mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-02 10:52:27 +00:00
perf: enable lazy loading for avatars and thumbnails
Added `loading="lazy"` and `decoding="async"` attributes to dynamically created `<img>` elements in: - `js/historyView.js` (avatars) - `js/ui/subscriptionHistoryController.js` (channel icons) - `js/searchView.js` (added `decoding="async"`) - `js/ui/profileModal/ProfileDirectMessageRenderer.js` (attachment previews, avatars) - `js/ui/profileModalController.js` (attachment previews, saved profile avatars) This reduces initial page load impact and bandwidth usage by deferring off-screen image loading. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
216361ed77
commit
df62585106
6 files changed
+62
No files matched your search
@@ -390,6 +390,8 @@ export class ProfileDirectMessageRenderer {
|
||||
img.src = result.objectUrl;
|
||||
img.alt = attachment.name || "Attachment preview";
|
||||
img.className = "h-40 w-full rounded-lg object-cover";
|
||||
img.loading = "lazy";
|
||||
img.decoding = "async";
|
||||
attachmentCard.appendChild(img);
|
||||
} else if (attachment.type?.startsWith("video/")) {
|
||||
const video = document.createElement("video");
|
||||
@@ -884,6 +886,8 @@ export class ProfileDirectMessageRenderer {
|
||||
avatarImg.className = "h-full w-full object-cover";
|
||||
avatarImg.src = avatarUrl;
|
||||
avatarImg.alt = `${safeName} avatar`;
|
||||
avatarImg.loading = "lazy";
|
||||
avatarImg.decoding = "async";
|
||||
avatarWrapper.appendChild(avatarImg);
|
||||
|
||||
const textStack = document.createElement("div");
|
||||
|
||||
Reference in new issue
Block a user