Initial commit.
This commit is contained in:
18
app/static/js/app.js
Normal file
18
app/static/js/app.js
Normal file
@@ -0,0 +1,18 @@
|
||||
(function themeInit() {
|
||||
try {
|
||||
const html = document.documentElement;
|
||||
const select = document.getElementById("theme-select");
|
||||
const saved = localStorage.getItem("theme") || "light";
|
||||
html.setAttribute("data-theme", saved);
|
||||
if (select) {
|
||||
select.value = saved;
|
||||
select.addEventListener("change", () => {
|
||||
const value = select.value;
|
||||
html.setAttribute("data-theme", value);
|
||||
localStorage.setItem("theme", value);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
// no-op
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user