1jQuery(document).ready(function($){ 2 let timer; 3 4 $(document).on('input', '.els-search', function(){ 5 const $input = $(this); 6 const term = $.trim($input.val()); 7 const $container = $input.closest('.els-search-container'); 8 const $results = $container.find('.els-results'); 9 const $spinner = $container.find('.els-spinner'); 10 const $clear = $container.find('.els-clear'); 11 12 if(term.length > 0){ 13 $clear.show(); 14 } else { 15 $clear.hide(); 16 } 17 18 if(term.length < 3){ 19 $spinner.hide(); 20 $results.hide().html(''); 21 return; 22 } 23 24 clearTimeout(timer); 25 26 timer = setTimeout(function(){ 27 $.ajax({ 28 url: els_ajax.ajax_url, 29 type: 'POST', 30 data: { 31 action: 'els_search', 32 term: term 33 }, 34beforeSend: function(){ 35 $spinner.show(); 36 $container.find('.els-search-icon').hide(); 37 38 $results.html('<div style="padding:10px;color:#fff;">Söker...</div>').show(); 39}, 40success: function(response){ 41 $spinner.hide(); 42 $container.find('.els-search-icon').show(); 43 44 if($.trim(response) !== ''){ 45 $results.html(response).show(); 46 } else { 47 $results.hide().html(''); 48 } 49 }, 50 error: function(){ 51 $spinner.hide(); 52 $results.html('<div style="padding:10px;color:#fff;">Fel vid sökning</div>').show(); 53 } 54 }); 55 }, 300); 56 }); 57 58 $(document).on('click', '.els-clear', function(){ 59 const $container = $(this).closest('.els-search-container'); 60 $container.find('.els-search').val(''); 61 $container.find('.els-results').hide().html(''); 62 $container.find('.els-spinner').hide(); 63 $(this).hide(); 64 }); 65 66 $(document).on('click', function(e){ 67 if(!$(e.target).closest('.els-search-container').length){ 68 $('.els-results').hide(); 69 } 70 }); 71});
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.