summaryrefslogtreecommitdiff
path: root/src/pages.js
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2025-06-12 22:23:55 -0500
committerTim Keller <tjk@tjkeller.xyz>2025-06-12 22:23:55 -0500
commit81ce440269a29d70de5c806f03d064b0897cf7db (patch)
tree8dbb3128b427023037551d39bac97f72cc10da6a /src/pages.js
parent043317fc36bf39ab073941eae4611645637aaee9 (diff)
downloadimmich-frame-81ce440269a29d70de5c806f03d064b0897cf7db.tar.xz
immich-frame-81ce440269a29d70de5c806f03d064b0897cf7db.zip
integrate tailwind more and a few other minor features
Diffstat (limited to 'src/pages.js')
-rw-r--r--src/pages.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/pages.js b/src/pages.js
index 0576684..f6a8b9b 100644
--- a/src/pages.js
+++ b/src/pages.js
@@ -1,3 +1,5 @@
+const menu = document.querySelector("#menu")
+
export default class Page {
static pages = {}
static currentPage = null
@@ -33,9 +35,20 @@ export default class Page {
}
setVisible(visible) {
- this.pageContainer.style.display = visible ? null : "none"
+ this.pageContainer.classList.toggle("hidden!", !visible)
this.visible = visible
- if (visible && !this.initialized && this.initialize)
- this.initialized = this.initialize(this.pageContainer)
+ if (this.visible) {
+ /* initialize page */
+ if (!this.initialized && this.initialize)
+ this.initialized = this.initialize(this.pageContainer)
+
+ /* set selected attribute on the link */
+ for (const a of menu.querySelectorAll("a")) {
+ if (this.endpoints.includes(a.getAttribute("href")))
+ a.dataset.selected = "1"
+ else
+ delete a.dataset.selected
+ }
+ }
}
}