1(function($) { 2 Drupal.behaviors.custom_search = { 3 attach: function(context) { 4 5 if (!Drupal.settings.custom_search.solr) { 6 // Check if the search box is not empty on submit 7 $('form.search-form', context).submit(function(){ 8 var $this = $(this); 9 var box = $this.find('input.custom-search-box'); 10 if (box.val() != undefined && box.val() == '') { 11 $this.find('input.custom-search-box').addClass('error'); 12 return false; 13 } 14 // If basic search is hidden, copy or value to the keys 15 if ($this.find('#edit-keys').parents('div.element-invisible').attr('class') == 'element-invisible') { 16 $this.find('#edit-keys').val($this.find('#edit-or').val()); 17 $this.find('#edit-or').val(''); 18 } 19 return true; 20 }); 21 } 22 23 // Search from target 24 $('form.search-form').attr('target', Drupal.settings.custom_search.form_target); 25 26 // Displays Popup. 27 $('form.search-form input.custom-search-box', context).bind('click focus', function(e){ 28 var $parentForm = $(this).parents('form'); 29 // check if there's something in the popup and displays it 30 var popup = $parentForm.find('fieldset.custom_search-popup'); 31 if (popup.find('input,select').length && !popup.hasClass('opened')) { 32 popup.fadeIn().addClass('opened'); 33 } 34 e.stopPropagation(); 35 }); 36 $(document).bind('click focus', function(){ 37 $('fieldset.custom_search-popup').hide().removeClass('opened'); 38 }); 39 40 // Handle checkboxes 41 $('.custom-search-selector input:checkbox', context).each(function(){ 42 var el = $(this); 43 if (el.val() == 'c-all') { 44 el.change(function(){ 45 $(this).parents('.custom-search-selector').find('input:checkbox[value!=c-all]').attr('checked', false); 46 }); 47 } 48 else { 49 if (el.val().substr(0,2) == 'c-') { 50 el.change(function(){ 51 $('.custom-search-selector input:checkbox').each(function(){ 52 if ($(this).val().substr(0,2) == 'o-') { 53 $(this).attr('checked', false); 54 } 55 }); 56 $(this).parents('.custom-search-selector').find('input:checkbox[value=c-all]').attr('checked', false); 57 }); 58 } else { 59 el.change(function(){ 60 $(this).parents('.custom-search-selector').find('input:checkbox[value!=' + el.val() + ']').attr('checked', false); 61 }); 62 } 63 } 64 }); 65 66 // Handle popup. 67 var popup = $('fieldset.custom_search-popup:not(.custom_search-processed)', context).addClass("custom_search-processed"); 68 popup.click(function(e){ 69 e.stopPropagation(); 70 }) 71 popup.append('<a class="custom_search-popup-close" href="#">' + Drupal.t('Close') + '</a>'); 72 $('a.custom_search-popup-close').click(function(e){ 73 $('fieldset.custom_search-popup.opened').hide().removeClass('opened'); 74 e.preventDefault(); 75 }); 76 77 } 78 } 79})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.