1WPO.Common = (function ($, window, document, WPO, Marionette, Backbone) { 2 var _body; 3 var _nav; 4 var _ddParents; 5 var _init = function () { 6 _nav = $('.site-header nav'); 7 var mainNavItems = $('> div > ul > li.menu-item-has-children', _nav); 8 mainNavItems.addClass('js'); 9 10 mainNavItems.on('mouseenter', function (e) { 11 if (window.innerWidth > 991) { 12 $('.site-header').addClass('show-dropdown'); 13 } 14 }).on('mouseleave', function (e) { 15 if (window.innerWidth > 991) { 16 $('.site-header').removeClass('show-dropdown'); 17 } 18 }); 19 20 _body = $('body'); 21 22 23 //FIXING SELECT OPTIONS FOR IOS 24 $(document).ready(function(){ 25 // iOS 7 hack: Add an optgroup to every select in order to avoid truncating the content 26 if (navigator.userAgent.match(/(iPad|iPhone|iPod touch);.*CPU.*OS 7_\d/i)) { 27 var selects = document.querySelectorAll("select"); 28 for (var i = 0; i < selects.length; i++ ){ 29 selects[i].appendChild(document.createElement("optgroup")); 30 } 31 } 32 }); 33 34 35 //MAIN MENU MOBILE STATE 36 $('.menu-toggle').on('click', function (e) { 37 e.preventDefault(); 38 if (!$('body').hasClass('menu-open')) { 39 $('body').addClass('menu-open'); 40 } else { 41 $('body').removeClass('menu-open'); 42 } 43 }); 44 45 //CARD BUTTON HOVER CLASS TOGGLE 46 $('.wp-block-p3-wpo-card:not(.large_cta)').hover(function() { 47 $(this).find('.wp-block-p3-wpo-button').addClass('hovered'); 48 }, function() { 49 $(this).find('.wp-block-p3-wpo-button').removeClass('hovered'); 50 }); 51 52 /* $('.body-content > div:not(.hero), .callouts').attr('data-aos', 'fade-up'); */ 53 54 //ADD ANIMATION TO BLOCKS 55 $(document).ready(function () { 56 AOS.init({ 57 easing: 'ease-in-out-sine', 58 }); 59 var hasScrolled = false; 60 $(window).on('scroll', function () { 61 if (!hasScrolled) { 62 hasScrolled = true; 63 AOS.refresh(); 64 } 65 }); 66 67 window.addEventListener('load', AOS.refresh); 68 //don't animate the home hero 69 }); 70 71 72 73 74 75 //on scroll add not-at-top class to header 76 $(window).on('scroll', function () { 77 if ($(window).scrollTop() > 0) { 78 $('body').addClass('not-at-top'); 79 } else { 80 $('body').removeClass('not-at-top'); 81 } 82 }); 83 84 //on resize, show/hide mobile menu 85 $(window).on('resize', _onWindowResizeHandler); 86 87 //if mobile on menu item click open/close dropdown 88 _ddParents = $('.site-header nav .menu-item-has-children > a'); 89 _ddParents.on('click', _onMenuItemClickHandler); 90 91 92 $('.video-wrapper .play-button').on('click', function (e) { 93 e.preventDefault(); 94 const videoPlayer = $(this).parent().find('video').get(0); 95 const isVideoPlaying = video => !!(video.currentTime > 0 && !video.paused && !video.ended && video.readyState > 2); 96 if (isVideoPlaying(videoPlayer)) { 97 videoPlayer.pause(); 98 $(this).removeClass('playing'); 99 } else { 100 videoPlayer.play(); 101 $(this).addClass('playing'); 102 } 103 }); 104 105 $('header.site-header').on('mouseenter', function (e) { 106 $('body').addClass('blur-body'); 107 }).on('mouseleave', function (e) { 108 $('body').removeClass('blur-body'); 109 }); 110 const modals = document.querySelectorAll('.modal'); // Select all elements with class 'modal' 111 112 modals.forEach(modal => { 113 document.body.appendChild(modal); // Append each modal to the body 114 }); 115 setTimeout(() => { 116 $('img.swp-icon-cart').attr('alt', 'Ticket Icon '); 117 $('svg.swp-icon-cart').prepend("<title>Ticket Icon</title>"); 118 }, 300); 119 /** 120 * Fix WAVE error: "Missing form label" on Google reCAPTCHA v2. 121 */ 122 if ( 'undefined' != typeof( gform ) ) { 123 gform.addAction('gform_post_recaptcha_render', function (elem) { 124 $response = jQuery( elem ).find( '.g-recaptcha-response' ); 125 $response.attr( 'aria-hidden', 'true' ); 126 $response.attr( 'aria-label', 'Ignore this field.' ); 127 }); 128 } 129 }; 130 131 const _onMenuItemClickHandler = function (e) { 132 if (window.innerWidth <= 991) { 133 e.preventDefault(); 134 $(this).parent().toggleClass('open'); 135 } 136 } 137 138 //SHOW AND HIDE MOBILE MENU WHEN RESIZED 139 var _onWindowResizeHandler = function () { 140 if (window.innerWidth > 991) { 141 if (!_nav.hasClass('show')) { 142 _nav.addClass('show'); 143 } 144 _ddParents.removeClass('open'); 145 } else { 146 if (_nav.hasClass('show')) { 147 _nav.removeClass('show'); 148 } 149 } 150 }; 151 _init(); 152 153 return { 154 }; 155})(jQuery, window, document, WPO);
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.