1const toggleAriaExpanded = (el) => { 2 if (el.getAttribute('aria-expanded') == 'false') { 3 el.setAttribute('aria-expanded', 'true') 4 } else { 5 el.setAttribute('aria-expanded', 'false') 6 } 7 return el.getAttribute('aria-expanded') 8} 9 10document.addEventListener('DOMContentLoaded', () => { 11 if (navigator.userAgent.match(/(Safari|Mac|iPhone|iPad)/i) && !navigator.userAgent.match(/(Firefox|Chrome|Chromium)/i)) { 12 document.body.tabIndex = 0 13 Array.from(document.querySelectorAll('a[href="#"]')) 14 .map(el => { el.tabIndex = 0 }) 15 } 16 17 // const submenus = Array.from(document.querySelectorAll('.menu-item-has-children > a')) 18 const submenus = Array.from(document.querySelectorAll('[aria-haspopup="true"]')) 19 submenus?.map(el => { 20 el.addEventListener('click', (e) => { 21 e.preventDefault() 22 toggleAriaExpanded(el) 23 }) 24 el.addEventListener('blur', (e) => { 25 e.preventDefault() 26 setTimeout(() => { el.setAttribute('aria-expanded', 'false') }, 150) 27 }) 28 }) 29 30 var lazyVideos = [].slice.call(document.querySelectorAll("video.lazy")); 31 if ("IntersectionObserver" in window) { 32 var lazyVideoObserver = new IntersectionObserver(function(entries, observer) { 33 entries.forEach(function(video) { 34 if (video.isIntersecting) { 35 for (var source in video.target.children) { 36 var videoSource = video.target.children[source]; 37 if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE") { 38 videoSource.src = videoSource.dataset.src; 39 } 40 } 41 42 video.target.load(); 43 video.target.classList.remove("lazy"); 44 lazyVideoObserver.unobserve(video.target); 45 } 46 }); 47 }); 48 49 lazyVideos.forEach(function(lazyVideo) { 50 lazyVideoObserver.observe(lazyVideo); 51 }); 52 } 53 54 var searchModal = document.getElementById('search-modal'); 55 searchModal.addEventListener( 'click', (e) => { 56 if ( e.target === e.currentTarget ) { 57 e.preventDefault(); 58 toggleAriaExpanded(searchModal); 59 } 60 }) 61 62 var searchToggle = Array.from(document.querySelectorAll('.search-toggle')); 63 searchToggle?.map(el => { 64 el.addEventListener('click', (e) => { 65 e.preventDefault() 66 toggleAriaExpanded(searchModal) 67 }) 68 }) 69 70 if (theContent = document.getElementById('the-content')) { 71 window.onscroll = () => { 72 var position = document.body.scrollTop || document.documentElement.scrollTop 73 var height = document.documentElement.scrollHeight - document.documentElement.clientHeight 74 var percentage = (position / height) * 100 75 document.getElementById('reading-progress').style.width = percentage.toFixed(2) + '%' 76 } 77 } 78})
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.