From 1166e31315e732113112ec0a317b67445d3b9f58 Mon Sep 17 00:00:00 2001 From: rdrew Date: Fri, 6 Mar 2026 10:42:13 -0400 Subject: [PATCH] mirador fix --- js/mirador-mods.js | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/js/mirador-mods.js b/js/mirador-mods.js index 00f4964..4063649 100755 --- a/js/mirador-mods.js +++ b/js/mirador-mods.js @@ -1,12 +1,32 @@ +//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(".mirador31"); + const searchPanel = document.querySelector("div.mirador31"); const searchPanelToggle = document.querySelector("button.mirador34"); - const searchPanelIcon = document.querySelector("button.MuiButtonBase-root.MuiTab-root.mirador26 svg"); + // const searchPanelIcon = document.querySelector("button.MuiButtonBase-root.MuiTab-root.mirador26 svg"); // hide the panel searchPanel.style.display = "none"; searchPanel.style.transform = "translateX(0px)"; @@ -16,10 +36,11 @@ window.addEventListener("load", (event) => { searchPanelToggle.setAttribute("aria-label", "Expand sidebar"); searchPanelToggle.setAttribute("title", "Expand sidebar"); - searchPanelIcon.style.fontSize = "2.7em"; - searchPanelIcon.style.marginTop = "21px"; + //searchPanelIcon.style.fontSize = "2.7em"; + //searchPanelIcon.style.marginTop = "21px"; + // //fake click searchPanelToggle.click(); - - }); +*/ +