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))
19 $('#global-progress .filled').css('right', (1 - progress) * 100 + '%');
20 tleft = Math.round((1 - progress) * t / 60);
23 h = Math.floor(tleft / 60);
28 $('#global-progress .progress-text-value').text(tt);
31 $(window).scroll(upd_t);