41 lines
No EOL
1.1 KiB
JavaScript
41 lines
No EOL
1.1 KiB
JavaScript
let dark = getCookie("dark") === "true";
|
|
let pride = new Date().getMonth() == 5;
|
|
|
|
if (dark) {
|
|
document.write('<link rel="stylesheet" href="style/dark.css">')
|
|
document.write('<link rel="stylesheet" href="style/prettify-dark.css">')
|
|
}
|
|
if (pride)
|
|
document.write('<link rel="stylesheet" href="style/pride.css">')
|
|
|
|
$(function () {
|
|
let openModals = function (hash) {
|
|
if (hash && hash.startsWith("#")) {
|
|
let modal = $(`${hash}-modal`);
|
|
if (modal.length)
|
|
modal.modal('show');
|
|
}
|
|
}
|
|
openModals(window.location.hash);
|
|
$('a').on('click', function () {
|
|
openModals($(this).attr('href'));
|
|
});;
|
|
|
|
$('.navbar-collapse a').on('click', function () {
|
|
$('.navbar-collapse').collapse('hide');
|
|
});
|
|
|
|
$('#blobheart').on('click', function () {
|
|
$('#navbar-image').attr('src', 'res/heart.png');
|
|
});
|
|
|
|
let mode = $('#dark-mode');
|
|
mode.prop('checked', dark);
|
|
mode.on('click', function () {
|
|
setCookie("dark", $(this).prop('checked'), 365);
|
|
window.location.hash = "";
|
|
location.reload();
|
|
});
|
|
|
|
PR.prettyPrint();
|
|
}); |