chore: cleanup
This commit is contained in:
parent
6ef59b5818
commit
f27baa0ce7
7 changed files with 39 additions and 35 deletions
|
@ -28,6 +28,9 @@ menu {
|
|||
|
||||
& a {
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
& .icon > svg,
|
||||
|
|
|
@ -59,10 +59,10 @@
|
|||
--error: light-dark(#b81f1f, #ff8b8b);
|
||||
--favorite: light-dark(#b03c72, #ff9ccd);
|
||||
--link: light-dark(#7b5cba, #e2b8ff);
|
||||
--music: light-dark(#1565c3, #99ccff);
|
||||
--music: light-dark(#3d7099, #76b8cc);
|
||||
--newsletter: light-dark(#37b0b0, #91fffa);
|
||||
--now: light-dark(#cc1076, #ff82d5);
|
||||
--search: light-dark(#3a6b94, #a0b8d9);
|
||||
--search: light-dark(#6b5e3a, #c0b594);
|
||||
--tattoo: light-dark(#951b1b, #ff7373);
|
||||
--tv: light-dark(#cc3600, #ff8f66);
|
||||
--warning: light-dark(#cc6f00, #ffbf66);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
storage="local"
|
||||
transition-duration="10ms"
|
||||
>
|
||||
<span class="loading client-side"> {{ nowPlaying }}</span>
|
||||
<span class="loading client-side">{{ nowPlaying }}</span>
|
||||
<span class="content"></span>
|
||||
<noscript>
|
||||
<span>{{ nowPlaying }}</span>
|
||||
|
|
|
@ -48,38 +48,40 @@
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
(() => {
|
||||
const storageType =
|
||||
document.querySelector("theme-toggle")?.getAttribute("storage") === "local"
|
||||
? localStorage
|
||||
: sessionStorage;
|
||||
window.addEventListener("load", () => {
|
||||
(() => {
|
||||
const storageType =
|
||||
document.querySelector("theme-toggle")?.getAttribute("storage") === "local"
|
||||
? localStorage
|
||||
: sessionStorage;
|
||||
|
||||
const currentTheme = storageType.getItem("theme") || "auto";
|
||||
const metaColorScheme = document.querySelector('meta[name="color-scheme"]');
|
||||
const lightIcon = document.querySelector(".light");
|
||||
const darkIcon = document.querySelector(".dark");
|
||||
const autoIcon = document.querySelector(".auto");
|
||||
const currentTheme = storageType.getItem("theme") || "auto";
|
||||
const metaColorScheme = document.querySelector('meta[name="color-scheme"]');
|
||||
const lightIcon = document.querySelector(".light");
|
||||
const darkIcon = document.querySelector(".dark");
|
||||
const autoIcon = document.querySelector(".auto");
|
||||
|
||||
if (currentTheme === "auto") {
|
||||
metaColorScheme.setAttribute("content", "light dark");
|
||||
document.documentElement.style.colorScheme = "";
|
||||
} else {
|
||||
metaColorScheme.setAttribute("content", currentTheme);
|
||||
document.documentElement.style.colorScheme = currentTheme;
|
||||
}
|
||||
if (currentTheme === "auto") {
|
||||
metaColorScheme.setAttribute("content", "light dark");
|
||||
document.documentElement.style.colorScheme = "";
|
||||
} else {
|
||||
metaColorScheme.setAttribute("content", currentTheme);
|
||||
document.documentElement.style.colorScheme = currentTheme;
|
||||
}
|
||||
|
||||
lightIcon.style.display = "none";
|
||||
darkIcon.style.display = "none";
|
||||
autoIcon.style.display = "none";
|
||||
lightIcon.style.display = "none";
|
||||
darkIcon.style.display = "none";
|
||||
autoIcon.style.display = "none";
|
||||
|
||||
if (currentTheme === "light") {
|
||||
lightIcon.style.display = "inline";
|
||||
} else if (currentTheme === "dark") {
|
||||
darkIcon.style.display = "inline";
|
||||
} else {
|
||||
autoIcon.style.display = "inline";
|
||||
}
|
||||
})();
|
||||
if (currentTheme === "light") {
|
||||
lightIcon.style.display = "inline";
|
||||
} else if (currentTheme === "dark") {
|
||||
darkIcon.style.display = "inline";
|
||||
} else {
|
||||
autoIcon.style.display = "inline";
|
||||
}
|
||||
})();
|
||||
});
|
||||
</script>
|
||||
<div class="main-wrapper">
|
||||
<main>
|
||||
|
|
Reference in a new issue