diff options
author | tyron <tyronx@gmail.com> | 2011-05-18 16:25:15 +0400 |
---|---|---|
committer | tyron <tyronx@gmail.com> | 2011-05-18 16:25:15 +0400 |
commit | d10e62ca37817c251cc3483b5d8ceea035759f9b (patch) | |
tree | 3ca8e4f817fb3873b47dfeeb72c7d448862c4fe3 /js/server_variables.js | |
parent | c0749d556378341727982e9ea08bb1de08e7c5ea (diff) |
Added variable filtering for the 'Variables' Page
Diffstat (limited to 'js/server_variables.js')
-rw-r--r-- | js/server_variables.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/js/server_variables.js b/js/server_variables.js new file mode 100644 index 0000000000..1877ce7fb8 --- /dev/null +++ b/js/server_variables.js @@ -0,0 +1,42 @@ +$(function() {
+ var textFilter=null;
+ var odd_row=false;
+
+ // Filter options are invisible for disabled js users
+ $('fieldset#tableFilter').css('display','');
+
+ $('#filterText').keyup(function(e) {
+ if($(this).val().length==0) textFilter=null;
+ else textFilter = new RegExp("(^| )"+$(this).val(),'i');
+ filterVariables();
+ });
+
+ function filterVariables() {
+ odd_row=false;
+ var mark_next=false;
+ var firstCell;
+
+ $('table.filteredData tbody tr').each(function() {
+ firstCell = $(this).children(':first');
+
+ if(mark_next || textFilter==null || textFilter.exec(firstCell.text())) {
+ // If current row is 'marked', also display next row
+ if($(this).hasClass('marked') && !mark_next)
+ mark_next=true;
+ else mark_next=false;
+
+ odd_row = !odd_row;
+ $(this).css('display','');
+ if(odd_row) {
+ $(this).addClass('odd');
+ $(this).removeClass('even');
+ } else {
+ $(this).addClass('even');
+ $(this).removeClass('odd');
+ }
+ } else {
+ $(this).css('display','none');
+ }
+ });
+ }
+});
\ No newline at end of file |