eirtube/pug/includes/video-list-item.pug
2024-12-19 18:49:09 -06:00

63 lines
3.6 KiB
Plaintext
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mixin video_list_item(className, video, options = {})
div(class={[className]: true, "video-list-item--watched": video.watched})
- let link = `/watch?v=${video.videoId}`
if options.continuous
- link += `&continuous=1&session-watched=${sessionWatchedNext}`
if video.type == "playlist"
- link = `/playlist?list=${video.playlistId}`
else if video.type == "channel"
- link = `/channel/${video.authorId}`
- const showDearrow = options.settings.dearrow > 0 && video.dearrowData && Object.keys(video.dearrowData).length > 0
if showDearrow
input(type="checkbox" checked=(options.settings.dearrow != 1) class={ "dearrow-button-list": true, "change-title": video.dearrowData.title || video.dearrowData.loading, "change-thumb": video.dearrowData.thumbnail || video.dearrowData.loading, "loading": video.dearrowData.loading })
.info
- let title = video.title
- let titleAlt = undefined
if showDearrow && (video.dearrowData.title || video.dearrowData.loading) && options.settings.dearrow != 3
- titleAlt = video.dearrowData.title || video.title
div.title
a(href=link).title-link= title
if titleAlt
div(class={ "title": true, "alt": true })
a(href=link).title-link= titleAlt
div.author-line
a(href=`/channel/${video.authorId}`).author= video.author
- const views = video.viewCountText || video.second__viewCountText
if views
= ` • `
span.views= views
if video.publishedText
= ` • `
span.published= video.publishedText
if options.showMarkWatched
form(method="post" action=`/formapi/markwatched/${video.videoId}`).mark-watched
= ` • `
button.mark-watched__button Mark watched
if video.descriptionHtml
div.description!= video.descriptionHtml
- let thumbnail = `/vi/${video.videoId}/mqdefault.jpg`
- let thumbnailAlt = undefined
if video.type == "playlist"
- thumbnail = video.playlistThumbnail
if video.type == "channel"
- thumbnail = video.authorThumbnails.slice(-1)[0].url
if video.type != "playlist" && showDearrow && (video.dearrowData.thumbnail || video.dearrowData.loading) && options.settings.dearrow != 2
- thumbnailAlt = video.dearrowData.thumbnail ? `${options.settings.dearrow_thumbnail_instance + (settings.dearrow_thumbnail_instance.endsWith("/") ? "" : "/")}${video.dearrowData.thumbnail}` : thumbnail
div(class={ thumbnail: true, channel: video.type == "channel" ? true : undefined })
a(href=link tabindex="-1").thumbnail__link
img(loading="lazy" src=thumbnail width=320 height=180 alt="").image
if thumbnailAlt
a(class={ "thumbnail__link": true, "alt": true } href=link tabindex="-1")
img(loading="lazy" src=thumbnailAlt width=320 height=180 alt="").image
if video.second__lengthText != undefined || video.type == "playlist"
span.duration= video.type != "playlist" ? video.second__lengthText : `${video.videoCount} videos`
details.thumbnail__more
summary.thumbnail__show-more ×
.thumbnail__options-container
.thumbnail__options-list
- const paramsBase = {}
- if (url) paramsBase.referrer = url.pathname + url.search
a(href=`/filters?${new URLSearchParams({"channel-id": video.authorId, label: video.author, ...paramsBase})}`).menu-look Hide this channel
a(href=`/filters?${new URLSearchParams({title: video.title, ...paramsBase})}`).menu-look Hide by title
a(href="/filters").menu-look Edit all filters