1/* PrognRoll | https://mburakerman.github.io/prognroll/ | @mburakerman | License: MIT */ 2(function ($) { 3 $.fn.prognroll = function (options) { 4 5 var settings = $.extend({ 6 height: 5, // progress bar height 7 color: "#50bcb6", // progress bar background color 8 custom: false // if you make it true, you can add your custom div and see it's scroll progress on the page 9 }, options); 10 11 return this.each(function () { 12 if ($(this).data('prognroll')) { 13 return false; 14 } 15 $(this).data('prognroll', true); 16 17 var progressBar = $("<span>", { 18 class: "prognroll-bar" 19 }); 20 $("body").prepend(progressBar); 21 22 progressBar.css({ 23 position: "fixed", 24 top: 0, 25 left: 0, 26 width: 0, 27 height: settings.height, 28 backgroundColor: settings.color, 29 zIndex: 2147483647 30 }); 31 32 var globals = { 33 "progressBar": $(".prognroll-bar"), 34 "windowScrollTop": $(window).scrollTop(), 35 "windowOuterHeight": $(window).outerHeight(), 36 "bodyHeight": $(document).height() 37 } 38 39 function bindWindowScroll() { 40 $(window).scroll(function (e) { 41 e.preventDefault(); 42 globals.windowScrollTop = $(window).scrollTop(); 43 globals.windowOuterHeight = $(window).outerHeight(); 44 globals.bodyHeight = $(document).height(); 45 46 var total = (globals.windowScrollTop / (globals.bodyHeight - globals.windowOuterHeight)) * 100; 47 globals.progressBar.css("width", total + "%"); 48 }); 49 } 50 51 if (settings.custom === false) { 52 bindWindowScroll(); 53 } else { 54 // if el has no max-height set 55 if ($(this).css("max-height") == "none") { 56 bindWindowScroll(); 57 } else { 58 $(this).scroll(function (e) { 59 e.preventDefault(); 60 var customScrollTop = $(this).scrollTop(); 61 var customOuterHeight = $(this).outerHeight(); 62 var customScrollHeight = $(this).prop("scrollHeight"); 63 64 var total = (customScrollTop / (customScrollHeight - customOuterHeight)) * 100; 65 globals.progressBar.css("width", total + "%"); 66 }); 67 } 68 } 69 70 // get scroll position on on page load 71 var total = (globals.windowScrollTop / (globals.bodyHeight - globals.windowOuterHeight)) * 100; 72 globals.progressBar.css("width", total + "%"); 73 }); 74 }; 75})(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.