1document.addEventListener("DOMContentLoaded", () => { 2 const originalSortSelects = document.querySelectorAll(".form-select select"); 3 4 if (!originalSortSelects) return; 5 6 originalSortSelects.forEach((originalSelect) => { 7 const newSelect = originalSelect.nextElementSibling.lastElementChild; 8 const newSelectTitle = originalSelect.nextElementSibling.firstElementChild; 9 10 for (let index = 0; index < originalSelect.options.length; index++) { 11 const option = document.createElement("li"); 12 13 let optionText = originalSelect.options[index].text, 14 optionValue = originalSelect.options[index].value; 15 16 option.className = "form-select__option"; 17 option.textContent = optionText; 18 option.dataset.optionValue = optionValue; 19 20 newSelect.appendChild(option); 21 22 let event = new Event("change"); 23 24 option.addEventListener("click", () => { 25 newSelectTitle.firstElementChild.textContent = optionText; 26 originalSelect.value = optionValue; 27 originalSelect.dispatchEvent(event); 28 29 newSelectTitle.classList.remove("open"); 30 newSelect.classList.remove("open"); 31 }); 32 } 33 34 newSelectTitle.addEventListener("click", () => { 35 newSelectTitle.classList.toggle("open"); 36 newSelect.classList.toggle("open"); 37 }); 38 39 document.addEventListener("click", (event) => { 40 if (!event.target.closest(".form-select")) { 41 newSelectTitle.classList.remove("open"); 42 newSelect.classList.remove("open"); 43 } 44 }); 45 }); 46});
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.