summaryrefslogtreecommitdiff
path: root/static/src/index.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-06-24 19:23:33 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-06-24 19:23:33 -0500
commitffa5ff333eabffe07394fb21bc413d7d238ee651 (patch)
tree007b506aca746fda9040ea4f0ffa8d6578e86f7e /static/src/index.js
parent09e9193b6be6e2eae7ffbfbfedd15ac22bab0022 (diff)
downloadimmich-frame-ffa5ff333eabffe07394fb21bc413d7d238ee651.tar.xz
immich-frame-ffa5ff333eabffe07394fb21bc413d7d238ee651.zip
move all files to /static
Diffstat (limited to 'static/src/index.js')
-rw-r--r--static/src/index.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/static/src/index.js b/static/src/index.js
new file mode 100644
index 0000000..7d7c9db
--- /dev/null
+++ b/static/src/index.js
@@ -0,0 +1,29 @@
+import "@fontsource/overpass"
+import "@fontsource/overpass/700.css"
+import "@fontsource/overpass/500.css"
+import "./style.css"
+import Page from "./pages.js"
+import "./icons.js"
+import initSlides from "./slides.js"
+import initAlbums from "./albums.js"
+import initSettings from "./settings.js"
+
+const slideshow = new Page(document.querySelector("#slideshow"), ["", "/slideshow"], initSlides)
+const albums = new Page(document.querySelector("#albums"), ["/albums"], initAlbums)
+const settings = new Page(document.querySelector("#settings"), ["/settings"], initSettings)
+
+window.addEventListener("popstate", Page.pathnameCallback)
+Page.pathnameCallback() /* run after all pages are registered */
+
+/* add event listeners for anchor elements in footer */
+function softRedirect(e) {
+ e.preventDefault()
+ let a = e.target
+ if (a === null) return
+ while (a !== null && a.tagName !== "A")
+ a = a.parentElement
+ if (a === null) return
+ Page.softRedirect(a.href)
+}
+
+document.querySelector("#menu").addEventListener("click", softRedirect)