1(function ($) { 2 3 var splitValues = Drupal.autocomplete.splitValues; 4 5 Drupal.behaviors.autocompleteSupervisor = { 6 attach: function (context) { 7 let elements = once('search_block', '.js-search-block-form', context); 8 elements.forEach((element) => { 9 const urlParams = new URLSearchParams(window.location.search); 10 const searchQuery = urlParams.get('search'); 11 if (searchQuery) { 12 element.querySelector('input[name="search"]').value = searchQuery; 13 } 14 }); 15 $('input[name="search"]', context).bind('autocompleteselect', function(event, node) { 16 if($(node.item.label).hasClass('search_block_link')){ 17 var link = $(node.item.label).attr('href'); 18 if(link){ 19 window.location = link; 20 } 21 } 22 }); 23 $(once('search_block_autocomplete', 'input.search_block_autocomplete')).each(function(){ 24 $(this).autocomplete('option','appendTo',$(this).parent()); 25 }); 26 } 27 }; 28 29 Drupal.autocomplete.splitValues = function (value) { 30 var result = []; 31 var searchText = $('input.search_block_autocomplete').val(); 32 if(searchText && searchText === value) { 33 result.push($.trim(value)); 34 } else { 35 result = splitValues.apply(this, arguments); 36 } 37 return result; 38 } 39 40})(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.