1//Custom Grand Royal multi page slide menu for mobile and desktop with mobile docking bar 2//Author: Airborne 3 4(function ($) { 5 "use strict"; 6 var mobile, 7 headerHeight, 8 footerHeight, 9 childMenuHeight, 10 childMenuPos, 11 siteMenuWidth, 12 //cache jquery objects 13 $slideMenuPeakabooContainer = $('#slide-menu-gr-peakaboo'), 14 $slideMenuPeakaboo = $('.slide-menu-gr-peakaboo'), 15 $socialIconMenuBar = $('.slide-menu-gr-peakaboo--social-mobile-only .social-sub-menu'), 16 $storeMenuBarWithSocial = $('.slide-menu-gr-peakaboo--social-mobile-only .active'), 17 $storeMenuBar = $('.slide-menu-gr-peakaboo--mobile-only .slide-menu-gr-child-peekaboo'), 18 $slideMenuGR = $('#slide-menu-gr'), 19 bannerVideo; 20 21 var sound_playing = false; 22 var audio_control_rendered = false; 23 var video_type = ''; 24 var html_video_obj = null; 25 26 function enq() { 27 enquire.register("screen and (min-width: 50em)", { 28 match: function () { 29 mobile = false; 30 }, 31 unmatch: function () { 32 mobile = true; 33 }, 34 setup: function () { 35 mobile = true; 36 } 37 }); 38 } 39 40 //wait for content from the top of the site to load before hiding loader 41 function listen_for_top_content_loaded() { 42 // chcek for the sessionStorage var before loading anything. 43 var splashSet = sessionStorage.getItem('umggr-splashed', true); 44 if(splashSet) { 45 $('body').addClass('overflow_visible'); 46 init_after_content_load(); 47 } else { 48 var required_content = []; 49 50 //check if splash page is used and grab it's img and iframe elements 51 if($('#umggr-splash').length && $('#umggr-splash .custom-html').length) { 52 $('#umggr-splash .custom-html').each(function() { 53 required_content.push($(this)); 54 }); 55 } 56 // TODO: replace this with a more robust method for detecting when this is the home page. 57 if ( window.location.pathname == '/' ){ 58 if($('#umggr-splash .yt-holder').length) { 59 required_content.push($('#umggr-splash .yt-holder')); 60 } 61 } 62 63 if(required_content.length) { 64 var num_required = required_content.length; 65 for(var c in required_content) { 66 if($(required_content[c]).hasClass('yt-holder')) { 67 $('#umggr-splash').on('youtube-splash-ready', function() { 68 init_after_content_load(); 69 }); 70 } else { 71 $(required_content[c]).ready(function() { 72 init_after_content_load(); 73 }); 74 } 75 } 76 } else { 77 init_after_content_load(); 78 } 79 } 80 }; 81 82 function init_after_content_load() { 83 $('.umggr-loader-status').fadeOut(300, function () { 84 $('#umggr-loader').fadeOut(); 85 }); 86 } 87 88 //initialise page elements 89 function init() { 90 // setNewsletterButtonWidth(); 91 //Set + get dimension vars 92 headerHeight = $('#site-header').outerHeight() ? $('#site-header').outerHeight() : 0; 93 footerHeight = $('#site-footer').outerHeight() ? $('#site-footer').outerHeight() : 0; 94 childMenuHeight = ($('.peekaboo').outerHeight() ? $('.peekaboo').outerHeight() : 0) + 3; 95 childMenuPos = headerHeight - childMenuHeight; 96 siteMenuWidth = $slideMenuGR.width(); 97 98 $slideMenuPeakabooContainer.css({ 99 top: headerHeight 100 }); 101 102 if (!$(".site-header-transparent").length) { 103 // $('.peekaboo').css('top', childMenuPos + 'px'); 104 $socialIconMenuBar.css('top', 0); 105 $storeMenuBarWithSocial.css('top', childMenuPos + 'px'); 106 $storeMenuBar.css('top', -childMenuHeight + 'px'); 107 } else { 108 if (jQuery('#site-header .social-nav').length > 0) { 109 $('.peekaboo').css('top', headerHeight + 'px'); 110 } else { 111 $('.peekaboo').css('top', -childMenuHeight + 'px'); 112 } 113 $storeMenuBar.css('top', -childMenuHeight + 'px'); 114 headerHeight = 0; 115 } 116 117 //Cleanup mobile states in case of browser resize 118 if (!mobile) { 119 $slideMenuGR.removeClass('docked'); 120 $('body, #slide-menu-gr, .dock-link, .mobile, .dimmer-lay').removeAttr('style'); 121 } 122 123 $('.umggr-fixed-social-menu-container.umggr-fixed-social-menu-top-left, .umggr-fixed-social-menu-container.umggr-fixed-social-menu-top-right').css('top', headerHeight); 124 125 var mainHeight = $('#main-content').outerHeight() ? $('#main-content').outerHeight() : 0; 126 headerHeight = $('#site-header').hasClass('site-header-transparent') ? 0 : headerHeight; 127 var HeaderFooterHeight = headerHeight + footerHeight; 128 if (((mainHeight + HeaderFooterHeight) < $(window).height()) && mobile === false){ 129 var contentHeight = ($(document).height() - HeaderFooterHeight); 130 $('#main-content').fadeIn(); 131 $('#main-content').css('min-height',contentHeight); 132 } else if (mainHeight + headerHeight < $(window).height() && mobile === true) { 133 //calculate the height of the content area necessary to push footer links below the main footer nav bar 134 var contentHeight = ($(window).height() - (headerHeight + footerHeight) ); 135 // 136 $('#main-content').fadeIn(); 137 // always keep footer idtems below bottom of page. 138 $('#main-content').css('min-height',contentHeight); 139 } 140 141 setTimeout(function(){ 142 headerHeight = $('#site-header').outerHeight() ? $('#site-header').outerHeight() : 0; 143 footerHeight = $('#site-footer').outerHeight() ? $('#site-footer').outerHeight() : 0; 144 mainHeight = $('#main-content').outerHeight() ? $('#main-content').outerHeight() : 0; 145 HeaderFooterHeight = (headerHeight + footerHeight); 146 if (((mainHeight + HeaderFooterHeight) < $(window).height()) && mobile === false){ 147 contentHeight = ($(document).height() - HeaderFooterHeight); 148 $('#main-content').css('min-height',contentHeight); 149 } else if (mainHeight + headerHeight < $(window).height() && mobile === true) { 150 var contentHeight = ($(window).height() - (headerHeight + footerHeight) ); 151 $('#main-content').css('min-height',contentHeight); 152 } 153 }, 200); 154 155 } 156 //open a slide child menu and set active state 157 function openSlideMenu(m) { 158 let tweenOpts = { 159 y: 0, 160 height: 40, 161 onComplete: function () { 162 $(m).addClass('active'); 163 } 164 }; 165 const headerPosition = $('#site-header').css('position'); 166 switch (headerPosition) { 167 case 'fixed': 168 let siteHeaderHeight = headerHeight = $('#site-header').outerHeight() ? $('#site-header').outerHeight() : 0; 169 tweenOpts.top = siteHeaderHeight; 170 tweenOpts.position = 'fixed'; 171 break; 172 default: 173 tweenOpts.y = 0; 174 break; 175 } 176 TweenMax.to($(m), 0.3, tweenOpts); 177 } 178 179 //toggle slide child menues 180 function toggleSlideMenu(slideChild) { 181 if (!mobile) { 182 //assign the data child-menu class ready for passing to the desktop open child menu function 183 const childMenu = $('.' + slideChild.data('child-menu')); 184 if (!childMenu.length) { 185 return false;
186 } 187 188 //remove any menu open states if the current one isn't in the open state 189 if (!slideChild.hasClass('open')) { 190 $('.with-children').find('a').each(function () { 191 $(this).removeClass('open'); 192 }); 193 //otherwise add an open state 194 slideChild.addClass('open'); 195 //close open child menus then open this one 196 const openSubMenus = $('.peekaboo.active'); 197 if (openSubMenus.length) { 198 TweenMax.to(openSubMenus, 0.3, {y: 0, height: 0, onComplete: function () { 199 openSlideMenu(childMenu) 200 }}); 201 } else { 202 openSlideMenu(childMenu); 203 } 204 $slideMenuPeakabooContainer.css('overflow', 'visible'); 205 } else { 206 //this menu is open or all are closed - close and remove open state to be sure 207 slideChild.removeClass('open'); 208 TweenMax.to($(childMenu), 0.3, {y: 0, height: 0, onComplete: function () { 209 $(childMenu).removeClass('active'); 210 $slideMenuPeakabooContainer.css('overflow', 'hidden'); 211 }}); 212 } 213 } 214 } 215 216 //close slide menu for mobile 217 function closeSlideMenuMobile() { 218 $slideMenuGR.removeClass('docked'); 219 TweenMax.to($slideMenuGR, 0.2, {x: siteMenuWidth + 'px', display: 'none'}); 220 TweenMax.to($('.dimmer-lay'), 0.3, {opacity: 0, display: 'none'}); 221 TweenMax.staggerTo($('.dock-link'), 0.1, {y: 0}, 0.05); 222 $('body').removeClass('-no-overflow'); 223 $('.open-slide-menu-gr').each(function () { 224 $(this).removeClass('expanded'); 225 var childMenu = $(this).parent().find('.slide-menu-gr-child'); 226 $(childMenu).removeAttr('style'); 227 }); 228 } 229 230 // HG Well's browser navigation 231 function timeMachine() { 232 if (document.referrer.split('/')[2] !== location.hostname) { 233 //External domain 234 return true; 235 } else { 236 //Internal page 237 window.history.go(-1); 238 event.preventDefault(); 239 } 240 } 241 242 function setYtVideoHeader(container, videoId, videoAutoplay) { 243 if (typeof (YT) == 'undefined' || typeof (YT.Player) == 'undefined') { 244 window.onYouTubeIframeAPIReady = function () { 245 setplayerBannerHeader(container, videoId, videoAutoplay); 246 }; 247 $.getScript('//www.youtube.com/iframe_api'); 248 } else 249 { 250 setplayerBannerHeader(container, videoId, videoAutoplay); 251 } 252 } 253 function setplayerBannerHeader(container, videoId, videoAutoplay) { 254 var ytMuteBtn = ($('.header-content-item .yt-holder-header').length === 0 ? 'nav-menu' : $('.header-content-item .yt-holder-header').data('yt-mutebtn')); 255 var ytPlayerHost = (!main_vars.disable_cookies ? 'https://www.youtube.com' : 'https://www.youtube-nocookie.com'); 256 if (videoId !== '') { 257 $('.yt-holder-header').YTPlayer({ 258 fitToBackground: true, 259 videoId: videoId, 260 host: ytPlayerHost, 261 pauseOnScroll: false, 262 playerVars: {'autoplay': true, 'mute': true, 'controls': 0, 'showinfo': 0, 'rel': 0}, 263 events: { 264 'onReady': onPlayerReady, 265 } 266 }); 267 } 268 function onPlayerReady(event) { 269 scale_video($('.yt-holder-header')); 270 } 271 var muteButtonHtml = '<div class="mute-unmute-mute"><a href="#unmute"><span class="-is-visually-hidden">Unmute</span><i class="fa fa-volume-mute" aria-hidden="true"></i></a></div><div class="mute-unmute-unmute" style="display:none"><a href="#mute"><span class="-is-visually-hidden">Mute</span><i class="fa fa-volume-up" aria-hidden="true"></i></a></div>'; 272 switch (ytMuteBtn) { 273 case 'nav-menu': 274 var liElement = document.createElement("li"); 275 liElement.className = 'mute-unmute'; 276 liElement.innerHTML = muteButtonHtml; 277 $('#slide-menu-gr .menu-main-container ul').append(liElement); 278 var dynamicParent = $('#slide-menu-gr').parent().parent()[0].className.replace(/\s+/g, '.'); 279 var divElement = document.createElement("div"); 280 divElement.className = 'mute-unmute -header'; 281 divElement.innerHTML = muteButtonHtml; 282 $('.'+dynamicParent).append(divElement); 283 break; 284 case 'overlay': 285 $('.video-overlay .mute-unmute').append(muteButtonHtml); 286 break; 287 } 288 } 289 290 function scale_video(elem) { 291 var $video = elem; 292 var maxHeight; 293 if ($(window).width() <= 500) { 294 maxHeight = 25; 295 } else if ($(window).width() <= 700) { 296 maxHeight = 35; 297 } else if ($(window).width() <= 1000) { 298 maxHeight = 50; 299 } else { 300 maxHeight = 75; 301 } 302 $video.find('iframe').css({ 303 'max-height' : maxHeight + 'vh', 304 }); 305 } 306 307 window.onresize = function(event) { 308 if ($('.header-content-item .yt-holder-header').length > 0) { 309 scale_video($('.yt-holder-header')); 310 } 311 }; 312 313 $(document).ready(function () 314 { 315 enq(); 316 init(); 317 listen_for_top_content_loaded(); 318 319 //toggle slide menu child desktop 320 $('.with-children a').click(function () { 321 var slideChild = $(this); 322 toggleSlideMenu(slideChild); 323 //detect clicks outside the open menu to close it 324 $(document).on('click', function (event) { 325 if (!$(event.target).closest('.with-children a').length) { 326 $('.with-children').find('a').each(function () { 327 $(this).removeClass('open'); 328 $('.peekaboo').each(function () { 329 TweenMax.to($(this), 0.3, {y: 0, height: 0, onComplete: function () { 330 $(this).removeClass('active') 331 }}); 332 }); 333 $(document).off('click'); 334 }); 335 } 336 //event.preventDefault(); 337 }); 338 }); 339 //open mobile slide menu child 340 $('.open-slide-menu-gr').click(function (event) { 341 var childMenu = $(this).parent().find('.slide-menu-gr-child'); 342 childMenu.css('height', ''); 343 if (!$(this).hasClass('expanded')) { 344 $(this).addClass('expanded'); 345 $('#slide-menu-gr-peakaboo').css('z-index', 98); 346 var childHeight = childMenu.outerHeight(); 347 TweenMax.fromTo(childMenu, 0.3, {height: 0}, {height: childHeight + 'px', display: 'block'}); 348 } else { 349 $(this).removeClass('expanded'); 350 TweenMax.to(childMenu, 0.3, {height: 0, display: 'none', onComplete: function(){ 351 $('#slide-menu-gr-peakaboo').css('z-index', 88); 352 }}); 353 } 354 event.preventDefault(); 355 }); 356 //close slide menu for mobile inside 357 $('.slide-menu-toggle').click(function (event) { 358 $('body').addClass('-no-overflow'); 359 $slideMenuGR.css({transform: 'translateX(' + siteMenuWidth + 'px)'}); 360 //check for previous opn state 361 if (!$slideMenuGR.hasClass('docked')) { 362 $slideMenuGR.addClass('docked'); 363 TweenMax.to($slideMenuGR, 0.3, {x: 0, display: 'block'}); 364 TweenMax.to($('.dimmer-lay'), 0.3, {opacity: 1, display: 'block'}); 365 TweenMax.staggerTo($('.dock-link'), 0.1, {y: 50}, 0.05); 366 } else { 367 closeSlideMenuMobile(); 368 } 369 event.preventDefault(); 370 }); 371 //close slide menu for mobile outside 372 $('.dimmer-lay').click(function (event) { 373 closeSlideMenuMobile(); 374 event.preventDefault(); 375 }); 376 377 //toggle filter slide menu for Isotope 378 $('.slide-menu-gr-filter-toggle').click(function (event) { 379 var peakHeight = $slideMenuPeakaboo.height() + 5; 380 if (!$(this).hasClass('open')) { 381 TweenMax.to($(this).parent().find($slideMenuPeakaboo), 0.1, {y: 0}); 382 $(this).addClass('open'); 383 } else { 384 // TweenMax.to($(this).parent().find($slideMenuPeakaboo), 0.2, {y: -peakHeight}); 385 TweenMax.to($(this).parent().find($slideMenuPeakaboo), 0.2, {y: peakHeight}); 386 $(this).removeClass('open'); 387 } 388 event.preventDefault(); 389 }); 390 $('.history').click(function (event) { 391 timeMachine(); 392 event.preventDefault(); 393 }); 394 $('.btn').mouseover(function () { 395 TweenMax.to($(this).parent().find('.btn-r'), 0.1, {x:'0%', op
395acity:0.7}); 396 TweenMax.to($(this).parent().find('.btn-l'), 0.2, {x:'-100%'}); 397 }); 398 $('.btn').mouseout(function () { 399 TweenMax.to($(this).parent().find('.btn-r'), 0.2, {x:'100%', opacity:1}); 400 TweenMax.to($(this).parent().find('.btn-l'), 0.2, {x:'0%'}); 401 }); 402 403 // check if mobile and the mobile video settings are set to static image 404 var md = new MobileDetect(window.navigator.userAgent); 405 // If header video setup YT api video 406 if ($('.header-content-item .yt-holder-header').length > 0) { 407 var ytId = $('.header-content-item .yt-holder-header').data('yt-id'); 408 var ytAutoplay = $('.header-content-item .yt-holder-header').data('yt-autoplay'); 409 var container = $('.header-content-item .yt-holder-header')[0]; 410 if (md.mobile() === null || !main_vars.mobile_video_settings.mobile_video_override) { 411 setYtVideoHeader(container, ytId, ytAutoplay); 412 } else { 413 // hide mute controls 414 $('.video-overlay').hide(); 415 $('#page .mute-unmute').hide(); 416 switch (main_vars.mobile_video_settings.mobile_video_image_setting ) { 417 case 'static_image': 418 if (main_vars.mobile_video_settings.mobile_video_static_image) { 419 $('#header-video').css('background-image', 'url(\"' + main_vars.mobile_video_settings.mobile_video_static_image + '\")'); 420 $('#header-video').append('<span role=\"img\" aria-label=\"' + main_vars.mobile_video_settings.mobile_video_static_image_alt_text + '\"></span>'); 421 } else { // or get a thumbnail from youtube 422 $('#header-video').css('background-image', 'url(\"https://i.ytimg.com/vi/' + ytId + '/hqdefault.jpg\")'); 423 } 424 $('#header-video').css('min-height','35vh' ); 425 break; 426 case 'embeded_video': 427 var iframe = '<iframe src=\"https://www.youtube-nocookie.com/embed/' + ytId + '?autoplay=1&autohide=1&border=0&wmode=opaque&enablejsapi=1\" class="header-video-mobile-embed" width="100%" height="' + (($(document).width() / 16) * 9) + 'px"></iframe>'; 428 $('#header-video').replaceWith(iframe); 429 break; 430 } 431 } 432 } 433 434 // Check if the content slider is available and which media is currently on the active slide 435 if ($('.slider-gr-container.promo-slider').length > 0){ 436 var contentSlideWrapper = $(".slider-gr-container"); 437 438 // Check for any video on the first available slide 439 contentSlideWrapper.on("init", function(event, slick, currentSlide){ 440 slick = $(slick.currentTarget); 441 setupSliderVideoAudio(slick); 442 }); 443 444 // Before the next slide make sure to mute all audio 445 contentSlideWrapper.on("beforeChange", function(event, slick) { 446 slick = $(slick.$slider); 447 resetAudio(); 448 }); 449 450 // When viewing the next slide check if audio controls are needed 451 contentSlideWrapper.on("afterChange", function(event, slick) { 452 slick = $(slick.$slider); 453 setupSliderVideoAudio(slick); 454 }); 455 456 } 457 458 if ($( window ).width() < 500) { 459 $('.video-overlay').css('opacity','1'); 460 $('body').on('click', '#page .mute-unmute', function(e) { 461 $('.video-overlay').removeAttr('style'); 462 }); 463 } 464 465 // add the mute / unmute functionality to the mute icons 466 $('#page .mute-unmute-mute').show(); 467 $('#page .mute-unmute-mute').toggleClass('active'); 468 $('body').on('click', '.mute-unmute', function(e) { 469 e.preventDefault(); 470 sound_playing = !sound_playing; 471 $(this).toggleClass('playing'); 472 var player = ($('.slider-gr-slide.slick-active').length > 0 ? $('.slider-gr-slide.slick-active').find('iframe').get(0) : $('.yt-holder-header').data('ytPlayer').player); 473 if ($('.slider-gr-slide.slick-active').length > 0){ 474 muteUnmute(player, sound_playing, 'content-slider'); 475 } else { 476 muteUnmute(player, sound_playing, null); 477 } 478 }); 479 480 function setupSliderVideoAudio(slickObj) { 481 482 var ytAutoplay = 'autoplaymuted'; 483 var container = $('.slider-gr-slide.slick-active')[0]; 484 485 if ($('.slider-gr-slide.slick-active').hasClass('youtube')){ 486 var ytId = $('.slider-gr-slide.slick-active').data('yt-id'); 487 video_type = 'youtube'; 488 489 if (typeof ytId !== 'undefined') { 490 if (!audio_control_rendered && (md.mobile() === null || !main_vars.mobile_video_settings.mobile_video_override)) { 491 setYtVideoHeader(container, ytId, ytAutoplay); 492 } 493 audio_control_rendered = true; 494 } 495 } else if ($('.slider-gr-slide.slick-active').hasClass('video')){ 496 var videoId = ''; 497 video_type = 'html'; 498 html_video_obj = $(".slick-current").find('video').get(0); 499 html_video_obj.muted = true; 500 if (!audio_control_rendered && (md.mobile() === null || !main_vars.mobile_video_settings.mobile_video_override)) { 501 setplayerBannerHeader(container, videoId, ytAutoplay); 502 } 503 audio_control_rendered = true; 504 } 505 506 } 507 508 function muteUnmute(player, sound_playing, bannerType) { 509 if (sound_playing) { 510 if (bannerType === 'content-slider'){ 511 if (video_type === 'html') { 512 if (html_video_obj.muted === true) { 513 html_video_obj.muted = !html_video_obj.muted; 514 } 515 } else { 516 postMessageToPlayer(player, { 517 "event": "command", 518 "func": "unMute" 519 }); 520 postMessageToPlayer(player, { 521 "event": "command", 522 "func": "playVideo" 523 }); 524 } 525 } else { 526 player.unMute(); 527 player.playVideo(); 528 } 529 530 $('#page .mute-unmute-mute').hide(); 531 $('#page .mute-unmute-mute').toggleClass('active'); 532 $('#page .mute-unmute-unmute').show(); 533 $('#page .mute-unmute-unmute').toggleClass('active'); 534 // setTimeout(function(){ 535 // $('.mute-unmute-mute').removeClass('active'); 536 // $('.mute-unmute-unmute').removeClass('active'); 537 // }, 200); 538 } else { 539 if (bannerType === 'content-slider'){ 540 if (video_type === 'html') { 541 if (html_video_obj.muted === false) { 542 html_video_obj.muted = true; 543 } 544 } else { 545 postMessageToPlayer(player, { 546 "event": "command", 547 "func": "mute" 548 }); 549 postMessageToPlayer(player, { 550 "event": "command", 551 "func": "playVideo" 552 }); 553 } 554 } else { 555 player.mute(); 556 } 557 // player.pauseVideo(); 558 $('#page .mute-unmute-mute').show(); 559 $('#page .mute-unmute-mute').toggleClass('active'); 560 $('#page .mute-unmute-unmute').hide(); 561 $('#page .mute-unmute-unmute').toggleClass('active'); 562 // setTimeout(function(){ 563 // $('.mute-unmute-mute').removeClass('active'); 564 // $('.mute-unmute-unmute').removeClass('active'); 565 // }, 200); 566 } 567 } 568 569 // hide the overlay mute button if cursor is left still for 2.5 seconds 570 // var timeout; 571 // $('.video-overlay').mousemove(function() { 572 // // $(this).css('opacity', 1); 573 // $('.mute-unmute').addClass('hideBefore'); 574 // if (sound_playing) { 575 // $('.mute-unmute-unmute').show(); 576 // } else { 577 // $('.mute-unmute-mute').show(); 578 // } 579 // }).mouseout(function () { 580 // // clearTimeout(timeout); 581 // // timeout = setTimeout(function () { 582 // if (sound_playing) { 583 // $('.mute-unmute-unmute').hide(); 584 // } else { 585 // $('.mute-unmute-mute').hide(); 586 // } 587 // // $(this).css('opacity', 0.3); 588 // // $('.mute-unmute').removeClass('hideBefore'); 589 // // }, 2000); 590 // }); 591 592 function tryOpenNewsletterV3Modal() { 593 var form = document.querySelector('#gr-newsletter-form'); 594 595 if (!form) { 596 return false;
597 } 598 599 if (typeof openNewsletterV3Modal === 'function' && openNewsletterV3Modal()) { 600 return true; 601 } 602 603 if ( 604 window.customElements 605 && typeof window.customElements.whenDefined === 'function' 606 ) { 607 window.customElements.whenDefined('pu-multistep-form').then(function () { 608 if (typeof openNewsletterV3Modal === 'function') { 609 openNewsletterV3Modal(); 610 } 611 }).catch(function () {}); 612 613 return true; 614 } 615 616 return false; 617 } 618 619 $(document).on('click', '#ae-cform-modal-display-cta-1, .ae-cform-modal-display-cta, .gr-newsletter-header-open-modal', function(e) { 620 if (tryOpenNewsletterV3Modal()) { 621 e.preventDefault(); 622 return false; 623 } 624 }); 625 626 $('.newsletter-header svg').click(function(e) { 627 if (tryOpenNewsletterV3Modal()) { 628 e.preventDefault(); 629 return false; 630 } 631 $('.gr-newsletter-header-open-modal, #ae-cform-modal-display-cta-1').first().trigger('click'); 632 }); 633 //newsletter button click 634 if($('.newsletter-button').length) { 635 $('.newsletter-button').on('click', function(e) { 636 e.preventDefault(); 637 if (tryOpenNewsletterV3Modal()) { 638 return false; 639 } 640 $('.ae-cform-modal-display-cta').trigger('click'); 641 }); 642 } 643 644 $('body').trigger('umggr-body-loaded'); 645 646 }); 647 $(window).resize(function () { 648 enq(); 649 init(); 650 }); 651 $(window).load(function () { 652 enq(); 653 init(); 654 }); 655 function resetAudio(){ 656 var player = $('.slider-gr-slide.slick-active').find('iframe').get(0); 657 sound_playing = false; 658 $('#page .mute-unmute-mute').show(); 659 $('#page .mute-unmute-mute').toggleClass('active'); 660 $('#page .mute-unmute-unmute').hide(); 661 $('#page .mute-unmute-unmute').toggleClass('active'); 662 postMessageToPlayer(player, { 663 "event": "command", 664 "func": "mute" 665 }); 666 postMessageToPlayer(player, { 667 "event": "command", 668 "func": "pauseVideo" 669 }); 670 if (html_video_obj !== null && typeof html_video_obj !== 'undefined'){ 671 html_video_obj.muted = true; 672 } 673 } 674})(jQuery);// JavaScript Document 675 676// POST commands to YouTube or Vimeo API 677function postMessageToPlayer(player, command){ 678 if (player == null || command == null) return; 679 player.contentWindow.postMessage(JSON.stringify(command), "*"); 680} 681 682function setNewsletterButtonWidth() { 683 var newsletterButtonWidth = 0; 684 (function ($) { 685 $('.header-mailing-list .ae-cform-container').find('a.ae-cform-modal-display-cta').each(function() { 686 if ($(this).outerWidth() > newsletterButtonWidth) { 687 newsletterButtonWidth = $(this).outerWidth(); 688 } 689 }); 690 $('.header-mailing-list').css('min-width', newsletterButtonWidth); 691 })(jQuery); 692}
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.