Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoTheissen committed Aug 28, 2024
1 parent 6825708 commit d7f2747
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions scripts/darkmode.html
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down

0 comments on commit d7f2747

Please sign in to comment.