Skip to content

Commit

Permalink
fix: Adding lazy load boolean for loading from dataset only
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Boutour <[email protected]>
  • Loading branch information
ViBiOh committed Nov 4, 2022
1 parent d0efbc6 commit 09fc062
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/fibr/static/scripts/async-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ document.addEventListener(
);

window.addEventListener('thumbnail-done', () => {
if (!lazyLoad) {
return;
}

const lazyImageObserver = new IntersectionObserver(
async (entries, observer) => {
for (const entry of entries) {
Expand Down
4 changes: 4 additions & 0 deletions cmd/fibr/templates/story.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

{{ $root := . }}

<script type="text/javascript" nonce="{{ .nonce }}">
const lazyLoad = true;
</script>

<link rel="preload" as="image" href="{{ url "/svg/link?fill=#272727" }}">

{{ if not .Request.Share.Story }}
Expand Down

0 comments on commit 09fc062

Please sign in to comment.