Fixed console error

pull/3383/head
Wes van der Vleuten 2 years ago
parent 420e12bb8b
commit bde21d527f

@ -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 + '%';
});

@ -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 + '%';
});

@ -39,7 +39,7 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<% if query %> <% if query %>
<%- query_encoded = URI.encode_www_form(query.text, space_to_plus: true) -%> <%- query_encoded = URI.encode_www_form(query.text, space_to_plus: true) -%>

@ -49,7 +49,7 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-md-4-5"></div> <div class="pure-u-1 pure-u-md-4-5"></div>

@ -62,7 +62,7 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">

@ -33,4 +33,4 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>

@ -17,4 +17,4 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>

@ -54,6 +54,7 @@
}.to_pretty_json }.to_pretty_json
%> %>
</script> </script>
<script src="/js/watched_widget.js"></script>
<div class="pure-g"> <div class="pure-g">
<% videos.each do |item| %> <% videos.each do |item| %>
@ -61,7 +62,7 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">

@ -46,4 +46,4 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>

@ -24,7 +24,7 @@
<%- end -%> <%- end -%>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">

@ -106,7 +106,7 @@
<% end %> <% end %>
</div> </div>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">

@ -37,7 +37,7 @@
</div> </div>
<%- end -%> <%- end -%>
<script src="/js/watched_widget.js"></script> <script src="/js/watched_indicator.js"></script>
<div class="pure-g h-box"> <div class="pure-g h-box">
<div class="pure-u-1 pure-u-lg-1-5"> <div class="pure-u-1 pure-u-lg-1-5">

Loading…
Cancel
Save