Add Docker Compose setup
This commit is contained in:
commit
91e67968ca
17 changed files with 2683 additions and 0 deletions
26
theme.js
Normal file
26
theme.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
(function () {
|
||||
const KEY = "frenchJourney.theme";
|
||||
const root = document.documentElement;
|
||||
|
||||
function apply(theme) {
|
||||
root.dataset.theme = theme;
|
||||
localStorage.setItem(KEY, theme);
|
||||
const button = document.querySelector("[data-theme-toggle]");
|
||||
if (button) {
|
||||
const dark = theme === "dark";
|
||||
button.textContent = dark ? "Light" : "Dark";
|
||||
button.setAttribute("aria-pressed", String(dark));
|
||||
}
|
||||
}
|
||||
|
||||
const saved = localStorage.getItem(KEY);
|
||||
const preferred = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
apply(saved || preferred);
|
||||
|
||||
window.addEventListener("DOMContentLoaded", () => {
|
||||
const button = document.querySelector("[data-theme-toggle]");
|
||||
if (!button) return;
|
||||
button.onclick = () => apply(root.dataset.theme === "dark" ? "light" : "dark");
|
||||
apply(root.dataset.theme || "light");
|
||||
});
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue