Browse Source

tidy

master
rdrew 1 week ago
parent
commit
d16485d1a1
  1. 48
      js/mirador-mods.js

48
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
testing
window.addEventListener("load", (event) => { window.addEventListener("load", (event) => {
// find elements // find elements
const searchPanel = document.querySelector("div.mirador31"); const searchPanel = document.querySelector("div.mirador31");
@ -21,28 +41,6 @@ window.addEventListener("load", (event) => {
// //
//fake click //fake click
searchPanelToggle.click(); searchPanelToggle.click();
}); });
*/ */
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();
});

Loading…
Cancel
Save