diff options
| author | Wes van der Vleuten <16665772+WesVleuten@users.noreply.github.com> | 2023-02-19 20:41:18 +0100 |
|---|---|---|
| committer | Wes van der Vleuten <16665772+WesVleuten@users.noreply.github.com> | 2023-02-19 20:41:18 +0100 |
| commit | bde21d527f1fae4a84b964f1b297d7b246526ba0 (patch) | |
| tree | c1adff68f9e5a47743e6d64d7af4b1d22d708d33 /assets/js | |
| parent | 420e12bb8b4809f819ef4f6cb06c33338d42f125 (diff) | |
| download | invidious-bde21d527f1fae4a84b964f1b297d7b246526ba0.tar.gz invidious-bde21d527f1fae4a84b964f1b297d7b246526ba0.tar.bz2 invidious-bde21d527f1fae4a84b964f1b297d7b246526ba0.zip | |
Fixed console error
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/watched_indicator.js | 24 | ||||
| -rw-r--r-- | assets/js/watched_widget.js | 24 |
2 files changed, 24 insertions, 24 deletions
diff --git a/assets/js/watched_indicator.js b/assets/js/watched_indicator.js new file mode 100644 index 00000000..e971cd80 --- /dev/null +++ b/assets/js/watched_indicator.js @@ -0,0 +1,24 @@ +'use strict'; +var save_player_pos_key = 'save_player_pos'; + +function get_all_video_times() { + return helpers.storage.get(save_player_pos_key) || {}; +} + +document.querySelectorAll('.watched-indicator').forEach(function (indicator) { + var watched_part = get_all_video_times()[indicator.dataset.id]; + var total = parseInt(indicator.dataset.length, 10); + if (watched_part === undefined) { + watched_part = total; + } + var percentage = Math.round((watched_part / total) * 100); + + if (percentage < 5) { + percentage = 5; + } + if (percentage > 90) { + percentage = 100; + } + + indicator.style.width = percentage + '%'; +}); diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js index 02537111..f1ac9cb4 100644 --- a/assets/js/watched_widget.js +++ b/assets/js/watched_widget.js @@ -32,27 +32,3 @@ 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) || {}; -} - -document.querySelectorAll('.watched-indicator').forEach(function (indicator) { - var watched_part = get_all_video_times()[indicator.dataset.id]; - var total = parseInt(indicator.dataset.length, 10); - if (watched_part === undefined) { - watched_part = total; - } - var percentage = Math.round((watched_part / total) * 100); - - if (percentage < 5) { - percentage = 5; - } - if (percentage > 90) { - percentage = 100; - } - - indicator.style.width = percentage + '%'; -}); |
