deploy: ef18d7efdf8c433b76874e637152873dbc78a479

This commit is contained in:
falsycat
2023-02-23 09:46:34 +00:00
parent 219522eeeb
commit 0ca501d356
36 changed files with 308 additions and 308 deletions

View File

@@ -0,0 +1 @@
const userPref=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark",currentTheme=localStorage.getItem("theme")??userPref,syntaxTheme=document.querySelector("#theme-link");currentTheme&&(document.documentElement.setAttribute("saved-theme",currentTheme),syntaxTheme.href=currentTheme==="dark"?"https://ar.falsy.cat/styles/_dark_syntax.bec558461529f0dd343a0b008c343934.min.css":"https://ar.falsy.cat/styles/_light_syntax.86a48a52faebeaaf42158b72922b1c90.min.css");const switchTheme=e=>{e.target.checked?(document.documentElement.setAttribute("saved-theme","dark"),localStorage.setItem("theme","dark"),syntaxTheme.href="https://ar.falsy.cat/styles/_dark_syntax.bec558461529f0dd343a0b008c343934.min.css"):(document.documentElement.setAttribute("saved-theme","light"),localStorage.setItem("theme","light"),syntaxTheme.href="https://ar.falsy.cat/styles/_light_syntax.86a48a52faebeaaf42158b72922b1c90.min.css")};window.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector("#darkmode-toggle");e.addEventListener("change",switchTheme,!1),currentTheme==="dark"&&(e.checked=!0)})

View File

@@ -1 +0,0 @@
const userPref=window.matchMedia("(prefers-color-scheme: light)").matches?"light":"dark",currentTheme=localStorage.getItem("theme")??userPref,syntaxTheme=document.querySelector("#theme-link");currentTheme&&(document.documentElement.setAttribute("saved-theme",currentTheme),syntaxTheme.href=currentTheme==="dark"?"https://falsy.cat/styles/_dark_syntax.bec558461529f0dd343a0b008c343934.min.css":"https://falsy.cat/styles/_light_syntax.86a48a52faebeaaf42158b72922b1c90.min.css");const switchTheme=e=>{e.target.checked?(document.documentElement.setAttribute("saved-theme","dark"),localStorage.setItem("theme","dark"),syntaxTheme.href="https://falsy.cat/styles/_dark_syntax.bec558461529f0dd343a0b008c343934.min.css"):(document.documentElement.setAttribute("saved-theme","light"),localStorage.setItem("theme","light"),syntaxTheme.href="https://falsy.cat/styles/_light_syntax.86a48a52faebeaaf42158b72922b1c90.min.css")};window.addEventListener("DOMContentLoaded",()=>{const e=document.querySelector("#darkmode-toggle");e.addEventListener("change",switchTheme,!1),currentTheme==="dark"&&(e.checked=!0)})