about summary refs log tree commit diff stats
path: root/frontend
diff options
context:
space:
mode:
authorAlan Pearce2025-03-29 13:19:21 +0100
committerAlan Pearce2025-03-29 13:19:21 +0100
commit807a691936113eecb43b6a64e2f4524a68a9a0d1 (patch)
treecc874d9635cddddb2bc35329501d2f153a4fc094 /frontend
parenteb130a451eb27fbbfb5467420e7e166d545ef938 (diff)
downloadsearchix-main.tar.lz
searchix-main.tar.zst
searchix-main.zip
refactor(js): cleanup unused code HEAD main
Diffstat (limited to 'frontend')
-rw-r--r--frontend/static/search.js12
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);