This commit is contained in:
@@ -151,36 +151,11 @@
|
||||
});
|
||||
}
|
||||
|
||||
function initModeToggle() {
|
||||
const root = document.documentElement;
|
||||
const button = document.getElementById("db-mode-toggle");
|
||||
const label = document.getElementById("db-mode-label");
|
||||
if (!root || !button) return;
|
||||
|
||||
const storageKey = "db-mode";
|
||||
const saved = localStorage.getItem(storageKey);
|
||||
|
||||
const setMode = (mode) => {
|
||||
const isRetro = mode === "retro";
|
||||
root.dataset.mode = isRetro ? "retro" : "normal";
|
||||
button.setAttribute("aria-pressed", String(isRetro));
|
||||
button.setAttribute("title", isRetro ? "Switch to normal mode" : "Switch to retro mode");
|
||||
if (label) label.textContent = isRetro ? "Normal mode" : "Retro mode";
|
||||
localStorage.setItem(storageKey, root.dataset.mode);
|
||||
};
|
||||
|
||||
setMode(saved === "retro" ? "retro" : "normal");
|
||||
button.addEventListener("click", () => {
|
||||
setMode(root.dataset.mode === "retro" ? "normal" : "retro");
|
||||
});
|
||||
}
|
||||
|
||||
function init() {
|
||||
updateGreeting();
|
||||
updateClock();
|
||||
updateStats();
|
||||
initCommandFilter();
|
||||
initModeToggle();
|
||||
|
||||
setInterval(updateClock, 1000);
|
||||
loadFeed("/blogs/blogs-list.html", "db-feed-blogs", 6, "/blogs");
|
||||
|
||||
Reference in New Issue
Block a user