From ad5e74cb27696f62e29808e969d87b78e6e19efc Mon Sep 17 00:00:00 2001 From: Nathan DeTar Date: Sat, 26 Feb 2022 03:11:09 -0800 Subject: [PATCH] Prevent setting progress bar on player close if video is watched. (#182) * Prevent setting progress bar on close if watched. --- tubearchivist/static/script.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tubearchivist/static/script.js b/tubearchivist/static/script.js index 8df9ffd..acc592a 100644 --- a/tubearchivist/static/script.js +++ b/tubearchivist/static/script.js @@ -444,7 +444,7 @@ function getVideoPlayerDuration() { function getVideoPlayerWatchStatus() { var videoId = getVideoPlayerVideoId(); var watched = false; - if(document.getElementById(videoId).className != "unseen-icon") { + if(document.getElementById(videoId) != null && document.getElementById(videoId).className != "unseen-icon") { watched = true; } return watched; @@ -608,8 +608,10 @@ function removePlayer() { function setProgressBar(videoId, currentTime, duration) { progressBar = document.getElementById("progress-" + videoId); progressBarWidth = (currentTime / duration) * 100 + "%"; - if (progressBar) { + if (progressBar && !getVideoPlayerWatchStatus()) { progressBar.style.width = progressBarWidth; + } else if (progressBar) { + progressBar.style.width = "0%"; } }