From 4fda4eef9b58504a1352a777f7d9b6826a26559e Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Mon, 5 May 2025 20:43:20 -0500 Subject: move softredirect to page class --- src/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/index.js') diff --git a/src/index.js b/src/index.js index e6a4dc3..cac7bf4 100644 --- a/src/index.js +++ b/src/index.js @@ -12,7 +12,7 @@ const albums = new Page(document.querySelector("#albums"), "/albums") const settings = new Page(document.querySelector("#settings"), "/settings") window.addEventListener("popstate", Page.pathnameCallback) -Page.pathnameCallback() +Page.pathnameCallback() /* run after all pages are registered */ /* add event listeners for anchor elements in footer */ function softRedirect(e) { @@ -22,8 +22,7 @@ function softRedirect(e) { while (a.tagName !== "A" && a !== null) a = a.parentElement if (a === null) return - window.history.pushState({}, "", a.href); - Page.pathnameCallback() + Page.softRedirect(a.href) } document.querySelector("#menu").addEventListener("click", softRedirect) -- cgit v1.2.3