mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-04 20:02:26 +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
@@ -1471,6 +1471,8 @@ export class ProfileModalController {
|
||||
img.src = entry.previewUrl;
|
||||
img.alt = entry.name || "Attachment preview";
|
||||
img.className = "h-24 w-24 rounded-lg object-cover";
|
||||
img.loading = "lazy";
|
||||
img.decoding = "async";
|
||||
item.appendChild(img);
|
||||
}
|
||||
|
||||
@@ -2892,6 +2894,8 @@ export class ProfileModalController {
|
||||
? formatNpub(meta.npub) || DEFAULT_SAVED_PROFILE_LABEL
|
||||
: DEFAULT_SAVED_PROFILE_LABEL);
|
||||
avatarImg.alt = `${cardDisplayName} avatar`;
|
||||
avatarImg.loading = "lazy";
|
||||
avatarImg.decoding = "async";
|
||||
avatarSpan.appendChild(avatarImg);
|
||||
|
||||
const metaSpan = document.createElement("div");
|
||||
|
||||
Reference in new issue
Block a user