1 (function($){$(function(){
3 let t = $('#global-progress').data('t');
6 $text = $('#main-text #book-text');
7 texttop = $text.offset().top;
9 $footnotes = $('#footnotes', $text);
10 if ($footnotes.length) {
11 textbottom = $footnotes.offset().top;
13 textbottom = texttop + $text.height();
16 textlen = textbottom - texttop;
17 progress = (window.scrollY - texttop) / textlen;
18 progress = Math.max(0, Math.min(progress, 1))
20 $('#global-progress .filled').css('right', (1 - progress) * 100 + '%');
21 tleft = Math.round((1 - progress) * t / 60);
24 h = Math.floor(tleft / 60);
29 $('#global-progress .progress-text-value').text(tt);
32 $(window).scroll(upd_t);