diff options
Diffstat (limited to 'ratatoeskr/js')
-rw-r--r-- | ratatoeskr/js/backend.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ratatoeskr/js/backend.js b/ratatoeskr/js/backend.js index d131bfe..43e2544 100644 --- a/ratatoeskr/js/backend.js +++ b/ratatoeskr/js/backend.js @@ -16,4 +16,42 @@ $(function() $("div.articleeditor-metabar-element-content", self.parent()).show("fast"); } }); + + function filtertable(table, pairs) + { + $.each(pairs, function(idx, pair) + { + input = pair[0]; + column = pair[1]; + + (function(column){input.keyup(function() + { + filterby = $(this).val().toLowerCase(); + $("tbody tr", table).each(function(i) + { + if($("td", this).eq(column).text().toLowerCase().indexOf(filterby) == -1) + $(this).hide() + else + $(this).show(); + }); + });})(column); + }); + } + + $("#articlestable").each(function(i) + { + filtertable( + $("table", this), + [ + [$("input[name=filter_urlname]", this), 1], + [$("input[name=filter_tag]", this), 4], + [$("input[name=filter_section]", this), 5] + ] + ); + }); + + $("#commentstable").each(function(i) + { + filtertable($("table", this), [[$("input[name=filter_article]", this), 7]]); + }); });
\ No newline at end of file |