Skip to content

Commit

Permalink
refactor: Optimize lazy loading for images and adjust feed pagination…
Browse files Browse the repository at this point in the history
… offset
  • Loading branch information
TimDaub committed Feb 10, 2025
1 parent e30e2eb commit 7199916
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/views/components/row.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ const row = (
>
<div style="position: relative;">
<img
loading="lazy"
${i > 2 ? 'loading="lazy"' : ''}
style="aspect-ratio: 2 / 1; object-fit:cover; margin: 0 11px; border-radius: 2px; width: calc(100% - 24px);"
src="${DOMPurify.sanitize(story.metadata.image)}"
/>
Expand Down Expand Up @@ -420,7 +420,7 @@ const row = (
)}', event.currentTarget.getAttribute('target'));"
>
<img
loading="lazy"
${i > 2 ? 'loading="lazy"' : ''}
style="max-height: 61px; border: var(--border-line); border-radius: 2px; width: 110px; object-fit: cover;"
src="${DOMPurify.sanitize(story.metadata.image)}"
/></a>`
Expand Down Expand Up @@ -488,7 +488,7 @@ const row = (
${story.avatars.slice(0, 5).map(
(avatar, index) => html`
<img
loading="lazy"
${i > 2 ? 'loading="lazy"' : ''}
src="${avatar}"
alt="avatar"
style="z-index: ${index}; width: ${size}px; height:
Expand Down
2 changes: 1 addition & 1 deletion src/views/feed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ export default async function (trie, theme, page, domain, identity, hash) {
recentJoiners,
false,
currentQuery,
)(story, i + 8),
)(story, i + 5),
)}
<tr style="height: 50px">
<td>
Expand Down

0 comments on commit 7199916

Please sign in to comment.