diff options
author | Alan Pearce | 2025-03-29 13:19:21 +0100 |
---|---|---|
committer | Alan Pearce | 2025-03-29 13:19:21 +0100 |
commit | 807a691936113eecb43b6a64e2f4524a68a9a0d1 (patch) | |
tree | cc874d9635cddddb2bc35329501d2f153a4fc094 /frontend | |
parent | eb130a451eb27fbbfb5467420e7e166d545ef938 (diff) | |
download | searchix-main.tar.lz searchix-main.tar.zst searchix-main.zip |
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/static/search.js | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/frontend/static/search.js b/frontend/static/search.js index 0bf4a5e..41f40bc 100644 --- a/frontend/static/search.js +++ b/frontend/static/search.js @@ -18,7 +18,6 @@ let state = history.state || { url: urlLocation.toString(), input: urlLocation.searchParams.get("query"), results: resultsRange.cloneContents().innerHTML || null, - opened: [], }; let escapePolicy = null; @@ -105,7 +104,6 @@ async function getResults(url) { // render errors sent as HTML as well as OK responses if (res.headers.get("content-type").startsWith("text/html")) { state.results = await res.text(); - state.opened = []; history.replaceState(state, null, url); renderResults(state.results); } else { @@ -155,7 +153,7 @@ document.querySelector("a.current").addEventListener("click", function (ev) { state.results = ""; history.pushState(state, null, ev.target.href); ev.preventDefault(); - document.querySelectorAll("nav > a:not(.current)").forEach(function (node) { + nav.querySelectorAll("a:not(.current)").forEach(function (node) { const u = new URL(node.href); u.search = ""; node.href = u.toString(); @@ -218,14 +216,6 @@ function handleDialogOpen(ev) { } } -if (state.opened.length > 0) { - state.opened.forEach((id) => - document.getElementById(id).setAttribute("open", "open"), - ); -} else if (location.hash) { - document.getElementById(location.hash.slice(1)).setAttribute("open", "open"); -} - addEventListener("popstate", function (ev) { if (ev.state != null) { url = new URL(ev.state.url); |