1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-03-02 02:31:35 +00:00

Implement watched videos

Watched videos on your subscriptions feed will be darkened, and the
option to hide all of them has been added.

This only takes effect if you have enabled saving watched videos on the
server in the settings menu - default is off.
This commit is contained in:
Cadence Ember 2020-12-29 01:42:25 +13:00
parent c3afe77e2d
commit e0bc0d2e81
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
12 changed files with 106 additions and 34 deletions

View file

@ -28,5 +28,4 @@ block content
.videos
each video in data.latestVideos
.channel-video
+video_list_item(video, instanceOrigin)
+video_list_item("channel-video", video, instanceOrigin)

View file

@ -1,19 +1,20 @@
mixin video_list_item(video, instanceOrigin)
- let link = `/watch?v=${video.videoId}`
a(href=link tabindex="-1").thumbnail
img(src=`/vi/${video.videoId}/mqdefault.jpg` width=320 height=180 alt="").image
if video.second__lengthText != undefined
span.duration= video.second__lengthText
.info
div.title: a(href=link).title-link= video.title
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 video.descriptionHtml
div.description!= video.descriptionHtml
mixin video_list_item(className, video, instanceOrigin)
div(class={[className]: true, "video-list-item--watched": video.watched})
- let link = `/watch?v=${video.videoId}`
a(href=link tabindex="-1").thumbnail
img(src=`/vi/${video.videoId}/mqdefault.jpg` width=320 height=180 alt="").image
if video.second__lengthText != undefined
span.duration= video.second__lengthText
.info
div.title: a(href=link).title-link= video.title
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 video.descriptionHtml
div.description!= video.descriptionHtml

View file

@ -8,5 +8,4 @@ block head
block content
main.search-page
each result in results
.search-result
+video_list_item(result, instanceOrigin)
+video_list_item("search-result", result, instanceOrigin)

View file

@ -37,9 +37,9 @@ block content
"https://invidious.fdn.fr"
])
+select("save_history", "Watch history", false, [
{value: "0", text: "Don't save"},
{value: "1", text: "Save"}
+select("save_history", "Watched videos history", false, [
{value: "0", text: "Don't store"},
{value: "1", text: "Store on server"}
])
+select("local", "Fetch videos", false, [

View file

@ -27,9 +27,13 @@ block content
if notLoaded
div #{notLoaded} subscriptions have not been refreshed at all
if settings.save_history
input(type="checkbox" id="watched-videos-display")
.watched-videos-display-container
label(for="watched-videos-display").watched-videos-display-label Hide watched videos
each video in videos
.subscriptions-video
+video_list_item(video, instanceOrigin)
+video_list_item("subscriptions-video", video, instanceOrigin)
else
.no-subscriptions
h2 You have no subscriptions.

View file

@ -66,8 +66,7 @@ block content
aside.related-videos
h2.related-header Related videos
each r in video.recommendedVideos
.related-video
+video_list_item(r, instanceOrigin)
+video_list_item("related-video", r, instanceOrigin)
else
//- error