X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=templates%2Fall_checkboxes.html.ep;h=ac67713170444232267f4c9414a894c05d23420c;hb=4fde37c9ffd336ea4155bb1398da758d15091eb8;hp=390b02fc819fe8c98ca3cce0801fd18c7c961b7b;hpb=b4f706b083cab95da64aebbd2ae6b11de531b2e7;p=MojoFacets.git diff --git a/templates/all_checkboxes.html.ep b/templates/all_checkboxes.html.ep index 390b02f..ac67713 100644 --- a/templates/all_checkboxes.html.ep +++ b/templates/all_checkboxes.html.ep @@ -69,17 +69,15 @@ $('a#excluded').click( function(){ // regex for column names -var apply_regex = function(e) { - var v = this.value; - console.debug( this, e, v ); +var filter_regex = function(user_regex) { - if ( v.length == 0 ) return false; + if ( user_regex == '' ) return false; - var r = new RegExp( v,'i'); + var r = new RegExp( user_regex,'i'); var included = 0; var excluded = 0; $("input[type='checkbox']:not([disabled='disabled'])").each( function(i,element){ - if ( r.test( v ) ) { + if ( r.test( this.value ) ) { $(this).parent().removeClass('excluded').addClass('included'); included++; } else { @@ -90,17 +88,19 @@ var apply_regex = function(e) { $('a#included').text(included).show(); $('a#excluded').text(excluded).show(); - return false; + + console.debug('filter_regex',included,excluded); }; $('input[name=filter_regex]') -.focusout( apply_regex ) +.focusout( function(e) { filter_regex( this.value ) } ) .keypress( function(e) { // disable enter var code = e.keyCode ? e.keyCode : e.which; //console.debug('key code',code); if ( code == 13 ) { - return apply_regex(e); + filter_regex( this.value ); + return false; } else { return true; }