summaryrefslogtreecommitdiff
path: root/static/src/index.js
diff options
context:
space:
mode:
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)