mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-07 21:32:51 +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
@@ -255,6 +255,8 @@ export class SubscriptionHistoryController {
|
||||
|
||||
const img = document.createElement("img");
|
||||
img.src = avatar;
|
||||
img.loading = "lazy";
|
||||
img.decoding = "async";
|
||||
img.className = "w-8 h-8 rounded-full object-cover bg-surface-2";
|
||||
img.onerror = function () {
|
||||
this.src = "assets/svg/default-profile.svg";
|
||||
|
||||
Reference in new issue
Block a user