diff options
Diffstat (limited to 'static/src/index.js')
| m--------- | static | 6 | ||||
| -rw-r--r-- | static/src/index.js | 29 |
2 files changed, 29 insertions, 6 deletions
diff --git a/static b/static deleted file mode 160000 -Subproject 51be71d8943f6e5e0c4b28358f227860c73d53a 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) |
