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 ebd2b11 commit 24fad06
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 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.

3 changes: 2 additions & 1 deletion js/src/forum/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ app.initializers.add('darkle/fancybox', () => {
postBody.querySelectorAll('a[data-fancybox]').forEach((link, index) => {
const img = link.querySelector('img');
if (img) {
const src = img.getAttribute('data-src') || img.getAttribute('src') || link.href;
fancyboxItems.push({
src: link.href,
src: src,
type: 'image',
thumbSrc: img.src,
});
Expand Down
16 changes: 14 additions & 2 deletions src/DefineGalleryTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,24 @@ public function __invoke(Configurator $config)
<xsl:choose>
<xsl:when test="parent::FANCYBOX-GALLERY-ITEM">
<a data-fancybox="gallery" href="{@url}">
$newTemplate
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="data-src">
<xsl:value-of select="@url"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</a>
</xsl:when>
<xsl:otherwise>
<a data-fancybox="single" href="{@url}">
$newTemplate
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:attribute name="data-src">
<xsl:value-of select="@url"/>
</xsl:attribute>
<xsl:apply-templates/>
</xsl:copy>
</a>
</xsl:otherwise>
</xsl:choose>
Expand Down

0 comments on commit 24fad06

Please sign in to comment.