1document.addEventListener('DOMContentLoaded', function () { 2 3 autoCompleteCity('billing_city'); 4 autoCompleteCity('shipping_city'); 5 6}); 7 8function autoCompleteCity(el) { 9 10 const input = document.querySelector('#' + el); 11 const awesomplete = new Awesomplete(input,{ 12 minChars: 1, 13 maxItems: 50 14 }); 15 16 console.log(el + " loaded.."); 17 18 input.addEventListener('input', function () { 19 20 console.log(el, input.value); 21 22 if (input.value.length >= 1) { 23 fetch(`${ajaxObject.ajaxUrl}?action=search_gov_cities&term=${input.value}`) 24 .then(response => response.json()) 25 .then(data => { 26 awesomplete.list = data; 27 }); 28 } 29 }); 30 31 input.addEventListener('awesomplete-selectcomplete', function (event) { 32 input.value = event.text.value; // Ensures the selected value is used 33 }); 34 35}
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.