1(function($) { 2 $(document).ready(function(){ 3 $("#search_query_top").autocomplete({ 4 source: function(){ 5 searchQueryAutocomplete($("#search_query_top")); 6 }, 7 minLenght: 3, 8 autoFocus: true 9 }); 10 11 $("#search_query_top_responsive").autocomplete({ 12 source: function(){ 13 searchQueryAutocomplete($("#search_query_top_responsive")); 14 }, 15 minLenght: 3, 16 autoFocus: true 17 }); 18 19 20 }); 21 22 function searchQueryAutocomplete($searchQueryTop){ 23 var lang_id = $('html').attr('lang'); 24 25 if(lang_id == "fr-FR"){ 26 lang_id = 5; 27 } else if(lang_id == "de-DE"){ 28 lang_id = 3; 29 } else if (lang_id == "en-US"){ 30 lang_id = 1; 31 } else { 32 lang_id = 1; 33 } 34 35 if ($searchQueryTop.val().length > 2){ 36 $searchQueryTop.addClass('ac_loading'); 37 } 38 $.ajax({ 39 url:"/modules/snsquicksearch/snsquicksearch_ajax.php", 40 dataType: "json", 41 data: { 42 ajaxSearch: 1, 43 id_lang: lang_id, 44 q: $searchQueryTop.val() 45 } 46 }).done(function(data) { 47 var $acResultsUl = $searchQueryTop.closest('form').next('.ac_results').find('ul'); 48 $acResultsUl.html(''); 49 var mytab = []; 50 51 for (var i = 0; i < data.length; i++) { 52 if (i < 5) { 53 mytab[mytab.length] = { data: data[i], value: '<li><a href="' + data[i].product_link + '"><div class="img"><img src="' + data[i].product_image + '" alt="' + data[i].pname + '" /></div>' + '<span class="ac_product_name">' + data[i].pname + '</span></a></li>' }; 54 $acResultsUl.append($(mytab[i].value)).show(); 55 } 56 } 57 $searchQueryTop.closest('form').next('.ac_results').show(); 58 59 /*$searchQueryTop.on('focusout', function(){ 60 $(this).closest('form').next('.ac_results').hide(); 61 });*/ 62 63 $searchQueryTop.removeClass('ac_loading'); 64 }); 65 } 66})(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.