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>
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
// calc-notes — open every note before printing, restore afterwards
|
|
(function () {
|
|
window.addEventListener("beforeprint", function () {
|
|
document.querySelectorAll("details.calc-note").forEach(function (d) {
|
|
d.dataset.calcWasOpen = d.open ? "1" : "0";
|
|
d.open = true;
|
|
});
|
|
});
|
|
window.addEventListener("afterprint", function () {
|
|
document.querySelectorAll("details.calc-note").forEach(function (d) {
|
|
d.open = d.dataset.calcWasOpen === "1";
|
|
delete d.dataset.calcWasOpen;
|
|
});
|
|
});
|
|
})();
|
|
|
|
// --- high contrast: a switch of its own, beside Quarto's light/dark one ----
|
|
// The class is already set before the first paint by the script calc-notes.lua
|
|
// puts in the head; this only builds the control and remembers a choice.
|
|
// Precedence: what the reader picked here, then `high-contrast: true` in the
|
|
// book, then the reader's system setting.
|
|
(function () {
|
|
var KEY = "notes-contrast";
|
|
var root = document.documentElement;
|
|
|
|
var LABELS = {
|
|
de: { on: "Hoher Kontrast aus", off: "Hoher Kontrast ein" },
|
|
fr: { on: "Désactiver le contraste élevé", off: "Activer le contraste élevé" },
|
|
en: { on: "Turn high contrast off", off: "Turn high contrast on" }
|
|
};
|
|
var lang = (root.lang || "en").slice(0, 2).toLowerCase();
|
|
var L = LABELS[lang] || LABELS.en;
|
|
|
|
function store(v) {
|
|
try { localStorage.setItem(KEY, v ? "more" : "normal"); } catch (e) {}
|
|
}
|
|
|
|
function paint() {
|
|
var on = root.classList.contains("hc");
|
|
document.querySelectorAll(".notes-contrast-toggle").forEach(function (b) {
|
|
b.setAttribute("aria-pressed", String(on));
|
|
b.setAttribute("title", on ? L.on : L.off);
|
|
b.setAttribute("aria-label", on ? L.on : L.off);
|
|
});
|
|
}
|
|
|
|
function build() {
|
|
var anchors = document.querySelectorAll(".quarto-color-scheme-toggle");
|
|
if (anchors.length === 0) return; // a page without Quarto's own tools
|
|
anchors.forEach(function (a) {
|
|
var b = document.createElement("button");
|
|
b.type = "button";
|
|
b.className = "quarto-navigation-tool px-1 notes-contrast-toggle";
|
|
// bootstrap-icons ships with these books; the glyph is the fallback
|
|
b.innerHTML = '<i class="bi bi-circle-half" aria-hidden="true"></i>';
|
|
b.addEventListener("click", function () {
|
|
var on = !root.classList.contains("hc");
|
|
root.classList.toggle("hc", on);
|
|
store(on);
|
|
paint();
|
|
});
|
|
a.parentNode.insertBefore(b, a.nextSibling);
|
|
});
|
|
paint();
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", build);
|
|
} else { build(); }
|
|
})();
|