2023-06-13 17:29:52 +02:00
|
|
|
const darkCookie = localStorage.getItem("dark");
|
|
|
|
const dark = darkCookie === null ? window.matchMedia("(prefers-color-scheme: dark)").matches : darkCookie === "true";
|
2021-07-09 01:59:28 +02:00
|
|
|
if (dark)
|
2023-06-13 17:29:52 +02:00
|
|
|
$('head').append($("<link/>", {
|
|
|
|
rel: "stylesheet",
|
|
|
|
href: "/style/dark.css"
|
|
|
|
}));
|
2018-12-30 02:26:56 +01:00
|
|
|
|
2021-10-11 14:07:57 +02:00
|
|
|
// redirect legacy anchors
|
2021-10-11 14:17:29 +02:00
|
|
|
if (/^#privacy\/?$/.test(location.hash))
|
2021-10-11 14:07:57 +02:00
|
|
|
location.href = "/privacy";
|
2021-10-11 14:17:29 +02:00
|
|
|
if (/^#impressum\/?$/.test(location.hash))
|
2021-10-11 14:07:57 +02:00
|
|
|
location.href = "/impressum";
|
|
|
|
|
2018-12-16 23:39:35 +01:00
|
|
|
$(function () {
|
|
|
|
$('.navbar-collapse a').on('click', function () {
|
2018-07-25 12:50:47 +02:00
|
|
|
$('.navbar-collapse').collapse('hide');
|
2018-07-24 22:45:53 +02:00
|
|
|
});
|
2018-07-25 18:28:43 +02:00
|
|
|
|
2018-12-16 23:39:35 +01:00
|
|
|
$('#blobheart').on('click', function () {
|
2021-03-19 04:23:04 +01:00
|
|
|
$('#navbar-image').attr('src', 'res/heart.jpeg');
|
2018-07-25 18:28:43 +02:00
|
|
|
});
|
2018-12-30 02:26:56 +01:00
|
|
|
|
2019-10-04 22:15:03 +02:00
|
|
|
let mode = $('#dark-mode');
|
|
|
|
mode.prop('checked', dark);
|
|
|
|
mode.on('click', function () {
|
2023-06-13 17:29:52 +02:00
|
|
|
localStorage.setItem("dark", $(this).prop('checked'));
|
2021-10-11 14:07:57 +02:00
|
|
|
location.hash = "";
|
2019-10-04 22:15:03 +02:00
|
|
|
location.reload();
|
|
|
|
});
|
2023-06-13 17:29:52 +02:00
|
|
|
});
|