X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=templates%2Fall_checkboxes.html.ep;h=13003363394b63366e831a27d0f9d2ddb3a8dd8c;hb=769929cfc8b7186c5283330863aeddd4969c2ed2;hp=d18fb32440583171b96fda608d725686996f5e97;hpb=dd94053ca40642c627077aadfed0ad7fb28ba070;p=MojoFacets.git diff --git a/templates/all_checkboxes.html.ep b/templates/all_checkboxes.html.ep index d18fb32..1300336 100644 --- a/templates/all_checkboxes.html.ep +++ b/templates/all_checkboxes.html.ep @@ -1,9 +1,84 @@ +all +none + + + + -all -none +$("input[type='checkbox']").bind( 'click', update_checked_count ); + +$('a#included').click( function(){ + $("label.included input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); + update_checked_count(1); +}).hide(); + +$('a#excluded').click( function(){ + $("label.excluded input[type='checkbox']:not([disabled='disabled'])").attr('checked', true); + update_checked_count(1); +}).hide(); + +$('input[name=filter_regex]').change( function(e) { + console.debug( this, e ); + var r = new RegExp( this.value ,'i'); + var included = 0; + var excluded = 0; + $("input[type='checkbox']:not([disabled='disabled'])").each( function(i,element){ + if ( r.test( this.value ) ) { + $(this).parent().removeClass('excluded').addClass('included'); + included++; + } else { + $(this).parent().removeClass('included').addClass('excluded'); + excluded++; + } + }); + + $('a#included').text(included).show(); + $('a#excluded').text(excluded).show(); +}); + +update_checked_count(1); + +}); // document.ready + +