1(function () { 2 "use strict"; 3 4 function normalizeSearchValue(value) { 5 return String(value || "").trim(); 6 } 7 8 function updateFormState(form) { 9 var input = form.querySelector("[data-site-search-input]"); 10 var submit = form.querySelector("[data-site-search-submit]"); 11 var minLength = parseInt(form.getAttribute("data-search-min-length") || "3", 10); 12 var isValid = input && normalizeSearchValue(input.value).length >= minLength; 13 14 if (submit) { 15 submit.disabled = !isValid; 16 submit.setAttribute("aria-disabled", isValid ? "false" : "true"); 17 } 18 19 return isValid; 20 } 21 22 document.querySelectorAll("[data-site-search-form]").forEach(function (form) { 23 var input = form.querySelector("[data-site-search-input]"); 24 25 if (!input) { 26 return; 27 } 28 29 updateFormState(form); 30 31 input.addEventListener("input", function () { 32 updateFormState(form); 33 }); 34 35 form.addEventListener("submit", function (event) { 36 if (!updateFormState(form)) { 37 event.preventDefault(); 38 } 39 }); 40 }); 41})();
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.