1/** 2 * Salient search autocomplete 3 * 4 * @package Salient 5 * @author ThemeNectar 6 */ 7 /* global jQuery */ 8 9jQuery(document).ready(function ($) { 10 11 "use strict"; 12 13 if( $('#search-outer.nectar').length > 0 ) { 14 15 var acs_action = 'myprefix_autocompletesearch'; 16 17 $("body").on('focus','#s',function() { 18 19 if( !$(this).hasClass('ui-autocomplete-input') ) { 20 21 $(this).autocomplete({ 22 delay: 50, 23 position: {of: "#search-outer #search .container" }, 24 appendTo: $("#search-box"), 25 source: function(req, response){ 26 $.getJSON(MyAcSearch.url+'?callback=?&action='+acs_action, req, response); 27 }, 28 select: function(event, ui) { 29 if( ui.item.target == '_blank' ) { 30 window.open(ui.item.link); 31 } else { 32 window.location.href = ui.item.link; 33 } 34 35 }, 36 minLength: 2, 37 }).data( "ui-autocomplete" )._renderItem = function( ul, item ) { 38 return $( "<li>" ) 39 .append( "<a>" + item.image + "<span class='title'>" + item.label + "</span><br/><span class='desc'>" + item.post_type + "</span> </a>" ) 40 .appendTo( ul ); 41 }; 42 43 } 44 45 }); 46 47 } 48 49});
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.