Skip to content

Commit

Permalink
try 1
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdarkle committed Sep 8, 2024
1 parent 1405ea7 commit d5ef03d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/dist/forum.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/forum.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ app.initializers.add('darkle/fancybox', () => {
new Carousel(gallery, {
Dots: false,
});

// Ensure all gallery images have proper src attribute
gallery.querySelectorAll('img').forEach(img => {
if (!img.src && img.dataset.lazySrc) {
img.src = img.dataset.lazySrc;
}
});
});

// Initialize Fancybox for galleries
Expand All @@ -36,5 +43,12 @@ app.initializers.add('darkle/fancybox', () => {

// Make Fancybox available globally for single image clicks
window.Fancybox = Fancybox;

// Ensure all single images have proper src attribute
postBody.querySelectorAll('a[data-fancybox="single"] img').forEach(img => {
if (!img.src && img.parentNode.href) {
img.src = img.parentNode.href;
}
});
});
});
2 changes: 1 addition & 1 deletion src/DefineGalleryTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __invoke(Configurator $config)
</a>
</xsl:when>
<xsl:otherwise>
<a data-fancybox="single" href="{@url}" onclick="event.preventDefault(); Fancybox.show([{src: this.href}]);">
<a data-fancybox="single" href="{@url}" onclick="event.preventDefault(); Fancybox.show([{src: '{@url}'}]);">
$newTemplate
</a>
</xsl:otherwise>
Expand Down

0 comments on commit d5ef03d

Please sign in to comment.