diff options
| author | Wes van der Vleuten <16665772+WesVleuten@users.noreply.github.com> | 2023-01-21 23:08:24 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-21 23:08:24 +0100 |
| commit | 4aa696fa6ea11959e72b7c084d0b55b2c5476a07 (patch) | |
| tree | dbcfcf02f2fc3c1972b935f034bf786778fc8b31 /assets/js | |
| parent | d3d9cfdd0d1d0739b88e34fbb39653131d475665 (diff) | |
| download | invidious-4aa696fa6ea11959e72b7c084d0b55b2c5476a07.tar.gz invidious-4aa696fa6ea11959e72b7c084d0b55b2c5476a07.tar.bz2 invidious-4aa696fa6ea11959e72b7c084d0b55b2c5476a07.zip | |
Update assets/js/watched_widget.js with suggestion of AHOHNMYC
Co-authored-by: AHOHNMYC <24810600+AHOHNMYC@users.noreply.github.com>
Diffstat (limited to 'assets/js')
| -rw-r--r-- | assets/js/watched_widget.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/assets/js/watched_widget.js b/assets/js/watched_widget.js index d1b55d28..02537111 100644 --- a/assets/js/watched_widget.js +++ b/assets/js/watched_widget.js @@ -39,11 +39,9 @@ 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); +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; } @@ -57,4 +55,4 @@ for (var i = 0; i < watchedIndicators.length; i++) { } indicator.style.width = percentage + '%'; -} +}); |
