FIX: dark mode is default now/Pressing enter
This commit is contained in:
@@ -1406,17 +1406,24 @@ function danceTiles(tiles) {
|
||||
|
||||
function restoreTheme() {
|
||||
const selectedTheme = localStorage.getItem("selected-theme")
|
||||
if (selectedTheme === "dark") {
|
||||
document.body.classList.add("dark-theme")
|
||||
themeButton.setAttribute("aria-label", "Switch to light mode")
|
||||
}
|
||||
const shouldUseDarkTheme = selectedTheme !== "light"
|
||||
|
||||
document.body.classList.toggle("dark-theme", shouldUseDarkTheme)
|
||||
themeButton.setAttribute(
|
||||
"aria-label",
|
||||
shouldUseDarkTheme ? "Switch to light mode" : "Switch to dark mode"
|
||||
)
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
function toggleTheme(event) {
|
||||
document.body.classList.toggle("dark-theme")
|
||||
const theme = document.body.classList.contains("dark-theme") ? "dark" : "light"
|
||||
localStorage.setItem("selected-theme", theme)
|
||||
themeButton.setAttribute("aria-label", theme === "dark" ? "Switch to light mode" : "Switch to dark mode")
|
||||
|
||||
if (event?.currentTarget instanceof HTMLElement) {
|
||||
event.currentTarget.blur()
|
||||
}
|
||||
}
|
||||
|
||||
async function openStats() {
|
||||
|
||||
Reference in New Issue
Block a user