summaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js5
1 files changed, 2 insertions, 3 deletions
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)