summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorWes van der Vleuten <16665772+WesVleuten@users.noreply.github.com>2022-11-07 19:03:23 +0000
committerWes van der Vleuten <16665772+WesVleuten@users.noreply.github.com>2022-11-07 20:04:46 +0100
commit7b573817734dfd48fc6d1fbdc9a0a99f379f0ed1 (patch)
treead38b4422aca94cefe9da2871ba471882295d832 /assets/js
parent437f42250e381ab7652e07b4a413bb5d152356e1 (diff)
downloadinvidious-7b573817734dfd48fc6d1fbdc9a0a99f379f0ed1.tar.gz
invidious-7b573817734dfd48fc6d1fbdc9a0a99f379f0ed1.tar.bz2
invidious-7b573817734dfd48fc6d1fbdc9a0a99f379f0ed1.zip
Added watch indicator
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/watched_widget.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js
index f1ac9cb4..10b33c1a 100644
--- a/assets/js/watched_widget.js
+++ b/assets/js/watched_widget.js
@@ -32,3 +32,30 @@ function mark_unwatched(target) {
}
});
}
+
+
+var save_player_pos_key = 'save_player_pos';
+
+function get_all_video_times() {
+ return helpers.storage.get(save_player_pos_key) || {};
+}
+
+var watchedIndicators = document.getElementsByClassName('watched-indicator');
+for (var i = 0; i < watchedIndicators.length; i++) {
+ var indicator = watchedIndicators[i];
+
+ var watched_part = get_all_video_times()[indicator.getAttribute('data-id')];
+ var total = parseInt(indicator.getAttribute('data-length'), 10);
+
+ var percentage = Math.round((watched_part / total) * 100);
+
+
+ if (percentage < 5) {
+ percentage = 5;
+ }
+ if (percentage > 90) {
+ percentage = 100;
+ }
+
+ indicator.style.width = percentage + '%';
+}