1(function () { 2 const clearAll = document.getElementById("clear-all"); 3 const categoriesForm = document.getElementById("news-form"); 4 const urlParams = new URLSearchParams(window.location.search); 5 const hasSearch = urlParams.get("keywords"); 6 7 if (hasSearch || aBoxIsTicked()) { 8 showButton(); 9 } else { 10 hideButton(); 11 } 12 13 addListeners(); 14 15 // Add listeners 16 function addListeners() { 17 const checkboxes = categoriesForm.querySelectorAll("input[type='checkbox']"); 18 checkboxes.forEach(box => { 19 box.addEventListener("click", handleCheckboxClick); 20 }); 21 } 22 23 // Utility functions 24 function aBoxIsTicked() { 25 return categoriesForm.querySelectorAll("input[type='checkbox']:checked").length > 0; 26 } 27 28 function showButton() { 29 clearAll.style.visibility = "visible"; 30 } 31 32 function hideButton() { 33 clearAll.style.visibility = "hidden"; 34 } 35 36 // Event handler 37 function handleCheckboxClick() { 38 aBoxIsTicked() ? showButton() : hideButton(); 39 } 40})();
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.