1 (function($){$(function(){
3 let t = $('#global-progress').data('t');
6 $text = $('#main-text #book-text');
7 if (!$text.length) return;
9 texttop = $text.offset().top;
11 $footnotes = $('#footnotes', $text);
12 if ($footnotes.length) {
13 textbottom = $footnotes.offset().top;
15 textbottom = texttop + $text.height();
18 textlen = textbottom - texttop;
19 progress = (window.scrollY - texttop) / textlen;
20 progress = Math.max(0, Math.min(progress, 1))
22 $('#global-progress .filled').css('right', (1 - progress) * 100 + '%');
23 tleft = Math.round((1 - progress) * t / 60);
26 h = Math.floor(tleft / 60);
31 $('#global-progress .progress-text-value').text(tt);
34 $(window).scroll(upd_t);