#27 fix issue with description on lazy loaded images

This commit is contained in:
Alan Grainger
2025-05-09 21:47:39 +12:00
parent ea5889f7a6
commit 2bba8d7527
6 changed files with 24 additions and 48 deletions
+2 -27
View File
@@ -32,33 +32,8 @@
<%
// Load the first 50 thumbnails, then load more as the user scrolls. See web.js
items.slice(0, 50).forEach(item => {
// Replace HTML entities for description text (if any)
item.description = item.description.replace(/'/g, '&apos;')
if (item.video) { %>
<a data-video='<%- item.video %>'
<% if (item.description) { %>
data-sub-html='<p><%= item.description %></p>'
<% } %>
<% if (item.downloadUrl) { %>
data-download-url="<%- item.downloadUrl %>"
<% } %>
>
<img alt="" src="<%- item.thumbnailUrl %>"/>
<div class="play-icon"></div>
</a>
<% } else { %>
<a href="<%- item.previewUrl %>"
<% if (item.description) { %>
data-sub-html='<p><%= item.description %></p>'
<% } %>
<% if (item.downloadUrl) { %>
data-download-url="<%- item.downloadUrl %>"
<% } %>
>
<img alt="" src="<%- item.thumbnailUrl %>"/>
</a>
<% }
}) %>
%><%- item %>
<% }) %>
</div>
<script src="/share/static/web.js"></script>
<script src="/share/static/lg/lightgallery.min.js"></script>