1"use strict"; 2 3var domReady = function domReady(callback) { 4 document.readyState === "interactive" || document.readyState === "complete" ? callback() : document.addEventListener("DOMContentLoaded", callback); 5}; 6 7domReady(function () { 8 /** 9 * for all links with an anchor as href, 10 * if there is no class 'js-no-centered-scroll' or data attribute 'data-no-centered-scroll', 11 * scroll to vertically center the top of the target block in viewport on click event 12 * */ 13 document.addEventListener('click', function(e) { 14 var link = e.target; 15 if (link && typeof link.tagName === 'string' && link.tagName.toLowerCase() === 'a') { 16 var href = link.getAttribute('href'); 17 if (typeof href === 'string' && href.match(/^#\w+/g) && !(link.classList.contains('js-no-centered-scroll') || link.dataset.noCenteredScroll)) { 18 var anchorTarget = document.querySelector(href); 19 if (anchorTarget) { 20 var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 21 var offset = Math.ceil(anchorTarget.getBoundingClientRect().top - viewHeight/ 2 + window.scrollY); 22 e.preventDefault(); 23 window.scroll({ 24 behavior: 'smooth', 25 top: offset, 26 }); 27 } 28 } 29 } 30 }) 31}); 32;
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.