1(function( $ ) { 2 'use strict'; 3 4 // The DOM needs to be fully loaded (including graphics, iframes, etc) 5 $(window).on('load', function() { 6 7 // Maximum value for the progressbar 8 var winHeight = $(window).height(), 9 docHeight = $(document).height(); 10 var max = docHeight - winHeight; 11 $('.readingProgressbar').attr('max', max); 12 13 var progressForeground = $('.readingProgressbar').attr('data-foreground'); 14 var progressBackground = $('.readingProgressbar').attr('data-background'); 15 var progressHeight = $('.readingProgressbar').attr('data-height'); 16 var progressPosition = $('.readingProgressbar').attr('data-position'); 17 var progressCustomPosition = $('.readingProgressbar').attr('data-custom-position'); 18 var progressFixedOrAbsolute = 'fixed'; 19 20 // Custom position 21 if (progressPosition == 'custom') { 22 $('.readingProgressbar').appendTo(progressCustomPosition); 23 progressPosition = 'bottom'; 24 progressFixedOrAbsolute = 'absolute'; 25 } 26 27 // Styles 28 if ( progressPosition == 'top' ) { 29 var progressTop = '0'; 30 var progressBottom = 'auto'; 31 } else { 32 var progressTop = 'auto'; 33 var progressBottom = '0'; 34 } 35 36 $('.readingProgressbar').css({ 37 'background-color' : progressBackground, 38 'color' : progressForeground, 39 'height' : progressHeight + 'px', 40 'top' : progressTop, 41 'bottom' : progressBottom, 42 'position' : progressFixedOrAbsolute, 43 'display' : 'block' 44 }); 45 46 $('<style>.readingProgressbar::-webkit-progress-bar { background-color: transparent } .readingProgressbar::-webkit-progress-value { background-color: ' + progressForeground + ' } .readingProgressbar::-moz-progress-bar { background-color: ' + progressForeground + ' }</style>') 47 .appendTo('head'); 48 49 // Inital value (if the page is loaded within an anchor) 50 var value = $(window).scrollTop(); 51 $('.readingProgressbar').attr('value', value); 52 // Maths & live update of progressbar value 53 $(document).on('scroll', function() { 54 value = $(window).scrollTop(); 55 $('.readingProgressbar').attr('value', value); 56 }); 57 }); 58 59})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.