Spaces:
Sleeping
Sleeping
File size: 514 Bytes
7ee22ad | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | let theme = localStorage.getItem("nexus_theme") || "dark";
function applyTheme(t) {
theme = t;
document.body.className = t;
localStorage.setItem("nexus_theme", t);
}
document.addEventListener("DOMContentLoaded", async () => {
applyTheme(theme);
try {
const res = await fetch("/api/settings", { credentials: "include" });
if (res.ok) {
const data = await res.json();
if (data.settings && data.settings.theme) {
applyTheme(data.settings.theme);
}
}
} catch {}
});
|