mirror of
https://github.com/iv-org/invidious.git
synced 2025-05-02 06:26:26 -04:00
Fixed console error
This commit is contained in:
parent
420e12bb8b
commit
bde21d527f
12 changed files with 35 additions and 34 deletions
24
assets/js/watched_indicator.js
Normal file
24
assets/js/watched_indicator.js
Normal file
|
@ -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 + '%';
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue