Change folder hierarchy

This commit is contained in:
2026-09-14 08:04:43 +02:00
parent 7178558330
commit d457cf20c5
12 changed files with 0 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
// exo — hints unlock one by one; everything unfolds for printing
(function () {
// block opening a locked hint
document.addEventListener("click", function (e) {
var s = e.target.closest ? e.target.closest("details.exo-hint.exo-locked > summary") : null;
if (s) e.preventDefault();
});
// opening hint n unlocks hint n+1 (toggle doesn't bubble: use capture)
document.addEventListener("toggle", function (e) {
var d = e.target;
if (!d.classList || !d.classList.contains("exo-hint") || !d.open) return;
var next = d.nextElementSibling;
while (next && !(next.tagName === "DETAILS" && next.classList.contains("exo-hint"))) {
next = next.nextElementSibling;
}
if (next) next.classList.remove("exo-locked");
}, true);
// print: open all hints/solutions, restore afterwards
window.addEventListener("beforeprint", function () {
document.querySelectorAll(".exo details").forEach(function (d) {
d.dataset.exoWasOpen = d.open ? "1" : "0";
d.open = true;
});
});
window.addEventListener("afterprint", function () {
document.querySelectorAll(".exo details").forEach(function (d) {
d.open = d.dataset.exoWasOpen === "1";
delete d.dataset.exoWasOpen;
});
});
})();