');
let overlay = document.getElementById("overlay");
let jsonUrl = el.href.endsWith(".json") ? el.href : el.href + ".json";
fetch(jsonUrl)
.then((response) => response.text())
.then((data) => {
let json = JSON.parse(data);
if (json.content) {
overlay.querySelector(".htmlContent").innerHTML = json.content;
}
})
.catch(() => console.error("Failed to load overlay content"));
}
function goOverlayIframe(e, el) {
e.preventDefault();
document.body.insertAdjacentHTML("beforeend", '
');
document.querySelector("#overlay iframe").src = el.href;
}
function toggleCheckboxParent(e, el) {
e.preventDefault();
let ref = el.dataset.ref;
if (ref) document.querySelector(ref).click();
}
function killOverlay(e) {
if (e) e.preventDefault();
let overlay = document.getElementById("overlay");
if (overlay) overlay.remove();
}