Fix Gallery lightbox URL to image

This commit is contained in:
Noah Petherbridge 2023-12-21 21:14:00 -08:00
parent ebc8e9b72c
commit f986c6f0a5

View File

@ -572,7 +572,7 @@
<source src="{{PhotoURL .Filename}}" type="video/mp4"> <source src="{{PhotoURL .Filename}}" type="video/mp4">
</video> </video>
{{else}} {{else}}
<a href="/photo/view?id={{.ID}}" target="_blank" <a href="/photo/view?id={{.ID}}" data-url="{{PhotoURL .Filename}}" target="_blank"
class="js-modal-trigger" data-target="detail-modal" class="js-modal-trigger" data-target="detail-modal"
onclick="setModalImage(this.href)"> onclick="setModalImage(this.href)">
<img src="{{PhotoURL .Filename}}" loading="lazy"{{if BlurExplicit .}} class="blurred-explicit"{{end}}> <img src="{{PhotoURL .Filename}}" loading="lazy"{{if BlurExplicit .}} class="blurred-explicit"{{end}}>
@ -646,7 +646,7 @@
document.querySelectorAll(".js-modal-trigger").forEach(node => { document.querySelectorAll(".js-modal-trigger").forEach(node => {
node.addEventListener("click", (e) => { node.addEventListener("click", (e) => {
e.preventDefault(); e.preventDefault();
setModalImage(node.href); setModalImage(node.dataset.url);
$modal.classList.add("is-active"); $modal.classList.add("is-active");
}) })
}); });