make saved searches table sortable

This commit is contained in:
r888888888
2017-03-20 15:44:33 -07:00
parent c90de90291
commit 73895a1a27
3 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
$(document).ready(function() {
if ($("#c-saved-searches".length)) {
Danbooru.sorttable($("#c-saved-searches table"));
}
});

View File

@@ -120,6 +120,15 @@
}
};
Danbooru.sorttable = function(table) {
table.stupidtable();
table.bind("aftertablesort", function(event, data) {
$("#c-saved-searches table tbody tr").removeClass("even odd");
$("#c-saved-searches table tbody tr:even").addClass("even");
$("#c-saved-searches table tbody tr:odd").addClass("odd");
});
};
String.prototype.hash = function() {
var hash = 5381, i = this.length;

View File

@@ -10,8 +10,8 @@
<table class="striped" width="100%">
<thead>
<tr>
<th width="60%">Query</th>
<th width="20%">Labels</th>
<th data-sort="string" width="60%">Query</th>
<th data-sort="string" width="20%">Labels</th>
<th width="20%" class="links"></th>
</tr>
</thead>