1"use strict"; 2 3function customRules(element) { 4 return !(element.classList.contains('interstitial-minified') || element.classList.contains('interstitial-learn-more') || element.classList.contains('interstitial-collapse')); 5} 6 7function isClicking() { 8 document.body.classList.add('user-is-clicking'); 9 document.body.classList.remove('user-is-tabbing'); 10} 11 12function isTabbing(e) { 13 var keyCode = e.keyCode || e.which; 14 15 if (keyCode === 9) { 16 document.body.classList.add('user-is-tabbing'); 17 document.body.classList.remove('user-is-clicking'); 18 } 19} 20 21document.onmousedown = isClicking; 22document.onkeydown = isTabbing; 23var previousElementOffsetTop = 0; 24 25Element.prototype.documentOffsetTop = function () { 26 return this.offsetTop + (this.offsetParent ? this.offsetParent.documentOffsetTop() : 0); 27}; 28 29Element.prototype.scrollIntoCustomPosition = function () { 30 if (customRules(document.activeElement)) { 31 var documentOffsetTop = this.documentOffsetTop(); 32 var elementOffsetHeight = document.activeElement.offsetHeight; 33 var resultPosition = documentOffsetTop - window.innerHeight / 2 + elementOffsetHeight / 2; 34 35 if (Math.abs(previousElementOffsetTop - documentOffsetTop) > 100 || elementOffsetHeight > 100) { 36 window.scrollTo(0, resultPosition); 37 previousElementOffsetTop = documentOffsetTop; 38 } 39 } 40}; 41 42function jumpFocusAlt(e) { 43 var keyCode = e.keyCode || e.which; 44 45 if (keyCode === 9) { 46 if (document.body.classList.contains('user-is-tabbing')) { 47 document.activeElement.scrollIntoCustomPosition(); 48 } 49 } 50} 51 52window.addEventListener('keyup', jumpFocusAlt);
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.