1var scrollParameter = '#scrollto='; // parameter used after hash e.g. #scrollto=pipo where pipo is the actual id 2 3window.on("load", function() { 4 scrolltoHash(); 5}); 6 7window.on('hashchange', function() { 8 scrolltoHash(); 9}); 10 11document.ready(function() { 12 document.body.on('click', 'a[href*="'+ scrollParameter + '"]', function(event) { 13 // Only if the hash already is in the URL - because a hashChange is not triggered 14 if (event.target.hash == window.location.hash) { 15 scrolltoHash(); 16 } 17 }); 18}); 19 20 21function scrolltoHash(){ 22 var scrollSpeed = 2000; 23 var hash = window.location.hash; // window.location.hash.substr(1); 24 if (hash.substr(0, scrollParameter.length) == scrollParameter) { 25 var element = document.querySelector('#' + hash.substr(scrollParameter.length)); // + 1 26 var fixedTopHeight = 15; // standard fixed top height - parseInt($(".go_pageWrapper").css('padding-top')) || 0 27 28 // get total height off fixed-top elements and add as margin to page wrapper 29 document.querySelectorAll('.fixed-top').forEach( function(node, index, list) { 30 fixedTopHeight += node.offsetHeight; 31 }); 32 33 // Stop automated scroll when the user scrolls 34 /* 35 $("html, body").one("scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove", function(){ 36 $("html, body").stop(); 37 }); 38 */ 39 40 // Scroll to the element 41 window.scroll({ 42 top: element.offset().top - fixedTopHeight, 43 behavior: "smooth", 44 }); 45 } 46}
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.