Fix hearts
[wolnelektury.git] / src / wolnelektury / static / js / book_text / progress.js
index 8175de6..723e03e 100644 (file)
@@ -1,8 +1,11 @@
 (function($){$(function(){
 
-    t = $('#global-progress').data('t');
+    let t = $('#global-progress').data('t');
+
     function upd_t() {
         $text = $('#main-text #book-text');
+        if (!$text.length) return;
+
         texttop = $text.offset().top;
 
         $footnotes = $('#footnotes', $text);
@@ -15,7 +18,6 @@
         textlen = textbottom - texttop;
         progress = (window.scrollY - texttop) / textlen;
         progress = Math.max(0, Math.min(progress, 1))
-        console.log('SCROLL BODY', progress);
 
         $('#global-progress .filled').css('right', (1 - progress) * 100 + '%');
         tleft = Math.round((1 - progress) * t / 60);