From ffa5ff333eabffe07394fb21bc413d7d238ee651 Mon Sep 17 00:00:00 2001 From: Tim Keller Date: Tue, 24 Jun 2025 19:23:33 -0500 Subject: move all files to /static --- static/src/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 static/src/index.js (limited to 'static/src/index.js') 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) -- cgit v1.2.3