From e0238d7e7dbe7c6af03183f00584a7b9e6e1329a Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 26 Apr 2021 00:22:14 +1200 Subject: [PATCH] Preserve session-watched param on auto-proceed --- html/static/js/continuous.js | 5 +++-- pug/video.pug | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/html/static/js/continuous.js b/html/static/js/continuous.js index dfbcd30..2241ee4 100644 --- a/html/static/js/continuous.js +++ b/html/static/js/continuous.js @@ -6,8 +6,9 @@ console.log video.addEventListener("ended", () => { if (data.continuous) { - const first = data.recommendedVideos[0] - window.location.assign(`/watch?v=${first.videoId}&continuous=1`) + const first = q("#continuous-first") + const url = first.querySelector(".title-link").href + location.assign(url) } }) diff --git a/pug/video.pug b/pug/video.pug index 804d7b9..bfdd301 100644 --- a/pug/video.pug +++ b/pug/video.pug @@ -18,7 +18,7 @@ block content if first script(type="module" src=getStaticURL("html", "/static/js/continuous.js")) noscript - meta(http-equiv="refresh" content=`${video.lengthSeconds+5};url=/watch?v=${first.videoId}&continuous=1`) + meta(http-equiv="refresh" content=`${video.lengthSeconds+5};url=/watch?v=${first.videoId}&continuous=1&session-watched=${sessionWatchedNext}`) main.video-page .main-video-section .video-container @@ -91,7 +91,8 @@ block content if column.length .related-cols h2.related-header Autoplay next - +video_list_item("related-video", column.shift(), instanceOrigin, {continuous: true}) + #continuous-first + +video_list_item("related-video", column.shift(), instanceOrigin, {continuous: true}) if column.length .related-cols h2.related-header Related videos