From d7f2747725429ecf303fa61a81444455317b6b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Heiko=20Thei=C3=9Fen?= Date: Wed, 28 Aug 2024 08:55:55 +0200 Subject: [PATCH] typo --- scripts/darkmode.html | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/scripts/darkmode.html b/scripts/darkmode.html index 0162b8b3..5e0fccef 100644 --- a/scripts/darkmode.html +++ b/scripts/darkmode.html @@ -13,24 +13,25 @@ } function darkmode_manual() { - localStorage.setItem("odata-vocabularies/darkmode", darkmode_switch.value); + localStorage.setItem("odata-specs/darkmode", darkmode_switch.value); switch (darkmode_switch.value) { - case "auto": - darkmode_auto(); + case "off": + document.body.classList.remove("darkmode"); break; case "on": document.body.classList.add("darkmode"); break; - default: - document.body.classList.remove("darkmode"); + case "auto": + darkmode_auto(); + break; } } const darkmode_query = matchMedia("(prefers-color-scheme: dark)"); darkmode_query.addEventListener("change", darkmode_auto); const darkmode_switch = document.getElementById("darkmode"); - darkmode_switch.value = localStorage.getItem("odata-vocabularies/darkmode") || "off"; - document.body.appendChild(darkmode_switch); + darkmode_switch.value = + localStorage.getItem("odata-specs/darkmode") || "off"; darkmode_switch.addEventListener("change", darkmode_manual); darkmode_manual(); });