1jQuery(document).ready(function($){const $searchInput=$('#custom-search-input');const $resultsBox=$('#custom-search-results');let lastRequest=null;$searchInput.on('input',function(){const query=$.trim($(this).val());if(query.length<2){$resultsBox.html('').hide();return} 2$searchInput.addClass('loading');if(lastRequest){lastRequest.abort()} 3lastRequest=$.ajax({url:customSearchAjax.ajax_url,method:'GET',data:{action:'custom_search_suggestions',term:query},dataType:'json',success:function(data){$resultsBox.html('');if(data.length>0){for(let i=0;i<data.length;i++){const title=data[i].title.replace(new RegExp(query,'gi'),(match)=>`<strong>${match}</strong>`);const meta=data[i].meta.replace(new RegExp(query,'gi'),(match)=>`<strong>${match}</strong>`);const $el=$(` 4 <div class="search-suggestion"> 5 <a href="${data[i].permalink}">${title} <span class="meta">(${meta})</span></a> 6 </div> 7 `);$resultsBox.append($el)} 8$resultsBox.show()}else{$resultsBox.html('<div class="no-results">No suggestions found. Press Enter to search.</div>').show()}},error:function(xhr,status,error){if(status!=='abort'){console.error('Search failed:',error)}},complete:function(){$searchInput.removeClass('loading')}})});$searchInput.on('focus',function(){const query=$.trim($(this).val());if(query.length>=2&&$resultsBox.children().length>0){$resultsBox.show()}});$(document).on('click',function(e){if(!$resultsBox.is(e.target)&&$resultsBox.has(e.target).length===0&&!$searchInput.is(e.target)&&$searchInput.has(e.target).length===0){$resultsBox.hide()}});$searchInput.on('keypress',function(e){if(e.which===13){const query=$.trim($(this).val());if(query.length>=2){window.location.href='/?s='+encodeURIComponent(query)}}})})
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.