Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdarkle committed Sep 8, 2024
1 parent 215c3c9 commit 1405ea7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 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.

7 changes: 5 additions & 2 deletions js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ app.initializers.add('darkle/fancybox', () => {
});
});

// Initialize Fancybox for all galleries and single images
Fancybox.bind('[data-fancybox]', {
// Initialize Fancybox for galleries
Fancybox.bind('[data-fancybox="gallery"]', {
Carousel: {
infinite: false,
},
Expand All @@ -33,5 +33,8 @@ app.initializers.add('darkle/fancybox', () => {
},
},
});

// Make Fancybox available globally for single image clicks
window.Fancybox = Fancybox;
});
});
9 changes: 4 additions & 5 deletions src/DefineGalleryTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ public function __invoke(Configurator $config)
<xsl:choose>
<xsl:when test="parent::FANCYBOX-GALLERY-ITEM">
<a data-fancybox="gallery" data-src="{@url}">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<img>
<xsl:copy-of select="@*"/>
<xsl:attribute name="data-lazy-src">
<xsl:value-of select="@url"/>
</xsl:attribute>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</img>
</a>
</xsl:when>
<xsl:otherwise>
<a data-fancybox="single" href="{@url}">
<a data-fancybox="single" href="{@url}" onclick="event.preventDefault(); Fancybox.show([{src: this.href}]);">
$newTemplate
</a>
</xsl:otherwise>
Expand Down

0 comments on commit 1405ea7

Please sign in to comment.