summaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-05-05 20:43:20 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-05-05 20:43:20 -0500
commit4fda4eef9b58504a1352a777f7d9b6826a26559e (patch)
treed52befdf1d95a87297235da3e0a798e611c456d0 /src/index.js
parent832ee186bd8477eff88560d4fddf643ec608d4b6 (diff)
downloadimmich-frame-4fda4eef9b58504a1352a777f7d9b6826a26559e.tar.xz
immich-frame-4fda4eef9b58504a1352a777f7d9b6826a26559e.zip
move softredirect to page class
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)