Updates
This commit is contained in:
parent
f0e1a953b3
commit
3d2ff01e78
223 changed files with 4819 additions and 127381 deletions
47
Libraries/js/app.js
Normal file
47
Libraries/js/app.js
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
let currentDisplayMode = "dark";
|
||||
|
||||
const updateDisplayModeIcons = () => {
|
||||
document.querySelectorAll(".display-mode-icon").forEach((el) => {
|
||||
if (currentDisplayMode == "dark") {
|
||||
el.innerHTML = "🌙";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
el.innerHTML = "☀️";
|
||||
} else {
|
||||
el.innerHTML = "🌑";
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const toggleDisplayMode = () => {
|
||||
if (currentDisplayMode == "dark") {
|
||||
window.localStorage.setItem("displayMode", "moonlight");
|
||||
currentDisplayMode = "moonlight";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-moonlight.css";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
window.localStorage.setItem("displayMode", "light");
|
||||
currentDisplayMode = "light";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-light.css";
|
||||
} else {
|
||||
window.localStorage.setItem("displayMode", "dark");
|
||||
currentDisplayMode = "dark";
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-dark.css";
|
||||
}
|
||||
updateDisplayModeIcons();
|
||||
};
|
||||
|
||||
window.addEventListener("DOMContentLoaded", (evt) => {
|
||||
if (window.localStorage.getItem("displayMode") != null) {
|
||||
currentDisplayMode = window.localStorage.getItem("displayMode");
|
||||
} else {
|
||||
window.localStorage.setItem("displayMode", "dark");
|
||||
}
|
||||
|
||||
if (currentDisplayMode == "dark") {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-dark.css";
|
||||
} else if (currentDisplayMode == "moonlight") {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-moonlight.css";
|
||||
} else {
|
||||
document.getElementById("themekit-css").href = "/Libraries/css/themekit/main-light.css";
|
||||
}
|
||||
updateDisplayModeIcons();
|
||||
});
|
||||
Loading…
Reference in a new issue