From 235ce5716edc2f7cbe80fdccf26eac7269587839 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 08 Jun 2026 04:38:18 +0000
Subject: [PATCH] =FavouritesManager.php and FavouritesRoutes.php fixes. Moving all logic to FavouritesManager.php. Still some left to do
---
assets/js/concise/Gallery.js | 31 +++++++++++++++++++++++++------
1 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/assets/js/concise/Gallery.js b/assets/js/concise/Gallery.js
index 948ab0f..950aa71 100644
--- a/assets/js/concise/Gallery.js
+++ b/assets/js/concise/Gallery.js
@@ -26,7 +26,6 @@
this.initModal();
this.initListeners();
this.initSubscribers();
- console.log('Gallery loaded...');
}
/*********************************************************************
ELEMENTS
@@ -42,7 +41,8 @@
image: '.image',
leftImage: '.image-left',
rightImage: '.image-right',
- counter: '.counter'
+ counter: '.counter',
+ caption: 'details .item-info'
},
}
this.ui = window.uiFromSelectors(this.elements);
@@ -66,6 +66,16 @@
let selector = filtered ? `[data-gallery="${filtered}"]` : this.elements.imageSelector;
this.items = Array.from(document.querySelectorAll(selector))
.map((img, index) => {
+ let caption = '';
+ if (Object.hasOwn(img.dataset, 'caption')) {
+ caption = img.parentElement.querySelector(img.dataset.caption).cloneNode(true);
+ } else {
+ caption = img.nextElementSibling && img.nextElementSibling.tagName === 'FIGCAPTION' ?
+ img.nextElementSibling.textContent :
+ '';
+ }
+
+
return {
id: img.dataset.id||index,
srcset: img.srcset || img.src, // Clone the srcset from page
@@ -73,7 +83,8 @@
src: img.currentSrc || img.src, // Fallback
full: img.dataset.full || img.src,
alt: img.alt || '',
- element: img
+ element: img,
+ caption: caption
};
});
}
@@ -101,10 +112,8 @@
this.toggleGallery(true);
} else if (this.modal.isOpen) {
if (window.targetCheck(e, this.elements.gallery.nextButton)) {
- console.log('Next');
this.nextElement();
} else if (window.targetCheck(e, this.elements.gallery.prevButton)) {
- console.log('Previous');
this.prevElement();
}
}
@@ -387,7 +396,17 @@
galleryImg.src = item.src; // Fallback
galleryImg.alt = item.alt;
- // ALWAYS load full resolution for zoom quality
+ window.removeChildren(this.ui.gallery.caption);
+ if (typeof item.caption === 'object') {
+ this.ui.gallery.caption.append(item.caption);
+
+ } else {
+ this.ui.gallery.caption.textContent = item.caption;
+ }
+
+
+
+
if (item.full && item.full !== item.src) {
const fullImg = new Image();
fullImg.onload = () => {
--
Gitblit v1.10.0