1 (function($){$(function(){
3 t = $('#global-progress').data('t');
5 $text = $('#main-text #book-text');
6 texttop = $text.offset().top;
8 $footnotes = $('#footnotes', $text);
9 if ($footnotes.length) {
10 textbottom = $footnotes.offset().top;
12 textbottom = texttop + $text.height();
15 textlen = textbottom - texttop;
16 progress = (window.scrollY - texttop) / textlen;
17 progress = Math.max(0, Math.min(progress, 1))
18 console.log('SCROLL BODY', progress);
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);