1;( $ => { 2 3 let lenis 4 5 // Initialize Lenis 6 if ( typeof Lenis !== 'undefined' ) { 7 8 lenis = new Lenis( { 9 prevent: node => ( 10 node.classList.contains( 'modal' ) 11 || node.classList.contains( 'cookieadmin_details_wrapper' ) 12 || node.classList.contains( 'gmap' ) 13 || node.classList.contains( 'hamburger-container' ) 14 || node.tagName === 'TEXTAREA' 15 ) 16 } ) 17 18 } 19 20 if ( typeof gsap !== 'undefined' ) { 21 22 if ( typeof ScrollTrigger !== 'undefined' ) gsap.registerPlugin( ScrollTrigger ) 23 24 } 25 26 if ( typeof Lenis !== 'undefined'&& lenis && typeof ScrollTrigger !== 'undefined' ) { 27 28 gsap.ticker.add( time => { 29 30 lenis.raf( time * 1000 ) 31 32 } ) 33 34 gsap.ticker.lagSmoothing( 0 ) 35 36 } 37 38 let scrollY 39 40 window.GBWP = { 41 isMobile: window.innerWidth <= 620, 42 google: { 43 maps: [], 44 markers: [], 45 clusters: [], 46 mapStyle: JSON.parse( '[{"elementType":"geometry","stylers":[{"color":"#fdfffa"}]},{"elementType":"labels.icon","stylers":[{"visibility":"off"}]},{"elementType":"labels.text.fill","stylers":[{"color":"#015051"},{"visibility":"on"}]},{"elementType":"labels.text.stroke","stylers":[{"color":"#ffffff"}]},{"featureType":"administrative.country","elementType":"geometry.stroke","stylers":[{"color":"#4c7273"}]},{"featureType":"administrative.land_parcel","elementType":"labels.text.fill","stylers":[{"color":"#015051"}]},{"featureType":"poi","elementType":"geometry","stylers":[{"color":"#ddedd1"}]},{"featureType":"poi","elementType":"labels.text.fill","stylers":[{"color":"#005051"}]},{"featureType":"poi.business","stylers":[{"visibility":"off"}]},{"featureType":"poi.park","elementType":"geometry","stylers":[{"color":"#ddeed1"}]},{"featureType":"poi.park","elementType":"labels.text.fill","stylers":[{"color":"#005051"}]},{"featureType":"road","elementType":"geometry","stylers":[{"color":"#76bc43"}]},{"featureType":"road","elementType":"labels.icon","stylers":[{"visibility":"on"}]},{"featureType":"road.arterial","elementType":"geometry","stylers":[{"color":"#c0d4d4"},{"lightness":20}]},{"featureType":"road.arterial","elementType":"labels.text.fill","stylers":[{"color":"#407c7d"}]},{"featureType":"road.highway","elementType":"geometry.fill","stylers":[{"lightness":20}]},{"featureType":"road.highway","elementType":"geometry.stroke","stylers":[{"color":"#76bc43"},{"lightness":20}]},{"featureType":"road.highway","elementType":"labels.text.fill","stylers":[{"color":"#005051"}]},{"featureType":"road.local","elementType":"geometry.fill","stylers":[{"color":"#fdfffa"},{"visibility":"on"}]},{"featureType":"road.local","elementType":"geometry.stroke","stylers":[{"color":"#d7e5e5"},{"visibility":"on"}]},{"featureType":"road.local","elementType":"labels.text.fill","stylers":[{"color":"#417c7c"}]},{"featureType":"transit","stylers":[{"visibility":"off"}]},{"featureType":"transit.line","elementType":"geometry","stylers":[{"color":"#c1d4d4"}]},{"featureType":"transit.station","elementType":"geometry","stylers":[{"color":"#c1d4d4"}]},{"featureType":"water","elementType":"geometry","stylers":[{"color":"#d8eefc"}]},{"featureType":"water","elementType":"labels.text.fill","stylers":[{"color":"#5e98c5"}]}]' ), 47 createMap: async ( mapNode, args = {}, store = true ) => { 48 49 if ( GBWP.getSearchParams().has( 'nomap' ) ) return 50 51 if ( ! window.google || ! window.google.maps || ! mapNode ) return false 52 53 const { Map } = await google.maps.importLibrary( 'maps' ) 54 55 const mapArgs = { 56 zoom: 8, 57 disableDefaultUI: true, 58 gestureHandling: 'greedy', 59 } 60 61 if ( GBWPMeta.google_maps.map_id ) 62 mapArgs.mapId = GBWPMeta.google_maps.map_id 63 else 64 mapArgs.mapTypeControlOptions = { 65 mapTypeIds: [ 'custom_style' ], 66 } 67 68 if ( args.center ) 69 mapArgs.center = args.center 70 else if ( GBWPMeta.google_maps.center ) 71 mapArgs.center = GBWPMeta.google_maps.center 72 73 if ( args.zoom ) 74 mapArgs.zoom = args.zoom 75 else if ( GBWPMeta.google_maps.zoom ) 76 mapArgs.zoom = GBWPMeta.google_maps.zoom 77 78 if ( ! args.noRestriction ) { 79 80 if ( args.restriction ) 81 mapArgs.restriction = args.restriction 82 else if ( GBWPMeta.google_maps.restriction ) 83 mapArgs.restriction = { 84 latLngBounds: GBWPMeta.google_maps.restriction,
85 strictBounds: false, 86 } 87 88 } 89 90 const map = new Map( mapNode, mapArgs ) 91 92 if ( ! GBWPMeta.google_maps.map_id ) { 93 94 const styledMapType = new google.maps.StyledMapType( GBWP.google.mapStyle, { name: 'Custom Style' } ) 95 96 map.mapTypes.set( 'custom_style', styledMapType ) 97 map.setMapTypeId( 'custom_style' ) 98 99 } 100 101 const $controlsWrapper = $( mapNode ).next( '.gmap-controls' ) 102 103 if ( $controlsWrapper.length ) { 104 105 // Init zoom controls 106 $controlsWrapper.find( '.zoom-control-in' ).on( 'click', () => { 107 map.setZoom( map.getZoom() + 1 ) 108 } ) 109 110 $controlsWrapper.find( '.zoom-control-out' ).on( 'click', () => { 111 map.setZoom( map.getZoom() - 1 ) 112 } ) 113 114 // Init fullscreen control 115 const elementToSendFullscreen = map.getDiv().firstChild 116 const $fullscreenControl = $controlsWrapper.find( '.fullscreen-control' ) 117 118 $fullscreenControl.on( 'click', ev => { 119 120 if ( GBWP.isFullscreen( elementToSendFullscreen ) ) 121 GBWP.exitFullscreen() 122 else 123 GBWP.requestFullscreen( elementToSendFullscreen ) 124 125 } ) 126 127 document.onwebkitfullscreenchange = 128 document.onmsfullscreenchange = 129 document.onmozfullscreenchange = 130 document.onfullscreenchange = 131 function () { 132 if ( GBWP.isFullscreen( elementToSendFullscreen ) ) 133 $fullscreenControl.addClass( 'is-fullscreen' ) 134 else 135 $fullscreenControl.removeClass( 'is-fullscreen' ) 136 } 137 138 map.controls[google.maps.ControlPosition.RIGHT_TOP].push( 139 $controlsWrapper.find( '.custom-controls' ).get( 0 ), 140 ) 141 142 } 143 144 return store ? GBWP.google.maps.push( map ) - 1 : map 145 146 }, 147 }, 148 isFullscreen: element => ( 149 ( 150 document.fullscreenElement || 151 document.webkitFullscreenElement || 152 document.mozFullScreenElement || 153 document.msFullscreenElement 154 ) == element 155 ), 156 requestFullscreen: element => { 157 158 if (element.requestFullscreen) { 159 element.requestFullscreen(); 160 } else if (element.webkitRequestFullScreen) { 161 element.webkitRequestFullScreen(); 162 } else if (element.mozRequestFullScreen) { 163 element.mozRequestFullScreen(); 164 } else if (element.msRequestFullScreen) { 165 element.msRequestFullScreen(); 166 } 167 168 }, 169 exitFullscreen: () => { 170 171 if (document.exitFullscreen) { 172 document.exitFullscreen(); 173 } else if (document.webkitExitFullscreen) { 174 document.webkitExitFullscreen(); 175 } else if (document.mozCancelFullScreen) { 176 document.mozCancelFullScreen(); 177 } else if (document.msExitFullscreen) { 178 document.msExitFullscreen(); 179 } 180 181 }, 182 debounce: ( func, wait, immediate ) => { 183 184 let timeout 185 186 return function() { 187 188 const context = this 189 const args = arguments 190 const later = function() { 191 192 timeout = null 193 194 if ( !immediate ) func.apply( context, args ) 195 196 } 197 const callNow = immediate && !timeout 198 199 clearTimeout( timeout ) 200 201 timeout = setTimeout( later, wait ) 202 203 if ( callNow ) func.apply( context, args ) 204 205 } 206 207 }, 208 refreshHeaderHeight: () => { 209 210 $( 'html' ).css( '--header-height', `${$( '.site-header' ).height()}px` ) 211 212 }, 213 refreshDocumentWidth: () => { 214 215 $( 'html' ).css( '--document-width', `${document.documentElement.clientWidth}px` ) 216 217 }, 218 disableScroll: target => { 219 220 scrollY = window.scrollY || window.pageYOffset 221 222 document.documentElement.classList.add( 'scroll-lock' ) 223 document.body.classList.add( 'scroll-lock' ) 224 document.body.style.top = `-${scrollY}px` 225 226 if ( bodyScrollLock && bodyScrollLock.disableBodyScroll ) 227 bodyScrollLock.disableBodyScroll( target, { reserveScrollBarGap: true } ) 228 229 }, 230 enableScroll: target => { 231 232 document.documentElement.classList.add( 'no-smooth' ) 233 document.body.classList.add( 'no-smooth' ) 234 document.documentElement.classList.remove( 'scroll-lock' ) 235 document.body.classList.remove( 'scroll-lock' ) 236 document.body.style.top = `` 237 238 window.scrollTo( { top: scrollY, left: 0, behavior: 'auto' } ) 239 240 requestAnimationFrame( () => { 241 242 document.documentElement.classList.remove( 'no-smooth' ) 243 document.body.classList.remove( 'no-smooth' ) 244 245 } ) 246 247 if ( bodyScrollLock && bodyScrollLock.enableBodyScroll ) 248 bodyScrollLock.enableBodyScroll( target ) 249 250 }, 251 getSearchParams: () => new URLSearchParams( location.search ), 252 changeSearchParams: searchParams => { 253 254 const url = new URL( location.href ) 255 256 if ( searchParams instanceof URLSearchParams ) 257 url.search = `?${searchParams.toString()}` 258 else if ( typeof searchParams === 'string' ) 259 url.search = ( searchParams.indexOf( '?' ) === 0 ? searchParams : `?${searchParams}` ) 260 else 261 return false 262 263 history.replaceState( null, '', url.toString() ) 264 265 }, 266 changeHash: hash => { 267 268 const url = new URL( location.href ) 269 270 if ( typeof hash === 'string' ) 271 url.hash = ( hash.indexOf( '#' ) === 0 ? hash : `#${hash}` ) 272 else 273 return false 274 275 history.replaceState( null, '', url.toString() ) 276 277 }, 278 createTicker: ticker => { 279 280 const tickerContainer = ticker.querySelector( '.gbwp-ticker__container' ) 281 const tickerWrapper = ticker.querySelector( '.gbwp-ticker__wrapper' ) 282 283 // const numberClones = ( tickerWrapper.offsetWidth < window.innerWidth ? 4 : 2 ) 284 const numberClones = 4 285 286 for ( let i = 0 ; i < numberClones ; i++ ) { 287 288 const clone = tickerWrapper.cloneNode( true ) 289 const $lazyImages = $( clone ).find( 'img[loading=lazy]' ) 290 291 $lazyImages.attr( 'loading', 'eager' ) 292 $lazyImages.attr( 'fetchpriority', 'low' ) 293 294 if ( i % 2 === 0 ) 295 tickerWrapper.parentNode.prepend( clone ) 296 else 297 tickerWrapper.parentNode.append( clone ) 298 299 300 } 301 302 ticker.classList.add( 'gbwp-ticker--ready' ) 303 304 if ( ! ticker.hasAttribute( 'data-disable-scroll' ) ) { 305 306 ScrollTrigger.create({ 307 trigger: ticker, 308 start: 'top bottom', 309 end: 'bottom top', 310 onUpdate: self => { 311 312 tickerContainer.style.transform = `translate3d(${-self.progress * window.innerHeight}px, 0, 0)` 313 314 if ( ! self.prevDirection ) self.prevDirection = null 315 316 if ( self.direction !== self.prevDirection ) { 317 318 ticker.querySelectorAll('.gbwp-ticker__list').forEach(list => { 319 320 list.style.animationPlayState = (self.direction < 0 ? 'paused' : 'running') 321 322 }) 323 324 ticker.querySelectorAll('.gbwp-ticker__wrapper').forEach(wrapper => { 325 326 wrapper.style.animationPlayState = (self.direction < 0 ? 'running' : 'paused') 327 328 }) 329 330 self.prevDirection = self.direction 331 332 } 333 334 } 335 }) 336 337 } 338 339 }, 340 isPartiallyVisible: element => { 341 342 const rect = element.getBoundingClientRect() 343 344 return ( 345 rect.top < ( window.innerHeight || document.documentElement.clientHeight ) && 346 rect.bottom > 0 && 347 rect.left < ( window.innerWidth || document.documentElement.clientWidth ) && 348 rect.right > 0 349 ) 350 351 }, 352 fetchLocationLiveData: () => { 353 354 const $triggers = $( '[data-location-live]' ) 355 356 if ( ! $triggers.length ) return false 357 358 const ids = [ ...new Set( $triggers.map( ( idx, el ) => { 359 360 return $( el ).data( 'location' ) 361 362 } ).get() ) ] 363 364 const fields = [ ...new Set( $triggers.map( ( idx, el ) => { 365 366 return $( el ).data( 'location-live' ) 367 368 } ).get() ) ] 369 370 $.ajax( { 371 url: GBWPMeta.ajax.url, 372 method: 'post', 373 data: { 374 action: 'location_live_status', 375 nonce: GBWPMeta.ajax.nonce, 376 ids: ids.join( ',' ), 377 fields: fields.join( ',' ), 378 }, 379 success: res => { 380 381 if ( res.status == 'success' ) { 382 383 if ( res.result ) { 384 385 for ( const locationId in res.result ) { 386 387 for ( const field in res.result[locationId] ) { 388 389 $( `[data-location=${locationId}][data-location-live=${field}]` ).replaceWith( res.result[locationId][field] ) 390 391 } 392 393 } 394 395 } 396 397 } 398 399 } 400 } ) 401 402 }, 403 createLiveLocationInterval: ( delay = 30000 ) => { 404 405 if ( ! GBWP.locationLiveDataInterval ) { 406 407 GBWP.locationLiveDataInterval = setInterval( GBWP.fetchLocationLiveData, delay ) 408 409 } 410 411 }, 412 deleteLiveLocationInterval: () => { 413 414 if ( GBWP.locationLiveDataInterval ) { 415 416 clearInterval( GBWP.locationLiveDataInterval ) 417 418 GBWP.locationLiveDataInterval = undefined 419 420 } 421 422 }, 423 getCurrentPosition: ( options = {} ) => { 424 425 return new Promise( ( resolve, reject ) => { 426 427 navigator.geolocation.getCurrentPosition( 428 position => resolve( position ), 429 error => reject( error ), 430 options 431 ) 432 433 } ) 434 435 }, 436 cookie: { 437 get: name => { 438 439 const clist = decodeURIComponent( document.cookie ).split( ';' ) 440 441 for ( let i = 0 ; i < clist.length ; i++ ) { 442 443 const c = clist[i].trim() 444 445 if ( c.indexOf( name + '=' ) == 0 ) return c.substring( name.length + 1, c.length ) 446 447 } 448 449 return '' 450 451 }, 452 set: ( name, value, expDays ) => { 453 454 const expire = new Date() 455 expire.setTime( expire.getTime() + expDays*24*60*60*1000 ) 456 document.cookie = `${name}=${value};expires=${expire.toUTCString()};path=/` 457 458 }, 459 } 460 } 461 462 $( window ).on( 'load', () => { 463 464 $( 'body' ).addClass( 'window-loaded' ) 465 466 } ) 467 468 $( () => { 469 470 let prevScrollPos = $( window ).scrollTop() 471 472 // DOM loaded 473 $( 'body' ).addClass( 'dom-ready' ) 474 $( 'body' ).toggleClass( 'scrolled', $( window ).scrollTop() > 0 ) 475 476 // Refresh CSS variables 477 GBWP.refreshHeaderHeight() 478 GBWP.refreshDocumentWidth() 479 480 /* ------------------------- */ 481 /* -------- Tickers -------- */ 482 /* ------------------------- */ 483 484 $( '.gbwp-ticker' ).each( ( idx, el ) => { 485 486 GBWP.createTicker( el ) 487 488 } ) 489 490 /* ------------------------- */ 491 /* ----- Menu Switcher ----- */ 492 /* ------------------------- */ 493 494 // Enable Space and Enter keys on labels 495 $( '.menu-switcher label' ).on( 'keyup', ev => { 496 497 switch ( ev.keyCode ) { 498 499 case 13: // Enter 500 case 32: // Space 501 502 $( ev.currentTarget ).trigger( 'click' ) 503 504 break; 505 506 default: break; 507 508 } 509 510 } ) 511 512 /* ---------------------- */ 513 /* --- Clickable Area --- */ 514 /* ---------------------- */ 515 516 $( document ).on( 'click', '[data-href]', ev => { 517 518 const $trigger = $( ev.currentTarget ) 519 520 const href = $trigger.data( 'href' ) 521 522 const $linkElement = $( ev.target ).closest( 'a', $trigger ) 523 524 if ( href && !$linkElement.length ) { 525 526 let target = $trigger.data( 'href-target' ) 527 528 if ( ! target ) target = '_self' 529 530 window.open( href, target ) 531 532 } 533 534 } ) 535 536 /* ------------------------- */ 537 /* --- Scroll To Element --- */ 538 /* ------------------------- */ 539 540 $( document ).on( 'click', '[data-scroll-to]', ev => { 541 542 ev.preventDefault() 543 544 const $target = $( $( ev.currentTarget).data( 'scroll-to' ) ) 545 546 if ( $target.length ) { 547 548 try { 549 550 $target.get( 0 ).scrollIntoView( { behavior: 'smooth' } ) 551 552 } catch ( ex ) { 553 554 $target.get( 0 )?.scrollIntoView( true ) 555 556 } 557 558 } 559 560 } ) 561 562 /* ----------------- */ 563 /* --- Accordion --- */ 564 /* ----------------- */ 565 566 $( document ).on( 'click', '.ac-trigger', ev => { 567 568 const $trigger = $( ev.currentTarget ) 569 570 const $accordion = $trigger.closest( '.accordion' ) 571 572 if ( $accordion.find( '.ac-state' ).is( ':checked' ) && $accordion.find( '.ac-content' ).is( ':visible' ) ) { 573 574 ev.preventDefault() 575 576 $accordion.find( '.ac-state' ).prop( 'checked', false ).trigger( 'change' ) 577 578 } 579 580 } ) 581 582 $( document ).on( 'change', '.ac-state', ev => { 583 584 const $state = $( ev.currentTarget ) 585 586 $( `.ac-state[type=radio][name=${$state.attr( 'name' )}
586]` ).closest( '.accordion' ).find( '.ac-content-inner' ).each( ( idx, el ) => { 587 588 el.inert = true 589 590 } ) 591 592 $state.closest( '.accordion' ).find( '.ac-content-inner' ).get( 0 ).inert = ! $state.is( ':checked') 593 594 } ) 595 596 /* ------------------------ */ 597 /* --- On Window Scroll --- */ 598 /* ------------------------ */ 599 600 $( window ).on( 'scroll', ev => { 601 602 // Check window scroll 603 $( 'body' ).toggleClass( 'scrolled', $( window ).scrollTop() > 0 ) 604 605 // Show header on scroll up 606 const currentScrollPos = $( window ).scrollTop() 607 const headerTop = $( '#header-top' ).offset()?.top || 0 608 const headerHeight = $( '.site-header' ).height() 609 610 $( '.site-header' ).toggleClass( 'hide', currentScrollPos > headerHeight + headerTop && currentScrollPos > prevScrollPos ) 611 612 prevScrollPos = currentScrollPos 613 614 } ) 615 616 /* ------------------------ */ 617 /* --- On Window Resize --- */ 618 /* ------------------------ */ 619 620 $( window ).on( 'resize', GBWP.debounce( ev => { 621 622 // Refresh CSS variables 623 GBWP.refreshHeaderHeight() 624 GBWP.refreshDocumentWidth() 625 626 }, 100 ) ) 627 628 /* ------------- */ 629 /* --- Modal --- */ 630 /* ------------- */ 631 632 $( document ).on( 'click', '.modal', ev => { 633 634 if ( ev.target == ev.currentTarget ) { 635 636 $( ev.currentTarget ).trigger( 'modal:close' ) 637 638 } 639 640 } ) 641 642 $( document ).on( 'click', '.modal-close', ev => { 643 644 ev.preventDefault() 645 646 $( ev.currentTarget ).closest( '.modal' ).trigger( 'modal:close' ) 647 648 } ) 649 650 $( document ).on( 'click', '[data-open-modal]', ev => { 651 652 ev.preventDefault() 653 654 $( `#${$( ev.currentTarget ).data( 'open-modal' )}` ).trigger( 'modal:open' ) 655 656 $( ev.currentTarget ).trigger( 'blur' ) 657 658 } ) 659 660 $( document ).on( 'modal:open', '.modal', ev => { 661 662 const $modal = $( ev.currentTarget ) 663 664 $modal.addClass( 'active' ) 665 666 GBWP.disableScroll( $modal.find( '.modal-inner' ).get( 0 ) ) 667 668 $modal.get( 0 ).inert = false 669 670 if ( $modal.hasClass( 'modal--video' ) ) { 671 672 $modal.find( 'video' ).each( ( idx, el ) => { 673 674 if ( $( el ).prop( 'autoplay' ) ) 675 el.play() 676 677 } ) 678 679 } 680 681 } ) 682 683 $( document ).on( 'modal:close', '.modal', ev => { 684 685 const $modal = $( ev.currentTarget ) 686 687 $modal.removeClass( 'active' ) 688 689 GBWP.enableScroll( $modal.find( '.modal-inner' ).get( 0 ) ) 690 691 if ( $modal.hasClass( 'modal--video' ) ) { 692 693 $modal.find( 'video' ).each( ( idx, el ) => { 694 695 el.pause() 696 697 } ) 698 699 $modal.find( 'iframe' ).each( ( idx, el ) => { 700 701 const src = el.src 702 el.src = '' 703 el.src = src 704 705 } ) 706 707 } 708 709 $modal.get( 0 ).inert = true 710 711 } ) 712 713 /* ------------------------- */ 714 /* --- Copy To Clipboard --- */ 715 /* ------------------------- */ 716 717 $( document ).on( 'click', '[data-clipboard]', ev => { 718 719 ev.preventDefault() 720 721 const $trigger = $( ev.currentTarget ) 722 const data = $trigger.data( 'clipboard' ) 723 724 if ( data ) { 725 726 navigator.clipboard.writeText( data ) 727 728 alert( 'Copied to clipboard' ) 729 730 } 731 732 } ) 733 734 /* ------------------ */ 735 /* --- Navigation --- */ 736 /* ------------------ */ 737 738 $( '.site-header #hamburger-menu-state' ).on( 'change', ev => { 739 740 const $trigger = $( ev.currentTarget ) 741 const $hamburger = $( '.site-header .hamburger-container' ) 742 743 if ( $trigger.is( ':checked' ) ) GBWP.disableScroll( $hamburger.get( 0 ) ) 744 else GBWP.enableScroll( $hamburger.get( 0 ) ) 745 746 } ) 747 748 $( '.site-header input[name="menu-state"]' ).on( 'change', ev => { 749 750 const $trigger = $( ev.currentTarget ) 751 const $label = $( `.site-header [for='${$trigger.prop( 'id' )}'` ) 752 753 $label.siblings().removeClass( 'active' ) 754 $label.addClass( 'active' ) 755 756 GBWP.cookie.set( 'menu_switch', $trigger.val(), 30 ) 757 758 } ) 759 760 $( '.site-header .main-menu > .menu-item-has-children > a' ).on( 'click', ev => { 761 762 ev.preventDefault() 763 764 const $menuItem = $( ev.currentTarget ).closest( '.menu-item' ) 765 const $subMenu = $menuItem.find( '.sub-menu' ) 766 const $hamburger = $( '.site-header .hamburger-container' ) 767 768 if ( $subMenu.length ) { 769 770 if ( $menuItem.hasClass( 'active' ) ) { 771 772 $menuItem.removeClass( 'active' ) 773 774 $( 'body' ).removeClass( 'submenu-open' ) 775 776 if ( window.innerWidth > 1024 ) 777 GBWP.enableScroll( $hamburger.get( 0 ) ) 778 779 } else { 780 781 if ( window.innerWidth > 1024 ) 782 GBWP.disableScroll( $hamburger.get( 0 ) ) 783 784 $menuItem.siblings( '.menu-item.active' ).removeClass( 'active' ) 785 786 $menuItem.addClass( 'active' ) 787 788 $( 'body' ).addClass( 'submenu-open' ) 789 790 } 791 792 } 793 794 } ) 795 796 $( '#hamburger-overlay' ).on( 'click', ev => { 797 798 $( 'body' ).removeClass( 'submenu-open' ) 799 $( '.site-header .main-menu .menu-item.active' ).removeClass( 'active' ) 800 801 if ( window.innerWidth > 1024 ) { 802 803 const $hamburger = $( '.site-header .hamburger-container' ) 804 805 GBWP.enableScroll( $hamburger.get( 0 ) ) 806 807 } 808 809 } ) 810
811 $( '.site-header .hamburger-menu-back-btn' ).on( 'click', ev => { 812 813 $( 'body' ).removeClass( 'submenu-open' ) 814 $( '.site-header .main-menu .menu-item.active' ).removeClass( 'active' ) 815 816 } ) 817 818 /* ---------------------- */ 819 /* --- Rolling Number --- */ 820 /* ---------------------- */ 821 822 $( '.rolling-number' ).each( function () { 823 824 new IntersectionObserver( ( entries, observer ) => { 825 826 entries.forEach( entry => { 827 828 if ( entry.isIntersecting ) { 829 830 const $el = $( entry.target ) 831 const target = $el.data( 'target' ) 832 const duration = $el.data( 'duration' ) 833 834 $( { counter: 0 } ).animate( 835 { counter: target }, 836 { 837 duration: duration || 1000, 838 step: now => { 839 840 $el.text( Math.floor( now ) ) 841 842 }, 843 complete: () => { 844 845 $el.text( target ) 846 847 } 848 } 849 ) 850 851 observer.unobserve( entry.target ); 852 853 } 854 855 } ) 856 857 }, { rootMargin: "-15% 0px -15% 0px" } ).observe( this ); 858 859 } ) 860 861 /* ------------------------- */ 862 /* --- Horizontal Scroll --- */ 863 /* ------------------------- */ 864 865 $( '.hscroll-container' ).each( ( idx, el ) => { 866 867 const $hscroll = $( el ) 868 const $inner = $hscroll.find( '.hscroll-inner' ) 869 870 const _ = () => { 871 872 let leftShadow = true, rightShadow = true 873 const treshold = 24 874 const scrollLeft = $inner.scrollLeft() 875 876 if ( scrollLeft < treshold ) leftShadow = false 877 878 if ( scrollLeft + $inner.outerWidth() + treshold >= $inner.get( 0 ).scrollWidth ) rightShadow = false 879 880 $hscroll.toggleClass( 'no-left-shadow', !leftShadow ) 881 $hscroll.toggleClass( 'no-right-shadow', !rightShadow ) 882 883 } 884 885 _() 886 887 $inner.on( 'scroll', _ ) 888 889 $( window ).on( 'resize', _ ) 890 891 } ) 892 893 /* ------------------------- */ 894 /* ---- Lazy Load Videos --- */ 895 /* ------------------------- */ 896 897 const lazyVideoObserver = new IntersectionObserver( ( entries, observer ) => { 898 899 entries.forEach( entry => { 900 901 if ( entry.isIntersecting ) { 902 903 observer.unobserve( entry.target ); 904 905 const video = entry.target 906 const videoSrc = video.getAttribute( 'data-src' ) 907 let sourceSet = false 908 909 video.querySelectorAll( 'source[data-src]' ).forEach( source => { 910 911 if ( ! source.getAttribute( 'src' ) ) { 912 913 source.setAttribute( 'src', source.getAttribute( 'data-src' ) ) 914 source.removeAttribute( 'data-src' ) 915 916 sourceSet = true 917 918 } 919 920 } ) 921 922 if ( ! sourceSet && videoSrc && ! video.getAttribute( 'src' ) ) { 923 924 video.setAttribute( 'src', videoSrc ) 925 video.removeAttribute( 'data-src' ) 926 927 } 928 929 if ( sourceSet ) 930 video.removeAttribute( 'src' ) 931 932 $( video ).on( 'loadedmetadata', () => { 933 934 if ( ! GBWP.isPartiallyVisible( video ) ) 935 video.pause() 936 937 } ) 938 939 video.load() 940 941 $( video ).removeClass( 'wp-video-shortcode--lazy' ).addClass( 'wp-video-shortcode' ).mediaelementplayer( $.extend( true, {}, _wpmejsSettings ) ) 942 943 setTimeout( () => { 944 945 $( video ).closest( '.mejs-video.background' ).attr( 'tabindex', '-1' ) 946 947 }, 100 ) 948 949 } 950 951 } ) 952 953 }, { 954 rootMargin: '800px 800px', 955 threshold: 0.01, 956 } ) 957 958 $( 'video.wp-video-shortcode--lazy' ).each( ( idx, el ) => lazyVideoObserver.observe( el ) ) 959 960 /* ------------------------- */
961 /* ---- Background Video --- */ 962 /* ------------------------- */ 963 964 // Remove controls from background videos 965 $( 'video.background' ).removeAttr( 'controls' ) 966 967 // Remove tab support for background videos 968 setTimeout( () => { 969 970 $( '.mejs-video.background' ).attr( 'tabindex', '-1' ) 971 972 }, 100 ) 973 974 // Observe background videos, only play them if they are in the viewport 975 const backgroundVideoObserver = new IntersectionObserver( entries => { 976 977 entries.forEach( entry => { 978 979 if ( entry.target.readyState >= HTMLMediaElement.HAVE_ENOUGH_DATA ) { 980 981 if ( entry.isIntersecting ) 982 entry.target.play().catch( () => {} ) 983 else 984 entry.target.pause() 985 986 } 987 988 } ) 989 990 } ) 991 992 $( 'video.background' ).each( ( idx, el ) => backgroundVideoObserver.observe( el ) ) 993 994 } ) 995 996} )( jQuery );
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.