Add lazy loading for the hidden image
authorCyperghost <olaf_schmitz_1@t-online.de>
Thu, 20 Jun 2024 10:30:04 +0000 (12:30 +0200)
committerCyperghost <olaf_schmitz_1@t-online.de>
Thu, 20 Jun 2024 10:30:04 +0000 (12:30 +0200)
ts/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Form/Builder/Field/Controller/FileProcessor.js

index fca641ebbe94168cf055b31752f5d61d04acdf0f..25a96be9b27ef0298c58eb60cc90f11209cbe6f5 100644 (file)
@@ -245,6 +245,7 @@ export class FileProcessor {
           previewImage.src = thumbnail !== undefined ? thumbnail.link : element.link;
           previewImage.alt = element.filename;
           previewImage.style.display = "none";
+          previewImage.loading = "lazy";
           previewImage.classList.add(this.classPrefix + "item__previewImage");
           filenameLink.append(previewImage);
 
index f61abcdd883d589dc30675011fdafadffd85807e..072caadb947989ab0eede92cc4d743382999a69f 100644 (file)
@@ -212,6 +212,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSui
                         previewImage.src = thumbnail !== undefined ? thumbnail.link : element.link;
                         previewImage.alt = element.filename;
                         previewImage.style.display = "none";
+                        previewImage.loading = "lazy";
                         previewImage.classList.add(this.classPrefix + "item__previewImage");
                         filenameLink.append(previewImage);
                         const filenameContainer = elementContainer.querySelector("." + this.classPrefix + "item__filename");