2021-03-11 03:21:23 +01:00
|
|
|
const dark = getCookie("dark") === "true";
|
|
|
|
const loc = $("script").last().attr("src").split("/")[0];
|
2018-12-30 16:38:14 +01:00
|
|
|
|
2019-10-03 15:15:25 +02:00
|
|
|
if (dark) {
|
2021-03-19 11:42:35 +01:00
|
|
|
addStyle(`${loc}/style/dark.css`);
|
|
|
|
addStyle(`${loc}/style/prettify-dark.css`);
|
2019-10-03 15:15:25 +02:00
|
|
|
}
|
2018-12-30 02:26:56 +01:00
|
|
|
|
2018-12-16 23:39:35 +01:00
|
|
|
$(function () {
|
2019-02-17 01:56:31 +01:00
|
|
|
openModals(window.location.hash);
|
2018-12-16 23:39:35 +01:00
|
|
|
$('a').on('click', function () {
|
2018-07-28 11:22:20 +02:00
|
|
|
openModals($(this).attr('href'));
|
2021-03-19 07:55:18 +01:00
|
|
|
});
|
2018-07-27 00:35:55 +02:00
|
|
|
|
2018-12-16 23:39:35 +01:00
|
|
|
$('.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 () {
|
|
|
|
setCookie("dark", $(this).prop('checked'), 365);
|
|
|
|
window.location.hash = "";
|
|
|
|
location.reload();
|
|
|
|
});
|
|
|
|
|
2019-10-03 15:15:25 +02:00
|
|
|
PR.prettyPrint();
|
2021-03-19 11:42:35 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
function openModals(hash) {
|
|
|
|
if (hash && hash.startsWith("#")) {
|
|
|
|
let modal = $(`${hash}-modal`);
|
|
|
|
if (modal.length)
|
|
|
|
modal.modal('show');
|
|
|
|
}
|
|
|
|
}
|