Parts V to IX in the book, extension 2.9.1, Demo topics
Add chapters 05-08 to the three language profiles: the published book stopped at Part IV because only 00-04 were listed. Rename the MQTT topic root Tutorial/ to Demo/ in Part IX (code and output included). Shared notes extension 2.9.1: dependency folders are named after the extension version, so browsers stop serving stale scripts after an update. Full rebuild of _book/ (HTML and PDF, three languages); remove the stray site_libs/ that the last Deploy commit had added at the project root. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
01f681165f
commit
f047b9c7ae
128 files changed
+18893
-7591
No files matched your search
@@ -0,0 +1,39 @@
|
||||
// exo — hints unlock one by one within a part; 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 of a part unlocks hint n+1 of the same part, wherever it
|
||||
// sits in the exercise (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 chain = d.getAttribute("data-exo-chain");
|
||||
var n = parseInt(d.getAttribute("data-exo-hint"), 10);
|
||||
if (!chain || isNaN(n)) return;
|
||||
var hints = document.querySelectorAll("details.exo-hint[data-exo-chain]");
|
||||
for (var i = 0; i < hints.length; i++) {
|
||||
if (hints[i].getAttribute("data-exo-chain") === chain &&
|
||||
parseInt(hints[i].getAttribute("data-exo-hint"), 10) === n + 1) {
|
||||
hints[i].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;
|
||||
});
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user