summaryrefslogtreecommitdiff
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js38
1 files changed, 12 insertions, 26 deletions
diff --git a/src/index.js b/src/index.js
index 6e35fa3..e6a4dc3 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,43 +1,29 @@
import "./style.css"
+import ImmichConnector from "./immich.js"
+import Page from "./pages.js"
import "./icons.js"
import initSlides from "./slides.js"
-initSlides()
+const immichConnector = new ImmichConnector("http://192.168.1.13", "m5nqOoBc4uhAba21gZdCP3z8D3JT4GPxDXL2psd52EA")
+document.immichConnector = immichConnector // FIXME TEMP
-const apiKey = "m5nqOoBc4uhAba21gZdCP3z8D3JT4GPxDXL2psd52EA"
-console.log(apiKey)
-const testDiv = document.querySelector("main div")
+const slideshow = new Page(document.querySelector("#slideshow"), "/slideshow", initSlides)
+const albums = new Page(document.querySelector("#albums"), "/albums")
+const settings = new Page(document.querySelector("#settings"), "/settings")
-function showAlbums() {
- testDiv.innerHTML
-}
-
-function pathnameCallback(e) {
- console.log(e)
- //testDiv.innerHTML = ""
- //switch (window.location.pathname) {
- // case "/":
- // testDiv.innerHTML = "<p>Hello first page</p>"
- // break ;;
- // case "/albums":
- // testDiv.innerHTML = "<p>Hello albums page</p>"
- // break ;;
- // case "/settings":
- // testDiv.innerHTML = "<p>Hello settings page</p>"
- // break ;;
- //}
-}
-window.addEventListener("popstate", pathnameCallback)
-pathnameCallback()
+window.addEventListener("popstate", Page.pathnameCallback)
+Page.pathnameCallback()
/* add event listeners for anchor elements in footer */
function softRedirect(e) {
e.preventDefault()
let a = e.target
+ if (a === null) return
while (a.tagName !== "A" && a !== null)
a = a.parentElement
+ if (a === null) return
window.history.pushState({}, "", a.href);
- pathnameCallback()
+ Page.pathnameCallback()
}
document.querySelector("#menu").addEventListener("click", softRedirect)