ref: master
plugins/pg_search/public/search.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
(function($) { $('#facets input[type=checkbox]').live('change', function() { $('form.search_form').submit(); return false; }); $('#facets .period input').live('change', function() { $('form.search_form').submit(); return false; }); // Facet See all $('.facet .see-all').live('click', function() { var id = $(this).data('facet'); $('#see-all-' + id).toggle(); return false; }); // Facet Clear $('.facet .clear-facet').live('click', function() { var id = $(this).data('facet'); var update = $('#'+ id +' input[type="checkbox"]:checked').length > 0; $('#'+ id +' input[type="checkbox"]').attr('checked', false); $('#'+ id +' .facet-refine').val('').trigger('keyup'); if(update) $('form.search_form').submit(); return false; }); // Facet Refine $('.facet-refine').live('keypress', function(ev) { if(ev.key == 'Enter') return false; }); $('.facet-refine').live('keyup', function(ev) { var query = this.value.toLowerCase(); var block = $(this).parent().children('.facets-block'); block.children().each(function(index, element) { if($('label', element).text().toLowerCase().indexOf(query) >= 0) element.style.display = 'block'; else element.style.display = 'none'; }); }); })(jQuery); |