mirror of
https://github.com/zedeus/nitter.git
synced 2024-12-12 11:06:30 +00:00
Use small video previews
This commit is contained in:
parent
40ef23956a
commit
a8553db66e
1 changed files with 10 additions and 4 deletions
|
@ -4,6 +4,12 @@ import karax/[karaxdsl, vdom, vstyles]
|
||||||
import renderutils
|
import renderutils
|
||||||
import ".."/[types, utils, formatters]
|
import ".."/[types, utils, formatters]
|
||||||
|
|
||||||
|
proc getSmallPic(url: string): string =
|
||||||
|
result = url
|
||||||
|
if "?" notin url:
|
||||||
|
result &= ":small"
|
||||||
|
result = getPicUrl(result)
|
||||||
|
|
||||||
proc renderHeader(tweet: Tweet; retweet=""): VNode =
|
proc renderHeader(tweet: Tweet; retweet=""): VNode =
|
||||||
buildHtml(tdiv):
|
buildHtml(tdiv):
|
||||||
if retweet.len > 0:
|
if retweet.len > 0:
|
||||||
|
@ -52,7 +58,7 @@ proc isPlaybackEnabled(prefs: Prefs; video: Video): bool =
|
||||||
|
|
||||||
proc renderVideoDisabled(video: Video; path: string): VNode =
|
proc renderVideoDisabled(video: Video; path: string): VNode =
|
||||||
buildHtml(tdiv):
|
buildHtml(tdiv):
|
||||||
img(src=getPicUrl(video.thumb))
|
img(src=getSmallPic(video.thumb))
|
||||||
tdiv(class="video-overlay"):
|
tdiv(class="video-overlay"):
|
||||||
case video.playbackType
|
case video.playbackType
|
||||||
of mp4:
|
of mp4:
|
||||||
|
@ -62,7 +68,7 @@ proc renderVideoDisabled(video: Video; path: string): VNode =
|
||||||
|
|
||||||
proc renderVideoUnavailable(video: Video): VNode =
|
proc renderVideoUnavailable(video: Video): VNode =
|
||||||
buildHtml(tdiv):
|
buildHtml(tdiv):
|
||||||
img(src=getPicUrl(video.thumb))
|
img(src=getSmallPic(video.thumb))
|
||||||
tdiv(class="video-overlay"):
|
tdiv(class="video-overlay"):
|
||||||
case video.reason
|
case video.reason
|
||||||
of "dmcaed":
|
of "dmcaed":
|
||||||
|
@ -77,7 +83,7 @@ proc renderVideo*(video: Video; prefs: Prefs; path: string): VNode =
|
||||||
buildHtml(tdiv(class="attachments card")):
|
buildHtml(tdiv(class="attachments card")):
|
||||||
tdiv(class="gallery-video" & container):
|
tdiv(class="gallery-video" & container):
|
||||||
tdiv(class="attachment video-container"):
|
tdiv(class="attachment video-container"):
|
||||||
let thumb = getPicUrl(video.thumb)
|
let thumb = getSmallPic(video.thumb)
|
||||||
if not video.available:
|
if not video.available:
|
||||||
renderVideoUnavailable(video)
|
renderVideoUnavailable(video)
|
||||||
elif not prefs.isPlaybackEnabled(video):
|
elif not prefs.isPlaybackEnabled(video):
|
||||||
|
@ -108,7 +114,7 @@ proc renderGif(gif: Gif; prefs: Prefs): VNode =
|
||||||
buildHtml(tdiv(class="attachments media-gif")):
|
buildHtml(tdiv(class="attachments media-gif")):
|
||||||
tdiv(class="gallery-gif", style={maxHeight: "unset"}):
|
tdiv(class="gallery-gif", style={maxHeight: "unset"}):
|
||||||
tdiv(class="attachment"):
|
tdiv(class="attachment"):
|
||||||
let thumb = getPicUrl(gif.thumb)
|
let thumb = getSmallPic(gif.thumb)
|
||||||
let url = getPicUrl(gif.url)
|
let url = getPicUrl(gif.url)
|
||||||
if prefs.autoplayGifs:
|
if prefs.autoplayGifs:
|
||||||
video(class="gif", poster=thumb, controls="", autoplay="", muted="", loop=""):
|
video(class="gif", poster=thumb, controls="", autoplay="", muted="", loop=""):
|
||||||
|
|
Loading…
Reference in a new issue