Project

General

Profile

Feature #14339 » jquery_function.diff

jquery function for searching the watchers - Daniel Felix, 2013-06-24 15:52

View differences:

public/javascripts/watcher_search.js
1
function findWatchers(checking,searchtext){
2
  if(checking.text().toLowerCase().indexOf(searchtext) > -1){
3
    checking.removeClass("hidden").addClass("visible");
4
  }
5
}
6

  
7
$(document).ready(function(){
8
  $('#watchers_filter').keyup(function(e){
9
    var searchtext = $(this).val().toLowerCase();
10
    var elements = $('#watchers_inputs > label');
11

  
12
    elements.not('.hidden').addClass('hidden');
13
    elements.each(function(){
14
      findWatchers($(this),searchtext);
15
    })
16
  });
17

  
18
  $('#mark_all_watchers').click(function(){
19
    $('#watchers_inputs > label').not('.hidden').children('input:checkbox:not(:checked)').attr('checked','checked');
20
  });
21
});
(1-1/3)