1;(function ($) { 2 3 $(document).ready(ready); 4 5 function ready() { 6 7 let searchForm = $('form.liquid-wc-product-search'), 8 searchFieldInput = $('[id*=liquid-wc-product-search-field-input-]'), 9 searchFieldSelect = $('[id*=liquid-wc-product-search-field-select-]'), 10 timeOut; 11 12 if (!searchForm.hasClass('liquid-wc-product-search-ajax-enabled')) return; 13 14 searchFieldInput.on('input', searchFieldInputChange); 15 searchFieldSelect.on('change', searchFieldInputChange); 16 $(window).on('click', hideSearchResults); 17 18 function searchFieldInputChange() { 19 let inputVal = searchFieldInput.val(); 20 21 if (timeOut) clearTimeout(timeOut); 22 23 if (inputVal.length > 2) { 24 timeOut = setTimeout(showSearchResults, 300); 25 } else { 26 hideSearchResults(); 27 } 28 } 29 30 function showSearchResults() { 31 32 hideSearchResults(); 33 34 $.ajax({ 35 type: "post", 36 url: wcLiquid.ajaxUrl, 37 data: { 38 action: "liquid_wc_get_products_by_input_text", 39 searchText: searchFieldInput.val(), 40 termId: searchFieldSelect.find('option:selected').data('term-id') 41 }, 42 beforeSend: function () { 43 searchForm.addClass('loading'); 44 }, 45 success: function (response) { 46 if (response.success === true) { 47 searchForm.append(response.data.html); 48 viewAllInit(); 49 searchForm.removeClass('loading'); 50 } 51 } 52 }); 53 } 54 55 function hideSearchResults() { 56 $('.liquid-wc-product-search-results').remove(); 57 } 58 59 function viewAllInit() { 60 $(document).on('click', '.ld-wc-search-view-all', function (e) { 61 e.preventDefault(); 62 searchForm.trigger('submit'); 63 }); 64 } 65 66 } 67 68})(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.