Night-mode styling, French cross-references, and the log through Part VI
- theme.scss and figures draw with the extension's --calc-… tokens; light/dark pair plus the high-contrast button; a11y highlight style for html - figure labels split so none leaves its viewBox in any language - _quarto-fr.yml: French cross-reference prefixes - notes extension synced to 2.8.18 - conv/: Parts IV, V and VI logged, pasted terminal output redacted Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
afb816f459
commit
f7fa60ba81
62 files changed
+3552
-852
No files matched your search
@@ -13,3 +13,58 @@
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
// --- 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(); }
|
||||
})();
|
||||
Reference in new issue
Block a user