1 <a id="all" href="#">all</a>
2 <a id="toggle" href="#">toggle</a>
3 <a id="none" href="#">none</a>
5 <label for=filter_regex>regex:
6 <input type=text name=filter_regex>
7 <span class=hint>tab or click outside to apply</span>
8 <a id="included" href="#" style="display:none">included</a>
9 <a id="excluded" href="#" style="display:none">excluded</a>
13 <script type="text/javascript">
15 $(document).ready( function(){
17 $('label span.hint').position({
23 $('a#all').click( function(){
24 $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', true);
25 $('#checked-count').text( $('#facet-count').text() );
28 $('a#none').click( function(){
29 $("input[type='checkbox']:not([disabled='disabled'])").attr('checked', false);
30 $('#checked-count').text( 0 );
33 $('a#toggle').click( function(){
35 $("input[type='checkbox']:not([disabled='disabled'])").each( function() {
36 this.checked = ! this.checked;
37 if ( this.checked ) count++;
39 $('#checked-count').text( count );
42 function update_checked_count(full) {
43 var count = $('#checked-count');
46 nr = $("label input[type='checkbox']:checked").length;
48 nr = parseInt( count.text() );
58 $("input[type='checkbox']").bind( 'click', update_checked_count );
60 $('a#included').click( function(){
61 $("label.included input[type='checkbox']:not([disabled='disabled'])").attr('checked', true);
62 update_checked_count(1);
65 $('a#excluded').click( function(){
66 $("label.excluded input[type='checkbox']:not([disabled='disabled'])").attr('checked', true);
67 update_checked_count(1);
70 $('input[name=filter_regex]').focusout( function(e) {
71 console.debug( this, e );
72 var r = new RegExp( this.value ,'i');
75 $("input[type='checkbox']:not([disabled='disabled'])").each( function(i,element){
76 if ( r.test( this.value ) ) {
77 $(this).parent().removeClass('excluded').addClass('included');
80 $(this).parent().removeClass('included').addClass('excluded');
85 $('a#included').text(included).show();
86 $('a#excluded').text(excluded).show();
89 update_checked_count(1);