()
| 5764 | }; |
| 5765 | |
| 5766 | const applyFilter = () => { |
| 5767 | const query = normalizeAdminSearchText(input.value); |
| 5768 | if (!query) { |
| 5769 | restoreState(); |
| 5770 | updateToggleState(); |
| 5771 | return; |
| 5772 | } |
| 5773 | |
| 5774 | let matches = 0; |
| 5775 | ids.forEach(id => { |
| 5776 | const hdr = document.getElementById(id + "Header"); |
| 5777 | const cnt = document.getElementById(id + "Content"); |
| 5778 | if (!hdr || !cnt) return; |
| 5779 | if (hdr.dataset.prevCollapsed === undefined) { |
| 5780 | hdr.dataset.prevCollapsed = hdr.classList.contains("collapsed") ? "1" : "0"; |
| 5781 | } |
| 5782 | |
| 5783 | const haystack = normalizeAdminSearchText(hdr.textContent + " " + cnt.textContent); |
| 5784 | const match = haystack.includes(query); |
| 5785 | hdr.style.display = match ? "" : "none"; |
| 5786 | setSectionContentImmediate(cnt, match); |
| 5787 | if (match) { |
| 5788 | hdr.classList.remove("collapsed"); |
| 5789 | matches += 1; |
| 5790 | if (id === "shareLinks" && !cnt.dataset.loaded) { |
| 5791 | loadShareLinksSection(); |
| 5792 | cnt.dataset.loaded = "1"; |
| 5793 | } |
| 5794 | } |
| 5795 | }); |
| 5796 | |
| 5797 | if (emptyState) emptyState.style.display = matches ? "none" : "block"; |
| 5798 | updateToggleState(); |
| 5799 | }; |
| 5800 | |
| 5801 | const clearSearch = (opts = {}) => { |
| 5802 | input.value = ""; |
no test coverage detected