mirror of
https://github.com/sp-tarkov/forge.git
synced 2025-02-13 04:30:41 -05:00
Refringe
787f796ad7
Worked on: - Mod component templating - Added dark mode styles for homepage - Added benchmarking to the wolt import command - Added MySQL natural sort function Short todo: - Add updated time to mod component - Implement naturalsort function into homepage queries and measure performance difference - Migrate top navigation from old-build
38 lines
1.4 KiB
JavaScript
38 lines
1.4 KiB
JavaScript
import "./bootstrap";
|
|
|
|
var themeToggleDarkIcon = document.getElementById("theme-toggle-dark-icon");
|
|
var themeToggleLightIcon = document.getElementById("theme-toggle-light-icon");
|
|
|
|
if (
|
|
localStorage.getItem("color-theme") === "dark" ||
|
|
(!("color-theme" in localStorage) &&
|
|
window.matchMedia("(prefers-color-scheme: dark)").matches)
|
|
) {
|
|
themeToggleLightIcon.classList.remove("hidden");
|
|
} else {
|
|
themeToggleDarkIcon.classList.remove("hidden");
|
|
}
|
|
|
|
var themeToggleBtn = document.getElementById("theme-toggle");
|
|
themeToggleBtn.addEventListener("click", function () {
|
|
themeToggleDarkIcon.classList.toggle("hidden");
|
|
themeToggleLightIcon.classList.toggle("hidden");
|
|
if (localStorage.getItem("color-theme")) {
|
|
if (localStorage.getItem("color-theme") === "light") {
|
|
document.documentElement.classList.add("dark");
|
|
localStorage.setItem("color-theme", "dark");
|
|
} else {
|
|
document.documentElement.classList.remove("dark");
|
|
localStorage.setItem("color-theme", "light");
|
|
}
|
|
} else {
|
|
if (document.documentElement.classList.contains("dark")) {
|
|
document.documentElement.classList.remove("dark");
|
|
localStorage.setItem("color-theme", "light");
|
|
} else {
|
|
document.documentElement.classList.add("dark");
|
|
localStorage.setItem("color-theme", "dark");
|
|
}
|
|
}
|
|
});
|