diff --git a/app/assets/javascripts/saved_searches.js b/app/assets/javascripts/saved_searches.js new file mode 100644 index 000000000..d413096c1 --- /dev/null +++ b/app/assets/javascripts/saved_searches.js @@ -0,0 +1,5 @@ +$(document).ready(function() { + if ($("#c-saved-searches".length)) { + Danbooru.sorttable($("#c-saved-searches table")); + } +}); diff --git a/app/assets/javascripts/utility.js b/app/assets/javascripts/utility.js index f74d5eb41..b9ecd6b52 100644 --- a/app/assets/javascripts/utility.js +++ b/app/assets/javascripts/utility.js @@ -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; diff --git a/app/views/saved_searches/index.html.erb b/app/views/saved_searches/index.html.erb index 807e8e643..b3e59e74b 100644 --- a/app/views/saved_searches/index.html.erb +++ b/app/views/saved_searches/index.html.erb @@ -10,8 +10,8 @@
| Query | -Labels | +Query | +Labels |
|---|