mirror of
https://github.com/zedeus/nitter.git
synced 2024-06-10 09:09:21 +00:00
lazyload images: pr #1157 zedeus/nitter
This commit is contained in:
parent
1322d131c8
commit
87b836e03d
|
@ -91,7 +91,7 @@ proc genDate*(pref, state: string): VNode =
|
|||
|
||||
proc genImg*(url: string; class=""): VNode =
|
||||
buildHtml():
|
||||
img(src=getPicUrl(url), class=class, alt="")
|
||||
img(src=getPicUrl(url), class=class, loading="lazy", alt="")
|
||||
|
||||
proc getTabClass*(query: Query; tab: QueryKind): string =
|
||||
if query.kind == tab: "tab-item active"
|
||||
|
|
|
@ -12,7 +12,7 @@ const doctype = "<!DOCTYPE html>\n"
|
|||
proc renderMiniAvatar(user: User; prefs: Prefs): VNode =
|
||||
let url = getPicUrl(user.getUserPic("_mini"))
|
||||
buildHtml():
|
||||
img(class=(prefs.getAvatarClass & " mini"), src=url)
|
||||
img(class=(prefs.getAvatarClass & " mini"), src=url, loading="lazy")
|
||||
|
||||
proc renderHeader(tweet: Tweet; retweet: string; pinned: bool; prefs: Prefs): VNode =
|
||||
buildHtml(tdiv):
|
||||
|
@ -92,10 +92,10 @@ proc renderVideo*(video: Video; prefs: Prefs; path: string): VNode =
|
|||
tdiv(class="attachment video-container"):
|
||||
let thumb = getSmallPic(video.thumb)
|
||||
if not video.available:
|
||||
img(src=thumb)
|
||||
img(src=thumb, loading="lazy")
|
||||
renderVideoUnavailable(video)
|
||||
elif not prefs.isPlaybackEnabled(playbackType):
|
||||
img(src=thumb)
|
||||
img(src=thumb, loading="lazy")
|
||||
renderVideoDisabled(playbackType, path)
|
||||
else:
|
||||
let
|
||||
|
@ -144,7 +144,7 @@ proc renderPoll(poll: Poll): VNode =
|
|||
proc renderCardImage(card: Card): VNode =
|
||||
buildHtml(tdiv(class="card-image-container")):
|
||||
tdiv(class="card-image"):
|
||||
img(src=getPicUrl(card.image), alt="")
|
||||
img(src=getPicUrl(card.image), alt="", loading="lazy")
|
||||
if card.kind == player:
|
||||
tdiv(class="card-overlay"):
|
||||
tdiv(class="overlay-circle"):
|
||||
|
|
Loading…
Reference in a new issue