2023-06-13 17:24:58 +02:00
|
|
|
const darkStorage = localStorage.getItem("dark");
|
|
|
|
const darkTheme = darkStorage === null ? window.matchMedia("(prefers-color-scheme: dark)").matches : darkStorage === "true";
|
|
|
|
|
|
|
|
$(function () {
|
2023-06-18 19:12:43 +02:00
|
|
|
$(".navbar-collapse a").on("click", () => $(".navbar-collapse").collapse("hide"));
|
2023-06-13 17:24:58 +02:00
|
|
|
|
2023-06-18 19:12:43 +02:00
|
|
|
let mode = $("#dark-mode");
|
|
|
|
mode.prop("checked", darkTheme);
|
|
|
|
mode.on("click", function () {
|
|
|
|
localStorage.setItem("dark", $(this).prop("checked"));
|
2023-06-13 17:24:58 +02:00
|
|
|
location.hash = "";
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
});
|