From 6cd53d868dbbc5364f3854f391a943203d068bf0 Mon Sep 17 00:00:00 2001 From: rdrew Date: Fri, 6 Mar 2026 11:24:22 -0400 Subject: [PATCH] mirador fix --- js/mirador-mods.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/js/mirador-mods.js b/js/mirador-mods.js index 276244d..4063649 100755 --- a/js/mirador-mods.js +++ b/js/mirador-mods.js @@ -1,7 +1,27 @@ +//This code waits for the viewer to load with the search panel open, then it closes the search 'companion window' +//leaving the search icon visible. This combo is not available in the configs +window.addEventListener("load", () => { + const tryInit = (attempts = 0) => { + const searchPanel = document.querySelector("div.mirador31"); + const searchPanelToggle = document.querySelector("button.mirador34"); + + if (!searchPanel || !searchPanelToggle) { + if (attempts < 20) setTimeout(() => tryInit(attempts + 1), 250); + return; + } + + searchPanel.style.display = "none"; + searchPanel.style.visibility = "hidden"; + searchPanelToggle.setAttribute("aria-expanded", "false"); + searchPanelToggle.setAttribute("aria-label", "Expand sidebar"); + searchPanelToggle.setAttribute("title", "Expand sidebar"); + searchPanelToggle.click(); + }; + + tryInit(); +}); + /* -This code waits for the viewer to load with the search panel open, then it closes the search 'companion window' -leaving the search icon visible. This combo is not available in the configs -*/ window.addEventListener("load", (event) => { // find elements const searchPanel = document.querySelector("div.mirador31"); @@ -21,5 +41,6 @@ window.addEventListener("load", (event) => { // //fake click searchPanelToggle.click(); - }); +*/ +