Web/main/scripts/main.js
Ell 023cb367d7
All checks were successful
Web/pipeline/head This commit looks good
overly specific regexing
2021-10-11 14:17:29 +02:00

27 lines
No EOL
727 B
JavaScript

const dark = getCookie("dark") === "true";
if (dark)
addStyle("/style/dark.css");
// redirect legacy anchors
if (/^#privacy\/?$/.test(location.hash))
location.href = "/privacy";
if (/^#impressum\/?$/.test(location.hash))
location.href = "/impressum";
$(function () {
$('.navbar-collapse a').on('click', function () {
$('.navbar-collapse').collapse('hide');
});
$('#blobheart').on('click', function () {
$('#navbar-image').attr('src', 'res/heart.jpeg');
});
let mode = $('#dark-mode');
mode.prop('checked', dark);
mode.on('click', function () {
setCookie("dark", $(this).prop('checked'), 365);
location.hash = "";
location.reload();
});
});