1/** 2 * Often used vanilla js functions, so that we don't need 3 * to use all of underscore/jQuery 4 */ 5(function( undefined ) { 6 "use strict"; 7 8 var v = ( window.VAMTAM = window.VAMTAM || {} ); // Namespace 9 10 // Returns a function, that, as long as it continues to be invoked, will not 11 // be triggered. The function will be called after it stops being called for 12 // N milliseconds. If `immediate` is passed, trigger the function on the 13 // leading edge, instead of the trailing. 14 v.debounce = function( func, wait, immediate ) { 15 var timeout; 16 return function() { 17 var context = this, args = arguments; 18 var later = function() { 19 timeout = null; 20 if ( ! immediate ) func.apply( context, args ); 21 }; 22 var callNow = immediate && ! timeout; 23 clearTimeout( timeout ); 24 timeout = setTimeout( later, wait ); 25 if ( callNow ) func.apply( context, args ); 26 }; 27 }; 28 29 if ( 'jQuery' in window && ! ( 'debounce' in window.jQuery ) ) { 30 window.jQuery.debounce = function( delay, at_begin, callback ) { 31 return callback === undefined ? 32 v.debounce( at_begin, delay, false ) 33 : v.debounce( callback, delay, at_begin !== false ); 34 }; 35 } 36 37 38 // vanilla jQuery.fn.offset() replacement 39 // @see https://plainjs.com/javascript/styles/get-the-position-of-an-element-relative-to-the-document-24/ 40 41 v.offset = function( el ) { 42 var rect = el.getBoundingClientRect(), 43 scrollLeft = window.pageXOffset || document.documentElement.scrollLeft, 44 scrollTop = window.pageYOffset || document.documentElement.scrollTop; 45 return { top: rect.top + scrollTop, left: rect.left + scrollLeft }; 46 }; 47 48 // Faster scroll-based animations 49 50 v.scroll_handlers = []; 51 v.latestKnownScrollY = 0; 52 53 var ticking = false; 54 55 v.addScrollHandler = function( handler ) { 56 requestAnimationFrame( function() { 57 handler.init(); 58 v.scroll_handlers.push( handler ); 59 60 handler.measure( v.latestKnownScrollY ); 61 handler.mutate( v.latestKnownScrollY ); 62 } ); 63 }; 64 65 v.onScroll = function() { 66 v.latestKnownScrollY = window.pageYOffset; 67 68 if ( ! ticking ) { 69 ticking = true; 70 71 requestAnimationFrame( function() { 72 var i; 73 74 for ( i = 0; i < v.scroll_handlers.length; i++ ) { 75 v.scroll_handlers[i].measure( v.latestKnownScrollY ); 76 } 77 78 for ( i = 0; i < v.scroll_handlers.length; i++ ) { 79 v.scroll_handlers[i].mutate( v.latestKnownScrollY ); 80 } 81 82 ticking = false; 83 } ); 84 } 85 }; 86 87 window.addEventListener( 'scroll', v.onScroll, { passive: true } ); 88 89 // Load an async script 90 v.load_script = function( src, callback ) { 91 var s = document.createElement('script'); 92 s.type = 'text/javascript'; 93 s.async = true; 94 s.src = src; 95 96 if ( callback ) { 97 s.onload = callback; 98 } 99 100 document.getElementsByTagName('script')[0].before( s ); 101 }; 102 103 v.load_style = function( href, media, callback, after ) { 104 var l = document.createElement('link'); 105 l.rel = 'stylesheet'; 106 l.type = 'text/css'; 107 l.media = media; 108 l.href = href; 109 110 if ( callback ) { 111 l.onload = callback; 112 } 113 114 if ( after ) { 115 after.after( l ); 116 } else { 117 document.getElementsByTagName('link')[0].before( l ); 118 } 119 }; 120})(); 121(function(v, undefined) { 122 "use strict"; 123 124 var queue = []; 125 126 function process_queue() { 127 for ( var i = 0; i < queue.length; i++ ) { 128 queue[i].call( window ); 129 } 130 } 131 132 document.addEventListener( 'DOMContentLoaded', function() { 133 var scripts = []; 134 135 if ( 'punchgs' in window ) { 136 window.vamtamgs = window.GreenSockGlobals = window.punchgs; 137 window._gsQueue = window._gsDefine = null; 138 } else { 139 window.vamtamgs = window.GreenSockGlobals = {}; 140 window._gsQueue = window._gsDefine = null; 141 142 scripts.push( 143 window.VAMTAM_FRONT.jspath + 'plugins/thirdparty/gsap/TweenLite.min.js', 144 window.VAMTAM_FRONT.jspath + 'plugins/thirdparty/gsap/TimelineLite.min.js', 145 window.VAMTAM_FRONT.jspath + 'plugins/thirdparty/gsap/plugins/CSSPlugin.min.js' 146 ); 147 } 148 149 window.vamtam_greensock_loaded = false; 150 151 if ( ! ( 'scroll-behavior' in document.documentElement.style ) ) { 152 scripts.push( window.VAMTAM_FRONT.jspath + 'plugins/thirdparty/smoothscroll.js' ); 153 } 154 155 var total_ready = 0; 156 var maybe_ready = function() { 157 if ( ++ total_ready >= scripts.length ) { 158 window.GreenSockGlobals = window._gsQueue = window._gsDefine = null; 159 160 window.vamtam_greensock_loaded = true; 161 162 process_queue(); 163 } 164 }; 165 166 if ( scripts.length > 0 ) { 167 for ( var i = 0; i < scripts.length; i++ ) { 168 v.load_script( scripts[i], maybe_ready ); 169 } 170 } else { 171 maybe_ready(); 172 } 173 }); 174 175 window.vamtam_greensock_wait = function( callback ) { 176 var callback_wrapper = function() { 177 requestAnimationFrame( callback ); 178 }; 179 180 if ( window.vamtam_greensock_loaded ) { 181 callback_wrapper(); 182 } else { 183 queue.push( callback_wrapper ); 184 } 185 }; 186} )( window.VAMTAM ); 187(function() { 188 'use strict'; 189 190 // ChildNode (MDN) 191 192 var buildDOM = function() { 193 var nodes = Array.prototype.slice.call(arguments), 194 frag = document.createDocumentFragment(), 195 div, node; 196 197 while (node = nodes.shift()) { 198 if (typeof node == "string") { 199 div = document.createElement("div"); 200 div.innerHTML = node; 201 while (div.firstChild) { 202 frag.appendChild(div.firstChild); 203 } 204 } else { 205 frag.appendChild(node); 206 } 207 } 208 209 return frag; 210 }; 211 212 var proto = { 213 before: function() { 214 var frag = buildDOM.apply(this, arguments); 215 this.parentNode.insertBefore(frag, this); 216 }, 217 after: function() { 218 var frag = buildDOM.apply(this, arguments); 219 this.parentNode.insertBefore(frag, this.nextSibling); 220 }, 221 replaceWith: function() { 222 if (this.parentNode) { 223 var frag = buildDOM.apply(this, arguments); 224 this.parentNode.replaceChild(frag, this); 225 } 226 }, 227 remove: function() { 228 if (this.parentNode) { 229 this.parentNode.removeChild(this); 230 } 231 } 232 }; 233 234 var a = ["Element", "DocumentType", "CharacterData"]; // interface 235 var b = ["before", "after", "replaceWith", "remove"]; // methods 236 a.forEach(function(v) { 237 b.forEach(function(func) { 238 if (window[v]) { 239 if (window[v].prototype[func]) { return; }
240 window[v].prototype[func] = proto[func]; 241 } 242 }); 243 }); 244 245 // ParentNode.prepend() 246 // Source: https://github.com/jserz/js_piece/blob/master/DOM/ParentNode/prepend()/prepend().md 247 248 (function(arr) { 249 arr.forEach(function(item) { 250 if (item.hasOwnProperty('prepend')) { 251 return; 252 } 253 Object.defineProperty(item, 'prepend', { 254 configurable: true, 255 enumerable: true, 256 writable: true, 257 value: function prepend() { 258 var argArr = Array.prototype.slice.call(arguments), 259 docFrag = document.createDocumentFragment(); 260 261 argArr.forEach(function(argItem) { 262 var isNode = argItem instanceof Node; 263 docFrag.appendChild(isNode ? argItem : document.createTextNode(String(argItem))); 264 }); 265 266 this.insertBefore(docFrag, this.firstChild); 267 } 268 }); 269 }); 270 })([Element.prototype, Document.prototype, DocumentFragment.prototype]); 271 272 // Object.assign() (MDN) 273 274 if (typeof Object.assign != 'function') { 275 (function () { 276 Object.assign = function (target) { 277 // We must check against these specific cases. 278 if (target === undefined || target === null) { 279 throw new TypeError('Cannot convert undefined or null to object'); 280 } 281 282 var output = Object(target); 283 for (var index = 1; index < arguments.length; index++) { 284 var source = arguments[index]; 285 if (source !== undefined && source !== null) { 286 for (var nextKey in source) { 287 if (source.hasOwnProperty(nextKey)) { 288 output[nextKey] = source[nextKey]; 289 } 290 } 291 } 292 } 293 return output; 294 }; 295 })(); 296 } 297 298 // Element.prototype.matches (https://plainjs.com/javascript/traversing/get-closest-element-by-selector-39/) 299 window.Element && function(ElementPrototype) { 300 ElementPrototype.matches = ElementPrototype.matches || 301 ElementPrototype.matchesSelector || 302 ElementPrototype.webkitMatchesSelector || 303 ElementPrototype.msMatchesSelector || 304 function(selector) { 305 var node = this, nodes = (node.parentNode || node.document).querySelectorAll(selector), i = -1; 306 while (nodes[++i] && nodes[i] != node); 307 return !!nodes[i]; 308 }; 309 }(Element.prototype); 310 311 // Element.prototype.closest (https://plainjs.com/javascript/traversing/get-closest-element-by-selector-39/) 312 window.Element && function(ElementPrototype) { 313 ElementPrototype.closest = ElementPrototype.closest || 314 function(selector) { 315 var el = this; 316 while (el.matches && !el.matches(selector)) el = el.parentNode; 317 return el.matches ? el : null; 318 }; 319 }(Element.prototype); 320}()); 321 322(function(undefined) { 323 'use strict'; 324 325 // Namespace 326 window.VAMTAM = window.VAMTAM || {}; 327 328 window.VAMTAM.MEDIA = window.VAMTAM.MEDIA || { 329 layout: {}, 330 fallback: ! ( window.CSS && window.CSS.supports && window.CSS.supports( '(--foo: red)' ) ), 331 }; 332 333 var LAYOUT_SIZES = [{ 334 min: 0, 335 max: window.VAMTAM_FRONT.beaver_small, 336 className: 'layout-small' 337 }, { 338 min: window.VAMTAM_FRONT.beaver_responsive + 1, 339 max: Infinity, 340 className: 'layout-max' 341 }, { 342 min: window.VAMTAM_FRONT.beaver_responsive + 1, 343 max: window.VAMTAM_FRONT.content_width, 344 className: 'layout-max-low' 345 }, { 346 min: 0, 347 max: window.VAMTAM_FRONT.beaver_responsive, 348 className: 'layout-below-max' 349 } ]; 350 351 var sizesLength = LAYOUT_SIZES.length; 352 353 var remap = function() { 354 var map = {}; 355 356 for ( var i = 0; i < sizesLength; i++ ) { 357 var mq = '(min-width: '+LAYOUT_SIZES[i].min+'px)'; 358 359 if ( LAYOUT_SIZES[i].max !== Infinity ) { 360 mq += ' and (max-width: '+LAYOUT_SIZES[i].max+'px)'; 361 } 362 363 if ( window.matchMedia(mq).matches ) { 364 map[LAYOUT_SIZES[i].className] = true; 365 } 366 else { 367 map[LAYOUT_SIZES[i].className] = false; 368 } 369 } 370 371 window.VAMTAM.MEDIA.layout = map; 372 }; 373 374 var debouncedRemap = window.VAMTAM.debounce( remap, 100 ); 375 376 remap(); 377 378 document.addEventListener('DOMContentLoaded', function () { 379 if ( document.body.classList.contains( 'responsive-layout' ) && 'matchMedia' in window ) { 380 window.addEventListener( 'resize', debouncedRemap, false ); 381 window.addEventListener( 'load', debouncedRemap, false ); 382 383 remap(); 384 } else { 385 window.VAMTAM.MEDIA.layout = { 'layout-max': true, 'layout-below-max': false }; 386 } 387 } ); 388})(); 389 390(function($, v, undefined) { 391 "use strict"; 392 393 window.FLBuilderLayout && Object.assign( window.FLBuilderLayout, { 394 /** 395 * Monkey patches the built-in smooth scrolling (opt-in is better for load performance) 396 */ 397 _initAnchorLinks: function() { 398 }, 399 } ); 400 401 var mainHeader = $('header.main-header'); 402 var main = $( '#main' ); 403 var body = $( document.body ); 404 var header_contents = mainHeader.find( '.header-contents' ); 405 var menu_toggle = document.getElementById( 'vamtam-megamenu-main-menu-toggle' ); 406 var original_toggle = document.querySelector( '#main-menu > .mega-menu-wrap > .mega-menu-toggle' ); 407 var main_menu = document.querySelector( '#main-menu' ); 408 409 // main menu custom toggle 410 411 if ( menu_toggle ) { 412 menu_toggle.addEventListener( 'click', function( e ) { 413 e.preventDefault(); 414 415 requestAnimationFrame( function() { 416 var is_open = ( original_toggle || menu_toggle ).classList.contains( 'mega-menu-open' ); 417 418 menu_toggle.classList.toggle( 'mega-menu-open', ! is_open ); 419 420 ( original_toggle || main_menu ).classList.toggle( 'mega-menu-open', ! is_open ); 421 } ); 422 } ); 423 } 424 425 // overlay menu 426 427 var overlay_menu = document.getElementById( 'vamtam-overlay-menu' ); 428 var overlay_menu_toggle = document.querySelector( '.vamtam-overlay-menu-toggle' ); 429 430 var overlay_open = false;
431 var toggle_clone; 432 433 var toggle_overlay_menu = function( e ) { 434 e.preventDefault(); 435 436 requestAnimationFrame( function() { 437 overlay_open = ! overlay_open; 438 439 if ( overlay_open ) { 440 toggle_clone = overlay_menu_toggle.cloneNode( true ); 441 // measure 442 443 var offset = overlay_menu_toggle.getBoundingClientRect(); 444 445 // mutate 446 447 document.body.appendChild( toggle_clone ); 448 449 Object.assign( toggle_clone.style, { 450 position: 'fixed', 451 top: offset.top + 'px', 452 left: offset.left + 'px', 453 } ); 454 455 requestAnimationFrame( function() { 456 overlay_menu.classList.add( 'open' ); 457 toggle_clone.classList.add( 'is-active' ); 458 } ); 459 } else { 460 toggle_clone.classList.remove( 'is-active' ); 461 overlay_menu.classList.remove( 'open' ); 462 463 setTimeout( function() { 464 requestAnimationFrame( function() { 465 toggle_clone.remove(); 466 } ); 467 }, 650 ); 468 } 469 } ); 470 }; 471 472 $( function() { 473 document.body.addEventListener( 'click', function( e ) { 474 var button = e.target.closest( 'button' ); 475 if ( button && button.classList.contains( 'vamtam-overlay-menu-toggle' ) ) { 476 toggle_overlay_menu( e ); 477 } 478 } ); 479 } ); 480 481 // add left/right classes to submenus depending on resolution 482 483 var allSubMenus = $( '#main-menu .sub-menu, #top-nav-wrapper .sub-menu' ); 484 485 if ( allSubMenus.length ) { 486 var invertPositionCallback = window.VAMTAM.debounce( function() { 487 requestAnimationFrame( function() { 488 var winWidth = window.innerWidth; 489 490 allSubMenus.show().removeClass( 'invert-position' ).each( function() { 491 if ( $( this ).offset().left + $( this ).width() > winWidth - 50 ) { 492 $( this ).addClass( 'invert-position' ); 493 } 494 } ); 495 496 allSubMenus.css( 'display', '' ); 497 } ); 498 }, 100 ); 499 500 invertPositionCallback(); 501 window.addEventListener( 'resize', invertPositionCallback, false ); 502 } 503 504 // open submenus on click, only on mobile, when Max Mega Menu plugin is disabled 505 if ( main_menu && main_menu.classList.contains('vamtam-basic-menu') ) { 506 var allSubMenusResponsive = $(main_menu).find('.sub-menu'); 507 var allMenusResponsive = $(main_menu).find('.menu-item > a'); 508 509 allMenusResponsive.on( 'click', function( event ) { 510 if (!main_menu.classList.contains('mega-menu-open')) { 511 return; 512 } 513 514 var menuItem = this.parentElement; 515 516 if ( this.classList.contains( 'menu-item-on' ) || ! menuItem.classList.contains( 'menu-item-has-children' ) ) { 517 return; 518 } 519 520 event.preventDefault(); 521 522 var submenu = $( menuItem ).find( '.sub-menu' ); 523 524 allSubMenusResponsive.attr( 'style', '' ); 525 submenu.attr( 'style', 'display: block !important;' ); 526 allMenusResponsive.not( this ).removeClass( 'menu-item-on' ); 527 this.classList.add( 'menu-item-on' ); 528 }); 529 } 530 531 // scrolling below 532 533 var smoothScrollTimer, smoothScrollCallback; 534 535 var smoothScrollListener = function() { 536 clearTimeout( smoothScrollTimer ); 537 538 smoothScrollTimer = setTimeout( scrollToElComplete, 200 ); 539 }; 540 541 var scrollToElComplete = function() { 542 window.removeEventListener( 'scroll', smoothScrollListener, { passive: true } ); 543 v.blockStickyHeaderAnimation = false; 544 545 setTimeout( function() { 546 requestAnimationFrame( function() { 547 document.body.classList.remove( 'no-sticky-header-animation-tmp' ); 548 } ); 549 }, 50 ); 550 551 if ( smoothScrollCallback ) { 552 smoothScrollCallback(); 553 } 554 }; 555 556 var scrollToEl = function( el, duration, callback ) { 557 requestAnimationFrame( function() { 558 var el_offset = el.offset().top; 559 560 v.blockStickyHeaderAnimation = true; 561 562 // measure header height 563 var header_height = 0; 564 565 if ( mainHeader.hasClass( 'layout-standard' ) || mainHeader.hasClass( 'logo-text-menu' ) ) { 566 if ( el_offset >= main.offset().top ) { 567 header_height = mainHeader.find( '.second-row-columns' ).height(); 568 } else { 569 header_height = mainHeader.height(); 570 } 571 } else { 572 if ( body.hasClass( 'no-sticky-header-animation' ) ) { 573 // single line header with a special page template 574 575 header_height = mainHeader.height(); 576 } else { 577 header_height = header_contents.height(); 578 579 if ( 'stickyHeader' in v ) { 580 v.stickyHeader.singleRowStick(); 581 } 582 583 // in this case stick the header, 584 // we'd like the menu to be visible after scrolling 585 document.body.classList.add( 'no-sticky-header-animation-tmp' ); 586 } 587 } 588 589 if ( window.matchMedia( '(max-width: ' + VAMTAM_FRONT.mobile_header_breakpoint + ')' ).matches ) { 590 header_height = mainHeader.height(); 591 } 592 593 var scroll_position = el_offset - v.admin_bar_fix - header_height; 594 595 smoothScrollCallback = callback; 596 597 window.addEventListener( 'scroll', smoothScrollListener, { passive: true } ); 598 599 window.scroll( { left: 0, top: scroll_position, behavior: 'smooth' } ); 600 601 if ( el.attr( 'id' ) ) { 602 if ( history.pushState ) { 603 history.pushState( null, null, '#' + el.attr( 'id' ) ); 604 } else { 605 window.location.hash = el.attr( 'id' ); 606 } 607 } 608 609 menu_toggle && menu_toggle.classList.remove( 'mega-menu-open' ); 610 original_toggle && original_toggle.classList.remove( 'mega-menu-open' ); 611 } ); 612 }; 613 614 window.FLBuilderLayout && Object.assign( window.FLBuilderLayout, { 615 /** 616 * Monkey patches the built-in animated scroll with a better implementation 617 * which does not use jQuery 618 */ 619 _scrollToElement: function( el, callback ) { 620 var config = window.FLBuilderLayoutConfig.anchorLinkAnimations; 621 622 if ( el.length ) { 623 menu_toggle.classList.remove( 'mega-menu-open' ); 624 original_toggle.classList.remove( 'mega-menu-open' ); 625 626 scrollToEl( el, config.duration / 1000, callback ); 627 } 628 }, 629 } ); 630 631 $( document.body ).on('click', '.vamtam-animated-page-scroll[href], .vamtam-animated-page-scroll [href], .vamtam-animated-page-scroll [data-href], .mega-vamtam-animated-page-scroll[href], .mega-vamtam-animated-page-scroll [href], .mega-vamtam-animated-page-scroll [data-href]', function(e) { 632 var href = $( this ).prop( 'href' ) || $( this ).data( 'href' ); 633 var el = $( '#' + ( href ).split( "#" )[1] ); 634 635 var l = document.createElement('a'); 636 l.href = href; 637 638 if(el.length && l.pathname === window.location.pathname) { 639 menu_toggle.classList.remove( 'mega-menu-open' ); 640 original_toggle.classList.remove( 'mega-menu-open' ); 641 642 scrollToEl( el ); 643 e.preventDefault(); 644 } 645 }); 646 647 if ( window.location.hash !== "" && 648 ( 649 $( '.vamtam-animated-page-scroll[href*="' + window.location.hash + '"]' ).length || 650 $( '.vamtam-animated-page-scroll [href*="' + window.location.hash + '"]').length || 651 $( '.vamtam-animated-page-scroll [data-href*="'+window.location.hash+'"]' ).length || 652 $( '.mega-vamtam-animated-page-scroll[href*="' + window.location.hash + '"]' ).length || 653 $( '.mega-vamtam-animated-page-scroll [href*="' + window.location.hash + '"]').length || 654 $( '.mega-vamtam-animated-page-scroll [data-href*="'+window.location.hash+'"]' ).length 655 ) 656 ) { 657 var el = $( window.location.hash ); 658 659 if ( el.length > 0 ) { 660 $( window ).add( 'html, body, #page' ).scrollTop( 0 ); 661 } 662 663 setTimeout( function() { 664 scrollToEl( el ); 665 }, 400 ); 666 } 667 668 // adds .current-menu-item classes 669 670 var hashes = [ 671 // ['top', $('<div></div>'), $('#top')] 672 ]; 673 674 $('#main-menu').find('.mega-menu, .menu').find('.maybe-current-menu-item, .mega-current-menu-item, .current-menu-item').each(function() { 675 var link = $('> a', this); 676 677 if(link.prop('href').indexOf('#') > -1) { 678 var link_hash = link.prop('href').split('#')[1]; 679 680 if('#'+link_hash !== window.location.hash) { 681 $(this).removeClass('mega-current-menu-item current-menu-item'); 682 } 683 684 hashes.push([link_hash, $(this), $('#'+link_hash)]); 685 } 686 }); 687 688 if ( hashes.length ) { 689 var winHeight = 0; 690 var documentHeight = 0; 691 692 var prev_upmost_data = null; 693 694 v.addScrollHandler( { 695 init: function() {}, 696 add_current_menu_item: function( hash ) { 697 // there may be more than one links with the same hash, 698 // so we need to loop over all of the hashes 699 700 for ( var i = 0; i < hashes.length; i++ ) { 701 if ( hashes[i][0] === hash ) { 702 hashes[i][1][0].classList.add( 'mega-current-menu-item' ); 703 hashes[i][1][0].classList.add( 'current-menu-item' ); 704 } 705 } 706 }, 707 measure: function( cpos ) { 708 winHeight = window.innerHeight; 709 documentHeight = document.body.offsetHeight; 710 711 this.upmost = Infinity; 712 this.upmost_data = null; 713 714 for ( var i = 0; i < hashes.length; i++ ) { 715 var el = hashes[i][2]; 716 717 if ( el.length ) { 718 var top = el.offset().top + 10; 719 720 if ( 721 top > cpos && 722 top < this.upmost && 723 ( 724 top < cpos + winHeight / 2 || 725 ( top < cpos + winHeight && cpos + winHeight === documentHeight ) 726 ) 727 ) { 728 this.upmost_data = hashes[i]; 729 this.upmost = top; 730 } 731 } 732 } 733 }, 734 mutate: function( cpos ) { 735 for ( var i = 0; i < hashes.length; i++ ) { 736 if ( hashes[i][2].length ) { 737 hashes[i][1][0].classList.remove( 'mega-current-menu-item' ); 738 hashes[i][1][0].classList.remove( 'current-menu-item' ); 739 hashes[i][1][0].childNodes[0].blur(); 740 } 741 } 742 743 if ( this.upmost_data ) { 744 this.add_current_menu_item( this.upmost_data[0] ); 745 746 // attempt to push a state to the history if the current hash is different from the previous one 747 if ( 'history' in window && ( prev_upmost_data !== null ? prev_upmost_data[0] : '' ) !== this.upmost_data[0] ) { 748 window.history.pushState( 749 this.upmost_data[0], 750 $( '> a', this.upmost_data[1] ).text(), 751 ( cpos !== 0 ? '#' + this.upmost_data[0] : location.href.replace( location.hash, '' ) ) 752 ); 753 754 prev_upmost_data = $.extend({}, this.upmost_data); 755 } 756 } else if ( this.upmost_data === null && prev_upmost_data !== null ) { 757 this.add_current_menu_item( prev_upmost_data[0] ); 758 } 759 } 760 } ); 761 } 762})( jQuery, window.VAMTAM ); 763 764( function( v, undefined ) { 765 'use strict'; 766 767 // this one can be initialized late (on load) instead of on DOMContentLoaded 768 window.addEventListener( 'load', function() { 769 var columns = document.querySelectorAll( '[data-progressive-animation]' ); 770 771 if ( columns.length && ! document.body.classList.contains( 'fl-builder
771-active' ) && ! ( window.matchMedia('(prefers-reduced-motion: reduce)').matches ) ) { 772 vamtam_greensock_wait( function() { 773 v.addScrollHandler( { 774 defaultOptions: { 775 origin: 'center center', 776 type: 'progressive', 777 exit: true, 778 delay: 0, 779 mobile: false, 780 pin: false, 781 pinUnit: 'px', 782 pinTrigger: 'center', 783 }, 784 blockAnimations: false, 785 canActivate: function( mobile ) { 786 return mobile || ! v.MEDIA.layout[ 'layout-below-max' ]; 787 }, 788 buildTimeline: function( target, withExit ) { 789 var timeline = new vamtamgs.TimelineLite( { paused: true } ); 790 var type = target.getAttribute( 'data-progressive-animation' ); 791 792 if ( type === 'dummy' ) { 793 timeline.fromTo( target, 1, { opacity: 1 }, {opacity: 1 }, '0' ); 794 795 withExit && timeline.to( target, 1, { opacity: 1 }, '1' ); 796 797 } else if ( type === 'rotate' ) { 798 timeline.fromTo( target, 1, { rotation: -180 }, { rotation: 0 }, '0' ); 799 800 withExit && timeline.to( target, 1, { rotation: 180 }, '1' ); 801 802 } else if ( type === 'fade' ) { 803 timeline.fromTo( target, 1, { 804 opacity: 0, 805 }, { 806 opacity: 1, 807 }, '0' ); 808 809 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 810 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 811 812 // Move + Fade // 813 814 } else if ( type === 'move-from-top' ) { 815 timeline.fromTo( target, 1, { 816 y: -160, 817 opacity: 0, 818 }, { 819 y: 0, 820 opacity: 1, 821 }, '0' ); 822 823 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 824 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 825 826 } else if ( type === 'move-from-bottom' ) { 827 timeline.fromTo( target, 1, { 828 y: 100, 829 opacity: 0, 830 }, { 831 y: 0, 832 opacity: 1, 833 }, '0' ); 834 835 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 836 withExit && timeline.to( target, 1, { y: -50 }, '1.6' ); 837 838 839 } else if ( type === 'move-from-left' ) { 840 timeline.fromTo( target, 1, { 841 x: -160, 842 opacity: 0, 843 }, { 844 x: 0, 845 opacity: 1, 846 }, '0' ); 847 848 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 849 withExit && timeline.to( target, 1, { x: -100 }, '1.6' ); 850 851 852 } else if ( type === 'move-from-right' ) { 853 timeline.fromTo( target, 1, { 854 x: 160, 855 opacity: 0, 856 }, { 857 x: 0, 858 opacity: 1, 859 }, '0' ); 860 861 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 862 withExit && timeline.to( target, 1, { x: 100 }, '1.6' ); 863 864 // Scale // 865 866 } else if ( type === 'scale-in' ) { 867 timeline.fromTo( target, 1, { 868 opacity: 0, 869 scaleX: 0.0, 870 scaleY: 0.0, 871 }, { 872 opacity: 1, 873 scaleX: 1, 874 scaleY: 1, 875 }, '0' ); 876 877 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 878 879 } else if ( type === 'scale-out' ) { 880 timeline.fromTo( target, 1, { 881 opacity: 0, 882 scaleX: 2, 883 scaleY: 2, 884 }, { 885 opacity: 1, 886 scaleX: 1, 887 scaleY: 1, 888 }, '0' ); 889 890 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 891 892 893 // Move + Scale // 894 895 // Zoom In // 896 897 } else if ( type === 'move-scale-in-from-top' ) { 898 timeline.fromTo( target, 1, { 899 y: -160, 900 opacity: 0, 901 scaleX: 0.6, 902 scaleY: 0.6, 903 }, { 904 y: 0, 905 opacity: 1, 906 scaleX: 1, 907 scaleY: 1, 908 }, '0' ); 909 910 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 911 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 912 913 } else if ( type === 'move-scale-in-from-bottom' ) { 914 timeline.fromTo( target, 1, { 915 y: 160, 916 opacity: 0, 917 scaleX: 0.6, 918 scaleY: 0.6, 919 }, { 920 y: 0, 921 opacity: 1, 922 scaleX: 1, 923 scaleY: 1, 924 }, '0' ); 925 926 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 927 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 928 929 } else if ( type === 'move-scale-in-from-left' ) { 930 timeline.fromTo( target, 1, { 931 x: -160, 932 opacity: 0, 933 scaleX: 0.6, 934 scaleY: 0.6, 935 }, {
936 x: 0, 937 opacity: 1, 938 scaleX: 1, 939 scaleY: 1, 940 }, '0' ); 941 942 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 943 withExit && timeline.to( target, 1, { x: -100 }, '1.6' ); 944 945 } else if ( type === 'move-scale-in-from-right' ) { 946 timeline.fromTo( target, 1, { 947 x: 160, 948 opacity: 0, 949 scaleX: 0.6, 950 scaleY: 0.6, 951 }, { 952 x: 0, 953 opacity: 1, 954 scaleX: 1, 955 scaleY: 1, 956 }, '0' ); 957 958 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 959 withExit && timeline.to( target, 1, { x: 100 }, '1.6' ); 960 961 // Zoom Out // 962 963 } else if ( type === 'move-scale-out-from-top' ) { 964 timeline.fromTo( target, 1, { 965 y: -160, 966 opacity: 0, 967 scaleX: 1.6, 968 scaleY: 1.6, 969 }, { 970 y: 0, 971 opacity: 1, 972 scaleX: 1, 973 scaleY: 1, 974 }, '0' ); 975 976 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 977 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 978 979 } else if ( type === 'move-scale-out-from-bottom' ) { 980 timeline.fromTo( target, 1, { 981 y: 160, 982 opacity: 0, 983 scaleX: 1.6, 984 scaleY: 1.6, 985 }, { 986 y: 0, 987 opacity: 1, 988 scaleX: 1, 989 scaleY: 1, 990 }, '0' ); 991 992 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 993 withExit && timeline.to( target, 1, { y: -100 }, '1.6' ); 994 995 } else if ( type === 'move-scale-out-from-left' ) { 996 timeline.fromTo( target, 1, { 997 x: -160, 998 opacity: 0, 999 scaleX: 1.6, 1000 scaleY: 1.6, 1001 }, { 1002 x: 0, 1003 opacity: 1, 1004 scaleX: 1, 1005 scaleY: 1, 1006 }, '0' ); 1007 1008 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 1009 withExit && timeline.to( target, 1, { x: -100 }, '1.6' ); 1010 1011 } else if ( type === 'move-scale-out-from-right' ) { 1012 timeline.fromTo( target, 1, { 1013 x: 160, 1014 opacity: 0, 1015 scaleX: 1.6, 1016 scaleY: 1.6, 1017 }, { 1018 x: 0, 1019 opacity: 1, 1020 scaleX: 1, 1021 scaleY: 1, 1022 }, '0' ); 1023 1024 withExit && timeline.to( target, 0.4, { opacity: 0 }, '1.6' ); 1025 withExit && timeline.to( target, 1, { x: 100 }, '1.6' ); 1026 1027 // Rotate // 1028 1029 } else if ( type === 'rotate-from-top-right' ) { 1030 timeline.fromTo( target, 1, { 1031 y: -200, 1032 x: 120, 1033 rotation: -10, 1034 opacity: 0, 1035 }, { 1036 y: 0, 1037 x: 0, 1038 rotation: 0, 1039 opacity: 1, 1040 }, '0' ); 1041 1042 withExit && timeline.fromTo( target, 1, { immediateRender: false, y: 0 }, { y: -70 }, '1.6' ); 1043 1044 } else if ( type === 'expand-scroll' ) { 1045 var contentWrap = target.querySelector( '.fl-row-content-wrap' ); 1046 1047 var scrollableContent = target.querySelector( '.vamtam-expand-scroll-content' ); 1048 1049 var totalWidth = target.vamtamProgressiveTimeline.options.pin; 1050 1051 scrollableContent.style.width = totalWidth + 'px'; 1052 scrollableContent.style.boxSizing = 'content-box'; 1053 1054 // this always has an exit animation 1055 timeline.fromTo( scrollableContent, 2, { 1056 x: 0, 1057 }, { 1058 x: - ( totalWidth - this.winWidth + parseInt( getComputedStyle( contentWrap ).paddingLeft, 10 ) * 2 ) + 'px', 1059 }, 0 ); 1060 1061 // Rotate // 1062 1063 } else if ( type === 'page-title' ) { 1064 var line = target.querySelector( '.page-header-line' ); 1065 var desc = target.querySelector( '.desc' ); 1066 var shadow = document.getElementById( 'sub-header' ).querySelector( '.text-shadow' ); 1067 1068 timeline.fromTo( target.querySelector( 'h1' ), 0.9, { y: 0, opacity: 1 }, { y: -10, opacity: 0, ease: vamtamgs.Quad.easeIn }, '0.1' ); 1069 1070 desc && timeline.fromTo( desc, 1, { y: 0, opacity: 1 }, { y: 30, opacity: 0, ease: vamtamgs.Quad.easeIn }, '0' ); 1071 1072 shadow && timeline.to( shadow, 1, { className: 'text-shadow shadow-darkened', ease: vamtamgs.Quad.easeIn }, '0' ); 1073 1074 line && timeline.to( line, 1, { scaleX: 0, y: 30, opacity: 0, ease: vamtamgs.Quad.easeIn }, '0' ); 1075 } else if ( type === 'custom' ) { 1076 timeline.to( target, 1, { className: target.getAttribute( 'data-
1076progressive-animation-custom' ) }, '1' ); 1077 } 1078 1079 1080 return timeline; 1081 }, 1082 getPinTrigger: function( column ) { 1083 if ( column.options.pinTrigger === 'center' ) { 1084 return this.winHeight / 2 - column.height / 2; 1085 } 1086 1087 if ( column.options.pinTrigger === 'bottom' ) { 1088 return this.winHeight - column.height; 1089 } 1090 1091 if ( column.options.pinTrigger === 'top' ) { 1092 return 0; 1093 } 1094 }, 1095 calculatePinDuration: function( column ) { 1096 if ( column.vamtamProgressiveTimeline.options.pin === 'parent' ) { 1097 if ( v.MEDIA.layout[ 'layout-below-max' ] ) { 1098 column.vamtamProgressiveTimeline.pinDuration = 0; 1099 } else { 1100 var closestRow = column.closest( '.fl-row-content' ); 1101 column.vamtamProgressiveTimeline.pinDuration = closestRow.offsetHeight - ( column.vamtamProgressiveTimeline.top - v.offset( closestRow ).top ); 1102 } 1103 } else { 1104 if ( 'pinUnit' in column.vamtamProgressiveTimeline.options && column.vamtamProgressiveTimeline.options.pinUnit === 'vw' ) { 1105 column.vamtamProgressiveTimeline.pinDuration = ( + column.vamtamProgressiveTimeline.options.pin ) / 100 * this.winWidth; 1106 } else { 1107 column.vamtamProgressiveTimeline.pinDuration = + column.vamtamProgressiveTimeline.options.pin; 1108 } 1109 } 1110 }, 1111 onresize: function() { 1112 var self = this; 1113 1114 if (this.winWidth === window.innerWidth) { 1115 return; 1116 } 1117 1118 this.winWidth = window.innerWidth; 1119 1120 this.winHeight = window.innerHeight; 1121 this.blockAnimations = true; 1122 1123 requestAnimationFrame( function() { 1124 // if the timeline was previously initialized - reset the progress to 0 1125 for ( var i = 0; i < columns.length; i++ ) { 1126 if ( columns[i].vamtamProgressiveTimeline.timeline ) { 1127 columns[i].vamtamProgressiveTimeline.timeline.progress( 0 ); 1128 } 1129 1130 if ( columns[i].vamtamProgressiveTimeline.wrapper ) { 1131 Object.assign( columns[i].vamtamProgressiveTimeline.pusher.style, { 1132 top: '', 1133 width: '', 1134 height: '', 1135 } ); 1136 1137 Object.assign( columns[i].vamtamProgressiveTimeline.wrapper.style, { 1138 top: '', 1139 width: '', 1140 height: '', 1141 position: '', 1142 } ); 1143 } 1144 } 1145 1146 requestAnimationFrame( function() { 1147 var cpos = window.pageYOffset; 1148 var i; 1149 var chromeWrapperFix = []; 1150 1151 // measure 1152 for ( i = 0; i < columns.length; i++ ) { 1153 var columnTop = v.offset( columns[i] ).top; 1154 1155 Object.assign( columns[i].vamtamProgressiveTimeline, { 1156 top: columnTop, 1157 height: columns[i].offsetHeight, 1158 width: columns[i].offsetWidth, 1159 } ); 1160 1161 self.calculatePinDuration( columns[i] ); 1162 } 1163 1164 // mutate 1165 for ( i = 0; i < columns.length; i++ ) { 1166 var data = columns[i].vamtamProgressiveTimeline; 1167 1168 if ( self.canActivate( data.options.mobile ) ) { 1169 data.timeline = self.buildTimeline( 1170 columns[i], 1171 data.options.type === 'progressive' && data.options.exit 1172 ); 1173 1174 if ( data.pusher ) { 1175 data.pusher.parentElement.minHeight = data.options.pin + 'px'; 1176 data.pusher.style.height = data.pinDuration + 'px'; 1177 1178 if ( ! data.pusher.classList.contains( 'fl-col' ) ) { 1179 data.pusher.style.width = data.width + 'px'; 1180 } 1181 1182 data.wrapper.style.height = data.height + 'px'; 1183 data.wrapper.style.top = self.getPinTrigger( data ) + 'px'; 1184 1185 data.wrapper.classList.add( 'vamtam-pin-active' ); 1186 } 1187 } else if ( data.timeline ) { 1188 if ( data.options.type === 'progressive' ) { 1189 if ( data.timeline.totalDuration() > 1 || ! data.options.exit ) { 1190 data.timeline.seek( 1 ); 1191 } else { 1192 data.timeline.seek( 0 ); 1193 } 1194 } else { 1195 data.timeline.seek( 1 ); 1196 } 1197 1198 data.timeline = null; 1199 1200 if ( data.pusher ) { 1201 data.pusher.parentElement.minHeight = ''; 1202 data.wrapper.classList.remove( 'vamtam-pin-active' ); 1203 1204 /* 1205 Fix a weird Chrome bug where the wrapper 1206 behaves as if it has visibility: hidden 1207 after disabling the pin for narrow screens 1208 */ 1209 data.wrapper.style.display = 'block'; 1210 chromeWrapperFix.push( data.wrapper ); 1211 /* End Chrome fix */ 1212 } 1213 } 1214 } 1215 1216 (function( wrappers ) { 1217 requestAnimationFrame( function() {
1218 wrappers.forEach( function( wrapper ) { 1219 wrapper.style.display = ''; 1220 } ); 1221 } ); 1222 })( chromeWrapperFix ); 1223 1224 self.blockAnimations = false; 1225 self.measure( cpos ); 1226 self.mutate( cpos ); 1227 } ); 1228 } ); 1229 }, 1230 init: function() { 1231 this.winHeight = window.innerHeight; 1232 this.winWidth = window.innerWidth; 1233 1234 var i, closestRow; 1235 1236 // measure 1237 for ( i = 0; i < columns.length; i++ ) { 1238 var options = Object.assign( {}, this.defaultOptions, JSON.parse( columns[i].getAttribute( 'data-vamtam-animation-options' ) ) || {} ); 1239 1240 var columnTop = v.offset( columns[i] ).top; 1241 var rect = columns[i].getBoundingClientRect(); 1242 1243 columns[i].vamtamProgressiveTimeline = { 1244 top: columnTop, 1245 height: Math.floor(rect.height), 1246 width: Math.floor(rect.width), 1247 options: options 1248 }; 1249 1250 this.calculatePinDuration( columns[i] ); 1251 1252 columns[i].style.transformOrigin = columns[i].vamtamProgressiveTimeline.options.origin; 1253 1254 if ( this.canActivate( options.mobile ) ) { 1255 columns[i].vamtamProgressiveTimeline.timeline = this.buildTimeline( 1256 columns[i], 1257 options.type === 'progressive' && options.exit 1258 ); 1259 } else { 1260 columns[i].vamtamProgressiveTimeline.timeline = null; 1261 } 1262 } 1263 1264 // mutate 1265 for ( i = 0; i < columns.length; i++ ) { 1266 var data = columns[i].vamtamProgressiveTimeline; 1267 1268 closestRow = columns[i].closest( '.fl-row' ); 1269 1270 closestRow && closestRow.classList.add( 'vamtam-animation-inside' ); 1271 1272 if ( data.options.pin !== false ) { 1273 closestRow.classList.add( 'vamtam-pin-inside' ); 1274 1275 data.pusher = document.createElement( 'div' ); 1276 data.pusher.classList.add( 'vamtam-pin-pusher' ); 1277 1278 // by default Beaver Builder sets the width of the .fl-col element 1279 // we need to move the .fl-col class to the wrapper 1280 // and set the width of the original column to 100% 1281 if ( columns[i].classList.contains( 'fl-col' ) ) { 1282 data.pusher.classList.add( 'fl-col' ); 1283 data.pusher.classList.add( 'fl-node-' + columns[i].attributes['data-node'].value ); 1284 data.pusher.style.width = ''; 1285 } 1286 1287 data.wrapper = document.createElement( 'div' ); 1288 data.wrapper.classList.add( 'vamtam-pin-wrapper' ); 1289 data.wrapper.style.willChange = 'transform, position'; 1290 1291 data.wrapper.style.height = data.height + 'px'; 1292 data.wrapper.style.top = this.getPinTrigger( data ) + 'px'; 1293 1294 columns[i].before( data.pusher ); 1295 data.wrapper.appendChild( columns[i] ); 1296 data.pusher.appendChild( data.wrapper ); 1297 1298 columns[i].style.width = '100%'; 1299 1300 data.pusher.parentElement.style.position = 'relative'; 1301 1302 if ( data.timeline && data.options.pin !== 'parent' ) { 1303 data.pusher.parentElement.style.minHeight = data.options.pin + 'px'; 1304 } 1305 1306 if ( this.canActivate( data.options.mobile ) ) { 1307 Object.assign( data.pusher.style, { 1308 width: data.width + 'px', 1309 height: data.pinDuration + 'px', 1310 }); 1311 1312 data.wrapper.classList.add( 'vamtam-pin-active' ); 1313 } 1314 } 1315 } 1316 1317 window.addEventListener( 'resize', window.VAMTAM.debounce( this.onresize, 100 ).bind( this ), false ); 1318 }, 1319 measure: function() { 1320 1321 }, 1322 mutate: function( cpos ) { 1323 if ( this.blockAnimations ) { 1324 return; 1325 } 1326 1327 for ( var i = 0; i < columns.length; i++ ) { 1328 var data = columns[i].vamtamProgressiveTimeline; 1329 1330 if ( data.timeline && cpos + this.winHeight > data.top ) { 1331 // natural column vertical middle 1332 var from = data.top + data.height / 2; 1333 1334 var progress; 1335 1336 if ( data.options.pin !== false ) { 1337 var pinTrigger; 1338 1339 if ( data.options.pinTrigger === 'center' ) { 1340 pinTrigger = cpos + this.winHeight / 2; 1341 } else if ( data.options.pinTrigger === 'bottom' ) { 1342 pinTrigger = cpos + this.winHeight - data.height / 2; 1343 } else if ( data.options.pinTrigger === 'top' ) { 1344 pinTrigger = cpos + data.height / 2; 1345 } 1346 1347 // pin length starts when the "natural column vertical middle" 1348 // aligns with the trigger (middle of the viewport, top/bottom of viewport - half column height) 1349 // 1350 // it ends after data.pinDuration - data.height px 1351 1352 var pinTo = from + data.pinDuration - data.height; 1353 1354 progress = 2 * ( pinTrigger - from ) / ( pinTo - from ) - 1; 1355 } else { 1356 progress = 1 - ( ( from - cpos ) / Math.min( this.winHeight / 2, from ) ); 1357 } 1358 1359 progress -= data.options.delay; 1360 1361 if ( data.options.type === 'progressive' ) { 1362 if ( data.timeline.totalDuration() > 1 || ! columns[i].vamtamProgressiveTimeline.options.exit ) { 1363 // two part (entry/exit) animation 1364 // note that the exit is optional 1365 progress = Math.min( 1, Math.max( -1, progress ) ); // clip 1366 1367 // progress + 1 is used so that we can avoid negative position params 1368 // 1369 // [0; 1] -> entrance animation 1370 // [1; 2] -> exit animation 1371 // 1372 // it's then divided by two, since the progress() method takes a [0; 1] fraction as its argument 1373 progress = progress + 1; 1374 } else { 1375 // only exit animation 1376 progress = Math.min( 1, Math.max( 0, progress ) ); // clip 1377 } 1378 1379 data.timeline.seek( progress ); 1380 } else { 1381 if ( ! data.used && progress >= 0 ) { 1382 data.used = true; 1383 data.timeline.timeScale( 2 ).play(); 1384 } else if ( data.used && ! data.timeline.isActive() && data.timeline.progress() < 1 ) { 1385 // if the animation was played once - make sure that the timeline is at its end 1386 data.timeline.seek( 1 ); 1387 } 1388 } 1389 } 1390 } 1391 } 1392 } ); 1393 } ); 1394 } 1395 }, { passive: true }); 1396 1397} )( window.VAMTAM ); 1398 1399( function( v, undefined ) { 1400 'use strict'; 1401 1402 var initialized = false;
1403 1404 v.parallaxBackground = { 1405 /** 1406 * Loop through all rows with a parallax background, 1407 * load the image asynchronously, 1408 * and create the necessary elements 1409 * 1410 * Also bind resize/load events here 1411 */ 1412 init: function() { 1413 this.rows = document.querySelectorAll( '.fl-row-bg-parallax' ); 1414 1415 for ( var i = 0; i < this.rows.length; i++ ) { 1416 var row = this.rows[ i ]; 1417 var src = row.getAttribute( 'data-parallax-image' ); 1418 1419 if ( ! row.vamtamParallaxLoaded && src ) { 1420 var img = new Image(); 1421 1422 img.addEventListener( 'load', this.loadImageCallback ); 1423 1424 img.row = row; 1425 img.src = src; 1426 } 1427 } 1428 1429 window.addEventListener( 'resize', window.VAMTAM.debounce( this.onresize, 100 ).bind( this ), false ); 1430 window.addEventListener( 'load', window.VAMTAM.debounce( this.onresize, 100 ).bind( this ), false ); 1431 this.onresize(); 1432 }, 1433 1434 /** 1435 * Fired when the background image is loaded, 1436 * this creates the element holding the background 1437 */ 1438 loadImageCallback: function( e ) { 1439 var row = e.target.row; 1440 var contentWrap = row.firstElementChild; 1441 1442 var imageHolder = document.createElement( 'div' ); 1443 1444 imageHolder.classList.add( 'vamtam-parallax-bg' ); 1445 1446 Object.assign( imageHolder.style, { 1447 backgroundImage: 'url(' + e.target.src + ')', 1448 backgroundSize: row.dataset.backgroundSize, 1449 backgroundRepeat: 'no-repeat', 1450 backgroundPosition: row.dataset.backgroundPosition, 1451 position: 'absolute', 1452 top: '-300px', 1453 right: 0, 1454 bottom: '-300px', 1455 left: 0, 1456 'will-change': 'transform', 1457 } ); 1458 1459 requestAnimationFrame( function() { 1460 row.vamtamParallaxLoaded = true; 1461 1462 var content = contentWrap.querySelector( '.fl-node-content' ); 1463 1464 content.before( imageHolder ); 1465 1466 contentWrap.style.overflow = 'hidden'; 1467 contentWrap.style.backgroundImage = 'none'; 1468 1469 content.style.zIndex = 1; 1470 content.style.position = 'relative'; 1471 } ); 1472 }, 1473 1474 /** 1475 * Measure and store the offset for each row 1476 * This only needs to happen on resize/page load 1477 */ 1478 onresize: function() { 1479 requestAnimationFrame( function() { 1480 var cpos = window.pageYOffset; 1481 1482 for ( var i = 0; i < this.rows.length; i++ ) { 1483 this.rows[ i ].vamtamParallaxOffset = v.offset( this.rows[ i ].firstElementChild ); 1484 } 1485 1486 this.measure( cpos ); 1487 this.mutate( cpos ); 1488 }.bind( this ) ); 1489 }, 1490 1491 measure: function() { 1492 }, 1493 1494 /** 1495 * Reposition the background elements. 1496 */ 1497 mutate: function( cpos ) { 1498 for ( var i = 0; i < this.rows.length; i++ ) { 1499 if ( this.rows[ i ].vamtamParallaxLoaded ) { 1500 var speed = this.rows[ i ].getAttribute( 'data-parallax-speed' ); 1501 var pos = - ( ( cpos - this.rows[ i ].vamtamParallaxOffset.top ) / speed ); 1502 1503 this.rows[ i ].firstElementChild.firstElementChild.style.transform = 'translateY(' + pos + 'px)'; 1504 } 1505 } 1506 }, 1507 }; 1508 1509 window.FLBuilderLayout && Object.assign( window.FLBuilderLayout, { 1510 /** 1511 * Monkey patches the built-in parallax with a better implementation 1512 */ 1513 _initParallaxBackgrounds: function() { 1514 if ( ! initialized ) { 1515 initialized = true; 1516 1517 // parallax should only be enabled if Beaver Builder is not active, 1518 // that is, only on pages which are not currently being edited 1519 if ( ! document.body.classList.contains( 'fl-builder-active' ) && ! ( window.matchMedia('(prefers-reduced-motion: reduce)').matches ) ) { 1520 v.addScrollHandler( v.parallaxBackground ); 1521 } else { 1522 var rows = document.querySelectorAll( '.fl-row-bg-parallax[data-parallax-image]' ); 1523 1524 for ( var i = 0; i < rows.length; i++ ) { 1525 var row = rows[ i ]; 1526 var src = row.getAttribute( 'data-parallax-image' ); 1527 1528 Object.assign( row.style, { 1529 backgroundImage: 'url(' + src + ')', 1530 backgroundSize: 'cover', 1531 backgroundRepeat: 'repeat', 1532 } ); 1533 } 1534 } 1535 } 1536 }, 1537 1538 _scrollParallaxBackgrounds: function() { 1539 // should only be called once after we remove the event listener 1540 jQuery( window ).off( 'scroll.fl-bg-parallax' ); 1541 }, 1542 } ); 1543 1544 var previewCallback = function() { 1545 initialized = false; 1546
1547 window.FLBuilderLayout._initParallaxBackgrounds(); 1548 }; 1549 1550 window.FLBuilderLayout && document.addEventListener( 'DOMContentLoaded', function() { 1551 if ( document.body.classList.contains( 'fl-builder-active' ) ) { 1552 FLBuilder.addHook( 'didCompleteAJAX', previewCallback ); 1553 FLBuilder.addHook( 'didRenderLayoutComplete', previewCallback ); 1554 1555 jQuery( FLBuilder._contentClass ).on( 'fl-builder.preview-rendered', previewCallback ); 1556 } 1557 1558 // force initialization of Beaver has disabled the parallax 1559 window.FLBuilderLayout._initParallaxBackgrounds(); 1560 } ); 1561 1562} )( window.VAMTAM ); 1563 1564/* jshint multistr:true */ 1565(function( $, undefined ) { 1566 "use strict"; 1567 1568 window.VAMTAM = window.VAMTAM || {}; // Namespace 1569 1570 $(function () { 1571 window.VAMTAM.admin_bar_fix = document.body.classList.contains( 'admin-bar' ) ? 32 : 0; 1572 1573 if ( /iPad|iPhone|iPod/.test( navigator.userAgent ) && ! window.MSStream) { 1574 requestAnimationFrame( function() { 1575 document.documentElement.classList.add( 'ios-safari' ); 1576 } ); 1577 } 1578 1579 // trigger resize after publishing a layout in order to deal with the disappearance of Beaver's UI 1580 if ( 'FLBuilder' in window ) { 1581 FLBuilder.addHook( 'didPublishLayout', function() { 1582 window.dispatchEvent( new Event( 'resize' ) ); 1583 } ); 1584 } 1585 1586 // prevent hover when scrolling 1587 (function() { 1588 var wrapper = document.getElementById( 'page' ), 1589 timer; 1590 1591 window.addEventListener( 'scroll', function() { 1592 clearTimeout(timer); 1593 1594 requestAnimationFrame( function() { 1595 wrapper.style.pointerEvents = 'none'; 1596 1597 timer = setTimeout( function() { 1598 wrapper.style.pointerEvents = ''; 1599 }, 300 ); 1600 } ); 1601 }, { passive: true } ); 1602 })(); 1603 1604 1605 // Code which depends on the window width 1606 // ===================================================================== 1607 1608 window.VAMTAM.resizeElements = function() { 1609 // video size 1610 $('.portfolio-image-wrapper,\ 1611 #page .media-inner,\ 1612 #page .loop-wrapper.news .thumbnail,\ 1613 #page .portfolio-image .thumbnail,\ 1614 .wp-block-embed-vimeo:not(.wp-has-aspect-ratio),\ 1615 :not(.wp-block-embed__wrapper) > .vamtam-video-frame').find('iframe, object, embed, video').each(function() { 1616 1617 setTimeout( function() { 1618 requestAnimationFrame( function() { 1619 var v_width = this.offsetWidth; 1620 1621 this.style.width = '100%'; 1622 1623 if ( this.width === '0' && this.height === '0' ) { 1624 this.style.height = ( v_width * 9/16 ) + 'px'; 1625 } else { 1626 this.style.height = ( this.height * v_width / this.width ) + 'px'; 1627 } 1628 1629 $( this ).trigger('vamtam-video-resized'); 1630 }.bind( this ) ); 1631 }.bind( this ), 50 ); 1632 }); 1633 1634 setTimeout( function() { 1635 requestAnimationFrame( function() { 1636 $('.mejs-time-rail').css('width', '-=1px'); 1637 } ); 1638 }, 100 ); 1639 }; 1640 1641 window.addEventListener( 'resize', window.VAMTAM.debounce( window.VAMTAM.resizeElements, 100 ), false ); 1642 window.VAMTAM.resizeElements(); 1643 } ); 1644 1645 // Low priority scripts are loaded later 1646 document.addEventListener('DOMContentLoaded', function () { 1647 window.VAMTAM.load_script( VAMTAM_FRONT.jspath + 'build/low-priority.min.js' ); 1648 1649 if ( ! ( window.CSS && window.CSS.supports && window.CSS.supports( '(--foo: red)' ) ) ) { 1650 window.VAMTAM.load_script( VAMTAM_FRONT.jspath + 'plugins/thirdparty/css-variables-polyfill.js' ); 1651 window.VAMTAM.load_style( VAMTAM_FRONT.jspath + '../css/dist/ie11.css', 'all' ); 1652 } 1653 }, { passive: true } ); 1654 1655})(jQuery); 1656(function(v, undefined) { 1657 'use strict'; 1658 1659 // lazy loading 1660 var observer; 1661 1662 if ( 'IntersectionObserver' in window ) { 1663 observer = new IntersectionObserver( function( changes ) {
1664 changes.forEach( function( change ) { 1665 if ( change.intersectionRatio > 0 || change.isIntersecting ) { 1666 showImage( change.target ); 1667 observer.unobserve(change.target); 1668 } 1669 }); 1670 }, { 1671 rootMargin: '200px', 1672 }); 1673 } 1674 1675 function onImageLoad() { 1676 /* jshint validthis: true */ 1677 this.removeEventListener( 'load', onImageLoad ); 1678 1679 requestAnimationFrame( function() { 1680 if ( ! ( this.classList.contains( 'vamtam-lazyload-noparent' ) ) && this.parentElement ) { 1681 this.parentElement.classList.add( 'image-loaded' ); 1682 } else { 1683 this.classList.add( 'image-loaded' ); 1684 } 1685 }.bind( this ) ); 1686 } 1687 1688 function showImage( image ) { 1689 var srcset = image.dataset.srcset; 1690 1691 if ( srcset ) { 1692 requestAnimationFrame( function() { 1693 image.addEventListener( 'load', onImageLoad ); 1694 image.srcset = srcset; 1695 } ); 1696 1697 delete image.dataset.srcset; 1698 } else { 1699 onImageLoad.call( image ); 1700 } 1701 } 1702 1703 // Either observe the images, or load immediately if IntersectionObserver doesn't exist 1704 function addElements() { 1705 let i; 1706 1707 let backgrounds = document.querySelectorAll( '.fl-row-content-wrap:not(.vamtam-show-bg-image), .fl-col-content:not(.vamtam-show-bg-image)' ); 1708 for ( i = 0; i < backgrounds.length; i++ ) { 1709 backgrounds[i].classList.add( 'vamtam-show-bg-image' ); 1710 } 1711 } 1712 1713 document.addEventListener('DOMContentLoaded', function() { 1714 var mutationObserver = new MutationObserver( addElements ); 1715 1716 mutationObserver.observe( document.body, { 1717 childList: true, 1718 subtree: true 1719 } ); 1720 1721 addElements(); 1722 }); 1723})( window.VAMTAM ); 1724 1725( function( $, v, undefined ) { 1726 'use strict'; 1727 1728 1729 $(function() { 1730 var cube_found = 'cubeportfolio' in $.fn; 1731 var cube_loading = false; 1732 1733 var win = $(window); 1734 1735 var cube_narrow = function( el ) { 1736 requestAnimationFrame( function() { 1737 var inner = el.find( '.cbp-wrapper' ); 1738 var outer = el.find( '.cbp-wrapper-outer' ); 1739 1740 if ( inner.width() <= outer.width() ) { 1741 el.addClass( 'vamtam-cube-narrow' ); 1742 } else { 1743 el.removeClass( 'vamtam-cube-narrow' ); 1744 } 1745 } ); 1746 }; 1747 1748 var attempt_cube_load_callback = function() { 1749 $( '.vamtam-cubeportfolio[data-options]:not(.vamtam-cube-loaded)' ).filter( ':visible' ).each( function() { 1750 var self = $( this ); 1751 var options = self.data( 'options' ); 1752 1753 if ( ! ( 'singlePageCallback' in options ) ) { 1754 options.singlePageDelegate = null; 1755 } 1756 1757 options.singlePageCallback = cube_single_page[ options.singlePageCallback ] || null; 1758 1759 self.on( 'initComplete.cbp', function() { 1760 if ( 'slider' === options.layoutMode ) { 1761 cube_narrow( self ); 1762 1763 win.on( 'resize.vamtamcube', function() { 1764 cube_narrow( self ); 1765 } ); 1766 } 1767 } ); 1768 1769 self.addClass( 'vamtam-cube-loaded' ).cubeportfolio( options ); 1770 1771 self.on( 'vamtam-video-resized', 'iframe, object, embed, video', function() { 1772 self.data('cubeportfolio').layoutAndAdjustment(); 1773 } ); 1774 1775 this.addEventListener( 'vamtamlazyloaded', function() { 1776 self.data('cubeportfolio').layoutAndAdjustment(); 1777 } ); 1778 } ); 1779 }; 1780 1781 // if there are cube instances, check that the script is loaded 1782 // otherwise - load it and prevent further calls to attempt_cube_load 1783 // until cube is available 1784 var attempt_cube_load = function() { 1785 if ( document.getElementsByClassName( 'vamtam-cubeportfolio' ).length ) { 1786 if ( cube_found ) { 1787 attempt_cube_load_callback(); 1788 } else if ( ! cube_loading ) { 1789 cube_loading = true; 1790 1791 // load css and js in parallel, init cube when both have finished loading 1792 1793 var loaded_assets = 0; 1794 1795 var check_loaded = function() { 1796 if ( ++loaded_assets === 2 ) { 1797 cube_found = 'cubeportfolio' in $.fn; 1798 1799 attempt_cube_load_callback(); 1800 } 1801 }; 1802 1803 v.load_style( VAMTAM_FRONT.cube_path + 'css/cubeportfolio.min.css?ver=' + VAMTAM_FRONT.cube_version, 'all', check_loaded, document.getElementById( 'vamtam-front-all-css' ) ); 1804 v.load_script( VAMTAM_FRONT.cube_path + 'js/jquery.cubeportfolio.min.js?ver=' + VAMTAM_FRONT.cube_version, check_loaded ); 1805 } 1806 } 1807 }; 1808 1809 var cube_single_page = { 1810 portfolio: function( url ) { 1811 var t = this; 1812 1813 $.ajax({ 1814 url: url, 1815 type: 'GET', 1816 dataType: 'html' 1817 }) 1818 .done(function(result) { 1819 t.updateSinglePage(result); 1820 1821 attempt_cube_load(); 1822 1823 $( document ).trigger( 'vamtam-single-page-project-loaded' ); 1824 }) 1825 .fail(function() { 1826 t.updateSinglePage('AJAX Error! Please refresh the page!'); 1827 }); 1828 } 1829 }; 1830 1831 $( document ).on( 'vamtam-attempt-cube-load', attempt_cube_load ); 1832 attempt_cube_load(); 1833 1834 window.addEventListener( 'resize', window.VAMTAM.debounce( attempt_cube_load, 100 ), false ); 1835 1836 const resizeAll = function() { 1837 $( '.cbp' ).each( function() { 1838 try { 1839 $(this).data( 'cubeportfolio' ).layoutAndAdjustment(); 1840 } catch ( e ) {} 1841 } ); 1842 }; 1843 1844 window.addEventListener( 'load', function() { 1845 resizeAll(); 1846 setTimeout( resizeAll, 200 ); 1847 setTimeout( resizeAll, 500 ); 1848 setTimeout( resizeAll, 1000 ); 1849 }, false ); 1850 1851 resizeAll(); 1852 }); 1853 1854 function attemptCubeLoad() { 1855 $( document ).trigger( 'vamtam-attempt-cube-load' ); 1856 } 1857 1858 document.addEventListener( 'DOMContentLoaded', function() { 1859 if ( window.FLBuilder ) { 1860 FLBuilder.addHook( 'didCompleteAJAX', attemptCubeLoad ); 1861 FLBuilder.addHook( 'didRenderLayoutComplete', attemptCubeLoad ); 1862 } 1863 attemptCubeLoad(); 1864 } ); 1865} )( jQuery, window.VAMTAM ); 1866 1867( function( $, undefined ) { 1868 'use strict'; 1869 1870 window.Cookies = window.Cookies || { 1871 get: function( name ) { 1872 var value = '; ' + document.cookie; 1873 var parts = value.split( '; ' + name + '=' ); 1874 1875 if ( parts.length === 2 ) { 1876 return parts.pop().split( ';' ).shift(); 1877 } 1878 } 1879 }; 1880 1881 $( function() { 1882 var dropdown = $( '.fixed-header-box .cart-dropdown' ), 1883 wrapper = $( '.vamtam-header-cart-wrapper' ), 1884 link = $( '.vamtam-cart-dropdown-link' ), 1885 count = $( '.products', link ), 1886 widget = $( '.widget', dropdown ), 1887 isVisible = false;
1888 1889 var dropdownEnabled = false; 1890 1891 if ( 'wc_cart_fragments_params' in window ) { 1892 // this is the shimmed version 1893 if ( 'jspath' in window.wc_cart_fragments_params ) { 1894 window.VAMTAM.load_script( window.wc_cart_fragments_params.jspath ); 1895 1896 window.addEventListener( 'load', function() { 1897 window.VAMTAM.load_style( window.wc_cart_fragments_params.csspath, 'all', function() { 1898 dropdownEnabled = true; 1899 } ); 1900 } ); 1901 } else { 1902 dropdownEnabled = true; 1903 } 1904 } 1905 1906 $( document.body ).on( 'added_to_cart removed_from_cart wc_fragments_refreshed wc_fragments_loaded', function() { 1907 var count_val = parseInt( Cookies.get( 'woocommerce_items_in_cart' ) || 0, 10 ); 1908 1909 if ( count_val > 0 ) { 1910 var count_real = 0; 1911 1912 var spans = document.querySelector( '.widget_shopping_cart' ).querySelectorAll( 'li .quantity' ); 1913 1914 for ( var i = 0; i < spans.length; i++ ) { 1915 count_real += parseInt( spans[i].innerHTML.split( '<span' )[0].replace( /[^\d]/g, '' ), 10 ); 1916 } 1917 1918 // sanitize count_real - if it's not a number, then don't show the counter at all 1919 count_real = count_real >= 0 ? count_real : ''; 1920 1921 count.text( count_real ); 1922 count.removeClass( 'cart-empty' ); 1923 wrapper.removeClass( 'hidden' ); 1924 } else { 1925 var show_if_empty = dropdown.hasClass( 'show-if-empty' ); 1926 1927 count.addClass( 'cart-empty' ); 1928 count.text( '0' ); 1929 1930 wrapper.toggleClass( 'hidden', ! show_if_empty ); 1931 } 1932 } ); 1933 1934 var open = 0; 1935 1936 var showCart = function() { 1937 if ( ! dropdownEnabled ) { 1938 return; 1939 } 1940 1941 open = +new Date(); 1942 dropdown.addClass( 'state-hover' ); 1943 widget.stop( true, true ).fadeIn( 300, function() { 1944 isVisible = true; 1945 } ); 1946 }; 1947 1948 var hideCart = function() { 1949 var elapsed = new Date() - open; 1950 1951 if( elapsed > 1000 ) { 1952 dropdown.removeClass( 'state-hover' ); 1953 widget.stop( true, true ).fadeOut( 300, function() { 1954 isVisible = false; 1955 } ); 1956 } else { 1957 setTimeout( function() { 1958 if( !dropdown.is( ':hover' ) ) { 1959 hideCart(); 1960 } 1961 }, 1000 - elapsed ); 1962 } 1963 }; 1964 1965 dropdown.on( 'mouseenter', function() { 1966 showCart(); 1967 } ).on( 'mouseleave', function() { 1968 hideCart(); 1969 } ); 1970 1971 link.on( 'click', function( e ) { 1972 if ( ! link.hasClass( 'no-dropdown' ) && dropdownEnabled ) { 1973 if( isVisible ) { 1974 hideCart(); 1975 } else { 1976 showCart(); 1977 } 1978 1979 e.preventDefault(); 1980 } 1981 } ); 1982 } ); 1983} )( 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.