1(function () { 2 'use strict'; 3 4 (function(){ 5 function getScrollbarWidth(){ 6 document.body.style.setProperty( 7 '--scrollbar-width', 8 `${window.innerWidth - document.body.clientWidth}px` 9 ); 10 } 11 12 window.addEventListener('resize', getScrollbarWidth, {passive:true}); 13 window.addEventListener('DOMContentLoaded', getScrollbarWidth); 14 getScrollbarWidth(); 15 })(); 16 17 (function () { 18 let $toggle, $page, $dialog, $dialogWrapper, $closeButton, $overlay; 19 20 function openMenu() { 21 if ($toggle.getAttribute('aria-expanded') === 'true') { 22 return; 23 } 24 document.body.classList.add('dialog-open'); 25 $dialogWrapper.removeAttribute('inert'); 26 $toggle.setAttribute('aria-expanded', 'true'); 27 $page.setAttribute('inert', 'true'); 28 document.addEventListener('keyup', document_onKeyup); 29 $dialog.focus(); 30 } 31 32 function closeMenu() { 33 if ($toggle.getAttribute('aria-expanded') === 'false') { 34 return; 35 } 36 document.body.classList.remove('dialog-open'); 37 $dialogWrapper.setAttribute('inert', 'true'); 38 $toggle.setAttribute('aria-expanded', 'false'); 39 $page.removeAttribute('inert'); 40 document.removeEventListener('keyup', document_onKeyup); 41 $toggle.focus(); 42 } 43 44 function document_onKeyup(e) { 45 if (e.key === 'Escape') { 46 closeMenu(); 47 } 48 } 49 50 function init() { 51 const media = window.matchMedia('(min-width:1200px)'); 52 if (media.matches) { 53 return; 54 } 55 56 57 $page = document.getElementById('page'); 58 $toggle = document.getElementById('mobile-menu-toggle'); 59 if (!$page || !$toggle) { 60 return; 61 } 62 63 $dialog = document.getElementById('mobile-menu'); 64 $dialogWrapper = document.getElementById('mobile-menu-wrapper'); 65 $closeButton = document.getElementById('mobile-menu-close'); 66 $overlay = document.getElementById('mobile-menu-overlay'); 67 if ( 68 !$dialog || 69 !$dialogWrapper || 70 !$closeButton || 71 !$overlay 72 ) { 73 $toggle.style.display = 'none'; 74 return; 75 } 76 77 $toggle.addEventListener('click', openMenu); 78 $closeButton.addEventListener('click', closeMenu); 79 $overlay.addEventListener('click', closeMenu); 80 81 initDisclosures(); 82 } 83 84 function initDisclosures() { 85 const disclosureLis = $dialog.querySelectorAll('.menu-item-has-children'); 86 disclosureLis.forEach(disc => initSubmenuDisclosure(disc)); 87 } 88 89 function initSubmenuDisclosure(el) { 90 const id = `submenu-${Math.random().toString(16).slice(2)}`; 91 const link = el.querySelector('a:first-child'); 92 if (!link) { 93 return; 94 } 95 const list= el.querySelector('.sub-menu'); 96 if (!list) { 97 return 98 } 99 list.setAttribute('id', id); 100 list.setAttribute('inert', true); 101 const actions = document.createElement('div'); 102 actions.classList.add('mobile-menu__disclosure-actions'); 103 link.remove(); 104 actions.appendChild(link); 105 const button = createDisclosureTrigger(id, link?.innerText || 'menu'); 106 actions.appendChild(button); 107 el.classList.add('mobile-menu__disclosure-container'); 108 el.insertAdjacentElement('afterbegin', actions); 109 button.addEventListener('click', toggleDisclosure); 110 } 111 112 function createDisclosureTrigger(id, label) { 113 const $button = document.createElement('button'); 114 $button.classList.add('mobile-menu__disclosure-trigger'); 115 $button.setAttribute('type', 'button'); 116 $button.setAttribute('aria-label', `More ${label} pages.`); 117 $button.setAttribute('aria-expanded', 'false'); 118 $button.setAttribute('aria-controls', id); 119 $button.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>'; 120 return $button; 121 } 122 123 function toggleDisclosure(e) { 124 const parent = e.currentTarget.closest('li.mobile-menu__disclosure-container'); 125 if (!parent) { 126 return; 127 } 128 if (parent.classList.contains('open')) { 129 parent.classList.remove('open'); 130 const list = document.getElementById(e.currentTarget.getAttribute('aria-controls')); 131 if( list ){ 132 list.setAttribute('inert', 'true'); 133 } 134 e.target.setAttribute('aria-expanded', 'false'); 135 } else { 136 parent.classList.add('open'); 137 const list = document.getElementById(e.currentTarget.getAttribute('aria-controls')); 138 if( list ){ 139 list.removeAttribute('inert'); 140 } 141 e.target.setAttribute('aria-expanded', 'true'); 142 } 143 } 144 145 if (document.readyState === 'loading') { 146 document.addEventListener('DOMContentLoaded', init); 147 } else { 148 init(); 149 } 150 151 })(); 152 153 (function(){ 154 let $toggle, $page, $dialog, $dialogWrapper, $closeButton, $overlay; 155 156 function openMenu() { 157 if ($toggle.getAttribute('aria-expanded') === 'true') { 158 return; 159 } 160 document.body.classList.add('dialog-open'); 161 $dialogWrapper.removeAttribute('hidden'); 162 $toggle.setAttribute('aria-expanded', 'true'); 163 $page.setAttribute('inert', 'true'); 164 document.addEventListener('keyup', document_onKeyup); 165 $dialog.focus(); 166 } 167 168 function closeMenu() { 169 if ($toggle.getAttribute('aria-expanded') === 'false') { 170 return; 171 } 172 document.body.classList.remove('dialog-open'); 173 $dialogWrapper.setAttribute('hidden', 'true'); 174 $toggle.setAttribute('aria-expanded', 'false'); 175 $page.removeAttribute('inert'); 176 document.removeEventListener('keyup', document_onKeyup); 177 $toggle.focus(); 178 } 179 180 function document_onKeyup(e) { 181 if (e.key === 'Escape') { 182 closeMenu(); 183 } 184 } 185
186 function init() { 187 const media = window.matchMedia('(max-width:1200px)'); 188 if (media.matches) { 189 return; 190 } 191 192 193 $page = document.getElementById('page'); 194 $toggle = document.getElementById('search-menu-toggle'); 195 if (!$page || !$toggle) { 196 return; 197 } 198 199 $dialog = document.getElementById('search-dialog'); 200 $dialogWrapper = document.getElementById('search-dialog-wrapper'); 201 $closeButton = document.getElementById('search-dialog-close'); 202 $overlay = document.getElementById('search-dialog-overlay'); 203 if ( 204 !$dialog || 205 !$dialogWrapper || 206 !$closeButton || 207 !$overlay 208 ) { 209 $toggle.style.display = 'none'; 210 return; 211 } 212 213 $toggle.addEventListener('click', openMenu); 214 $closeButton.addEventListener('click', closeMenu); 215 $overlay.addEventListener('click', closeMenu); 216 } 217 218 219 if (document.readyState === 'loading') { 220 document.addEventListener('DOMContentLoaded', init); 221 } else { 222 init(); 223 } 224 })(); 225 226 (function () { 227 228 class CarnivalPopup { 229 constructor($el) { 230 if (!$el) { 231 return; 232 } 233 this.scrollThreshold = 600; 234 this.$el = $el; 235 this.$page = document.getElementById('page'); 236 this.$inner = $el.querySelector('.popup__dialog'); 237 this.$close = $el.querySelector('.popup__dialog-close'); 238 if (!this.$page || !this.$inner || !this.$close) { 239 return; 240 } 241 this.showWhen = this.$el.getAttribute('data-display'); 242 this.onKeyDown = this.__onKeyDown.bind(this); 243 this.onCloseClick = this.__onCloseClick.bind(this); 244 this.onDialogClick = this.__onDialogClick.bind(this); 245 this.onDialogClick = this.__onDialogClick.bind(this); 246 this.onMouseLeave = this.__onMouseLeave.bind(this); 247 this.onScroll = this.__onScroll.bind(this); 248 this.onShowDeferred = this.show.bind(this); 249 250 this.handleDisplayEvent(); 251 } 252 253 handleDisplayEvent() { 254 switch (this.showWhen) { 255 case 'After 5 Seconds': 256 setTimeout(this.onShowDeferred, 5000); 257 break; 258 case 'After Scroll': 259 window.addEventListener('scroll', this.onScroll, {passive: true}); 260 break; 261 case 'Before Exit': 262 document.body.addEventListener('mouseleave', this.onMouseLeave); 263 break; 264 default: 265 this.show(); 266 } 267 } 268 269 __onMouseLeave(e){ 270 if( e.clientY < 0){ 271 document.body.removeEventListener('mouseleave', this.onMouseLeave); 272 this.show(); 273 } 274 } 275 276 __onScroll(e) { 277 if (window.scrollY > this.scrollThreshold) { 278 window.removeEventListener('scroll', this.onScroll); 279 this.show(); 280 } 281 } 282 283 show() { 284 this.activeElement = document.activeElement; 285 this.$el.addEventListener('click', this.onCloseClick); 286 this.$inner.addEventListener('click', this.onDialogClick); 287 this.$close.addEventListener('click', this.onCloseClick); 288 window.addEventListener('keydown', this.onKeyDown); 289 this.$page.setAttribute('inert', 'true'); 290 document.body.classList.add('dialog-open'); 291 this.$el.classList.add('visible'); 292 } 293 294 hide() { 295 this.$el.removeEventListener('click', this.onCloseClick); 296 this.$inner.removeEventListener('click', this.onDialogClick); 297 this.$close.removeEventListener('click', this.onCloseClick); 298 window.removeEventListener('keydown', this.onKeyDown); 299 this.$el.classList.remove('visible'); 300 document.body.classList.remove('dialog-open'); 301 this.$page.removeAttribute('inert'); 302 if (this.activeElement) { 303 this.activeElement.focus(); 304 } 305 } 306 307 __onKeyDown(e) { 308 if (e.key === 'Esc' || e.key === 'Escape') { 309 this.hide(); 310 } 311 } 312 313 __onCloseClick(e) { 314 this.hide(); 315 } 316 317 __onDialogClick(e) { 318 e.stopPropagation(); 319 } 320 } 321 322 function initPopups() { 323 const $popup = document.querySelector('.popup'); 324 325 if ($popup) { 326 new CarnivalPopup($popup); 327 } 328 } 329 330 if (document.readyState === 'loading') { 331 document.addEventListener('DOMContentLoaded', initPopups); 332 } else { 333 initPopups(); 334 } 335 336 })(); 337 338})();
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.