Improvements to types and age verification screen
This commit is contained in:
parent
18e98cdb3b
commit
7f7a62a391
78 changed files with 1132 additions and 1102 deletions
|
|
@ -3,33 +3,29 @@
|
|||
---
|
||||
|
||||
<script is:inline data-astro-rerun>
|
||||
/* Color scheme toggle */
|
||||
(() => {
|
||||
(function () {
|
||||
var colorScheme = localStorage.getItem("colorScheme");
|
||||
if (colorScheme == null || colorScheme === "auto") {
|
||||
localStorage.setItem("colorScheme", "auto");
|
||||
colorScheme = matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||
}
|
||||
|
||||
const bodyClassList = document.querySelector("body").classList;
|
||||
const bodyClassList = document.body.classList;
|
||||
if (colorScheme === "dark") {
|
||||
bodyClassList.add("dark");
|
||||
}
|
||||
|
||||
function toggleColorScheme() {
|
||||
if (colorScheme === "dark") {
|
||||
colorScheme = "light";
|
||||
bodyClassList.remove("dark");
|
||||
} else {
|
||||
colorScheme = "dark";
|
||||
bodyClassList.add("dark");
|
||||
}
|
||||
localStorage.setItem("colorScheme", colorScheme);
|
||||
}
|
||||
|
||||
const buttonDarkMode = document.querySelector("#button-dark-mode");
|
||||
if (buttonDarkMode) {
|
||||
buttonDarkMode.addEventListener("click", toggleColorScheme);
|
||||
}
|
||||
document.querySelectorAll("button[data-dark-mode]").forEach(function (button) {
|
||||
button.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
if (colorScheme === "dark") {
|
||||
colorScheme = "light";
|
||||
bodyClassList.remove("dark");
|
||||
} else {
|
||||
colorScheme = "dark";
|
||||
bodyClassList.add("dark");
|
||||
}
|
||||
localStorage.setItem("colorScheme", colorScheme);
|
||||
});
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue