This commit is contained in:
parent
4b661cf0a7
commit
cfe0ae6e88
3 changed files with 9 additions and 3 deletions
|
@ -10,7 +10,7 @@ $(".blog-cat-button").on("click", function () {
|
|||
history.replaceState(null, null, `#blog-${tag}`);
|
||||
});
|
||||
|
||||
let category = window.location.hash.match(/#blog-(.+)/);
|
||||
let category = location.hash.match(/#blog-(.+)/);
|
||||
openCategory(category && decodeURI(category[1]));
|
||||
|
||||
function openCategory(name) {
|
||||
|
|
|
@ -2,6 +2,12 @@ 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');
|
||||
|
@ -15,7 +21,7 @@ $(function () {
|
|||
mode.prop('checked', dark);
|
||||
mode.on('click', function () {
|
||||
setCookie("dark", $(this).prop('checked'), 365);
|
||||
window.location.hash = "";
|
||||
location.hash = "";
|
||||
location.reload();
|
||||
});
|
||||
});
|
|
@ -10,7 +10,7 @@ function setCookie(key, value, days) {
|
|||
}
|
||||
|
||||
function forceToAnchor(customAnchor) {
|
||||
let anchor = customAnchor || window.location.hash;
|
||||
let anchor = customAnchor || location.hash;
|
||||
// this is probably a terrible hack
|
||||
if (anchor.startsWith("#")) {
|
||||
let element = $(anchor);
|
||||
|
|
Loading…
Reference in a new issue