1(function () { 2'use strict'; 3var header = document.getElementById( 'jam-header' ); 4var burger = document.getElementById( 'jam-burger' ); 5var takeover = document.getElementById( 'jam-takeover' ); 6var closeBtn = document.getElementById( 'jam-t-close' ); 7var reduced = window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches; 8if ( header ) { 9var ticking = false; 10var shrunk = false; 11var SHRINK_AT = 90; 12var RESTORE_AT = 45; 13var onScroll = function () { 14if ( ticking ) { 15return; 16} 17ticking = true; 18window.requestAnimationFrame( function () { 19var y = window.pageYOffset || document.documentElement.scrollTop; 20if ( ! shrunk && y > SHRINK_AT ) { 21shrunk = true; 22header.classList.add( 'is-shrunk' ); 23} else if ( shrunk && y < RESTORE_AT ) { 24shrunk = false; 25header.classList.remove( 'is-shrunk' ); 26} 27ticking = false; 28} ); 29}; 30window.addEventListener( 'scroll', onScroll, { passive: true } ); 31onScroll(); 32} 33var wraps = document.querySelectorAll( '.jam-link-wrap' ); 34Array.prototype.forEach.call( wraps, function ( wrap ) { 35var trigger = wrap.querySelector( '.has-mega' ); 36if ( ! trigger ) { 37return; 38} 39var setOpen = function ( open ) { 40wrap.classList.toggle( 'is-open', open ); 41trigger.setAttribute( 'aria-expanded', open ? 'true' : 'false' ); 42}; 43wrap.addEventListener( 'mouseenter', function () { setOpen( true ); } ); 44wrap.addEventListener( 'mouseleave', function () { setOpen( false ); } ); 45trigger.addEventListener( 'click', function ( e ) { 46if ( ! wrap.classList.contains( 'is-open' ) ) { 47e.preventDefault(); 48setOpen( true ); 49} 50} ); 51wrap.addEventListener( 'focusout', function ( e ) { 52if ( ! wrap.contains( e.relatedTarget ) ) { 53setOpen( false ); 54} 55} ); 56wrap.addEventListener( 'keydown', function ( e ) { 57if ( 'Escape' === e.key ) { 58setOpen( false ); 59trigger.focus(); 60} 61} ); 62} ); 63var CONFETTI_KEY = 'jammyConfettiFired'; 64var COLORS = [ '#FFD96B', '#F5A623', '#FFF6E9', '#ffb3bd', '#C98A0E' ]; 65function confettiAllowed() { 66if ( reduced ) { 67return false; 68} 69try { 70return ! window.sessionStorage.getItem( CONFETTI_KEY ); 71} catch ( err ) { 72return false; 73} 74} 75function markConfettiFired() { 76try { 77window.sessionStorage.setItem( CONFETTI_KEY, '1' ); 78} catch ( err ) {} 79} 80function burst( x, y ) { 81if ( ! confettiAllowed() ) { 82return; 83} 84markConfettiFired(); 85for ( var i = 0; i < 28; i++ ) { 86var c = document.createElement( 'div' ); 87c.className = 'jam-confetti'; 88c.style.left = x + 'px'; 89c.style.top = y + 'px'; 90c.style.background = COLORS[ Math.floor( Math.random() * COLORS.length ) ]; 91document.body.appendChild( c ); 92var ang = Math.random() * Math.PI * 2; 93var dist = 70 + Math.random() * 160; 94var rot = Math.random() * 720 - 360; 95( function ( el ) { 96var anim = el.animate( 97[ 98{ transform: 'translate(0,0) rotate(0deg) scale(1)', opacity: 1 }, 99{ 100transform: 'translate(' + ( Math.cos( ang ) * dist ) + 'px,' + 101( Math.sin( ang ) * dist + 90 ) + 'px) rotate(' + rot + 'deg) scale(.6)', 102opacity: 0 103} 104], 105{ duration: 850 + Math.random() * 500, easing: 'cubic-bezier(.21,.61,.35,1)' } 106); 107anim.onfinish = function () { 108if ( el.parentNode ) { 109el.parentNode.removeChild( el ); 110} 111}; 112} )( c ); 113} 114} 115if ( burger && takeover ) { 116var lastFocus = null; 117var focusables = function () { 118return Array.prototype.filter.call( 119takeover.querySelectorAll( 'a[href], button:not([disabled])' ), 120function ( el ) { 121return 'hidden' !== window.getComputedStyle( el ).visibility; 122} 123); 124}; 125var setMenu = function ( open ) { 126if ( open ) { 127lastFocus = document.activeElement; 128takeover.hidden = false; 129void takeover.offsetWidth; 130} 131takeover.classList.toggle( 'is-open', open ); 132burger.classList.toggle( 'is-x', open ); 133burger.setAttribute( 'aria-expanded', open ? 'true' : 'false' ); 134burger.setAttribute( 'aria-label', open ? 'Close menu' : 'Open menu' ); 135document.body.classList.toggle( 'jam-menu-open', open ); 136if ( open ) { 137var r = burger.getBoundingClientRect(); 138burst( r.left + r.width / 2, r.top + r.height / 2 ); 139if ( closeBtn ) { 140closeBtn.focus(); 141} 142} else { 143if ( lastFocus && lastFocus.focus ) { 144lastFocus.focus(); 145} 146window.setTimeout( function () { 147if ( ! takeover.classList.contains( 'is-open' ) ) { 148takeover.hidden = true; 149} 150}, 600 ); 151} 152}; 153burger.addEventListener( 'click', function () { 154setMenu( ! takeover.classList.contains( 'is-open' ) ); 155} ); 156if ( closeBtn ) { 157closeBtn.addEventListener( 'click', function () { setMenu( false ); } ); 158} 159takeover.addEventListener( 'click', function ( e ) { 160var tog = e.target.closest( '.jam-t-tog' ); 161if ( ! tog ) { 162return; 163} 164var grp = tog.closest( '.jam-t-grp' ); 165if ( ! grp ) { 166return; 167} 168var open = grp.classList.toggle( 'is-open' ); 169tog.setAttribute( 'aria-expanded', open ? 'true' : 'false' ); 170} ); 171document.addEventListener( 'keydown', function ( e ) { 172if ( 'Escape' === e.key && takeover.classList.contains( 'is-open' ) ) { 173setMenu( false ); 174} 175} ); 176takeover.addEventListener( 'keydown', function ( e ) { 177if ( 'Tab' !== e.key ) { 178return; 179}
180var items = focusables(); 181if ( ! items.length ) { 182return; 183} 184var first = items[ 0 ]; 185var last = items[ items.length - 1 ]; 186if ( e.shiftKey && document.activeElement === first ) { 187e.preventDefault(); 188last.focus(); 189} else if ( ! e.shiftKey && document.activeElement === last ) { 190e.preventDefault(); 191first.focus(); 192} 193} ); 194var touchY = null; 195takeover.addEventListener( 'touchstart', function ( e ) { 196touchY = e.touches[ 0 ].clientY; 197}, { passive: true } ); 198takeover.addEventListener( 'touchend', function ( e ) { 199if ( null === touchY ) { 200return; 201} 202var delta = e.changedTouches[ 0 ].clientY - touchY; 203if ( delta > 90 && takeover.scrollTop <= 0 ) { 204setMenu( false ); 205} 206touchY = null; 207}, { passive: true } ); 208window.addEventListener( 'popstate', function () { 209if ( takeover.classList.contains( 'is-open' ) ) { 210setMenu( false ); 211} 212} ); 213window.addEventListener( 'resize', function () { 214if ( window.innerWidth > 960 && takeover.classList.contains( 'is-open' ) ) { 215setMenu( false ); 216} 217} ); 218} 219} )();
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.