save settings in url
This commit is contained in:
parent
621feae15b
commit
168d93e01a
|
@ -1,7 +1,7 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Packages > Search > !main-distribution > !main-tests</title>
|
||||
<title>Packages</title>
|
||||
<script src="/sorttable.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
|
||||
<script src="/index.js"></script>
|
||||
|
@ -9,29 +9,28 @@
|
|||
</head>
|
||||
<body>
|
||||
<div class="breadcrumb">
|
||||
<span><a href="/">Packages</a></span> >
|
||||
<span>Search</span>
|
||||
<span><a href="/">Packages</a></span>
|
||||
|
||||
<span id="logout">jay.mccarthy@gmail.com | <a href="/curate">curate</a> | <a href="/rss">rss</a> | <a href="/account/login">re-login</a> | <a href="/account/logout">logout</a></span>
|
||||
<span id="logout">jay.mccarthy@gmail.com | <a href="/upload">upload</a> | <a href="/update">update</a> | <a href="/account/logout">logout</a> </span>
|
||||
</div>
|
||||
<div id="menu"><span class="menu_option"><a href="/manage">Manage Your Packages</a></span>
|
||||
</form></div>
|
||||
<p id="search_menu"></p>
|
||||
<table class="packages sortable">
|
||||
<thead><tr>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Package</th>
|
||||
<th>Authors</th>
|
||||
<th>Description</th>
|
||||
<th>Tags</th>
|
||||
</tr></thead>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="packages_table">
|
||||
</tbody>
|
||||
<tfoot></tfoot>
|
||||
</table>
|
||||
<div id="footer">
|
||||
Powered by <a href="http://racket-lang.org">Racket</a> and a
|
||||
mess of ugly JS. Written
|
||||
by <a href="http://faculty.cs.byu.edu/~jay">Jay McCarthy</a>.
|
||||
<a href="/rss">RSS</a> feed available.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,12 +1,31 @@
|
|||
// xxx curate
|
||||
// xxx display curation if allowed
|
||||
// xxx display conflicts as a tag
|
||||
// xxx rss
|
||||
// xxx re-login
|
||||
// xxx logout
|
||||
// xxx what user am i
|
||||
// xxx manage packages
|
||||
// xxx upload
|
||||
// xxx update
|
||||
|
||||
$( document ).ready(function() {
|
||||
var search_terms = { "!main-tests": true, "!main-distribution": true };
|
||||
var search_terms = { };
|
||||
{ var h = window.location.hash;
|
||||
if ( h == "" ) {
|
||||
search_terms["!main-tests"] = true;
|
||||
search_terms["!main-distribution"] = true; }
|
||||
else {
|
||||
h = h.substring(1);
|
||||
console.log(h);
|
||||
while ( h != "" ) {
|
||||
if ( h.charAt(0) == "(" ) {
|
||||
var end = 1;
|
||||
while ( h.charAt(end) != ")" ) {
|
||||
end++;
|
||||
if ( ! h.charAt(end) ) { break; } }
|
||||
console.log( h, end, h.substring(1, end), h.substring(end) );
|
||||
search_terms[ h.substring(1, end) ] = true;
|
||||
h = h.substring(end+1); }
|
||||
else {
|
||||
h = ""; } } } }
|
||||
|
||||
function filterlink ( text, tclass, f ) {
|
||||
return [$('<a>', { text: text,
|
||||
|
@ -61,8 +80,6 @@ $( document ).ready(function() {
|
|||
else {
|
||||
shown_terms[ term ] = -1; } });
|
||||
|
||||
// xxx handle search button
|
||||
|
||||
var shown_terms_keys = object_keys(shown_terms);
|
||||
var shown_terms_skeys = shown_terms_keys.sort(function(a,b) {
|
||||
var va = shown_terms[a];
|
||||
|
@ -72,11 +89,14 @@ $( document ).ready(function() {
|
|||
else if ( va < 0 ) { return -1; }
|
||||
else if ( vb < 0 ) { return 1; } });
|
||||
|
||||
window.location.hash = "";
|
||||
$("#search_menu").html("").append( $.map( shown_terms_skeys, function ( term, i ) {
|
||||
if ( shown_terms[term] < 0 ) {
|
||||
if ( shown_terms[term] == -1 ) {
|
||||
window.location.hash = window.location.hash + "(" + term + ")";
|
||||
return changefilterlink ( term, term, "!" + term, "active" ); }
|
||||
else {
|
||||
window.location.hash = window.location.hash + "(" + "!" + term + ")";
|
||||
return removefilterlink ( term, "!" + term, "inactive" ); } }
|
||||
else {
|
||||
return addfilterlink ( term, term, "possible" ); } } ) );
|
||||
|
|
Loading…
Reference in New Issue
Block a user