1var _DeferredScripts = _DeferredScripts || []; 2 3function initDeferredVideos() { 4 var maxVideoResolution = 768; 5 $("video.defer.init").each(function () { 6 //if (window.innerWidth >= maxVideoResolution) { 7 $(this).find("source").each(function () { 8 var sourceFile = $(this).attr("data-src"); 9 $(this).attr("src", sourceFile); 10 }); 11 $(this).removeClass("init"); 12 var video = $(this)[0]; 13 video.load(); 14 video.play(); 15 //} 16 }); 17 $("video.defer:not(.init)").each(function () { 18 var video = $(this)[0]; 19 if (window.innerWidth >= maxVideoResolution) { 20 //video.play(); 21 } else { 22 //video.pause(); 23 } 24 }); 25} 26 27// BEGIN DOC READY 28jQuery(document).ready(function() { 29 30 // BEGIN: VIDEO DEFER 31 if ($("video.defer").length > 0) { 32 _DeferredScripts.push({ 33 //object properties here: 34 priority: 1, 35 thirdParty: 0, 36 callback: function () { 37 $(window).bind("resize", function () { 38 initDeferredVideos(); 39 }); 40 initDeferredVideos(); 41 } 42 }); 43 } 44 // END: VIDEO DEFER 45 46 // BEGIN: HOME VIDEO PLAY OPTIONS - UPDATE IDs AND SPAN TEXT AS NEEDED 47 if (jQuery("#homeVideo").length != 0) { 48 var ppbutton = document.getElementById("playButton"); 49 ppbutton.addEventListener("click", playPause); 50 mainVideo = document.getElementById("homeVideo"); 51 jQuery("#playButton").on('click', function(){ 52 $(this).addClass('initial'); 53 }); 54 function playPause() { 55 if (mainVideo.paused) { 56 mainVideo.play(); 57 ppbutton.innerHTML = "<span>Pause Home Video</span>"; 58 jQuery("#playButton").addClass("on"); 59 jQuery("#playButton").removeClass("initial"); 60 } 61 else { 62 mainVideo.pause(); 63 ppbutton.innerHTML = "<span>Play Home Video</span>"; 64 jQuery("#playButton").removeClass("on"); 65 jQuery("#playButton").removeClass("initial"); 66 } 67 } 68 var screenWidth = $(window).width(); 69 if (screenWidth < 768){ 70 $('#homeVideo').removeAttr('controls'); 71 } else { 72 $('#homeVideo').attr('controls'); 73 } 74 } 75 // END: HOME VIDEO PLAY OPTIONS - UPDATE IDs AND SPAN TEXT AS NEEDED 76 77 // BEGIN: PROGRAM DETAIL VIDEO PLAY OPTIONS - UPDATE IDs AND SPAN TEXT AS NEEDED 78 if (jQuery("#landingVideo").length != 0) { 79 var ppbutton1 = document.getElementById("playButton"); 80 ppbutton1.addEventListener("click", playPause); 81 landingVideo = document.getElementById("landingVideo"); 82 jQuery("#playButton").on('click', function(){ 83 $(this).addClass('initial'); 84 }); 85 function playPause() { 86 if (landingVideo.paused) { 87 landingVideo.play(); 88 ppbutton1.innerHTML = "<span>Pause Video</span>"; 89 jQuery("#playButton").addClass("on"); 90 jQuery("#playButton").removeClass("initial"); 91 } 92 else { 93 landingVideo.pause(); 94 ppbutton1.innerHTML = "<span>Play Video</span>"; 95 jQuery("#playButton").removeClass("on"); 96 jQuery("#playButton").removeClass("initial"); 97 } 98 } 99 } 100 // END: PROGRAM DETAIL VIDEO PLAY OPTIONS - UPDATE IDs AND SPAN TEXT AS NEEDED 101 102 //BEGIN: TOGGLE QUICKLINKS NAV 103 var $menu = jQuery('.quicklinksMenu'); 104 jQuery(document).mouseup(function (e) { 105 if (!$menu.is(e.target) // if the target of the click isn't the container... 106 && $menu.has(e.target).length === 0) // ... nor a descendant of the container 107 { 108 $menu.removeClass('open'); 109 if(jQuery(".quicklinksMenu").hasClass('open')) { 110 jQuery("#toggleQuicklinks").attr('aria-expanded', true); 111 } else { 112 jQuery("#toggleQuicklinks").attr('aria-expanded', false); 113 } 114 jQuery("#quicklinkSubMenu").slideUp("slow"); 115 } 116 }); 117 jQuery('#toggleQuicklinks').click(function () { 118 $menu.toggleClass('open'); 119 if(jQuery(".quicklinksMenu").hasClass('open')) { 120 jQuery("#toggleQuicklinks").attr('aria-expanded', true); 121 } else {
122 jQuery("#toggleQuicklinks").attr('aria-expanded', false); 123 } 124 jQuery("#quicklinkSubMenu").slideToggle("slow"); 125 }); 126 // ESC Mobile Menu 127 $(document).keydown(function(e) { 128 if (e.keyCode == 27) { // escape key maps to keycode '27' 129 jQuery('.quicklinksMenu.open > #toggleQuicklinks').trigger('click'); 130 } 131 }); 132 //END: TOGGLE QUICKLINKS NAV 133 134 //BEGIN: TOGGLE TOP NAV 135 jQuery('#skipToTopNav, #topNavMenu').click(function (e) { 136 if (jQuery(e.target).attr('id') != 'toggleButtonClose' ) { 137 jQuery("#skipToTopNav").addClass('open'); 138 jQuery(".dim").addClass('on'); 139 jQuery("#skipToTopNav, #toggleButtonClose").attr('aria-expanded', true); 140 jQuery("#toggleButtonClose, #toggleButtonCloseBottom").removeClass('close'); 141 jQuery("body").addClass("fixed-position"); 142 jQuery("body").css("overflow-y","hidden"); 143 jQuery(".header li.sub").removeClass("enter"); 144 } 145 }); 146 jQuery('.dim,#toggleButtonClose,#toggleButtonCloseBottom').click(function () { 147 jQuery("#toggleButtonClose,#toggleButtonCloseBottom").addClass('close'); 148 jQuery(".dim").removeClass('on'); 149 jQuery("#skipToTopNav, #toggleButtonClose, #toggleButtonCloseBottom").attr('aria-expanded', false); 150 jQuery("#skipToTopNav").removeClass('open'); 151 jQuery("body").css("overflow-y","auto"); 152 jQuery("body").removeClass("fixed-position"); 153 event.stopPropagation(); 154 }) 155 //END: TOGGLE TOP NAV 156 157 // BEGIN: FOCUS TRAP FOR TOP NAV 158 var $topNav = jQuery('#topNavMenu'); 159 var $closeBtn = jQuery('#toggleButtonClose'); 160 function getFocusableElements() { 161 return $topNav.find('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])') 162 .filter(':visible'); 163 } 164 jQuery(document).on('keydown', function (e) { 165 // Only run when menu is open 166 if (!jQuery('#skipToTopNav').hasClass('open')) return; 167 if (e.key === 'Tab') { 168 var $focusable = getFocusableElements(); 169 if ($focusable.length === 0) return; 170 var first = $focusable.first()[0]; 171 var last = $focusable.last()[0]; 172 // SHIFT + TAB (backwards) 173 if (e.shiftKey) { 174 if (document.activeElement === first) { 175 e.preventDefault(); 176 $closeBtn.focus(); 177 } 178 } else { 179 // TAB forward 180 if (document.activeElement === last) { 181 e.preventDefault(); 182 $closeBtn.focus(); 183 } 184 } 185 } 186 }); 187 // Optional: move focus to close button when menu opens 188 jQuery('#skipToTopNav').on('click', function () { 189 setTimeout(function () { 190 if (jQuery('#skipToTopNav').hasClass('open')) { 191 $closeBtn.focus(); 192 } 193 }, 50); 194 }); 195 // END: FOCUS TRAP FOR TOP NAV 196 197 // BEGIN: TOP NAV ACCESSIBLE MENU 198 if (jQuery(".menuContainer").length != 0) { 199 var menuItems = document.querySelectorAll('#menu li.menuItem'); 200 Array.prototype.forEach.call(menuItems, function(el, i){ 201 var activatingA = el.querySelector('a'); 202 var btn = '<button class="navSubButton" aria-haspopup="true"><span class="expander"><span class="visuallyhidden">show submenu for ' + activatingA.text + '</span></span></button>'; 203 activatingA.insertAdjacentHTML('afterend', btn); 204 205 el.querySelector('.navSubButton').addEventListener("click", function(event){ 206 jQuery(this).next('.subNav').slideToggle(); 207 jQuery(this).toggleClass("clicked"); 208 if (this.parentNode.className == "menuItem") { 209 this.parentNode.className = "menuItem open"; 210 } else { 211 this.parentNode.className = "menuItem"; 212 } 213 event.preventDefault(); 214 }); 215 }); 216 // ESC Mobile Menu 217 $(document).keydown(function(e) { 218 if (e.keyCode == 27) { // escape key maps to keycode '27' 219 $('#toggleButtonClose').trigger('click'); 220 } 221 }); 222 } 223 224 // BEGIN: HEADER ACCESSIBLE MENU 225 var $menuDropdown = jQuery('.header li.sub'); 226 jQuery(document).mouseup(function (e) { 227 if (!$menuDropdown.is(e.target) // if the target of the click isn't the container... 228 && $menuDropdown.has(e.target).length === 0) // ... nor a descendant of the container 229 { 230 $menuDropdown.removeClass('open'); 231 $menuDropdown.removeClass('enter'); 232 if(jQuery(".header li.sub").hasClass('open')) { 233 jQuery(".subMenu").attr('aria-expanded', true); 234 } else { 235 jQuery(".subMenu").attr('aria-expanded', false); 236 } 237 } 238 }); 239 240 if(jQuery(".header li.sub").hasClass("enter")) { 241 jQuery(".searchMenu").removeClass("open"); 242 jQuery(".toggleBtn").removeClass("open"); 243 } 244 245 // ESC Mobile Menu 246 $('.header li.sub').keydown(function(e) { 247 if (e.keyCode == 13) { // enter key maps to keycode '13' 248 jQuery('.header li.sub').toggleClass('enter'); 249 jQuery('.searchMenu').removeClass('open'); 250 } 251 if (e.keyCode == 27) { // escape key maps to keycode '27' 252 jQuery('.header li.sub').removeClass('enter'); 253 } 254 }); 255 $('.header li.sub').keyup(function(e) { 256 if (e.keyCode == 9) { // tab key maps to keycode '9' 257 jQuery('.header li.sub').addClass('enter'); 258 jQuery('.searchMenu').removeClass('open'); 259 } 260 }); 261 // END: HEADER ACCESSIBLE MENU 262 263 264 jQuery("#mainMenu > nav").accessibleMegaMenu({ 265 uuidPrefix: "accessibleMegamenu",
266 menuClass: "navMenu", 267 topNavItemClass: "menuItem", 268 panelClass: "subNav", 269 panelGroupClass: "subNavGroup", 270 hoverClass: "hover", 271 focusClass: "focus", 272 openClass: "open" 273 }); 274 // END: TOP NAV ACCESSIBLE MENU 275 276 //BEGIN: TOGGLE SEARCH NAV 277 var $menuSearch = jQuery('.searchMenu'); 278 jQuery(document).mouseup(function (e) { 279 if (!$menuSearch.is(e.target) // if the target of the click isn't the container... 280 && $menuSearch.has(e.target).length === 0) // ... nor a descendant of the container 281 { 282 $menuSearch.removeClass('open'); 283 if(jQuery(".searchMenu").hasClass('open')) { 284 jQuery("#toggleSearch").attr('aria-expanded', true); 285 } else { 286 jQuery("#toggleSearch").attr('aria-expanded', false); 287 } 288 } 289 }); 290 var $menuSearchClick = jQuery('.searchMenu'); 291 jQuery('#toggleSearch').click(function () { 292 $menuSearchClick.toggleClass('open'); 293 if(jQuery(".searchMenu").hasClass('open')) { 294 jQuery("#toggleSearch").attr('aria-expanded', true); 295 setTimeout(function () { 296 jQuery("#searchBoxLabel").focus(); 297 }, 500); 298 jQuery('.header li.sub').removeClass('open'); 299 jQuery('.header li.sub').removeClass('enter'); 300 } else { 301 jQuery("#toggleSearch").attr('aria-expanded', false); 302 } 303 }); 304 // ESC Mobile Menu 305 $(document).keydown(function(e) { 306 if (e.keyCode == 27) { // escape key maps to keycode '27' 307 jQuery('.searchMenu.open > #toggleSearch').trigger('click'); 308 } 309 }); 310 //END: TOGGLE SEARCH NAV 311 312 //BEGIN: MAIN SEARCH INPUT FOCUS KEYPRESS 313 jQuery('#toggleSearch').keypress(function(){ 314 setTimeout(function () { 315 jQuery("#searchBoxLabel").focus(); 316 }, 500); 317 }); 318 //END: MAIN SEARCH INPUT FOCUS KEYPRESS 319 320 // BEGIN: HEADER SCROLL 321 var didScroll; 322 var lastScrollTop = 0; 323 var delta = 5; 324 var navbarHeight = 1; 325 $(window).scroll(function(event){ 326 didScroll = true; 327 }); 328 setInterval(function() { 329 if (didScroll) { 330 hasScrolled(); 331 didScroll = false; 332 } 333 }, 250); 334 function hasScrolled() { 335 var st = $(this).scrollTop(); 336 // Make sure they scroll more than delta 337 if(Math.abs(lastScrollTop - st) <= delta) 338 return; 339 // If they scrolled down and are past the navbar, add class .nav-up. 340 // This is necessary so you never see what is "behind" the navbar. 341 if (st > lastScrollTop && st > navbarHeight){ 342 // Scroll Down 343 if (jQuery(".toggleBtn.open").length == 0) { 344 jQuery('.header').fadeOut(); 345 jQuery('.header').removeClass("nav-up"); 346 } 347 } else { 348 // Scroll Up 349 if(st + $(window).height() < $(document).height()) { 350 if (jQuery(".toggleBtn.open").length == 0) { 351 jQuery('.header').fadeIn(); 352 jQuery('.header').addClass("nav-up"); 353 } 354 } 355 } 356 if(st <= 50){ 357 jQuery('.header').removeClass("nav-up"); 358 } 359 lastScrollTop = st; 360 } 361 // END: HEADER SCROLL 362 363 // BEGIN: BACK TO TOP LINK 364 // COMMENT: ADDS SCOLL FUNCTIONALITY TO #topLink ELEMENTS BACK TO TOP BUTTON/LINK 365 jQuery('.backToTop').click(function() { 366 jQuery("html, body").animate({ 367 scrollTop: 0 368 }, 600); 369 return false; 370 }); 371 // END: BACK TO TOP LINK 372 373 //BEGIN: EMERGENCY POPUP MAGNIFIC-POPUP 374 if (jQuery(".toggleAlertBtn").length != 0) { 375 $(window).on('load', function () { 376 if (!localStorage.getItem('popup_show')) { 377 $.magnificPopup.open({ callbacks: { 378 open: function(){ 379 jQuery(".toggleAlertBtn").hide(); 380 }, 381 close: function(){ 382 jQuery(".toggleAlertBtn").show(); 383 } 384 }, 385 items: { 386 src: '#alertMessage' 387 }, 388 type: 'inline', 389 mainClass: 'mfp-fade', 390 removalDelay: 160, 391 preloader: false, 392 fixedContentPos: false, 393 closeOnContentClick: false 394 }, 0); 395 localStorage.setItem('popup_show', 'true'); // Set the flag in localStorage 396 } 397 }); 398 } 399 if (jQuery(".toggleAlertBtn").length != 0) { 400 jQuery('.toggleAlertBtn').magnificPopup({ 401 callbacks: { 402 open: function(){ 403 jQuery(".toggleAlertBtn").hide(); 404 }, 405 close: function(){ 406 jQuery(".toggleAlertBtn").show(); 407 } 408 }, 409 items: { 410 src: '#alertMessage' 411 }, 412 type: 'inline', 413 mainClass: 'mfp-fade', 414 removalDelay: 160, 415 preloader: false,
416 fixedContentPos: false, 417 closeOnContentClick: false 418 }); 419 } 420 //END: EMERGENCY POPUP MAGNIFIC-POPUP 421 422 //BEGIN: MESSAGE ALERT HOME 423 if (jQuery(".toggleAlertBtnMessage").length != 0) { 424 $(window).on('load', function () { 425 if (!localStorage.getItem('popup_show')) { 426 $.magnificPopup.open({ 427 callbacks: { 428 open: function(){ 429 jQuery(".toggleAlertBtnMessage").hide(); 430 }, 431 close: function(){ 432 jQuery(".toggleAlertBtnMessage").show(); 433 } 434 }, 435 items: { 436 src: '#alertMessageHome' 437 }, 438 type: 'inline', 439 mainClass: 'mfp-fade', 440 removalDelay: 160, 441 preloader: false, 442 fixedContentPos: false, 443 closeOnContentClick: false 444 }, 0); 445 localStorage.setItem('popup_show', 'true'); // Set the flag in localStorage 446 } 447 }); 448 } 449 if (jQuery(".toggleAlertBtnMessage").length != 0) { 450 jQuery('.toggleAlertBtnMessage').magnificPopup({ 451 callbacks: { 452 open: function(){ 453 jQuery(".toggleAlertBtnMessage").hide(); 454 }, 455 close: function(){ 456 jQuery(".toggleAlertBtnMessage").show(); 457 } 458 }, 459 items: { 460 src: '#alertMessageHome' 461 }, 462 type: 'inline', 463 mainClass: 'mfp-fade', 464 removalDelay: 160, 465 preloader: false, 466 fixedContentPos: false, 467 closeOnContentClick: false 468 }); 469 } 470 //END: MESSAGE ALERT HOME 471 472 //BEGIN: HOME IMPACT SLIDER WITH IMAGE 473 if (jQuery(".sliderMain").length != 0) { 474 jQuery('.sliderMain').slick({ 475 slidesToShow: 1, 476 slidesToScroll: 1, 477 arrows: false, 478 useCSS: false, 479 pauseOnFocus: true, 480 pauseOnHover: true, 481 dots: true, 482 fade: true, 483 autoplay: true, 484 autoplaySpeed: 5000, 485 responsive: [ 486 { 487 breakpoint: 960, 488 settings: { 489 arrows: false, 490 autoplay: false, 491 appendDots: $('.appendDots') 492 } 493 } 494 ] 495 }); 496 497 } 498 //END: HOME IMPACT SLIDER WITH IMAGE 499 500 //BEGIN: TOGGLE QUICKLINKS NAV 501 // setTimeout(function () { 502 jQuery(".impactLinksBtn").on("click", function () { 503 $(this).prev('.linkList').toggleClass('open'); 504 if(jQuery(".impactLinksBtn").hasClass('open')) { 505 jQuery(".impactLinksBtn").attr('aria-expanded', true); 506 } else { 507 jQuery(".impactLinksBtn").attr('aria-expanded', false); 508 } 509 $(this).prev('.linkList').slideToggle("slow"); 510 }); 511 // ESC Mobile Menu 512 $(document).keydown(function(e) { 513 if (e.keyCode == 27) { // escape key maps to keycode '27' 514 jQuery('.linkList.open > .impactLinksBtn').trigger('click'); 515 } 516 }); 517 // }, 500); 518 519 //END: TOGGLE QUICKLINKS NAV 520 521 522 //BEGIN: TABLE SAW 523 if (jQuery(".content table").length != 0) { 524 $(".content table").each(function(){ 525 $(this) 526 .attr("class", "tablesaw tablesaw-stack" ) 527 .attr("data-tablesaw-mode", "stack"); 528 }); 529 } 530 //END: TABLE SAW 531 532 // BEGIN: YOUTUBE POPUP MAGNIFIC-POPUP 533 if (jQuery('.popupVideo').length > 0 && !$(this).hasClass('dialogVideo')) { 534 jQuery('.popupVideo').magnificPopup({ 535 //disableOn: 700, 536 type: 'iframe', 537 mainClass: 'mfp-fade', 538 removalDelay: 300, 539 preloader: false, 540 fixedContentPos: true 541 }); 542 } 543 // END: YOUTUBE POPUP MAGNIFIC-POPUP 544 545 //BEGIN: EMERGENCY POPUP MAGNIFIC-POPUP 546 if (jQuery(".toggleAlertBtn").length != 0) { 547 $(window).on('load', function () { 548 if (!localStorage.getItem('popup_show')) { 549 $.magnificPopup.open({ 550 items: { 551 src: '#alertMessage' 552 }, 553 type: 'inline', 554 mainClass: 'alertActive mfp-fade', 555 removalDelay: 300, 556 preloader: false,
557 fixedContentPos: false, 558 closeOnContentClick: false 559 }, 0); 560 localStorage.setItem('popup_show', 'true'); // Set the flag in localStorage 561 } 562 }); 563 } 564 if (jQuery(".toggleAlertBtn").length != 0) { 565 jQuery('.toggleAlertBtn').magnificPopup({ 566 items: { 567 src: '#alertMessage' 568 }, 569 type: 'inline', 570 mainClass: 'alertActive mfp-fade', 571 removalDelay: 300, 572 preloader: false, 573 fixedContentPos: false, 574 closeOnContentClick: false 575 }); 576 } 577 //END: EMERGENCY POPUP MAGNIFIC-POPUP 578 579 // BEGIN: STORIES 580 if (jQuery(".stories .three").length !=0) { 581 582 $window = $(window); 583 $slick_slider_stories = $(".stories .three"); 584 settings = { 585 mobileFirst: true, 586 slidesToShow: 1, 587 slidesToScroll: 1, 588 arrows: true, 589 useCSS: true, 590 dots: true, 591 infinite: false, 592 responsive: [ 593 { 594 breakpoint: 760, 595 settings: { 596 slidesToShow: 2, 597 slidesToScroll: 1, 598 }, 599 }, 600 { 601 breakpoint: 1349, 602 settings: "unslick" 603 } 604 ] 605 }; 606 $slick_slider_stories.slick(settings); 607 $window.on('resize', function() { 608 if ( ! $slick_slider_stories.hasClass('slick-initialized')) 609 return $slick_slider_stories.slick(settings); 610 }); 611 612 613 $(".story").hover(function () { 614 jQuery('.story video')[0].pause(); 615 $(this).children("video")[0].play(); 616 }, function () { 617 var el = $(this).children("video")[0]; 618 el.pause(); 619 }); 620 $(".story .toggle").click(function () { 621 $(this).parent('.subContent').toggleClass("open"); 622 $(this).next('p').slideToggle("slow"); 623 }) 624 $(".story .toggleClick").click(function () { 625 $(this).parent('.subContent').toggleClass("open"); 626 }) 627 628 // ESC Mobile Menu 629 $('.story .toggle').keydown(function(e) { 630 if (e.keyCode == 13) { // enter key maps to keycode '13' 631 jQuery('.story .toggle').trigger('click'); 632 } 633 if (e.keyCode == 13) { // enter key maps to keycode '13' 634 jQuery('.story .toggleClick').trigger('click'); 635 } 636 }); 637 638 }; 639 // END: STORIES 640 641 // BEGIN: HOME STORIES VIDEO POPUP 642 // jQuery(".closeDialog").on( "click", function() { 643 // // Stop embedded video 644 // jQuery('.videoiFrame').each(function(index) { 645 // $(this).attr('src', $(this).attr('src')); 646 // return false; 647 // }); 648 // }); 649 jQuery(".closeDialog").on( "click", function() { 650 //jQuery('iframe.videoiFrame').attr('src', ''); // Or reset to original URL 651 const iframesVideo = document.querySelectorAll('iframe'); 652 iframesVideo.forEach(iframe => { 653 if (iframe.src.includes('youtube.com/embed')) { 654 iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":[]}', 'https://www.youtube.com'); 655 } 656 }); 657 }); 658 // Pause all videos when the escape key is pressed 659 jQuery(document).keyup(function(e) { 660 if (e.key === "Escape" || e.keyCode === 27 ) { 661 // Stop embedded video 662 jQuery('.videoiFrame').each(function(index) { 663 $(this).attr('src', $(this).attr('src')); 664 return false; 665 }); 666 } 667 }); 668 // Check if the clicked element is NOT the target div or a descendant of it 669 function pauseAllIframes() { 670 const iframes = document.querySelectorAll('iframe'); 671 iframes.forEach(iframe => { 672 if (iframe.src.includes('youtube.com/embed')) { 673 iframe.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":[]}', 'https://www.youtube.com'); 674 } 675 }); 676 } 677 const hasDialog = document.getElementsByClassName('mediaDialog'); 678 if (hasDialog) { 679 document.addEventListener('click', (event) => { 680 const dialogs = document.querySelectorAll('dialog');
681 dialogs.forEach(dialog => { 682 if (dialog.open) { 683 if (event.target === dialog) { 684 dialog.close(); 685 pauseAllIframes(); 686 } 687 } 688 }); 689 }); 690 } 691 window.addEventListener('resize', function() { 692 // Assuming your dialogs have a common class, e.g., 'my-dialog' 693 const dialogs = document.querySelectorAll('.mediaDialog'); 694 dialogs.forEach(dialog => { 695 if (dialog.open) { // Check if the dialog is currently open 696 dialog.close(); // Close the dialog 697 } 698 }); 699 }); 700 // END: HOME STORIES VIDEO POPUP 701 702 // BEGIN: STORIES 703 if (jQuery(".landing .stories").length !=0) { 704 705 $(".landing .story .toggleClick").click(function () { 706 $(this).parent('.subContent').toggleClass("open"); 707 }) 708 709 // ESC Mobile Menu 710 $('.landing .story .toggleClick').keydown(function(e) { 711 if (e.keyCode == 13) { // enter key maps to keycode '13' 712 jQuery('.landing .story .toggleClick').trigger('click'); 713 } 714 if (e.keyCode == 13) { // enter key maps to keycode '13' 715 jQuery('.landing .story .toggleClick').trigger('click'); 716 } 717 }); 718 }; 719 // END: STORIES 720 721 //BEGIN: INTERIOR GALLERY SLIDER 722 if (jQuery(".interiorGallerySlider").length != 0) { 723 // setting for slick.js 724 $('.interiorGallerySlider').slick({ 725 slidesToShow: 1, 726 slidesToScroll: 1, 727 dots: true, 728 arrows: true, 729 infinite: false, 730 }); 731 } 732 //END: INTERIOR GALLERY SLIDER 733 734 //BEGIN: GALLERY SLIDER 735 if (jQuery(".gallerySlides").length != 0) { 736 // setting for slick.js 737 $('.gallerySlides').slick({ 738 slidesToShow: 5, 739 slidesToScroll: 5, 740 dots: true, 741 arrows: true, 742 infinite: false, 743 responsive: [ 744 { 745 breakpoint: 1597, 746 settings: { 747 slidesToShow: 4, 748 slidesToScroll: 4, 749 }, 750 }, 751 { 752 breakpoint: 1200, 753 settings: { 754 slidesToShow: 3, 755 slidesToScroll: 3, 756 }, 757 }, 758 { 759 breakpoint: 1024, 760 settings: { 761 slidesToShow: 2, 762 slidesToScroll: 2, 763 }, 764 }, 765 { 766 breakpoint: 650, 767 settings: { 768 slidesToShow: 1, 769 slidesToScroll: 1, 770 }, 771 }, 772 773 ] 774 }); 775 } 776 //END: GALLERY SLIDER 777 778 //BEGIN: GALLERY SLIDER TAB 779 if (jQuery(".gallerySlides").length != 0) { 780 $('.gallerySlides .slick-slide').each(function(){ 781 // Find any ctaLink elements nested inside this specific slide 782 const $ctaLinks = $(this).find('.ctaLink'); 783 784 if($(this).hasClass('slick-active')) { 785 $(this).attr("aria-hidden", false); 786 $(this).attr("tabindex", 0); 787 788 // Explicitly strip the tabindex off the nested CTA links 789 $ctaLinks.removeAttr("tabindex"); 790 } 791 else { 792 $(this).attr("aria-hidden", true); 793 $(this).attr("tabindex", -1); 794 795 // Keep it stripped or let the browser naturally ignore hidden links 796 $ctaLinks.removeAttr("tabindex"); 797 } 798 }); 799 } 800 //END: GALLERY SLIDER TAB 801 802 //BEGIN: FACULTY SLIDER 803 if (jQuery(".facultySlider .slide").length > 2) { 804 // setting for slick.js 805 $('.facultySlider').slick({ 806 slidesToShow: 2, 807 slidesToScroll: 1, 808 dots: true, 809 arrows: true, 810 infinite: false, 811 responsive: [ 812 { 813 breakpoint: 1150, 814 settings: { 815 slidesToShow: 1, 816 } 817 }, 818 { 819 breakpoint: 960, 820 settings: { 821 slidesToShow: 2, 822 } 823 }, 824 { 825 breakpoint: 651, 826 settings: { 827 slidesToShow: 1, 828 } 829 } 830 ] 831 }); 832 } else if (jQuery(".facultySlider .slide").length === 2) { 833 (jQuery(".facultySlider").parent('.wrapper').addClass("noSlick")); 834 } else if (jQuery(".facultySlider .slide").length === 1) { 835 (jQuery(".facultySlider").parent('.wrapper').addClass("noSlick oneItem")); 836 } 837 //END: FACULTY SLIDER 838 839 //BEGIN: FACILTIES SLIDER 840 if (jQuery(".facilitiesSlider .slide").length > 2) { 841 // setting for slick.js 842 $('.facilitiesSlider').slick({ 843 slidesToShow: 2, 844 slidesToScroll: 1, 845 dots: true, 846 arrows: true, 847 infinite: false, 848 responsive: [ 849 { 850 breakpoint: 1150, 851 settings: { 852 slidesToShow: 1, 853 } 854 }, 855 { 856 breakpoint: 960, 857 settings: { 858 slidesToShow: 2, 859 } 860 }, 861 { 862 breakpoint: 651, 863 settings: { 864 slidesToShow: 1, 865 } 866 } 867 ] 868 }); 869 } else if (jQuery(".facilitiesSlider .slide").length === 2) { 870 (jQuery(".facilitiesSlider").parent('.wrapper').addClass("noSlick")); 871 } else if (jQuery(".facilitiesSlider .slide").length === 1) { 872 (jQuery(".facilitiesSlider").parent('.wrapper').addClass("noSlick oneItem")); 873 } 874 //END: FACULTIES SLIDER 875 876 //BEGIN: BLOG SLIDER 877 if (jQuery(".blogSlider .slide").length > 2) { 878 // setting for slick.js 879 $('.blogSlider').slick({ 880 slidesToShow: 2, 881 slidesToScroll: 1, 882 dots: true, 883 arrows: true, 884 infinite: false, 885 responsive: [ 886 { 887 breakpoint: 1150, 888 settings: { 889 slidesToShow: 1, 890 } 891 }, 892 { 893 breakpoint: 960, 894 settings: { 895 slidesToShow: 2, 896 } 897 }, 898 { 899 breakpoint: 651, 900 settings: { 901 slidesToShow: 1, 902 } 903 } 904 ] 905 }); 906 } else if (jQuery(".blogSlider .slide").length === 2) { 907 (jQuery(".blogSlider").parent('.wrapper').addClass("noSlick")); 908 } else if (jQuery(".blogSlider .slide").length === 1) { 909 (jQuery(".blogSlider").parent('.wrapper').addClass("noSlick oneItem")); 910 } 911 //END: BLOG SLIDER 912 913 //BEGIN: IMAGE GALLERY SLIDER 914 if (jQuery(".imageGallerySlider").length != 0) { 915 // setting for slick.js 916 $('.imageGallerySlider').slick({ 917 slidesToShow: 1, 918 slidesToScroll: 1, 919 dots: true, 920 arrows: true, 921 infinite: false, 922 }); 923 } 924 //END: IMAGE GALLERY SLIDER 925 926 //BEGIN: IMAGE GALLERY SLIDER 927 if (jQuery(".programHighlightSlider").length != 0) { 928 // setting for slick.js 929 $('.programHighlightSlider').slick({ 930 slidesToShow: 1, 931 slidesToScroll: 1, 932 dots: true, 933 arrows: true, 934 infinite: false, 935 }); 936 } 937 //END: IMAGE GALLERY SLIDER 938 939 //BEGIN: INTERIOR GALLERY SLIDER 940 if (jQuery(".interiorGallerySlides").length != 0) { 941 jQuery('.interiorGallerySlides').slick({ 942 slidesToShow: 1, 943 slidesToScroll: 1, 944 arrows: true,
945 useCSS: false, 946 dots: true, 947 fade: true, 948 infinite: false, 949 }); 950 } 951 //END: INTERIOR GALLERY SLIDER 952 953 //BEGIN: TOGGLE SECTION NAV 954 var $sectionMenu = jQuery('.sectionNav'); 955 jQuery(document).mouseup(function (e) { 956 if (!$sectionMenu.is(e.target) // if the target of the click isn't the container... 957 && $sectionMenu.has(e.target).length === 0) // ... nor a descendant of the container 958 { 959 $sectionMenu.find(".content").removeClass('open'); 960 $sectionMenu.find(".sectionNav .sectionTitle").removeClass('open'); 961 if ($(window).width() <= 960 ) { 962 if(jQuery(".sectionNav").hasClass('open')) { 963 jQuery("#navSection").attr('aria-expanded', true); 964 jQuery("#sectionNavMenu").attr('aria-expanded', true); 965 } else { 966 jQuery("#navSection").attr('aria-expanded', false); 967 jQuery("#sectionNavMenu").attr('aria-expanded', false); 968 } 969 if (jQuery('#navSection').is(":visible")) { 970 jQuery("#sectionNavMenu").slideUp("slow"); 971 } 972 } 973 } 974 }); 975 //END: TOGGLE SECTION NAV 976 977 // BEGIN: LEFT NAV ACCESSIBLE MENU 978 if (jQuery(".sectionNavColumn").length != 0) { 979 var navItems = document.querySelectorAll('#sectionNavMenu li.sub'); 980 Array.prototype.forEach.call(navItems, function(el, i){ 981 var activatingAB = el.querySelector('a'); 982 var navbtn = '<button class="sectionNavBtn" aria-haspopup="true"><span class="expander"><span class="visuallyhidden">show submenu for ' + activatingAB.text + '</span></span></button>'; 983 activatingAB.insertAdjacentHTML('afterend', navbtn); 984 985 el.querySelector('.sectionNavBtn').addEventListener("click", function(event){ 986 jQuery(this).parent('.sectionNavTitle').next("ul").slideToggle(); 987 jQuery(this).parent('.sectionNavTitle').parent("li.sub").toggleClass("open"); 988 }); 989 }); 990 $(".sectionNav .sectionTitle").click(function () { 991 $(this).next('.content').toggleClass("open"); 992 $(this).next('.content').slideToggle("slow"); 993 $(this).toggleClass("open"); 994 }) 995 996 // ACCESSIBILITY ENHANCEMENTS: ESC + FOCUS TRAP 997 var $navButton = jQuery('#navSection'); 998 var $sideNavMenu = jQuery('#sectionNavMenu'); 999 1000 function isMobileView() { 1001 return jQuery(window).width() <= 960; 1002 } 1003 1004 function getFocusableSideNavElements() { 1005 return $sideNavMenu.find('a, button, input, textarea, select, [tabindex]:not([tabindex="-1"])').filter(':visible'); 1006 } 1007 1008 function trapFocus(e) { 1009 if (!isMobileView() || !$sideNavMenu.hasClass('open')) return; 1010 1011 var focusableSideNav = getFocusableSideNavElements(); 1012 if (!focusableSideNav.length) return; 1013 1014 var firstSideNav = focusableSideNav.first()[0]; 1015 var lastSideNav = focusableSideNav.last()[0]; 1016 1017 if (e.key === 'Tab') { 1018 if (e.shiftKey) { 1019 // SHIFT + TAB 1020 if (document.activeElement === firstSideNav) { 1021 e.preventDefault(); 1022 lastSideNav.focus(); 1023 } 1024 } else { 1025 // TAB forward 1026 if (document.activeElement === lastSideNav) { 1027 e.preventDefault(); 1028 firstSideNav.focus(); 1029 } 1030 } 1031 } 1032 } 1033 1034 function closeSideNav() { 1035 $sideNavMenu.removeClass('open').slideUp("slow"); 1036 $navButton.removeClass('open').attr('aria-expanded', false); 1037 $sideNavMenu.attr('aria-expanded', false); 1038 // return focus to trigger 1039 $navButton.focus(); 1040 } 1041 // ESC key to close 1042 jQuery(document).on('keydown', function (e) { 1043 if (e.key === 'Escape' && isMobileView() && $sideNavMenu.hasClass('open')) { 1044 closeSideNav(); 1045 } 1046 }); 1047 // Focus trap 1048 jQuery(document).on('keydown', trapFocus); 1049 // Ensure focus moves into menu when opened 1050 $navButton.on('click', function () { 1051 setTimeout(function () { 1052 if (isMobileView() && $sideNavMenu.hasClass('open')) { 1053 var focusableSideNav = getFocusableSideNavElements(); 1054 if (focusableSideNav.length) { 1055 focusableSideNav.firstSideNav().focus(); 1056 } 1057 } 1058 }, 300); // wait for slideToggle 1059 }); 1060 } 1061 // END: LEFT NAV ACCESSIBLE MENU 1062 1063 //BEGIN: TAB SLIDER 1064 if (jQuery(".sliderTabs").length != 0) { 1065 jQuery('.sliderTabs.slider-for').slick({ 1066 slidesToShow: 1, 1067 slidesToScroll: 1,
1068 arrows: false, 1069 fade: true, 1070 asNavFor: '.slider-nav' 1071 }); 1072 jQuery('.sliderTabs.slider-nav') 1073 .on('init', function(event, slick) { 1074 $('.slider-nav .slick-slide.slick-current').addClass('is-active'); 1075 }) 1076 .slick({ 1077 slidesToShow: 5, 1078 slidesToScroll: 1, 1079 asNavFor: '.slider-for', 1080 dots: false, 1081 focusOnSelect: true, 1082 responsive: [ 1083 { 1084 breakpoint: 1400, 1085 settings: { 1086 slidesToShow: 4, 1087 slidesToScroll: 1 1088 } 1089 }, 1090 { 1091 breakpoint: 1200, 1092 settings: { 1093 slidesToShow: 3, 1094 slidesToScroll: 1, 1095 } 1096 }, 1097 { 1098 breakpoint: 960, 1099 settings: { 1100 slidesToShow: 2, 1101 slidesToScroll: 1, 1102 }, 1103 }, 1104 { 1105 breakpoint: 640, 1106 settings: { 1107 slidesToShow: 1, 1108 slidesToScroll: 1, 1109 } 1110 } 1111 ] 1112 }); 1113 $('.slider-for').on('afterChange', function(event, slick, currentSlide) { 1114 $('.slider-nav').slick('slickGoTo', currentSlide); 1115 var currrentNavSlideElem = '.slider-nav .slick-slide[data-slick-index="' + currentSlide + '"]'; 1116 $('.slider-nav .slick-slide.is-active').removeClass('is-active'); 1117 $(currrentNavSlideElem).addClass('is-active'); 1118 }); 1119 1120 $('.slider-nav').on('click', '.slick-slide', function(event) { 1121 event.preventDefault(); 1122 var goToSingleSlide = $(this).data('slick-index'); 1123 1124 $('.slider-for').slick('slickGoTo', goToSingleSlide); 1125 }); 1126 } 1127 //END: TAB SLIDER 1128 // BEGIN: STANDARD TABS 1129 if (jQuery(".responsiveTabs").length != 0){ 1130 jQuery('.responsiveTabs').accessibleResponsiveTabs(); 1131 } 1132 // END: STANDARD TABS 1133 1134 // BEGIN: TWO COLUMN WRAPPER 1135 $(".one + .two").prev('.one').addClass("small"); 1136 // END: TWO COLUMN WRAPPER 1137 1138 // BEGIN: LANDING GALLERY SLIDER GRADIENT 1139 if (jQuery(".landing .imageGallery").length != 0){ 1140 $(".landing .imageGallery .slide img + a").parent('.slide').addClass("gradient"); 1141 }; 1142 // END: LANDING GALLERY SLIDER GRADIENT 1143 1144 // BEGIN: IMAGE GALLERY CAPTION LINK 1145 $(".mediaContent img + a").parent('.mediaContent').addClass("caption"); 1146 // END: IMAGE GALLERY CAPTION LINK 1147 1148 // BEGIN: STATS 1149 if ($(".home .stats").length != 0) { 1150 $window = $(window); 1151 $slick_sliderStats = $(".home .stats"); 1152 settings = { 1153 mobileFirst: true, 1154 slidesToShow: 1, 1155 slidesToScroll: 1, 1156 arrows: true, 1157 dots: true, 1158 infinite: false, 1159 responsive: [ 1160 { 1161 breakpoint: 959, 1162 settings: { 1163 slidesToShow: 2, 1164 slidesToScroll: 2, 1165 } 1166 }, 1167 { 1168 breakpoint: 1249, 1169 settings: "unslick" 1170 } 1171 ] 1172 }; 1173 $slick_sliderStats.slick(settings); 1174 $window.on('resize', function() { 1175 if ( ! $slick_sliderStats.hasClass('slick-initialized')) 1176 return $slick_sliderStats.slick(settings); 1177 }); 1178 } 1179 // END: STATS 1180 1181 // BEGIN: LANDING STATS 1182 if ($(".landing .stats").length != 0) { 1183 $window = $(window); 1184 $slick_sliderLandingStats = $(".landing .stats"); 1185 settings = { 1186 mobileFirst: true, 1187 slidesToShow: 1, 1188 slidesToScroll: 1, 1189 arrows: true, 1190 dots: true, 1191 autoplay: false, 1192 infinite: false, 1193 responsive: [ 1194 { 1195 breakpoint: 959, 1196 settings: { 1197 slidesToShow: 2, 1198 slidesToScroll: 2, 1199 } 1200 }, 1201 { 1202 breakpoint: 1249, 1203 settings: "unslick" 1204 } 1205 ] 1206 }; 1207 $slick_sliderLandingStats.slick(settings); 1208 $window.on('resize', function() { 1209 if ( ! $slick_sliderLandingStats.hasClass('slick-initialized')) 1210 return $slick_sliderLandingStats.slick(settings); 1211 }); 1212 jQuery('.landing .statistics .cell').click(function () { 1213 if ($(this).hasClass('clicked')) { 1214 jQuery(this).removeClass('clicked'); 1215 jQuery(this).addClass('not-clicked'); 1216 } 1217 else { 1218 jQuery(this).removeClass('not-clicked'); 1219 jQuery(this).addClass('clicked'); 1220 } 1221 }); 1222 } 1223 // END: LANDING STATS 1224 1225 // BEGIN: RANDOM STATS 1226 var randomItem = jQuery(".randomGroup"); 1227 if (randomItem.length) { 1228 var keep = Math.floor(Math.random() * randomItem.length); 1229 for (var i = 0; i < randomItem.length; ++i) { 1230 if (i !== keep) { 1231 $(randomItem[i]).hide(); 1232 } 1233 } 1234 } 1235 // END: RANDOM STATS 1236 1237 if (jQuery(".statistics.components").length != 0) { 1238 jQuery(".statistics.components .cell").on("click", function () { 1239 jQuery(this).blur(); 1240 }); 1241 } 1242 1243 //BEGIN: EVENTS 1244 if ($(".event").length != 0) { 1245 $window = $(window); 1246 $slick_slider = $(".event"); 1247 settings = { 1248 mobileFirst: true, 1249 slidesToShow: 1, 1250 slidesToScroll: 1, 1251 arrows: true, 1252 useCSS: true, 1253 dots: true, 1254 infinite: false, 1255 responsive: [ 1256 { 1257 breakpoint: 701, 1258 settings: { 1259 slidesToShow: 2, 1260 slidesToScroll: 2, 1261 }, 1262 }, 1263 { 1264 breakpoint: 1249, 1265 settings: "unslick" 1266 } 1267 ] 1268 }; 1269 $slick_slider.slick(settings); 1270 $window.on('resize', function() { 1271 if ( ! $slick_slider.hasClass('slick-initialized')) 1272 return $slick_slider.slick(settings); 1273 }); 1274 } 1275 // END: EVENTS 1276 1277 //BEGIN: NEWSROOM CATEGORY SLIDERS 1278 $(window).on('load resize orientationchange', function() { 1279 $('.newsCategory .four.sharedNews').each(function(){ 1280 var $carouselNews = $(this); 1281 /* Initializes a slick carousel only on mobile screens */ 1282 // slick on mobile 1283 if ($(window).width() > 650) { 1284 if ($carouselNews.hasClass('slick-initialized')) { 1285 $carouselNews.slick('unslick'); 1286 } 1287 } 1288 else if ($(window).width() < 650){ 1289 if (!$carouselNews.hasClass('slick-initialized')) { 1290 $carouselNews.slick({ 1291 slidesToShow: 1, 1292 slidesToScroll: 1, 1293 dots: true, 1294 arrows: true, 1295 autoplay: false, 1296 infinite: false, 1297 }); 1298 } 1299 } 1300 1301 }); 1302 });
1303 // END: NEWSROOM CATEGORY SLIDERS 1304 1305 1306 //BEGIN: ANIMATE ACCORDIONS 1307 if (jQuery(".accordion").length != 0) { 1308 jQuery(".accordion > h2, .accordion > h3").click(function () { 1309 jQuery(this).next(".accordionPanel").slideToggle("slow"); 1310 }); 1311 var hashACC = window.location.hash; 1312 if (hashACC) { 1313 var element = $(hashACC); 1314 if (element.length) { 1315 element.trigger('click'); 1316 } 1317 } 1318 } 1319 //END: ANIMATE ACCORDIONS 1320 1321}); 1322// END DOC READY 1323 1324 1325function custInterval(func, wait, times) { 1326 var interv = function (w, t) { 1327 return function () { 1328 if (typeof t === "undefined" || t-- > 0) { 1329 setTimeout(interv, w); 1330 try { 1331 func.call(null); 1332 } 1333 catch (e) { 1334 t = 0; 1335 throw e.toString(); 1336 } 1337 } 1338 }; 1339 }(wait, times); 1340 1341 setTimeout(interv, wait); 1342}; 1343// Include these at the end of the main scripts file: 1344function downloadJSAtOnload() { 1345 // call function now 1346 getDeferredScripts(); 1347 // create function interval 1348 custInterval(getDeferredScripts, 5000, 10); 1349} 1350function getDeferredScripts() { 1351 // if _DeferredScripts is an object and has items 1352 if (typeof _DeferredScripts == 'object' && _DeferredScripts.length > 0) { 1353 // Sort 1354 _DeferredScripts.sort(function (a, b) { 1355 try { 1356 // if they have the same priority 1357 if (a.priority == b.priority) { 1358 return a.thirdParty - b.thirdParty; 1359 } else { 1360 //priority is different so third party doesn't matter 1361 return a.priority - b.priority; 1362 } 1363 } catch (e) { 1364 return 1; 1365 } 1366 }); 1367 while (_DeferredScripts.length > 0) { 1368 // remove the first item in _DeferredScripts and return that item 1369 var scriptObj = _DeferredScripts.shift(); 1370 1371 // if returned object has a callback function 1372 // else if it has a url 1373 if (typeof scriptObj.callback == 'function') { 1374 scriptObj.callback(); 1375 } else if (typeof scriptObj.url == 'string') { 1376 var element = document.createElement("script"); 1377 element.src = scriptObj.url; 1378 document.body.appendChild(element); 1379 } 1380 } 1381 } 1382} 1383if (window.addEventListener) 1384 window.addEventListener("load", downloadJSAtOnload, false); 1385else if (window.attachEvent) 1386 window.attachEvent("onload", downloadJSAtOnload); 1387else 1388 window.onload = downloadJSAtOnload; 1389 1390// FOR PASSIVE EVENT LISTENERS 1391jQuery.event.special.touchstart = { 1392 setup: function( _, ns, handle ) { 1393 this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") }); 1394 } 1395}; 1396jQuery.event.special.touchmove = { 1397 setup: function( _, ns, handle ) { 1398 this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") }); 1399 } 1400}; 1401jQuery.event.special.wheel = { 1402 setup: function( _, ns, handle ){ 1403 this.addEventListener("wheel", handle, { passive: true }); 1404 } 1405}; 1406jQuery.event.special.mousewheel = { 1407 setup: function( _, ns, handle ){ 1408 this.addEventListener("mousewheel", handle, { passive: true }); 1409 } 1410};
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.