1/* ---------------------------------------------------------- 2 * Uncode App 3 * ---------------------------------------------------------- */ 4 5(function($) { 6 "use strict"; 7 var UNCODE = window.UNCODE || {}; 8 window.UNCODE = UNCODE; 9 10 window.requestAnimFrame = (function() { 11 return window.requestAnimationFrame || 12 window.webkitRequestAnimationFrame || 13 window.mozRequestAnimationFrame || 14 window.oRequestAnimationFrame || 15 window.msRequestAnimationFrame || 16 function(/* function */ callback, /* DOMElement */ element){ 17 window.setTimeout(callback, 1000 / 60); 18 }; 19})(); 20 21window.requestTimeout = function(fn, delay) { 22 if( !window.requestAnimationFrame && 23 !window.webkitRequestAnimationFrame && 24 !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support 25 !window.oRequestAnimationFrame && 26 !window.msRequestAnimationFrame) 27 return window.setTimeout(fn, delay); 28 29 var start = new Date().getTime(), 30 handle = new Object(); 31 32 function loop(){ 33 var current = new Date().getTime(), 34 delta = current - start; 35 36 delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop); 37 }; 38 39 handle.value = requestAnimFrame(loop); 40 return handle; 41}; 42 43window.clearRequestTimeout = function(handle) { 44 if ( typeof handle !== 'undefined' ) { 45 window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : 46 window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) : 47 window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */ 48 window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : 49 window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : 50 window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) : 51 clearTimeout(handle); 52 } 53}; 54 55function uncodeVisibilityChange() { 56 if (document.hidden) { 57 window.dispatchEvent(new CustomEvent('is-blur')); 58 } else { 59 window.dispatchEvent(new CustomEvent('is-focus')); 60 } 61 } 62document.addEventListener('visibilitychange', uncodeVisibilityChange, false); 63 64if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) { 65 window.lenis = new Lenis({ 66 duration: 1 67 }) 68 69 UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 70 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 71 72 function raf(time) { 73 window.lenis.raf(time) 74 requestAnimationFrame(raf) 75 window.dispatchEvent(new CustomEvent('lenis-scroll')); 76 77 if ( SiteParameters.uncode_smooth_scroll_safe ) { 78 var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 79 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 80 81 if ( UNCODE.hDoc !== newHdoc ) { 82 UNCODE.hDoc = newHdoc; 83 window.lenis.resize(); 84 //window.dispatchEvent(new CustomEvent('boxResized')); 85 } 86 } 87 } 88 89 requestAnimationFrame(raf) 90 91 $(window).on('unmodal-open', function(){ 92 window.lenis.stop(); 93 }); 94 95 $(document).on('unmodal-close', function(){ 96 window.lenis.start(); 97 }); 98 99} 100 101var checkScrollTriggerRefresh; 102$(function(){ 103 $(document).on('uncode-scrolltrigger-refresh', function(){ 104 clearRequestTimeout(checkScrollTriggerRefresh); 105 checkScrollTriggerRefresh = requestTimeout(function(){ 106 ScrollTrigger.refresh(); 107 }, 500); 108 }); 109}); 110 111UNCODE.checkImgLoad = function( src, cb, err, el ) { 112 var img = new Image(); 113 img.onload = function () { 114 var result = (img.width > 0) && (img.height > 0); 115 cb(el); 116 }; 117 img.onerror = function () { 118 err(); 119 }; 120 img.src = src 121}; 122 123UNCODE.betterResize = function() { 124 var setResize, 125 doubleResize = true, 126 oldW = UNCODE.wwidth, 127 oldH = UNCODE.wheight, 128 setCTA; 129 $(window).on( 'resize orientationchange', function(){ 130 if ( oldW === UNCODE.wwidth ) { 131 return; 132 } else { 133 oldW = UNCODE.wwidth; 134 $(window).trigger('wwResize'); 135 } 136 137 if ( oldH === UNCODE.wheight ) { 138 return; 139 } else { 140 oldH = UNCODE.wheight; 141 $(window).trigger('whResize'); 142 } 143 }); 144 145 $(window).on( 'resize orientationchange', function(){ 146 clearRequestTimeout(setCTA); 147 setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 ); 148 }); 149}; 150 151UNCODE.shuffle = function(array) { 152 var currentIndex = array.length, 153 randomIndex; 154 155 while (currentIndex > 0) { 156 randomIndex = Math.floor(Math.random() * currentIndex); 157 currentIndex--; 158 [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; 159 } 160 161 return array; 162}; 163 164Number.isInteger = Number.isInteger || function(value) { 165 return typeof value === "number" && 166 isFinite(value) && 167 Math.floor(value) === value; 168}; 169 170UNCODE.utils = function() { 171 $(document).on('mouseover', 'a', function () { 172 if (!$(this).hasClass('star')) { 173 $(this).attr('data-title', $(this).attr('title')); 174 $(this).removeAttr('title'); 175 } 176 }); 177 $(document).on('mouseout', 'a', function () { 178 if (!$(this).hasClass('star')) { 179 $(this).attr('title', $(this).attr('data-title')); 180 $(this).removeAttr('data-title'); 181 } 182 }); 183 184 this.get_scroll_offset = function(e) { 185 186 var scroll_offset = 0, 187 target, 188 trigger; 189 190 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 191 target = e.target; 192 trigger = e.currentTarget; 193 } 194 195 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 196 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 197 UNCODE.hideMenu(100); 198 } 199 } 200 201 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) {
202 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 203 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 204 if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) { 205 if ( !$('.menu-hided').length ) { 206 if ( $('body').hasClass('hmenu-center') ) { 207 scroll_offset += $('.menu-sticky .menu-container').outerHeight(); 208 } else { 209 scroll_offset += $('.logo-container:visible').outerHeight(); 210 } 211 } 212 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 213 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 214 scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink ); 215 } else { 216 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 217 scroll_offset += UNCODE.menuMobileHeight; 218 } else { 219 if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) { 220 //scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 221 } else { 222 if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 223 scroll_offset += UNCODE.menuMobileHeight; 224 } 225 } 226 } 227 } 228 } 229 230 } 231 232 scroll_offset += UNCODE.bodyBorder; 233 234 return scroll_offset; 235 } 236 237 if ( !UNCODE.isFullPage ) { 238 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) { 239 240 var hash = (e.currentTarget).hash, 241 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 242 anchor = ''; 243 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 244 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 245 e.preventDefault(); 246 if (!$('#tab-reviews').is(':visible')) { 247 $('a[href="#tab-reviews"]').trigger('click'); 248 } 249 var calc_scroll = $('.wootabs .tab-content').offset().top; 250 calc_scroll -= UNCODE.get_scroll_offset(e); 251 252 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 253 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 254 255 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 256 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 257 } 258 } 259 260 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 261 delta = bodyTop - calc_scroll, 262 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 263 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 264 265 requestTimeout(function(){ 266 if (scrollSpeed == 0) { 267 $('html, body').scrollTop(calc_scroll); 268 UNCODE.scrolling = false; 269 } else { 270 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 271 $(this).stop(); 272 }).animate({ 273 scrollTop: calc_scroll 274 }, scrollSpeed, 'easeInOutCubic', function() { 275 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 276 UNCODE.scrolling = false; 277 } 278 ); 279 } 280 }, 200); 281 return; 282 } 283 if (hash != undefined) { 284 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 285 var anchor = this.hash.slice(1); 286 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 287 if ( !specialFormat.test(hash) ) { 288 if ( $(hash).length ) 289 anchor = $(hash); 290 } 291 } 292 } 293 294 if (is_scrolltop || anchor != '') { 295 if (is_scrolltop) { 296 e.preventDefault(); 297 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 298 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 299 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 300 301 if (scrollSpeed == 0) { 302 $('html, body').scrollTop(0); 303 UNCODE.scrolling = false;
304 } else { 305 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 306 $(this).stop(); 307 }).animate({ 308 scrollTop: 0 309 }, scrollSpeed, 'easeInOutCubic', function() { 310 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 311 UNCODE.scrolling = false; 312 }); 313 } 314 } else { 315 var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor; 316 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 317 var get_href = $(val).attr('href'); 318 if (get_href != undefined) { 319 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 320 else $(val).parent().removeClass('active'); 321 } 322 }); 323 if (scrollSection.length) { 324 if ( $('body').hasClass('uncode-scroll-no-history') ) { 325 e.preventDefault(); 326 } 327 328 if (UNCODE.menuOpened) { 329 if (UNCODE.wwidth < UNCODE.mediaQuery) { 330 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 331 } else { 332 $('.mmb-container-overlay .overlay-close').trigger('click'); 333 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 334 } 335 } 336 337 var calc_scroll = scrollSection.offset().top, 338 getOffset = UNCODE.get_scroll_offset(e), 339 $logo = $('.logo-container:visible'), 340 logoH, 341 $menu = $('#masthead .menu-container'), 342 menuH; 343 344 calc_scroll -= isNaN(getOffset) ? 0 : getOffset; 345 346 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 347 delta = bodyTop - calc_scroll, 348 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 349 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 350 351 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 352 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) { 353 logoH = $logo.outerHeight(), 354 menuH = $menu.outerHeight(); 355 if ( calc_scroll < ( logoH + menuH ) ) { 356 calc_scroll = 0; 357 } 358 } 359 } 360 361 if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) { 362 calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() ); 363 } 364 365 if (scrollSpeed == 0) { 366 $('html, body').scrollTop(calc_scroll); 367 UNCODE.scrolling = false; 368 } else { 369 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 370 $(this).stop(); 371 }).animate({ 372 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 373 }, scrollSpeed, 'easeInOutCubic', function() { 374 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 375 UNCODE.scrolling = false; 376 if ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 377 || 378 $('.menu-hided').length ) { 379 calc_scroll = scrollSection.offset().top; 380 getOffset = UNCODE.get_scroll_offset(e); 381 calc_scroll -= getOffset; 382 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 383 $(this).stop(); 384 }).animate({ 385 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 386 }, scrollSpeed, 'easeInOutCubic', function() { 387 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 388 UNCODE.scrolling = false; 389 } 390 ); 391 } 392 }); 393 } 394 } 395 } 396 } 397 }); 398 $('.header-scrolldown').on('click', function(event) { 399 400 event.preventDefault(); 401 402 var pageHeader = $(event.target).closest('#page-header'), 403 pageHeaderTop = pageHeader.offset().top, 404 pageHeaderHeight = pageHeader.outerHeight(), 405 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 406 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 407 408 var calc_scroll = pageHeaderTop + pageHeaderHeight, 409 getOffset = UNCODE.get_scroll_offset(event); 410 calc_scroll -= getOffset; 411
412 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 413 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 414 415 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 416 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 417 } 418 } 419 420 if (scrollSpeed == 0) { 421 $('html, body').scrollTop(calc_scroll); 422 UNCODE.scrolling = false; 423 } else { 424 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 425 $(this).stop(); 426 }).animate({ 427 scrollTop: calc_scroll 428 }, scrollSpeed, 'easeInOutCubic', function() { 429 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 430 UNCODE.scrolling = false; 431 if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) { 432 calc_scroll = pageHeaderTop + pageHeaderHeight; 433 getOffset = UNCODE.get_scroll_offset(event); 434 calc_scroll -= getOffset; 435 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 436 $(this).stop(); 437 }).animate({ 438 scrollTop: calc_scroll 439 }, scrollSpeed, 'easeInOutCubic', function() { 440 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 441 UNCODE.scrolling = false; 442 } 443 ); 444 } 445 } 446 ); 447 } 448 }); 449 } 450 451 // Colomun hover effect 452 // ================= 453 $(document).on('mouseenter', '.col-link', function(e) { 454 var uncol = $(e.target).prev('.uncol'), 455 el = uncol.find('.column-background'); 456 if (el) { 457 $('.btn-container .btn', uncol).addClass('active'); 458 var elOverlay = $(el[0]).find('.block-bg-overlay'); 459 if (elOverlay.length) { 460 var getOpacity = $(elOverlay).css('opacity'); 461 if (getOpacity != 1) { 462 getOpacity = Math.round(getOpacity * 100) / 100; 463 var newOpacity = getOpacity + .1; 464 $(elOverlay).data('data-opacity', getOpacity); 465 $(elOverlay).css('opacity', newOpacity); 466 } 467 } 468 } 469 }).on('mouseleave', '.col-link', function(e) { 470 var uncol = $(e.target).prev('.uncol'), 471 el = uncol.find('.column-background'); 472 $('.btn-container .btn', uncol).removeClass('active'); 473 if (el) { 474 var elOverlay = $(el[0]).find('.block-bg-overlay'); 475 if (elOverlay.length) { 476 var getOpacity = $(elOverlay).data('data-opacity'); 477 $(elOverlay).css('opacity', getOpacity); 478 } 479 } 480 }); 481 482 // Admin bar 483 // ============ 484 var fixAdminBar = function() { 485 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 486 var getAdminBar = $('#wpadminbar'); 487 if (getAdminBar.length) { 488 if (getAdminBar.css('position') !== 'hidden') { 489 var getAdminBarHeight = getAdminBar.height(); 490 if (getAdminBar.css('position') === 'fixed') { 491 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 492 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 493 } else { 494 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 495 $('.body-borders .top-border').css({'margin-top':'0px'}); 496 } 497 } 498 } 499 } 500 }; 501 window.addEventListener('load', fixAdminBar); 502 window.addEventListener('resize', fixAdminBar); 503 // Print 504 // =========== 505 var beforePrint = function() { 506 window.dispatchEvent(new CustomEvent('resize')); 507 window.dispatchEvent(UNCODE.boxEvent); 508 }; 509 510 if (window.matchMedia) { 511 var mediaQueryList = window.matchMedia('print'); 512 mediaQueryList.addListener(function(mql) { 513 if (mql.matches) { 514 beforePrint(); 515 } 516 }); 517 } 518 519 window.onbeforeprint = beforePrint; 520 521 // Safari srcset 522 var safariSrcSet = function(){ 523 if ( !SiteParameters.is_frontend_editor ) { 524 $('html.safari img[sizes]').each(function(){ 525 var $img = $(this), 526 sizeImg = parseInt($img.attr('sizes')); 527 if ( typeof(sizeImg) === 'number' ) { 528 $img.attr('sizes', (sizeImg) + 'px'); 529 } 530 }); 531 } 532 }; 533 window.addEventListener('load', safariSrcSet); 534} 535 536UNCODE.lettering = function() { 537 538 var setCTA; 539 var highlightStill = function(){ 540 541 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 542 543 $.each($heading_texts, function(key, el) { 544 var $heading = $(el); 545 546 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 547 return; 548 } 549 550 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 551 return; 552 } 553 554 var waypoint = new Waypoint({ 555 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 556 element: el, 557 handler: function() { 558 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 559 anims_l = $anims.length; 560 $anims.each(function(_key_, _el_){ 561 var $anim = $(_el_); 562 563 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 564 $anim.addClass('heading-text-highlight-animated'); 565 566 if ( $heading.data('animate') === true ) { 567 $anim.css({ 568 '-webkit-transition-duration': '0ms', 569 '-moz-transition-duration': '0ms', 570 '-o-transition-duration': '0ms', 571 'transition-duration': '0ms', 572 }); 573 } else { 574 $anim.css({ 575 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 576 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 577 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 578 'transition-delay': ((_key_ + 2) * 200) + 'ms', 579 }); 580 } 581 } 582 583 }); 584 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 585 $heading.data('animate', true); 586 }); 587 $anims.removeAttr('data-animated'); 588 }, 589 offset: '100%' 590 }); 591 592 }); 593 594 Waypoint.refreshAll(); 595 $( document.body ).trigger('uncode_waypoints'); 596 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 597 $(document).trigger('uncode-scrolltrigger-refresh'); 598 } 599 600 } 601 602 requestTimeout(function(){ 603 highlightStill(); 604 $(window).on( 'wwResize', function(){ 605 clearRequestTimeout(setCTA); 606 setCTA = requestTimeout( highlightStill, 100 ); 607 }); 608 }, 400); 609 610}; 611 612UNCODE.isUnmodalOpen = false;
613 614var manageVideoSize = function(){ 615 616 var setVideoFit; 617 $('.wp-block-embed').each(function(){ 618 619 var $this = $(this); 620 621 if ( $('iframe', $this).length ) { 622 623 var $iframe = $('> iframe, > a > iframe', $this), 624 w = parseFloat($iframe.attr('width')), 625 h = parseFloat($iframe.attr('height')), 626 url = $iframe.attr('src'), 627 ratio, frW; 628 629 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 630 631 ratio = h / w; 632 var setResizeiFto, 633 resizeiFrame = function(){ 634 frW = $iframe.width(); 635 $iframe.css({ 636 height: frW * ratio 637 }); 638 }; 639 resizeiFrame(); 640 $(window).on( 'wwResize load', function(){ 641 clearRequestTimeout(setResizeiFto); 642 setResizeiFto = requestTimeout( function() { 643 resizeiFrame(); 644 }, 10 ); 645 }); 646 647 } 648 649 } 650 651 }); 652 653}; 654 655manageVideoSize(); 656 657UNCODE.vivus = function(icon, time, delay, file) { 658 if (typeof Vivus !== 'undefined') { 659 var icon_options = { 660 type: 'delayed', 661 pathTimingFunction: Vivus.EASE_OUT, 662 animTimingFunction: Vivus.LINEAR, 663 duration: time, 664 } 665 666 if (delay) { 667 icon_options.delayStart = delay; 668 } 669 670 if (file) { 671 icon_options.file = file; 672 } 673 674 new Vivus(icon, icon_options); 675 } 676}; 677 678UNCODE.lastURL = ''; 679 680UNCODE.getURLParams = function(current_location, is_string) { 681 var params = {}; 682 if (is_string) { 683 var url = current_location.split('?')[1]; 684 } else { 685 var url = current_location.search; 686 url = url.substring(1); 687 } 688 if (url) { 689 var parts = url.split('&'); 690 for (var i = 0; i < parts.length; i++) { 691 var nv = parts[i].split('='); 692 if (!nv[0]) { 693 continue; 694 } 695 params[nv[0]] = nv[1] || true; 696 } 697 } 698 return params; 699} 700 701UNCODE.hasEqualURLParams = function(obj1, obj2) { 702 for (var i in obj1) { 703 if (obj1.hasOwnProperty(i)) { 704 if (!obj2.hasOwnProperty(i)) { 705 return false; 706 } 707 if (obj1[i] != obj2[i]) { 708 return false; 709 } 710 } 711 } 712 for (var i in obj2) { 713 if (obj2.hasOwnProperty(i)) { 714 if (!obj1.hasOwnProperty(i)) { 715 return false; 716 } 717 if (obj1[i] != obj2[i]) { 718 return false; 719 } 720 } 721 } 722 return true; 723} 724 725UNCODE.magnetic = function(){ 726 727 $(document).on('mousemove', '.un-magnetic-zone', function(e){ 728 729 var $zone = $(this), 730 zoneOff = $zone.offset(), 731 $mgntcEl = $('.un-magnetic-el', this), 732 elBound = this.getBoundingClientRect(), 733 maxSize = Math.max($zone.outerWidth(), $zone.outerHeight()); 734 735 var Xvalue = e.pageX - (zoneOff.left + maxSize / 2), 736 Yvalue = e.pageY - (zoneOff.top + maxSize / 2); 737 738 $mgntcEl.each(function(key, val){ 739 var magneticValue = $(val).attr('data-mgntc') || 0.5; 740 741 val.animate({ 742 transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)', 743 },{ 744 duration: 500, 745 fill: 'forwards', 746 }) 747 }); 748 }) 749 750 $(document).on('mouseleave', '.un-magnetic-zone', function(e){ 751 var $mgntcEl = $('.un-magnetic-el', this); 752 753 $mgntcEl.each(function(key, val){ 754 val.animate({ 755 transform: 'translate(0)', 756 },{ 757 duration: 500, 758 fill: 'forwards', 759 }) 760 }); 761 }) 762}; 763 764UNCODE.rowParallax = function(){ 765 766 if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) { 767 return; 768 } 769 770 var $rows = $('.parallax-move'), 771 stableHeight = UNCODE.wheight; 772 $rows.each(function(){ 773 var $row = $(this), 774 _row = $row[0], 775 dataMove = $row.attr('data-parallax-move'), 776 dataSafe = $row.attr('data-parallax-safe'), 777 rowInViewport = false, 778 trans; 779 780 if ( $row.find('.parallax-move').length ) { 781 return; 782 } 783 784 dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe; 785 dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove; 786 dataMove = dataMove / 10; 787 788 if ( 'IntersectionObserver' in window ) { 789 var observer = new IntersectionObserver(function(entries) { 790 791 entries.forEach(function(entry){ 792 if ( entry.isIntersecting ) { 793 rowInViewport = true; 794 } else { 795 rowInViewport = false; 796 } 797 }); 798 799 }, { 800 root: document, 801 }); 802 803 observer.observe(_row); 804 } else { 805 rowInViewport = true; 806 } 807 808 var loopRAF = function() { 809 if( rowInViewport ) { 810 var bound = _row.getBoundingClientRect(), 811 bound_top = bound.top, 812 bound_height = bound.height, 813 move = true, 814 scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 815 docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 816 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 817 fromBottom = docH - (scrolled + bound_top + bound_height); 818 819 if ( bound_height > stableHeight && dataSafe === 'yes' ) { 820 $row.find('>div').css({ 821 'transform':'none' 822 }); 823 move = false;
824 } 825 826 if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) { 827 $row.find('>div').css({ 828 'transform':'none' 829 }); 830 move = false; 831 } 832 833 if ( move ) { 834 835 if ( fromBottom < stableHeight ) { 836 //maybe Footer 837 trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove); 838 } else if ( scrolled + bound_top < stableHeight ) { 839 //maybe Header 840 trans = scrolled*(dataMove); 841 } else { 842 trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove); 843 } 844 845 $row.find('>div').css({ 846 'transform':'translateY(' + (trans) + 'px) translateZ(0)', 847 }); 848 } 849 } 850 851 requestAnimationFrame(loopRAF); 852 }; 853 854 requestAnimationFrame(loopRAF); 855 856 }); 857 858 $(window).on( 'load resize', function(e) { 859 if ( ! UNCODE.isMobile ) { 860 stableHeight = UNCODE.wheight; 861 } 862 }); 863 864 $(window).on( 'load wwResize', function(e) { 865 if ( UNCODE.isMobile ) { 866 stableHeight = UNCODE.wheight; 867 } 868 }); 869 870} 871 872UNCODE.changeSkinOnScroll = function(){ 873 if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { 874 return; 875 } 876 var $masthead = $('#masthead'), 877 transDesktop, 878 transMobile, 879 changeSkin, 880 881 checkTransparencyAndChange = function( $col ){ 882 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 883 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 884 changeSkin = $masthead.hasClass('menu-change-skin'); 885 886 if ( ! transDesktop && ! transMobile ) { 887 return false; 888 } 889 890 if ( ! changeSkin ) { 891 return false; 892 } 893 894 if ( $col.hasClass('style-light') ){ 895 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 896 return false; 897 } else if ( $col.hasClass('style-dark') ) { 898 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 899 return false; 900 } 901 }; 902 903 var prev_row = 'normal', 904 odd = true, 905 $rows = $('.vc_row[data-parent]:visible'); 906 $.each($rows, function(index, row){ 907 var $row = $(row), 908 $col = $('.uncol', $row).first(), 909 $slider = $('.uncode-slider', $row); 910 911 var wayDown = new Waypoint({ 912 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 913 element: row, 914 handler: function(direction) { 915 if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 916 if ( $slider.length ) { 917 $col = $('.owl-item.index-active .uncol', $slider).first(); 918 } 919 checkTransparencyAndChange($col); 920 } 921 if ( odd === false ) { 922 if ( row.hasAttribute('data-bg-changer') ) { 923 prev_row = 'bg-changer'; 924 } else { 925 prev_row = 'normal'; 926 } 927 odd = true; 928 } else { 929 odd = false; 930 } 931 }, 932 offset: function() { 933 return UNCODE.menuHeight / 2 934 } 935 }); 936 var wayUp = new Waypoint({ 937 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 938 element: row, 939 handler: function(direction) { 940 if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 941 if ( $slider.length ) { 942 $col = $('.owl-item.index-active .uncol', $slider).first(); 943 } 944 checkTransparencyAndChange($col); 945 } 946 if ( odd === false ) { 947 if ( row.hasAttribute('data-bg-changer') ) { 948 prev_row = 'bg-changer'; 949 } else { 950 prev_row = 'normal'; 951 } 952 odd = true; 953 } else { 954 odd = false; 955 } 956 }, 957 offset: function() { 958 return -row.clientHeight + ( UNCODE.menuHeight / 2 ) 959 } 960 }); 961 }); 962 963}; 964 965UNCODE.share = function() { 966 if (typeof Share !== 'undefined') { 967 var share_button_element = $('.share-button'); 968 var share_button_url = share_button_element.data('url'); 969 970 var share_button_config = { 971 ui: { 972 flyout: "top center", 973 button_font: false, 974 button_text: '', 975 icon_font: false 976 } 977 }; 978 979 if (share_button_url) { 980 share_button_config.url = share_button_url.replace("&", "%26"); 981 } 982 983 var share_button_top = new Share('.share-button', share_button_config); 984 } 985}; 986 987UNCODE.tooltip = function() { 988 if (typeof jQuery.fn.tooltip !== 'undefined') { 989 $('.btn-tooltip').tooltip(); 990 } 991}; 992 993UNCODE.counters = function() { 994 var $counters = $('.uncode-counter:not(.counter-init)'); 995 $counters.each(function(){ 996 var $counter = $(this).addClass('counter-init'); 997 if ( SiteParameters.is_frontend_editor ) { 998 $counter.addClass('started'); 999 } 1000 if ( $counter.closest( '.owl-carousel' ).length ) { 1001 return; 1002 } 1003 $counter.addClass('started').counterUp({ 1004 delay: 10, 1005 time: 1500 1006 }); 1007 }); 1008}; 1009 1010UNCODE.countdowns = function() { 1011 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 1012 $countdowns.each(function() { 1013 var $this = $(this).addClass('counter-init'), 1014 finalDate = $(this).data('uncode-countdown'); 1015 $this.countdown(finalDate, function(event) { 1016 $this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>')); 1017 }); 1018 }); 1019}; 1020 1021UNCODE.tabs = function() { 1022 1023 var tabSwitcher = function($el){ 1024 $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1024ical):not(.tab-switch)', $el).each(function(key, value){ 1025 var $navs = $(value), 1026 $active = $('li.active', $navs), 1027 $active_a = $('> a', $active), 1028 $active_span = $('> span', $active_a), 1029 vertical = $navs.closest('.vertical-tab-menu').length; 1030 1031 if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { 1032 $navs.append('<span class="switcher-cursor" />'); 1033 } 1034 1035 var $cursor = $('.switcher-cursor', $navs), 1036 active_w = $('a', $active).outerWidth(), 1037 span_w = $active_span.outerWidth(), 1038 active_pos = $active.position(), 1039 active_a_pos = $active_a.position(), 1040 span_pos = $active_span.position(), 1041 cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w, 1042 cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; 1043 1044 cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); 1045 1046 if ( ! vertical ) { 1047 $cursor.css({ 1048 left: cursor_left, 1049 width: cursor_w 1050 }); 1051 } 1052 1053 $navs.addClass('switch-init'); 1054 }); 1055 }; 1056 1057 var $body = $('body'); 1058 tabSwitcher($body); 1059 1060 var tabHoverIntent = function(){ 1061 var setHover; 1062 $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') 1063 .on('mouseover', function(e){ 1064 var $this = $(e.target); 1065 setHover = requestTimeout(function() { 1066 $this.trigger('hover-int'); 1067 }, 50); 1068 }) 1069 .on('mouseout', function(){ 1070 clearRequestTimeout(setHover); 1071 }); 1072 }; 1073 tabHoverIntent(); 1074 1075 var tabInit = function(){ 1076 $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { 1077 e.preventDefault() 1078 var $el = $(this); 1079 $el.tab('show'); 1080 var $container = $el.closest('.uncode-tabs'); 1081 tabSwitcher($container); 1082 requestTimeout(function() { 1083 window.dispatchEvent(UNCODE.boxEvent); 1084 var $tabs = $(e.currentTarget).closest('.uncode-tabs'); 1085 1086 if ( $tabs.hasClass('tabs-trigger-box-resized') ) { 1087 window.dispatchEvent(new CustomEvent('boxResized')); 1088 } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { 1089 window.dispatchEvent(new Event('resize')); 1090 $(window).trigger('uncode.re-layout'); 1091 } 1092 1093 var $active_panel = $('.tab-pane.active', $tabs); 1094 1095 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 1096 var element = $(val), 1097 delayAttr = element.attr('data-delay'); 1098 if (delayAttr == undefined) delayAttr = 0; 1099 requestTimeout(function() { 1100 element.addClass('start_animation'); 1101 }, delayAttr); 1102 }); 1103 1104 }, 300); 1105 1106 var $li = $el.closest('li'), 1107 mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 1108 $('li', $container).not($li).find('.tab-pane').slideUp(250) 1109 $('.tab-pane', $li).slideDown(250); 1110 var completeSlideDown = requestTimeout(function(){ 1111 if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { 1112 var pos = $el.offset(), 1113 rect = $el[0].getBoundingClientRect(), 1114 $masthead = $('#masthead > .menu-container'), 1115 considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; 1116 1117 if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { 1118 $('html, body').animate({ 1119 scrollTop: ( pos.top ) - considerMenu 1120 },{ 1121 easing: 'easeInOutQuad', 1122 duration: 250 1123 }); 1124 } 1125 } 1126 }, 260); 1127 }); 1128 } 1129 tabInit(); 1130 1131 var tabResponsive = function(){ 1132 if ( SiteParameters.is_frontend_editor ) { 1133 return true; 1134 } 1135 var $tabContainers = $('.tab-container.tabs-breakpoint'); 1136 $tabContainers.each(function(){ 1137 var $tabContainer = $(this), 1138 $tabContent = $('.tab-content', $tabContainer), 1139 $nav = $('.nav-tabs', $tabContainer), 1140 mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 1141 1142 $('> li', $nav).each(function(){ 1143 var $li = $(this), 1144 dataID = $li.attr('data-tab-id'); 1145 1146 if ( UNCODE.wwidth <= mQuery ) { 1147 if ( ! $('.tab-pane', $li ).length ) { 1148 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); 1149 $tabContainer.addClass('tabs-appended'); 1150 $li.append($append_pane); 1151 } 1152 1153 if ( $li.hasClass('active') ) { 1154 $('> a', $li).click(); 1155 } 1156 } else { 1157 if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { 1158 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); 1159 $tabContainer.removeClass('tabs-appended');
1160 $tabContent.prepend($append_pane.removeAttr('style')); 1161 } 1162 } 1163 }); 1164 }); 1165 1166 } 1167 tabResponsive(); 1168 1169 $(window).on('wwResize', function(){ 1170 tabHoverIntent(); 1171 tabSwitcher($body); 1172 }); 1173 1174 var setCTA; 1175 $(window).on( 'resize', function(){ 1176 clearRequestTimeout(setCTA); 1177 setCTA = requestTimeout( tabResponsive, 100 ); 1178 }); 1179 1180 $('.nav-tabs').each(function(){ 1181 var $nav = $(this), 1182 $lis = $('> li:not(.active)', $nav), 1183 $links = $('.tab-excerpt-link', $nav); 1184 $('.tab-excerpt', $lis).slideUp(400, function(){ 1185 $(this).addClass('init'); 1186 }); 1187 1188 $links.each(function(){ 1189 var $link = $(this), 1190 $par_a = $link.closest('a'), 1191 href = $link.attr('data-href'), 1192 target = $link.attr('data-target'); 1193 $par_a.addClass('inner-link'); 1194 $link.on('click', function(){ 1195 var _link = document.createElement('a'); 1196 _link.href = href; 1197 _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; 1198 _link.click(); 1199 }); 1200 }); 1201 $nav.addClass('tab-init'); 1202 }); 1203 1204 $('.uncode-tabs.tabs-no-lazy').each(function(){ 1205 var $tabs = $(this), 1206 $panes = $('.tab-pane:not(.active)', $tabs); 1207 $panes.each(function(){ 1208 var $pane = $(this), 1209 $imgs = $('img[loading="lazy"]', $pane); 1210 $imgs.removeAttr('loading'); 1211 $imgs.removeAttr('decoding'); 1212 }); 1213 }); 1214 1215}; 1216UNCODE.collapse = function() { 1217 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 1218 var $this = $(this), 1219 href 1220 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 1221 var $target = $(target) 1222 var parent = $this.attr('data-parent') 1223 var $parent = parent && $(parent) 1224 var $title = $(this).parent() 1225 var $accordion = $(e.target).closest('.uncode-accordion') 1226 var $group = $this.closest('.group') 1227 var $panel_group = $this.closest('.panel-group') 1228 if ($parent) { 1229 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 1230 if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { 1231 $title.removeClass('active'); 1232 $group.removeClass('active-group'); 1233 } else { 1234 if ( $panel_group.attr('data-no-toggle') != true ) { 1235 $parent.find('.panel-title').removeClass('active') 1236 $parent.find('.group').removeClass('active-group') 1237 } 1238 $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') 1239 $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') 1240 } 1241 } 1242 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 1243 requestTimeout(function() { 1244 var $accordion = $(e.target).closest('.uncode-accordion'); 1245 if ( $accordion.hasClass('tabs-trigger-box-resized') ) { 1246 window.dispatchEvent(new CustomEvent('boxResized')); 1247 } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { 1248 window.dispatchEvent(new Event('resize')); 1249 $(window).trigger('uncode.re-layout'); 1250 } 1251 1252 var $active_panel = $('.panel.active-group', $parent); 1253 1254 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 1255 var element = $(val), 1256 delayAttr = element.attr('data-delay'); 1257 if (delayAttr == undefined) delayAttr = 0; 1258 requestTimeout(function() { 1259 element.addClass('start_animation'); 1260 }, delayAttr); 1261 }); 1262 1263 }, 500); 1264 }); 1265 1266 $('.uncode-accordion.tabs-no-lazy').each(function(){ 1267 var $accordion = $(this), 1268 $panes = $('.panel:not(.active-group)', $accordion); 1269 $panes.each(function(){ 1270 var $pane = $(this), 1271 $imgs = $('img[loading="lazy"]', $pane); 1272 $imgs.removeAttr('loading'); 1273 $imgs.removeAttr('decoding'); 1274 }); 1275 }); 1276}; 1277 1278UNCODE.bigText = function(el) { 1279 var bigTextLaunch = function(){ 1280 if (el == undefined) { 1281 el = $('body'); 1282 } 1283 $.each($('.bigtext', el), function(index, val) { 1284 $(val).bigtext({ 1285 minfontsize: 24 1286 }); 1287 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 1288 opacity: 1 1289 }); 1290 requestTimeout(function() { 1291 if ($(val).find('.animate_when_almost_visible').length != 0) { 1292 $(val).css({opacity: 1}); 1293 } 1294 }, 400); 1295 }); 1296 }; 1297 1298 if ( UNCODE.wwidth > UNCODE.mediaQuery ) { 1299 bigTextLaunch(); 1300 } 1301 $(window).on( 'load', bigTextLaunch ); 1302}; 1303 1304UNCODE.process_shortpixel_image = function(image) { 1305 var data = { 1306 action: 'shortpixel_manual_optimization', 1307 image_id: image,
1308 cleanup: true 1309 }; 1310 1311 $.get(SiteParameters.ajax_url, data); 1312}; 1313 1314UNCODE.menuSystem = function() { 1315 1316 function menuMobile() { 1317 var $body = $('body'), 1318 scrolltop, 1319 $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), 1320 $masthead = $('#masthead'), 1321 $box, 1322 $el, 1323 $el_transp, 1324 elHeight, 1325 offCanvasAnim, 1326 check, 1327 animating = false, 1328 stickyMobile = false, 1329 menuClose = new CustomEvent('menuMobileClose'), 1330 menuOpen = new CustomEvent('menuMobileOpen'); 1331 UNCODE.menuOpened = false; 1332 $mobileToggleButton.on('click', function(event) { 1333 event.stopPropagation(); 1334 var btn = this; 1335 if ($(btn).hasClass('overlay-close')) return; 1336 event.preventDefault(); 1337 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 1338 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 1339 $box = $(this).closest('.box-container').find('.main-menu-container'); 1340 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 1341 $el_transp = $('.menu-absolute.menu-transparent'); 1342 if (UNCODE.isMobile) { 1343 if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) { 1344 stickyMobile = true; 1345 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 1346 } else { 1347 elHeight = 0; 1348 $.each($box.find('> div'), function(index, val) { 1349 elHeight += $(val).outerHeight(); 1350 }); 1351 } 1352 } else { 1353 elHeight = 0; 1354 $.each($el, function(index, val) { 1355 elHeight += $(val).outerHeight(); 1356 }); 1357 } 1358 var open = function() { 1359 clearTimeout(offCanvasAnim); 1360 if (!animating) { 1361 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 1362 scrolltop = $(window).scrollTop(); 1363 window.dispatchEvent(menuOpen); 1364 animating = true; 1365 UNCODE.menuOpened = true; 1366 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 1367 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 1368 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1369 } 1370 if ($('body.menu-offcanvas').length) { 1371 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1372 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1373 } else { 1374 if ( $('.menu-hide, .menu-sticky').length ) { 1375 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 1376 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1377 } 1378 } 1379 } 1380 } 1381 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { 1382 //$("#masthead")[0].scrollIntoView(); 1383 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1384 } 1385 $box.addClass('open-items'); 1386 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 1387 $el_transp.addClass('is_mobile_open'); 1388 } 1389 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1390 btn.classList.add('close'); 1391 $box.animate({ 1392 height: elHeight 1393 }, 600, "easeInOutCirc", function() { 1394 animating = false; 1395 if (!stickyMobile) $box.css('height', 'auto'); 1396 }); 1397 } else { 1398 animating = false; 1399 } 1400 } 1401 }; 1402 1403 var close = function() { 1404 clearTimeout(offCanvasAnim); 1405 if (!animating) { 1406 window.dispatchEvent(menuClose); 1407 animating = true; 1408 UNCODE.menuOpened = false;
1409 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1410 btn.classList.remove('close'); 1411 btn.classList.add('closing'); 1412 } 1413 $box.addClass('close'); 1414 requestTimeout(function() { 1415 $box.removeClass('close'); 1416 $box.removeClass('open-items'); 1417 btn.classList.remove('closing'); 1418 if ($el_transp.length) { 1419 $el_transp.removeClass('is_mobile_open'); 1420 } 1421 }, 500); 1422 $body.removeClass('opening-overlay-menu'); 1423 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1424 $box.animate({ 1425 height: 0 1426 }, { 1427 duration: 600, 1428 easing: "easeInOutCirc", 1429 complete: function(elements) { 1430 $(elements).css('height', ''); 1431 animating = false; 1432 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 1433 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 1434 } 1435 $body.removeClass('open-overlay-menu'); 1436 } 1437 }); 1438 } else { 1439 animating = false; 1440 offCanvasAnim = setTimeout(function(){ 1441 $body.removeClass('open-overlay-menu'); 1442 }, 1000); 1443 } 1444 } 1445 }; 1446 check = (!UNCODE.menuOpened) ? open() : close(); 1447 } 1448 }); 1449 1450 $('html').on('click', function(event){ 1451 if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { 1452 $('.uncode-close-offcanvas-mobile').trigger('click'); 1453 } 1454 }); 1455 1456 window.addEventListener('menuMobileTrigged', function(e) { 1457 $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); 1458 }); 1459 window.addEventListener('orientationchange', function(e) { 1460 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 1461 }); 1462 window.addEventListener("resize", function() { 1463 if ($(window).width() < UNCODE.mediaQuery) { 1464 if (UNCODE.isMobile) { 1465 var $box = $('.box-container .main-menu-container'), 1466 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 1467 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 1468 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 1469 elHeight = 0; 1470 $.each($el, function(index, val) { 1471 elHeight += $(val).outerHeight(); 1472 }); 1473 elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1; 1474 $($box).css('height', elHeight + 'px'); 1475 } 1476 } 1477 } 1478 } else { 1479 $('.menu-hide-vertical').removeAttr('style'); 1480 $('.menu-container-mobile').removeAttr('style'); 1481 $('.vmenu-container.menu-container').removeAttr('style'); 1482 } 1483 }); 1484 1485 $(window).on('scroll', function(){ 1486 if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { 1487 $(window).scrollTop(scrolltop); 1488 return false; 1489 } 1490 }); 1491 1492 }; 1493 1494 function menuOffCanvas() { 1495 var menuClose = new CustomEvent('menuCanvasClose'), 1496 menuOpen = new CustomEvent('menuCanvasOpen'); 1497 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { 1498 if ($(window).width() > UNCODE.mediaQuery) { 1499 if ( $('body.vmenu-offcanvas-overlay').length ) { 1500 if ($(event.currentTarget).hasClass('off-close')) { 1501 $(event.currentTarget).removeClass('off-close'); 1502 requestTimeout(function() { 1503 window.dispatchEvent(menuClose); 1504 }, 500); 1505 1506 } else { 1507 $(event.currentTarget).addClass('off-close'); 1508 window.dispatchEvent(menuOpen); 1509 } 1510 } else { 1511 if ($(event.currentTarget).hasClass('close')) { 1512 $(event.currentTarget).removeClass('close'); 1513 $(event.currentTarget).addClass('closing'); 1514 requestTimeout(function() { 1515 $(event.currentTarget).removeClass('closing'); 1516 window.dispatchEvent(menuClose); 1517 }, 500); 1518 1519 } else { 1520 $(event.currentTarget).addClass('close'); 1521 window.dispatchEvent(menuOpen); 1522 } 1523 } 1524 } 1525 1526 $('body').toggleClass('off-opened'); 1527 }); 1528 1529 $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ 1530 if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { 1531 var $vMenuCont = $('#masthead .vmenu-container'), 1532 $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), 1533 1534 vmenu_h = parseFloat( $vMenuCont.outerHeight() ), 1535 vmenu_w = parseFloat( $vMenuCont.outerWidth() ), 1536 vmenu_off = $vMenuCont.offset(), 1537 vmenu_l = parseFloat(vmenu_off.left), 1538 vmenu_t = parseFloat(vmenu_off.top), 1539 vmenu_r = vmenu_l + vmenu_w, 1540 vmenu_b = vmenu_t + vmenu_h, 1541 1542 close_h = parseFloat( $close_menu.outerHeight() ), 1543 close_w = parseFloat( $close_menu.outerWidth() ), 1544 close_off = $close_menu.offset(), 1545 close_l = parseFloat(close_off.left), 1546 close_t = parseFloat(close_off.top), 1547 close_r = close_l + close_w, 1548 close_b = close_t + close_h; 1549 if ( 1550 !( 1551 e.clientX > vmenu_l && 1552 e.clientX < vmenu_r && 1553 e.clientY > vmenu_t && 1554 e.clientY < vmenu_b 1555 ) 1556 || 1557 ( 1558 e.clientX > close_l && 1559 e.clientX < close_r && 1560 e.clientY > close_t && 1561 e.clientY < close_b 1562 ) 1563 ) { 1564 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); 1565 } 1566 } 1567 }); 1568 }; 1569 1570 function menuOverlay() { 1571 if ( $('.overlay').length ) { 1572 $('.overlay').removeClass('hidden'); 1573 } 1574 if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { 1575 $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) { 1576 var transDelay = (index / 20) + 0.1; 1577 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1578 transDelay = transDelay + 0.3; 1579 $(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's'); 1580 }); 1581 } 1582 1583 }; 1584 var $secondary_parent; 1585 function menuAppend() { 1586 var $body = $('body'), 1587 $menuCont = $('.menu-container:not(.vmenu-container)'), 1588 $vMenuCont = $('.menu-container.vmenu-container'), 1589 $cta = $('.navbar-cta'), 1590 $socials = $('.navbar-social:not(.appended-navbar)'), 1591 $ul = $('.navbar-main ul.menu-primary-inner'), 1592 $ulCta, 1593 $ulSocials, 1594 $navLast, 1595 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1596 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1597 $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), 1598 $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), 1599 $ulFirst = $('> ul', $firstNav), 1600 $ulSecond = $('> ul', $secondNav), 1601 setCTA, 1602 appendCTA = function(){ 1603 return true; 1604 }, 1605 appendSocials = function(){ 1606 return true; 1607 }, 1608 appendSplit = function(){ 1609 return true; 1610 }; 1611 1612 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1613 $ulCta = $('> ul', $cta); 1614 $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); 1615 1616 appendCTA = function(){ 1617 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1618 $ul.after($ulCta); 1619 } else { 1620 $cta.append($ulCta); 1621 } 1622 } 1623 } 1624 1625 if ( ! $body.hasClass('cta-not-appended') ) { 1626 appendCTA(); 1627 } 1628 1629 var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); 1630 $smartSocial.each(function(){ 1631 var $_smartSocial = $(this); 1632 $('> li', $_smartSocial).each(function(){ 1633 var $li = $(this); 1634 if ( $li.hasClass('mobile-hidden') ) { 1635 $_smartSocial.addClass('mobile-hidden'); 1636 } else { 1637 $_smartSocial.removeClass('mobile-hidden'); 1638 return false;
1639 } 1640 }); 1641 1642 $('> li', $_smartSocial).each(function(){ 1643 var $li = $(this); 1644 if ( $li.hasClass('tablet-hidden') ) { 1645 $_smartSocial.addClass('tablet-hidden'); 1646 } else { 1647 $_smartSocial.removeClass('tablet-hidden'); 1648 return false; 1649 } 1650 }); 1651 }); 1652 1653 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { 1654 $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); 1655 if ( $body.hasClass('hmenu-center-split') ) { 1656 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1657 } else { 1658 $navLast = $('.navbar-nav-last', $vMenuCont); 1659 } 1660 1661 if ( ! $navLast.length ) { 1662 var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />'); 1663 if ( $body.hasClass('hmenu-center-split') ) { 1664 $('.menu-horizontal-inner', $menuCont).append(_navLast); 1665 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1666 } else { 1667 $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); 1668 $navLast = $('.navbar-nav-last', $vMenuCont); 1669 } 1670 } 1671 1672 appendSocials = function(){ 1673 if ( !$body.hasClass('menu-overlay-center') ) { 1674 // if ( !$navLast.find('ul.menu-smart-social').length ) { 1675 // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); 1676 // $navLast.append('<ul class="menu-smart menu-smart-social" />'); 1677 // $ulSocials.each(function(){ 1678 // var $li_social = $(this); 1679 // $navLast.find('ul.menu-smart-social').append($li_social); 1680 // }); 1681 // } 1682 // } else { 1683 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1684 $socials.addClass('mobile-hidden').addClass('tablet-hidden') 1685 if ( ! $('> ul.menu-smart-social li', $socials).length ) { 1686 $('> ul.menu-smart-social li', $socials).remove(); 1687 } 1688 $navLast.append($ulSocials); 1689 } else { 1690 if ( ! $('> ul.menu-smart-social li', $navLast).length ) { 1691 $('> ul.menu-smart-social li', $navLast).remove(); 1692 } 1693 $socials.append($ulSocials); 1694 } 1695 } 1696 } 1697 appendSocials(); 1698 } 1699 1700 if ( $vMenuCont.length ) { 1701 var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); 1702 } else { 1703 var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); 1704 } 1705 if ( $accordion_secondary.length ) { 1706 var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); 1707 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1708 if ( !$accordion_secondary_ph.length ) { 1709 $accordion_secondary.after('<span class="accordion-secondary-ph" />'); 1710 } 1711 if ( $vMenuCont.length ) { 1712 $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); 1713 } else { 1714 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1715 $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); 1716 } else { 1717 $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); 1718 } 1719 } 1720 } else { 1721 if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { 1722 $accordion_secondary_ph.before($accordion_secondary); 1723 } 1724 } 1725 } 1726 1727 if ( $vMenuCont.length ) { 1728 var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); 1729 } else { 1730 var $extra_icons = $('.navbar-extra-icons', $menuCont); 1731 } 1732 1733 if ( $extra_icons.length ) { 1734 if ( $vMenuCont.length ) { 1735 if ( $('li:not(.social-icon)', $extra_icons).length ) { 1736 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1737 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1738 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1739 $not_social.each(function(){ 1740 if ( ! $primary_after.length ) { 1741 $('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />'); 1742 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1743 $primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />'); 1744 } 1745 var $extra_li = $(this); 1746 $primary_after.find('> ul').append($extra_li); 1747 }); 1748 } else { 1749 var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), 1750 $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1751 $not_social.each(function(){ 1752 var $extra_li = $(this); 1753 $extra_icons.find('> ul').append($extra_li); 1754 }); 1755 } 1756 } /*else { 1757 var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); 1758 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1759 if ( !$extra_icons_ph.length ) { 1760 $extra_icons.after('<span class="extra-icons-ph" />'); 1761 } 1762 if ( $('.navbar-accordion-cta', $vMenuCont).length ) { 1763 $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); 1764 } else { 1765 $('.menu-accordion-primary', $vMenuCont).after($extra_icons); 1766 } 1767 } else { 1768 if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { 1769 $extra_icons_ph.before($extra_icons); 1770 } 1771 } 1772 }*/ 1773 } else { 1774 if ( ! $body.hasClass('hmenu-center-double') ) { 1775 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1776 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1777 $primary_after = $('.nav.navbar-main-after', $menuCont); 1778 1779 if ( ! $primary_after.length && $not_social.length ) { 1780 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1781 $('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />'); 1782 } else { 1783 $('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />'); 1784 } 1785 $primary_after = $('.nav.navbar-main-after', $menuCont); 1786 $primary_after.append('<ul class="menu-smart sm menu-smart-social" />'); 1787 } 1788 var tablet_hidden = true, 1789 mobile_hidden = true; 1790 $not_social.each(function(){ 1791 var $extra_li = $(this); 1792 $primary_after.find('> ul').append($extra_li); 1793 if ( ! $extra_li.hasClass('tablet-hidden') ) { 1794 tablet_hidden = false;
1795 } 1796 if ( ! $extra_li.hasClass('mobile-hidden') ) { 1797 mobile_hidden = false; 1798 } 1799 }); 1800 if ( tablet_hidden === true && $not_social.length ) { 1801 $primary_after.addClass('tablet-hidden'); 1802 } 1803 if ( mobile_hidden === true && $not_social.length ) { 1804 $primary_after.addClass('mobile-hidden'); 1805 } 1806 } else { 1807 var $primary_after = $('.nav.navbar-main-after', $menuCont); 1808 1809 if ( $primary_after.length ) { 1810 var $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1811 $not_social.each(function(){ 1812 var $extra_li = $(this); 1813 $extra_icons.find('> ul').append($extra_li); 1814 }); 1815 $primary_after.remove(); 1816 } 1817 } 1818 } 1819 } 1820 } 1821 1822 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1823 appendSplit = function(){ 1824 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1825 if ( $extra_icons.length ) { 1826 if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { 1827 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1828 $append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />'); 1829 $not_social.each(function(){ 1830 var $extra_li = $(this); 1831 $append_ul.append($extra_li); 1832 }); 1833 if ( $secondNav.length ) { 1834 $secondNav.append($append_ul); 1835 } else { 1836 $('.menu-horizontal-inner', $menuCont).prepend($append_ul); 1837 } 1838 } 1839 } 1840 if ( $secondNav.length ) { 1841 $secondNav.prepend($ulFirst); 1842 } else { 1843 $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); 1844 } 1845 $firstMenu.hide(); 1846 } else { 1847 $firstNav.append($ulFirst); 1848 var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); 1849 if ( $append_ul.length ) { 1850 var $not_social = $('> li:not(.social-icon)', $append_ul); 1851 $not_social.each(function(){ 1852 var $extra_li = $(this); 1853 $extra_icons.find('> ul').append($extra_li); 1854 }); 1855 } 1856 $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); 1857 $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); 1858 $firstMenu.css({ 1859 'display': 'table-cell' 1860 }); 1861 } 1862 } 1863 } 1864 appendSplit(); 1865 1866 $(window).on( 'wwresize', function(){ 1867 clearRequestTimeout(setCTA); 1868 setCTA = requestTimeout( function() { 1869 appendCTA(); 1870 appendSocials(); 1871 appendSplit(); 1872 }, 10 ); 1873 }); 1874 } 1875 //menuMobileButton(); 1876 menuMobile(); 1877 menuOffCanvas(); 1878 menuAppend(); 1879 menuOverlay(); 1880 1881 var stickyDropdownSearch = function(){ 1882 var $masthead = $('#masthead'), 1883 $ddSearch = $('.overlay.overlay-search', $masthead), 1884 $styles = $('#stickyDropdownSearch').remove(); 1885 if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { 1886 var $menuWrapper = $('.menu-wrapper'), 1887 $navbar = $('.menu-container-mobile', $menuWrapper), 1888 navbarH = $navbar.outerHeight(), 1889 //$topbar = $('.top-menu', $menuWrapper), 1890 //topbarH = $topbar.outerHeight(), 1891 _css; 1892 1893 _css = '<style id="stickyDropdownSearch">'; 1894 _css += '@media (max-width: 959px) {'; 1895 _css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {'; 1896 _css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;'; 1897 _css += '}'; 1898 _css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {'; 1899 _css += 'position: fixed;'; 1900 _css += 'top: 0;'; 1901 _css += '}'; 1902 _css += '</style>'; 1903 1904 $(_css).appendTo($('head')); 1905 } 1906 } 1907 stickyDropdownSearch(); 1908 1909 var setMenuOverlay; 1910 $(window).on( 'wwResize', function(){ 1911 if ( $('.overlay').length && $(window).width() > 1024 ) { 1912 $('.overlay').addClass('hidden'); 1913 } 1914 clearRequestTimeout(setMenuOverlay); 1915 setMenuOverlay = requestTimeout( function(){ 1916 menuOverlay(); 1917 menuAppend(); 1918 stickyDropdownSearch(); 1919 }, 150 ); 1920 }); 1921 UNCODE.menuSmartInit(); 1922}; 1923 1924UNCODE.menuSmartInit = function() { 1925 var $menusmart = $('[class*="menu-smart"]'), 1926 $masthead = $('#masthead'), 1927 $hMenu = $('.menu-horizontal-inner', $masthead), 1928 $focus = $('.overlay-menu-focus'), 1929 showTimeout = 50, 1930 hideTimeout = 50, 1931 showTimeoutFunc, hideTimeoutFunc; 1932 1933 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1934 $(this).data('hover', true); 1935 }, function(){ 1936 $(this).data('hover', false); 1937 }); 1938 1939 $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ 1940 e.preventDefault(); 1941 }); 1942 1943 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1944 var $notLis = $('> .nav > ul > li a', $hMenu), 1945 $menuA = $('a', $masthead).not($notLis), 1946 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1947 showFuncCond = function() { return true }; 1948 1949 if ( $('body').hasClass('focus-megamenu') ) { 1950 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1951 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1952 } else if ( $('body').hasClass('focus-links') ) { 1953 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1954 } 1955 1956 $hoverSelector.hover(function(){ 1957 clearRequestTimeout(hideTimeoutFunc);
1958 showTimeoutFunc = requestTimeout(function(){ 1959 $('body').addClass('navbar-hover'); 1960 }, showTimeout*2); 1961 }, function(){ 1962 hideTimeoutFunc = requestTimeout(function(){ 1963 if ( ! $('.overlay-search.open', $masthead).length ) { 1964 $('body').removeClass('navbar-hover'); 1965 } 1966 }, hideTimeout*2); 1967 }); 1968 } else { 1969 showFuncCond = function() { return false }; 1970 } 1971 1972 if ($menusmart.length > 0) { 1973 $menusmart.smartmenus({ 1974 subIndicators: false, 1975 subIndicatorsPos: 'append', 1976 //subMenusMinWidth: '13em', 1977 subIndicatorsText: '', 1978 showTimeout: showTimeout, 1979 hideTimeout: hideTimeout, 1980 scrollStep: 8, 1981 showFunction: function($ul, complete) { 1982 clearRequestTimeout(showTimeoutFunc); 1983 $ul.fadeIn(0, 'linear', function(){ 1984 complete(); 1985 if ( $ul.hasClass('vc_row') ) { 1986 $ul.css({ 1987 'display': 'table' 1988 }); 1989 } 1990 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1991 $('body').addClass('open-megamenu'); 1992 } 1993 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1994 $('body').addClass('navbar-hover'); 1995 } 1996 }).addClass('open-animated'); 1997 }, 1998 hideFunction: function($ul, complete) { 1999 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 2000 $('body').removeClass('open-megamenu'); 2001 } 2002 var fixIE = $('html.ie').length; 2003 if (fixIE) { 2004 var $rowParent = $($ul).closest('.main-menu-container'); 2005 $rowParent.height('auto'); 2006 } 2007 $ul.fadeOut(0, 'linear', function(){ 2008 complete(); 2009 $ul.removeClass('open-animated'); 2010 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 2011 $('body').removeClass('open-submenu'); 2012 } 2013 }); 2014 }, 2015 collapsibleShowFunction: function($ul, complete) { 2016 $ul.slideDown(400, 'easeInOutCirc', complete); 2017 }, 2018 collapsibleHideFunction: function($ul, complete) { 2019 $ul.slideUp(200, 'easeInOutCirc', complete); 2020 }, 2021 hideOnClick: SiteParameters.menuHideOnClick, 2022 }); 2023 2024 if ( $('body').hasClass('menu-accordion-active') ) { 2025 $menusmart.each(function(key, menu){ 2026 $(menu).addClass('menu-smart-init'); 2027 $(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) ); 2028 }); 2029 } 2030 2031 $(document).on( 'uncode.smartmenu-appended', function(){ 2032 requestTimeout(function(){ 2033 $menusmart.smartmenus( 'refresh' ); 2034 }, 1000); 2035 }); 2036 } 2037 2038 $('.main-menu-container').each(function(){ 2039 var $main_cont = $(this), 2040 $uls = $('ul', $main_cont); 2041 2042 $uls.each(function(){ 2043 var $ul = $(this), 2044 mobile_hidden = true, 2045 tablet_hidden = true; 2046 $('> li:not(.hidden)', $ul).each(function(){ 2047 if ( !$(this).hasClass('mobile-hidden') ) { 2048 mobile_hidden = false; 2049 return false; 2050 } 2051 }); 2052 $('> li:not(.hidden)', $ul).each(function(){ 2053 if ( !$(this).hasClass('tablet-hidden') ) { 2054 tablet_hidden = false; 2055 return false; 2056 } 2057 }); 2058 if ( mobile_hidden ) { 2059 $ul.addClass('mobile-hidden'); 2060 } 2061 if ( tablet_hidden ) { 2062 $ul.addClass('tablet-hidden'); 2063 } 2064 }); 2065 2066 var $divUlsMB = $('div:has(>ul.mobile-hidden)'); 2067 2068 $divUlsMB.each(function(){ 2069 var $divUlMB = $(this), 2070 div_mobile_hidden = true, 2071 div_tablet_hidden = true; 2072 2073 $('> ul:not(.hidden)', $divUlMB).each(function(){ 2074 if ( !$(this).hasClass('mobile-hidden') ) { 2075 div_mobile_hidden = false; 2076 return false; 2077 } 2078 }); 2079 $('> ul:not(.hidden)', $divUlMB).each(function(){ 2080 if ( !$(this).hasClass('tablet-hidden') ) { 2081 div_tablet_hidden = false; 2082 return false; 2083 } 2084 }); 2085 if ( div_mobile_hidden ) { 2086 $divUlMB.addClass('mobile-hidden'); 2087 } 2088 if ( div_tablet_hidden ) { 2089 $divUlMB.addClass('tablet-hidden'); 2090 } 2091 }); 2092 }); 2093 2094 var overlaySearchButton = function(){ 2095 var $search_wrap = $('.overlay.overlay-search, .widget_search'); 2096 2097 $search_wrap.each(function(){ 2098 var $form = $('form', this), 2099 $icon = $('i', $form); 2100 2101 $icon.on('click', function(){ 2102 $form.submit(); 2103 }); 2104 }); 2105 }; 2106 overlaySearchButton(); 2107} 2108 2109UNCODE.okvideo = function(ev) { 2110 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 2111 $.okvideo = function(options) { 2112 // if the option var was just a string, turn it into an object 2113 if (typeof options !== 'object') options = { 2114 'video': options 2115 }; 2116 var base = this; 2117 // kick things off 2118 base.init = function() { 2119 base.options = $.extend({}, $.okvideo.options, options); 2120 // support older versions of okvideo 2121 if (base.options.video === null) base.options.video = base.options.source; 2122 base.setOptions(); 2123 var target = base.options.target || $('body'); 2124 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 2125 var zIndex = base.options.controls === 3 ? -999 : "auto"; 2126 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 2127 var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>'; 2128 if (OKEvents.utils.isMobile()) { 2129 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>'); 2130 } else { 2131 if (base.options.controls === 3) { 2132 target.append(mask) 2133 } 2134 if (base.options.adproof === 1) { 2135 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>'); 2136 } else { 2137 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>'); 2138 } 2139 } 2140 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 2141 if (base.options.playlist.list === null) { 2142 if (base.options.video.provider === 'youtube') { 2143 base.loadYouTubeAPI(); 2144 } else if (base.options.video.provider === 'vimeo') { 2145 base.options.volume /= 100; 2146 base.loadVimeoAPI(); 2147 } 2148 } else { 2149 base.loadYouTubeAPI(); 2150 } 2151 } 2152 }; 2153 // clean the options 2154 base.setOptions = function() { 2155 // exchange 'true' for '1' and 'false' for 3 2156 for (var key in this.options) { 2157 if (this.options[key] === true) this.options[key] = 1; 2158 if (this.options[key] === false) this.options[key] = 3; 2159 } 2160 if (base.options.playlist.list === null) { 2161 base.options.video = base.determineProvider(); 2162 } 2163 // pass options to the window 2164 $(window).data('okoptions-' + base.options.id, base.options); 2165 };
2166 // insert js into the head and exectue a callback function 2167 base.insertJS = function(src, callback, provider){ 2168 var tag; 2169 if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) { 2170 delete UNCODE.insertedSripts[src]; 2171 var tags = document.getElementsByTagName('script'); 2172 for (var i = tags.length; i >= 0; i--){ 2173 if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) { 2174 tags[i].parentNode.removeChild(tags[i]); 2175 } 2176 } 2177 } else { 2178 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 2179 tag = UNCODE.insertedSripts[src]; 2180 if (callback){ 2181 if (tag.readyState){ //IE 2182 tag.onreadystatechange = function(){ 2183 if (tag.readyState === "loaded" || 2184 tag.readyState === "complete"){ 2185 tag.onreadystatechange = null; 2186 callback(); 2187 } 2188 }; 2189 } else { 2190 $(tag).on('load', callback); 2191 } 2192 } 2193 return; 2194 } 2195 } 2196 tag = document.createElement('script'); 2197 if (callback){ 2198 if (tag.readyState){ //IE 2199 tag.onreadystatechange = function(){ 2200 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 2201 tag.onreadystatechange = null; 2202 callback(); 2203 } 2204 }; 2205 } else { 2206 tag.onload = function() { 2207 callback(); 2208 }; 2209 } 2210 } 2211 tag.src = src; 2212 var firstScriptTag = document.getElementsByTagName('script')[0]; 2213 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2214 if ( ! UNCODE.insertedSripts ) { 2215 UNCODE.insertedSripts = []; 2216 } 2217 UNCODE.insertedSripts[src] = tag; 2218 }; 2219 // load the youtube api 2220 base.loadYouTubeAPI = function(callback) { 2221 if ( ev === 'uncode-more-items-loaded' ) { 2222 onYouTubeIframeAPIReady(); 2223 } else { 2224 base.insertJS('https://www.youtube.com/player_api', false, 'youtube'); 2225 } 2226 }; 2227 base.loadYouTubePlaylist = function() { 2228 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 2229 }; 2230 // load the vimeo api by replacing the div with an iframe and loading js 2231 base.loadVimeoAPI = function() { 2232 var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0', 2233 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >'); 2234 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 2235 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 2236 base.insertJS('//player.vimeo.com/api/player.js', function() { 2237 vimeoPlayerReady(base.options.id); 2238 }, 'vimeo'); 2239 }; 2240 // is it from youtube or vimeo? 2241 base.determineProvider = function() { 2242 var a = document.createElement('a'); 2243 a.href = base.options.video; 2244 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 2245 var videoid = a.href.split('/')[3].toString(); 2246 var query = videoid.substring(videoid.indexOf('?') + 1); 2247 if (query != '') { 2248 var vars = query.split('&'); 2249 for (var i = 0; i < vars.length; i++) { 2250 var pair = vars[i].split('='); 2251 if (pair[0] == 'v') { 2252 videoid = pair[1]; 2253 } 2254 } 2255 } 2256 return { 2257 "provider": "youtube", 2258 "id": videoid 2259 }; 2260 } else if (/vimeo.com/.test(base.options.video)) { 2261 return { 2262 "provider": "vimeo", 2263 "id": (a.href.split('/')[3].toString()).split('#')[0], 2264 }; 2265 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 2266 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 2267 if (id.length == 11) { 2268 return { 2269 "provider": "youtube", 2270 "id": id.toString() 2271 }; 2272 } else { 2273 for (var i = 0; i < base.options.video.length; i++) { 2274 if (typeof parseInt(base.options.video[i]) !== "number") { 2275 throw 'not vimeo but thought it was for a sec'; 2276 } 2277 } 2278 return { 2279 "provider": "vimeo", 2280 "id": base.options.video 2281 }; 2282 } 2283 } else { 2284 throw "OKVideo: Invalid video source"; 2285 } 2286 }; 2287 base.init(); 2288 }; 2289 2290 var checkResize, 2291 newW = UNCODE.wwidth; 2292 2293 $.okvideo.options = { 2294 id: null, 2295 source: null, // Deprecate dis l8r 2296 video: null, 2297 playlist: { // eat ur heart out @brokyo 2298 list: null, 2299 index: 0, 2300 startSeconds: 0, 2301 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 2302 }, 2303 disableKeyControl: 1, 2304 captions: 0, 2305 loop: 1, 2306 hd: 1, 2307 volume: 0, 2308 adproof: false, 2309 unstarted: null, 2310 onFinished: null, 2311 onReady: null, 2312 onPlay: null, 2313 onPause: null, 2314 buffering: null, 2315 controls: false, 2316 autoplay: true, 2317 annotations: true, 2318 cued: null 2319 }; 2320 $.fn.okvideo = function(options) { 2321 options.target = this; 2322 return this.each(function() { 2323 (new $.okvideo(options)); 2324 }); 2325 }; 2326 2327 var checkForVideos = function(){ 2328 $(".uncode-video-container.video").each(function(index, el) { 2329 var $this = $(this), 2330 mobile_ready = $this.hasClass('no-control-mobile-autoplay'), 2331 url = $this.attr('data-video'), 2332 id = $this.attr('data-id'), 2333 cloned = $this.closest('.owl-item'); 2334 2335 if ( mobile_ready || newW >= UNCODE.mediaQuery ) { 2336 if (!cloned.hasClass('cloned') || cloned.length == 0) { 2337 $this.okvideo({ 2338 id: id, 2339 source: url.split('#')[0], 2340 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 2341 autoplay: 1, 2342 controls: 0, 2343 volume: 0, 2344 adproof: 0, 2345 caller: $this, 2346 hd: 1, 2347 onReady: function(player) { 2348 var getPlayer = player.c || player.h || player, 2349 $iframe, 2350 getContainer = $(getPlayer).closest('.background-element'); 2351 if (getContainer.length) { 2352 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 2353 } 2354 2355 if ( $this.hasClass('drop-move') ) { 2356 2357 var $iframe = $(getPlayer), 2358 w = parseFloat($iframe.attr('width')), 2359 h = parseFloat($iframe.attr('height')), 2360 ratio = h / w, 2361 setResizeiFto, 2362 resizeiFrame = function(){ 2363 var dataW = $this.attr('data-w'), 2364 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2365 newH = newW * ratio; 2366 $iframe.css({ 2367 width: newW, 2368 height: newH 2369 }); 2370 }; 2371 resizeiFrame(); 2372 $(window).on( 'load', resizeiFrame ); 2373 $(window).on( 'resize', function(){ 2374 clearRequestTimeout(setResizeiFto); 2375 setResizeiFto = requestTimeout( function() { 2376 resizeiFrame(); 2377 }, 10 ); 2378 }); 2379 2380 } 2381 2382 } 2383 }); 2384 } 2385 } 2386 }); 2387 }; 2388 2389 checkForVideos(); 2390 2391 $(window).on('load', function(){ 2392 $('.mejs-fullscreen-button button').on('click', function(){ 2393 var $button = $(this), 2394 $stuck = $button.closest('.is_stucked'); 2395 2396 if ( $stuck.length ) { 2397 $stuck = $(this).trigger("sticky_kit:detach"); 2398 window.scrollTo(0, 0); 2399 } 2400 }); 2401 }); 2402 2403 var checkVideoResize = function(){ 2404 clearRequestTimeout(checkResize); 2405 checkResize = requestTimeout(function(){ 2406 if ( newW !== UNCODE.wwidth ) { 2407 newW = UNCODE.wwidth; 2408 checkForVideos(); 2409 } 2410 }, 1000); 2411 }; 2412 2413 $(window).off('resize', checkVideoResize) 2414 .on( 'resize', checkVideoResize); 2415 2416}; 2417 2418UNCODE.backgroundSelfVideos = function( $ctx ) { 2419 2420 var backgroundSelfVideosInit = function( $ctx ) { 2421 if ( SiteParameters.block_mobile_videos === true ) { 2422 return false;
2423 } 2424 if (typeof MediaElement === "function") { 2425 if ( typeof $ctx === 'undefined' ) { 2426 $ctx = document; 2427 } 2428 2429 $(".background-video-shortcode", $ctx).each(function(index, el) { 2430 if ( $(this).closest('mediaelementwrapper').length ) { 2431 return true; 2432 } 2433 var $video_el = $(this), 2434 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 2435 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 2436 video_id = $video_el.attr('id'); 2437 2438 if ( SiteParameters.is_frontend_editor ) { 2439 video_id = video_id + '_' + index; 2440 $video_el.attr('id', video_id); 2441 } 2442 2443 var media = new MediaElement(video_id, { 2444 startVolume: 0, 2445 loop: true, 2446 success: function(mediaElement, domObject) { 2447 domObject.volume = 0; 2448 $(mediaElement).data('started', false); 2449 mediaElement.addEventListener('timeupdate', function(e) { 2450 if (!$(e.target).data('started')) { 2451 $(mediaElement).data('started', true); 2452 } 2453 }); 2454 mediaElement.addEventListener('loadedmetadata', function(e) { 2455 $('body').removeClass('video-not-supported'); 2456 mediaElement.play(); 2457 }); 2458 if (!UNCODE.isMobile) { 2459 requestTimeout(function() { 2460 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 2461 }, 100); 2462 } 2463 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 2464 mediaElement.play(); 2465 } 2466 2467 if ( $parent_drop_move.length ) { 2468 var setResizeMEto, 2469 resizeMediaElement = function(){ 2470 var dataW = $parent_drop_move.attr('data-w'), 2471 videoW = domObject.width, 2472 videoH = domObject.height, 2473 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2474 newH = newW / ( videoW / videoH ); 2475 2476 $(domObject).css({ 2477 'height': newH, 2478 'width': newW 2479 }); 2480 }; 2481 $(window).on( 'resize load', function(){ 2482 clearRequestTimeout(setResizeMEto); 2483 setResizeMEto = requestTimeout( function() { 2484 resizeMediaElement(); 2485 }, 10 ); 2486 }); 2487 } 2488 2489 mediaElement.addEventListener('play', function() { 2490 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2491 $(mediaElement).closest('#page-header').addClass('video-started'); 2492 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2493 }, true); 2494 2495 }, 2496 // fires when a problem is detected 2497 error: function() {} 2498 }); 2499 }); 2500 } else { 2501 2502 if ( typeof $ctx === 'undefined' ) { 2503 $ctx = document; 2504 } 2505 2506 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 2507 Array.from(videos).forEach(function(video_el) { 2508 video_el.addEventListener('loadedmetadata', function(e) { 2509 $('body').removeClass('video-not-supported'); 2510 video_el.play(); 2511 }); 2512 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 2513 video_el.muted = true; 2514 video_el.loop = true; 2515 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2516 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 2517 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2518 $('body').removeClass('video-not-supported'); 2519 video_el.play(); 2520 } else { 2521 requestTimeout(function(){ 2522 backgroundSelfVideosInit( $ctx ); 2523 }, 1000); 2524 } 2525 }); 2526 } 2527 }; 2528 2529 backgroundSelfVideosInit( $ctx ); 2530 2531 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2532 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 2533 var $el = model.view.$el, 2534 shortcode = model.attributes.shortcode; 2535 2536 if (typeof MediaElement === "function") { 2537 backgroundSelfVideosInit( $el ); 2538 } else { 2539 backgroundSelfVideosInit( $el[0] ); 2540 } 2541 }); 2542 } 2543}; 2544 2545UNCODE.is_scrolling = false; 2546 2547UNCODE.disableHoverScroll = function() { 2548 2549 if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) { 2550 var body = document.body, 2551 timer; 2552 2553 window.addEventListener('scroll', function() {
2554 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 2555 clearRequestTimeout(timer); 2556 if ( body.classList && !body.classList.contains('disable-hover') ) { 2557 body.classList.add('disable-hover'); 2558 window.dispatchEvent(new CustomEvent('disable-hover')); 2559 } 2560 UNCODE.is_scrolling = true; 2561 2562 timer = requestTimeout(function() { 2563 if ( body.classList ) { 2564 body.classList.remove('disable-hover'); 2565 window.dispatchEvent(new CustomEvent('enable-hover')); 2566 } 2567 UNCODE.is_scrolling = false; 2568 }, delay); 2569 }, false); 2570 } 2571}; 2572 2573UNCODE.isotopeLayout = function() { 2574 if ($('.isotope-layout').length > 0) { 2575 var isotopeContainersArray = [], 2576 typeGridArray = [], 2577 layoutGridArray = [], 2578 screenLgArray = [], 2579 screenMdArray = [], 2580 screenSmArray = [], 2581 transitionDuration = [], 2582 $filterItems = [], 2583 $filters = $('.isotope-system .isotope-filters'), 2584 $itemSelector = '.tmb-iso', 2585 $items, 2586 itemMargin, 2587 correctionFactor = 0, 2588 firstLoad = true, 2589 isOriginLeft = $('body').hasClass('rtl') ? false : true; 2590 $('[class*="isotope-container"]').each(function(index) { 2591 var _this = $(this); 2592 var isoData = _this.data(), 2593 $data_lg, 2594 $data_md, 2595 $data_sm; 2596 _this.children('.tmb').addClass('tmb-iso'); 2597 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 2598 else $data_lg = '1000'; 2599 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 2600 else $data_md = '600'; 2601 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 2602 else $data_sm = '480'; 2603 screenLgArray.push($data_lg); 2604 screenMdArray.push($data_md); 2605 screenSmArray.push($data_sm); 2606 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 2607 if (isoData.type == 'metro') typeGridArray.push(true); 2608 else typeGridArray.push(false); 2609 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 2610 else layoutGridArray.push('masonry'); 2611 isotopeContainersArray.push(_this); 2612 _this.attr('data-iso-index', index); 2613 }); 2614 var colWidth = function(index) { 2615 $(isotopeContainersArray[index]).width(''); 2616 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 2617 widthAvailable = $(isotopeContainersArray[index]).width(), 2618 columnNum = 12, 2619 columnWidth = 0, 2620 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 2621 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 2622 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 2623 $rowContainer, 2624 paddingRow, 2625 $colContainer, 2626 paddingCol; 2627 2628 if ( consider_menu ) 2629 winHeight = winHeight - UNCODE.menuHeight; 2630 2631 if ( data_vp_height === '1' ) { 2632 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 2633 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2634 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 2635 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 2636 winHeight = winHeight - ( paddingRow + paddingCol ); 2637 } 2638 2639 if (isPx) { 2640 columnWidth = Math.ceil(widthAvailable / columnNum); 2641 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 2642 } else { 2643 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 2644 } 2645 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 2646 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 2647 for (var i = 0, len = $items.length; i < len; i++) { 2648 var $item = $($items[i]), 2649 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 2650 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 2651 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 2652 2653 2654 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 2655 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 2656 } 2657 2658 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 2659 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 2660 } 2661 2662 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 2663 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2664 switch (parseInt(multiplier_w[1])) { 2665 case (5): 2666 case (4): 2667 case (3): 2668 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2669 multiplier_w[1] = 6; 2670 break; 2671 case (2): 2672 case (1): 2673 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 2674 multiplier_w[1] = 3; 2675 break; 2676 default: 2677 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2678 multiplier_w[1] = 12; 2679 break; 2680 } 2681 2682 if (multiplier_w[1] == 2.4) { // 5 columns 2683 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2684 multiplier_w[1] = 6; 2685 } 2686 } 2687 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 2688 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2689 switch (parseInt(multiplier_w[1])) { 2690 case (5): 2691 case (4): 2692 case (3): 2693 case (2): 2694 case (1): 2695 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2696 multiplier_w[1] = 6; 2697 break; 2698 default: 2699 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2700 multiplier_w[1] = 12; 2701 break; 2702 } 2703 2704 if (multiplier_w[1] == 2.4) { // 5 columns 2705 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2706 multiplier_w[1] = 6; 2707 } 2708 } 2709 } else if (widthAvailable < screenSmArray[index]) { 2710 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2711 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2712 multiplier_w[1] = 12; 2713 if (typeGridArray[index]) multiplier_h[1] = 12; 2714 } 2715 } 2716 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 2717 height; 2718 2719 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 2720 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 2721 if ( widthAvailable < screenSmArray[index] ) { 2722 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 2723 } 2724 } else { 2725 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 2726 } 2727 2728 if (width >= widthAvailable) { 2729 $item.css({ 2730 width: widthAvailable 2731 }); 2732 if (typeGridArray[index]) { 2733 $item.children().add($item.find('.backimg')).css({ 2734 height: height 2735 }); 2736 } 2737 } else { 2738 $item.css({ 2739 width: width 2740 }); 2741 if (typeGridArray[index]) { 2742 $item.children().add($item.find('.backimg')).css({ 2743 height: height 2744 }); 2745 } 2746 } 2747 } 2748 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 2749 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 2750 } else { 2751 return columnWidth; 2752 } 2753 }, 2754 init_isotope = function() { 2755 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 2756 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 2757 isotopeId = isotopeSystem.attr('id'), 2758 $layoutMode = layoutGridArray[i], 2759 setIsotopeFirstRowTimeOut, 2760 setIsotopeFirstRow = function(items){ 2761 var firstRow = true; 2762 $(items).each(function(index, val){ 2763 var el = items[index].element, 2764 el_top = items[index].position.y, 2765 $el = $(el); 2766 if ( index > 0 && el_top > 0 && firstRow ) { 2767 firstRow = false;
2768 } else if ( index == 0 && el_top == 0 ) { 2769 firstRow = true; 2770 } 2771 if ( firstRow ) { 2772 $el.removeClass('tmb-isotope-further-row'); 2773 } else { 2774 $el.addClass('tmb-isotope-further-row'); 2775 } 2776 }); 2777 }; 2778 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 2779 //resizable: true, 2780 itemSelector: $itemSelector, 2781 layoutMode: $layoutMode, 2782 transitionDuration: transitionDuration[i], 2783 masonry: { 2784 columnWidth: colWidth(i) 2785 }, 2786 vertical: { 2787 horizontalAlignment: 0.5, 2788 }, 2789 sortBy: 'original-order', 2790 isOriginLeft: isOriginLeft 2791 }) 2792 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 2793 .on('layoutComplete', function( event, items ){ 2794 if ( typeof items[0] !== 'undefined' ) { 2795 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2796 setIsotopeFirstRow(items); 2797 } 2798 } 2799 }) 2800 .on('arrangeComplete', function( event, items ){ 2801 if ( typeof items[0] !== 'undefined' ) { 2802 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2803 clearRequestTimeout(setIsotopeFirstRowTimeOut); 2804 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 2805 setIsotopeFirstRow(items); 2806 }, 100); 2807 } 2808 } 2809 }); 2810 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 2811 $(isotopeContainersArray[i]).infinitescroll({ 2812 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 2813 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 2814 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 2815 animate: false, 2816 behavior: 'local', 2817 debug: false, 2818 loading: { 2819 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 2820 speed: 0, 2821 finished: undefined, 2822 msg: $('#' + isotopeId + ' .loadmore-button'), 2823 }, 2824 errorCallback: function() { 2825 var isotope_system = $(this).closest('.isotope-system'); 2826 $('.loading-button', isotope_system).hide(); 2827 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 2828 } 2829 }, 2830 // append the new items to isotope on the infinitescroll callback function. 2831 function(newElements, opts) { 2832 var $isotope = $(this), 2833 isotope_system = $isotope.closest('.isotope-system'), 2834 isotopeId = isotope_system.attr('id'), 2835 filters = new Array(), 2836 $loading_button = isotope_system.find('.loading-button'), 2837 $infinite_button = isotope_system.find('.loadmore-button'), 2838 $numPages = $('a', $infinite_button).data('pages'), 2839 $woo_results, 2840 delay = 300; 2841 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 2842 $infinite_button.show(); 2843 $loading_button.hide(); 2844 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 2845 $('> li', $isotope).remove(); 2846 $('.isotope-container').find('.woocommerce-result-count-wrapper').remove(); 2847 $.each($(newElements), function (index, val) { 2848 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 2849 $woo_results = $(val); 2850 delete newElements[index]; 2851 } else { 2852 $(val).addClass('tmb-iso'); 2853 if ($(val).is("li")) { 2854 filters.push($(val)[0]); 2855 } 2856 } 2857 $(val).addClass('uncode-appended'); 2858 }); 2859 newElements = newElements.filter(function(x) { 2860 return filters.indexOf(x) < 0 2861 }); 2862 $.each($(filters), function(index, val) { 2863 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 2864 }); 2865 if ($woo_results && $woo_results.length > 0) { 2866 var old_count = isotope_system.find('.woocommerce-result-count').text(); 2867 var new_count = $woo_results.find('.woocommerce-result-count').text(); 2868 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 2869 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 2870 function replaceMatch(match, p1, p2) { 2871 return old_start + '–' + new_end; 2872 } 2873 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 2874 isotope_system.find('.woocommerce-result-count').text(new_count_text); 2875 } 2876 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 2877 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2878 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 2879 if (typeof getLightbox === 'object') { 2880 getLightbox.refresh(); 2881 } else { 2882 UNCODE.lightbox(); 2883 } 2884 } 2885 if ( typeof twttr !== 'undefined' ) 2886 twttr.widgets.load(isotopeContainersArray[i]); 2887 2888 requestTimeout(function() { 2889 Waypoint.refreshAll(); 2890 $isotope.trigger('more-items-loaded'); 2891 $(window).trigger('more-items-loaded'); 2892 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 2893 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 2894 $(document).trigger('uncode-scrolltrigger-refresh'); 2895 } 2896 }, 1000); 2897 2898 }); 2899 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 2900 var $infinite_isotope = $(isotopeContainersArray[i]), 2901 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 2902 $infinite_isotope.infinitescroll('pause'); 2903 $infinite_button.on('click', function(event) { 2904 event.preventDefault(); 2905 var $infinite_system = $(event.target).closest('.isotope-system'), 2906 $infinite_isotope = $infinite_system.find('.isotope-container'), 2907 isotopeId = $infinite_system.attr('id'); 2908 $(event.currentTarget).html(SiteParameters.loading); 2909 $infinite_isotope.infinitescroll('resume'); 2910 $infinite_isotope.infinitescroll('retrieve'); 2911 $infinite_isotope.infinitescroll('pause'); 2912 }); 2913 } 2914 } 2915 } 2916 }, 2917 onLayout = function(isotopeObj, startIndex, needsReload) { 2918 var needsReload = needsReload ? true : false;
2919 2920 if (typeof UNCODE.bigText !== 'undefined') { 2921 UNCODE.bigText(); 2922 } 2923 isotopeObj.css('opacity', 1); 2924 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 2925 2926 requestTimeout(function() { 2927 if (startIndex > 0) { 2928 reloadIsotope(isotopeObj); 2929 if (SiteParameters.dynamic_srcset_active === '1') { 2930 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2931 UNCODE.adaptive_srcset(isotopeObj); 2932 } 2933 // window.dispatchEvent(UNCODE.boxEvent); 2934 } else if (needsReload) { 2935 reloadIsotope(isotopeObj); 2936 } 2937 2938 UNCODE.adaptive(); 2939 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 2940 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2941 } 2942 if (typeof MediaElement === "function") { 2943 $(isotopeObj).find('audio,video').each(function() { 2944 $(this).mediaelementplayer({ 2945 pauseOtherPlayers: false, 2946 }); 2947 }); 2948 } 2949 if ($(isotopeObj).find('.nested-carousel').length) { 2950 if (typeof UNCODE.carousel !== 'undefined') { 2951 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 2952 } 2953 requestTimeout(function() { 2954 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2955 }, 200); 2956 } else { 2957 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2958 } 2959 isotopeObj.trigger('isotope-layout-complete'); 2960 2961 }, 100); 2962 2963 }, 2964 boxAnimation = function(items, startIndex, sequential, container) { 2965 var $allItems = items.length - startIndex, 2966 showed = 0, 2967 index = 0; 2968 if (container.closest('.owl-item').length == 1) return false; 2969 $.each(items, function(index, val) { 2970 var $this = $(val), 2971 elInner = $('> .t-inside', val); 2972 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2973 return; 2974 } 2975 if (val[0]) val = val[0]; 2976 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 2977 new Waypoint({ 2978 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2979 element: val, 2980 handler: function() { 2981 var element = $('> .t-inside', this.element), 2982 parent = $(this.element), 2983 currentIndex = parent.index(); 2984 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 2985 delayAttr = parseInt(element.attr('data-delay')); 2986 if (isNaN(delayAttr)) delayAttr = 100; 2987 delay -= showed; 2988 var objTimeout = requestTimeout(function() { 2989 element.removeClass('zoom-reverse').addClass('start_animation'); 2990 showed = parent.index(); 2991 if ( container.data('isotope') ) { 2992 container.isotope('layout'); 2993 } 2994 }, delay * delayAttr) 2995 parent.data('objTimeout', objTimeout); 2996 if (!UNCODE.isUnmodalOpen) { 2997 this.destroy(); 2998 } 2999 }, 3000 offset: '100%' 3001 }) 3002 } else { 3003 if (elInner.hasClass('force-anim')) { 3004 elInner.addClass('start_animation'); 3005 } else { 3006 elInner.css('opacity', 1); 3007 } 3008 container.isotope('layout'); 3009 } 3010 3011 index++; 3012 }); 3013 }, 3014 reloadIsotope = function(isotopeObj) { 3015 var isoIndex = $(isotopeObj).attr('data-iso-index'); 3016 var $layoutMode = ($(isotopeObj).data('layout')); 3017 if ($layoutMode === undefined) { 3018 $layoutMode = 'masonry'; 3019 } 3020 if (isotopeObj.data('isotope')) { 3021 isotopeObj.isotope({ 3022 itemSelector: $itemSelector, 3023 layoutMode: $layoutMode, 3024 transitionDuration: transitionDuration[isoIndex], 3025 masonry: { 3026 columnWidth: colWidth(isoIndex) 3027 }, 3028 vertical: { 3029 horizontalAlignment: 0.5, 3030 }, 3031 sortBy: 'original-order', 3032 isOriginLeft: isOriginLeft 3033 }); 3034 } 3035 } 3036 ; 3037 if ($('.isotope-pagination').length > 0) { 3038 $('.isotope-system').on('click', '.pagination a', function(evt) { 3039 evt.preventDefault(); 3040 3041 if (SiteParameters.index_pagination_disable_scroll !== '1') { 3042 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 3043 container = $(this).closest('.isotope-system'), 3044 pagination_disable_scroll = container.attr('data-pagination-scroll'), 3045 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 3046 calc_scroll -= UNCODE.get_scroll_offset(); 3047 3048 if ( pagination_disable_scroll === 'disabled' ) { 3049 return; 3050 } 3051 3052 var menu_container = $('.menu-sticky'); 3053 var menu = menu_container.find('.menu-container'); 3054 3055 if (menu_container.length > 0 && menu.length > 0) { 3056 calc_scroll = calc_scroll - menu.outerHeight(); 3057 } 3058 3059 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3060 delta = bodyTop - calc_scroll, 3061 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 3062 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3063 3064 if (!UNCODE.isFullPage) { 3065 if (scrollSpeed == 0) { 3066 $('html, body').scrollTop(calc_scroll); 3067 } else { 3068 $('html, body').animate({ 3069 scrollTop: calc_scroll 3070 }, {
3071 easing: 'easeInOutQuad', 3072 duration: scrollSpeed, 3073 complete: function () { 3074 UNCODE.scrolling = false; 3075 } 3076 }); 3077 } 3078 } 3079 } 3080 3081 loadIsotope($(this), true); 3082 }); 3083 } 3084 $filters.on('click', 'a.isotope-nav-link', function(evt) { 3085 if ($(this).hasClass('no-isotope-filter')) { 3086 return; 3087 } 3088 var $filter = $(this), 3089 filterContainer = $filter.closest('.isotope-filters'), 3090 filterValue = $filter.attr('data-filter'), 3091 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 3092 transitionDuration = container.data().isotope.options.transitionDuration, 3093 delay = 300, 3094 filterItems = []; 3095 3096 var filter_items = function(){ 3097 if (filterValue !== undefined) { 3098 container.addClass('grid-filtering'); 3099 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 3100 var parent = $(val).parent(), 3101 objTimeout = parent.data('objTimeout'); 3102 if (objTimeout) { 3103 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3104 clearRequestTimeout(objTimeout); 3105 } 3106 if (transitionDuration == 0) { 3107 if ($(val).hasClass('animate_when_almost_visible')) { 3108 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3109 } else { 3110 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 3111 } 3112 } 3113 }); 3114 requestTimeout(function(){ 3115 if ( filterValue == '*' ) { 3116 container.removeClass('isotope-filtered'); 3117 } else { 3118 container.addClass('isotope-filtered'); 3119 } 3120 container.isotope({ 3121 filter: function() { 3122 var block = $(this), 3123 filterable = (filterValue == '*') || block.hasClass(filterValue), 3124 lightboxElements = $('[data-lbox^=ilightbox]', block); 3125 if (filterable) { 3126 if (lightboxElements.length) { 3127 lightboxElements.removeClass('lb-disabled'); 3128 container.data('lbox', $(lightboxElements[0]).data('lbox')); 3129 } 3130 filterItems.push(block); 3131 } else { 3132 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 3133 } 3134 container.trigger('more-items-loaded'); 3135 $(window).trigger('more-items-loaded'); 3136 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 3137 return filterable; 3138 } 3139 }); 3140 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 3141 3142 }, delay); 3143 3144 /** once filtered - start **/ 3145 container.isotope('once', 'arrangeComplete', function() { 3146 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3147 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 3148 if (typeof getLightbox === 'object') { 3149 getLightbox.refresh(); 3150 } else { 3151 UNCODE.lightbox(); 3152 } 3153 } 3154 if (transitionDuration == 0) { 3155 requestTimeout(function() { 3156 boxAnimation(filterItems, 0, false, container); 3157 }, 100); 3158 } 3159 requestTimeout(function() { 3160 Waypoint.refreshAll(); 3161 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 3162 $(document).trigger('uncode-scrolltrigger-refresh'); 3163 } 3164 container.removeClass('grid-filtering'); 3165 }, 2000); 3166 }); 3167 /** once filtered - end **/ 3168 } else { 3169 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3170 $.each(UNCODE.lightboxArray, function(index, val) { 3171 UNCODE.lightboxArray[index].destroy(); 3172 }); 3173 } 3174 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 3175 var parent = $(val).parent(), 3176 objTimeout = parent.data('objTimeout'); 3177 if (objTimeout) { 3178 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3179 clearRequestTimeout(objTimeout); 3180 } 3181 if (transitionDuration == 0) { 3182 if ($(val).hasClass('animate_when_almost_visible')) { 3183 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3184 } else { 3185 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 3186 } 3187 } 3188 }); 3189 container.parent().addClass('grid-loading'); 3190 loadIsotope($filter); 3191 } 3192 }; 3193 3194 if (!$filter.hasClass('active')) { 3195 /** Scroll top with filtering */ 3196 if (filterContainer.hasClass('filter-scroll')) { 3197 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 3198 calc_scroll -= UNCODE.get_scroll_offset(); 3199 3200 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3201 delta = bodyTop - calc_scroll, 3202 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 3203 filterTolerance = false, 3204 filter_timeout; 3205 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3206 3207 if ( !UNCODE.isFullPage ) { 3208 if (scrollSpeed == 0) { 3209 $('html, body').scrollTop(calc_scroll); 3210 UNCODE.scrolling = false;
3211 filter_items(); 3212 } else { 3213 3214 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 3215 filter_items(); 3216 filterTolerance = true; 3217 } 3218 3219 $('html, body').animate({ 3220 scrollTop: calc_scroll 3221 },{ 3222 easing: 'easeInOutQuad', 3223 duration: scrollSpeed, 3224 complete: function(){ 3225 UNCODE.scrolling = false; 3226 if ( !filterTolerance ) { 3227 filter_timeout = setTimeout(function(){ 3228 clearTimeout(filter_timeout); 3229 filter_items(); 3230 }, 200); 3231 } 3232 } 3233 }); 3234 } 3235 } 3236 } else { 3237 filter_items(); 3238 } 3239 } 3240 evt.preventDefault(); 3241 }); 3242 3243 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 3244 var params = UNCODE.getURLParams(window.location); 3245 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 3246 3247 UNCODE.lastURL = window.location.href; 3248 3249 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 3250 return; 3251 } 3252 3253 if (params.id === undefined) { 3254 $.each($('.isotope-system'), function(index, val) { 3255 loadIsotope($(val)); 3256 }); 3257 } else { 3258 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 3259 loadIsotope($('#' + params.id)); 3260 } 3261 } 3262 }); 3263 3264 var loadIsotope = function($href, $paginating) { 3265 var is_paginating = false; 3266 3267 if (undefined !== $paginating && $paginating) { 3268 var is_paginating = $paginating; 3269 } 3270 3271 var href = ($href.is("a") ? $href.attr('href') : location), 3272 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 3273 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 3274 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 3275 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 3276 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 3277 isotopeId = isotopeSystem.attr('id'); 3278 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 3279 UNCODE.lastURL = href; 3280 history.pushState({ 3281 myIsotope: true 3282 }, document.title, href); 3283 } 3284 if (is_paginating) { 3285 isotopeWrapper.addClass('grid-filtering'); 3286 } 3287 $.ajax({ 3288 url: href 3289 }).done(function(data) { 3290 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 3291 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 3292 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 3293 isotopeWrapper.addClass('isotope-reloaded'); 3294 requestTimeout(function() { 3295 isotopeWrapper.removeClass('grid-loading'); 3296 isotopeWrapper.removeClass('isotope-reloaded'); 3297 isotopeWrapper.removeClass('grid-filtering'); 3298 }, 500); 3299 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 3300 var parent = $(val).parent(), 3301 objTimeout = parent.data('objTimeout'); 3302 if (objTimeout) { 3303 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3304 clearRequestTimeout(objTimeout); 3305 } 3306 if ($(val).hasClass('animate_when_almost_visible')) { 3307 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3308 } else { 3309 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 3310 } 3311 }); 3312 requestTimeout(function() { 3313 if (isotopeContainer.data('isotope')) { 3314 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 3315 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 3316 UNCODE.adaptive(); 3317 if (SiteParameters.dynamic_srcset_active === '1') { 3318 UNCODE.adaptive_srcset(isotopeContainer); 3319 } 3320 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3321 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 3322 if (typeof getLightbox === 'object') { 3323 getLightbox.refresh(); 3324 } else { 3325 UNCODE.lightbox(); 3326 } 3327 } 3328 } 3329 isotopeContainer.trigger('more-items-loaded'); 3330 $(window).trigger('more-items-loaded'); 3331 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 3332 }, 300); 3333 $('.pagination', isotopeFooter).remove(); 3334 isotopeFooter.append($resultPagination); 3335 3336 if (isotopeResultCount.length > 0) { 3337 $('.woocommerce-result-count', isotopeResultCount).remove(); 3338 isotopeResultCount.append($resultCount); 3339 } 3340 }); 3341 }; 3342 $filters.each(function(i, buttonGroup) { 3343 var $buttonGroup = $(buttonGroup); 3344 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 3345 $buttonGroup.find('.active').removeClass('active'); 3346 $(this).addClass('active'); 3347 3348 }); 3349 3350 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 3351 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 3352 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 3353 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 3354 e.preventDefault(); 3355 $cats_filters.slideToggle(400, 'easeInOutCirc'); 3356 }); 3357 3358 }); 3359 window.addEventListener('boxResized', function(e) { 3360 if (UNCODE.printDialogOpen !== false) { 3361 return false;
3362 } 3363 $.each($('.isotope-layout'), function(index, val) { 3364 var $layoutMode = ($(this).data('layout')); 3365 if ($layoutMode === undefined) $layoutMode = 'masonry'; 3366 if ($(this).data('isotope')) { 3367 $(this).isotope({ 3368 itemSelector: $itemSelector, 3369 layoutMode: $layoutMode, 3370 transitionDuration: transitionDuration[index], 3371 masonry: { 3372 columnWidth: colWidth(index) 3373 }, 3374 vertical: { 3375 horizontalAlignment: 0.5, 3376 }, 3377 sortBy: 'original-order', 3378 isOriginLeft: isOriginLeft 3379 }); 3380 $(this).isotope('unbindResize'); 3381 if (SiteParameters.dynamic_srcset_active === '1') { 3382 UNCODE.refresh_dynamic_srcset_size($(this)); 3383 } 3384 } 3385 $(this).find('.mejs-video,.mejs-audio').each(function() { 3386 $(this).trigger('resize'); 3387 }); 3388 }); 3389 }, false); 3390 3391 init_isotope(); 3392 }; 3393} 3394 3395UNCODE.lightbox = function() { 3396 if ( SiteParameters.lbox_enhanced ) { 3397 return true; 3398 } 3399 UNCODE.lightboxArray = {}; 3400 requestTimeout(function() { 3401 var groupsArr = {}; 3402 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 3403 var group = this.getAttribute("data-lbox"), 3404 values = $(this).data(); 3405 $(this).attr('data-lbox-init','true') 3406 groupsArr[group] = values; 3407 }); 3408 for (var i in groupsArr) { 3409 var skin = groupsArr[i].skin || 'black', 3410 path = groupsArr[i].dir || 'horizontal', 3411 thumbs = !groupsArr[i].notmb || false, 3412 arrows = !groupsArr[i].noarr || false, 3413 social = groupsArr[i].social || false, 3414 deeplink = groupsArr[i].deep || false, 3415 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 3416 counter = $els.length, 3417 dataAlbum = $els.attr('data-album'); 3418 if (social) social = { 3419 facebook: true, 3420 twitter: true, 3421 reddit: true, 3422 digg: true 3423 }; 3424 UNCODE.lightboxArray[i] = $els.iLightBox({ 3425 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 3426 skin: skin, 3427 path: path, 3428 linkId: deeplink, 3429 infinite: false, 3430 //fullViewPort: 'fit', 3431 smartRecognition: false, 3432 fullAlone: true, 3433 maxScale: 1, 3434 minScale: .02, 3435 //fullStretchTypes: 'flash, video', 3436 overlay: { 3437 opacity: .94 3438 }, 3439 controls: { 3440 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 3441 fullscreen: true, 3442 thumbnail: thumbs, 3443 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 3444 }, 3445 show: { 3446 speed: 200 3447 }, 3448 hide: { 3449 speed: 200 3450 }, 3451 social: { 3452 start: false, 3453 buttons: social 3454 }, 3455 caption: { 3456 start: false 3457 }, 3458 styles: { 3459 nextOpacity: 1, 3460 nextScale: 1, 3461 prevOpacity: 1, 3462 prevScale: 1 3463 }, 3464 effects: { 3465 switchSpeed: 400 3466 }, 3467 slideshow: { 3468 pauseTime: 5000 3469 }, 3470 thumbnails: { 3471 maxWidth: 60, 3472 maxHeight: 60, 3473 activeOpacity: .2 3474 }, 3475 html5video: { 3476 preload: true 3477 }, 3478 callback: { 3479 onOpen: function(){ 3480 $(window).trigger('uncode-custom-cursor'); 3481 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3482 iNoBounce.enable(); 3483 } 3484 }, 3485 onHide: function(){ 3486 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3487 iNoBounce.disable() 3488 } 3489 }, 3490 } 3491 }); 3492 3493 $(document).on('infinite-loaded', function(){ 3494 UNCODE.lightboxArray[i].refresh(); 3495 }); 3496 3497 $(window).on('gdprOpen', function(){ 3498 UNCODE.lightboxArray[i].close(); 3499 }); 3500 }; 3501 }, 100); 3502 3503 $(document).on('click', '.lb-disabled', function(e){ 3504 e.preventDefault(); 3505 }); 3506}; 3507 3508UNCODE.lightgallery = function( $el ) { 3509 var createSelectors = function(){ 3510 $('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){ 3511 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3512 $(this).addClass('lbox-trigger-item'); 3513 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3514 $(this).addClass('lbox-nested-item'); 3515 } else { 3516 $(this).removeClass('lbox-trigger-item'); 3517 $(this).removeClass('lbox-nested-item'); 3518 } 3519 }); 3520 }; 3521 3522 createSelectors(); 3523 3524 var galleries = [], 3525 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3526 return !$(this).closest('.nested-carousel').length; 3527 }), 3528 $_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .linear-container:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box .icon-box-icon:not([data-lbox-init]), .icon-box .icon-box-content:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container:not([data-lbox-init])' + SiteParameters.uncode_lb_add_galleries).has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *, .linear-container *'), 3529 $galleries = $_galleries.filter(function( index ) { 3530 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3531 }), 3532 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 3533 3534 if ( typeof $el === 'undefined' ) { 3535 $el = $galleries.add( $nested ); 3536 } 3537 3538 var $disabled = $('a.lb-disabled'); 3539 $disabled.on('click', function(e){ 3540 e.preventDefault(); 3541 }); 3542 3543 var beforeSlide = function(event) { 3544 var detail = event.detail, 3545 info = detail.info, 3546 item = detail.item, 3547 $slide = $(detail.currentSlide.selector), 3548 $video = $('video', $slide), 3549 $previous = $(detail.previousSlide.selector), 3550 $prevVideo = $('video', $previous), 3551 isAudio = false;
3552 3553 if ( typeof info.src !== 'undefined' ) { 3554 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 3555 } 3556 3557 if ( ! $video.length && ( info.video || isAudio ) ) { 3558 if ( info.video ) { 3559 if ( typeof info.video === 'object' ) { 3560 var infoJson = info.video; 3561 } else { 3562 var infoJson = JSON.parse(info.video); 3563 } 3564 var src = infoJson.source[0].src, 3565 autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes', 3566 muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes', 3567 loop = $(item).attr('data-loop'); 3568 3569 } else if ( isAudio ) { 3570 var src = info.src, 3571 autoplay = true, 3572 loop = false; 3573 } 3574 if ( typeof src !== 'undefined' ) { 3575 $slide.addClass('has-html5'); 3576 var video = document.createElement('video'); 3577 video.src = src; 3578 video.preload = 'auto'; 3579 video.controls = 'controls'; 3580 video.controlsList = 'nodownload'; 3581 if ( autoplay ) { 3582 video.autoplay = 'autoplay'; 3583 } 3584 if ( muted ) { 3585 video.muted = 'muted'; 3586 } 3587 if ( loop ) { 3588 video.loop = 'loop'; 3589 } 3590 $(video).appendTo($slide); 3591 } 3592 } else { 3593 var $video = $('video', $slide); 3594 if ( $video.length ) { 3595 $video[0].currentTime = 0; 3596 if ( $video[0].autoplay ) { 3597 $video[0].play(); 3598 } 3599 } 3600 } 3601 if ( $prevVideo.length ) { 3602 $prevVideo[0].currentTime = 0; 3603 $prevVideo[0].pause(); 3604 } 3605 }; 3606 3607 var beforeOpen = function(event) { 3608 var detail = event.detail, 3609 items = detail.items, 3610 galleryItems = detail.galleryItems, 3611 outer = detail.outer.selector, 3612 i, ii; 3613 for ( i = 0; i < galleryItems.length; i++ ) { 3614 var item = galleryItems[i]; 3615 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 3616 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 3617 } 3618 } 3619 for ( ii = 0; ii < items.length; ii++ ) { 3620 var item = items[ii]; 3621 if ( $(item).attr('data-icon') === 'video' ) { 3622 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 3623 } 3624 } 3625 3626 }; 3627 3628 //caption builder 3629 var captionBuilder = function($el){ 3630 $el.each( function( index, val ) { 3631 var $gallery = $(this).attr('data-lbox-init','true'), 3632 $_a = '.lbox-trigger-item', 3633 $_nested_a = '.lbox-nested-item'; 3634 3635 $gallery.find($_a, $_nested_a).each(function(){ 3636 var $a = $(this), 3637 $img = $('img', $a).first(), 3638 imgw = $img.attr('data-width'), 3639 imgh = $img.attr('data-height'), 3640 caption = $a.attr('data-caption'), 3641 title = $a.attr('data-title'); 3642 3643 if ( $img.length && $img.attr('data-crop') != true ) { 3644 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 3645 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 3646 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 3647 $a.attr('data-external-thumb-image', $img[0].src); 3648 } 3649 } 3650 3651 if ( typeof title !== 'undefined' && title !== '' ) { 3652 title = '<h6>' + title + '</h6>'; 3653 } else { 3654 title = ''; 3655 } 3656 3657 if ( typeof caption !== 'undefined' && caption !== '' ) { 3658 caption = '<p>' + caption + '</p>'; 3659 title += caption; 3660 } 3661 3662 if ( title !== '' ) { 3663 $a.attr( 'title', title ); 3664 } 3665 3666 if ( $img.attr('data-crop') != true && typeof imgw !== 'undefined' && typeof imgh !== 'undefined' && imgw !== '' && imgh !== '' && ( typeof $a.attr('data-lg-size') === 'undefined' || !$a.attr('data-lg-size') ) ) { 3667 $a.attr('data-lg-size', imgw + '-' + imgh); 3668 } 3669 }); 3670 }); 3671 }; 3672 captionBuilder($el); 3673 3674 //regular galleries 3675 $el.each( function( index, val ) { 3676 var $gallery = $(this), 3677 $_a = '.lbox-trigger-item', 3678 $_nested_a = '.lbox-nested-item', 3679 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 3680 galleryID = $_first.attr('data-lbox'), 3681 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 3682 tmb = $_first.attr('data-notmb'), 3683 social = $_first.attr('data-social'), 3684 deep = $_first.attr('data-deep'), 3685 zoom = $_first.attr('data-zoom-origin'), 3686 actual = $_first.attr('data-actual-size'), 3687 download = $_first.attr('data-download'), 3688 controls = $_first.attr('data-arrows') !== 'no', 3689 fullScreen = $_first.attr('data-full'),
3690 counter = $_first.attr('data-counter'), 3691 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 3692 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3693 connect = $_first.attr('data-connect'), 3694 lgPlugins = [lgVideo], 3695 itemsLoadedTimeOut; 3696 3697 if ( typeof galleryID === 'undefined' ) { 3698 galleryID = $gallery.attr('id'); 3699 } 3700 3701 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3702 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3703 3704 if ( typeof tmb == 'undefined' || !tmb ) { 3705 lgPlugins.push(lgThumbnail); 3706 } 3707 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 3708 lgPlugins.push(lgZoom); 3709 } 3710 if ( typeof deep != 'undefined' && deep != '' ) { 3711 lgPlugins.push(lgHash); 3712 } 3713 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3714 lgPlugins.push(lgFullscreen); 3715 } 3716 if ( social ) { 3717 lgPlugins.push(lgShare); 3718 } 3719 3720 if ( galleries.indexOf( galleryID ) !== -1 ) { 3721 return true; 3722 } 3723 3724 galleries.push( galleryID ); 3725 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 3726 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 3727 var gallery = lightGallery( $triggerGal[0], { 3728 addClass: containerClass, 3729 plugins: lgPlugins, 3730 mode: transition, 3731 selector: $selector, 3732 galleryId: galleryID, 3733 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3734 iframeWidth: '848px', 3735 iframeMaxWidth: '90%', 3736 iframeMaxHeight: '90%', 3737 exThumbImage: 'data-external-thumb-image', 3738 loadYouTubeThumbnail: false, 3739 autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ), 3740 // autoplayFirstVideo: false, 3741 pager: false, 3742 startClass: 'lg-start-opacity', 3743 zoomFromOrigin: zoom, 3744 controls: controls, 3745 download: ( typeof download != 'undefined' && download != '' ), 3746 thumbWidth: 50, 3747 thumbHeight: '50px', 3748 counter: $triggerGal.find($selector).length > 1 ? counter : false, 3749 loadYouTubePoster: false, 3750 enableDrag: $triggerGal.find($selector).length > 1, 3751 mobileSettings: { 3752 showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true, 3753 }, 3754 }); 3755 3756 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 3757 e.preventDefault(); 3758 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 3759 gallery.openGallery(index-1); 3760 }); 3761 3762 $triggerGal.on('more-items-loaded', function(e, items) { 3763 clearRequestTimeout(itemsLoadedTimeOut); 3764 itemsLoadedTimeOut = requestTimeout(function(){ 3765 createSelectors(); 3766 captionBuilder($triggerGal); 3767 gallery.refresh(); 3768 }, 100); 3769 }); 3770 3771 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3772 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3773 $el = model.view.$el; 3774 if ( $el.find($triggerGal).length ) { 3775 gallery.destroy(); 3776 } 3777 }); 3778 } 3779 3780 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 3781 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 3782 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 3783 $(window).trigger('uncode-custom-cursor'); 3784 }); 3785 3786 }); 3787 3788 if ( typeof $el !== 'undefined' ) { 3789 3790 //album galleries 3791 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 3792 var album = val, 3793 galleryID = index, 3794 $album = $(album), 3795 params = $album.attr('data-album'), 3796 tmb = $(val).attr('data-notmb'), 3797 social = $(val).attr('data-social'), 3798 deep = $(val).attr('data-deep'), 3799 actual = $(val).attr('data-actual-size'), 3800 download = $(val).attr('data-download'), 3801 controls = $(val).attr('data-arrows') !== 'no', 3802 fullScreen = $(val).attr('data-full'), 3803 counter = $(val).attr('data-counter'), 3804 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 3805 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3806 lgPlugins = [lgVideo]; 3807 3808 $(val).attr('data-lbox-init','true'); 3809 3810 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3811 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3812 3813 if ( typeof tmb == 'undefined' || !tmb ) { 3814 lgPlugins.push(lgThumbnail); 3815 } 3816 if ( typeof actual != 'undefined' && actual != '' ) { 3817 lgPlugins.push(lgZoom); 3818 } 3819 if ( typeof deep != 'undefined' && deep != '' ) { 3820 lgPlugins.push(lgHash); 3821 } 3822 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3823 lgPlugins.push(lgFullscreen); 3824 } 3825 if ( social ) { 3826 lgPlugins.push(lgShare); 3827 } 3828 3829 var gallery = window.lightGallery(album, { 3830 dynamic: true, 3831 plugins: lgPlugins, 3832 dynamicEl: JSON.parse(params), 3833 galleryId: galleryID, 3834 addClass: containerClass, 3835 mode: transition, 3836 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3837 iframeWidth: '848px', 3838 iframeMaxWidth: '90%', 3839 iframeMaxHeight: '90%', 3840 loadYouTubeThumbnail: false, 3841 autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ), 3842 // autoplayFirstVideo: false, 3843 pager: false, 3844 startClass: 'lg-start-opacity', 3845 zoomFromOrigin: false, 3846 controls: controls, 3847 download: ( typeof download != 'undefined' && download != '' ), 3848 thumbWidth: 50, 3849 thumbHeight: '50px', 3850 loadYouTubePoster: false, 3851 counter: counter, 3852 exThumbImage: 'data-external-thumb-image', 3853 loadYouTubePoster: false, 3854 mobileSettings: { 3855 showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true, 3856 }, 3857 }); 3858 3859 $album.on('click', function(){ 3860 gallery.openGallery(0); 3861 }); 3862 3863 album.addEventListener('lgBeforeSlide', beforeSlide); 3864 album.addEventListener('lgBeforeOpen', beforeOpen); 3865 album.addEventListener('lgAfterOpen', function(){ 3866 $(window).trigger('uncode-custom-cursor'); 3867 }); 3868 3869 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3870 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3871 $el = model.view.$el; 3872 if ( $el.find($album).length ) { 3873 gallery.destroy(); 3874 } 3875 }); 3876 } 3877 3878 }); 3879 3880 //single images 3881 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 3882 var gallery = lightGallery( $('.page-wrapper')[0], { 3883 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 3884 iframeWidth: '848px', 3885 iframeMaxWidth: '90%', 3886 iframeMaxHeight: '90%', 3887 loadYouTubeThumbnail: false, 3888 // autoplayFirstVideo: false, 3889 startClass: 'lg-start-opacity', 3890 thumbWidth: 50, 3891 thumbHeight: '50px', 3892 download: false, 3893 loadYouTubePoster: false, 3894 counter: false 3895 }); 3896 3897 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 3898 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 3899 }); 3900 } 3901}; 3902 3903UNCODE.carousel = function(container) { 3904 var $owlContainers = $('.owl-carousel-container', container); 3905 $owlContainers.each(function() { 3906 var $owlContainer = $(this), 3907 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 3908 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 3909 values = {}, 3910 tempTimeStamp, 3911 newWidth = UNCODE.wwidth, 3912 $owlInsideEqual = []; 3913 $owlSelector.each(function() { 3914 var itemID = $(this).attr('id'), 3915 $elSelector = $(('#' + itemID).toString()); 3916 values['id'] = itemID; 3917 values['items'] = 1;
3918 values['columns'] = 3; 3919 values['fade'] = false; 3920 values['nav'] = false; 3921 values['navmobile'] = false; 3922 values['navskin'] = 'light'; 3923 values['navspeed'] = 400; 3924 values['dots'] = false; 3925 values['dotsmobile'] = false; 3926 values['loop'] = false; 3927 values['autoplay'] = false; 3928 values['timeout'] = 3000; 3929 values['autoheight'] = false; 3930 values['stagepadding'] = 0; 3931 values['margin'] = 0; 3932 values['lg'] = 1; 3933 values['md'] = 1; 3934 values['sm'] = 1; 3935 $.each($(this).data(), function(i, v) { 3936 values[i] = v; 3937 }); 3938 3939 if ($(this).closest('.uncode-slider').length) { 3940 values['navskin'] = ''; 3941 values['navmobile'] = false; 3942 //values['dotsmobile'] = true; 3943 } else { 3944 values['navskin'] = ' style-'+values['navskin']+' style-override'; 3945 } 3946 3947 var setIndexActive = function(event, init){ 3948 var init = typeof init === 'undefined' ? false : init, 3949 thiis = $(event.currentTarget); 3950 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 3951 var scrolltop = $(document).scrollTop(), 3952 size = event.page.size, 3953 i; 3954 var setIndex = requestTimeout(function() { 3955 for ( i = 0; i < size; i++ ) { 3956 var itemCont = event.item.index != null ? (event.item.index + i) : i; 3957 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 3958 if (thiis.closest('.row-slider').length) { 3959 if (currentItem == undefined) { 3960 currentItem = thiis.children()[i]; 3961 } 3962 if ($(currentItem).closest('#page-header').length) { 3963 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3964 UNCODE.switchColorsMenu(scrolltop, 'dark'); 3965 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3966 UNCODE.switchColorsMenu(scrolltop, 'light'); 3967 } 3968 } 3969 var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit'); 3970 if (owlCustomNav.length) { 3971 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3972 owlCustomNav.addClass('style-dark').removeClass('style-light'); 3973 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3974 owlCustomNav.addClass('style-light').removeClass('style-dark'); 3975 } 3976 } 3977 } 3978 var itendIndex = $(currentItem).attr('data-index'); 3979 if ( isNaN(itendIndex) ) { 3980 itendIndex = 1; 3981 } 3982 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 3983 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 3984 if ($.fn.counterUp) { 3985 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 3986 var $counter = $(this); 3987 $counter.addClass('started').counterUp({ 3988 delay: 10, 3989 time: 1500 3990 }); 3991 }); 3992 } 3993 } 3994 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 3995 }, 200); 3996 } 3997 tempTimeStamp = event.timeStamp; 3998 } 3999 4000 /** Initialize */ 4001 $elSelector.on('initialize.owl.carousel', function(event) { 4002 if (typeof UNCODE.owlNav !== 'undefined') { 4003 UNCODE.owlNav(itemID, event); 4004 } 4005 4006 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4007 window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) { 4008 var shortcode = model.attributes.shortcode, 4009 $el = model.view.$el, 4010 $row_wrap = $el.closest('.row'); 4011 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4012 $row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove(); 4013 } 4014 }); 4015 window.parent.vc.events.on('shortcodeView:updated', function(model) { 4016 var shortcode = model.attributes.shortcode; 4017 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4018 tempTimeStamp = Math.floor(Date.now() / 1000); 4019 } 4020 }); 4021 window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) { 4022 var shortcode = model.attributes.shortcode; 4023 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4024 UNCODE.owlNav(itemID, event); 4025 $elSelector.trigger('refresh.owl.carousel'); 4026 } 4027 }); 4028 } 4029 }); 4030 4031 /** Initialized */ 4032 $elSelector.on('initialized.owl.carousel', function(event) { 4033 4034 if ( $('.isotope-container', event.currentTarget).length ) { 4035 window.dispatchEvent(UNCODE.boxEvent); 4036 } 4037 4038 $('.owl-dot.active', $elSelector).on('click', function(){ 4039 return false;
4040 }); 4041 4042 var thiis = $(event.currentTarget), 4043 // get the time from the data method 4044 time = thiis.data("timer-id"), 4045 rowParent = thiis.closest('.row-parent'); 4046 4047 if ( typeof rowParent[0] !== 'undefined' ) { 4048 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 4049 } 4050 4051 if (time) { 4052 clearRequestTimeout(time); 4053 } 4054 4055 thiis.addClass('showControls'); 4056 var new_time = requestTimeout(function() { 4057 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 4058 if (thiis.hasClass('owl-height-viewport')) 4059 setItemsRelHeight(thiis); 4060 if (thiis.hasClass('owl-height-equal')) 4061 setItemsHeight(thiis); 4062 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 4063 if (thiis.closest('.unequal, .unexpand').length) { 4064 UNCODE.setRowHeight(rowParent[0], true); 4065 } 4066 if (SiteParameters.dynamic_srcset_active === '1') { 4067 UNCODE.refresh_dynamic_srcset_size(thiis); 4068 } 4069 }, 350); 4070 // save the new time 4071 thiis.data("timer-id", new_time); 4072 4073 var scrolltop = $(document).scrollTop(); 4074 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 4075 4076 //if (!UNCODE.isMobile) { 4077 /** fix autoplay when visible **/ 4078 $(window).on('load', function(){ 4079 if (thiis.data('autoplay')) { 4080 if ( !thiis.closest('.sticky-element').length ) { 4081 thiis.trigger('stop.autoplay.owl'); 4082 } else { 4083 thiis.trigger('play.owl.autoplay'); 4084 } 4085 } 4086 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 4087 return; 4088 } 4089 if ( ! thiis.closest('.sticky-element').length ) { 4090 var carouselInView = new Waypoint.Inview({ 4091 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4092 element: thiis[0], 4093 exited: function() { 4094 var el = $(this.element); 4095 if (el.data('autoplay') ) { 4096 el.trigger('stop.owl.autoplay'); 4097 el.data('stopped','true'); 4098 } 4099 }, 4100 enter: function(direction) { 4101 var el = $(this.element); 4102 requestTimeout(function() { 4103 if (el.data('autoplay')) { 4104 el.trigger('play.owl.autoplay'); 4105 el.data('stopped','false'); 4106 } 4107 }, 100); 4108 } 4109 }); 4110 } 4111 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4112 setTimeout(function(){ 4113 window.lenis.resize(); 4114 }, 1000); 4115 } 4116 4117 }); 4118 //} 4119 4120 // $(window).on('frontend:carousel_updated', function(){ 4121 // Waypoint.refreshAll(); 4122 // }); 4123 4124 if (!thiis.closest('.isotope-system').length) { 4125 requestTimeout(function() { 4126 animate_thumb($('.t-inside', el), event); 4127 }, 400); 4128 } else { 4129 requestTimeout(function() { 4130 thiis.closest('.isotope-container').isotope('layout'); 4131 }, 400); 4132 } 4133 4134 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4135 currentIndex = $(currentItem).attr('data-index'); 4136 4137 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4138 if ($(val).closest('.uncode-slider').length) { 4139 $(val).removeClass('start_animation'); 4140 } 4141 }); 4142 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4143 if ($(val).closest('.uncode-slider').length) { 4144 $(val).removeClass('already-animated'); 4145 } 4146 }); 4147 4148 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4149 if ($(val).closest('.uncode-slider').length) { 4150 $(val).removeAttr('data-animated'); 4151 } 4152 }); 4153 4154 $.each($('.owl-item.cloned', thiis), function(index, val) { 4155 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 4156 }); 4157 4158 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4159 if ($(val).attr('data-index') != currentIndex) { 4160 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4161 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4162 } 4163 if ($(val).attr('data-index') != currentIndex) { 4164 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 4165 } 4166 if ($(val).attr('data-index') == currentIndex) { 4167 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4168 } 4169 }); 4170 4171 if (thiis.closest('.uncode-slider').length) { 4172 var el = thiis.closest('.row-parent')[0]; 4173 if ($(el).data('imgready')) { 4174 firstLoaded(el, event); 4175 } else { 4176 el.addEventListener("imgLoaded", function(el) { 4177 firstLoaded(el.target, event); 4178 }, false); 4179 } 4180 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 4181 if (transHeight != null) { 4182 requestTimeout(function() { 4183 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 4184 }, 100); 4185 } 4186 } else { 4187 var el = thiis; 4188 el.closest('.uncode-slider').addClass('slider-loaded'); 4189 } 4190 4191 requestTimeout(function() { 4192 if (typeof UNCODE.bigText !== 'undefined') { 4193 UNCODE.bigText(thiis); 4194 } 4195 if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) { 4196 if (thiis.data('autoplay')) pauseOnHover(thiis); 4197 } 4198 }, 500); 4199 4200 if (thiis.closest('.unequal').length) { 4201 $owlInsideEqual.push(thiis.closest('.row-parent')); 4202 } 4203 4204 var containerClasses = '', 4205 containerStyle = '';
4206 if ( $('.owl-dots-classes', $owlContainer).length ) { 4207 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 4208 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 4209 $('.owl-dots-classes', $owlContainer).remove(); 4210 } 4211 4212 if ( containerClasses !== '' ) { 4213 requestTimeout(function() { 4214 if ( containerClasses !== '' ) 4215 $('.owl-dots', $owlContainer).attr('style', containerStyle); 4216 if ( containerStyle !== '' ) 4217 $('.owl-dots', $owlContainer).addClass(containerClasses); 4218 }, 100); 4219 } 4220 4221 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 4222 $(val).closest('.row-inner').css({ 4223 'margin-top': '-1px' 4224 }); 4225 }); 4226 4227 if ($.fn.isotope) { 4228 if ( thiis.closest('.isotope-container').length ) { 4229 if (thiis.closest('.isotope-container').data('isotope')) { 4230 requestTimeout(function(){ 4231 thiis.closest('.isotope-container').isotope('layout'); 4232 }, 300); 4233 } 4234 $(window).on('load', function(){ 4235 if (thiis.closest('.isotope-container').data('isotope')) { 4236 thiis.closest('.isotope-container').isotope('layout'); 4237 } 4238 }); 4239 } 4240 } 4241 4242 if (thiis.data('autoplay')) { 4243 $(window).on('menuOpen', function(){ 4244 thiis.trigger('stop.owl.autoplay'); 4245 thiis.data('stopped','true'); 4246 }).on('menuClose', function(){ 4247 4248 }); 4249 } 4250 $(window).on('menuClose', function(){ 4251 if (thiis.data('autoplay')) { 4252 thiis.trigger('play.owl.autoplay'); 4253 thiis.data('stopped','false'); 4254 } 4255 }); 4256 4257 setIndexActive(event, true); 4258 4259 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 4260 return !$(this).closest('.nested-carousel').length; 4261 }), 4262 $_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init])', thiis).has(nested_a), 4263 $galleries = $_galleries.filter(function( index ) { 4264 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 4265 }); 4266 4267 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 4268 UNCODE.lightgallery( $galleries ); 4269 } 4270 4271 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4272 $(document).trigger('uncode-scrolltrigger-refresh'); 4273 } 4274 }); 4275 4276 $elSelector.on('resized.owl.carousel', function(event) { 4277 var thiis = $(event.currentTarget); 4278 // if ($(this).closest('.nested-carousel').length) { 4279 // requestTimeout(function() { 4280 // window.dispatchEvent(UNCODE.boxEvent); 4281 // }, 200); 4282 // } 4283 if ( thiis.hasClass('owl-height-equal') ) 4284 setItemsHeight(thiis); 4285 4286 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4287 newWidth = UNCODE.wwidth; 4288 setItemsRelHeight($elSelector); 4289 } 4290 4291 setIndexActive(event); 4292 4293 if (SiteParameters.dynamic_srcset_active === '1') { 4294 UNCODE.refresh_dynamic_srcset_size(thiis); 4295 } 4296 4297 if ($.fn.isotope) { 4298 $(window).on('load', function(){ 4299 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 4300 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 4301 } 4302 }); 4303 } 4304 4305 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4306 setTimeout(function(){ 4307 window.lenis.resize(); 4308 }, 1000); 4309 } 4310 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4311 $(document).trigger('uncode-scrolltrigger-refresh'); 4312 } 4313 }); 4314 4315 $elSelector.on('refreshed.owl.carousel', function(event) { 4316 setIndexActive(event); 4317 }); 4318 4319 /** detect resize window for fluid height layout */ 4320 var setFluidResize; 4321 function manageFluidCarouseHeight() { 4322 clearRequestTimeout(setFluidResize); 4323 setFluidResize = requestTimeout(function(){ 4324 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4325 newWidth = UNCODE.wwidth; 4326 setItemsRelHeight($elSelector); 4327 } 4328 }, 100); 4329 }
4330 window.addEventListener('resize', manageFluidCarouseHeight); 4331 4332 /** Change */ 4333 $elSelector.on('change.owl.carousel', function(event) { 4334 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 4335 }); 4336 4337 /** Changed */ 4338 $elSelector.on('changed.owl.carousel', function(event) { 4339 var $row = $elSelector.parents('.row')[0]; 4340 if ( typeof $row !== 'undefined' ) { 4341 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 4342 } 4343 setIndexActive(event); 4344 }); 4345 4346 var checkDrag = function(e) { 4347 $elSelector.addClass('owl-dragging'); 4348 }; 4349 $elSelector.on('drag.owl.carousel', function(event) { 4350 document.addEventListener("mousemove", checkDrag); 4351 }); 4352 4353 $elSelector.on('dragged.owl.carousel', function(event) { 4354 $elSelector.removeClass('owl-dragging'); 4355 document.removeEventListener("mousemove", checkDrag); 4356 }); 4357 4358 $elSelector.on('translate.owl.carousel', function(event) { 4359 if (UNCODE.isMobile) { 4360 $(event.currentTarget).addClass('owl-translating'); 4361 } 4362 }); 4363 4364 /** Translated */ 4365 $elSelector.on('translated.owl.carousel', function(event) { 4366 4367 var thiis = $(event.currentTarget), 4368 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4369 currentIndex = $(currentItem).attr('data-index'), 4370 stagePadding = thiis.data('stagepadding'); 4371 4372 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4373 4374 if (!UNCODE.isMobile) { 4375 UNCODE.owlPlayVideo(thiis); 4376 } 4377 4378 requestTimeout(function(){ 4379 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 4380 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 4381 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 4382 if (lastDelayElems == undefined) lastDelayElems = 0; 4383 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4384 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4385 thiis.trigger('stop.owl.autoplay'); 4386 requestTimeout(function() { 4387 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 4388 }, maxDelay); 4389 } 4390 }, 200); 4391 4392 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4393 if ($(val).closest('.uncode-slider').length) { 4394 $(val).removeClass('start_animation'); 4395 } 4396 }); 4397 4398 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4399 if ($(val).closest('.uncode-slider').length) { 4400 $(val).removeClass('already-animated'); 4401 } 4402 }); 4403 4404 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4405 if ($(val).closest('.uncode-slider').length) { 4406 $(val).removeAttr('data-animated'); 4407 } 4408 }); 4409 4410 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4411 if ($(val).attr('data-index') != currentIndex) { 4412 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4413 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4414 } 4415 if ($(val).attr('data-index') != currentIndex) { 4416 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4417 } 4418 if ($(val).attr('data-index') == currentIndex) { 4419 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4420 } 4421 }); 4422 4423 if (UNCODE.isMobile) { 4424 thiis.removeClass('owl-translating'); 4425 } 4426 4427 setIndexActive(event); 4428 }); 4429 4430 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4431 4432 /** Init carousel */ 4433 $elSelector.not('.showControls').owlCarousel({ 4434 items: values['items'], 4435 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4436 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4437 nav: values['nav'], 4438 dots: values['dots'], 4439 loop: values['loop'], 4440 stagePadding: values['stagepadding'], 4441 margin: 0, 4442 video: true, 4443 autoWidth: false, 4444 autoplay: false, 4445 autoplayTimeout: values['timeout'], 4446 autoplaySpeed: values['navspeed'], 4447 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4448 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4449 rtl: $('body').hasClass('rtl') ? true : false, 4450 fluidSpeed: true, 4451 navSpeed: values['navspeed'], 4452 dotsSpeed: values['navspeed'] / values['items'], 4453 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4454 navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'], 4455 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4456 responsiveClass: true, 4457 responsiveBaseElement: '.box-container', 4458 responsive: { 4459 0: { 4460 items: values['sm'], 4461 nav: values['navmobile'], 4462 dots: values['dotsmobile'], 4463 dotsSpeed: values['navspeed'] / values['sm'], 4464 }, 4465 480: { 4466 items: values['sm'], 4467 nav: values['navmobile'], 4468 dots: values['dotsmobile'], 4469 dotsSpeed: values['navspeed'] / values['sm'], 4470 }, 4471 570: { 4472 items: values['md'], 4473 nav: values['navmobile'], 4474 dots: values['dotsmobile'], 4475 dotsSpeed: values['navspeed'] / values['md'], 4476 }, 4477 960: { 4478 items: values['lg'], 4479 dotsSpeed: values['navspeed'] / values['lg'], 4480 } 4481 } 4482 }); 4483 4484 var transDuration = parseFloat(values['navspeed']) * 0.3; 4485 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4486 4487 $('.owl-item .tmb', $elSelector).css({ 4488 '-webkit-transition-delay': transDuration + 'ms', 4489 '-moz-transition-delay': transDuration + 'ms', 4490 '-o-transition-delay': transDuration + 'ms', 4491 'transition-delay': transDuration + 'ms', 4492 '-webkit-transition-duration': transDuration2 + 'ms', 4493 '-moz-transition-duration': transDuration2 + 'ms', 4494 '-o-transition-duration': transDuration2 + 'ms', 4495 'transition-duration': transDuration2 + 'ms', 4496 }); 4497 4498 requestTimeout(function() { 4499 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4500 UNCODE.setRowHeight($owlInsideEqual[i]); 4501 }; 4502 }, 300); 4503 4504 $(window).on('load', function(){ 4505 var $elCarousel = $elSelector.data('owl.carousel'); 4506 if ( typeof $elCarousel !== 'undefined' ) { 4507 $elCarousel.trigger('refreshed'); 4508 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4509 UNCODE.setRowHeight($owlInsideEqual[i]); 4510 }; 4511 } 4512 }); 4513 4514 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4515 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4516 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4517 $('#' + carousel_id).find('.owl-item').each( function() { 4518 var $item = $(this), 4519 index = ( $item.index() + 1 ); 4520 $item.attr('data-index', index); 4521 }); 4522 } 4523 }); 4524 4525 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4526 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4527 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4528 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4529 $('#' + carousel_id).find('.owl-item').each( function() { 4530 var $item = $(this), 4531 index = ( $item.index() + 1 ); 4532 $item.attr('data-index', index); 4533 }); 4534 } 4535 }); 4536 } 4537 4538 }); 4539 4540 function firstLoaded(el, event) { 4541 var el = $(el), 4542 uncode_slider = el.find('.uncode-slider'); 4543 el.find('.owl-carousel').css('opacity', 1); 4544 uncode_slider.addClass('slider-loaded'); 4545 if (typeof UNCODE.bigText !== 'undefined') { 4546 UNCODE.bigText(el.find('.owl-item.active')); 4547 } 4548 //if (!UNCODE.isMobile) { 4549 requestTimeout(function() { 4550 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4551 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4552 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4553 if (lastDelayElems == undefined) lastDelayElems = 0; 4554 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4555 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4556 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4557 requestTimeout(function() { 4558 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4559 }, maxDelay); 4560 } 4561 }, 500); 4562 4563 //} 4564 } 4565 4566 function navHover(el) { 4567 var $owlCont = el, 4568 $owlPrev = $owlCont.find('.owl-prev'), 4569 $owlNext = $owlCont.find('.owl-next'), 4570 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4571 $owlPagination = $owlCont.next(), 4572 owlPrevW = $owlPrev.outerWidth(), 4573 owlNextW = $owlNext.outerWidth(), 4574 owlDotsH = $owlDots.innerHeight(), 4575 owlTime = 400, 4576 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4577 if ( $('body').hasClass('rtl') ) { 4578 $owlPrev.css("margin-right", -owlPrevW); 4579 $owlNext.css("margin-left", -owlNextW); 4580 } else { 4581 $owlPrev.css("margin-left", -owlPrevW); 4582 $owlNext.css("margin-right", -owlNextW); 4583 } 4584 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4585 $owlCont.mouseenter(function() { 4586 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4587 $owlPrev.add($owlNext).css({ 4588 marginLeft: 0, 4589 marginRight: 0 4590 }); 4591 if (!owlNested) { 4592 $owlDots.css({ 4593 opacity: 1, 4594 bottom: 0 4595 }); 4596 } 4597 }).mouseleave(function() { 4598 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4599 if ( $('body').hasClass('rtl') ) { 4600 $owlPrev.css("margin-right", -owlPrevW); 4601 $owlNext.css("margin-left", -owlNextW); 4602 } else { 4603 $owlPrev.css("margin-left", -owlPrevW); 4604 $owlNext.css("margin-right", -owlNextW); 4605 } 4606 if (!owlNested) { 4607 $owlDots.css({ 4608 opacity: 1, 4609 bottom: -owlDotsH 4610 }); 4611 } 4612 }); 4613 }; 4614 4615 function animate_elems($this) { 4616 var lastDelay; 4617 $.each($('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside), .animate_when_parent_almost_visible:not(.t-inside)', $this), function(index, val) { 4618 var element = $(val), 4619 delayAttr = element.attr('data-delay'), 4620 $first_item = element.closest('.owl-item[data-index="1"]'); 4621 4622 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4623 return false;
4624 } 4625 4626 if (delayAttr == undefined) delayAttr = 0; 4627 requestTimeout(function() { 4628 element.addClass('start_animation'); 4629 }, delayAttr); 4630 lastDelay = delayAttr; 4631 }); 4632 return lastDelay; 4633 } 4634 4635 function animate_thumb(items, event) { 4636 var lastDelay, 4637 itemIndex, 4638 thiis = $(event.currentTarget), 4639 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4640 numActives = $('.owl-item.active', thiis).length, 4641 stagePadding = thiis.data('stagepadding'); 4642 4643 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4644 4645 thiis.data('tempIndex', event.item.index); 4646 $.each(items, function(index, val) { 4647 var parent = $(val).closest('.owl-item'); 4648 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4649 return; 4650 } 4651 if (!$(val).hasClass('start_animation')) { 4652 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4653 var thumbInView = new Waypoint.Inview({ 4654 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4655 element: val, 4656 enter: function(direction) { 4657 var element = $(this.element), 4658 delayAttr = parseInt(element.attr('data-delay')), 4659 itemIndex = element.closest('.owl-item').index() + 1, 4660 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4661 if (itemIndex > tempIndex) { 4662 thiis.data('tempIndex', itemIndex); 4663 } 4664 if (isNaN(delayAttr)) delayAttr = 100; 4665 if (stagePadding) { 4666 var objTimeout = requestTimeout(function() { 4667 element.addClass('start_animation'); 4668 }, index * delayAttr); 4669 lastDelay = index * delayAttr; 4670 } else { 4671 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4672 var objTimeout = requestTimeout(function() { 4673 element.addClass('start_animation'); 4674 }, diffItem * delayAttr); 4675 lastDelay = diffItem * delayAttr; 4676 } 4677 parent.data('objTimeout', objTimeout); 4678 if (!UNCODE.isUnmodalOpen) { 4679 this.destroy(); 4680 } 4681 } 4682 }); 4683 } 4684 } 4685 }); 4686 return lastDelay; 4687 } 4688 4689 function setItemsHeight(item) { 4690 $.each($('.owl-item', item), function(index, val) { 4691 var availableThumbHeight = $('.t-inside', $(val)).height(), 4692 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4693 difference = availableThumbHeight - innerThumbHeight; 4694 if ($('.tmb-content-under', val).length) { 4695 var visualPart = $('.t-entry-visual', val); 4696 if (visualPart.length) { 4697 difference -= $('.t-entry-visual', val).height(); 4698 } 4699 } 4700 if (! $('.tmb-content-lateral', val).length) 4701 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4702 }); 4703 } 4704 4705 function setItemsRelHeight(item) { 4706 $.each($('.owl-item', item), function(index, val) { 4707 var $rowContainer = $(item).parents('.row-parent').eq(0), 4708 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4709 $colContainer = $(item).parents('.uncell').eq(0), 4710 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4711 winHeight = UNCODE.wheight, 4712 multiplier_h = parseInt($(item).attr('data-vp-height')), 4713 data_viewport_h, 4714 consider_menu = $(item).data('vp-menu'); 4715 4716 if ( consider_menu ) { 4717 winHeight = winHeight - UNCODE.menuHeight; 4718 } 4719 4720 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4721 $('.t-inside', val).css( 'height', data_viewport_h ); 4722 }); 4723 } 4724 4725 function pauseOnHover(slider) { 4726 var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next'); 4727 $('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({ 4728 mouseenter: function () { 4729 $(slider).addClass('owl-mouseenter'); 4730 $(slider).trigger('stop.owl.autoplay'); 4731 }, 4732 mouseleave: function () { 4733 $(slider).removeClass('owl-mouseenter'); 4734 $(slider).trigger('play.owl.autoplay'); 4735 } 4736 }); 4737 } 4738 }); 4739}; 4740 4741UNCODE.owlPlayVideo = function(carousel) { 4742 var player, iframe; 4743 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4744 var content = $(val).html(); 4745 if (content == '') { 4746 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4747 $(val).append(getCloned); 4748 } 4749 if ($(this).attr('data-provider') == 'vimeo') { 4750 iframe = $(this).find('iframe'); 4751 player = new Vimeo.Player(iframe[0]); 4752 player.play(); 4753 } else if ($(this).attr('data-provider') == 'youtube') { 4754 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4755 } else { 4756 var player = $(this).find('video'); 4757 if (player.length) { 4758 $(this).find('video')[0].volume = 0; 4759 $(this).find('video')[0].play(); 4760 $(val).css('opacity', 1); 4761 } 4762 } 4763 }); 4764}; 4765 4766UNCODE.owlStopVideo = function(carousel) { 4767 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4768 var player, iframe; 4769 if ($(this).attr('data-provider') == 'vimeo') { 4770 iframe = $(this).find('iframe'); 4771 player = new Vimeo.Player(iframe[0]); 4772 player.pause(); 4773 } else if ($(this).attr('data-provider') == 'youtube') { 4774 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4775 } else { 4776 var player = $(this).find('video'); 4777 if (player.length) { 4778 $(this).find('video')[0].volume = 0; 4779 $(this).find('video')[0].play(); 4780 } 4781 } 4782 }); 4783}; 4784 4785UNCODE.animations = function() { 4786 4787 var runWaypoints_TO, 4788 runWaypoints_carousel_TO, 4789 runWaypoints_delay = 0, 4790 highlightComplexFunc = function($wrap, ev){ 4791 4792 var $lines = $('.heading-line-wrap', $wrap), 4793 not_animate = false;
4794 4795 if ( $wrap.data('animate') === true ) { 4796 not_animate = true; 4797 } 4798 4799 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4800 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4801 return; 4802 } 4803 4804 $lines.each(function(_key, _value){ 4805 var $line = $(_value), 4806 $inners = $('.split-word-inner', $line), 4807 $highlights = $('.heading-text-highlight-inner', $line); 4808 4809 var highlitInnerFunc = function(ev){ 4810 var delay = 0; 4811 $highlights.each(function(h_key, high){ 4812 var $highlight = $(high), 4813 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4814 $nextSplit = $split.nextUntil(), 4815 $next = $('.heading-text-highlight-inner', $nextSplit), 4816 countCh = $split.text().length; 4817 4818 $highlight.css({ 4819 '-webkit-transition-duration': (30 * countCh) + 'ms', 4820 '-moz-transition-duration': (30 * countCh) + 'ms', 4821 '-o-transition-duration': (30 * countCh) + 'ms', 4822 'transition-duration': (30 * countCh) + 'ms', 4823 }); 4824 4825 delay += (30 * countCh); 4826 4827 $next.css({ 4828 '-webkit-transition-delay': delay + 'ms', 4829 '-moz-transition-delay': delay + 'ms', 4830 '-o-transition-delay': delay + 'ms', 4831 'transition-delay': delay + 'ms', 4832 }); 4833 }); 4834 $highlights.removeAttr('data-animated'); 4835 if ( _key+1 === $lines.length ) { 4836 $wrap.data('animate', true); 4837 } 4838 }; 4839 4840 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4841 if ( not_animate ) { 4842 $highlights.each(function(h_key, high){ 4843 var $highlight = $(high); 4844 $highlight.css({ 4845 '-webkit-transition-duration': '0ms', 4846 '-moz-transition-duration': '0ms', 4847 '-o-transition-duration': '0ms', 4848 'transition-duration': '0ms', 4849 }); 4850 }); 4851 $highlights.removeAttr('data-animated'); 4852 } else { 4853 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4854 highlitInnerFunc(); 4855 } else { 4856 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4857 } 4858 } 4859 } 4860 }); 4861 }; 4862 4863 $.each($('.header-content-inner'), function(index, val) { 4864 var element = $(val), 4865 transition = ''; 4866 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4867 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4868 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4869 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4870 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4871 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4872 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4873 if (transition != '') { 4874 $(val).removeClass(transition); 4875 var container = element, 4876 containerDelay = container.attr('data-delay'), 4877 containerSpeed = container.attr('data-speed'), 4878 items = $('.header-title > *, .post-info', container); 4879 $.each(items, function(index, val) { 4880 var element = $(val), 4881 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4882 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4883 if (!element.hasClass('animate_when_almost_visible')) { 4884 delayAttr = Number(delayAttr) + (400 * index); 4885 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4886 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4887 } 4888 }); 4889 container.css('opacity', 1); 4890 } 4891 }); 4892 4893 function animate_css_grids_on_load() { 4894 $('.cssgrid-system').each(function() { 4895 var grid = $(this); 4896 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4897 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4898 }); 4899 } 4900 4901 var delayAdd = 0; 4902 4903 window.waypoint_animation = function(ev) { 4904 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-linear .animate_when_almost_visible:not(.start_animation), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)'), function(index, val) { 4905 if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length ) && !SiteParameters.is_frontend_editor ) ) { 4906 return true; 4907 } 4908 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4909 return; 4910 } 4911 var run = true, 4912 $carousel = $(val).closest('.owl-carousel'), 4913 marquee = $(val).closest('.tmb-linear').length; 4914 if ( $carousel.length ) { 4915 run = false;
4916 } 4917 if (run) { 4918 new Waypoint({ 4919 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4920 element: val, 4921 handler: function() { 4922 var element = $(this.element), 4923 index = element.index(), 4924 delayAttr = element.attr('data-delay'); 4925 if (delayAttr == undefined) delayAttr = 0; 4926 // delayAttr = parseFloat(delayAttr) + delayAdd; 4927 // if ( marquee ) { 4928 // delayAdd += 50; 4929 // } else { 4930 // delayAdd = 0; 4931 // } 4932 requestTimeout(function() { 4933 element.addClass('start_animation'); 4934 }, delayAttr); 4935 if (!UNCODE.isUnmodalOpen) { 4936 this.destroy(); 4937 } 4938 }, 4939 offset: UNCODE.isFullPage ? '100%' : '90%' 4940 }); 4941 } 4942 }); 4943 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4944 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4945 return; 4946 } 4947 var run = true, 4948 $carousel = $(val).closest('.owl-carousel'); 4949 if ( $carousel.length ) { 4950 run = false; 4951 } 4952 if (run) { 4953 new Waypoint({ 4954 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4955 element: val, 4956 handler: function() { 4957 var $element = $(this.element), 4958 $childs = $('.animate_when_parent_almost_visible', $element); 4959 $childs.each(function(key,el){ 4960 var $child = $(el), 4961 delaySpeed = $child.attr('data-speed'), 4962 delayAttr = $child.attr('data-delay'), 4963 intervalAttr = $child.attr('data-interval'); 4964 if (delayAttr == undefined) { 4965 delayAttr = 50*key; 4966 } 4967 requestTimeout(function() { 4968 $child.addClass('start_animation'); 4969 if ( $child.hasClass('anim-line-checker') ) { 4970 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4971 var $line = $child.closest('.heading-line-wrap'); 4972 }); 4973 } 4974 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4975 highlightComplexFunc($wrapText, ev); 4976 if ( $child.hasClass('anim-tot-checker') ) { 4977 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4978 if ( $child.hasClass('anim-tot-checker') ) { 4979 $wrapText.addClass('already-animated'); 4980 $element.trigger('already-animated'); 4981 } 4982 }); 4983 } 4984 }, delayAttr ); 4985 }); 4986 $element.addClass('start_animation'); 4987 if (!UNCODE.isUnmodalOpen) { 4988 this.destroy(); 4989 } 4990 }, 4991 offset: UNCODE.isFullPage ? '100%' : '90%' 4992 }); 4993 } 4994 }); 4995 } 4996 window.waypoint_carousel_animation = function(ev) { 4997 $.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) { 4998 if ( $(val).hasClass('el-text-split') ) { 4999 return true; 5000 } 5001 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5002 return; 5003 } 5004 var run = true, 5005 $carousel = $(val).closest('.owl-carousel'), 5006 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5007 $all_first = $('.owl-item[data-index="1"]', $carousel); 5008 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5009 run = false; 5010 } 5011 if (run) { 5012 new Waypoint({ 5013 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5014 element: val, 5015 handler: function() { 5016 var element = $(this.element), 5017 index = element.index(), 5018 delayAttr = element.attr('data-delay'); 5019 if (delayAttr == undefined) delayAttr = 0; 5020 requestTimeout(function() { 5021 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5022 $all_first.attr('data-already-reached', 'true'); 5023 } 5024 element.addClass('start_animation'); 5025 }, delayAttr); 5026 if (!UNCODE.isUnmodalOpen) { 5027 this.destroy(); 5028 } 5029 }, 5030 offset: UNCODE.isFullPage ? '100%' : '90%' 5031 }); 5032 } 5033 }); 5034 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 5035 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5036 return; 5037 } 5038 var run = true, 5039 $carousel = $(val).closest('.owl-carousel'), 5040 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5041 $all_first = $('.owl-item[data-index="1"]', $carousel); 5042 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5043 run = false;
5044 } 5045 if (run) { 5046 new Waypoint({ 5047 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5048 element: val, 5049 handler: function() { 5050 var $element = $(this.element), 5051 $childs = $('.animate_when_parent_almost_visible', $element); 5052 $childs.each(function(key,el){ 5053 var $child = $(el), 5054 delaySpeed = $child.attr('data-speed'), 5055 delayAttr = $child.attr('data-delay'), 5056 intervalAttr = $child.attr('data-interval'); 5057 if (delayAttr == undefined) { 5058 delayAttr = 50*key; 5059 } 5060 requestTimeout(function() { 5061 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5062 $all_first.attr('data-already-reached', 'true'); 5063 } 5064 $child.addClass('start_animation'); 5065 if ( $child.hasClass('anim-line-checker') ) { 5066 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5067 var $line = $child.closest('.heading-line-wrap'); 5068 }); 5069 } 5070 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 5071 highlightComplexFunc($wrapText, ev); 5072 if ( $child.hasClass('anim-tot-checker') ) { 5073 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5074 if ( $child.hasClass('anim-tot-checker') ) { 5075 $wrapText.addClass('already-animated'); 5076 } 5077 }); 5078 } 5079 }, delayAttr ); 5080 }); 5081 $element.addClass('start_animation'); 5082 if (!UNCODE.isUnmodalOpen) { 5083 this.destroy(); 5084 } 5085 }, 5086 offset: UNCODE.isFullPage ? '100%' : '90%' 5087 }); 5088 } 5089 }); 5090 } 5091 5092 var runWaypoints = function(ev){ 5093 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 5094 runWaypoints_delay = 400; 5095 } 5096 clearRequestTimeout(runWaypoints_TO); 5097 runWaypoints_TO = requestTimeout(function() { 5098 window.waypoint_animation(ev); 5099 }, runWaypoints_delay); 5100 5101 clearRequestTimeout(runWaypoints_carousel_TO); 5102 runWaypoints_carousel_TO = requestTimeout(function() { 5103 window.waypoint_carousel_animation(ev); 5104 }, 400); 5105 }; 5106 runWaypoints(); 5107 animate_css_grids_on_load(); 5108 5109 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 5110 runWaypoints(ev); 5111 }); 5112 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 5113 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 5114 } 5115}; 5116 5117UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 5118 var $allItems = elements.length - startIndex, 5119 showed = 0, 5120 index = 0, 5121 use_index = false 5122 ; 5123 5124 if (filtering) { 5125 if (sequential) { 5126 use_index = true; 5127 } 5128 sequential = false; 5129 } 5130 5131 $.each(elements, function(index, val) { 5132 var $this = $(val), 5133 elInner = $('> .t-inside', val); 5134 5135 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5136 return; 5137 } 5138 if (val[0]) val = val[0]; 5139 5140 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 5141 new Waypoint({ 5142 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5143 element: val, 5144 handler: function() { 5145 var element = $('> .t-inside', this.element), 5146 parent = $(this.element); 5147 var _index = use_index? index : 0; 5148 5149 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 5150 delayAttr = parseInt(element.attr('data-delay')); 5151 if (isNaN(delayAttr)) delayAttr = 100; 5152 if (sequential || use_index) { 5153 delay -= showed; 5154 } 5155 var objTimeout = requestTimeout(function() { 5156 element.removeClass('zoom-reverse').addClass('start_animation'); 5157 showed = index; 5158 }, delay * delayAttr); 5159 parent.data('objTimeout', objTimeout); 5160 if (!UNCODE.isUnmodalOpen) { 5161 this.destroy(); 5162 } 5163 }, 5164 offset: UNCODE.isFullPage ? '100%' : '90%' 5165 }); 5166 } 5167 5168 index++; 5169 }); 5170}; 5171 5172UNCODE.tapHover = function() { 5173 5174 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 5175 elClass = "hover"; 5176 5177 $(window).on('click', function() { 5178 $el.removeClass(elClass); 5179 }); 5180 5181 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 5182 e.stopPropagation(); 5183 var link = $(this); 5184 if ( ! link.hasClass(elClass)) { 5185 e.preventDefault(); 5186 link.addClass("hover"); 5187 $el.not(this).removeClass(elClass); 5188 return false;
5189 } 5190 }); 5191}; 5192 5193UNCODE.onePage = function(isMobile) { 5194 var current = 0, 5195 last = 0, 5196 lastScrollTop = 0, 5197 forceScroll = false, 5198 lastScrolled = 0, 5199 isSectionscroller = ($('.main-onepage').length) ? true : false, 5200 isOnePage = false, 5201 getOffset = function () { 5202 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0); 5203 return calculateOffset; 5204 } 5205 5206 isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile; 5207 5208 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 5209 // return false; 5210 5211 function init_onepage() { 5212 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 5213 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 5214 } 5215 last = $('.onepage-pagination li').last().find('a').data('index'); 5216 $.each($('div[data-parent="true"]'), function(index, val) { 5217 $(this).attr('data-section', index); 5218 if (isMobile) return; 5219 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5220 return; 5221 } 5222 var sectionDown = new Waypoint({ 5223 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5224 element: val, 5225 handler: function(direction) { 5226 if (direction == 'down') { 5227 changeMenuActive(this.element, index); 5228 } 5229 }, 5230 offset: function() { 5231 return 5 + getOffset() 5232 } 5233 }); 5234 var sectionUp = new Waypoint({ 5235 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5236 element: val, 5237 handler: function(direction) { 5238 if (direction == 'up') { 5239 changeMenuActive(this.element, index); 5240 } 5241 }, 5242 offset: function() { 5243 return -5 - getOffset() 5244 } 5245 }); 5246 5247 if (isSectionscroller) { 5248 var label; 5249 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 5250 else label = ''; 5251 var getName = $(this).attr('data-name'); 5252 if (getName == undefined) getName = index; 5253 if (label != '') { 5254 isOnePage = true; 5255 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 5256 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 5257 } 5258 } 5259 }); 5260 5261 if (isSectionscroller) { 5262 $.each($('ul.onepage-pagination li'), function(index, val) { 5263 var $this = $(val), 5264 $a = ('a', $this); 5265 $a.on('click', function(evt) { 5266 if ( $('.is-selected', $this).length || UNCODE.scrolling ) { 5267 return false; 5268 } 5269 if ( $('body').hasClass('uncode-scroll-no-history') ) { 5270 evt.preventDefault(); 5271 } 5272 Waypoint.refreshAll(); 5273 var el = $('a', evt.currentTarget); 5274 current = lastScrolled = parseInt(el.attr('data-index')); 5275 lastScrolled += 1; 5276 scrollBody(current); 5277 }); 5278 }); 5279 } 5280 5281 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 5282 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 5283 goToSection = String(window.location.hash).replace(/^#/, ""); 5284 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 5285 } 5286 5287 if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) { 5288 current = lastScrolled = goToSection; 5289 $(window).on('load', function(){ 5290 if ( $('.owl-carousel').length ) { 5291 requestTimeout(function(){ 5292 scrollBody(goToSection); 5293 }, 400); 5294 } else { 5295 scrollBody(goToSection); 5296 } 5297 }); 5298 } 5299 5300 } 5301 5302 function changeMenuActive(section, index) { 5303 current = lastScrolled = parseInt($(section).attr('data-section')); 5304 if (isOnePage) { 5305 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 5306 if (newSection.length) { 5307 $('ul.onepage-pagination li a').removeClass('is-selected'); 5308 newSection.addClass('is-selected'); 5309 } 5310 var getName = $('[data-section="' + index + '"]').attr('data-name'); 5311 if (getName != undefined && getName !== '') { 5312 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 5313 var get_href = $(val).attr('href'); 5314 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5315 $(val).closest('.menu-smart').find('.active').removeClass('active'); 5316 $(val).parent().addClass('active'); 5317 } 5318 }); 5319 } 5320 } 5321 } 5322 5323 if (isOnePage) { 5324 $(window).on('scroll', function() { 5325 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 5326 if (bodyTop == 0) { 5327 $('ul.onepage-pagination li a').removeClass('is-selected'); 5328 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 5329 var getName = $('[data-section=0]').attr('data-name'); 5330 if (getName != undefined && getName !== '') { 5331 $.each($('.menu-container .menu-item > a'), function(i, val) { 5332 var get_href = $(val).attr('href'); 5333 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5334 $(val).closest('ul').find('.active').removeClass('active'); 5335 $(val).parent().addClass('active'); 5336 } 5337 }); 5338 } 5339 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 5340 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 5341 if (lastSection.length) { 5342 $('ul.onepage-pagination li a').removeClass('is-selected'); 5343 lastSection.addClass('is-selected'); 5344 } 5345 } 5346 }); 5347 } 5348 5349 var scrollBody = function(index) { 5350 $('ul.onepage-pagination li a').removeClass('is-selected'); 5351 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 5352 5353 var getSection = $('[data-section=' + index + ']'), 5354 scrollTo; 5355 5356 if (getSection == undefined) return; 5357 5358 var body = $("html, body"), 5359 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5360 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 5361 getOffset = UNCODE.get_scroll_offset(index); 5362 if ( typeof getSection.offset() === 'undefined' ) 5363 return; 5364 scrollTo = getSection.offset().top; 5365
5366 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 5367 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 5368 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 5369 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 5370 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 5371 } 5372 5373 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 5374 if ( index === 0 ) { 5375 scrollTo = 0; 5376 } else { 5377 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 5378 } 5379 } else { 5380 scrollTo -= getOffset; 5381 } 5382 } 5383 5384 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5385 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5386 5387 if (index != 0) { 5388 UNCODE.scrolling = true; 5389 } 5390 5391 if (scrollSpeed == 0) { 5392 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 5393 UNCODE.scrolling = false; 5394 } else { 5395 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5396 $(this).stop(); 5397 }).animate({ 5398 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5399 }, scrollSpeed, 'easeInOutCubic', function() { 5400 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5401 UNCODE.scrolling = false; 5402 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 5403 || 5404 $('.menu-hided').length ) { 5405 scrollTo = getSection.offset().top; 5406 getOffset = UNCODE.get_scroll_offset(index); 5407 scrollTo -= getOffset; 5408 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5409 $(this).stop(); 5410 }).animate({ 5411 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5412 }, scrollSpeed, 'easeInOutCubic', function() { 5413 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5414 UNCODE.scrolling = false; 5415 } 5416 ); 5417 } 5418 }); 5419 } 5420 5421 }; 5422 5423 init_onepage(); 5424}; 5425 5426UNCODE.stickyElements = function() { 5427 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5428 if (!isMobile_wide ) { 5429 5430 var $pageHeader = $('#page-header'), 5431 $headerRow = $('.vc_row', $pageHeader), 5432 $headerSection = $headerRow.closest('section[data-parent]'), 5433 startSticky = false; 5434 5435 if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) { 5436 $headerRow.removeClass('sticky-element'); 5437 $pageHeader.addClass('sticky-element'); 5438 startSticky = true; 5439 } 5440 5441 var calculateOffset = function(el) { 5442 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5443 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5444 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0, 5445 elTop = window.pageYOffset + el.getBoundingClientRect().top; 5446 5447 sideOffset += UNCODE.bodyBorder; 5448 5449 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5450 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) { 5451 if ($('.menu-shrink').length) { 5452 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5453 } else { 5454 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5455 } 5456 } 5457 5458 return sideOffset; 5459 5460 }, 5461 5462 initStickyElement = function($els) { 5463 if ( $('body').hasClass('vc-safe-mode') ) { 5464 return true; 5465 } 5466 if ( typeof $els === 'undefined' ) { 5467 $els = $('.sticky-element'); 5468 } 5469 $.each($els, function(index, element) { 5470 if ($(element).closest('.tab-pane').length) { 5471 var $paneParent = $(element).closest('.tab-pane'); 5472 if ( !$paneParent.hasClass('active') ) { 5473 return true; 5474 } 5475 } 5476 $(element).stick_in_parent({ 5477 sticky_class: 'is_stucked', 5478 offset_top: calculateOffset(element), 5479 bottoming: true, 5480 inner_scrolling: SiteParameters.sticky_elements === 'on' 5481 }); 5482 }); 5483 }; 5484 5485 var oldW = UNCODE.wwidth, 5486 oldH = UNCODE.wHeight; 5487 5488 requestTimeout(function() { 5489 if ($('.sticky-element').length) { 5490 5491 if ($(window).width() > UNCODE.mediaQuery) { 5492 initStickyElement(); 5493
5494 if ( startSticky === true ) { 5495 $('#page-header').trigger('sticky_kit:recalc'); 5496 } 5497 } 5498 5499 $(window).on('resize lateral_resize', function(event) { 5500 if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) { 5501 $(".sticky-element").trigger("sticky_kit:detach"); 5502 if ($(window).width() > UNCODE.mediaQuery) { 5503 initStickyElement(); 5504 } 5505 oldW = UNCODE.wwidth; 5506 oldH = UNCODE.wHeight; 5507 } 5508 }); 5509 } 5510 }, 1000); 5511 5512 if ($('.sticky-element').length) { 5513 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5514 requestTimeout(function() { 5515 $(document.body).trigger("sticky_kit:recalc"); 5516 }, 100); 5517 }); 5518 } 5519 5520 var $panels = $('.panel-collapse'); 5521 if ( $panels.length ) { 5522 $panels.each(function(){ 5523 var $panel = $(this); 5524 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5525 $(document.body).trigger("sticky_kit:recalc"); 5526 }); 5527 }); 5528 } 5529 5530 $('.nav-tabs a').on('shown.bs.tab', function(e){ 5531 var $tabs = $(e.target).closest('.tab-container'), 5532 $panel = $('.tab-pane.active', $tabs), 5533 $els = $(e.target).nextAll(".sticky-element"); 5534 5535 $els.trigger("sticky_kit:detach"); 5536 initStickyElement($els); 5537 }); 5538 5539 $(window).on('vc-safe-mode-on', function(){ 5540 $(".sticky-element").trigger("sticky_kit:detach"); 5541 }); 5542 5543 $(window).on('vc-safe-mode-off', function(){ 5544 initStickyElement(); 5545 }); 5546 } 5547}; 5548 5549UNCODE.twentytwenty = function() { 5550 5551 if (!$('.twentytwenty-container').length) return; 5552 5553// DOM.event.move 5554// 5555// 2.0.0 5556// 5557// Stephen Band 5558// 5559// Triggers 'movestart', 'move' and 'moveend' events after 5560// mousemoves following a mousedown cross a distance threshold, 5561// similar to the native 'dragstart', 'drag' and 'dragend' events. 5562// Move events are throttled to animation frames. Move event objects 5563// have the properties: 5564// 5565// pageX: 5566// pageY: Page coordinates of pointer. 5567// startX: 5568// startY: Page coordinates of pointer at movestart. 5569// distX: 5570// distY: Distance the pointer has moved since movestart. 5571// deltaX: 5572// deltaY: Distance the finger has moved since last event. 5573// velocityX: 5574// velocityY: Average velocity over last few events. 5575 5576 5577(function(fn) { 5578 if (typeof define === 'function' && define.amd) { 5579 define([], fn); 5580 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5581 module.exports = fn; 5582 } else { 5583 fn(); 5584 } 5585})(function(){ 5586 var assign = Object.assign || window.jQuery && jQuery.extend; 5587 5588 // Number of pixels a pressed pointer travels before movestart 5589 // event is fired. 5590 var threshold = 8; 5591 5592 // Shim for requestAnimationFrame, falling back to timer. See: 5593 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5594 var requestFrame = (function(){ 5595 return ( 5596 window.requestAnimationFrame || 5597 window.webkitRequestAnimationFrame || 5598 window.mozRequestAnimationFrame || 5599 window.oRequestAnimationFrame || 5600 window.msRequestAnimationFrame || 5601 function(fn, element){ 5602 return window.setTimeout(function(){ 5603 fn(); 5604 }, 25); 5605 } 5606 ); 5607 })(); 5608 5609 // Shim for customEvent 5610 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5611 (function () { 5612 if ( typeof window.CustomEvent === "function" ) return false; 5613 function CustomEvent ( event, params ) { 5614 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5615 var evt = document.createEvent( 'CustomEvent' ); 5616 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5617 return evt; 5618 } 5619 5620 CustomEvent.prototype = window.Event.prototype; 5621 window.CustomEvent = CustomEvent; 5622 })(); 5623 5624 var ignoreTags = { 5625 textarea: true, 5626 input: true, 5627 select: true, 5628 button: true 5629 }; 5630 5631 var mouseevents = { 5632 move: 'mousemove', 5633 cancel: 'mouseup dragstart', 5634 end: 'mouseup' 5635 }; 5636 5637 var touchevents = { 5638 move: 'touchmove', 5639 cancel: 'touchend', 5640 end: 'touchend' 5641 }; 5642 5643 var rspaces = /\s+/; 5644 5645 5646 // DOM Events 5647 5648 var eventOptions = { bubbles: true, cancelable: true }; 5649 5650 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5651 5652 function createEvent(type) { 5653 return new CustomEvent(type, eventOptions); 5654 } 5655 5656 function getEvents(node) { 5657 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5658 } 5659 5660 function on(node, types, fn, data, selector) {
5661 types = types.split(rspaces); 5662 5663 var events = getEvents(node); 5664 var i = types.length; 5665 var handlers, type; 5666 5667 function handler(e) { fn(e, data); } 5668 5669 while (i--) { 5670 type = types[i]; 5671 handlers = events[type] || (events[type] = []); 5672 handlers.push([fn, handler]); 5673 node.addEventListener(type, handler); 5674 } 5675 } 5676 5677 function off(node, types, fn, selector) { 5678 types = types.split(rspaces); 5679 5680 var events = getEvents(node); 5681 var i = types.length; 5682 var type, handlers, k; 5683 5684 if (!events) { return; } 5685 5686 while (i--) { 5687 type = types[i]; 5688 handlers = events[type]; 5689 if (!handlers) { continue; } 5690 k = handlers.length; 5691 while (k--) { 5692 if (handlers[k][0] === fn) { 5693 node.removeEventListener(type, handlers[k][1]); 5694 handlers.splice(k, 1); 5695 } 5696 } 5697 } 5698 } 5699 5700 function trigger(node, type, properties) { 5701 // Don't cache events. It prevents you from triggering an event of a 5702 // given type from inside the handler of another event of that type. 5703 var event = createEvent(type); 5704 if (properties) { assign(event, properties); } 5705 node.dispatchEvent(event); 5706 } 5707 5708 5709 // Constructors 5710 5711 function Timer(fn){ 5712 var callback = fn, 5713 active = false, 5714 running = false; 5715 5716 function trigger(time) { 5717 if (active){ 5718 callback(); 5719 requestFrame(trigger); 5720 running = true; 5721 active = false; 5722 } 5723 else { 5724 running = false; 5725 } 5726 } 5727 5728 this.kick = function(fn) { 5729 active = true; 5730 if (!running) { trigger(); } 5731 }; 5732 5733 this.end = function(fn) { 5734 var cb = callback; 5735 5736 if (!fn) { return; } 5737 5738 // If the timer is not running, simply call the end callback. 5739 if (!running) { 5740 fn(); 5741 } 5742 // If the timer is running, and has been kicked lately, then 5743 // queue up the current callback and the end callback, otherwise 5744 // just the end callback. 5745 else { 5746 callback = active ? 5747 function(){ cb(); fn(); } : 5748 fn ; 5749 5750 active = true; 5751 } 5752 }; 5753 } 5754 5755 5756 // Functions 5757 5758 function noop() {} 5759 5760 function preventDefault(e) { 5761 e.preventDefault(); 5762 } 5763 5764 function isIgnoreTag(e) { 5765 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5766 } 5767 5768 function isPrimaryButton(e) { 5769 // Ignore mousedowns on any button other than the left (or primary) 5770 // mouse button, or when a modifier key is pressed. 5771 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5772 } 5773 5774 function identifiedTouch(touchList, id) { 5775 var i, l; 5776 5777 if (touchList.identifiedTouch) { 5778 return touchList.identifiedTouch(id); 5779 } 5780 5781 // touchList.identifiedTouch() does not exist in 5782 // webkit yet… we must do the search ourselves... 5783 5784 i = -1; 5785 l = touchList.length; 5786 5787 while (++i < l) { 5788 if (touchList[i].identifier === id) { 5789 return touchList[i]; 5790 } 5791 } 5792 } 5793 5794 function changedTouch(e, data) { 5795 var touch = identifiedTouch(e.changedTouches, data.identifier); 5796 5797 // This isn't the touch you're looking for. 5798 if (!touch) { return; } 5799 5800 // Chrome Android (at least) includes touches that have not 5801 // changed in e.changedTouches. That's a bit annoying. Check 5802 // that this touch has changed. 5803 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5804 5805 return touch; 5806 } 5807 5808 5809 // Handlers that decide when the first movestart is triggered 5810 5811 function mousedown(e){ 5812 // Ignore non-primary buttons 5813 if (!isPrimaryButton(e)) { return; } 5814 5815 // Ignore form and interactive elements 5816 if (isIgnoreTag(e)) { return; } 5817 5818 on(document, mouseevents.move, mousemove, e); 5819 on(document, mouseevents.cancel, mouseend, e); 5820 } 5821 5822 function mousemove(e, data){ 5823 checkThreshold(e, data, e, removeMouse); 5824 } 5825 5826 function mouseend(e, data) { 5827 removeMouse(); 5828 } 5829 5830 function removeMouse() { 5831 off(document, mouseevents.move, mousemove); 5832 off(document, mouseevents.cancel, mouseend); 5833 } 5834 5835 function touchstart(e) { 5836 // Don't get in the way of interaction with form elements 5837 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5838 5839 var touch = e.changedTouches[0]; 5840 5841 // iOS live updates the touch objects whereas Android gives us copies. 5842 // That means we can't trust the touchstart object to stay the same, 5843 // so we must copy the data. This object acts as a template for 5844 // movestart, move and moveend event objects. 5845 var data = { 5846 target: touch.target, 5847 pageX: touch.pageX, 5848 pageY: touch.pageY, 5849 identifier: touch.identifier, 5850 5851 // The only way to make handlers individually unbindable is by 5852 // making them unique. 5853 touchmove: function(e, data) { touchmove(e, data); }, 5854 touchend: function(e, data) { touchend(e, data); } 5855 }; 5856 5857 on(document, touchevents.move, data.touchmove, data); 5858 on(document, touchevents.cancel, data.touchend, data); 5859 } 5860 5861 function touchmove(e, data) { 5862 var touch = changedTouch(e, data); 5863 if (!touch) { return; } 5864 checkThreshold(e, data, touch, removeTouch); 5865 } 5866 5867 function touchend(e, data) { 5868 var touch = identifiedTouch(e.changedTouches, data.identifier); 5869 if (!touch) { return; } 5870 removeTouch(data); 5871 } 5872 5873 function removeTouch(data) { 5874 off(document, touchevents.move, data.touchmove); 5875 off(document, touchevents.cancel, data.touchend); 5876 } 5877 5878 function checkThreshold(e, data, touch, fn) { 5879 var distX = touch.pageX - data.pageX; 5880 var distY = touch.pageY - data.pageY; 5881
5882 // Do nothing if the threshold has not been crossed. 5883 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5884 5885 triggerStart(e, data, touch, distX, distY, fn); 5886 } 5887 5888 function triggerStart(e, data, touch, distX, distY, fn) { 5889 var touches = e.targetTouches; 5890 var time = e.timeStamp - data.timeStamp; 5891 5892 // Create a movestart object with some special properties that 5893 // are passed only to the movestart handlers. 5894 var template = { 5895 altKey: e.altKey, 5896 ctrlKey: e.ctrlKey, 5897 shiftKey: e.shiftKey, 5898 startX: data.pageX, 5899 startY: data.pageY, 5900 distX: distX, 5901 distY: distY, 5902 deltaX: distX, 5903 deltaY: distY, 5904 pageX: touch.pageX, 5905 pageY: touch.pageY, 5906 velocityX: distX / time, 5907 velocityY: distY / time, 5908 identifier: data.identifier, 5909 targetTouches: touches, 5910 finger: touches ? touches.length : 1, 5911 enableMove: function() { 5912 this.moveEnabled = true; 5913 this.enableMove = noop; 5914 e.preventDefault(); 5915 } 5916 }; 5917 5918 // Trigger the movestart event. 5919 trigger(data.target, 'movestart', template); 5920 5921 // Unbind handlers that tracked the touch or mouse up till now. 5922 fn(data); 5923 } 5924 5925 5926 // Handlers that control what happens following a movestart 5927 5928 function activeMousemove(e, data) { 5929 var timer = data.timer; 5930 5931 data.touch = e; 5932 data.timeStamp = e.timeStamp; 5933 timer.kick(); 5934 } 5935 5936 function activeMouseend(e, data) { 5937 var target = data.target; 5938 var event = data.event; 5939 var timer = data.timer; 5940 5941 removeActiveMouse(); 5942 5943 endEvent(target, event, timer, function() { 5944 // Unbind the click suppressor, waiting until after mouseup 5945 // has been handled. 5946 setTimeout(function(){ 5947 off(target, 'click', preventDefault); 5948 }, 0); 5949 }); 5950 } 5951 5952 function removeActiveMouse() { 5953 off(document, mouseevents.move, activeMousemove); 5954 off(document, mouseevents.end, activeMouseend); 5955 } 5956 5957 function activeTouchmove(e, data) { 5958 var event = data.event; 5959 var timer = data.timer; 5960 var touch = changedTouch(e, event); 5961 5962 if (!touch) { return; } 5963 5964 // Stop the interface from gesturing 5965 e.preventDefault(); 5966 5967 event.targetTouches = e.targetTouches; 5968 data.touch = touch; 5969 data.timeStamp = e.timeStamp; 5970 5971 timer.kick(); 5972 } 5973 5974 function activeTouchend(e, data) { 5975 var target = data.target; 5976 var event = data.event; 5977 var timer = data.timer; 5978 var touch = identifiedTouch(e.changedTouches, event.identifier); 5979 5980 // This isn't the touch you're looking for. 5981 if (!touch) { return; } 5982 5983 removeActiveTouch(data); 5984 endEvent(target, event, timer); 5985 } 5986 5987 function removeActiveTouch(data) { 5988 off(document, touchevents.move, data.activeTouchmove); 5989 off(document, touchevents.end, data.activeTouchend); 5990 } 5991 5992 5993 // Logic for triggering move and moveend events 5994 5995 function updateEvent(event, touch, timeStamp) { 5996 var time = timeStamp - event.timeStamp; 5997 5998 event.distX = touch.pageX - event.startX; 5999 event.distY = touch.pageY - event.startY; 6000 event.deltaX = touch.pageX - event.pageX; 6001 event.deltaY = touch.pageY - event.pageY; 6002 6003 // Average the velocity of the last few events using a decay 6004 // curve to even out spurious jumps in values. 6005 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 6006 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 6007 event.pageX = touch.pageX; 6008 event.pageY = touch.pageY; 6009 } 6010 6011 function endEvent(target, event, timer, fn) { 6012 timer.end(function(){ 6013 trigger(target, 'moveend', event); 6014 return fn && fn(); 6015 }); 6016 } 6017 6018 6019 // Set up the DOM 6020 6021 function movestart(e) { 6022 if (e.defaultPrevented) { return; } 6023 if (!e.moveEnabled) { return; } 6024 6025 var event = { 6026 startX: e.startX, 6027 startY: e.startY, 6028 pageX: e.pageX, 6029 pageY: e.pageY, 6030 distX: e.distX, 6031 distY: e.distY, 6032 deltaX: e.deltaX, 6033 deltaY: e.deltaY, 6034 velocityX: e.velocityX, 6035 velocityY: e.velocityY, 6036 identifier: e.identifier, 6037 targetTouches: e.targetTouches, 6038 finger: e.finger 6039 }; 6040 6041 var data = { 6042 target: e.target, 6043 event: event, 6044 timer: new Timer(update), 6045 touch: undefined, 6046 timeStamp: e.timeStamp 6047 }; 6048 6049 function update(time) { 6050 updateEvent(event, data.touch, data.timeStamp); 6051 trigger(data.target, 'move', event); 6052 } 6053 6054 if (e.identifier === undefined) { 6055 // We're dealing with a mouse event. 6056 // Stop clicks from propagating during a move 6057 on(e.target, 'click', preventDefault); 6058 on(document, mouseevents.move, activeMousemove, data); 6059 on(document, mouseevents.end, activeMouseend, data); 6060 } 6061 else { 6062 // In order to unbind correct handlers they have to be unique 6063 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 6064 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 6065 6066 // We're dealing with a touch. 6067 on(document, touchevents.move, data.activeTouchmove, data); 6068 on(document, touchevents.end, data.activeTouchend, data); 6069 } 6070 } 6071 6072 on(document, 'mousedown', mousedown); 6073 on(document, 'touchstart', touchstart); 6074 on(document, 'movestart', movestart); 6075 6076 6077 // jQuery special events 6078 // 6079 // jQuery event objects are copies of DOM event objects. They need 6080 // a little help copying the move properties across. 6081 6082 if (!window.jQuery) { return; } 6083 6084 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 6085 6086 function enableMove1(e) { e.enableMove(); } 6087 function enableMove2(e) { e.enableMove(); } 6088 function enableMove3(e) { e.enableMove(); } 6089 6090 function add(handleObj) { 6091 var handler = handleObj.handler; 6092 6093 handleObj.handler = function(e) { 6094 // Copy move properties across from originalEvent 6095 var i = properties.length; 6096 var property; 6097 6098 while(i--) { 6099 property = properties[i]; 6100 e[property] = e.originalEvent[property]; 6101 } 6102 6103 handler.apply(this, arguments); 6104 }; 6105 } 6106 6107 jQuery.event.special.movestart = { 6108 setup: function() { 6109 // Movestart must be enabled to allow other move events 6110 on(this, 'movestart', enableMove1); 6111 6112 // Do listen to DOM events 6113 return false;
6114 }, 6115 6116 teardown: function() { 6117 off(this, 'movestart', enableMove1); 6118 return false; 6119 }, 6120 6121 add: add 6122 }; 6123 6124 jQuery.event.special.move = { 6125 setup: function() { 6126 on(this, 'movestart', enableMove2); 6127 return false; 6128 }, 6129 6130 teardown: function() { 6131 off(this, 'movestart', enableMove2); 6132 return false; 6133 }, 6134 6135 add: add 6136 }; 6137 6138 jQuery.event.special.moveend = { 6139 setup: function() { 6140 on(this, 'movestart', enableMove3); 6141 return false; 6142 }, 6143 6144 teardown: function() { 6145 off(this, 'movestart', enableMove3); 6146 return false; 6147 }, 6148 6149 add: add 6150 }; 6151}); 6152 6153 $.fn.twentytwenty = function(options) { 6154 var options = $.extend({ 6155 default_offset_pct: 0.5, 6156 orientation: 'horizontal', 6157 before_label: 'Before', 6158 after_label: 'After', 6159 no_overlay: false, 6160 move_slider_on_hover: false, 6161 move_with_handle_only: true, 6162 click_to_move: false 6163 }, options); 6164 6165 return this.each(function() { 6166 6167 var sliderPct = options.default_offset_pct; 6168 var container = $(this); 6169 var sliderOrientation = options.orientation; 6170 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 6171 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 6172 6173 6174 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 6175 if(!options.no_overlay) { 6176 container.append("<div class='twentytwenty-overlay'></div>"); 6177 var overlay = container.find(".twentytwenty-overlay"); 6178 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 6179 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 6180 } 6181 var beforeImg = container.find("img:first"); 6182 var afterImg = container.find("img:last"); 6183 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 6184 var slider = container.find(".twentytwenty-handle"); 6185 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 6186 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 6187 container.addClass("twentytwenty-container"); 6188 beforeImg.addClass("twentytwenty-before"); 6189 afterImg.addClass("twentytwenty-after"); 6190 6191 var calcOffset = function(dimensionPct) { 6192 var w = beforeImg.width(); 6193 var h = beforeImg.height(); 6194 return { 6195 w: w+"px", 6196 h: h+"px", 6197 cw: (dimensionPct*w)+"px", 6198 ch: (dimensionPct*h)+"px" 6199 }; 6200 }; 6201 6202 var adjustContainer = function(offset) { 6203 if (sliderOrientation === 'vertical') { 6204 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 6205 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 6206 } 6207 else { 6208 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 6209 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 6210 } 6211 container.css("height", offset.h); 6212 }; 6213 6214 var adjustSlider = function(pct) { 6215 var offset = calcOffset(pct); 6216 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 6217 adjustContainer(offset); 6218 }; 6219 6220 // Return the number specified or the min/max number if it outside the range given. 6221 var minMaxNumber = function(num, min, max) { 6222 return Math.max(min, Math.min(max, num)); 6223 }; 6224 6225 // Calculate the slider percentage based on the position. 6226 var getSliderPercentage = function(positionX, positionY) { 6227 var sliderPercentage = (sliderOrientation === 'vertical') ? 6228 (positionY-offsetY)/imgHeight : 6229 (positionX-offsetX)/imgWidth; 6230 6231 return minMaxNumber(sliderPercentage, 0, 1); 6232 }; 6233 6234 6235 $(window).on("resize.twentytwenty", function(e) { 6236 adjustSlider(sliderPct); 6237 }); 6238 6239 var offsetX = 0; 6240 var offsetY = 0; 6241 var imgWidth = 0; 6242 var imgHeight = 0; 6243 var onMoveStart = function(e) { 6244 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 6245 e.preventDefault(); 6246 } 6247 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 6248 e.preventDefault(); 6249 } 6250 container.addClass("active"); 6251 offsetX = container.offset().left; 6252 offsetY = container.offset().top; 6253 imgWidth = beforeImg.width(); 6254 imgHeight = beforeImg.height(); 6255 }; 6256 var onMove = function(e) { 6257 if (container.hasClass("active")) { 6258 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6259 adjustSlider(sliderPct); 6260 } 6261 }; 6262 var onMoveEnd = function() { 6263 container.removeClass("active"); 6264 }; 6265 6266 var moveTarget = options.move_with_handle_only ? slider : container; 6267 moveTarget.on("movestart",onMoveStart); 6268 moveTarget.on("move",onMove); 6269 moveTarget.on("moveend",onMoveEnd); 6270 6271 if (options.move_slider_on_hover) { 6272 container.on("mouseenter", onMoveStart); 6273 container.on("mousemove", onMove); 6274 container.on("mouseleave", onMoveEnd); 6275 } 6276 6277 slider.on("touchmove", function(e) { 6278 e.preventDefault(); 6279 }); 6280 6281 container.find("img").on("mousedown", function(event) { 6282 event.preventDefault(); 6283 }); 6284 6285 if (options.click_to_move) { 6286 container.on('click', function(e) { 6287 offsetX = container.offset().left; 6288 offsetY = container.offset().top; 6289 imgWidth = beforeImg.width(); 6290 imgHeight = beforeImg.height(); 6291 6292 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6293 adjustSlider(sliderPct); 6294 }); 6295 } 6296 6297 $(window).trigger("resize.twentytwenty"); 6298 }); 6299 }; 6300 6301 6302 $(window).on("load", function(e) { 6303 $('.twentytwenty-container').each(function(){ 6304 var $container = $(this); 6305 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6306 $container.twentytwenty(); 6307 } 6308 $('img', $container).on('async-done', function(){ 6309 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6310 $container.twentytwenty(); 6311 } 6312 }); 6313 }); 6314 }); 6315} 6316 6317UNCODE.justifiedGallery = function() { 6318 6319 var breakPointMe = function( val ) { 6320 val = parseInt( val ); 6321 if ( isNaN(val) ) { 6322 return false;
6323 } 6324 if ( val >= 1500 ) { 6325 return 1; 6326 } else if ( val < 1500 && val >= 960 ) { 6327 return 2; 6328 } else if ( val < 960 && val >= 570 ) { 6329 return 3; 6330 } else if ( val < 570 ) { 6331 return 4; 6332 } 6333 } 6334 6335 var gutterByBreakpoint = function( bp, gutter ) { 6336 var ret; 6337 switch(gutter) { 6338 case 'no-gutter': 6339 ret = 0; 6340 break; 6341 case 'px-gutter': 6342 ret = 1; 6343 break; 6344 case 'half-gutter': 6345 ret = 18; 6346 break; 6347 case 'double-gutter': 6348 switch(bp) { 6349 case 3: 6350 case 4: 6351 ret = 36; 6352 break; 6353 default: 6354 ret = 72; 6355 break; 6356 } 6357 break; 6358 case 'triple-gutter': 6359 switch(bp) { 6360 case 3: 6361 case 4: 6362 ret = 36; 6363 break; 6364 default: 6365 ret = 108; 6366 break; 6367 } 6368 break; 6369 case 'quad-gutter': 6370 switch(bp) { 6371 case 2: 6372 ret = 108; 6373 break; 6374 case 3: 6375 ret = 72; 6376 break; 6377 case 4: 6378 ret = 36; 6379 break; 6380 default: 6381 ret = 144; 6382 break; 6383 } 6384 break; 6385 default: 6386 ret = 36;//single-gutter 6387 } 6388 return ret; 6389 } 6390 6391 if ($('.justified-layout').length > 0) { 6392 var justifiedContainersArray = [], 6393 typeGridArray = [], 6394 layoutGridArray = [], 6395 transitionDuration = [], 6396 $filterItems = [], 6397 $filters = $('.justified-system .isotope-filters'), 6398 $itemSelector = '.tmb', 6399 $items, 6400 itemMargin, 6401 correctionFactor = 0, 6402 firstLoad = true, 6403 isOriginLeft = $('body').hasClass('rtl') ? false : true, 6404 prevW = breakPointMe(UNCODE.wwidth); 6405 $('[class*="justified-container"]').each(function() { 6406 var isoData = $(this).data(); 6407 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6408 if (isoData.type == 'metro') typeGridArray.push(true); 6409 else typeGridArray.push(false); 6410 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 6411 else layoutGridArray.push('justified'); 6412 justifiedContainersArray.push($(this)); 6413 }); 6414 var init_justifiedGallery = function() { 6415 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 6416 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 6417 justifiedId = justifiedSystem.attr('id'), 6418 $layoutMode = layoutGridArray[i], 6419 gutter = $(justifiedContainersArray[i]).data('gutter'), 6420 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 6421 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 6422 lastRow = $(justifiedContainersArray[i]).data('last-row'), 6423 margins; 6424 6425 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 6426 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 6427 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6428 6429 margins = gutterByBreakpoint(prevW, gutter); 6430 6431 $(justifiedContainersArray[i]).justifiedGallery({ 6432 rowHeight: rowHeight, 6433 maxRowHeight: maxRowHeight, 6434 margins: margins, 6435 cssAnimation: true, 6436 lastRow: lastRow, 6437 waitThumbnailsLoad: false 6438 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 6439 6440 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 6441 $(justifiedContainersArray[i]).infinitescroll({ 6442 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 6443 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6444 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 6445 animate: false, 6446 behavior: 'local', 6447 debug: false, 6448 loading: { 6449 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 6450 speed: 0, 6451 finished: undefined, 6452 msg: $('#' + justifiedId + ' .loadmore-button'), 6453 }, 6454 errorCallback: function() { 6455 var justified_system = $(this).closest('.justified-system'); 6456 $('.loading-button', justified_system).hide(); 6457 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6458 } 6459 }, 6460 // append the new items to galleryJustified on the infinitescroll callback function. 6461 function(newElements, opts) { 6462 var $galleryJustified = $(this), 6463 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6464 filters = new Array(), 6465 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6466 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6467 $numPages = $('a', $infinite_button).data('pages'),
6468 delay = 300; 6469 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6470 $infinite_button.show(); 6471 $loading_button.hide(); 6472 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6473 $('> li', $galleryJustified).remove(); 6474 $.each($(newElements), function(index, val) { 6475 $(val).addClass('tmb-iso'); 6476 if ($(val).is("li")) { 6477 filters.push($(val)[0]); 6478 } 6479 $(val).addClass('uncode-appended'); 6480 }); 6481 newElements = newElements.filter(function(x) { 6482 return filters.indexOf(x) < 0 6483 }); 6484 $.each($(filters), function(index, val) { 6485 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6486 }); 6487 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6488 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6489 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6490 if (typeof getLightbox === 'object') { 6491 getLightbox.refresh(); 6492 } else { 6493 UNCODE.lightbox(); 6494 } 6495 } 6496 if ( typeof twttr !== 'undefined' ) 6497 twttr.widgets.load(justifiedContainersArray[i]); 6498 6499 requestTimeout(function() { 6500 $galleryJustified.trigger('more-items-loaded'); 6501 $(window).trigger('more-items-loaded'); 6502 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6503 }, 1000); 6504 }); 6505 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6506 var $infinite_justified = $(justifiedContainersArray[i]), 6507 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6508 $infinite_justified.infinitescroll('pause'); 6509 $infinite_button.on('click', function(event) { 6510 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6511 $.each(UNCODE.lightboxArray, function(index, val) { 6512 UNCODE.lightboxArray[index].destroy(); 6513 }); 6514 } 6515 event.preventDefault(); 6516 var $justified_system = $(event.target).closest('.justified-system'), 6517 $infinite_justified = $justified_system.find('.justified-container'), 6518 justifiedId = $justified_system.attr('id'); 6519 $(event.currentTarget).html(SiteParameters.loading); 6520 $infinite_justified.infinitescroll('resume'); 6521 $infinite_justified.infinitescroll('retrieve'); 6522 $infinite_justified.infinitescroll('pause'); 6523 $infinite_justified.trigger('more-items-loaded'); 6524 $(window).trigger('more-items-loaded'); 6525 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6526 }); 6527 } 6528 } 6529 } 6530 }, 6531 onLayout = function(justifiedObj, startIndex) { 6532 justifiedObj.css('opacity', 1); 6533 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6534 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6535 6536 requestTimeout(function() { 6537 // window.dispatchEvent(UNCODE.boxEvent); 6538 UNCODE.adaptive(); 6539 if (SiteParameters.dynamic_srcset_active === '1') { 6540 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6541 } 6542 if (typeof MediaElement === "function") { 6543 $(justifiedObj).find('audio,video').each(function() { 6544 $(this).mediaelementplayer({ 6545 pauseOtherPlayers: false, 6546 }); 6547 }); 6548 } 6549 if ($(justifiedObj).find('.nested-carousel').length) { 6550 if (typeof UNCODE.carousel !== 'undefined') { 6551 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6552 } 6553 requestTimeout(function() { 6554 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6555 justifiedObj.addClass('justified-gallery-finished') 6556 Waypoint.refreshAll(); 6557 }, 200); 6558 } else { 6559 requestTimeout(function() { 6560 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6561 justifiedObj.addClass('justified-gallery-finished') 6562 Waypoint.refreshAll(); 6563 }, 300); 6564 } 6565 }, 100); 6566 6567 }, 6568 boxAnimation = function(items, startIndex, sequential, container) { 6569 var $allItems = items.length - startIndex, 6570 showed = 0, 6571 index = 0; 6572 if (container.closest('.owl-item').length == 1) return false;
6573 $.each(items, function(index, val) { 6574 var elInner = $('> .t-inside', val); 6575 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6576 return; 6577 } 6578 if (val[0]) val = val[0]; 6579 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6580 new Waypoint({ 6581 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6582 element: val, 6583 handler: function() { 6584 var element = $('> .t-inside', this.element), 6585 parent = $(this.element), 6586 currentIndex = parent.index(); 6587 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6588 delayAttr = parseInt(element.attr('data-delay')); 6589 if (isNaN(delayAttr)) delayAttr = 100; 6590 delay -= showed; 6591 var objTimeout = requestTimeout(function() { 6592 element.removeClass('zoom-reverse').addClass('start_animation'); 6593 showed = parent.index(); 6594 }, delay * delayAttr); 6595 parent.data('objTimeout', objTimeout); 6596 if (!UNCODE.isUnmodalOpen) { 6597 this.destroy(); 6598 } 6599 }, 6600 offset: '100%' 6601 }) 6602 } else { 6603 elInner.removeClass('animate_when_almost_visible'); 6604 $(val).addClass('no-waypoint-animation'); 6605 /*if (elInner.hasClass('force-anim')) { 6606 elInner.addClass('start_animation'); 6607 } else { 6608 elInner.css('opacity', 1); 6609 }*/ 6610 } 6611 index++; 6612 }); 6613 }; 6614 $filters.on('click', 'a[data-filter]', function(evt) { 6615 var $filter = $(this), 6616 filterContainer = $filter.closest('.isotope-filters'), 6617 filterValue = $filter.attr('data-filter'), 6618 container = $filter.closest('.justified-system').find($('.justified-layout')), 6619 lastRow = container.data('last-row'), 6620 transitionDuration = 0, 6621 delay = 300, 6622 filterItems = []; 6623 6624 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6625 6626 var filter_items = function(){ 6627 if (filterValue !== undefined) { 6628 $.each($('> .tmb > .t-inside', container), function(index, val) { 6629 var parent = $(val).parent(), 6630 objTimeout = parent.data('objTimeout'); 6631 if (objTimeout) { 6632 $(val).removeClass('zoom-reverse'); 6633 clearRequestTimeout(objTimeout); 6634 } 6635 if (transitionDuration == 0) { 6636 if ($(val).hasClass('animate_when_almost_visible')) { 6637 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6638 } else { 6639 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6640 } 6641 } 6642 }); 6643 6644 requestTimeout(function() { 6645 var $block, 6646 selector, 6647 lightboxElements, 6648 $boxes; 6649 6650 if ( filterValue !== '' && filterValue !== '*' ) { 6651 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6652 selector = '.' + filterValue; 6653 $.each($(selector, container), function(index, block) { 6654 lightboxElements = $('[data-lbox^=ilightbox]', block); 6655 if (lightboxElements.length) { 6656 lightboxElements.removeClass('lb-disabled'); 6657 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6658 } 6659 filterItems.push(block); 6660 }); 6661 container.justifiedGallery({ 6662 filter: selector, 6663 lastRow: 'nojustify' 6664 }); 6665 } else { 6666 container.justifiedGallery({ 6667 filter: false, 6668 lastRow: lastRow 6669 }); 6670 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6671 filterItems = $('> .tmb', container); 6672 } 6673 container.trigger('more-items-loaded'); 6674 $(window).trigger('more-items-loaded'); 6675 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6676 6677 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6678 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6679 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6680 if (typeof getLightbox === 'object') { 6681 getLightbox.refresh(); 6682 } else { 6683 UNCODE.lightbox(); 6684 } 6685 } 6686 6687 if (transitionDuration == 0) { 6688 requestTimeout(function() { 6689 boxAnimation(filterItems, 0, false, container); 6690 }, 100); 6691 } 6692 requestTimeout(function() { 6693 Waypoint.refreshAll(); 6694 container.trigger('more-items-loaded'); 6695 $(window).trigger('more-items-loaded'); 6696 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6697 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 6698 $(document).trigger('uncode-scrolltrigger-refresh'); 6699 } 6700 }, 2000); 6701 6702 }, delay); 6703 } else { 6704 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6705 $.each(UNCODE.lightboxArray, function(index, val) { 6706 UNCODE.lightboxArray[index].destroy(); 6707 }); 6708 } 6709 $.each($('> .tmb > .t-inside', container), function(index, val) { 6710 var parent = $(val).parent(), 6711 objTimeout = parent.data('objTimeout'); 6712 if (objTimeout) { 6713 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6714 clearRequestTimeout(objTimeout); 6715 } 6716 if (transitionDuration == 0) { 6717 if ($(val).hasClass('animate_when_almost_visible')) { 6718 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6719 } else { 6720 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6721 } 6722 } 6723 }); 6724 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6725 UNCODE.lightbox(); 6726 } 6727 container.parent().addClass('justified-loading'); 6728 container.trigger('more-items-loaded'); 6729 $(window).trigger('more-items-loaded'); 6730 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6731 } 6732 }; 6733 6734 if (!$filter.hasClass('active')) { 6735 /** Scroll top with filtering */ 6736 if (filterContainer.hasClass('filter-scroll')) { 6737 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6738 calc_scroll -= UNCODE.get_scroll_offset(); 6739 6740 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6741 delta = bodyTop - calc_scroll, 6742 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6743 filterTolerance = false, 6744 filter_timeout; 6745 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6746 6747 if ( !UNCODE.isFullPage ) { 6748 if (scrollSpeed == 0) { 6749 $('html, body').scrollTop(calc_scroll); 6750 UNCODE.scrolling = false;
6751 filter_items(); 6752 } else { 6753 6754 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6755 filter_items(); 6756 filterTolerance = true; 6757 } 6758 6759 $('html, body').animate({ 6760 scrollTop: calc_scroll 6761 },{ 6762 easing: 'easeInOutQuad', 6763 duration: scrollSpeed, 6764 complete: function(){ 6765 UNCODE.scrolling = false; 6766 if ( !filterTolerance ) { 6767 filter_timeout = setTimeout(function(){ 6768 clearTimeout(filter_timeout); 6769 filter_items(); 6770 }, 200); 6771 } 6772 } 6773 }); 6774 } 6775 } 6776 } else { 6777 filter_items(); 6778 } 6779 } 6780 evt.preventDefault(); 6781 }); 6782 6783 $filters.each(function(i, buttonGroup) { 6784 var $buttonGroup = $(buttonGroup); 6785 $buttonGroup.on('click', 'a', function() { 6786 $buttonGroup.find('.active').removeClass('active'); 6787 $(this).addClass('active'); 6788 }); 6789 6790 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6791 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6792 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6793 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6794 e.preventDefault(); 6795 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6796 }); 6797 }); 6798 window.addEventListener('boxResized', function(e) { 6799 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6800 prevW = breakPointMe(UNCODE.wwidth); 6801 $.each($('.justified-layout'), function(index, val) { 6802 var gutter = $(this).data('gutter'), 6803 margins = gutterByBreakpoint( prevW, gutter); 6804 $(this).justifiedGallery({ 6805 margins: margins 6806 }); 6807 $(this).find('.mejs-video,.mejs-audio').each(function() { 6808 $(this).trigger('resize'); 6809 }); 6810 }); 6811 } 6812 }, false); 6813 6814 init_justifiedGallery(); 6815 }; 6816}; 6817 6818UNCODE.cssGrid = function() { 6819 if ($('.cssgrid-layout').length > 0) { 6820 var cssGridContainersArray = []; 6821 var transitionDuration = []; 6822 var $filters = $('.cssgrid-system .cssgrid-filters'); 6823 6824 $('[class*="cssgrid-container"]').each(function() { 6825 cssGridContainersArray.push($(this)); 6826 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6827 }); 6828 6829 var init_cssGridAjax = function() { 6830 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6831 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6832 cssGridId = cssGridSystem.attr('id'); 6833 6834 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6835 6836 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6837 $(cssGridContainersArray[i]).infinitescroll({ 6838 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6839 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6840 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 6841 animate: false, 6842 behavior: 'local', 6843 debug: false, 6844 loading: { 6845 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6846 speed: 0, 6847 finished: undefined, 6848 msg: $('#' + cssGridId + ' .loadmore-button'), 6849 }, 6850 errorCallback: function() { 6851 var cssgrid_system = $(this).closest('.cssgrid-system'); 6852 $('.loading-button', cssgrid_system).hide(); 6853 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6854 } 6855 }, 6856 // append the new items to cssGrid on the infinitescroll callback function. 6857 function(newElements, opts) { 6858 var $cssGrid = $(this), 6859 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6860 cssGridId = cssGridSystemCont.attr('id'), 6861 filters = new Array(), 6862 $loading_button = cssGridSystemCont.find('.loading-button'), 6863 $infinite_button = cssGridSystemCont.find('.loadmore-button'), 6864 $numPages = $('a', $infinite_button).data('pages'), 6865 $woo_results,
6866 delay = 300; 6867 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6868 $infinite_button.show(); 6869 $loading_button.hide(); 6870 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6871 $('> li', $cssGrid).remove(); 6872 $('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove(); 6873 $.each($(newElements), function (index, val) { 6874 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 6875 $woo_results = $(val); 6876 delete newElements[index]; 6877 } else { 6878 $(val).addClass('tmb-grid'); 6879 if ($(val).is("li")) { 6880 filters.push($(val)[0]); 6881 } 6882 } 6883 $(val).addClass('uncode-appended'); 6884 }); 6885 newElements = newElements.filter(function(x) { 6886 return filters.indexOf(x) < 0 6887 }); 6888 $.each($(filters), function(index, val) { 6889 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6890 }); 6891 if ($woo_results && $woo_results.length > 0) { 6892 var old_count = cssGridSystemCont.find('.woocommerce-result-count').text(); 6893 var new_count = $woo_results.find('.woocommerce-result-count').text(); 6894 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 6895 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 6896 function replaceMatch(match, p1, p2) { 6897 return old_start + '–' + new_end; 6898 } 6899 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 6900 cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text); 6901 } 6902 6903 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6904 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6905 if (filterValue !== undefined && filterValue != '*') { 6906 $(newElements).hide(); 6907 var els_to_show = $(); 6908 $(newElements).each(function() { 6909 var el = $(this); 6910 if (el.hasClass(filterValue)) { 6911 els_to_show = els_to_show.add(el); 6912 el.show(); 6913 } 6914 }); 6915 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6916 } else { 6917 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6918 } 6919 6920 UNCODE.adaptive(); 6921 if (SiteParameters.dynamic_srcset_active === '1') { 6922 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6923 } 6924 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6925 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6926 if (typeof getLightbox === 'object') { 6927 getLightbox.refresh(); 6928 } else { 6929 UNCODE.lightbox(); 6930 } 6931 } 6932 if ( typeof twttr !== 'undefined' ) { 6933 twttr.widgets.load(cssGridContainersArray[i]); 6934 } 6935 6936 UNCODE.carousel($(newElements)); 6937 requestTimeout(function() { 6938 $cssGrid.trigger('more-items-loaded'); 6939 $(window).trigger('more-items-loaded'); 6940 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6941 }, 1000); 6942 6943 }); 6944 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6945 var $cssgrid_el = $(cssGridContainersArray[i]), 6946 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6947 $cssgrid_el.infinitescroll('pause'); 6948 $infinite_button.on('click', function(event) { 6949 event.preventDefault(); 6950 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6951 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6952 cssGridId = $cssgrid_system.attr('id'); 6953 $(event.currentTarget).html(SiteParameters.loading); 6954 $cssgrid_el.infinitescroll('resume'); 6955 $cssgrid_el.infinitescroll('retrieve'); 6956 $cssgrid_el.infinitescroll('pause'); 6957 }); 6958 } 6959 } 6960 } 6961 }; 6962 6963 init_cssGridAjax(); 6964 6965 if ($('.cssgrid-pagination').length > 0) { 6966 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 6967 evt.preventDefault(); 6968 6969 if (SiteParameters.index_pagination_disable_scroll !== '1') { 6970 var container = $(this).closest('.cssgrid-system'), 6971 pagination_disable_scroll = container.attr('data-pagination-scroll'), 6972 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6973 6974 if ( pagination_disable_scroll === 'disabled' ) { 6975 return; 6976 } 6977 6978 calc_scroll -= UNCODE.get_scroll_offset(); 6979 6980 var menu_container = $('.menu-sticky'); 6981 var menu = menu_container.find('.menu-container'); 6982 6983 if (menu_container.length > 0 && menu.length > 0) { 6984 calc_scroll = calc_scroll - menu.outerHeight(); 6985 } 6986 6987 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6988 delta = bodyTop - calc_scroll, 6989 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6990 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6991 6992 if ( !UNCODE.isFullPage ) { 6993 if (scrollSpeed == 0) { 6994 $('html, body').scrollTop(calc_scroll); 6995 } else { 6996 $('html, body').animate({ 6997 scrollTop: calc_scroll 6998 },{ 6999 easing: 'easeInOutQuad', 7000 duration: scrollSpeed, 7001 complete: function(){ 7002 UNCODE.scrolling = false; 7003 } 7004 }); 7005 } 7006 } 7007 } 7008 7009 loadCssGrid($(this), true); 7010 }); 7011 } 7012 7013 $filters.on('click', 'a.grid-nav-link', function(evt) { 7014 if ($(this).hasClass('no-grid-filter')) { 7015 return; 7016 } 7017 var $filter = $(this), 7018 filterContainer = $filter.closest('.cssgrid-filters'), 7019 filterValue = $filter.attr('data-filter'), 7020 containerSystem = $filter.closest('.cssgrid-system'), 7021 container = containerSystem.find($('.cssgrid-layout')), 7022 transitionDuration = containerSystem.data('transitionDuration'),
7023 delay = 300, 7024 filterItems = [], 7025 all_thumbs = container.find('.tmb-grid'); 7026 7027 var filter_items = function(){ 7028 if (filterValue !== undefined) { 7029 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7030 var parent = $(val).parent(), 7031 objTimeout = parent.data('objTimeout'); 7032 if (objTimeout) { 7033 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7034 clearRequestTimeout(objTimeout); 7035 } 7036 if (transitionDuration == 0) { 7037 if ($(val).hasClass('animate_when_almost_visible')) { 7038 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7039 } else { 7040 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7041 } 7042 } 7043 }); 7044 requestTimeout(function(){ 7045 if ( filterValue == '*' ) { 7046 all_thumbs.show(); 7047 all_thumbs.each(function(index, val) { 7048 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7049 filterItems.push($(this)); 7050 }); 7051 } else { 7052 all_thumbs.each(function() { 7053 var _tmb = $(this); 7054 if (_tmb.hasClass(filterValue)) { 7055 _tmb.show(); 7056 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7057 filterItems.push(_tmb); 7058 } else { 7059 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 7060 _tmb.hide(); 7061 } 7062 }); 7063 } 7064 7065 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 7066 7067 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7068 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 7069 var lightboxElements = $('[data-lbox^=ilightbox]', container); 7070 if (lightboxElements.length) { 7071 container.data('lbox', $(lightboxElements[0]).data('lbox')); 7072 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7073 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 7074 if (typeof getLightbox === 'object') { 7075 getLightbox.refresh(); 7076 } else { 7077 UNCODE.lightbox(); 7078 } 7079 } 7080 } 7081 container.trigger('more-items-loaded'); 7082 $(window).trigger('more-items-loaded'); 7083 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7084 }, delay); 7085 } else { 7086 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7087 var parent = $(val).parent(), 7088 objTimeout = parent.data('objTimeout'); 7089 if (objTimeout) { 7090 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7091 clearRequestTimeout(objTimeout); 7092 } 7093 if (transitionDuration == 0) { 7094 if ($(val).hasClass('animate_when_almost_visible')) { 7095 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7096 } else { 7097 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7098 } 7099 } 7100 }); 7101 loadCssGrid($filter); 7102 } 7103 }; 7104 7105 if (!$filter.hasClass('active')) { 7106 /** Scroll top with filtering */ 7107 if (filterContainer.hasClass('filter-scroll')) { 7108 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 7109 calc_scroll -= UNCODE.get_scroll_offset(); 7110 7111 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7112 delta = bodyTop - calc_scroll, 7113 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 7114 filterTolerance = false, 7115 filter_timeout; 7116 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7117 7118 if ( !UNCODE.isFullPage ) { 7119 if (scrollSpeed == 0) { 7120 $('html, body').scrollTop(calc_scroll); 7121 UNCODE.scrolling = false; 7122 filter_items(); 7123 } else { 7124 7125 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 7126 filter_items(); 7127 filterTolerance = true; 7128 } 7129 7130 $('html, body').animate({ 7131 scrollTop: calc_scroll 7132 },{ 7133 easing: 'easeInOutQuad', 7134 duration: scrollSpeed, 7135 complete: function(){ 7136 UNCODE.scrolling = false;
7137 if ( !filterTolerance ) { 7138 filter_timeout = setTimeout(function(){ 7139 clearTimeout(filter_timeout); 7140 filter_items(); 7141 }, 200); 7142 } 7143 } 7144 }); 7145 } 7146 } 7147 } else { 7148 filter_items(); 7149 } 7150 } 7151 evt.preventDefault(); 7152 }); 7153 7154 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 7155 var params = UNCODE.getURLParams(window.location); 7156 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 7157 7158 UNCODE.lastURL = window.location.href; 7159 7160 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 7161 return; 7162 } 7163 7164 if (params.id === undefined) { 7165 $.each($('.cssgrid-system'), function(index, val) { 7166 loadCssGrid($(val)); 7167 }); 7168 } else { 7169 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 7170 loadCssGrid($('#' + params.id)); 7171 } 7172 } 7173 }); 7174 7175 var loadCssGrid = function($href, $paginating) { 7176 var is_paginating = false; 7177 7178 if (undefined !== $paginating && $paginating) { 7179 var is_paginating = $paginating; 7180 } 7181 7182 var href = ($href.is("a") ? $href.attr('href') : location), 7183 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 7184 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 7185 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 7186 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 7187 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 7188 cssgridId = cssgridSystem.attr('id'); 7189 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 7190 UNCODE.lastURL = href; 7191 history.pushState({ 7192 myCSSgrid: true 7193 }, document.title, href); 7194 } 7195 cssgridWrapper.addClass('cssgrid-loading'); 7196 if (is_paginating) { 7197 cssgridWrapper.addClass('grid-filtering'); 7198 } 7199 $.ajax({ 7200 url: href 7201 }).done(function(data) { 7202 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 7203 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 7204 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 7205 requestTimeout(function() { 7206 cssgridContainer.html($resultItems); 7207 cssgridWrapper.removeClass('cssgrid-loading'); 7208 cssgridWrapper.removeClass('grid-filtering'); 7209 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7210 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 7211 UNCODE.adaptive(); 7212 if (SiteParameters.dynamic_srcset_active === '1') { 7213 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 7214 } 7215 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7216 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 7217 if (typeof getLightbox === 'object') { 7218 getLightbox.refresh(); 7219 } else { 7220 UNCODE.lightbox(); 7221 } 7222 } 7223 cssgridContainer.trigger('more-items-loaded'); 7224 $(window).trigger('more-items-loaded'); 7225 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7226 }, 300); 7227 7228 $('.pagination', cssgridFooter).remove(); 7229 cssgridFooter.append($resultPagination); 7230 7231 if (cssgridResultCount.length > 0) { 7232 $('.woocommerce-result-count', cssgridResultCount).remove(); 7233 cssgridResultCount.append($resultCount); 7234 } 7235 }); 7236 }; 7237 7238 $filters.each(function(i, buttonGroup) { 7239 var $buttonGroup = $(buttonGroup); 7240 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 7241 $buttonGroup.find('.active').removeClass('active'); 7242 $(this).addClass('active'); 7243 7244 }); 7245 7246 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 7247 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 7248 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 7249 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 7250 e.preventDefault(); 7251 $cats_filters.slideToggle(400, 'easeInOutCirc'); 7252 }); 7253 7254 }); 7255 }; 7256}; 7257 7258UNCODE.linearGrid = function(){ 7259 $('.linear-wrapper').each(function(){ 7260 var $wrap = $(this), 7261 $system = $wrap.closest('.linear-system'), 7262 $dragger = $('[data-dragger]', $system), 7263 $row = $wrap.closest('.vc_row[data-parent]'),
7264 _row = $row[0], 7265 $cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap), 7266 vertical = $cont.hasClass('linear-or-vertical'), 7267 clone = $wrap.attr('data-infinite') === 'yes' || vertical, 7268 freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop', 7269 freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile', 7270 dataSpeed = parseFloat( $wrap.attr('data-speed') ), 7271 isInViewport = false, 7272 isHover = false, 7273 init = false, 7274 stableHeight = UNCODE.wheight, 7275 wCont, hCont, docH, marqueeTL; 7276 7277 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 7278 var dataX = dataSpeed; 7279 7280 dataSpeed += 5; 7281 7282 var checkLinearGridSize = function(){ 7283 if ( !$wrap.is(':visible') ) { 7284 return; 7285 } 7286 $wrap.find('.cont-appended').remove(); 7287 7288 if ( vertical ) { 7289 if ( ! SiteParameters.is_frontend_editor ) { 7290 hCont = $cont.outerHeight(); 7291 docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed ); 7292 if ( hCont < docH ) { 7293 var res = docH - hCont * 3, 7294 times = 2 * Math.round((res/hCont+1) / 2); 7295 } 7296 for ( var i = 0; i < times; i++ ) { 7297 var $cloneCont = $cont.clone(), 7298 $cloneCont2 = $cont.clone(), 7299 trans = ( (i+2) ) * 100; 7300 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'})); 7301 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'})); 7302 $cloneCont.find('a[data-lbox]').each(function(){ 7303 var dataLbox = $(this).attr('data-lbox'); 7304 $(this).attr('data-lbox', dataLbox + '_' + i); 7305 }); 7306 $cloneCont.find('.wp-video-shortcode').each(function(){ 7307 var thisID = $(this).attr('id'); 7308 $(this).attr('id', thisID + '_' + i); 7309 }); 7310 $cloneCont2.find('a[data-lbox]').each(function(){ 7311 var dataLbox = $(this).attr('data-lbox'); 7312 $(this).attr('data-lbox', dataLbox + '_2' + i); 7313 }); 7314 $cloneCont2.find('.wp-video-shortcode').each(function(){ 7315 var thisID = $(this).attr('id'); 7316 $(this).attr('id', thisID + '__' + i); 7317 }); 7318 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7319 UNCODE.lightgallery($cloneCont); 7320 UNCODE.lightgallery($cloneCont2); 7321 } 7322 } 7323 } 7324 } else { 7325 wCont = $cont.outerWidth(); 7326 if ( (wCont) < UNCODE.wwidth*2 ) { 7327 var res = UNCODE.wwidth*2 - (wCont), 7328 times = 2 * Math.round((res/wCont+1) / 2); 7329 } 7330 for ( var i = 0; i < times; i++ ) { 7331 var $cloneCont = $cont.clone(), 7332 $cloneCont2 = $cont.clone(), 7333 trans = ( (i+2) ) * 100; 7334 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'})); 7335 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'})); 7336 $cloneCont.find('a[data-lbox]').each(function(){ 7337 var dataLbox = $(this).attr('data-lbox'); 7338 $(this).attr('data-lbox', dataLbox + '_' + i); 7339 }); 7340 $cloneCont.find('[id]').each(function(){ 7341 var thisID = $(this).attr('id'); 7342 $(this).attr('id', thisID + '_' + i); 7343 }); 7344 $cloneCont2.find('a[data-lbox]').each(function(){ 7345 var dataLbox = $(this).attr('data-lbox'); 7346 $(this).attr('data-lbox', dataLbox + '_2' + i); 7347 }); 7348 $cloneCont2.find('[id]').each(function(){ 7349 var thisID = $(this).attr('id'); 7350 $(this).attr('id', thisID + '__' + i); 7351 }); 7352 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7353 UNCODE.lightgallery($cloneCont); 7354 UNCODE.lightgallery($cloneCont2); 7355 } 7356 } 7357 } 7358 }; 7359 if ( clone ) { 7360 checkLinearGridSize(); 7361 $(window).on('resize.linearGrid', function(){ 7362 checkLinearGridSize(); 7363 }); 7364 } 7365 7366 var continuousLinearMarquee = function(_xStrt){ 7367 if ( !$wrap.is(':visible') ) { 7368 return; 7369 } 7370 var ease = 'none'; 7371 wCont = $cont.outerWidth(); 7372 hCont = $cont.outerHeight(); 7373 7374 var xStrt = typeof _xStrt === 'undefined' ? 0 : _xStrt, 7375 xEnd = vertical ? hCont : wCont, 7376 direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7377 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed, 7378 speedSlow = (xEnd + xStrt) / 45, 7379 freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7380 7381 marqueeTL = new TimelineMax({paused:true, reversed:true}); 7382 7383 if ( isInViewport && !isHover && !freezed ) { 7384 marqueeTL.play(); 7385 7386 if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) { 7387 var $column = $wrap.closest('.wpb_column'), 7388 $col_link = $('.col-link', $column), 7389 $hover_sel = $wrap; 7390 7391 if ( $col_link.length ) { 7392 $hover_sel = $wrap.add($column); 7393 } 7394 7395 $hover_sel.on('mouseover', function(){ 7396 if ( $wrap.attr('data-hover') === 'yes' ) { 7397 //speed = ( 10 - dataSpeed ) * 5; 7398 ease = 'power2.out'; 7399 marqueeTL.duration( speedSlow ); 7400 } else { 7401 marqueeTL.pause(); 7402 } 7403 isHover = true; 7404 }).on('mouseout', function(){ 7405 if ( $wrap.attr('data-hover') === 'yes' ) { 7406 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed; 7407 ease = 'power2.in'; 7408 marqueeTL.duration( speed ); 7409 } else { 7410 marqueeTL.play(); 7411 } 7412 isHover = false;
7413 }); 7414 } 7415 7416 } 7417 7418 gsap.killTweensOf($wrap); 7419 if ( vertical ) { 7420 marqueeTL.fromTo( $wrap, { 7421 y: xStrt * direction 7422 }, 7423 { 7424 duration: speed, 7425 y: xEnd * direction * -1, 7426 onComplete: function(){ 7427 continuousLinearMarquee(); 7428 }, 7429 ease: ease, 7430 paused: freezed 7431 }); 7432 } else { 7433 marqueeTL.fromTo( $wrap, { 7434 x: xStrt * direction 7435 }, 7436 { 7437 duration: speed, 7438 x: xEnd * direction * -1, 7439 onComplete: function(){ 7440 continuousLinearMarquee(); 7441 }, 7442 ease: ease, 7443 paused: freezed 7444 }); 7445 } 7446 }; 7447 7448 var dragLinearContinuous = function(){ 7449 if ( !$wrap.is(':visible') ) { 7450 return; 7451 } 7452 var matrix, _x, _y, 7453 dragAction = false; 7454 Draggable.create($wrap[0], { 7455 type: vertical ? "y" : "x", 7456 bounds: document.getElementById("container"), 7457 inertia: false, 7458 onPress: function (e) { 7459 }, 7460 onRelease: function (e) { 7461 if ( dragAction === true ) { 7462 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7463 _x = matrix[12] || matrix[4]; 7464 _y = matrix[13] || matrix[5]; 7465 if ( vertical ) { 7466 continuousLinearMarquee(_y * -1); 7467 } else { 7468 continuousLinearMarquee(_x * -1); 7469 } 7470 $wrap.removeClass('linear-dragging'); 7471 } 7472 }, 7473 onDrag: function (e) { 7474 dragAction = true; 7475 $wrap.addClass('linear-dragging'); 7476 }, 7477 onDragEnd: function (e) { 7478 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7479 _x = matrix[12] || matrix[4]; 7480 _y = matrix[13] || matrix[5]; 7481 wCont = $cont.outerWidth(); 7482 hCont = $cont.outerHeight(); 7483 if ( vertical ) { 7484 if ( Math.abs(_y) > hCont ) { 7485 if ( _y < 0 ) { 7486 _y = hCont + parseFloat( _y ); 7487 } else { 7488 _y = parseFloat( _y ) - hCont; 7489 } 7490 } 7491 continuousLinearMarquee(_y * -1); 7492 } else { 7493 if ( Math.abs(_x) > wCont ) { 7494 if ( _x < 0 ) { 7495 _x = wCont + parseFloat( _x ); 7496 } else { 7497 _x = parseFloat( _x ) - wCont; 7498 } 7499 } 7500 continuousLinearMarquee(_x * -1); 7501 } 7502 $wrap.removeClass('linear-dragging'); 7503 dragAction = false; 7504 }, 7505 }); 7506 }; 7507 7508 var runScrollLinear = function(){ 7509 var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7510 if ( !$wrap.is(':visible') || freezed ) { 7511 return; 7512 } 7513 var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7514 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 7515 7516 var linearGridScroll = function(){ 7517 if ( isInViewport ) { 7518 var bound = _row.getBoundingClientRect(); 7519 7520 var bound_top = bound.top, 7521 gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction ); 7522 7523 if ( vertical ) { 7524 $wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7525 } else { 7526 $wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7527 } 7528 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7529 requestAnimationFrame(linearGridScroll); 7530 } 7531 } 7532 if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) { 7533 window.addEventListener("scroll", linearGridScroll); 7534 } 7535 }; 7536 7537 $(window).on( 'load wwResize', function(e) { 7538 stableHeight = UNCODE.wheight; 7539 linearGridScroll(); 7540 }); 7541 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7542 requestAnimationFrame(linearGridScroll); 7543 } 7544 }; 7545 7546 var dragLinear = function(){ 7547 if ( !$wrap.is(':visible') ) { 7548 return; 7549 } 7550 var matrix, _x, _y; 7551 Draggable.create($dragger[0], { 7552 type: vertical ? "y" : "x", 7553 bounds: document.getElementById("container"), 7554 inertia: false, 7555 onPress: function (e) { 7556 }, 7557 onRelease: function (e) { 7558 }, 7559 onDrag: function (e) { 7560 $wrap.addClass('linear-dragging'); 7561 }, 7562 onDragEnd: function (e) { 7563 matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7564 _x = matrix[12] || matrix[4]; 7565 _y = matrix[13] || matrix[5]; 7566 wCont = $cont.outerWidth(); 7567 hCont = $cont.outerHeight(); 7568 if ( vertical ) { 7569 if ( Math.abs(_y) > hCont ) { 7570 if ( _y < 0 ) { 7571 _y = hCont + parseFloat( _y ); 7572 } else { 7573 _y = parseFloat( _y ) - hCont; 7574 } 7575 gsap.to( $dragger[0], { 7576 duration: 0, 7577 y: _y, 7578 }); 7579 } 7580 } else { 7581 if ( Math.abs(_x) > wCont ) { 7582 if ( _x < 0 ) { 7583 _x = wCont + parseFloat( _x ); 7584 } else { 7585 _x = parseFloat( _x ) - wCont; 7586 } 7587 gsap.to( $dragger[0], { 7588 duration: 0, 7589 x: _x, 7590 }); 7591 } 7592 } 7593 $wrap.removeClass('linear-dragging'); 7594 }, 7595 }); 7596 }; 7597 7598 if ( ! $('body').hasClass('compose-mode') ) { 7599 if ( $wrap.attr('data-animation') === 'marquee' || $wrap.attr('data-animation') === 'marquee-opposite' ) { 7600 continuousLinearMarquee(); 7601 $(window).on( 'wwResize', function(e) { 7602 continuousLinearMarquee(); 7603 }); 7604 if ( $wrap.attr('data-draggable') === 'yes' ) { 7605 dragLinearContinuous(); 7606 } 7607 } 7608 7609 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7610 runScrollLinear(); 7611 if ( $wrap.attr('data-draggable') === 'yes' ) { 7612 dragLinear(); 7613 } 7614 } 7615 7616 if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7617 var observer = new IntersectionObserver(function(entries) { 7618
7619 entries.forEach(function(entry){ 7620 if ( entry.isIntersecting ) { 7621 isInViewport = true; 7622 if ( !init ) { 7623 init = true; 7624 continuousLinearMarquee(); 7625 } else { 7626 if ( typeof marqueeTL !== 'undefined' ) { 7627 marqueeTL.play(); 7628 } 7629 } 7630 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7631 requestAnimFrame(runScrollLinear); 7632 } 7633 } else { 7634 isInViewport = false; 7635 if ( typeof marqueeTL !== 'undefined' ) { 7636 marqueeTL.pause(); 7637 } 7638 } 7639 }); 7640 }, { 7641 root: document, 7642 }); 7643 7644 observer.observe(_row); 7645 7646 } else { 7647 7648 var checkVisible = function( el, off ) { 7649 if (typeof jQuery === "function" && el instanceof jQuery) { 7650 el = el[0]; 7651 } 7652 7653 off = typeof off=='undefined' ? 50 : off; 7654 7655 var rect = el.getBoundingClientRect(); 7656 7657 return ( 7658 ( 7659 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7660 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7661 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7662 ) 7663 ); 7664 }; 7665 7666 var checkVisibility = function(){ 7667 7668 if ( checkVisible($row) ) { 7669 isInViewport = true; 7670 if ( typeof marqueeTL !== 'undefined' ) { 7671 marqueeTL.play(); 7672 } 7673 } else { 7674 isInViewport = false; 7675 if ( typeof marqueeTL !== 'undefined' ) { 7676 marqueeTL.pause(); 7677 } 7678 } 7679 } 7680 7681 window.addEventListener("scroll", checkVisibility); 7682 checkVisibility(); 7683 7684 } 7685 } 7686 }); 7687}; 7688UNCODE.preventDoubleTransition = function() { 7689 $('.sticky-element .animate_when_almost_visible').each(function(){ 7690 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 7691 $el.addClass('do_not_reanimate'); 7692 }); 7693 }); 7694}; 7695 7696UNCODE.checkScrollForTabs = function(){ 7697 var goToSection = window.location.hash.replace('#', ''), 7698 $index; 7699 7700 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 7701 goToSection = encodeURIComponent(goToSection); 7702 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 7703 7704 $index.attr('data-parent', 'parent-' + goToSection); 7705 7706 if (window.location.hash != undefined && window.location.hash != '') { 7707 requestTimeout(function() { 7708 scrollBody('parent-' + goToSection); 7709 }, 500); 7710 } 7711 7712 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 7713 var hash = (e.currentTarget).hash, 7714 index = (e.currentTarget).closest('.uncode-tabs'); 7715 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 7716 $('a[href="' + hash + '"][data-tab-history]').click(); 7717 scrollBody(index); 7718 } 7719 }); 7720 7721 var scrollBody = function(index) { 7722 7723 var getSection = $('a[href="' + index + '"][data-tab-history]'), 7724 scrollTo, 7725 safeGap = 27; 7726 7727 if ( ! getSection.length ) { 7728 getSection = $('div[data-parent="' + index + '"]'); 7729 7730 if ( getSection.attr('data-target') == 'row' ) { 7731 getSection = getSection.closest('.vc_row'); 7732 safeGap = 0; 7733 } 7734 } 7735 7736 if (typeof getSection === 'undefined' || ! getSection.length ) { 7737 return; 7738 } 7739 7740 var body = $("html, body"), 7741 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7742 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 7743 getOffset = UNCODE.get_scroll_offset(); 7744 if ( typeof getSection.offset() === 'undefined' ) 7745 return; 7746 scrollTo = getSection.offset().top - safeGap; 7747 scrollTo -= getOffset; 7748 7749 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7750 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7751 7752 if (index != 0) { 7753 UNCODE.scrolling = true; 7754 } 7755 7756 if (scrollSpeed == 0) { 7757 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 7758 UNCODE.scrolling = false; 7759 } else { 7760 body.animate({ 7761 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 7762 }, scrollSpeed, 'easeInOutQuad', function() { 7763 requestTimeout(function() { 7764 UNCODE.scrolling = false;
7765 if (getOffset != UNCODE.get_scroll_offset()) { 7766 scrollBody(index); 7767 } 7768 }, 100); 7769 }); 7770 } 7771 7772 }; 7773}; 7774 7775UNCODE.printScreen = function() { 7776 var inlineMediaStyle = null, 7777 setResize; 7778 7779 function changeMediaStyle() { 7780 clearRequestTimeout(setResize); 7781 setResize = requestTimeout(function(){ 7782 var $head = document.getElementsByTagName('head')[0], 7783 $newStyle = document.createElement('style'), 7784 winW = window.innerWidth, 7785 printH = window.innerHeight; 7786 7787 $newStyle.setAttribute('type', 'text/css'); 7788 $newStyle.setAttribute('media', 'print'); 7789 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 7790 7791 if (inlineMediaStyle != null) { 7792 $head.replaceChild($newStyle, inlineMediaStyle) 7793 } else { 7794 $head.appendChild($newStyle); 7795 } 7796 inlineMediaStyle = $newStyle; 7797 }, 1000); 7798 } 7799 7800 changeMediaStyle(); 7801 window.addEventListener('resize', changeMediaStyle); 7802}; 7803 7804UNCODE.fullPage = function() { 7805 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 7806 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 7807 return false; 7808 } else { 7809 requestTimeout(function() { 7810 window.scrollTo(0, 0); 7811 }, 10); 7812 } 7813 7814 var $masthead = $('#masthead'), 7815 $logo = $('#logo-container-mobile'), 7816 $logolink = $('[data-minheight]', $logo), 7817 logoMinScale = $logolink.data('minheight'), 7818 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 7819 $container = $('.main-container .post-content'), 7820 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 7821 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 7822 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 7823 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 7824 headerWithOpacity = $('.header-scroll-opacity', $header).length, 7825 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 7826 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 7827 scrollBar = true, 7828 effect, 7829 animationEndTimeOut, 7830 fp_anim_time = 900, 7831 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 7832 is_scrolling = false, 7833 dataNames = [], 7834 is_first = true, 7835 no_history = $('body').hasClass('uncode-scroll-no-history'), 7836 theres_footer = true; 7837 7838 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 7839 $('> div', $footer).each(function(index, el){ 7840 if ( $(el).outerHeight() < 2 ) 7841 theres_footer = false; 7842 else 7843 theres_footer = true; 7844 }); 7845 } 7846 7847 if ( !$footer.length ) 7848 theres_footer = false; 7849 7850 if ( !UNCODE.isFullPageSnap ) { 7851 7852 if ( $('body').hasClass('uncode-fullpage-zoom') ) 7853 effect = 'scaleDown'; 7854 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 7855 effect = 'moveparallax'; 7856 else 7857 effect = 'movecurtain'; 7858 } 7859 7860 if ( $('body').hasClass('uncode-fullpage-trid') ) 7861 fp_anim_time = fp_anim_time*2; 7862 7863 if ( $header.length ) { 7864 if ( headerName !== '' ) 7865 $header.attr('data-name', headerName); 7866 if ( headerLabel !== '' ) 7867 $header.attr('data-label', headerLabel); 7868 $container.prepend($header); 7869 } 7870 if ( theres_footer ) { 7871 $container.append($footer); 7872 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 7873 $('aside.widget ul', $footer).addClass('no-list'); 7874 } 7875 7876 var $all = $rows.add($header); 7877 7878 if ( theres_footer ) 7879 $all = $all.add($footer); 7880 7881 $all.each(function(index, row) { 7882 if( index === 0 ) 7883 $(row).addClass('uncode-scroll-active'); 7884 }); 7885 7886 var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile; 7887 7888 if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) { 7889 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 7890 } 7891 7892 $all.each(function(index, val) { 7893 var getName = $(val).data('name'), 7894 label; 7895 7896 if (typeof getName == 'undefined' || getName == 'undefined') 7897 getName = SiteParameters.slide_name + '-' + index; 7898 7899 //if ( dataNames.includes(getName) ) { 7900 if ( dataNames.indexOf(getName) > 0 ) { 7901 getName += '_' + index; 7902 $(val).data('name', getName); 7903 } 7904 7905 dataNames.push(getName); 7906 7907 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 7908 7909 if (typeof $(val).attr('data-label') !== 'undefined') 7910 label = $(val).attr('data-label'); 7911 else label = ''; 7912 7913 if ( $(val).is($footer) ) 7914 return; 7915 7916 if (label != '' ) { 7917 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 7918 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 7919 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 7920 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>"); 7921 } 7922 }); 7923 7924 var checkVisible = function( el, off ) { 7925 if (typeof jQuery === "function" && el instanceof jQuery) { 7926 el = el[0]; 7927 } 7928 7929 off = typeof off=='undefined' ? 50 : off; 7930 7931 var rect = el.getBoundingClientRect(); 7932 7933 return ( 7934 ( 7935 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7936 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7937 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7938 ) 7939 ); 7940 }; 7941 7942 var animationEndAction = function( index, nextIndex ) { 7943 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7944 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7945 player, iframe; 7946 7947 if ( !$nextSlide.is($footer) ) { 7948 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7949 } 7950 7951 if ( !UNCODE.isFullPageSnap ) { 7952 activateKBurns( nextIndex ); 7953 } 7954 7955 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7956 if ($(this).attr('data-provider') == 'vimeo') { 7957 iframe = $(this).find('iframe'); 7958 player = new Vimeo.Player(iframe[0]); 7959 player.pause(); 7960 } else if ($(this).attr('data-provider') == 'youtube') { 7961 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7962 } else { 7963 if ($(this).is('video')) { 7964 $(this)[0].volume = 0; 7965 $(this)[0].pause(); 7966 } 7967 } 7968 }); 7969 7970 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7971 if ( $nextSlide.is($header) ) 7972 $header.removeClass('header-scrolled'); 7973 } 7974 7975 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 7976 $otherEl.each(function(){ 7977 var $otherThis = $(this), 7978 $bgwrapperOther = $('.background-inner', $otherThis); 7979 if ( !checkVisible($otherThis) ) 7980 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 7981 7982 }); 7983 7984 if ( !checkVisible($currentSlide) ) { 7985 $currentSlide.removeClass('uncode-scroll-visible'); 7986 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 7987 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7988 currentScroll.scrollTo(0, 0, 0); 7989 } 7990 7991 clearRequestTimeout(animationEndTimeOut); 7992 animationEndTimeOut = requestTimeout(function(){ 7993 Waypoint.refreshAll(); 7994 $( document.body ).trigger('uncode_waypoints'); 7995 var eventFP = new CustomEvent('fp-slide-changed'); 7996 window.dispatchEvent(eventFP); 7997 is_scrolling = false; 7998 7999 if ( is_first ) { 8000 $('ul.onepage-pagination a').removeClass('is-selected'); 8001 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8002 is_first = false; 8003 } 8004 8005 }, 500); 8006 }; 8007 8008 var postLeaveActions = function( nextIndex ){ 8009 if ( menuHidden && ! UNCODE.isMobile ) 8010 return false; 8011 8012 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8013 $cols = $('.uncol', $el), 8014 anchor = $el.data('anchor'); 8015 8016 if ( ! UNCODE.isFullPageSnap ) { 8017 $.each($cols, function(index, val){ 8018 if ( $(val).hasClass('style-light') ){ 8019 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 8020 return false; 8021 } else if ( $(val).hasClass('style-dark') ) { 8022 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 8023 return false; 8024 } 8025 }); 8026 } 8027 8028 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 8029 $('.menu-item' ).removeClass('active'); 8030 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8031 } 8032 8033 if ( !UNCODE.isFullPageSnap ) { 8034 activateBackWash( nextIndex ); 8035 } 8036 }; 8037 8038 var activateBackWash = function( nextIndex ){ 8039 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8040 $bgwrapper; 8041 8042 if ( $el.length ) { 8043 if ( $el.hasClass('with-zoomout') ) { 8044 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8045 } else if ( $('.with-zoomout', $el).length ) { 8046 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 8047 } else { 8048 return false; 8049 } 8050 } else { 8051 return false; 8052 } 8053 8054 $bgwrapper.addClass('uncode-zoomout'); 8055 8056 }; 8057 8058 var activateKBurns = function( nextIndex ){ 8059 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8060 $bgwrapper; 8061 8062 if ( $el.length ) { 8063 if ( $el.hasClass('with-kburns') ) { 8064 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8065 } else if ( $('.with-kburns', $el).length ) { 8066 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 8067 } else { 8068 return false; 8069 } 8070 } else { 8071 return false; 8072 } 8073 8074 $bgwrapper.addClass('uncode-kburns'); 8075 8076 }; 8077 8078 var activateParallax = function( nextIndex, direction ){ 8079 8080 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8081 $cell = $('.fp-tableCell', $el), 8082 animationEnd = 'webkitAnimationEnd animationend', 8083 cellAnim; 8084 8085 switch( direction ) { 8086 case 'up': 8087 cellAnim = 'moveFromTopInner'; 8088 break; 8089 default: 8090 cellAnim = 'moveFromBottomInner'; 8091 } 8092 8093 $cell.css({ 8094 'animation-name': cellAnim, 8095 'animation-duration': fp_anim_time + 'ms', 8096 'animation-delay': '', 8097 'animation-timing-function': fp_easing, 8098 'animation-fill-mode': 'both', 8099 }).off(animationEnd) 8100 .on(animationEnd, function(event) { 8101 if ( event.originalEvent.animationName === cellAnim ) { 8102 $cell 8103 .css({ 8104 'animation-name': '', 8105 'animation-duration': '', 8106 'animation-delay': '', 8107 'animation-timing-function': '', 8108 'animation-fill-mode': '', 8109 }); 8110 } 8111 }); 8112 }; 8113 8114 var scrollHashes = function(){ 8115 var hash = window.location.hash.replace('#', '').split('/'), 8116 hashInd; 8117 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 8118 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 8119 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 8120 $.fn.fullpage.moveTo(hashInd+1); 8121 } 8122 } else if( hash[0] === '' ) { 8123 $.fn.fullpage.moveTo(1); 8124 } 8125 }; 8126 8127 var hideMenu = function( index, nextIndex ){ 8128 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 8129 return false; 8130 8131 var hMenu = UNCODE.menuHeight, 8132 transTime = hMenu * 2; 8133 8134 if ( index === 1 && nextIndex > 1 ) { 8135 hMenu = hMenu * -1; 8136 } else if ( index !== 1 && nextIndex === 1 ) { 8137 hMenu = 0; 8138 } else { 8139 return false;
8140 } 8141 8142 $masthead.css({ 8143 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8144 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8145 '-webkit-transition': 'transform 0.5s ease-in-out', 8146 'transition': 'transform 0.5s ease-in-out' 8147 }); 8148 }; 8149 8150 var shrinkMenu = function( index, nextIndex ){ 8151 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 8152 return false; 8153 8154 if ( index === 1 && nextIndex > 1 ) { 8155 $logo.addClass('shrinked'); 8156 $('div', $logo).each(function(index, val){ 8157 $(val).css({ 8158 'height': logoMinScale, 8159 'line-height': logoMinScale 8160 }); 8161 if ($(val).hasClass('text-logo')) { 8162 $(val).css({ 8163 'font-size': logoMinScale + 'px' 8164 }); 8165 } 8166 }); 8167 requestTimeout(function() { 8168 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8169 }, 300); 8170 } else if ( index !== 1 && nextIndex === 1 ) { 8171 $logo.removeClass('shrinked'); 8172 $('div', $logo).each(function(index, val){ 8173 $(val).css({ 8174 'height': logoMaxScale, 8175 'line-height': logoMaxScale 8176 }); 8177 if ($(val).hasClass('text-logo')) { 8178 $(val).css({ 8179 'font-size': logoMaxScale + 'px' 8180 }); 8181 } 8182 }); 8183 requestTimeout(function() { 8184 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8185 }, 300); 8186 } else { 8187 return false; 8188 } 8189 8190 }; 8191 8192 var anchorLink = function(){ 8193 8194 $container.add('.menu-item').find('a[href*="#"]').on('click', function(e) { 8195 var $this = $(e.currentTarget), 8196 hash = e.currentTarget.href.split('#'), 8197 current = window.location.href.split('#'), 8198 ind, 8199 currentMenuOpened = UNCODE.menuOpened, 8200 go = false; 8201 8202 var hash_url = hash[0].replace(/\/?$/, '/'), 8203 current_url = current[0].replace(/\/?$/, '/'); 8204 8205 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 8206 hash = '#'+hash[1]; 8207 e.preventDefault(); 8208 go = true; 8209 } 8210 8211 if ( go ) { 8212 8213 if ( $(hash).length ) { 8214 ind = $(hash).closest('.fp-section').index(); 8215 } else { 8216 hash = hash.slice(1); 8217 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 8218 } 8219 8220 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 8221 ind = $this.closest('.fp-section').index(); 8222 8223 UNCODE.menuOpened = false; 8224 8225 $.fn.fullpage.moveTo(ind+1); 8226 8227 UNCODE.menuOpened = currentMenuOpened; 8228 if (UNCODE.menuOpened) { 8229 if (UNCODE.wwidth < UNCODE.mediaQuery) { 8230 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 8231 } else { 8232 $('.mmb-container-overlay .overlay-close').trigger('click'); 8233 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 8234 } 8235 } 8236 8237 } 8238 8239 }); 8240 8241 $('.header-scrolldown').on('click', function(event) { 8242 event.preventDefault(); 8243 var scrollDown = $(this), 8244 ind = scrollDown.closest('.fp-section').index(); 8245 8246 $.fn.fullpage.moveTo(ind+2); 8247 }); 8248 8249 var anchor = $('.fp-section.active').data('anchor'); 8250 8251 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 8252 $('.menu-item').removeClass('active'); 8253 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8254 } 8255 8256 }; 8257 8258 var slideLeave = function( index, nextIndex, direction ) { 8259 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 8260 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8261 animationEnd = 'webkitAnimationEnd animationend', 8262 transitionEnd = 'webkitTransitionEnd transitionend', 8263 animOut = effect != 'scaleDown' ? effect + direction : effect, 8264 animIn, 8265 isFooter = false, 8266 isFooterNext = false, 8267 footerH = $footer.outerHeight(), 8268 timeout, 8269 player, iframe, 8270 footerCoeff; 8271 switch( direction ) { 8272 case 'up': 8273 animIn = 'moveFromTop'; 8274 break; 8275 default: 8276 animIn = 'moveFromBottom'; 8277 } 8278 8279 if ( $('body').hasClass('uncode-fullpage-trid') ) { 8280 animOut = animIn + 'trid'; 8281 animIn = animOut + 'In'; 8282 } else if ( UNCODE.isFullPageSnap ) { 8283 animIn = animOut = 'none'; 8284 } 8285 8286 hideMenu(index, nextIndex); 8287 shrinkMenu(index, nextIndex); 8288 8289 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 8290 if ($(this).attr('data-provider') == 'vimeo') { 8291 iframe = $(this).find('iframe'); 8292 player = new Vimeo.Player(iframe[0]); 8293 player.pause(); 8294 } else if ($(this).attr('data-provider') == 'youtube') { 8295 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 8296 } else { 8297 if ($(this).is('video')) { 8298 $(this)[0].volume = 0; 8299 $(this)[0].pause(); 8300 } 8301 } 8302 }); 8303 8304 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 8305 if ($(this).attr('data-provider') == 'vimeo') { 8306 iframe = $(this).find('iframe'); 8307 iframe.on('load', function(){ 8308 player = new Vimeo.Player(iframe); 8309 player.setVolume(0); 8310 player.play(); 8311 }); 8312 player = new Vimeo.Player(iframe); 8313 player.setVolume(0); 8314 player.play(); 8315 } else if ($(this).attr('data-provider') == 'youtube') { 8316 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 8317 } else { 8318 if ($(this).is('video')) { 8319 $(this)[0].volume = 0; 8320 $(this)[0].play(); 8321 } 8322 } 8323 }); 8324 8325 if ( $currentSlide.is($footer) ) 8326 isFooter = true; 8327 8328 if ( $nextSlide.is($footer) ) 8329 isFooterNext = true; 8330 8331 if ( ! UNCODE.isMobile && headerWithOpacity ) { 8332 if ( $currentSlide.is($header) ) 8333 $header.addClass('header-scrolled'); 8334 } 8335 8336 footerCoeff = footerH; 8337 8338 if ( UNCODE.isFullPageSnap ) { 8339 postLeaveActions( nextIndex ); 8340 activateBackWash( nextIndex ); 8341 activateKBurns( nextIndex ); 8342 requestTimeout(function(){ 8343 animationEndAction( index, nextIndex ); 8344 }, fp_anim_time+150); 8345 } else { 8346 if ( isFooterNext ) { 8347 8348 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 8349 $iscrollWrapper.addClass('no-scrolloverflow'); 8350 8351 $nextSlide 8352 .add($currentSlide) 8353 .addClass('uncode-scroll-front') 8354 .addClass('uncode-scroll-active') 8355 .addClass('uncode-scroll-visible'); 8356 $container.css({ 8357 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8358 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8359 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8360 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8361 }).off(transitionEnd) 8362 .one(transitionEnd, function(){ 8363 animationEndAction( index, nextIndex ); 8364 }); 8365 8366 } else if ( isFooter ) { 8367 8368 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 8369 .add($currentSlide) 8370 .addClass('uncode-scroll-front') 8371 .addClass('uncode-scroll-active') 8372 .addClass('uncode-scroll-visible'); 8373 $container.css({ 8374 '-webkit-transform': 'translate3d(0, 0, 0)', 8375 'transform': 'translate3d(0, 0, 0)', 8376 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8377 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8378 }) 8379 .one(transitionEnd, function(){ 8380 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 8381 clearRequestTimeout(timeout); 8382 timeout = requestTimeout(function(){ 8383 $.fn.fullpage.moveTo(nextIndex); 8384 slideLeave( index-1, nextIndex, 'up' ); 8385 $container.off(transitionEnd); 8386 }, 50); 8387 } 8388 animationEndAction( index, nextIndex ); 8389 }); 8390 8391 } else { 8392 8393 postLeaveActions( nextIndex ); 8394 8395 if ( !$('body').hasClass('uncode-fullpage-trid') ) 8396 activateParallax( nextIndex, direction ); 8397 8398 var $outBg = $('.background-wrapper', $currentSlide); 8399 8400 $nextSlide 8401 .addClass('uncode-scroll-front') 8402 .addClass('uncode-scroll-active') 8403 .addClass('uncode-scroll-visible') 8404 .addClass('uncode-scroll-animating-in') 8405 .css({ 8406 'z-index':4, 8407 'animation-name': animIn, 8408 'animation-duration': fp_anim_time + 'ms', 8409 'animation-delay': '', 8410 'animation-timing-function': fp_easing, 8411 'animation-fill-mode': 'both', 8412 'transition': 'initial', 8413 }).off(animationEnd) 8414 .on(animationEnd, function(event) { 8415 if ( event.originalEvent.animationName === animIn ) { 8416 $(this) 8417 .addClass('uncode-scroll-already') 8418 .removeClass('uncode-scroll-front') 8419 .removeClass('uncode-scroll-animating-in') 8420 .css({ 8421 'animation-name': '', 8422 'animation-duration': '', 8423 'animation-delay': '', 8424 'animation-timing-function': '', 8425 'animation-fill-mode': '', 8426 'transition': 'initial', 8427 }); 8428 8429 $currentSlide 8430 .removeClass('uncode-scroll-active') 8431 .add($outBg) 8432 .css({ 8433 'animation-name': '', 8434 'animation-duration': '', 8435 'animation-delay': '', 8436 'animation-timing-function': '', 8437 'animation-fill-mode': '', 8438 'transition': 'initial', 8439 }); 8440 8441 animationEndAction( index, nextIndex ); 8442 8443 } 8444 8445 if ( nextIndex > 1 ) 8446 $('body').addClass('window-scrolled'); 8447 else 8448 $('body').removeClass('window-scrolled'); 8449 }); 8450 8451 $currentSlide 8452 .addClass('uncode-scroll-animating-out') 8453 .removeClass('uncode-scroll-front') 8454 .css({ 8455 'z-index':'1', 8456 'animation-name': animOut, 8457 'animation-duration': fp_anim_time + 'ms', 8458 'animation-delay': '', 8459 'animation-timing-function': fp_easing, 8460 'animation-fill-mode': 'both', 8461 'transition': 'initial', 8462 'will-change': 'auto' 8463 }).off(animationEnd) 8464 .on(animationEnd, function(event) { 8465 if ( event.originalEvent.animationName === animOut ) { 8466 $currentSlide.removeClass('uncode-scroll-animating-out'); 8467 } 8468 }); 8469 8470 if ( $('body').hasClass('uncode-fp-opacity') ) { 8471 $currentSlide.find('> div').css({ 8472 'animation-name': 'opacityout', 8473 'animation-duration': fp_anim_time + 'ms', 8474 'animation-delay': '', 8475 'animation-timing-function': fp_easing, 8476 'animation-fill-mode': 'both', 8477 'transition': 'initial', 8478 }).off(animationEnd) 8479 .on(animationEnd, function(event) { 8480 if ( event.originalEvent.animationName === 'opacityout' ) { 8481 $(event.currentTarget).css({ 8482 'animation-name': '', 8483 'animation-duration': '', 8484 'animation-delay': '', 8485 'animation-timing-function': '', 8486 'animation-fill-mode': '', 8487 'transition': '', 8488 }); 8489 } 8490 }); 8491 } 8492 } 8493 } 8494 8495 $('.scroll-top').on('click', function(e){ 8496 $.fn.fullpage.moveTo(1); 8497 return false;
8498 }); 8499 8500 }; 8501 8502 var init_fullPage = function(mode){ 8503 8504 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 8505 // scrollBar = false; 8506 // } 8507 8508 var checkFPeffects; 8509 8510 $container.fullpage({ 8511 sectionSelector: '.uncode-scroll-lock', 8512 scrollOverflow: true, 8513 scrollOverflowOptions: { 8514 click: false, 8515 preventDefaultException: { tagName:/.*/ } 8516 }, 8517 navigation: false, 8518 scrollBar: scrollBar, 8519 scrollingSpeed: fp_anim_time, 8520 verticalCentered: true, 8521 anchors: no_history ? false : dataNames, 8522 recordHistory: !no_history, 8523 afterRender: function(){ 8524 $('body').removeClass('fp-waiting'); 8525 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 8526 var $invisible = $(this).addClass('hidden-scroll');//, 8527 }); 8528 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 8529 var $visible = $(this).addClass('uncode-scroll-visible'), 8530 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 8531 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 8532 }); 8533 8534 $('ul.onepage-pagination a').on('click', function(e){ 8535 e.preventDefault(); 8536 var $a = $(this), 8537 toIndex = $a.data('index'); 8538 8539 $.fn.fullpage.moveTo(toIndex+1); 8540 }); 8541 8542 requestTimeout(function(){ 8543 scrollHashes(); 8544 }, 1000); 8545 8546 $(window).on('hashchange', function(e){ 8547 requestTimeout(function(){ 8548 scrollHashes(); 8549 }, 500); 8550 }); 8551 8552 anchorLink(); 8553 8554 if ( $('body').hasClass('uncode-fp-opacity') ) { 8555 $all.each(function(index, row) { 8556 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 8557 classBg; 8558 8559 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 8560 classBg = testmatch[0]; 8561 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 8562 } 8563 }); 8564 } 8565 8566 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 8567 $(window).on('menuOpen gdprOpen', function(){ 8568 $.fn.fullpage.setAutoScrolling(false); 8569 }).on('menuClose gdprClose', function(){ 8570 $.fn.fullpage.setAutoScrolling(true); 8571 }); 8572 } 8573 8574 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 8575 requestTimeout(function(){ 8576 $.fn.fullpage.setAutoScrolling(false); 8577 }, 1000); 8578 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 8579 $.fn.fullpage.setAutoScrolling(true); 8580 }); 8581 8582 if ( !UNCODE.isFullPageSnap ) { 8583 clearRequestTimeout(checkFPeffects); 8584 checkFPeffects = requestTimeout(function(){ 8585 activateBackWash( 1 ); 8586 activateKBurns( 1 ); 8587 }, 100); 8588 } 8589 8590 }, 8591 onLeave: function( index, nextIndex, direction ){ 8592 8593 if ( UNCODE.menuOpened || is_scrolling ) 8594 return false; 8595 8596 is_scrolling = true; 8597 8598 var event = new CustomEvent('fp-slide-leave'); 8599 window.dispatchEvent(event); 8600 8601 slideLeave( index, nextIndex, direction ); 8602 8603 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 8604 if ( direction === 'up' ) { 8605 $.fn.fullpage.moveTo(nextIndex-1); 8606 } else { 8607 $.fn.fullpage.moveTo(nextIndex+1); 8608 } 8609 return false; 8610 } 8611 8612 $('ul.onepage-pagination a').removeClass('is-selected'); 8613 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8614 8615 } 8616 }); 8617 }; 8618 8619 init_fullPage(); 8620 $(window).on('load', function(){ 8621 requestTimeout(function(){ 8622 $.fn.fullpage.reBuild(); 8623 }, 3000); 8624 }); 8625 8626 var addScrollingClass, 8627 removeScrollingClass; 8628 8629 window.addEventListener("fp-slide-scroll", function(){ 8630 addScrollingClass = requestTimeout( function(){ 8631 $('body').addClass('fp-slide-scrolling'); 8632 }, 10 ); 8633 8634 clearRequestTimeout(removeScrollingClass); 8635 removeScrollingClass = requestTimeout( function(){ 8636 $('body').removeClass('fp-slide-scrolling'); 8637 }, 150 ); 8638 8639 Waypoint.refreshAll(); 8640 }, false); 8641 8642 var setFPheight = function(){ 8643 var $body = document.body, 8644 $footer = document.getElementById('colophon'), 8645 $maincontainer = document.querySelector('.main-wrapper'), 8646 $boxcontainer = document.querySelector('.box-container'), 8647 $sections = document.querySelectorAll('.fp-section'), 8648 rect = $maincontainer.getBoundingClientRect(), 8649 rect2 = $boxcontainer.getBoundingClientRect(), 8650 $masthead = document.getElementById('masthead'), 8651 _hideMenu = false, 8652 menuHeight = UNCODE.menuHeight; 8653 $body.style.height = UNCODE.wheight + 'px'; 8654 8655 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 8656 _hideMenu = true; 8657 } 8658 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 8659 menuHeight = 0 8660 } 8661 8662 8663 if ( theres_footer ) 8664 $footer.style.top = (rect.height || rect2.height) + 'px'; 8665 8666 for (var i = 0; i < $sections.length; i++) { 8667 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 8668 } 8669 }; 8670 8671 setFPheight(); 8672 8673 window.addEventListener('resize', setFPheight, false); 8674 window.addEventListener('orientationchange', setFPheight, false); 8675 8676}; 8677 8678UNCODE.particles = function() { 8679 $(".vc-particles-background").each(function() { 8680 var $particle = $(this); 8681 var $parent = $particle.closest('[data-parent]'); 8682
8683 $parent.prepend($particle); 8684 // $(window).trigger('resize'); 8685 }) 8686}; 8687 8688 8689UNCODE.readMoreCol = function( $el ){ 8690 if ( typeof $el === 'undefined' || $el === null ) { 8691 $el = $('body'); 8692 } 8693 var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el); 8694 $readMoreCols.each(function(){ 8695 var $uncont = $(this), 8696 $row = $uncont.closest('.row-container'), 8697 max_h = $uncont.attr('data-ov-height'), 8698 max_h_mobile = $uncont.attr('data-ov-height-mobile'), 8699 actual_max_h = $uncont.outerHeight(), 8700 inner_h, 8701 $read_more = $('+ .btn-more-wrap', $uncont), 8702 read_more_resize = $read_more.hasClass('trigger-resize'), 8703 marginClosedBtn = $uncont.attr('data-margin-closed'), 8704 marginClosed = 0, 8705 marginOpenBtn = $uncont.attr('data-margin-open'), 8706 marginOpen = 0, 8707 anim_t = 250, 8708 resized = false; 8709 8710 max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile; 8711 8712 switch (marginClosedBtn) { 8713 case 'sm': 8714 marginClosed = 18 8715 break; 8716 8717 case 'std': 8718 marginClosed = 36 8719 break; 8720 8721 case 'lg': 8722 marginClosed = 72 8723 break; 8724 8725 case '': 8726 default: 8727 marginClosed = 0 8728 break; 8729 8730 } 8731 8732 switch (marginOpenBtn) { 8733 case 'sm': 8734 marginOpen = 18 8735 break; 8736 8737 case 'std': 8738 marginOpen = 36 8739 break; 8740 8741 case 'lg': 8742 marginOpen = 72 8743 break; 8744 8745 case 'no': 8746 marginOpen = 0 8747 break; 8748 8749 } 8750 8751 var checkToggleMobile = function(){ 8752 if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) { 8753 resized = true; 8754 if ( $read_more.hasClass('state-closed') ) { 8755 $uncont[0].style.height = ''; 8756 $uncont[0].style.maxHeight = max_h_mobile; 8757 } 8758 } if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) { 8759 if ( $read_more.hasClass('state-closed') ) { 8760 $uncont[0].style.height = ''; 8761 $uncont[0].style.maxHeight = max_h; 8762 } 8763 resized = false; 8764 } 8765 } 8766 checkToggleMobile(); 8767 $(window).on('resize', function() { 8768 checkToggleMobile(); 8769 }); 8770 8771 $('a', $read_more).on('click', function(e){ 8772 e.preventDefault(); 8773 8774 var $a = $(this); 8775 8776 if ( $read_more.hasClass('state-closed') ) { 8777 8778 $read_more 8779 .removeClass('state-closed') 8780 .addClass('state-open'); 8781 8782 $uncont.css({ 8783 'max-height': 'none', 8784 'height': 'auto', 8785 }); 8786 8787 inner_h = parseFloat( $uncont.outerHeight() ); 8788 8789 $uncont.css({ 8790 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8791 }); 8792 8793 anim_t = inner_h - actual_max_h; 8794 if ( anim_t < 250 ) { 8795 anim_t = 250; 8796 } else if ( anim_t > 1000 ) { 8797 anim_t = 1000; 8798 } 8799 8800 $uncont.css({ 8801 'transition-duration' : anim_t + 'ms' 8802 }).addClass('overflow-mask-animation').animate({ 8803 'height': inner_h 8804 }, anim_t, 'easeInOutCubic', function(){ 8805 $uncont.css({ 8806 'height' : 'auto' 8807 }).removeClass('overflow-mask'); 8808 if ( read_more_resize === true ) { 8809 window.dispatchEvent(new Event('resize')); 8810 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8811 ScrollTrigger.refresh(true); 8812 } 8813 } 8814 }); 8815 8816 if ( marginOpen != '' ) { 8817 $read_more.animate({ 8818 'margin-top' : marginOpen 8819 }, anim_t, 'easeInOutCubic'); 8820 } 8821 8822 } else { 8823 $read_more 8824 .removeClass('state-open') 8825 .addClass('state-closed'); 8826 8827 $uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({ 8828 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8829 }, anim_t, 'easeInOutCubic', function(){ 8830 if ( read_more_resize === true ) { 8831 window.dispatchEvent(new Event('resize')); 8832 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8833 ScrollTrigger.refresh(true); 8834 } 8835 } 8836 }); 8837 8838 if ( marginClosed !== '' ) { 8839 $read_more.animate({ 8840 'margin-top' : marginClosed 8841 }, anim_t, 'easeInOutCubic'); 8842 } 8843 8844 if ( $a.hasClass('toggle-scroll') ) { 8845 var $masthead = $('#masthead > div:first-child'), 8846 headH = $masthead.outerHeight(), 8847 rectTop = $row[0].getBoundingClientRect().top, 8848 checkNavBar = $a.hasClass('toggle-navbar'), 8849 checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'), 8850 offCont = ( $row.offset().top ); 8851 8852 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 8853 checkNavBar = checkNavBarMobile; 8854 } 8855 8856 if ( checkNavBar ) { 8857 offCont = offCont - headH; 8858 } 8859 8860 if ( rectTop < headH ) { 8861 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 8862 $(this).stop(); 8863 }).animate({ 8864 scrollTop: offCont 8865 }, anim_t, 'easeInOutCubic'); 8866 } 8867 } 8868 8869 } 8870 }); 8871 }); 8872} 8873UNCODE.filters = function() { 8874 var $systems = $('.isotope-system, .cssgrid-system'); 8875 8876 $systems.each(function(index, val){ 8877 var $system = $(this), 8878 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 8879 $widgets = $('.widgetized-cb-wrapper', $system), 8880 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 8881 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 8882 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 8883 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 8884 8885 if ($system.hasClass('isotope-processed')) { 8886 return; 8887 } 8888 8889 $cats_trigger.on('click', function(e) { 8890 if ( ! $('html').hasClass('screen-sm') ) { 8891 // $widgets.add($sorting_dd).slideUp(400); 8892 e.preventDefault(); 8893 $widgets.slideUp(400, 'easeInOutCirc'); 8894 } 8895 }); 8896 8897 $('.filters-toggle-trigger', $system).on('click', function(e) { 8898 e.preventDefault(); 8899 var $filters = $('.isotope-filters .menu-horizontal', $system); 8900 $filters.slideToggle(400, 'easeInOutCirc');
8901 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8902 }); 8903 8904 $widget_trgr.on('click', function(e) { 8905 e.preventDefault(); 8906 $widgets.slideToggle(400, 'easeInOutCirc'); 8907 if (!$('html').hasClass('screen-sm')) { 8908 $cats_filters.slideUp(400, 'easeInOutCirc'); 8909 } 8910 window.dispatchEvent(new CustomEvent('boxResized')); 8911 }); 8912 8913 $sorting_trgr.on('click', function(e) { 8914 e.preventDefault(); 8915 if (!$('html').hasClass('screen-sm')) { 8916 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8917 } 8918 }); 8919 8920 $system.addClass('isotope-processed'); 8921 }); 8922 8923}; 8924 8925UNCODE.widgets = function() { 8926 var widget_collapses = $('.widget-collapse'); 8927 8928 widget_collapses.each(function(){ 8929 var widget_collapse = $(this), 8930 widget_title = widget_collapse.find('.widget-title'), 8931 widget = widget_title.closest('.widget'), 8932 content = widget.children().not('.widget-title'), 8933 setCTA; 8934 8935 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 8936 widget_title.toggleClass('open'); 8937 } 8938 8939 widget_title.each(function() { 8940 var _this = $(this); 8941 var content = _this.closest('.widget').find('.widget-collapse-content'); 8942 8943 $(window).on('load resize', function(){ 8944 clearRequestTimeout(setCTA); 8945 setCTA = requestTimeout( function() { 8946 if ( content.is(':visible') ) { 8947 _this.addClass( 'open' ); 8948 } else { 8949 _this.removeClass( 'open' ); 8950 } 8951 }, 10 ); 8952 }) 8953 8954 _this.on( 'click', function(){ 8955 8956 // Get content of :after element (+ icon) to check the visibility 8957 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 8958 8959 if (icon_content === 'none' || !icon_content) { 8960 return false; 8961 } 8962 8963 _this.toggleClass('open'); 8964 var isOpen = _this.hasClass('open'), 8965 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 8966 content.animate({ 8967 height: 'toggle', 8968 padding: 'toggle', 8969 opacity: 'toggle', 8970 top: isOpen ? 0 : hasBorder 8971 }, { 8972 duration: 400, 8973 easing: "easeInOutCirc", 8974 }); 8975 8976 return false; 8977 8978 }); 8979 }); 8980 }); 8981 8982 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 8983}; 8984 8985UNCODE.unmodal = function() { 8986 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 8987 $('.unmodal-overlay').fadeIn(); 8988 $('.unmodal-overlay').addClass('loading'); 8989 $('body').addClass('uncode-unmodal-overlay-visible'); 8990 $(window).trigger('unmodal-open'); 8991 }); 8992 8993 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 8994 $('.unmodal-overlay').fadeOut(); 8995 $('.unmodal').fadeOut(); 8996 $('body').removeClass('uncode-unmodal-overlay-visible'); 8997 $('body').removeClass('uncode-unmodal-open'); 8998 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 8999 $(document).trigger('unmodal-close'); 9000 UNCODE.isUnmodalOpen = false; 9001 }); 9002 9003 $(document).on('uncode-unmodal-show-content', function() { 9004 $('.unmodal-overlay').removeClass('loading'); 9005 $('.unmodal').show(); 9006 $('.unmodal').addClass('show-unmodal-with-animation'); 9007 $('.unmodal-content')[0].scrollTop = 0; 9008 $('body').addClass('uncode-unmodal-open'); 9009 UNCODE.isUnmodalOpen = true; 9010 9011 if ($('body').hasClass('qw-body-scroll-disabled')) { 9012 $('html').addClass('uncode-unmodal-body-disable-scroll'); 9013 } 9014 9015 if ($('.unmodal').hasClass('auto-height')) { 9016 set_modal_height(); 9017 } 9018 }); 9019 9020 var set_modal_height = function() { 9021 var modal = $('.unmodal').css({height: 'auto'}); 9022 var window_height = $(window).outerHeight(); 9023 var modal_height = modal.outerHeight(); 9024 9025 modal.css('height', 'auto'); 9026 9027 if (modal_height > window_height) { 9028 modal.outerHeight(window_height); 9029 } 9030 } 9031 9032 if ($('.unmodal').hasClass('auto-height')) { 9033 var setCTA; 9034 9035 $(window).on('resize', function() { 9036 clearRequestTimeout(setCTA); 9037 setCTA = requestTimeout(function() { 9038 set_modal_height(); 9039 }, 100); 9040 }); 9041 } 9042}; 9043 9044UNCODE.bgChanger = function() { 9045 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 9046 $bg_first = $('.vc_row[data-bg-remove]'), 9047 bg_remove = $bg_first.attr('data-bg-remove'), 9048 $first = $bg_changers.first(), 9049 $last = $bg_changers.last(), 9050 $bg_wrapper = $('#changer-back-color'), 9051 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 9052 setCTA, localH = UNCODE.wheight, 9053 isScrolling; 9054 9055 $bg_first.removeClass(bg_remove); 9056 9057 var bgChange = function($col, bgColor, skin, tmbskin){ 9058 $bg_wrapper.attr( 'class', bgColor ); 9059 var menuskin; 9060 if ( typeof skin !== 'undefined' ) { 9061 menuskin = skin.replace('style', 'menu') 9062 } 9063 9064 if ( $col.length ) { 9065 $('.uncol[data-skin-change]').each(function(){ 9066 var $isoFooter = $('.isotope-footer', this); 9067 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 9068 if ( menuskin !== '' ) {
9069 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 9070 } 9071 }); 9072 9073 $('.tmb[data-skin-change]').each(function(){ 9074 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 9075 }); 9076 } 9077 }; 9078 9079 var $masthead = $('#masthead'), 9080 transDesktop, 9081 transMobile, 9082 changeSkin, 9083 9084 checkTransparencyAndChange = function( skin ){ 9085 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 9086 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 9087 changeSkin = $masthead.hasClass('menu-change-skin'); 9088 9089 if ( ! transDesktop && ! transMobile ) { 9090 return false; 9091 } 9092 9093 if ( ! changeSkin ) { 9094 return false; 9095 } 9096 9097 if ( skin === 'style-light' ){ 9098 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 9099 return false; 9100 } else if ( skin === 'style-dark' ) { 9101 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 9102 return false; 9103 } 9104 }; 9105 9106 var bg_waypoints = function(){ 9107 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 9108 9109 $.each($bg_changers, function(index, row) { 9110 9111 var $row = $(row), 9112 $col = $('.uncol[data-skin-change]', $row).eq(0), 9113 skin, 9114 $tmbs, 9115 tmbskin, 9116 bgColor = $row.attr('data-bg-color'); 9117 9118 if ( ! $row.is(':visible') ) { 9119 return false; 9120 } 9121 9122 if ( $col.length ) { 9123 skin = $col.attr('data-skin-change'); 9124 $tmbs = $('.tmb[data-skin-change]', $row); 9125 tmbskin = skin.replace('style', 'tmb'); 9126 } 9127 9128 if ( ! $row.hasClass('unscroll-horizontal') ) { 9129 $row.waypoint(function( dir ) { 9130 if ( dir === 'down' ) { 9131 bgChange($col, bgColor, skin, tmbskin); 9132 checkTransparencyAndChange(skin); 9133 } else { 9134 return; 9135 } 9136 }, {
9137 offset: '50%' 9138 }); 9139 9140 $row.waypoint(function( dir ) { 9141 if ( dir === 'up' ) { 9142 bgChange($col, bgColor, skin, tmbskin); 9143 checkTransparencyAndChange(skin); 9144 } else { 9145 return; 9146 } 9147 }, { 9148 offset: function() { 9149 var clH = this.element.clientHeight, 9150 wH = window.innerHeight, 9151 ret = clH > 200 ? -100 : clH * -0.5; 9152 return ( wH / 2 ) - clH; 9153 } 9154 }); 9155 } 9156 9157 }); 9158 9159 $('body').addClass('bg-changer-init'); 9160 9161 } 9162 }; 9163 9164 var body = document.body, 9165 edges = false; 9166 9167 var throttle = function(fn, wait) { 9168 var time = Date.now(); 9169 return function() { 9170 if ((time + wait - Date.now()) < 0) { 9171 fn(); 9172 time = Date.now(); 9173 } 9174 } 9175 } 9176 9177 var $wrapper = document.querySelector(".main-wrapper"), 9178 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 9179 9180 var $title = document.querySelector('#rotating'); 9181 if ( $title !== null ) { 9182 $title.style.whiteSpace = 'nowrap'; 9183 $title.style.transition = 'transform 200ms linear'; 9184 } 9185 9186 window.addEventListener( 'scroll', throttle( function() { 9187 window.clearRequestTimeout( isScrolling ); 9188 9189 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 9190 9191 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 9192 body = document.body, 9193 html = document.documentElement, 9194 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9195 $row = false, 9196 firstOff, 9197 lastOff; 9198 9199 if ( scrolled < 100 && $first.length ) { 9200 firstOff = $first.offset().top; 9201 if ( firstOff < 100 ) { 9202 var $row = $first; 9203 } 9204 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 9205 lastOff = $last.offset().top + $last.outerHeight(); 9206 if ( lastOff > ( docH - 100 ) ) { 9207 var $row = $last; 9208 } 9209 } 9210 9211 if ( $row.length ) { 9212 var $col = $('.uncol[data-skin-change]', $row).eq(0), 9213 skin, 9214 $tmbs, 9215 tmbskin, 9216 bgColor = $row.attr('data-bg-color'); 9217 9218 if ( $col.length ) { 9219 skin = $col.attr('data-skin-change'); 9220 $tmbs = $('.tmb[data-skin-change]', $row); 9221 tmbskin = skin.replace('style', 'tmb'); 9222 } 9223 9224 bgChange($col, bgColor, skin, tmbskin); 9225 checkTransparencyAndChange(skin); 9226 edges = true; 9227 } 9228 9229 }, 150); 9230 9231 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 9232 bg_waypoints(); 9233 Waypoint.refreshAll(); 9234 edges = false; 9235 } 9236 9237 }, 100), false); 9238 9239 $(window).on('resize', function() { 9240 clearRequestTimeout(setCTA); 9241 setCTA = requestTimeout(function() { 9242 if ( localH != UNCODE.wheight ) { 9243 localH = UNCODE.wheight; 9244 bg_waypoints(); 9245 Waypoint.refreshAll(); 9246 } 9247 }, 100); 9248 }); 9249 9250 bg_waypoints(); 9251 9252}; 9253 9254UNCODE.skewIt = function() { 9255 9256 if ( $('body').hasClass('compose-mode') ) { 9257 return; 9258 } 9259 9260 var justscrolled = false; 9261 9262 var loadSkewIt = function(){ 9263 9264 var $pageHeader = $('#page-header'), 9265 $page_body = $('.page-body'), 9266 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 9267 9268 if ( $header_skew.length ) { 9269 $pageHeader.addClass('uncode-skew').css({ 9270 position: 'relative', 9271 zIndex: 1 9272 }); 9273 $header_skew.removeClass('uncode-skew'); 9274 $page_body.css({ 9275 position: 'relative', 9276 zIndex: 0 9277 }); 9278 } 9279 9280 var $skew = $('.uncode-skew'), 9281 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 9282 horizontal = $horizontal.length, 9283 stopSkewing, 9284 lastOffset = 0, 9285 lastDate = Date.now(); 9286 9287 if ( ! $skew.length ) { 9288 return; 9289 } 9290 9291 var dropSkew = function(){ 9292 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 9293 return; 9294 9295 $skew.each(function(){ 9296 var $this = $(this), 9297 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9298 9299 if ( $drop.length ) { 9300 $this.css({ 9301 'transform': 'skew(0)' 9302 }); 9303 var bound = $this[0].getBoundingClientRect(); 9304 $drop.css({ 9305 left: bound.x * -1, 9306 top: bound.y * -1, 9307 }); 9308 } 9309 }); 9310 }; 9311 dropSkew(); 9312 9313 $(window).on('resize', dropSkew); 9314 9315 window.addEventListener( 'scroll', function() { 9316 9317 if ( justscrolled !== true ) { 9318 justscrolled = true; 9319 return; 9320 } 9321 9322 window.clearRequestTimeout( stopSkewing ); 9323 9324 var now = Date.now(), 9325 delayInMs = now - lastDate, 9326 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9327 newOffset = offset - lastOffset, 9328 speed = Math.pow((newOffset / delayInMs), 3) * -1, 9329 body = document.body, 9330 html = document.documentElement, 9331 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9332 wait = 50, 9333 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 9334 9335 if ((lastDate + wait - now) < 0) { 9336 9337 lastDate = now; 9338 lastOffset = offset; 9339 9340 if ( speed > 6 ) { 9341 speed = 6; 9342 } else if ( speed < -6 ) { 9343 speed = -6; 9344 } 9345 9346 if ( speed > 2 && offset < UNCODE.wheight ) { 9347 speed = 2; 9348 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 9349 speed = -2; 9350 } 9351 9352 var speedY = speed, 9353 speedX = speed * 1.25; 9354 9355 if ( horizontal ) { 9356 speedY = 0; 9357 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9358 speedX = 0; 9359 return; 9360 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 9361 speedX = 0; 9362 return; 9363 } 9364 } else { 9365 speedX = 0; 9366 } 9367 9368 if ( ! $skew.closest('.enter-st').length ) { 9369 speedX = 0; 9370 } 9371 9372 gsap.killTweensOf($skew); 9373 gsap.to( $skew, { 9374 duration: 0.2, 9375 skewY: (speedY * maxSpeed) + "deg", 9376 skewX: (speedX * maxSpeed) + "deg", 9377 ease: Power0.easeNone, 9378 transformOrigin: 'center', 9379 }); 9380 9381 } 9382 9383 stopSkewing = requestTimeout(function() { 9384 gsap.killTweensOf($skew); 9385 gsap.to( $skew, { 9386 duration: 0.5, 9387 skewY: "0deg", 9388 skewX: "0deg", 9389 transformOrigin: 'center', 9390 ease: Expo.easeOut, 9391 }); 9392 9393 $skew.each(function(){ 9394 var $this = $(this), 9395 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9396 9397 if ( $drop.length ) { 9398 var bound = $this[0].getBoundingClientRect() 9399 $drop.css({ 9400 left: bound.x * -1, 9401 top: bound.y * -1, 9402 }); 9403 } 9404 }); 9405 9406 }, 200); 9407 9408 }, false); 9409 9410 }; 9411 9412 $(window).on('load', loadSkewIt); 9413 9414}; 9415 9416UNCODE.rotateIt = function() { 9417 9418 if ( $('body').hasClass('compose-mode') ) { 9419 return; 9420 } 9421 9422 var frameRotate = false;
9423 var loadRotateIt = function(){ 9424 9425 var $toRotate = $('.uncode-rotate'); 9426 9427 $toRotate.each(function(){ 9428 var $rotate = $(this), 9429 deg = 0, 9430 dir = true, 9431 coeff = 1, 9432 lastOffset = 0, 9433 lastDate = Date.now(); 9434 9435 var checkScroll = function($rotate){ 9436 // if ( ! $rotate.length ) { 9437 // return; 9438 // } 9439 9440 var now = Date.now(), 9441 delayInMs = now - lastDate, 9442 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9443 newOffset = offset - lastOffset, 9444 speed = (newOffset / delayInMs) * 5, 9445 body = document.body, 9446 html = document.documentElement, 9447 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 9448 9449 lastDate = now; 9450 lastOffset = offset; 9451 9452 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 9453 deg = 0; 9454 } 9455 9456 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 9457 deg = parseFloat(deg) + parseFloat(speed); 9458 } 9459 9460 if ( $rotate.hasClass('uncode-rotate-hover') ) { 9461 $rotate.hover(function(){ 9462 coeff = 1.75; 9463 }, function(){ 9464 coeff = 1; 9465 }); 9466 } 9467 9468 // if ( speed > 0 ) { 9469 // dir = true 9470 // } else if ( speed < 0 ) { 9471 // dir = false 9472 // } 9473 9474 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 9475 deg = deg+coeff; 9476 // if ( dir ) { 9477 // deg = deg+coeff; 9478 // } else { 9479 // deg = deg-coeff; 9480 // } 9481 } 9482 9483 if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9484 return false; 9485 } 9486 9487 if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) { 9488 var undeg = deg*-1; 9489 $rotate[0].style.transform = 'rotate(' + undeg + 'deg)'; 9490 } else { 9491 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 9492 } 9493 9494 requestAnimationFrame(function() { 9495 if ( frameRotate === true ) { 9496 frameRotate = false; 9497 return; 9498 } 9499 checkScroll($rotate); 9500 }); 9501 }; 9502 9503 checkScroll($rotate); 9504 9505 }); 9506 9507 }; 9508 9509 $(window).on('load', loadRotateIt); 9510 9511 var checkRotate; 9512 var resizeRotate = function(){ 9513 var $inlineRotates = $('.inline-rotate'); 9514 $inlineRotates.each(function(){ 9515 $(this).addClass('inline-rotate-standby'); 9516 }); 9517 clearTimeout(checkRotate); 9518 checkRotate = setTimeout(function(){ 9519 $('.inline-rotate').each(function(){ 9520 $(this).removeClass('inline-rotate-standby'); 9521 frameRotate = true; 9522 }); 9523 loadRotateIt(); 9524 }, 500); 9525 }; 9526 9527 $(window).off('resize.inline-rotate', resizeRotate) 9528 .on('resize.inline-rotate', resizeRotate); 9529 9530}; 9531 9532var marqueeAttempts = 0, 9533 marqueeTO, 9534 marqueeCheckResize; 9535 9536UNCODE.textMarquee = function( $titles ) { 9537 9538 var initTextMarquee = function( $titles ){ 9539 9540 if ( typeof $titles == 'undefined' ) { 9541 $titles = $('.un-text-marquee'); 9542 } 9543 9544 if ( ! $titles.length ) { 9545 return; 9546 } 9547 9548 var stableHeight = UNCODE.wheight; 9549 9550 $titles.each(function(){ 9551 var $title = $(this), 9552 $span = $('> span, > i > span', $title), 9553 txt, 9554 first = true, 9555 dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ), 9556 dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ), 9557 dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'), 9558 hasSticky = false, 9559 dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'), 9560 dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'), 9561 newW = UNCODE.wwidth, 9562 marqueeTL, inview; 9563 9564 if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) { 9565 hasSticky = true; 9566 dataTrigger = 'row'; 9567 } 9568 9569 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 9570 dataNavBar = dataNavBarMobile; 9571 } 9572 9573 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 9574 dataSpace = isNaN(dataSpace) ? 'default' : dataSpace; 9575 var dataX = dataSpeed; 9576 9577 dataSpeed += 5; 9578 9579 $('.marquee-clone-wrap', $title).remove(); 9580 9581 txt = $span.html(); 9582 9583 if ( ! $('.marquee-original-core', $span).length ) { 9584 txt = $span.html(); 9585 $span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 9586 } else { 9587 txt = $('.marquee-original-core', $span).html(); 9588 } 9589 9590 var spanW, 9591 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 9592 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 9593 speed = 10 - dataSpeed; 9594 9595 $span.prepend($prepended); 9596 $span.append($appended); 9597 9598 var continuousTextMarquee = function () { 9599 var bound = $title 9600 .css({ 9601 transform: "none", 9602 opacity: 0, 9603 }) 9604 .offset(), 9605 ease = "none"; 9606 9607 var xStrt = 9608 first || $title.hasClass("un-marquee-infinite") 9609 ? 0 9610 : UNCODE.wwidth - bound.left, 9611 xEnd = $title.hasClass("un-marquee-infinite") 9612 ? spanW 9613 : spanW + bound.left, 9614 xSpeed = 9615 ((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) * 9616 dataSpeed, 9617 direction = $title.hasClass("un-marquee-opposite") ? 1 : -1, 9618 speedSlow = (xEnd + xStrt) / 45, 9619 transFormVal, 9620 translX; 9621 9622 marqueeTL = new TimelineMax({ paused: true, reversed: true }); 9623 9624 var inViewElement = 9625 dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0], 9626 wayOff = 9627 dataTrigger === "row" && dataNavBar === "yes" 9628 ? UNCODE.menuHeight 9629 : 0; 9630 9631 inview = new Waypoint.Inview({ 9632 element: inViewElement, 9633 offset: wayOff, 9634 enter: function (direction) { 9635 marqueeTL.play(); 9636 }, 9637 exited: function (direction) { 9638 if (!$title.closest(".pin-spacer").length) { 9639 marqueeTL.pause(); 9640 } 9641 }, 9642 }); 9643 9644 if ($title.hasClass("un-marquee-hover")) { 9645 var $column = $title.closest(".wpb_column"), 9646 $col_link = $(".col-link", $column), 9647 $hover_sel = $title; 9648 9649 if ($col_link.length) { 9650 $hover_sel = $title.add($column); 9651 } 9652 $hover_sel 9653 .on("mouseover", function () { 9654 ease = "power2.out";
9655 transFormVal = $title.css("transform").split(/[()]/)[1]; 9656 translX = transFormVal.split(",")[4]; 9657 speedSlow = (xEnd + (xStrt - translX)) / 45; 9658 marqueeTL.duration(speedSlow); 9659 }) 9660 .on("mouseout", function () { 9661 ease = "power2.in"; 9662 transFormVal = $title.css("transform").split(/[()]/)[1]; 9663 translX = transFormVal.split(",")[4]; 9664 speedSlow = 9665 ((xEnd + (xStrt - translX)) / 9666 (dataSpeed * dataSpeed * dataSpeed) / 9667 5) * 9668 dataSpeed; 9669 marqueeTL.duration(speedSlow); 9670 }); 9671 } 9672 9673 gsap.killTweensOf($title); 9674 marqueeTL.fromTo( $title, { 9675 opacity: 1, 9676 x: xStrt * direction * -1 9677 }, 9678 { 9679 duration: xSpeed, 9680 x: xEnd * direction, 9681 onComplete: function(){ 9682 first = false; 9683 continuousTextMarquee(); 9684 }, 9685 ease: ease 9686 }); 9687 9688 }; 9689 9690 var runTextMarquee = function(){ 9691 var time = Date.now(); 9692 9693 var textMarqueeScroll = function(){ 9694 var $row = $title.closest('.vc_row'); 9695 if ( hasSticky ) { 9696 $row = $title.closest('.sticky-trigger, .sticky-element').parent(); 9697 } 9698 var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title; 9699 9700 if ( !$bound.length ) { 9701 return; 9702 } 9703 9704 var bound = $bound[0].getBoundingClientRect(), 9705 wait = 100, 9706 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1, 9707 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 9708 9709 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 9710 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 9711 marqueeAttempts < 2 ) { 9712 9713 clearRequestTimeout(marqueeTO); 9714 9715 marqueeTO = requestTimeout(function(){ 9716 marqueeAttempts++; 9717 initTextMarquee(); 9718 }, 100); 9719 } 9720 9721 9722 var bound_top = bound.top, 9723 gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction; 9724 9725 if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) { 9726 if ( dataTrigger === 'row-middle' ) { 9727 bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5) 9728 } 9729 if ( dataNavBar === 'yes' ) { 9730 bound_top = bound_top - UNCODE.menuHeight; 9731 } 9732 gsap_calc = ( bound_top * dataMove ) * 0.5 * direction; 9733 } 9734 9735 gsap.killTweensOf($title); 9736 gsap.to( $title, { 9737 duration: 0.24, 9738 x: gsap_calc, 9739 }); 9740 }; 9741 9742 textMarqueeScroll(); 9743 $(window).on( 'load scroll', function(e) { 9744 textMarqueeScroll(); 9745 }); 9746 9747 }; 9748 9749 var cloneSpan = function($_title, cntnt){ 9750 9751 if ( $_title.hasClass('un-marquee-infinite') ) { 9752 $('> span.marquee-clone-wrap', $_title).text(''); 9753 } 9754 9755 gsap.to( $_title, { 9756 duration: 0, 9757 x: 0 9758 }); 9759 spanW = $span.outerWidth(); 9760 9761 if ( !spanW ) { 9762 return; 9763 } 9764 9765 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2, 9766 spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0"; 9767 9768 if ( $_title.hasClass('un-marquee-infinite') ) { 9769 9770 for ( var i = 0; i < part; i++ ) { 9771 $prepended.append(cntnt + spaceSpan); 9772 $appended.append(cntnt + spaceSpan); 9773 } 9774 } 9775 9776 if ( $('body').hasClass('compose-mode') ) { 9777 $('.uncode_fe_safe').remove(); 9778 return; 9779 } 9780 9781 if ( $title.closest('.marquee-freezed').length ) { 9782 return; 9783 } 9784 9785 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 9786 continuousTextMarquee(); 9787 } 9788 9789 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 9790 runTextMarquee(); 9791 } 9792 9793 }; 9794 9795 var marqueeResize = function(e){ 9796 clearRequestTimeout(marqueeCheckResize); 9797 marqueeCheckResize = requestTimeout(function(){ 9798 if ( newW !== UNCODE.wwidth ) { 9799 gsap.killTweensOf($title); 9800 if ( typeof inview !== 'undefined' && inview !== null ) { 9801 inview.destroy(); 9802 } 9803 if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) { 9804 marqueeTL.kill(); 9805 } 9806 first = true; 9807 initTextMarquee(); 9808 newW = UNCODE.wwidth; 9809 } 9810 }, 1000); 9811 }; 9812 9813 $(window).off('resize uncode.re-layout', marqueeResize) 9814 .on( 'resize uncode.re-layout', marqueeResize); 9815 9816 cloneSpan($title, txt); 9817 9818 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9819 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 9820 var $_titles = $('.un-text-marquee',e.view.$el); 9821 clearRequestTimeout(marqueeCheckResize); 9822 marqueeCheckResize = requestTimeout(function(){ 9823 initTextMarquee($_titles); 9824 }, 1000); 9825 }); 9826 } 9827 }); 9828 9829 $(window).on( 'load wwResize', function(e) { 9830 stableHeight = UNCODE.wheight; 9831 }); 9832 9833 }; 9834 9835 document.addEventListener("DOMContentLoaded", function() { 9836 initTextMarquee(); 9837 }); 9838 9839 $(window).on('focus load',function(){ 9840 setTimeout(function(){ 9841 initTextMarquee(); 9842 },500); 9843 }); 9844 9845 $(document).on('pumAfterOpen pumAfterClose', function(args){ 9846 initTextMarquee(); 9847 }); 9848 9849}; 9850 9851UNCODE.parallax = function() { 9852 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 9853 if ($('.parallax-el').length > 0) { 9854 var parallax_elements = new Rellax('.parallax-el'); 9855 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 9856 window.addEventListener('boxResized', function(e) { 9857 parallax_elements.refresh(); 9858 }, false); 9859 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 9860 requestTimeout(function() { 9861 parallax_elements.refresh(); 9862 }, 100); 9863 }); 9864 9865 if ( typeof UNCODE.hDoc === 'undefined' ) { 9866 UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9867 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9868 } 9869 9870 function paralraf(time) { 9871 requestAnimationFrame(paralraf) 9872 9873 var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9874 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9875 9876 if ( UNCODE.hDoc !== newHdoc ) { 9877 UNCODE.hDoc = newHdoc; 9878 parallax_elements.refresh(); 9879 } 9880 } 9881 9882 requestAnimationFrame(paralraf) 9883 9884 } 9885 } 9886}; 9887 9888UNCODE.magicCursor = function(){ 9889 var $customCursor = $('#uncode-custom-cursor'), 9890 $customPilot = $('#uncode-custom-cursor-pilot'), 9891 $tooltip = $('.title-tooltip', $customCursor),
9892 $cursorSpan = $('> span', $tooltip), 9893 currentBg = false, 9894 fromTitle = false, 9895 setTime, 9896 mouseEvent; 9897 9898 var spanW, spanH, 9899 maxW = false; 9900 9901 function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){ 9902 if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) { 9903 $tooltip.css({opacity: 0}); 9904 delayt_time += 400; 9905 } 9906 clearRequestTimeout(setTime); 9907 setTime = requestTimeout(function() { 9908 9909 $tooltip.css({opacity: ''}); 9910 9911 $customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing'); 9912 9913 if ( cursorTitle !== '' ) { 9914 if ( fromTitle && dataTitle === 'boing' ) { 9915 setTimeout(function(){ 9916 $customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing'); 9917 }, 5); 9918 } 9919 $cursorSpan.attr('class', fontClass).html( cursorTitle ); 9920 } else { 9921 if ( cursorType !== 'auto' ) { 9922 $cursorSpan.html(''); 9923 } 9924 } 9925 9926 $cursorSpan.addClass('in-tooltip'); 9927 9928 $customCursor.attr('data-cursor', cursorType); 9929 9930 if ( fromTitle ) { 9931 $customCursor.addClass('from-tooltip-title'); 9932 } else { 9933 $customCursor.removeClass('from-tooltip-title'); 9934 } 9935 9936 if ( cursorBg !== false ) { 9937 $customCursor.attr('data-bg', 'transparent'); 9938 } else { 9939 $customCursor.removeAttr('data-bg'); 9940 } 9941 9942 currentBg = cursorBg; 9943 9944 if ( cursorTitle !== '' ) { 9945 fromTitle = true; 9946 $customCursor.attr('data-cursor', cursorType); 9947 $customCursor.attr('data-title', 'true'); 9948 $cursorSpan.css({width: ''}); 9949 } else { 9950 fromTitle = false; 9951 $customCursor.removeAttr('data-title'); 9952 } 9953 spanW = $cursorSpan.outerWidth(); 9954 9955 if ( spanW >= maxW && maxW !== false ) { 9956 $customCursor.find('> span:first-child').add($tooltip).addClass('max-width'); 9957 $customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({ 9958 width: maxW 9959 }); 9960 spanW = maxW; 9961 } else { 9962 $customCursor.find('> span:first-child').removeClass('max-width'); 9963 } 9964 spanH = $cursorSpan.outerHeight(); 9965 if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) { 9966 $customCursor.find('> span:first-child').add($tooltip).css({ 9967 width: spanW, 9968 height: spanH 9969 }); 9970 } else { 9971 $customCursor.find('> span:first-child').add($tooltip).removeAttr("style"); 9972 } 9973 if ( $customPilot.length ) { 9974 $customPilot.attr('data-cursor', cursorType); 9975 } 9976 }, delayt_time); 9977 } 9978 9979 function changeCursor($wrap){ 9980 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 9981 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 9982 $href = $wrap.find(href), 9983 cursorType, 9984 cursorTitle = '', 9985 tooltip_class = '', 9986 cursorBg = false; 9987 9988 $wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) { 9989 var $this = $(this).addClass("cursor-init"), 9990 $tmb = $this.closest('.tmb'), 9991 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 9992 cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'), 9993 data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'), 9994 data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'), 9995 custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')), 9996 $title = $('.t-entry-title', $tmb), 9997 is_frontend_editor = $this.closest('.vc_controls').length, 9998 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 9999 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 10000 10001 if ( is_frontend_editor ) { 10002 cursorType = 'auto'; 10003 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 10004 cursorType = data_cursor; 10005 } else if ( $parent_cursor.length ) { 10006 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 10007 cursorType = 'icon-light'; 10008 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 10009 cursorType = 'icon-diff'; 10010 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 10011 cursorType = 'icon-accent'; 10012 } else { 10013 cursorType = 'icon-dark'; 10014 } 10015 } else { 10016 cursorType = 'pointer'; 10017 } 10018 10019 if ( typeof data_title !== 'undefined' && data_title !== '' ) { 10020 if ( typeof custom_text !== 'undefined' && custom_text !== '' ) { 10021 cursorTitle = custom_text; 10022 } else { 10023 cursorTitle = $title.clone(); 10024 $('a', cursorTitle).replaceWith(function() { 10025 return this.childNodes; 10026 }); 10027 $('*', cursorTitle).replaceWith(function(){ 10028 return $(this).removeAttr('class'); 10029 });
10030 cursorTitle = cursorTitle.html(); 10031 } 10032 } else { 10033 cursorTitle = ''; 10034 } 10035 10036 if ( typeof data_class !== 'undefined' && data_class !== '' ) { 10037 tooltip_class = data_class; 10038 } else { 10039 tooltip_class = ''; 10040 } 10041 10042 if ( cursor_bg == 'true' ) { 10043 cursorBg = true; 10044 } else { 10045 cursorBg = false; 10046 } 10047 10048 delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class); 10049 }).on("mouseleave.cursor", href, function(e) { 10050 var outTime = 150; 10051 if ( currentBg !== false && cursorBg === false ) { 10052 outTime = 0; 10053 } 10054 delayChangeCursor('auto', '', false, outTime, false, ''); 10055 }); 10056 10057 $(window).on('disable-hover', function(event) { 10058 document.addEventListener("mousemove", function(e) { 10059 mouseEvent = e; 10060 }); 10061 delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, ''); 10062 }); 10063 10064 $(window).on('enable-hover', function(event) { 10065 if ( typeof mouseEvent !== 'undefined' ) { 10066 var x = mouseEvent.clientX, 10067 y = mouseEvent.clientY; 10068 10069 var elements = document.elementsFromPoint(x, y), 10070 $element = $(elements[0]); 10071 10072 $element.closest(href).trigger('mouseenter'); 10073 } 10074 }); 10075 10076 } 10077 10078 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10079 changeCursor(); 10080 }); 10081 10082 $(document).ajaxComplete(function( event, xhr, settings ) { 10083 changeCursor(); 10084 }); 10085 10086 $('.isotope-container').on('isotope-layout-complete', function() { 10087 var $this = $(this); 10088 changeCursor($this); 10089 }); 10090 10091}; 10092 10093UNCODE.magneticCursor = function(){ 10094 function magneticCursor($wrap){ 10095 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 10096 var $magnetics = $wrap.find('.tmb-image-anim-magnetic .t-entry-visual').has('img:not(.avatar), .t-background-cover, .dummy.secondary-dummy-image, .t-secondary-background-cover').add($('.magnetic').has('.background-inner, .header-bg')); 10097 10098 $magnetics.on('mousemove', function(e){ 10099 var $this = $(this), 10100 $el, 10101 bound = e.currentTarget.getBoundingClientRect(), 10102 coeff = 30, 10103 hor = (bound.width / 2) - (e.clientX - bound.left), 10104 ver = (bound.height / 2) - (e.clientY - bound.top), 10105 toX = hor / bound.width * coeff, 10106 toY = ver / bound.height * coeff, 10107 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 10108 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 10109 toScale = Math.max(scaleX, scaleY); 10110 10111 if ( $this.hasClass('magnetic') ) { 10112 $el = $('.background-inner, .header-bg', $this); 10113 } else { 10114 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10115 } 10116 10117 gsap.killTweensOf($el); 10118 gsap.to( $el, { 10119 duration: 0.75, 10120 x: toX, 10121 y: toY, 10122 scale: toScale, 10123 ease: Power1.easeOut, 10124 transformPerspective: 900, 10125 transformOrigin: 'center', 10126 force3D: true 10127 }); 10128 }).on('mouseout', function(e){ 10129 var $this = $(this), 10130 $el 10131 if ( $this.hasClass('magnetic') ) { 10132 $el = $('.background-inner, .header-bg', $this); 10133 } else { 10134 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10135 } 10136 gsap.killTweensOf($el); 10137 gsap.to( $el, { 10138 duration: 0.6, 10139 y: 0, 10140 x: 0, 10141 scale: 1, 10142 ease: Power1.easeOut, 10143 transformPerspective: 900, 10144 transformOrigin: 'center', 10145 force3D: true 10146 }); 10147 }); 10148 }; 10149 10150 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10151 magneticCursor(); 10152 }); 10153 10154 $(document).ajaxComplete(function( event, xhr, settings ) { 10155 magneticCursor(); 10156 }); 10157 10158 $('.isotope-container').on('isotope-layout-complete', function() { 10159 var $this = $(this); 10160 magneticCursor($this); 10161 }); 10162 10163}; 10164 10165UNCODE.dropImage = function() { 10166 10167 /**************************** 10168 * Image hover * 10169 ****************************/ 10170 function imageHover(){ 10171 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10172 return; 10173 } 10174 10175 var $postLists = $('.uncode-post-titles'); 10176 $postLists.each(function(){ 10177 var $list = $(this), 10178 timing = parseFloat( $list.attr('data-timing') ), 10179 default_image = $list.hasClass('uncode-post-titles-default-image'), 10180 default_title = $list.hasClass('uncode-post-titles-default-title'), 10181 $tmbs = $('.tmb', $list), 10182 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 10183 clientX, 10184 clientY, 10185 $row_parent = $list.closest('.vc_row'), 10186 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 10187 $col_parent = $list.closest('.uncell'), 10188 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 10189 stoppedScrolling = true, 10190 setCTA; 10191 10192 timing *= 0.001; 10193 10194 var drop_bgs = function(){ 10195 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 10196 var $drop = $(this), 10197 srcset = $drop.attr('data-bgset'), 10198 setArr = srcset.split(","), 10199 setArrOrder = [], 10200 biggest = 0, 10201 checkBg = false, 10202 desktopBG = $drop.data('[data-background-image]'), 10203 mobileBG = $drop.data('[data-mobile-background-image]'); 10204 10205 if ( $drop.hasClass('srcset-bg-async') ) { 10206 10207 if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) { 10208 return; 10209 } 10210 10211 } 10212 10213 if ( SiteParameters.uncode_adaptive == true ) { 10214 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 10215 $drop.css({ 10216 'background-image' : 'url(' + setArr[0] + ')' 10217 }); 10218 } 10219 } else { 10220 for ( var i = 0; i < setArr.length; i++ ) { 10221 var setLoop = setArr[i].trim().split(" ");
10222 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 10223 var parseSet = parseFloat(setLoop[1]); 10224 if ( biggest < parseSet ) { 10225 biggest = parseSet; 10226 } 10227 setArrOrder[parseSet] = setLoop[0]; 10228 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 10229 checkBg = true; 10230 $drop.css({ 10231 'background-image' : 'url(' + setLoop[0] + ')' 10232 }); 10233 } 10234 } 10235 } 10236 10237 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 10238 $drop.css({ 10239 'background-image' : 'url(' + setArrOrder[biggest] + ')' 10240 }); 10241 } 10242 } 10243 10244 }); 10245 }; 10246 10247 drop_bgs(); 10248 10249 var dropMovesSize = function(){ 10250 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 10251 return; 10252 } 10253 $drop_moves.each(function(){ 10254 var $drop_move = $(this), 10255 dataW = $drop_move.attr('data-w'), 10256 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 10257 if ( typeof dataW !== 'undefined' && dataW !== null ) { 10258 dataW = screenInfo.width / 12 * parseFloat( dataW ); 10259 } 10260 $drop_moves.css({ 10261 width: dataW 10262 }); 10263 10264 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10265 $anim_parent.on('animationend', function(){ 10266 var bound = $anim_parent[0].getBoundingClientRect(); 10267 $drop_move.css({ 10268 left: bound.x * -1, 10269 top: bound.y * -1, 10270 }); 10271 }); 10272 } 10273 }); 10274 10275 10276 }; 10277 10278 dropMovesSize(); 10279 10280 $(window).on( 'resize', function(){ 10281 clearRequestTimeout(setCTA); 10282 setCTA = requestTimeout( function() { 10283 drop_bgs(); 10284 dropMovesSize(); 10285 }, 100 ); 10286 }); 10287 10288 if ( $drop_row_parents.length ) { 10289 $row_parent.addClass( 'drop-added' ); 10290 } 10291 10292 $drop_row_parents.each(function(index, val){ 10293 var $drop = $(val); 10294 $row_parent.prepend($drop); 10295 manageVideos($drop, false); 10296 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10297 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10298 } 10299 if ( default_image && index == 0 ) { 10300 manageVideos($drop, true); 10301 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10302 image_ph = new Image(); 10303 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10304 image_ph.onload = function() { 10305 $drop.addClass('active'); 10306 if ( default_title ) { 10307 $list.addClass('drop-hover'); 10308 $tmbs.first().addClass('drop-active'); 10309 } 10310 }; 10311 image_ph.src = bg_img; 10312 } 10313 } 10314 }); 10315 10316 if ( $drop_col_parents.length ) { 10317 $col_parent.addClass( 'drop-added' ); 10318 } 10319 10320 $drop_col_parents.each(function(index, val){ 10321 var $drop = $(this); 10322 $col_parent.prepend($drop); 10323 manageVideos($drop, false); 10324 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10325 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10326 } 10327 if ( default_image && index == 0 ) { 10328 manageVideos($drop, true); 10329 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10330 image_ph = new Image(); 10331 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10332 image_ph.onload = function() { 10333 $drop.addClass('active'); 10334 if ( default_title ) { 10335 $list.addClass('drop-hover'); 10336 $tmbs.first().addClass('drop-active'); 10337 } 10338 }; 10339 image_ph.src = bg_img; 10340 } 10341 } 10342 }); 10343 10344 function manageVideos( $el, start ) { 10345 var videoElem = $('video', $el), 10346 $iframe = $('iframe', $el), 10347 iframeID = $iframe.attr('id'); 10348 if ( videoElem.length ) { 10349 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 10350 if ( start ) { 10351 videoElem[0].setCurrentTime(0); 10352 videoElem[0].play(); 10353 } else { 10354 videoElem[0].pause(); 10355 videoElem[0].setCurrentTime(0); 10356 } 10357 } else { 10358 if ( start ) { 10359 videoElem[0].currentTime = 0; 10360 videoElem[0].play(); 10361 } else { 10362 videoElem[0].pause(); 10363 videoElem[0].currentTime = 0; 10364 } 10365 } 10366 } 10367 10368 $el.data('active', start); 10369 10370 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 10371 var iframeIDv = iframeID.replace('okplayer-', ''), 10372 optionsV = $(window).data('okoptions-' + iframeIDv), 10373 vimeo = $iframe[0], 10374 playerV = new Vimeo.Player(vimeo), 10375 timeV = 0; 10376 10377 if (optionsV.time != null) { 10378 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 10379 for ( var i = 0; i < timeArr.length; i++ ) { 10380 if ( timeArr[i] === 'h' ) { 10381 timeV += parseFloat(timeArr[i-1]) * 3600; 10382 } else if ( timeArr[i] === 'm' ) { 10383 timeV += parseFloat(timeArr[i-1]) * 60; 10384 } else if ( timeArr[i] === 's' ) { 10385 timeV += parseFloat(timeArr[i-1]); 10386 } 10387 } 10388 } 10389 playerV.setCurrentTime(timeV); 10390 if ( start ) { 10391 playerV.setVolume(0); 10392 playerV.play(); 10393 } else { 10394 playerV.pause(); 10395 } 10396 } else if ( $el.attr('data-provider') === 'youtube' ) { 10397 if ( start ) { 10398 $el.trigger('uncode-resume'); 10399 } else { 10400 $el.trigger('uncode-pause'); 10401 } 10402 } 10403 10404 } 10405 10406 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10407 10408 document.addEventListener("mousemove", function(e) { 10409 $drop_moves.each(function(){ 10410 var $drop_move = $(this), 10411 duration = 0.4; 10412 10413 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 10414 duration = 0.8; 10415 } 10416 10417 clientX = e.clientX; 10418 clientY = e.clientY; 10419 10420 gsap.to( $drop_move, { 10421 duration: duration, 10422 x: clientX, 10423 y: clientY, 10424 ease: Power1.easeOut, 10425 }); 10426 }); 10427 }); 10428 10429 } else { 10430 10431 $(window).on("touchend scroll", function(e) { 10432 $list.removeClass('drop-hover'); 10433 $drop_moves.removeClass('active'); 10434 $tmbs.removeClass('drop-active'); 10435 }); 10436 10437 $drop_moves.each(function(){ 10438 var $drop_move = $(this), 10439 $tmb = $drop_move.closest('.tmb'), 10440 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 10441 10442 if ( $anim_parent.hasClass('uncode-skew') ) { 10443 $anim_parent.css({ 10444 'transform': 'skew(0)' 10445 }); 10446 } 10447 10448 $tmb.on('touchend', function(e){ 10449 e.stopPropagation(); 10450 10451 $drop_moves.removeClass('active'); 10452 $tmbs.removeClass('drop-active'); 10453 10454 $list.addClass('drop-hover'); 10455 $tmb.addClass('drop-active'); 10456 $drop_move.addClass('active'); 10457 manageVideos($drop_move, true); 10458 clientX = e.changedTouches[0].clientX; 10459 clientY = e.changedTouches[0].clientY; 10460 10461 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10462 var bound = $anim_parent[0].getBoundingClientRect(); 10463 clientX = clientX - bound.x; 10464 clientY = clientY - bound.y; 10465 } 10466 10467 $drop_move.css({ 10468 left: clientX, 10469 top: clientY 10470 }); 10471 }); 10472 }); 10473 10474 } 10475 10476 $tmbs.each(function(e){ 10477 var $tmb = $(this), 10478 // $trgr = $('a', $tmb), 10479 $trgr = $tmb, 10480 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 10481 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10481(.t-inside), .parallax-el'), 10482 $video = $('video', $tmb), 10483 $iframe = $('iframe', $tmb), 10484 $entryTxt = $('.t-entry-text', $tmb), 10485 stopBounding; 10486 10487 $entryTxt.add($drop_move).css({ 10488 'transition-duration': timing + 's' 10489 }); 10490 10491 if ( $video.length ) { 10492 var vidH = $video[0].videoHeight, 10493 vidW = $video[0].videoWidth; 10494 $video.css({ 10495 'height': vidH, 10496 'width': vidW 10497 }); 10498 } 10499 10500 if ( $iframe.length ) { 10501 var vidH = $drop_move.attr('data-height'), 10502 vidW = $drop_move.attr('data-width'); 10503 $iframe.css({ 10504 'height': vidH, 10505 'width': vidW 10506 }); 10507 } 10508 10509 $iframe.each(function(){ 10510 var $video = $(this), 10511 vidH = $video[0].videoHeight, 10512 vidW = $video[0].videoWidth; 10513 $video.css({ 10514 'height': vidH, 10515 'width': vidW 10516 }); 10517 }); 10518 10519 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10520 $trgr.on('mouseenter',function(e){ 10521 10522 $list.addClass('drop-hover'); 10523 $tmbs.removeClass('drop-active'); 10524 $tmb.addClass('drop-active'); 10525 $drop_move.addClass('active'); 10526 manageVideos($drop_move, true); 10527 10528 var clientX = e.clientX, 10529 clientY = e.clientY; 10530 $drop_move.css({ 10531 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 10532 }); 10533 10534 }) 10535 .on('mouseleave', function(e){ 10536 $list.removeClass('drop-hover'); 10537 $drop_move.css({ 10538 'transition-duration': ( timing*1.25 ) + 's' 10539 }); 10540 $drop_move.removeClass('active'); 10541 $tmb.removeClass('drop-active'); 10542 $drop_move.on('transitionend', function(e){ 10543 $drop_move.off('transitionend'); 10544 $drop_move.css({ 10545 'transition-duration': timing + 's' 10546 }); 10547 manageVideos($drop_move,false); 10548 }); 10549 }); 10550 10551 document.addEventListener('visibilitychange', function(){ 10552 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 10553 $drop_move.css({ 10554 'transition-duration': '0s' 10555 }); 10556 $drop_move.removeClass('active'); 10557 manageVideos($drop_move, false); 10558 } 10559 }); 10560 10561 document.addEventListener('scroll', function(){ 10562 window.clearRequestTimeout( stopBounding ); 10563 if ( stoppedScrolling ) { 10564 stoppedScrolling = false; 10565 if ( $drop_move.hasClass('active') ) { 10566 $list.removeClass('drop-hover'); 10567 $tmbs.removeClass('drop-active'); 10568 $drop_move.removeClass('active'); 10569 $drop_move.on('transitionend', function(e){ 10570 $drop_move.off('transitionend'); 10571 $drop_move.css({ 10572 'transition-duration': timing + 's' 10573 }); 10574 manageVideos($drop_move,false); 10575 }); 10576 } 10577 } 10578 10579 stopBounding = requestTimeout(function() { 10580 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10581 var bound = $anim_parent[0].getBoundingClientRect(); 10582 $drop_move.css({ 10583 left: bound.x * -1, 10584 top: bound.y * -1, 10585 }); 10586 } 10587 stoppedScrolling = true; 10588 }, 500); 10589 }); 10590 } 10591 10592 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 10593 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 10594 10595 $drop.css({ 10596 'transition-duration': timing + 's' 10597 }); 10598 10599 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 10600 $trgr.on('mouseenter',function(e){ 10601 $row_parent.add($col_parent).addClass('drop-list-loaded'); 10602 $list.addClass('drop-hover'); 10603 10604 if ( !$tmb.hasClass('drop-active') ) { 10605 $tmbs.removeClass('drop-active'); 10606 $tmb.addClass('drop-active'); 10607 if ( default_image && !$drop.hasClass('active') ) { 10608 var $prev = $('[data-drop].active', $row_parent); 10609 $prev.css({ 10610 'transition-duration': (timing*1.5) + 's' 10611 }); 10612 $prev.removeClass('active'); 10613 $prev.on('transitionend', function(e){ 10614 $prev.off('transitionend'); 10615 manageVideos($prev,false); 10616 }); 10617 } 10618 $drop.css({ 10619 'transition-duration': timing + 's' 10620 }); 10621 $drop.off('transitionend'); 10622 $drop.addClass('active'); 10623 manageVideos($drop, true); 10624 } 10625 }) 10626 .on('mouseleave', function(e){ 10627 if ( ( default_image && !default_title ) || !default_image ) { 10628 $list.removeClass('drop-hover'); 10629 $tmb.removeClass('drop-active'); 10630 } 10631 if ( ! default_image ) { 10632 $drop.css({ 10633 'transition-duration': (timing*1.5) + 's' 10634 }); 10635 $drop.removeClass('active'); 10636 10637 $drop.on('transitionend', function(e){ 10638 $drop.off('transitionend'); 10639 manageVideos($drop,false); 10640 }); 10641 } 10642 }); 10643 10644 document.addEventListener('visibilitychange', function(){ 10645 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 10646 $drop.css({ 10647 'transition-duration': '0s' 10648 }); 10649 $drop.removeClass('active'); 10650 manageVideos($drop, false); 10651 } 10652 }); 10653 } 10654 }); 10655 10656 }); 10657 }; 10658 10659 $(window).on('load', function(event) { 10660 imageHover(); 10661 }); 10662 10663 var drop_wp_animation = function() { 10664 var $postLists = $('.uncode-post-titles'); 10665 $postLists.each(function(){ 10666 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10667 new Waypoint({ 10668 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10669 element: val, 10670 handler: function() { 10671 var element = $(this.element), 10672 parent = element.closest('.tmb'), 10673 currentIndex = parent.index(),
10674 delay = currentIndex, 10675 delayAttr = parseInt(element.attr('data-delay')); 10676 if (isNaN(delayAttr)) delayAttr = 100; 10677 var objTimeout = requestTimeout(function() { 10678 element.addClass('start_animation'); 10679 10680 var nextTimeout = requestTimeout(function() { 10681 $('.drop-image-separator', parent).addClass('start_animation'); 10682 }, 50); 10683 10684 }, delay * delayAttr); 10685 if (!UNCODE.isUnmodalOpen) { 10686 this.destroy(); 10687 } 10688 }, 10689 offset: UNCODE.isFullPage ? '100%' : '90%' 10690 }) 10691 }); 10692 }); 10693 } 10694 10695 var runWaypoints_TO, 10696 runWaypoints_delay = 0; 10697 10698 var runWaypoints = function(){ 10699 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10700 runWaypoints_delay = 400; 10701 } 10702 clearRequestTimeout(runWaypoints_TO); 10703 runWaypoints_TO = requestTimeout(function() { 10704 drop_wp_animation(); 10705 }, runWaypoints_delay); 10706 }; 10707 runWaypoints(); 10708 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10709 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10710 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10711 // imageHover(); 10712 runWaypoints(); 10713 }); 10714 } 10715}; 10716 10717UNCODE.postTable = function() { 10718 10719 var clickRow = function(){ 10720 var $postLists = $('.uncode-post-table'); 10721 10722 $postLists.each(function(){ 10723 var $postList = $(this), 10724 $tmbClicks = $('.tmb.tmb-click-row', $postList); 10725 10726 $tmbClicks.each(function(){ 10727 var $tmb = $(this), 10728 $click = $('.table-click-row', $tmb); 10729 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 10730 e.preventDefault(); 10731 e.stopPropagation(); 10732 $click[0].click(); 10733 return false; 10734 }); 10735 }); 10736 10737 }) 10738 }; 10739 10740 clickRow(); 10741 10742 var hoverRow = function(){ 10743 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 10744 10745 $postLists.on('mouseenter', function(){ 10746 $(this).addClass('post-table-hover'); 10747 }); 10748 $postLists.on('mouseleave', function(){ 10749 $(this).removeClass('post-table-hover'); 10750 }); 10751 } 10752 10753 hoverRow(); 10754 10755 var drop_wp_animation = function() { 10756 var $postLists = $('.uncode-post-table'); 10757 $postLists.each(function(){ 10758 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10759 new Waypoint({ 10760 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10761 element: val, 10762 handler: function() { 10763 var element = $(this.element), 10764 parent = element.closest('.tmb'), 10765 currentIndex = parent.index(), 10766 delay = currentIndex, 10767 delayAttr = parseInt(element.attr('data-delay')); 10768 if (isNaN(delayAttr)) delayAttr = 100; 10769 var objTimeout = requestTimeout(function() { 10770 element.addClass('start_animation'); 10771 }, delay * delayAttr); 10772 if (!UNCODE.isUnmodalOpen) { 10773 this.destroy(); 10774 } 10775 }, 10776 offset: UNCODE.isFullPage ? '100%' : '90%' 10777 }) 10778 }); 10779 }); 10780 } 10781 10782 var runWaypoints_TO, 10783 runWaypoints_delay = 0; 10784 10785 var runWaypoints = function(){ 10786 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10787 runWaypoints_delay = 400; 10788 } 10789 clearRequestTimeout(runWaypoints_TO); 10790 runWaypoints_TO = requestTimeout(function() { 10791 drop_wp_animation(); 10792 }, runWaypoints_delay); 10793 }; 10794 runWaypoints(); 10795 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10796 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10797 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10798 runWaypoints(); 10799 // clickRow(); 10800 }); 10801 } 10802}; 10803 10804UNCODE.rotatingTxt = function($ctxt) { 10805 10806 if ( $('body').hasClass('compose-mode') ) { 10807 return; 10808 } 10809 10810 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 10811 var setCTA; 10812 10813 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 10814 var $heading = $(this), 10815 // debug = 0, 10816 cycle = 0, 10817 $trgt, 10818 $toMove, 10819 $highl, 10820 $col = $heading.closest('.uncont'), 10821 txt, 10822 arrTxt, 10823 textFadeIn, textFadeOut, 10824 removeWraps; 10825 10826 var defineObjs = function() { 10827 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 10828 var $rtx = $(this), 10829 fx = $rtx.attr('data-fx'), 10830 wait = $rtx.attr('data-wait'), 10831 $prev = $(this).prev().addClass('prev-rotating-start'), 10832 splitToMove = [], 10833 splitArray = [], 10834 lineArray = [], 10835 lineIndex = 0, 10836 lineStart = true, 10837 lineEnd = false, 10838 startSplit = false, 10839 $line_wrap = $rtx.closest('.heading-line-wrap'), 10840 same_line = true, 10841 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 10842 indexRtx = $splits.index($rtx); 10843 10844 fx = typeof fx === 'undefined' ? '' : fx;
10845 wait = typeof wait === 'undefined' ? '' : wait; 10846 10847 $splits.each(function(key, val){ 10848 var $split = $(this), 10849 $new_line_wrap = $split.closest('.heading-line-wrap'); 10850 10851 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 10852 splitArray.push( $split ); 10853 } 10854 10855 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10856 startSplit = false; 10857 } 10858 10859 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10860 splitArray.push( $split ); 10861 10862 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 10863 same_line = true; 10864 } else { 10865 same_line = false; 10866 } 10867 } 10868 10869 if ( key == indexRtx ) { 10870 if ( /\S/.test($split.text()) ) { 10871 startSplit = true; 10872 $line_wrap = $split.closest('.heading-line-wrap'); 10873 splitArray.push( $split ); 10874 } else { 10875 indexRtx++; 10876 } 10877 } 10878 10879 $line_wrap = $new_line_wrap; 10880 }); 10881 10882 $toMove = $($.map(splitToMove, function(el){return el.get();})); 10883 $trgt = $($.map(splitArray, function(el){return el.get();})); 10884 10885 if ( same_line ) { 10886 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 10887 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 10888 } 10889 10890 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 10891 $prev.addClass('empty-span-hidden'); 10892 } 10893 10894 $highl = $('.heading-text-highlight-inner', $trgt); 10895 10896 $rtx.attr('data-animated', 'true'); 10897 if ( cycle == 0 ) { 10898 $( document.body ).trigger('defer-highlights'); 10899 cycle++; 10900 defineObjs(); 10901 return; 10902 } 10903 cycle++; 10904 10905 txt = $rtx.attr('data-text'); 10906 arrTxt = txt.split("|"); 10907 10908 textFadeOut($trgt); 10909 10910 }); 10911 }; 10912 10913 removeWraps = function(){ 10914 10915 // if ( debug == 1 ) return; 10916 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 10917 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 10918 10919 10920 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 10921 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 10922 10923 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 10924 10925 $splitFlow.each(function(){ 10926 $(this).append($temp_highl); 10927 }); 10928 10929 var $line_wrap = $wraps[wrap_k]; 10930 var $parent_wrap = $line_wrap.parentNode; 10931 if ( $parent_wrap !== null ) { 10932 while ( $line_wrap.firstChild ) { 10933 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 10934 } 10935 $parent_wrap.removeChild($line_wrap); 10936 } 10937 } 10938 // debug++; 10939 defineObjs(); 10940 }; 10941 10942 var loop = 0; 10943 textFadeIn = function($trgt){ 10944 var word = arrTxt[loop].split(" "), 10945 worsSpan = '', 10946 $wrap = $trgt.closest('.uncode-rotating-wrap'), 10947 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 10948 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 10949 10950 for (var w = 0; w < word.length; w++) { 10951 var highl; 10952 if ( $highl.length ) { 10953 highl = $highl[0].outerHTML; 10954 } else { 10955 highl = ''; 10956 } 10957 10958 if ( w > 0 ) { 10959 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 10960 } 10961 var charachters = word[w].split(''); 10962 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 10963 for (var c = 0; c < charachters.length; c++) { 10964 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 10965 } 10966 worsSpan += '</span>' + highl + '</span></span>'; 10967 } 10968 10969 if ( $wrap.length && $wrap_inner.length ) { 10970 var words_w = $wrap_inner.outerWidth(); 10971 $wrap.css({ 10972 width: words_w 10973 }); 10974 10975 $highl = $('.heading-text-highlight-inner', $wrap); 10976 $highl.prependTo($wrap); 10977 10978 $wrap_inner.css({ 10979 opacity: 0 10980 }); 10981 10982 $wrap_inner.html(worsSpan); 10983 $('.heading-text-highlight-inner', $wrap_inner).remove(); 10984 words_w = $wrap_inner.innerWidth(); 10985 10986 var duration = 0.45; 10987 10988 $heading.removeClass('auto-width'); 10989 if ( words_w > $col.width() ) { 10990 $heading.addClass('auto-width'); 10991 words_w = 'auto'; 10992 duration = 0; 10993 } 10994 10995 $wrap.css({ 10996 'width': words_w, 10997 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 10998 }); 10999 11000 var $word_inner = $('.split-word-inner', $wrap_inner), 11001 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 11002 11003 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11004 11005 if ( !$target_fx.length ) { 11006 return; 11007 } 11008 11009 gsap.killTweensOf($target_fx); 11010 11011 if ( fx !== 'zoom' ) { 11012 gsap.fromTo( $target_fx, { 11013 y: fx === 'opacity' ? '0%' : '-10%' 11014 },{ 11015 delay: duration, 11016 duration: 0.25, 11017 y: '0%', 11018 ease: Circ.easeOut, 11019 }); 11020 11021 if ( !$wrap_inner.length ) { 11022 return; 11023 } 11024 11025 gsap.fromTo( $wrap_inner, { 11026 opacity: 0, 11027 },{ 11028 delay: duration, 11029 duration: 0.25, 11030 opacity: 1, 11031 ease: Circ.easeOut, 11032 onComplete: function(){ 11033 $('> .heading-text-highlight-inner', $wrap).remove(); 11034 $wrap_inner.html(worsSpan); 11035 removeWraps(); 11036 } 11037 }) 11038 11039 } else { 11040 gsap.fromTo( $target_fx, { 11041 transformOrigin: '50%', 11042 opacity: 0, 11043 scale: 0.875, 11044 },{ 11045 opacity: 1, 11046 delay: duration, 11047 duration: 0.25, 11048 scale: 1, 11049 ease: Circ.easeOut, 11050 onComplete: function(){ 11051 $('> .heading-text-highlight-inner', $wrap).remove(); 11052 $wrap_inner.html(worsSpan); 11053 removeWraps(); 11054 } 11055 }); 11056 } 11057 11058 } else { 11059 11060 if ( !$wrap_inner.length ) { 11061 return; 11062 } 11063 11064 gsap.to( $wrap_inner, { 11065 duration: 0.4, 11066 opacity: 0, 11067 ease: Power1.easeOut, 11068 onComplete: function(){ 11069 $wrap_inner.html(worsSpan); 11070 words_w = $wrap_inner.innerWidth(); 11071 11072 gsap.to( $wrap_inner, { 11073 duration: 0.2, 11074 opacity: 1, 11075 ease: Power1.easeOut, 11076 onComplete: function(){ 11077 $('> .heading-text-highlight-inner', $wrap).remove(); 11078 $wrap_inner.html(worsSpan); 11079 removeWraps(); 11080 } 11081 }) 11082 } 11083 }); 11084 } 11085 11086 if ( loop < arrTxt.length-1 ) { 11087 loop++; 11088 } else { 11089 loop = 0; 11090 } 11091 11092 }; 11093 11094 textFadeOut = function($trgt){ 11095 var $word_inner = $('.split-word-inner', $trgt), 11096 $wrap = $trgt.closest('.uncode-rotating-wrap'), 11097 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 11098 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 11099 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 11100 11101 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 11102 11103 var gsap_param = { 11104 delay: wait, 11105 duration: 0.25, 11106 y: fx === '' ? '10%' : '0%', 11107 opacity: 0, 11108 ease: Circ.easeOut, 11109 onStart: function(){ 11110 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 11111 $highl = $('.heading-text-highlight-inner', $wrap); 11112 $highl.prependTo($wrap); 11113 } 11114 }, 11115 onComplete: textFadeIn, 11116 onCompleteParams: [$trgt] 11117 }; 11118 11119 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11120 11121 if ( fx === '' ) { 11122 gsap_param.y = '10%'; 11123 } else if ( fx === 'zoom' ) { 11124 gsap_param.scale = '1.045'; 11125 } 11126 11127 if ( !$target_fx.length ) { 11128 return; 11129 } 11130 11131 if ( $heading.data('waypoint') !== true ) { 11132 var textInView = new Waypoint.Inview({ 11133 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 11134 element: $heading[0], 11135 enter: function(direction) { 11136 $heading.data('waypoint',true); 11137 gsap.fromTo( $target_fx, { 11138 transformOrigin: '50%' 11139 }, gsap_param ); 11140 } 11141 }); 11142 } else { 11143 gsap.fromTo( $target_fx, { 11144 transformOrigin: '50%' 11145 }, gsap_param ); 11146 } 11147 }; 11148 11149 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 11150 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 11151 var $el = model.view.$el, 11152 shortcode = model.attributes.shortcode; 11153 11154 UNCODE.rotatingTxt($el); 11155 }); 11156 } else { 11157 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 11158 $heading.on('already-animated', function(){ 11159 removeWraps(); 11160 window.addEventListener('removeOldLines', function(){ 11161 clearRequestTimeout(setCTA); 11162 setCTA = requestTimeout( removeWraps, 150 ); 11163 }); 11164 }); 11165 } else { 11166 $(window).on('load', function(){ 11167 removeWraps(); 11168 window.addEventListener('removeOldLines', function(){ 11169 clearRequestTimeout(setCTA); 11170 setCTA = requestTimeout( removeWraps, 150 ); 11171 }); 11172 }); 11173 } 11174 } 11175 }); 11176 11177}; 11178 11179UNCODE.verticalText = function() { 11180 $(window).on('menuCanvasOpen', function(){ 11181 $('.vertical-text--fixed').fadeOut(500); 11182 $('.horizontal-text--fixed').fadeOut(500); 11183 }).on('menuCanvasClose', function(){ 11184 $('.vertical-text--fixed').fadeIn(500); 11185 $('.horizontal-text--fixed').fadeIn(500); 11186 }); 11187 11188 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 11189 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 11190 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 11191 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 11192 11193 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 11194 window.addEventListener('scroll', function(e) { 11195 var totalPageHeight = document.body.scrollHeight; 11196 var scrollPoint = window.scrollY + window.innerHeight; 11197 11198 if (window.scrollY > 0) { 11199 showOnTopVerticalTexts.fadeOut(); 11200 showOnTopHorizontalTexts.fadeOut(); 11201 } else { 11202 showOnTopVerticalTexts.fadeIn(); 11203 showOnTopHorizontalTexts.fadeIn(); 11204 } 11205 11206 if (scrollPoint >= totalPageHeight) { 11207 hideOnBottomVerticalTexts.fadeOut(); 11208 hideOnBottomHorizontalTexts.fadeOut(); 11209 } else { 11210 hideOnBottomVerticalTexts.fadeIn(); 11211 hideOnBottomHorizontalTexts.fadeIn(); 11212 } 11213 }, false); 11214 } 11215}; 11216 11217UNCODE.stickyScroll = function( $el ) { 11218 if ( typeof $el === 'undefined' || $el === null ) { 11219 $el = $('body'); 11220 } 11221 var checkVisible = function( el, dir ) { 11222 if (typeof jQuery === "function" && el instanceof jQuery) { 11223 el = el[0]; 11224 } 11225 11226 var off = 50; 11227 dir = typeof dir=='undefined' ? 'right' : dir; 11228 var rect = el.getBoundingClientRect(); 11229 11230 return ( 11231 ( 11232 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11233 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11234 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 11235 ) && 11236 ( 11237 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 11238 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 11239 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 11240 ( rect.right <= window.innerWidth && rect.left >= 0 ) 11241 ) 11242 ); 11243 }; 11244 11245 var setItemsRelHeight = function(reset) { 11246 var $_el = $el; 11247 if ( $el.is('.index-scroll') ) { 11248 var $_el = $el.closest('.uncont'); 11249 } 11250 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 11251 $.each($('.tmb', item), function(index, val) { 11252 if ( reset === true ) { 11253 $(val).css( 'visibility', 'hidden' ); 11254 } else { 11255 $(val).css( 'visibility', 'visible' ); 11256 } 11257 }); 11258 }); 11259 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 11260 $.each($('.tmb', item), function(index, val) { 11261 if ( reset === true ) { 11262 $(val).css( 'visibility', 'hidden' ); 11263 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 11264 } else { 11265 var $rowParent = $(item).closest('.row-parent'), 11266 rowRatio = $rowParent.attr('data-height-ratio'), 11267 $rowInner = $(item).closest('.row-child'), 11268 rowRatioInner = $rowInner.attr('data-height'), 11269 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11270 $colContainer = $(item).closest('.uncell'), 11271 $uncont = $(item).closest('.uncont'), 11272 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 11273 safe_heigth = $(item).data('safe-height'), 11274 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 11275 offSet = $(item).offset().top - $uncont.offset().top, 11276 multiplier_h, 11277 data_viewport_h, 11278 body_border = $('.body-borders .top-border').outerHeight() * 2, 11279 remove_menu = $(item).data('vp-menu'); 11280 11281 if ( rowRatio === 'full' || rowRatio === '' ) { 11282 rowRatio = 1; 11283 } else { 11284 rowRatio = rowRatio / 100; 11285 } 11286 11287 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 11288 rowRatio = rowRatio; 11289 } else { 11290 rowRatio = rowRatio * rowRatioInner / 100; 11291 } 11292 11293 winHeight = winHeight * rowRatio; 11294 11295 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 11296 multiplier_h = parseInt($(item).attr('data-vp-height')); 11297 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 11298 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 11299 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 11300 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 11301 } 11302 11303 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 11304 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 11305 if ( remove_menu === true ) { 11306 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 11307 } 11308 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 11309 } else { 11310 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 11311 } 11312 11313 } 11314 }); 11315 }); 11316 $('.index-scroll', $_el).each(function(i, item){ 11317 var $uncoltable = $(item).closest('.uncoltable'), 11318 $rowParent = $(item).closest('.row-parent'), 11319 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11320 body_border = $('.body-borders .top-border').outerHeight() * 2, 11321 $index_row = $('.index-row', item), 11322 safe_heigth = $index_row.data('safe-height'), 11323 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 11324 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 11325 var data_viewport_h = winHeight - ( paddingRow + body_border ); 11326 $uncoltable.css({ 11327 'min-height': data_viewport_h 11328 }); 11329 } else { 11330 $uncoltable.css({ 11331 'min-height': 'auto' 11332 }); 11333 } 11334 }); 11335 11336 } 11337 setItemsRelHeight(); 11338 11339 var $index_scrolls = $('.index-scroll', $el); 11340
11341 $index_scrolls.each(function(key, value){ 11342 var $index = $(this), 11343 $parent_row = $index.closest('.vc_row[data-parent]'), 11344 $index_row = $('.index-row', $index), 11345 dir = $index_row.attr('data-direction'); 11346 dir = typeof dir === 'undefined' ? 'right' : dir; 11347 11348 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 11349 }); 11350 11351 var $horScrolls = $('.unscroll-horizontal', $el); 11352 11353 if ( $horScrolls.length ) { 11354 11355 $('body').addClass('scrolling-trigger'); 11356 11357 $horScrolls.each(function(key, value){ 11358 var $section = $(this), 11359 $index_scroll = $('.index-scroll', $section), 11360 $index_row = $('.index-row', $index_scroll), 11361 dir = $section.attr('data-direction'), 11362 wrap = $index_row.attr('data-wrap'), 11363 $pinWrap, 11364 $pinTrigger; 11365 11366 dir = typeof dir === 'undefined' ? 'right' : dir; 11367 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 11368 $pinWrap = $('<div class="pin-wrap" />'); 11369 if ( SiteParameters.is_frontend_editor ) { 11370 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 11371 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 11372 } else { 11373 if ( wrap === 'column' ) { 11374 $index_scroll.wrapInner( $pinWrap ); 11375 } else { 11376 $('> .row', $section).wrap( $pinWrap ); 11377 } 11378 $section.wrapInner( $pinTrigger ); 11379 } 11380 11381 }); 11382 11383 var $pinWraps = $('.pin-wrap', $el); 11384 11385 var horScrollSizes = function(){ 11386 11387 $pinWraps.each(function(key, val){ 11388 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 11389 $pinTrigger = $pinWrap.closest('.pin-trigger'), 11390 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 11391 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 11392 $boxContainer = $('.box-container'), 11393 box_m = $boxContainer.css('margin-left'), 11394 st_active = true; 11395 11396 var setHorW, 11397 horWidth = function(){ 11398 $index_scroll.each(function(){ 11399 var $this = $(this), 11400 $index_row = $('.index-row', $this), 11401 $rowContainer = $index_row.closest('.vc_row'), 11402 $rowInner = $index_row.closest('.wpb_row'), 11403 $rowParent = $index_row.closest('.row-parent'), 11404 $tmbs = $('.tmb', $index_row), 11405 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 11406 $uncont = $index_row.closest('.uncont'), 11407 $parent_col = $index_row.closest('.wpb_column'), 11408 col_w = $uncont.width(), 11409 data_lg = parseFloat( $index_row.attr('data-lg') ), 11410 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 11411 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 11412 tmb_w; 11413 11414 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 11415 tmb_w = ( col_w + padding_tmb ) / data_lg; 11416 11417 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 11418 tmb_w = ( col_w + padding_tmb ) / data_sm; 11419 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 11420 tmb_w = ( col_w + padding_tmb ) / data_md; 11421 } 11422 11423 if ( !isNaN(tmb_w) ) { 11424 $tmbs.css({ 11425 'width': tmb_w 11426 }); 11427 } 11428 11429 $tmbs.css({ 11430 'visibility': 'visible' 11431 }); 11432 11433 }); 11434 }; 11435 11436 horWidth(); 11437 clearRequestTimeout(setHorW); 11438 setHorW = requestTimeout( function(){ 11439 setItemsRelHeight(); 11440 horWidth(); 11441 }, 100 ); 11442 11443 if ( SiteParameters.is_frontend_editor ) { 11444 return; 11445 } 11446 11447 var $vmenu = $('body.vmenu .vmenu-container'), 11448 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 11449 winWidth = window.innerWidth - vmenuW, 11450 $tmb = $('.tmb', $index_scroll).eq(0), 11451 paddingRight = parseFloat( $tmb.css('padding-right') ), 11452 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 11453 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 11454 scroll_anim; 11455 11456 if ( $('body').hasClass('rtl') ) { 11457 if ( dir === 'left' ) { 11458 scroll_anim = gsap.fromTo( $pinWrap, { 11459 x: stickyScrollLength 11460 },{ 11461 x: 0, 11462 ease: "none" 11463 }); 11464 } else { 11465 scroll_anim = gsap.fromTo( $pinWrap, { 11466 x: 0 11467 },{ 11468 x: stickyScrollLength, 11469 ease: "none" 11470 }); 11471 } 11472 } else { 11473 if ( dir === 'left' ) { 11474 scroll_anim = gsap.fromTo( $pinWrap, { 11475 x: -stickyScrollLength 11476 },{ 11477 x: 0, 11478 ease: "none" 11479 }); 11480 } else { 11481 scroll_anim = gsap.fromTo( $pinWrap, { 11482 x: 0 11483 },{ 11484 x: -stickyScrollLength, 11485 ease: "none" 11486 }); 11487 } 11488 } 11489 11490 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 11491 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 11492 } 11493 11494 var animationIncrease; 11495 11496 var checkForAnimations = function(){ 11497 animationIncrease = 0 11498 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11499 var _this = this; 11500 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 11501 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11502 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11503 requestTimeout(function() { 11504 $(_this).addClass('start_animation'); 11505 }, delayAttr + animationIncrease); 11506 animationIncrease += 150; 11507 } 11508 }); 11509 11510 var batchTime = 0; 11511 11512 var resetBatch = function(){ 11513 batchTime = 0; 11514 } 11515 11516 if (ScrollTrigger.isScrolling()) { 11517 resetBatch(); 11518 } 11519 11520 $('.tmb-mask-reveal', $pinTrigger).each(function(){ 11521 var _this = this, 11522 $this = $(_this), 11523 $inside = $('.t-inside', $this),
11524 delay = parseFloat( $inside.attr('data-delay') ), 11525 speed = parseFloat( $inside.attr('data-speed') ), 11526 easing = $inside.attr('data-easing'), 11527 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 11528 11529 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 11530 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 11531 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 11532 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 11533 11534 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) { 11535 $this.addClass('tmb-mask-init'); 11536 if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) { 11537 gsap.to($('.t-entry-visual-tc', $this), speed, { 11538 clipPath: 'inset(0% 0% 0% 0%)', 11539 delay: delay + batchTime, 11540 ease: easing, 11541 }); 11542 gsap.to($('.t-entry-visual-cont', $this), speed, { 11543 clipPath: 'inset(0% 0% 0% 0%)', 11544 scale: 1, 11545 delay: delay + batchTime + (speed*bgDelay), 11546 ease: easing, 11547 onComplete: resetBatch, 11548 }); 11549 } else { 11550 gsap.to($('.t-entry-visual-cont', $this), speed, { 11551 clipPath: 'inset(0% 0% 0% 0%)', 11552 scale: 1, 11553 delay: delay + batchTime, 11554 ease: easing, 11555 onComplete: resetBatch, 11556 }); 11557 } 11558 batchTime += 0.1; 11559 } 11560 }); 11561 11562 }; 11563 checkForAnimations(); 11564 11565 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 11566 var start = 0; 11567 11568 var horST = ScrollTrigger.create({ 11569 id: "stickySectionScrolling" + key, 11570 scrub: true, 11571 trigger: $pinTrigger[0], 11572 pin: true, 11573 anticipatePin: 1, 11574 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 11575 end: function() { return "+="+stickyScrollLength; }, 11576 animation: scroll_anim, 11577 ease: Sine.easeOut, 11578 onUpdate: checkForAnimations, 11579 invalidateOnRefresh: true, 11580 onEnter: function(){ 11581 $pinTrigger.addClass('enter-st'); 11582 }, 11583 onEnterBack: function(){ 11584 $pinTrigger.addClass('enter-st'); 11585 }, 11586 onLeave: function(){ 11587 $pinTrigger.removeClass('enter-st'); 11588 }, 11589 onLeaveBack: function(){ 11590 $pinTrigger.removeClass('enter-st'); 11591 } 11592 }); 11593 11594 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 11595 window.dispatchEvent(new CustomEvent('boxResized')); 11596 11597 var testSecondTrigger = function(){ 11598 animationIncrease = 0 11599 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11600 var _this = this; 11601 if ( checkVisible(_this) ) { 11602 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11603 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11604 requestTimeout(function() { 11605 $(_this).addClass('start_animation'); 11606 }, delayAttr + animationIncrease); 11607 animationIncrease += 150; 11608 } 11609 }); 11610 11611 }; 11612 11613 var verST = ScrollTrigger.create({ 11614 id: "verticalSectionScrolling" + key, 11615 trigger: $pinTrigger[0], 11616 start: "top center", 11617 end: function() { return "+="+UNCODE.wheight; }, 11618 onUpdate: testSecondTrigger, 11619 invalidateOnRefresh: true 11620 }); 11621 11622 var setCTA, 11623 11624 dis_enable_ST = function(){ 11625 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 11626 horST.kill(); 11627 verST.kill(); 11628 $pinTrigger.addClass('disabled'); 11629 st_active = false; 11630 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 11631 horST.kill(); 11632 verST.kill(); 11633 $pinTrigger.addClass('disabled'); 11634 st_active = false; 11635 } 11636 }; 11637 11638 $(window).on('resize load', function() { 11639 clearRequestTimeout(setCTA); 11640 setCTA = requestTimeout(function() { 11641 dis_enable_ST(); 11642 checkForAnimations(); 11643 }, 500); 11644 }); 11645 11646 }); 11647 }; 11648 11649 $(window).on( 'load', function(){ 11650 horScrollSizes(); 11651 }); 11652 var setResize, 11653 setReLayout, 11654 doubleResize = true; 11655 $(window).on( 'load', function(){ 11656 if ( $('.body-borders .top-border').outerHeight() > 0 ) { 11657 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11658 Array.prototype.forEach.call($row_inners, function(el) { 11659 el.style.height = ''; 11660 el.style.marginBottom = ''; 11661 }); 11662 setItemsRelHeight(); 11663 horScrollSizes(); 11664 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11665 $(document).trigger('uncode-scrolltrigger-refresh'); 11666 } 11667 } 11668 var carousel = document.querySelector(".owl-carousel"), 11669 grid = document.querySelector(".isotope-container"), 11670 stickyAll = document.querySelectorAll(".index-scroll"); 11671 11672 if ( stickyAll.length ) { 11673 var sticky = stickyAll[(stickyAll.length-1)]; 11674 } 11675 11676 if ( typeof sticky !== "undefined" ) { 11677 11678 if ( typeof carousel !== "undefined" && carousel !== null ) { 11679 var carousel_position = sticky.compareDocumentPosition(carousel); 11680 } 11681 if ( typeof grid !== "undefined" && grid !== null ) { 11682 var grid_position = sticky.compareDocumentPosition(grid); 11683 } 11684 11685 if ( carousel_position === 2 || grid_position === 2 ) { 11686 setTimeout(function(){ 11687 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11688 $(document).trigger('uncode-scrolltrigger-refresh'); 11689 } 11690 }, 500); 11691 } 11692 11693 } 11694 11695 }); 11696 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11697 android = /Android/.test(navigator.userAgent) && !window.MSStream; 11698 $(window).on( 'resize orientationchange', function(e){ 11699 if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11700 return; 11701 } 11702 setItemsRelHeight(true); 11703 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11704 Array.prototype.forEach.call($row_inners, function(el) { 11705 el.style.height = ''; 11706 el.style.marginBottom = ''; 11707 }); 11708 clearRequestTimeout(setResize); 11709 setResize = requestTimeout( function(){ 11710 setItemsRelHeight(); 11711 horScrollSizes(); 11712 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11713 $(document).trigger('uncode-scrolltrigger-refresh'); 11714 } 11715 if ( doubleResize === true ) { 11716 window.dispatchEvent(new Event('resize')); 11717 doubleResize = false;
11718 } else { 11719 doubleResize = true; 11720 } 11721 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 11722 }, 100 ); 11723 }); 11724 11725 var show_pins = function(){ 11726 $('.index-scroll').css({'opacity':'1'}); 11727 }; 11728 ScrollTrigger.addEventListener("refresh", show_pins); 11729 $(window).on( 'uncode.re-layout', function(){ 11730 //$('.index-scroll').css({'opacity':'0'}); 11731 $('.pin-spacer').each(function(){ 11732 var space_h = $(this).outerHeight(), 11733 $row = $(this).closest('.row-container'); 11734 $row.css({ 11735 'height': space_h, 11736 'overflow': 'hidden' 11737 }); 11738 }); 11739 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11740 ScrollTrigger.refresh(true); 11741 } 11742 clearRequestTimeout(setReLayout); 11743 setReLayout = requestTimeout( function(){ 11744 $('.row-container').each(function(){ 11745 $(this).css({ 11746 'height': '', 11747 'overflow': '' 11748 }); 11749 }); 11750 }, 1000); 11751 }); 11752 } 11753 11754}; 11755 11756UNCODE.stickyTrigger = function( $el ) { 11757 if ( SiteParameters.is_frontend_editor ) { 11758 return false; 11759 } 11760 11761 var stickyTrigger = function(){ 11762 var stickyTrick = $('.sticky-trigger').each(function(){ 11763 var $sticky = $(this), 11764 $inside = $('> div', $sticky), 11765 insideH = $inside.outerHeight(), 11766 $row = $sticky.closest('.vc_row'), 11767 $uncont = $sticky.closest('.uncont'), 11768 rowBottom, 11769 uncontBottom, 11770 diffBottom; 11771 11772 ScrollTrigger.create({ 11773 trigger: $sticky, 11774 start: function(){ return "top center-=" + insideH/2; }, 11775 endTrigger: $row, 11776 end: function(){ 11777 rowBottom = $row.offset().top + $row.outerHeight(); 11778 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 11779 diffBottom = rowBottom - uncontBottom; 11780 return "bottom center+=" + ( insideH/2 + diffBottom ); 11781 }, 11782 anticipatePin: true, 11783 pin: true, 11784 pinSpacing: false, 11785 scrub: true, 11786 invalidateOnRefresh: true, 11787 }); 11788 11789 }); 11790 }, 11791 setResizeSticky; 11792 11793 $(window).on( 'load', function(){ 11794 stickyTrigger(); 11795 var carousel = document.querySelector(".owl-carousel"), 11796 grid = document.querySelector(".isotope-container"), 11797 stickyAll = document.querySelectorAll(".sticky-trigger"); 11798 11799 if ( stickyAll.length ) { 11800 var sticky = stickyAll[(stickyAll.length-1)]; 11801 } 11802 11803 if ( typeof sticky !== "undefined" ) { 11804 11805 if ( typeof carousel !== "undefined" && carousel !== null ) { 11806 var carousel_position = sticky.compareDocumentPosition(carousel); 11807 } 11808 if ( typeof grid !== "undefined" && grid !== null ) { 11809 var grid_position = sticky.compareDocumentPosition(grid); 11810 } 11811 11812 if ( carousel_position === 2 || grid_position === 2 ) { 11813 setTimeout(function(){ 11814 $(document).trigger('uncode-scrolltrigger-refresh'); 11815 }, 500); 11816 } 11817 11818 } 11819 }); 11820 11821 var oldW = UNCODE.wwidth; 11822 $(window).on( 'resize uncode.re-layout', function(e){ 11823 clearRequestTimeout(setResizeSticky); 11824 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 11825 return; 11826 } else { 11827 oldW = UNCODE.wwidth; 11828 } 11829 setResizeSticky = requestTimeout( function(){ 11830 stickyTrigger(); 11831 $(document).trigger('uncode-scrolltrigger-refresh'); 11832 }, 1000 ); 11833 }); 11834 11835 11836}; 11837 11838UNCODE.areaTextReveal = function() { 11839 if ( ! SiteParameters.is_frontend_editor ) { 11840 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11841 android = /Android/.test(navigator.userAgent) && !window.MSStream, 11842 prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11843 prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11844 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11845 firstObs = true, 11846 isMobileUsing = false;
11847 11848 var observer = new ResizeObserver(function(){ 11849 var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11850 newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11851 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11852 set = false; 11853 if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11854 set = true; 11855 prevW = newW; 11856 } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11857 set = true; 11858 prevH = newH; 11859 } 11860 if ( set || firstObs ) { 11861 window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe')); 11862 firstObs = false; 11863 } 11864 }).observe(document.body); 11865 11866 if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11867 window.scrollTo = function() { 11868 return; 11869 }; 11870 isMobileUsing = true; 11871 11872 $('html, body').css({ 11873 'overscroll-behavior': 'none' 11874 }); 11875 } 11876 11877 var setTriggerObserve; 11878 11879 ScrollTrigger.observe({ 11880 trigger: 'body', 11881 type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
11882 onUp: function() { ScrollTrigger.update(); }, 11883 }); 11884 } 11885 11886 var textReveal = function(){ 11887 11888 if ( SiteParameters.is_frontend_editor ) { 11889 return; 11890 } 11891 11892 var setTxtReveal, 11893 txtTrggrStart = false; 11894 11895 function headingReveal($sel){ 11896 txtTrggrStart = true; 11897 $('.text-reveal', $sel).each(function(val, key){ 11898 var $txtReveal = $(this).attr('data-init-reveal', true), 11899 $trigger = $txtReveal, 11900 $rowParent = $txtReveal.closest('.row-container[data-parent]'), 11901 hReveal = $txtReveal.outerHeight(), 11902 $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'), 11903 $sticky = $txtReveal.closest('.sticky-element'), 11904 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 11905 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 11906 dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')), 11907 $lines = $('.heading-line-wrap', $txtReveal), 11908 $words = $('.split-word-inner', $txtReveal), 11909 $chars = $('.split-char', $txtReveal), 11910 $elToReveal = $words; 11911 11912 if ( $pin.length ) { 11913 return; 11914 } else if ( $sticky.length ) { 11915 hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop); 11916 $trigger = $sticky.parent(); 11917 } 11918 11919 if ( dataReveal === 'chars' ) { 11920 $elToReveal = $chars; 11921 } else if ( dataReveal === 'lines' ) { 11922 $elToReveal = $lines; 11923 } 11924 11925 var tl = gsap.timeline({ 11926 scrollTrigger: { 11927 trigger: $trigger, 11928 start: "top +=" + (window.innerHeight/100*dataTop) + "px", 11929 end: "+=" + hReveal + "px", 11930 id: "txt_reveal_" + key, 11931 scrub: true, 11932 } 11933 }); 11934 gsap.set( 11935 $elToReveal, { 11936 opacity: dataRevealOpacity, 11937 } 11938 ) 11939 tl.fromTo($elToReveal, { 11940 opacity: dataRevealOpacity, 11941 duration: 1, 11942 }, { 11943 opacity: 1, 11944 stagger: 0.05, 11945 duration: 1, 11946 11947 }); 11948 $(window).on('uncode.tl-refresh', function(){ 11949 if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) { 11950 tl.scrollTrigger.refresh(); 11951 } 11952 }); 11953 11954 $rowParent.one( 'uncodeWordLines', function(){ 11955 clearRequestTimeout(setTxtReveal); 11956 setTxtReveal = requestTimeout( function(){ 11957 gsap.set($elToReveal, {clearProps: true}); 11958 tl.kill(true); 11959 if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) { 11960 ScrollTrigger.getById("txt_reveal_" + key).kill(true); 11961 } 11962 headingReveal($sel) 11963 }, 100); 11964 }); 11965 11966 }); 11967 }; 11968 11969 window.addEventListener("load", function (e) { 11970 if (!txtTrggrStart) { 11971 headingReveal($("body")); 11972 $(window).trigger("resize"); 11973 } 11974 }); 11975 11976 $('.row-container[data-parent]').each(function(){ 11977 if (!txtTrggrStart) { 11978 var $this = $(this); 11979 $this.on('uncodeWordLines', function(){ 11980 headingReveal($this); 11981 }); 11982 } 11983 }); 11984 11985 $(window).on('uncode-sticky-trigger-observe', function(e){ 11986 clearRequestTimeout(setTriggerObserve); 11987 setTriggerObserve = requestTimeout( function(){ 11988 $(window).trigger('uncode.tl-refresh'); 11989 }, 2000 ); 11990 }); 11991 11992 }; 11993 textReveal(); 11994 11995 var areaReveal = function(){ 11996 if ( SiteParameters.is_frontend_editor ) { 11997 return; 11998 } 11999
12000 $('.scroll-trigger-el').each(function(){ 12001 var $scrollTrgrEl = $(this), 12002 $row = $('> .row', $scrollTrgrEl), 12003 $row_in = $('> .row-inner', $row), 12004 cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length, 12005 stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows', 12006 animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes', 12007 stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false, 12008 $animateTrgrEl = $scrollTrgrEl, 12009 noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes', 12010 noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'), 12011 els = $scrollTrgrEl.attr('data-anim-els'), 12012 sticky = $scrollTrgrEl.attr('data-anim-sticky'), 12013 noSpace = $scrollTrgrEl.attr('data-anim-no-space'), 12014 state = $scrollTrgrEl.attr('data-anim-state'), 12015 target = $scrollTrgrEl.attr('data-anim-target'), 12016 origin = $scrollTrgrEl.attr('data-anim-origin'), 12017 mask = $scrollTrgrEl.attr('data-anim-mask'), 12018 _scale = $scrollTrgrEl.attr('data-anim-scale'), 12019 stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes', 12020 opacity = $scrollTrgrEl.attr('data-anim-opacity'), 12021 radius = $scrollTrgrEl.attr('data-anim-radius'), 12022 radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'), 12023 clip_path = $scrollTrgrEl.attr('data-clip-path'), 12024 animation_x = $scrollTrgrEl.attr('data-anim-x'), 12025 animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'), 12026 animation_y = $scrollTrgrEl.attr('data-anim-y'), 12027 blur = $scrollTrgrEl.attr('data-anim-blur'), 12028 perspective = $scrollTrgrEl.attr('data-anim-perspective'), 12029 rotate = $scrollTrgrEl.attr('data-anim-rotate'), 12030 rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'), 12031 topBottom = $scrollTrgrEl.attr('data-anim-start'), 12032 offTop = $scrollTrgrEl.attr('data-anim-top'), 12033 offBottom = $scrollTrgrEl.attr('data-anim-bottom'), 12034 safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0, 12035 animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'), 12036 easeOut = $scrollTrgrEl.attr('data-anim-ease'), 12037 offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'), 12038 stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards, 12039 $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(), 12040 setTxtReveal, 12041 txtTrggrStart = false, 12042 alreadyareaAnimateScrollTl = false; 12043 12044 _scale = _scale === '' ? 0 : parseFloat( _scale ); 12045 perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001; 12046 offTop = offTop === '' ? 0 : parseFloat( offTop ); 12047 offBottom = offBottom === '' ? 0 : parseFloat( offBottom ); 12048 offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard ); 12049 12050 function areaAnimateScrollTl($el, id, last) { 12051 alreadyareaAnimateScrollTl = true; 12052 12053 var pTop = parseFloat( $row.css('padding-top') ), 12054 innerGap = pTop + offSetCard * id, 12055 scale = _scale; 12056 12057 if ( isMobileUsing ) { 12058 innerGap = 0; 12059 } 12060 12061 if ( stepScale ) { 12062 if ( _scale < 100 ) { 12063 scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) ); 12064 } 12065 } 12066 12067 if ( els === 'content' ) { 12068 $animateTrgrEl = $('> .row', $scrollTrgrEl); 12069 } else if ( els === 'bg' ) { 12070 $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl); 12071 } else { 12072 $animateTrgrEl = $el; 12073 } 12074 12075 if ( rotate_alt === 'yes') { 12076 rotate *= -1; 12077 perspective *= -1; 12078 } 12079 12080 if ( animation_x_alt === 'yes') { 12081 animation_x *= -1; 12082 } 12083 12084 var $parentDiv = $el.closest('div[data-sticky]'); 12085 12086 var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px"; 12087 12088 var scrllTrggr = { 12089 trigger: $parentDiv, 12090 end: function(){ 12091 return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom))) 12092 }, 12093 start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12094 pin: sticky === 'yes' || stickyCards ? true : false, 12095 pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0), 12096 scrub: true, 12097 id: 'sticky_' + id, 12098 anticipatePin: 1, 12099 invalidateOnRefresh: true, 12100 // markers: { 12101 // indent: 150 * id 12102 // }, 12103 onToggle: function(){ 12104 $scrollTrgrEl.attr('data-revealed', true); 12105 }, 12106 }; 12107 12108 if ( !stickyLast && state === 'end' ) { 12109 last = false; 12110 } 12111 12112 if ( stickyCards ) { 12113 if ( state !== 'end' ) { 12114 if ( animation_rows_start === 'center' ) { 12115 scrllTrggr.start = "center center"; 12116 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight); 12117 } else if ( animation_rows_start === 'bottom' ) { 12118 if ( stickyOpts !== 'no' ) { 12119 scrllTrggr.start = "bottom bottom"; 12120 scrllTrggr.end = "bottom bottom"; 12121 } 12122 } else { 12123 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2); 12124 } 12125 if ( stickyOpts === 'no' ) { 12126 scrllTrggr.endTrigger = $el; 12127 scrllTrggr.end = "+=100%"; 12128 } else { 12129 scrllTrggr.endTrigger = $row; 12130 } 12131 } else { 12132 if ( animation_rows_start === 'center' ) { 12133 scrllTrggr.start = "center center"; 12134 } else if ( animation_rows_start === 'bottom' ) { 12135 scrllTrggr.start = "bottom bottom"; 12136 } 12137 if ( stickyOpts !== 'no' ) { 12138 scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1)); 12139 scrllTrggr.endTrigger = $lastEl; 12140 } else { 12141 scrllTrggr.end = "bottom bottom"; 12142 } 12143 } 12144 } 12145 12146 var tl = gsap.timeline({ 12147 scrollTrigger: scrllTrggr 12148 }); 12149 12150 // var mark = last ? { 12151 // startColor:"blue", 12152 // endColor:"orange", 12153 // } : false; 12154 12155 if ( !stickyCards ) { 12156 var tlConds = tl; 12157 } else { 12158 var scrllTrggrConds = { 12159 trigger: $parentDiv, 12160 end: function(){ 12161 return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom))) 12162 }, 12163 pin: (state === 'end' && last), 12164 pinSpacing: false, 12165 scrub: true, 12166 id: 'card_' + id, 12167 invalidateOnRefresh: true, 12168 // markers: true, 12169 }; 12170 if ( stickyCards ) { 12171 if ( state !== 'end' ) { 12172 if ( stickyOpts === '' ) { 12173 scrllTrggrConds.end = "bottom bottom-=100%"; 12174 scrllTrggrConds.endTrigger = $row_in; 12175 } 12176 12177 if ( animation_rows_start === 'bottom' ) { 12178 if ( stickyOpts !== 'no') { 12179 scrllTrggrConds.start = "top top+=" + window.innerHeight; 12180 scrllTrggrConds.end = "bottom bottom"; 12181 } 12182 } else if ( animation_rows_start === 'center' ) { 12183 scrllTrggrConds.start = "center center"; 12184 } else { 12185 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12186 } 12187 12188 } else { 12189 if ( stickyOpts === '' ) { 12190 if ( animLast ) { 12191 scrllTrggrConds.end = "bottom bottom-=100%"; 12192 } else { 12193 scrllTrggrConds.end = "bottom bottom"; 12194 } 12195 scrllTrggrConds.endTrigger = $lastEl; 12196 } 12197 12198 if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) { 12199 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12200 scrllTrggrConds.start = "bottom bottom"; 12201 } else { 12202 scrllTrggrConds.start = "top top+=" + $el.outerHeight(); 12203 } 12204 } else if ( animation_rows_start === 'center' ) { 12205 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12206 scrllTrggrConds.start = "center center"; 12207 } else { 12208 scrllTrggrConds.start = "top+=" + ($el.outerHeight()/2) + " top+="
12208+ window.innerHeight/2; 12209 } 12210 } else { 12211 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12212 scrllTrggrConds.start = "top top"; 12213 } else { 12214 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12215 } 12216 } 12217 12218 } 12219 12220 } else { 12221 scrllTrggrConds.start = start_topBottom; 12222 } 12223 12224 var tlConds = gsap.timeline({ 12225 scrollTrigger: scrllTrggrConds 12226 }); 12227 } 12228 12229 if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) { 12230 if ( target === 'mask' ) { 12231 if ( state !== 'end' ) { 12232 if ( mask === 'auto' ) { 12233 gsap.set( 12234 $animateTrgrEl, { 12235 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12236 opacity: parseFloat(opacity)/100, 12237 filter: 'blur(' + blur + 'px)', 12238 visibility: 'visible', 12239 } 12240 ) 12241 tlConds.fromTo($animateTrgrEl, { 12242 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12243 opacity: parseFloat(opacity)/100, 12244 filter: 'blur(' + blur + 'px)', 12245 duration: 1, 12246 }, { 12247 opacity: 1, 12248 clipPath: 'inset(0% 0px round 0' + radiu
12248s_unit + ')', 12249 filter: 'blur(0px)', 12250 duration: 1, 12251 ease: easeOut, 12252 //delay: 0.1 12253 }); 12254 } else { 12255 tlConds.fromTo($animateTrgrEl, { 12256 opacity: parseFloat(opacity)/100, 12257 clipPath: clip_path, 12258 filter: 'blur(' + blur + 'px)', 12259 duration: 1, 12260 }, { 12261 opacity: 1, 12262 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12263 filter: 'blur(0px)', 12264 duration: 1, 12265 ease: easeOut, 12266 //delay: 0.1 12267 }); 12268 } 12269 } else { 12270 if ( mask === 'auto' ) { 12271 tlConds.fromTo($animateTrgrEl, { 12272 opacity: 1, 12273 clipPath: 'inset(0% 0px round 0' + radiu
12273s_unit + ')', 12274 filter: 'blur(0px)', 12275 duration: 1, 12276 },{ 12277 opacity: parseFloat(opacity)/100, 12278 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12279 filter: 'blur(' + blur + 'px)', 12280 ease: easeOut, 12281 duration: 1, 12282 //delay: 0.1 12283 }); 12284 } else { 12285 tlConds.fromTo($animateTrgrEl, { 12286 opacity: 1, 12287 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12288 filter: 'blur(0px)', 12289 duration: 1, 12290 },{ 12291 opacity: parseFloat(opacity)/100, 12292 clipPath: clip_path, 12293 filter: 'blur(' + blur + 'px)', 12294 duration: 1, 12295 ease: easeOut, 12296 //delay: 0.1 12297 }); 12298 } 12299 } 12300 } else { 12301 if ( state !== 'end' ) { 12302 if ( scale === 'auto' ) { 12303 if ( radius ) { 12304 gsap.set( 12305 $animateTrgrEl, { 12306 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12307 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12308 x: animation_x + 'vw', 12309 y: animation_y + 'vh', 12310 filter: 'blur(' + blur + 'px)', 12311 rotation: rotate, 12312 rotationX: rotate == 0 ? perspective : 0, 12313 transformPerspective: '100vw', 12314 opacity: parseFloat(opacity)/100, 12315 transformOrigin: origin, 12316 borderRadius: radius + radius_unit, 12317 visibility: 'visible', 12318 } 12319 ) 12320 tlConds.fromTo($animateTrgrEl, { 12321 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12322 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12323 x: animation_x + 'vw', 12324 y: animation_y + 'vh', 12325 filter: 'blur(' + blur + 'px)', 12326 rotation: rotate, 12327 rotationX: rotate == 0 ? perspective : 0, 12328 transformPerspective: '100vw', 12329 opacity: parseFloat(opacity)/100, 12330 borderRadius: radius + radius_unit, 12331 transformOrigin: origin, 12332 duration: 1, 12333 }, { 12334 scaleX: 1, 12335 scaleY: 1, 12336 x: 0, 12337 y: 0, 12338 filter: 'blur(0px)', 12339 rotation: 0, 12340 rotationX: 0, 12341 opacity: 1, 12342 borderRadius: 0 + radius_unit, 12343 transformOrigin: origin, 12344 duration: 1, 12345 ease: easeOut, 12346 //delay: 0.1 12347 }); 12348 } else { 12349 gsap.set( 12350 $animateTrgrEl, { 12351 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12352 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12353 x: animation_x + 'vw', 12354 y: animation_y + 'vh', 12355 filter: 'blur(' + blur + 'px)', 12356 rotation: rotate, 12357 rotationX: rotate == 0 ? perspective : 0, 12358 transformPerspective: '100vw', 12359 opacity: parseFloat(opacity)/100, 12360 transformOrigin: origin, 12361 visibility: 'visible', 12362 } 12363 ) 12364 tlConds.fromTo($animateTrgrEl, { 12365 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12366 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12367 x: animation_x + 'vw', 12368 y: animation_y + 'vh', 12369 filter: 'blur(' + blur + 'px)', 12370 rotation: rotate, 12371 rotationX: rotate == 0 ? perspective : 0, 12372 transformPerspective: '100vw', 12373 opacity: parseFloat(opacity)/100, 12374 transformOrigin: origin, 12375 duration: 1, 12376 }, { 12377 scaleX: 1, 12378 scaleY: 1, 12379 x: 0, 12380 y: 0, 12381 filter: 'blur(0px)', 12382 rotation: 0, 12383 rotationX: 0, 12384 opacity: 1, 12385 transformOrigin: origin, 12386 duration: 1, 12387 ease: easeOut, 12388 //delay: 0.1 12389 }); 12390 } 12391 } else {
12392 if ( radius ) { 12393 gsap.set( 12394 $animateTrgrEl, { 12395 scaleX: parseFloat( scale ) / 100, 12396 scaleY: parseFloat( scale ) / 100, 12397 opacity: parseFloat(opacity)/100, 12398 x: animation_x + 'vw', 12399 y: animation_y + 'vh', 12400 filter: 'blur(' + blur + 'px)', 12401 rotation: rotate, 12402 rotationX: rotate == 0 ? perspective : 0, 12403 transformPerspective: '100vw', 12404 transformOrigin: origin, 12405 borderRadius: radius + radius_unit, 12406 visibility: 'visible', 12407 } 12408 ) 12409 tlConds.fromTo($animateTrgrEl, { 12410 scaleX: parseFloat( scale ) / 100, 12411 scaleY: parseFloat( scale ) / 100, 12412 opacity: parseFloat(opacity)/100, 12413 x: animation_x + 'vw', 12414 y: animation_y + 'vh', 12415 filter: 'blur(' + blur + 'px)', 12416 rotation: rotate, 12417 rotationX: rotate == 0 ? perspective : 0, 12418 transformPerspective: '100vw', 12419 borderRadius: radius + radius_unit, 12420 transformOrigin: origin, 12421 duration: 1, 12422 }, { 12423 scaleX: 1, 12424 scaleY: 1, 12425 opacity: 1, 12426 x: 0, 12427 y: 0, 12428 filter: 'blur(0px)', 12429 rotation: 0, 12430 rotationX: 0, 12431 transformOrigin: origin, 12432 ease: easeOut, 12433 duration: 1, 12434 borderRadius: 0 + radius_unit, 12435 //delay: 0.1 12436 }); 12437 } else { 12438 gsap.set( 12439 $animateTrgrEl, { 12440 scaleX: parseFloat( scale ) / 100, 12441 scaleY: parseFloat( scale ) / 100, 12442 opacity: parseFloat(opacity)/100, 12443 x: animation_x + 'vw', 12444 y: animation_y + 'vh', 12445 filter: 'blur(' + blur + 'px)', 12446 rotation: rotate, 12447 rotationX: rotate == 0 ? perspective : 0, 12448 transformPerspective: '100vw', 12449 transformOrigin: origin, 12450 visibility: 'visible', 12451 } 12452 ) 12453 tlConds.fromTo($animateTrgrEl, { 12454 scaleX: parseFloat( scale ) / 100, 12455 scaleY: parseFloat( scale ) / 100, 12456 opacity: parseFloat(opacity)/100, 12457 x: animation_x + 'vw', 12458 y: animation_y + 'vh', 12459 filter: 'blur(' + blur + 'px)', 12460 rotation: rotate, 12461 rotationX: rotate == 0 ? perspective : 0, 12462 transformPerspective: '100vw', 12463 transformOrigin: origin, 12464 duration: 1, 12465 }, { 12466 scaleX: 1, 12467 scaleY: 1, 12468 opacity: 1, 12469 x: 0, 12470 y: 0, 12471 filter: 'blur(0px)', 12472 rotation: 0, 12473 rotationX: 0, 12474 transformOrigin: origin, 12475 duration: 1, 12476 ease: easeOut, 12477 //delay: 0.1 12478 }); 12479 } 12480 } 12481 } else { 12482 if ( scale === 'auto' ) { 12483 tlConds.fromTo($animateTrgrEl, { 12484 scaleX: 1, 12485 scaleY: 1, 12486 opacity: 1, 12487 x: 0, 12488 y: 0, 12489 filter: 'blur(0px)', 12490 rotation: 0, 12491 rotationX: 0, 12492 transformOrigin: origin, 12493 duration: 1, 12494 }, { 12495 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12496 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12497 opacity: parseFloat(opacity)/100, 12498 x: animation_x + 'vw', 12499 y: animation_y + 'vh', 12500 filter: 'blur(' + blur + 'px)', 12501 rotation: rotate, 12502 rotationX: rotate == 0 ? perspective : 0, 12503 transformPerspective: '100vw', 12504 transformOrigin: origin, 12505 duration: 1, 12506 ease: easeOut, 12507 //delay: 0.1 12508 }) 12509 } else { 12510 tlConds.fromTo($animateTrgrEl, { 12511 scaleX: 1, 12512 scaleY: 1, 12513 opacity: 1, 12514 x: 0, 12515 y: 0, 12516 filter: 'blur(0px)', 12517 rotation: 0, 12518 rotationX: 0, 12519 transformPerspective: '100vw', 12520 transformOrigin: origin, 12521 borderRadius: 0 + radius_unit, 12522 duration: 1, 12523 }, { 12524 scaleX: parseFloat( scale ) / 100, 12525 scaleY: parseFloat( scale ) / 100, 12526 opacity: parseFloat(opacity)/100, 12527 x: animation_x + 'vw', 12528 y: animation_y + 'vh', 12529 filter: 'blur(' + blur + 'px)', 12530 rotation: rotate, 12531 rotationX: rotate == 0 ? perspective : 0, 12532 transformPerspective: '100vw', 12533 transformOrigin: origin, 12534 borderRadius: radius + radius_unit, 12535 duration: 1, 12536 ease: easeOut, 12537 //delay: 0.1 12538 }) 12539 } 12540 } 12541 } 12542 } 12543 12544 function headingReveal($el){ 12545 txtTrggrStart = true; 12546 $('.text-reveal', $el).each(function(_key, _val){ 12547 var $txtReveal = $(_val), 12548 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 12549 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 12550 $lines = $('.heading-line-wrap', $txtReveal), 12551 $words = $('.split-word-inner', $txtReveal), 12552 $chars = $('.split-char', $txtReveal), 12553 _setTxtReveal, 12554 $elToReveal = $words; 12555 12556 if ( !(sticky === 'yes' || stickyCards) ) { 12557 return; 12558 } 12559 12560 easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut; 12561 12562 if ( dataReveal === 'chars' ) { 12563 $elToReveal = $chars; 12564 } else if ( dataReveal === 'lines' ) { 12565 $elToReveal = $lines; 12566 } 12567 12568 var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr; 12569 scrllTrggrTxt.id = "txt_reveal_" + _key;
12570 scrllTrggrTxt.pin = false; 12571 12572 gsap.set($elToReveal, {opacity: dataRevealOpacity}); 12573 var _tl = gsap.timeline({ 12574 scrollTrigger: scrllTrggrTxt 12575 }); 12576 _tl.fromTo($elToReveal, { 12577 opacity: dataRevealOpacity, 12578 }, { 12579 opacity: 1, 12580 stagger: 0.05 12581 }); 12582 12583 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12584 clearRequestTimeout(_setTxtReveal); 12585 _setTxtReveal = requestTimeout( function(){ 12586 gsap.set($elToReveal, {clearProps: true}); 12587 _tl.kill(true); 12588 if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) { 12589 ScrollTrigger.getById("txt_reveal_" + _key).kill(true); 12590 } 12591 headingReveal($el) 12592 }, 100); 12593 }); 12594 12595 }); 12596 }; 12597 12598 if (!txtTrggrStart) { 12599 headingReveal($el); 12600 } 12601 12602 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12603 if (!txtTrggrStart) { 12604 headingReveal($el); 12605 } 12606 }); 12607 12608 var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 12609 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12610 var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 12611 document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12612 12613 $(window).on('uncode-sticky-trigger-observe', function(e){ 12614 var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12615 var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12616 $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false}); 12617 //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style'); 12618 $('.tmb', $scrollTrgrEl).removeAttr('style'); 12619 var scrollnow = document.body.scrollTop || document.documentElement.scrollTop; 12620 clearRequestTimeout(setTxtReveal); 12621 setTxtReveal = requestTimeout( function(){ 12622 $(document).trigger('uncode-scrolltrigger-refresh'); 12623 if ( isMobileUsing ) { 12624 if ( typeof tl !== 'undefined' ) { 12625 tl.scrollTrigger.refresh(); 12626 } 12627 if ( typeof tlConds !== 'undefined' ) { 12628 tlConds.scrollTrigger.refresh(); 12629 } 12630 $(window).trigger('scroll'); 12631 _width = __width; 12632 } else if ( _width !== __width && ( isMobileUsing ) ) { 12633 window.dispatchEvent(new CustomEvent('vc-resize')); 12634 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 12635 window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){ 12636 if ( typeof tl !== 'undefined' ) { 12637 tl.scrollTrigger.refresh(); 12638 } 12639 if ( typeof tlConds !== 'undefined' ) { 12640 tlConds.scrollTrigger.refresh(); 12641 } 12642 window.lenis.scrollTo(scrollnow, {duration: 0.01}); 12643 }}); 12644 } else { 12645 if ( typeof tl !== 'undefined' ) { 12646 tl.scrollTrigger.refresh(); 12647 } 12648 if ( typeof tlConds !== 'undefined' ) { 12649 tlConds.scrollTrigger.refresh(); 12650 } 12651 $(window).trigger('scroll'); 12652 } 12653 _height = __height; 12654 } 12655 }, 500); 12656 }); 12657 12658 12659 $(window).on('load ', function(e){ 12660 var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12661 if ( _height !== ___height ) { 12662 $scrollTrgrEl.attr('data-toggled', true); 12663 $(window).trigger('resize'); 12664 if ( typeof tl !== 'undefined' ) { 12665 tl.scrollTrigger.refresh(); 12666 } 12667 if ( typeof tlConds !== 'undefined' ) { 12668 tlConds.scrollTrigger.refresh(); 12669 } 12670 _height = ___height; 12671 } 12672 12673 12674 12675 $(document).trigger('uncode-scrolltrigger-refresh'); 12676 12677 }); 12678 12679 }; 12680 12681 var callAreaAnimateScrollTl = function() { 12682 if ( stickyCards ) { 12683 $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){ 12684 if ( key+1 < cardL || animLast || state !== 'end' ) { 12685 var $this = $(val), 12686 last = key+1===cardL; 12687 areaAnimateScrollTl($this, key, last); 12688 } 12689 }); 12690 } else {
12691 areaAnimateScrollTl($scrollTrgrEl, 0, false); 12692 } 12693 }; 12694 12695 $(window).on('wwResize', function(){ 12696 if ( !alreadyareaAnimateScrollTl ) { 12697 if ( noMobile ) { 12698 if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) { 12699 return; 12700 } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12701 return; 12702 } 12703 } 12704 12705 callAreaAnimateScrollTl(); 12706 } 12707 }) 12708 12709 if ( noMobile ) { 12710 if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) { 12711 return; 12712 } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12713 return; 12714 } 12715 } 12716 12717 callAreaAnimateScrollTl(); 12718 12719 }); 12720 12721 }; 12722 12723 areaReveal(); 12724 12725}; 12726 12727UNCODE.thumbsReveal = function() { 12728 var revealThumbs = function( $el ){ 12729 if ( typeof $el === 'undefined' || $el === null || !$el.length ) { 12730 $el = $('body'); 12731 } 12732 $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){ 12733 var $container = $(this), 12734 $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container), 12735 isContainer = false; 12736 12737 if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) { 12738 $stickys.each(function(){ 12739 var $sticky = $(this).addClass('tmb-mask-init'), 12740 $inside = $('.t-inside', $sticky), 12741 $media = $('img, video, .fluid-object', $sticky), 12742 val = parseFloat( $inside.attr('data-scroll-val') ); 12743 12744 val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val; 12745 12746 if ( $sticky.hasClass('tmb-mask-scroll') ) { 12747 12748 var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both')) 12749 ? val*0.05 : 0; 12750 var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) 12751 ? val*4 : 0; 12752 var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0; 12753 12754 var tl = gsap.timeline({ 12755 scrollTrigger: { 12756 trigger: $sticky, 12757 scrub: true, 12758 } 12759 }); 12760 12761 tl.fromTo($media, { 12762 yPercent: -(parax), 12763 scale: 1 + zoom + extra, 12764 }, { 12765 yPercent: parax, 12766 scale: 1 + extra, 12767 ease: "none", 12768 }); 12769 } 12770 }); 12771 } 12772 12773 if ( $container.has('.tmb-mask-reveal') ) { 12774 var $markTrigger = ".tmb-mask-reveal .t-entry-visual", 12775 staggerTime = 0.1; 12776 12777 $('.t-inside', $container).each(function(){ 12778 var checkEasing = $(this).attr('data-easing'); 12779 if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') { 12780 gsap.registerPlugin(CustomEase); 12781 return false; 12782 } 12783 }); 12784 12785 if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) { 12786 $markTrigger = $container; 12787 isContainer = true; 12788 staggerTime = 0; 12789 } 12790 12791 ScrollTrigger.batch( $markTrigger, { 12792 start: function( el ){ 12793 /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) { 12794 return "bottom bottom"; 12795 } else {*/ 12796 return "top 96%"; 12797 //} 12798 }, 12799 onEnter: function(batch){ 12800 var $inside = $(batch).closest('.t-inside'); 12801 12802 if ( isContainer ) { 12803 var $inside = $(batch).find('.t-inside').first(); 12804 } 12805
12806 var delay = parseFloat( $inside.attr('data-delay') ), 12807 speed = parseFloat( $inside.attr('data-speed') ), 12808 easing = $inside.attr('data-easing'), 12809 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 12810 12811 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 12812 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 12813 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 12814 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 12815 12816 if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) { 12817 gsap.to($('.t-entry-visual-tc', batch), speed, { 12818 clipPath: 'inset(0% 0% 0% 0%)', 12819 stagger: staggerTime, 12820 delay: delay, 12821 ease: easing, 12822 }); 12823 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12824 clipPath: 'inset(0% 0% 0% 0%)', 12825 stagger: staggerTime, 12826 scale: 1, 12827 delay: delay + (speed*bgDelay), 12828 ease: easing, 12829 }); 12830 } else { 12831 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12832 clipPath: 'inset(0% 0% 0% 0%)', 12833 stagger: staggerTime, 12834 scale: 1, 12835 delay: delay, 12836 ease: easing, 12837 }); 12838 } 12839 12840 } 12841 }); 12842 } 12843 12844 }); 12845 12846 }; 12847 $(window).on( 'load more-items-loaded', function(){ 12848 revealThumbs(); 12849 }); 12850 12851 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 12852 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 12853 var $el = model.view.$el, 12854 shortcode = model.attributes.shortcode; 12855 12856 if ( $el.is('.custom-grid-container') ) { 12857 $el = $el.parent(); 12858 } 12859 12860 if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') { 12861 revealThumbs($el); 12862 } 12863 }); 12864 } 12865 12866}; 12867 12868UNCODE.revslider = function() { 12869 var revSliderIn = function(){ 12870 $('rs-module').each(function(){ 12871 var $slider = $(this); 12872 12873 $slider.on('revolution.slide.onloaded', function(e, data){ 12874 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12875 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 12876 scrolltop = $(document).scrollTop(); 12877 if ( style != undefined ) { 12878 UNCODE.switchColorsMenu(scrolltop, style); 12879 } 12880 } 12881 }); 12882 12883 $slider.on('revolution.slide.onchange', function(e, data){ 12884 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12885 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 12886 scrolltop = $(document).scrollTop(); 12887 if ( style != undefined ) { 12888 UNCODE.switchColorsMenu(scrolltop, style); 12889 } 12890 } 12891 }); 12892 12893 }); 12894 }; 12895 revSliderIn(); 12896 $(window).on("load", revSliderIn ); 12897}; 12898UNCODE.layerslider = function() { 12899 $(window).on("load", function() { 12900 12901 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 12902 12903 var slideData = slider.slides.current.data, 12904 scrolltop = $(document).scrollTop(); 12905 if( slideData && slideData.skin ) { 12906 12907 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 12908 12909 } 12910 }); 12911 12912 }); 12913}; 12914 12915UNCODE.ajax_filters = function () { 12916 var isAjaxing = false;
12917 12918/************************* 12919 * 12920 * Filters Menu and Widgets Area 12921 * 12922 ************************/ 12923 12924 var clear_clicked = false; 12925 12926 var init_ajax_grid = function(){ 12927 12928 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 12929 $grids.each(function(index, val){ 12930 var $body = $('body'), 12931 $grid = $(val).addClass('init-ajax-grid'), 12932 starting_point = $grid.attr('data-toggle'), 12933 $trigger = $('.uncode-toggle-ajax-filters', $grid), 12934 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 12935 $isotope_wrapper = $('.isotope-wrapper', $grid), 12936 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 12937 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 12938 $footprint = $('.ajax-filter-footprint', $grid), 12939 sidebar_w, 12940 data_w = parseFloat( $sidebar.attr('data-max-width') ), 12941 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 12942 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 12943 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 12944 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 12945 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 12946 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 12947 sidew, 12948 $inside_row = $('> .row-parent', $vc_row), 12949 bg_row, 12950 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 12951 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 12952 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer), 12953 sidebar_overlay = false, 12954 sidebar_hover = false, 12955 switchMobile = false, 12956 scrollTop; 12957 12958 if ( $vc_row.attr('class') ) { 12959 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 12960 } 12961 12962 if ( bg_row != null ) { 12963 $side_header.add($side_footer).addClass(bg_row[0]); 12964 } 12965 12966 $trigger.add($apply_filters).on('click', function(e){ 12967 e.preventDefault(); 12968 e.stopPropagation(); 12969 $grid = $('.ajax-grid-system').eq(0); 12970 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 12971 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 12972 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 12973 sidebar_w = $sidebar_wrapper.width(); 12974 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 12975 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 12976 $(this).trigger('uncode-ajax-clear-filters'); 12977 } 12978 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 12979 $grid.toggleClass('ajax-hide-filters-blanks'); 12980 $sidebar.slideToggle({ 12981 duration: 400, 12982 easing: 'easeOutQuad', 12983 }); 12984 } else { 12985 $grid.removeClass('ajax-hide-filters-blanks'); 12986 $grid.toggleClass('ajax-hide-filters'); 12987 if ( $grid.hasClass('ajax-hide-filters') ) { 12988 $body.addClass('ajax-hide-filters'); 12989 } else { 12990 scrollTop = $('html, body').scrollTop(); 12991 $body.removeClass('ajax-hide-filters'); 12992 } 12993 } 12994 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 12995 $('html, body').scrollTop(scrollTop); 12996 } 12997 return false; 12998 }); 12999 13000 $close_btn.on('click', function(e){ 13001 e.preventDefault(); 13002 $grid = $('.ajax-grid-system').eq(0); 13003 $grid.addClass('ajax-hide-filters'); 13004 if ( $grid.hasClass('ajax-hide-filters') ) { 13005 $body.addClass('ajax-hide-filters'); 13006 } else { 13007 scrollTop = $('html, body').scrollTop(); 13008 $body.removeClass('ajax-hide-filters'); 13009 } 13010 $('html, body').scrollTop(scrollTop); 13011 }); 13012 13013 $sidebar_wrapper.on('mouseover',function(){ 13014 sidebar_hover = true; 13015 }).on('mouseout', function(){ 13016 sidebar_hover = false; 13017 }); 13018 13019 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 13020 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 13021 return; 13022 } 13023 if (undefined !== from && from === 'select_active_attributes') { 13024 return; 13025 } 13026 if ($(e.target).closest('.select2-container--open').length ) { 13027 return; 13028 } 13029 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 13030 $grid.add($body).addClass('ajax-hide-filters'); 13031 } 13032 }); 13033 13034 $sorting_trgr.on('click', function(e) { 13035 e.preventDefault(); 13036 }); 13037 13038 var inside_width = function(){ 13039 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13040 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13041 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13042 $inside_row = $('> .row-parent', $vc_row); 13043 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 13044 sidew = $sidebar.width(); 13045 $inside_row.css({ 13046 width: sidew 13047 }); 13048 } else { 13049 $inside_row.css({ 13050 width: '' 13051 }); 13052 } 13053 }; 13054 inside_width(); 13055 13056 var ajax_sidebar_position = function(e, f_editor){ 13057 $grid = $('.ajax-grid-system').eq(0); 13058 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13059 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 13060 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13061 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13062 $inside_row = $('> .row-parent', $vc_row); 13063 scrollTop = $('html, body').scrollTop(); 13064 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 13065 $grid.add($body).addClass('ajax-hide-filters'); 13066 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 13067 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13068 sidebar_overlay = true; 13069 $body.addClass('ajax-filter-sidebar-overlay'); 13070 $sidebar_wrapper.addClass(skin); 13071 var sideHeadH = $side_header.outerHeight(), 13072 sideFooterH = $side_footer.outerHeight(); 13073 if ( data_w !== '' && data_w > 0 ) { 13074 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 13075 $sidebar.css({ 13076 'max-width': data_w 13077 }); 13078 } else { 13079 $sidebar.css({ 13080 'max-width':'none' 13081 }); 13082 } 13083 } 13084 $vc_row.css({ 13085 'padding-top':sideHeadH, 13086 'padding-bottom':sideFooterH 13087 }); 13088 var sidew = $sidebar.width(); 13089 $inside_row.css({ 13090 width: sidew 13091 }); 13092 switchMobile = true; 13093 } else { 13094 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 13095 scrollTop = $('html, body').scrollTop(); 13096 $grid.add($body).removeClass('ajax-hide-filters'); 13097 } 13098 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 13099 $grid.addClass('ajax-hide-filters-blanks'); 13100 $sidebar.hide(); 13101 } 13102 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 13103 $('.ajax-sidebar-placeholder', $grid).remove(); 13104 sidebar_overlay = false; 13105 $body.removeClass('ajax-filter-sidebar-overlay'); 13106 $sidebar_wrapper.removeClass(skin); 13107 if ( data_w !== '' && data_w > 0 ) { 13108 $sidebar.css({ 13109 'max-width':'none' 13110 }); 13111 } 13112 $vc_row.css({ 13113 'padding-top':0, 13114 'padding-bottom':0, 13115 }); 13116 13117 $inside_row.css({ 13118 width: '' 13119 }); 13120 13121 if ( f_editor === true ) { 13122 UNCODE.ajax_filters(); 13123 } 13124 13125 switchMobile = false; 13126 } 13127 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 13128 $('html, body').scrollTop(scrollTop); 13129 } 13130 }; 13131 13132 var sidebar_width = function(){ 13133 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 13134 sidebar_w = $footprint.width(); 13135 $sidebar.css({ width: sidebar_w }); 13136 } else { 13137 $sidebar.css({ width: '' }); 13138 } 13139 }; 13140 sidebar_width(); 13141 13142 if ( SiteParameters.is_frontend_editor ) { 13143 ajax_sidebar_position(); 13144 } 13145 13146 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 13147 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 13148 ajax_sidebar_position(e); 13149 } 13150 sidebar_width(); 13151 }); 13152 13153 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 13154 ajax_sidebar_position(e, true); 13155 }); 13156 13157 $isotope_wrapper.on('transitionend', function(e){ 13158 if ( $(e.target).hasClass('isotope-wrapper') ) { 13159 window.dispatchEvent(new CustomEvent('boxResized')); 13160 } 13161 return false; 13162 }); 13163 13164 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 13165 var $grid = $('.ajax-grid-system').eq(0); 13166 $grid.addClass('ajax-hide-filters'); 13167 } 13168 13169 }); 13170 }; 13171 13172 init_ajax_grid(); 13173 $(document).on('uncode-ajax-filtered', init_ajax_grid); 13174 13175/************************* 13176 * 13177 * Hover hack 13178 * 13179 ************************/ 13180 var widget_hover_hack = function() { 13181 $('.widget, .uncode_widget').each(function(){ 13182 var $widget = $(this), 13183 class_w = $widget.attr('class'), 13184 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 13185 $footer = $widget.closest('#colophon'); 13186 13187 if ( class_w.indexOf('widget_yith') > 0 ) { 13188 return true; 13189 } 13190 13191 $lis.each(function(){ 13192 var $li = $(this), 13193 $a = $('a', $li), 13194 $label = $a.closest('label'); 13195 13196 if ( !$footer.length ) { 13197 $li.addClass('no-evts'); 13198 } 13199 13200 if ( ! $('span', $a).length ) { 13201 $li.addClass( 'li-hover' ); 13202 } 13203 13204 $('li', $li).hover(function(e){ 13205 $(e.target).parents('li').each(function(){ 13206 $(this).addClass( 'parent-li-hover' ); 13207 }); 13208 }, function (e) { 13209 $(e.target).parents('li').each(function(key, val){ 13210 if ( key === 0) { 13211 $(val).removeClass( 'parent-li-hover' ); 13212 } 13213 }); 13214 }); 13215 13216 $li.off('mouseup').on('mouseup', function (e) { 13217 if (e.which !== 3) { 13218 e.stopPropagation(); 13219 var $a = $('a', this).first(); 13220 $a[0].click(); 13221 } 13222 }); 13223 }); 13224 }); 13225 } 13226 if (SiteParameters.disable_hover_hack !== '1') { 13227 widget_hover_hack(); 13228 $(document).on('uncode-ajax-filtered', widget_hover_hack); 13229 } 13230 13231/************************* 13232 * 13233 * Init Filters 13234 * 13235 ************************/ 13236 13237 function init_filters() { 13238 $(document).on('click', '.term-filter-link', function(e) { 13239 var _this = $(this); 13240 var widget = _this.closest('.uncode_widget'); 13241 var container = get_filters_container(); 13242 13243 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13244 return true; 13245 } 13246 13247 e.preventDefault(); 13248 13249 if (widget.hasClass('widget-ajax-filters--checkbox')) { 13250 _this.parent().find('input[type="checkbox"]').trigger('click'); 13251 } else { 13252 if (_this.hasClass('term-filter-link--active')) { 13253 _this.removeClass('term-filter-link--active'); 13254 } else { 13255 _this.addClass('term-filter-link--active'); 13256 13257 if (widget.hasClass('widget-ajax-filters--single')) { 13258 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 13259 } 13260 } 13261 13262 var url = _this.attr('href'); 13263 13264 reload_items(container, url, true); 13265 } 13266 }); 13267 13268 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 13269 var _this = $(this); 13270 var widget = _this.closest('.uncode_widget'); 13271 var link = _this.closest('.term-filter').find('.term-filter-link'); 13272 var url = link.attr('href'); 13273 var container = get_filters_container(); 13274 13275 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13276 window.location = url; 13277 return; 13278 } 13279 13280 if (widget.hasClass('widget-ajax-filters--single')) { 13281 widget.find('input[type="checkbox"]').each(function() { 13282 if (_this.attr('id') !== $(this).attr('id')) { 13283 $(this).prop('checked', false); 13284 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 13285 } 13286 }); 13287 } 13288 13289 if (_this.prop('checked')) { 13290 link.addClass('term-filter-link--active'); 13291 } else { 13292 link.removeClass('term-filter-link--active'); 13293 } 13294 13295 reload_items(container, url, true); 13296 }); 13297 13298 $(document).on('change', 'select.select--term-filters', function(e) { 13299 var _this = $(this); 13300 var selected = _this.find('option:selected'); 13301 var option = $(selected); 13302 var url = option.attr('data-term-filter-url'); 13303 var container = get_filters_container(); 13304 var widget = _this.closest('.uncode_widget'); 13305 13306 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13307 window.location = url; 13308 } else { 13309 reload_items(container, url, true); 13310 } 13311 }); 13312 13313 $(document).on('click', '.filter-list__link', function(e) { 13314 if (SiteParameters.is_frontend_editor) { 13315 return false;
13316 } 13317 13318 e.preventDefault(); 13319 13320 var _this = $(this); 13321 var container = get_filters_container(); 13322 var url = _this.attr('href'); 13323 reload_items(container, url, true); 13324 }); 13325 13326 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 13327 var _this = $(this); 13328 var container = get_filters_container(); 13329 var url = _this.attr('href'); 13330 reload_items(container, url, true); 13331 }); 13332 13333 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 13334 13335 var _this = $(this); 13336 var container = get_filters_container(); 13337 var url = _this.attr('href'); 13338 13339 if ( container.length ) { 13340 e.preventDefault(); 13341 reload_items(container, url, true); 13342 } 13343 }); 13344 13345 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 13346 var _this = $(this); 13347 var container = get_filters_container(); 13348 13349 if (container.length > 0) { 13350 e.preventDefault(); 13351 13352 var min_price = $('#min_price').val(); 13353 var max_price = $('#max_price').val(); 13354 var location = window.location; 13355 var url = location.href; 13356 var page_uri = location.origin + location.pathname; 13357 var is_filtered = page_uri !== url; 13358 13359 if (is_filtered) { 13360 url = remove_parameter_from_url(url, 'min_price'); 13361 url = remove_parameter_from_url(url, 'max_price'); 13362 } 13363 13364 var concat = page_uri === url ? '?' : '&'; 13365 var params = {'min_price': min_price, 'max_price': max_price}; 13366 13367 url = url + concat + $.param(params); 13368 13369 reload_items(container, url, true); 13370 } 13371 }); 13372 13373 var search_timer; 13374 13375 $(document).on('keyup', '.term-filters-search-input', function(e) { 13376 var _this = $(this); 13377 var container = get_filters_container(); 13378 var value = _this.val(); 13379 13380 if (search_timer) { 13381 clearTimeout(search_timer); 13382 } 13383 13384 search_timer = setTimeout(function() { 13385 update_search_url(container, value); 13386 }, 500); 13387 }); 13388 } 13389 13390 function update_search_url(container, search_value) { 13391 var location = window.location; 13392 var url = location.href; 13393 var page_uri = location.origin + location.pathname; 13394 var is_filtered = page_uri !== url; 13395 var key_search = SiteParameters.ajax_filter_key_search; 13396 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 13397 13398 if (is_filtered) { 13399 url = remove_parameter_from_url(url, key_search); 13400 url = remove_parameter_from_url(url, key_unfilter); 13401 } 13402 13403 if (search_value) { 13404 var concat = page_uri === url ? '?' : '&'; 13405 var params = {}; 13406 13407 params[key_search] = search_value; 13408 params[key_unfilter] = 1; 13409 url = url + concat + $.param(params); 13410 } else { 13411 url = remove_parameter_from_url(url, key_search); 13412 } 13413 13414 reload_items(container, url, true); 13415 } 13416 13417 function remove_parameter_from_url(url, parameter) { 13418 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 13419 } 13420 13421 function get_filters_container() { 13422 var container = $('.ajax-grid-system'); 13423 13424 if (container.length == 0) { 13425 container = $('.ajax-filters'); 13426 } 13427 13428 return container; 13429 } 13430 13431 function update_widgets_state(widgets_states, container) { 13432 for (var i = widgets_states.length - 1; i >= 0; i--) { 13433 var state = widgets_states[i]; 13434 13435 if (!state.collapse) { 13436 continue; 13437 } 13438 13439 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 13440 13441 if (state.open) { 13442 new_widget.find('.widget-title').addClass('open'); 13443 if (state.css) { 13444 new_widget.find('.widget-collapse-content').attr('style', state.css); 13445 } 13446 } else { 13447 new_widget.find('.widget-title').removeClass('open'); 13448 if (state.css) { 13449 new_widget.find('.widget-collapse-content').attr('style', state.css); 13450 } 13451 } 13452 } 13453 } 13454 13455 // Reload items via AJAX 13456 function reload_items(container, url, push) { 13457 if (isAjaxing) { 13458 return 13459 }; 13460 13461 isAjaxing = true; 13462 13463 container.addClass('grid-filtering'); 13464 13465 $.ajax({ 13466 url : url, 13467 success : function(response) { 13468 if (!response) { 13469 return; 13470 } 13471 13472 $(document).trigger('uncode-ajax-pre-filtered'); 13473 13474 var container_id = container.attr('id'); 13475 var pagination = $('.row-navigation'); 13476 13477 if (container_id) { 13478 var container_to_append = $(response).find('#' + container_id); 13479 var pagination_to_append = $(response).find('.row-navigation'); 13480 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13481 13482 // Remember open/closed widgets 13483 var widgets = $('.uncode_widget'); 13484 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 13485 var widgets_states = []; 13486 13487 widgets.each(function() { 13488 var widget = $(this); 13489 var id = widget.attr('data-id'); 13490 var state = { 13491 'id': id, 13492 'collapse': false, 13493 'open': false, 13494 'css': false, 13495 }; 13496 13497 var collapse_wrapper = widget.find('.widget-collapse-content'); 13498 13499 if (collapse_wrapper.length > 0) { 13500 state.collapse = true; 13501 13502 var collapse_wrapper_css = collapse_wrapper.attr('style'); 13503 var title = widget.find('.widget-title'); 13504 13505 state.css = collapse_wrapper_css; 13506 13507 if (title.hasClass('open')) { 13508 state.open = true; 13509 } else { 13510 state.open = false;
13511 } 13512 } 13513 13514 widgets_states.push(state); 13515 }); 13516 13517 // Update widgets state 13518 if (offcanvas_sidebar_wrapper.length === 0) { 13519 update_widgets_state(widgets_states, container_to_append); 13520 } 13521 13522 // Update default sidebar state 13523 if (!container.hasClass('ajax-hide-filters')) { 13524 container_to_append.removeClass('ajax-hide-filters'); 13525 } 13526 13527 // Update horizontal sidebar 13528 if (!container.hasClass('ajax-hide-filters-blanks')) { 13529 container_to_append.removeClass('ajax-hide-filters-blanks'); 13530 } 13531 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 13532 if (horizontal_sidebar_wrapper.length > 0) { 13533 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 13534 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 13535 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 13536 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 13537 13538 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 13539 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 13540 } 13541 13542 // Append container 13543 container.replaceWith(container_to_append); 13544 13545 // Hide first thumbnail until the new srcset is loaded 13546 if (SiteParameters.dynamic_srcset_active === '1') { 13547 container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations'); 13548 } 13549 13550 // Remove loading attribute to images 13551 container_to_append.find('img').attr('loading', ''); 13552 13553 // Append pagination 13554 if (pagination.length > 0) { 13555 if (pagination_to_append.length > 0) { 13556 pagination.html(pagination_to_append.html()); 13557 } else { 13558 pagination.html(''); 13559 } 13560 } else { 13561 if (pagination_to_append.length > 0) { 13562 $('.post-wrapper').append(pagination_to_append); 13563 } 13564 } 13565 13566 // Update off canvas sidebar (mobile and overlay) 13567 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13568 13569 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 13570 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 13571 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 13572 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 13573 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 13574 13575 // Update widgets state 13576 update_widgets_state(widgets_states, sidebar_to_append); 13577 13578 // Update sidebar 13579 sidebar_container.html(sidebar_to_append.html()); 13580 } 13581 13582 if (push) { 13583 UNCODE.lastURL = url; 13584 window.history.pushState( 13585 { pageTitle: document.title }, 13586 '', 13587 url 13588 ); 13589 } 13590 13591 if (typeof UNCODE.isotopeLayout !== 'undefined') { 13592 UNCODE.isotopeLayout(); 13593 } 13594 if (typeof UNCODE.justifiedGallery !== 'undefined') { 13595 UNCODE.justifiedGallery(); 13596 } 13597 if (typeof UNCODE.cssGrid !== 'undefined') { 13598 UNCODE.cssGrid(); 13599 } 13600 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 13601 UNCODE.lightbox(); 13602 } 13603 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 13604 UNCODE.lightgallery(); 13605 } 13606 if (typeof UNCODE.carousel !== 'undefined') { 13607 UNCODE.carousel($('body')); 13608 } 13609 UNCODE.animations(); 13610 if (typeof UNCODE.filters !== 'undefined') { 13611 UNCODE.filters(); 13612 } 13613 if (typeof UNCODE.widgets !== 'undefined') { 13614 UNCODE.widgets(); 13615 } 13616 13617 if (SiteParameters.dynamic_srcset_active === '1') { 13618 UNCODE.refresh_dynamic_srcset_size(); 13619 } 13620 13621 if (typeof UNCODE.menuSmartInit !== 'undefined') { 13622 UNCODE.menuSmartInit(); 13623 } 13624 13625 if (typeof UNCODE.parallax !== 'undefined') { 13626 UNCODE.parallax(); 13627 } 13628 13629 maybe_scroll_to_top(); 13630 13631 var woo_select2_cats = $('.dropdown_product_cat'); 13632 13633 if (woo_select2_cats.length > 0) { 13634 woo_select2_cats.on( 'change', function() { 13635 if ( $(this).val() != '' ) { 13636 var this_page = ''; 13637 var home_url = UncodeWCParameters.uncode_wc_widget_product_categories_home_url; 13638 if ( home_url.indexOf( '?' ) > 0 ) { 13639 this_page = home_url + '&product_cat=' + $(this).val(); 13640 } else { 13641 this_page = home_url + '?product_cat=' + $(this).val(); 13642 } 13643 location.href = this_page; 13644 } else { 13645 location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url; 13646 } 13647 }); 13648 13649 if ( $().selectWoo ) { 13650 var wc_product_cat_select = function() { 13651 woo_select2_cats.selectWoo( { 13652 placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder, 13653 minimumResultsForSearch: 5, 13654 width: '100%', 13655 allowClear: true, 13656 language: { 13657 noResults: function() { 13658 return UncodeWCParameters.uncode_wc_widget_product_categories_no_results; 13659 } 13660 } 13661 } ); 13662 }; 13663 wc_product_cat_select(); 13664 } 13665 } 13666 13667 $(document).trigger('uncode-ajax-filtered'); 13668 $(document.body).trigger('init_price_filter'); 13669 window.dispatchEvent(new CustomEvent('uncode-ajax-filtered')); 13670 window.document.dispatchEvent(new Event("DOMContentLoaded", { 13671 bubbles: true, 13672 cancelable: true 13673 })); 13674 13675 isAjaxing = false;
13676 } 13677 }, 13678 error: function() { 13679 container.removeClass('grid-filtering'); 13680 13681 isAjaxing = false; 13682 13683 if (SiteParameters.enable_debug == true) { 13684 // This console log is disabled by default 13685 // So nothing is printed in a typical installation 13686 // 13687 // It can be enabled for debugging purposes setting 13688 // the 'uncode_enable_debug_on_js_scripts' filter to true 13689 console.log('There was an error retrieving the products'); 13690 } 13691 } 13692 }); 13693 } 13694 13695 // Scroll to top after filtering 13696 function maybe_scroll_to_top() { 13697 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13698 13699 if (offcanvas_sidebar_wrapper.length > 0) { 13700 return; 13701 } 13702 13703 var container = get_filters_container(); 13704 var bound = container[0].getBoundingClientRect(); 13705 13706 if (bound.y < 0) { 13707 $(window).scrollTop(container.offset().top); 13708 } 13709 } 13710 13711 // Back/forward browser buttons 13712 $(window).on("popstate.ajaxfilters", function(e) { 13713 var location = window.location; 13714 var url = location.href; 13715 var params = UNCODE.getURLParams(window.location); 13716 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 13717 13718 UNCODE.lastURL = url; 13719 13720 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 13721 return; 13722 } 13723 13724 var container = get_filters_container(); 13725 13726 reload_items(container, url, false); 13727 }); 13728 13729 // Destroy load more before to init a new one 13730 $(window).on('uncode-ajax-pre-filtered', function() { 13731 if ($.fn.infinitescroll) { 13732 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 13733 } 13734 }); 13735 13736 init_filters(); 13737}; 13738 13739UNCODE.videoThumbs = function() { 13740 var checkResize, 13741 newW = UNCODE.wwidth; 13742 var checkForVideos = function(){ 13743 13744 $(window).on('okevents.y.change', function(e, y){ 13745 var $video = $(y.target.g), 13746 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13747 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13748 restart = !$video_wrap.hasClass('play-pause'), 13749 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13750 setTime; 13751 if ( newW >= UNCODE.mediaQuery ) { 13752 13753 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 13754 $video_wrap.data('hovered', true); 13755 $video_wrap.addClass('played-on'); 13756 y.target.pauseVideo(); 13757 $tmb.on('mouseenter', function(){ 13758 if ( restart ) { 13759 y.target.seekTo(0); 13760 } 13761 y.target.playVideo(); 13762 }).on('mouseleave', function(){ 13763 clearTimeout(setTime); 13764 setTime = setTimeout(function(){ 13765 y.target.pauseVideo(); 13766 }, 300); 13767 }); 13768 } 13769 13770 } else { 13771 if( $mobile_video_wrap.length ) { 13772 $video_wrap.addClass('played-on'); 13773 y.target.playVideo(); 13774 } 13775 } 13776 13777 }); 13778 13779 $(window).on('okevents.v.loaded', function(e, playerV){ 13780 var $video = $(playerV.element), 13781 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13782 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13783 restart = !$video_wrap.hasClass('play-pause'), 13784 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13785 setTime; 13786 13787 if ( newW >= UNCODE.mediaQuery ) { 13788 13789 if( $video_wrap.length ) { 13790 13791 var playPromise = playerV.play(); 13792 if (playPromise !== undefined) { 13793 playPromise.then(function( value ) { 13794 playerV.pause(); 13795 }); 13796 } 13797 $video_wrap.addClass('played-on'); 13798 $tmb.on('mouseenter', function(){ 13799 if ( restart ) { 13800 playerV.setCurrentTime(0) 13801 } 13802 playerV.play(); 13803 }).on('mouseleave', function(){ 13804 clearTimeout(setTime); 13805 setTime = setTimeout(function(){ 13806 playerV.pause(); 13807 }, 300); 13808 }); 13809 } 13810 13811 } else { 13812 13813 if( $mobile_video_wrap.length ) { 13814 var playPromise = playerV.play(); 13815 if (playPromise !== undefined) { 13816 playPromise.then(function( value ) { 13817 playerV.play(); 13818 }); 13819 } 13820 $video_wrap.addClass('played-on'); 13821 } 13822 } 13823 }); 13824 13825 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 13826 var $video = $(video), 13827 $noscript = $('noscript', $video), 13828 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13829 restart = !$video_wrap.hasClass('play-pause'), 13830 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13831 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
13831: $video.closest('.t-entry-visual, .un-inline-image'), 13832 setTime, 13833 manageVideo = function(){ 13834 video.currentTime = 0; 13835 video.pause(); 13836 if ( newW >= UNCODE.mediaQuery ) { 13837 if ( $video_wrap.length ) { 13838 $video_wrap.addClass('played-on'); 13839 $tmb.on('mouseenter', function(){ 13840 if ( restart ) { 13841 video.currentTime = 0; 13842 } 13843 video.play(); 13844 }).on('mouseleave', function(){ 13845 clearTimeout(setTime); 13846 setTime = setTimeout(function(){ 13847 video.pause(); 13848 }, 300); 13849 }); 13850 } else { 13851 video.play(); 13852 } 13853 } else { 13854 if ( $mobile_video_wrap.length ) { 13855 $mobile_video_wrap.addClass('played-on'); 13856 video.play(); 13857 } 13858 } 13859 13860 }; 13861 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 13862 $noscript.each(function(key, val){ 13863 $noscript.after(val.textContent || val.innerText || val.innerHTML); 13864 $noscript.remove(); 13865 }); 13866 } 13867 13868 if (typeof MediaElement === "function") { 13869 $video.has('source[src]').mediaelementplayer({ 13870 pauseOtherPlayers: false, 13871 }); 13872 } 13873 if (video.readyState > 0) { 13874 manageVideo(); 13875 } else { 13876 $video.on("loadedmetadata", function(_event) { 13877 manageVideo(); 13878 }); 13879 }; 13880 }); 13881 13882 }; 13883 13884 checkForVideos(); 13885 13886 var checkVideoResize = function(){ 13887 clearRequestTimeout(checkResize); 13888 checkResize = requestTimeout(function(){ 13889 if ( newW !== UNCODE.wwidth ) { 13890 checkForVideos(); 13891 newW = UNCODE.wwidth; 13892 } 13893 }, 1000); 13894 }; 13895 13896 $(window).off('resize.videos', checkVideoResize) 13897 .on( 'resize.videos', checkVideoResize); 13898 13899 $(window).off('more-items-loaded.videos', checkForVideos) 13900 .on('more-items-loaded.videos', checkForVideos); 13901 13902}; 13903UNCODE.inlineImgs = function() { 13904 var linkInlineImgs = function(){ 13905 $('.un-inline-image').each(function(){ 13906 var $img = $(this), 13907 href = $(this).attr('data-link-href'), 13908 dataImg = $img.data(); 13909 if ( dataImg != '' && href != null && href !== '' ) { 13910 var class_stra_a = 'unline-image-link'; 13911 if ( $(this).hasClass('un-inline-space-over') ) { 13912 class_stra_a += ' un-inline-space-over'; 13913 } else if ( $(this).hasClass('un-inline-space-gutter') ) { 13914 class_stra_a += ' un-inline-space-gutter'; 13915 } 13916 var str_a = '<a class="' + class_stra_a + '" '; 13917 for (var key in dataImg) { 13918 if (dataImg.hasOwnProperty(key) && key.startsWith("link")) { 13919 str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\""; 13920 } 13921 } 13922 str_a += ' />'; 13923 $img.wrap(str_a); 13924 } 13925 }); 13926 }; 13927 $(window).on('load', linkInlineImgs ); 13928}; 13929UNCODE.lottie = function() { 13930 if ( SiteParameters.is_frontend_editor ) { 13931 var $lottie_wraps = $('div.uncode-lottie-wrap'); 13932 $lottie_wraps.each(function(){ 13933 var $lottie_wrap = $(this), 13934 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 13935 $player_clone = $div_player.clone(), 13936 player_id = $div_player.attr('data-id'), 13937 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 13938 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 13939 if ( $('#'+player_id).length ) { 13940 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 13941 } 13942 $player_clone.attr('id', player_id); 13943 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 13944 $div_player.after($player_clone); 13945 $div_player.attr('data-init',true); 13946 } 13947 }); 13948 } 13949 var $players = $('.uncode-lottie-wrap lottie-player'); 13950 $players.each(function(){ 13951 var player = this, 13952 this_id = $(player).attr('id'), 13953 _player = document.getElementById(this_id), 13954 trigger = $(player).attr('data-trigger'), 13955 pFrames = $(player).attr('data-frames').split(','), 13956 srcPlayer = $(player).attr('src'); 13957 13958 _player.load(srcPlayer); 13959 13960 _player.addEventListener("ready", function() { 13961 13962 var $_shadow = _player.shadowRoot; 13963 $($_shadow).find('.error').remove(); 13964 13965 var tFrames = _player.getLottie().totalFrames / 100, 13966 pFrame_from = Math.round(tFrames * pFrames[0]), 13967 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 13968 loop = $(player).attr('loop'), 13969 mode, 13970 actions; 13971 13972 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 13973 if ( trigger === 'scroll' ) { 13974 mode = 'scroll'; 13975 actions = [ 13976 { 13977 visibility:[0, 1.0], 13978 type: "seek",
13979 frames: [pFrame_from, pFrame_to], 13980 } 13981 ]; 13982 } else if ( trigger === 'viewport') { 13983 mode = 'scroll'; 13984 actions = [ 13985 { 13986 visibility: [0.20, 1.0], 13987 frames: [pFrame_from, pFrame_to], 13988 type: loop ? "loop" : "play" 13989 } 13990 ]; 13991 } else if ( trigger === 'hover') { 13992 $(player).on('mouseenter', function(){ 13993 _player.play(); 13994 }).on('mouseleave', function(){ 13995 _player.pause(); 13996 }); 13997 if ( pFrame_from > 0 && pFrame_from < 99 ) { 13998 _player.seek(pFrame_from); 13999 _player.addEventListener("frame", function(){ 14000 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14001 _player.seek(pFrame_from); 14002 } 14003 }); 14004 } 14005 } 14006 LottieInteractivity.create({
14007 player: '#' + this_id, 14008 mode: mode, 14009 actions: actions 14010 }); 14011 } else { 14012 if ( pFrame_from > 0 && pFrame_from < 99 ) { 14013 _player.seek(pFrame_from); 14014 _player.addEventListener("frame", function(){ 14015 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14016 _player.seek(pFrame_from); 14017 } 14018 }); 14019 } 14020 } 14021 }); 14022 14023 $(window).on('unlottie-destroy', function(){ 14024 _player.destroy(); 14025 }); 14026 }); 14027}; 14028 14029UNCODE.animatedBgGradient = function( _el ) { 14030 14031 var ev; 14032 14033 if ( typeof _el === 'undefined' || _el === null ) { 14034 _el = document; 14035 ev = false; 14036 } else { 14037 _el = _el[0]; 14038 ev = 'shortcode:update'; 14039 } 14040 14041 var simplex = new SimplexNoise(); 14042 14043 var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) { 14044 this.block = blockOverlay; 14045 this.wrap = canvasWrap; 14046 this.config(); 14047 this.checker(); 14048 this.loopRAF(); 14049 this.animLoader(); 14050 }; 14051 14052 var AnimGradient = Uncode_BG_Animated_Gradient.prototype; 14053 14054 AnimGradient.config = function() { 14055 this.canvas = document.createElement('canvas'); 14056 this.wrap.appendChild(this.canvas); 14057 this.ctx = this.canvas.getContext('2d'); 14058 this.count = 0; 14059 this.isOrientationChanged = false; 14060 this.res = UNCODE.isMobile ? 90 : 110; 14061 this.resPercent = 100/this.res; 14062 this.resAround = this.resPercent/100; 14063 this.size = typeof this.block.getAttribute('data-bg-noise-size') !== 'undefined' && this.block.getAttribute('data-bg-noise-size') !== null && this.block.getAttribute('data-bg-noise-size') !== '' ? this.block.getAttribute('data-bg-noise-size') : 1; 14064 14065 this.canvas.classList.add('uncode-bg-animated-gradient'); 14066 this.canvas.setAttribute('height', this.res); 14067 this.canvas.setAttribute('width', this.res); 14068 this.canvas.style = 'height: 100%; position: relative; width:100%;'; 14069 14070 this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); 14071 14072 this.cx = this.canvas.width/2; 14073 this.cy = this.canvas.height/2; 14074 this.data = this.imgdata.data; 14075 14076 this.opts = { 14077 col_1st: typeof this.block.getAttribute('data-bg-noise-1') !== 'undefined' && this.block.getAttribute('data-bg-noise-1') !== null && this.block.getAttribute('data-bg-noise-1') !== '' ? this.block.getAttribute('data-bg-noise-1') : false, 14078 col_2nd: typeof this.block.getAttribute('data-bg-noise-2') !== 'undefined' && this.block.getAttribute('data-bg-noise-2') !== null && this.block.getAttribute('data-bg-noise-2') !== '' ? this.block.getAttribute('data-bg-noise-2') : false, 14079 time: typeof this.block.getAttribute('data-bg-noise-speed') !== 'undefined' && this.block.getAttribute('data-bg-noise-speed') !== null && this.block.getAttribute('data-bg-noise-speed') !== '' ? parseFloat(this.block.getAttribute('data-bg-noise-speed')) : 250,//100,250,1500 14080 }; 14081 14082 this.lavaTime = 1; 14083 this.bg_colors = []; 14084 14085 if ( this.opts.col_1st === false && this.opts.col_2nd === false ) { 14086 return; 14087 } 14088 14089 if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) { 14090 this.singleColor = true; 14091 } 14092 14093 if( this.opts.col_1st ) { 14094 14095 var rgbColor1 = this.hexToRGB(this.opts.col_1st); 14096 14097 this.bg_colors.push({ 14098 r: rgbColor1.r, 14099 g: rgbColor1.g, 14100 b: rgbColor1.b 14101 }); 14102 } 14103 14104 if( this.opts.col_2nd ) { 14105 14106 var rgbColor2 = this.hexToRGB(this.opts.col_2nd); 14107 14108 this.bg_colors.push({ 14109 r: rgbColor2.r, 14110 g: rgbColor2.g, 14111 b: rgbColor2.b 14112 }); 14113 } 14114 14115 }; 14116 14117 AnimGradient.checker = function() { 14118 var scope = this; 14119 this.checkInViewPort(); 14120 14121 window.addEventListener('resize', function() { 14122 if(UNCODE.isMobile && !scope.isOrientationChanged) { 14123 return; 14124 } 14125 scope.ratioCalc(); 14126 }); 14127 14128 window.addEventListener("orientationchange", function() { 14129 scope.isOrientationChanged = true; 14130 }); 14131 14132 this.ratioCalc(); 14133 }; 14134 14135 AnimGradient.ratioCalc = function() { 14136 14137 var blockW = this.block.clientWidth, 14138 blockH = this.block.clientHeight; 14139 14140 var blockRatio = blockH/blockW; 14141 14142 if(blockRatio < 1) { 14143 this.ratioParam = { 14144 x: 1.4, 14145 y: blockRatio*1.4 14146 } 14147 } else { 14148 this.ratioParam = { 14149 x: blockRatio/3, 14150 y: 1 14151 } 14152 } 14153 14154 }; 14155 14156 AnimGradient.checkInViewPort = function() { 14157 if( 'IntersectionObserver' in window ) { 14158 var scope = this, 14159 observer = new IntersectionObserver(function(entries) { 14160
14161 entries.forEach(function(entry){ 14162 if ( entry.isIntersecting ) { 14163 scope.isInViewport = true; 14164 } else { 14165 scope.isInViewport = false; 14166 } 14167 }); 14168 14169 }, { 14170 root: document, 14171 }); 14172 14173 observer.observe(this.block); 14174 } 14175 }; 14176 14177 AnimGradient.hexToRGB = function(hexval) { 14178 var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval); 14179 if (!hexecuted) { 14180 return false; 14181 } 14182 return { 14183 r: parseInt(hexecuted[1], 16), 14184 g: parseInt(hexecuted[2], 16), 14185 b: parseInt(hexecuted[3], 16) 14186 } 14187 }; 14188 14189 AnimGradient.factor = function(val_1, val_2, lava) { 14190 return val_1 * (1 - lava) + val_2 * lava; 14191 }; 14192 14193 AnimGradient.factorNoise = function(wave_l, x, y, noise) { 14194 if (this.singleColor) { 14195 return this.bg_colors[0][wave_l]; 14196 } 14197 return this.factor(this.bg_colors[0][wave_l], this.bg_colors[1][wave_l], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*3.5)*noise/2 ); 14198 // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) ); 14199 }; 14200 14201 AnimGradient.lava = function(x, y, grade) { 14202 var radians = (Math.PI / 180) * grade, 14203 cos = Math.cos(radians), 14204 sin = Math.sin(radians), 14205 nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx; 14206 return nx; 14207 }; 14208 14209 AnimGradient.loopRAF = function() { 14210 14211 var scope = this; 14212 14213 if( this.isInViewport ) { 14214 for (var x = 0; x < this.res; x++) { 14215 for (var y = 0; y < this.res; y++) { 14216 14217 var noise = simplex.noise3D((x / this.res * this.ratioParam.x)*this.size, (y / this.res * this.ratioParam.y)*this.size, this.count/this.opts.time); //original 14218 14219 this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise); 14220 this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise); 14221 this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise); 14222 this.data[(x + y * this.res) * 4 + 3] = noise*265; 14223 14224 } 14225 } 14226 14227 this.count++; 14228 14229 this.ctx.putImageData(this.imgdata, 0, 0); 14230 14231 } 14232 14233 requestAnimationFrame(function() { 14234 scope.loopRAF(); 14235 }); 14236 }; 14237 14238 AnimGradient.animLoader = function() { 14239 this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded'); 14240 }; 14241 14242 var anim_init = function() { 14243 var bgs = _el.querySelectorAll('.block-bg-overlay'); 14244 14245 bgs.forEach(function(blockOverlay) { 14246 var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap'); 14247 if( !blockOverlay || !canvasWrap ) { 14248 return; 14249 } 14250 new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap); 14251 }); 14252 } 14253 14254 $(window).on('load', function(){ 14255 anim_init(); 14256 }); 14257 14258 if ( ev === 'shortcode:update' ) { 14259 anim_init(); 14260 } 14261 14262}; 14263UNCODE.multibg = function(){ 14264 var $bgsWraps = $('.uncode-multi-bgs'), 14265 $body = $('body'); 14266 $bgsWraps.each(function(){ 14267 var $bgWrap = $(this), 14268 transition = $bgWrap.attr('data-transition'), 14269 transitionTime = $bgWrap.attr('data-transition-time'), 14270 dataPace = $bgWrap.attr('data-transition-pace'), 14271 dataThreshold = $bgWrap.attr('data-transition-threshold'), 14272 dataTime = $bgWrap.attr('data-carousel-time'), 14273 dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'), 14274 random = $bgWrap.attr('data-multi-random'), 14275 _bgWrap = $bgWrap[0], 14276 $multiBgs = $('.multi-background', $bgWrap), 14277 imgFirst, 14278 bgAmount = $multiBgs.length, 14279 isInViewport = false, 14280 lastScrollTop = 0, 14281 counter = 0, 14282 totMove = 0, 14283 autoScroll = typeof dataPace === 'undefined' && transition === 'scroll', 14284 pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ), 14285 threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0, 14286 offX, offY, 14287 wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250, 14288 carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000, 14289 requestCarousel, 14290 is_header = $bgWrap.closest('#page-header').length, 14291 startTime = new Date(); 14292 14293 transition = typeof transition === 'undefined' ? '' : transition; 14294 14295 if ( random === 'true' ) { 14296 UNCODE.shuffle($multiBgs); 14297 } 14298 14299 imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, ""); 14300 14301 var loadFirst = function(){
14302 $multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({ 14303 opacity: 1 14304 }, 250, 'easeInQuad').css({ 14305 zIndex: 1 14306 }); 14307 } 14308 14309 var loadError = function(){ 14310 console.log('Multi BG loading error'); 14311 } 14312 14313 UNCODE.checkImgLoad( imgFirst, loadFirst, loadError ); 14314 14315 var loadSlides = function( $thisBg ){ 14316 $thisBg.attr('data-load', 'loaded'); 14317 } 14318 14319 $multiBgs.not('[data-load="loaded"]').each(function(ind, val){ 14320 var $thisBg = $(val); 14321 14322 if ( typeof $thisBg !== 'undefined' && $thisBg.length ) { 14323 14324 var _imgBg = $(val).find('.background-inner').css('background-image'); 14325 14326 if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) { 14327 $thisBg.attr('data-load', 'loaded'); 14328 } else { 14329 _imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, ""); 14330 if ( typeof _imgBg !== 'undefined' ) { 14331 UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg ); 14332 } 14333 } 14334 } 14335 }); 14336 14337 var multiCarousel = function(e) { 14338 14339 clearRequestTimeout(requestCarousel); 14340 14341 var checkTime = new Date(); 14342 if ( checkTime - startTime >= carouselTime && isInViewport ) { 14343 var $checkEl = $multiBgs.eq((counter+1)%bgAmount); 14344 14345 if ( $checkEl.attr('data-load') !== 'loaded' ) { 14346 requestTimeout(function(){
14347 multiCarousel(); 14348 }, 100); 14349 return; 14350 } 14351 14352 counter++; 14353 14354 $multiBgs.each(function(ind, val){ 14355 if ( ind === counter%bgAmount ) { 14356 $(val).stop(true,false).animate({ 14357 opacity: 1 14358 }, wait, 'easeInQuad').css({ 14359 zIndex: 1 14360 }); 14361 } else { 14362 $(val).stop(true,false).animate({ 14363 opacity: 0 14364 }, wait, 'easeInQuad').css({ 14365 zIndex: 0 14366 }); 14367 } 14368 }); 14369 14370 } 14371 14372 if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 14373 requestCarousel = requestTimeout(multiCarousel, carouselTime); 14374 } 14375 14376 }; 14377 14378 var multiMove = function(e) { 14379 if ( $body.hasClass('navbar-hover') ) { 14380 return; 14381 } 14382 var checkTime = new Date(), 14383 bound = $bgWrap[0].getBoundingClientRect(), 14384 windowTop = (window.clientYOffset || document.documentElement.scrollTop); 14385 if (offX) { 14386 totMove += Math.sqrt( 14387 Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2) 14388 ); 14389 } 14390 if ( 14391 totMove >= pace && 14392 checkTime - startTime >= wait && 14393 e.clientX <= (bound.left + bound.width) && 14394 e.clientX >= bound.left && 14395 e.clientY <= (bound.top + bound.height) && 14396 e.clientY >= bound.top 14397 ) { 14398 counter++; 14399 startTime = checkTime; 14400 $multiBgs.each(function(ind, val){ 14401 if ( ind === counter%bgAmount ) { 14402 $(val).stop(true,false).animate({ 14403 opacity: 1 14404 }, wait, 'easeInQuad').css({ 14405 zIndex: 1 14406 }); 14407 } else { 14408 $(val).stop(true,false).animate({ 14409 opacity: 0 14410 }, wait, 'easeInQuad').css({ 14411 zIndex: 0 14412 }); 14413 } 14414 }); 14415 14416 totMove = 0; 14417 } 14418 14419 offX = e.clientX; 14420 offY = e.clientY; 14421 14422 }; 14423 14424 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14425 document.addEventListener("mousemove", multiMove); 14426 } 14427 14428 window.addEventListener('resize', function() { 14429 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14430 document.removeEventListener("mousemove", multiMove); 14431 document.addEventListener("mousemove", multiMove); 14432 } 14433 }); 14434 14435 var lightLoopRAF = function() { 14436 14437 var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), 14438 checkTime = new Date(), 14439 bound = $bgWrap[0].getBoundingClientRect(), 14440 thresholdHeader = is_header ? 100 : threshold, 14441 rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace); 14442 if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) { 14443 counter++; 14444 lastScrollTop = scrollTop; 14445 startTime = checkTime; 14446 14447 $multiBgs.each(function(ind, val){ 14448 if ( ind === counter%bgAmount ) { 14449 $(val).stop(true,false).animate({ 14450 opacity: 1 14451 }, wait, 'easeInQuad').css({ 14452 zIndex: 1 14453 }); 14454 } else { 14455 $(val).stop(true,false).animate({ 14456 opacity: 0 14457 }, wait, 'easeInQuad').css({ 14458 zIndex: 0 14459 }); 14460 } 14461 }); 14462 14463 } 14464 14465 requestAnimationFrame(function() { 14466 if ( isInViewport ) { 14467 lightLoopRAF(); 14468 } 14469 }); 14470 }; 14471 14472 var currentInd = 0; 14473 14474 var loopRAF = function() { 14475 14476 var multiBgRotate = function(slideInd){ 14477 currentInd = slideInd; 14478 $multiBgs.each(function(ind, val){ 14479 if ( ind === slideInd ) { 14480 $(val).stop(true,false).animate({ 14481 opacity: 1 14482 }, wait, 'easeInQuad').css({ 14483 zIndex: 1 14484 }); 14485 } else { 14486 $(val).stop(true,false).animate({ 14487 opacity: 0 14488 }, wait, 'easeInQuad').css({ 14489 zIndex: 0 14490 }); 14491 } 14492 }); 14493 }; 14494 var bound = $bgWrap[0].getBoundingClientRect(), 14495 thresholdPX = UNCODE.wheight * threshold / 100, 14496 totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))), 14497 movePX = totMove / bgAmount, 14498 moving = UNCODE.wheight - (bound.top + thresholdPX), 14499 slideInd = 0; 14500 14501 if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) { 14502 multiBgRotate(0); 14503 } else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) { 14504 multiBgRotate(bgAmount-1); 14505 } else { 14506 slideInd = Math.ceil(moving/movePX) - 1; 14507 if ( slideInd < 0 ) { 14508 slideInd = 0; 14509 } else if ( slideInd >= bgAmount ) { 14510 slideInd = bgAmount-1; 14511 } 14512 if ( slideInd !== currentInd ) { 14513 multiBgRotate(slideInd); 14514 } 14515 } 14516 14517 requestAnimationFrame(function() { 14518 if ( isInViewport ) { 14519 loopRAF(); 14520 } 14521 }); 14522 }; 14523 14524 if( 'IntersectionObserver' in window ) { 14525 var observer = new IntersectionObserver(function(entries) { 14526
14527 entries.forEach(function(entry){ 14528 if ( entry.isIntersecting ) { 14529 isInViewport = true; 14530 if ( transition === 'scroll' ) { 14531 if ( autoScroll ) { 14532 loopRAF(); 14533 } else { 14534 lightLoopRAF(); 14535 } 14536 } else { 14537 multiCarousel(); 14538 } 14539 } else { 14540 isInViewport = false; 14541 } 14542 }); 14543 14544 }, { 14545 root: document, 14546 rootMargin: is_header ? '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px' 14547 }); 14548 14549 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14550 observer.observe(_bgWrap); 14551 } 14552 14553 window.addEventListener('resize', function() { 14554 observer.unobserve(_bgWrap); 14555 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14556 observer.observe(_bgWrap); 14557 } 14558 }); 14559 14560 } 14561 14562 }); 14563} 14564 14565UNCODE.owlNav = function(target, ev) { 14566 target = target.replace(/#\S+/g, ''); 14567 var $carousel = $('#'+target), 14568 $slider = $carousel.closest('.uncode-slider'), 14569 $checkNavs = $('.uncode-owl-nav'); 14570 if ( !$checkNavs.length ) { 14571 return; 14572 } 14573 14574 if ( $slider.length ){ 14575 target = $slider.attr('id'); 14576 } 14577 14578 var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'), 14579 $row; 14580 14581 if ( ! $navs.length ) { 14582 $row = $carousel.closest('.vc_row.row-container'); 14583 $navs = $('.uncode-owl-nav:not([data-target])', $row); 14584 } 14585 14586 if ( ! $navs.length ) { 14587 return; 14588 } 14589 14590 $navs.each(function(){ 14591 var $nav = $(this), 14592 $outer = $nav.closest('.uncode-owl-nav-out'), 14593 $inner = $nav.find('.uncode-owl-nav-in'), 14594 $navDots = $('.uncode-nav-dots', $nav), 14595 $navCounter = $('.uncode-nav-counter', $nav), 14596 $counterIndex = $('.uncode-nav-counter-index', $navCounter), 14597 $counterTotal = $('.uncode-nav-counter-total', $navCounter), 14598 skinInherit = $nav.hasClass('skin-inherit'), 14599 digit = parseFloat($nav.attr('data-digit')), 14600 counterDigit = parseFloat($nav.attr('data-counter-digit')), 14601 navSpeed = parseFloat($carousel.attr('data-navspeed')); 14602 navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400; 14603 14604 if ( $nav.hasClass('pos-abs') ){ 14605 if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) { 14606 $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />'); 14607 } 14608 $carousel.closest('.owl-carousel-wrapper-nav').append($outer); 14609 } 14610 14611 $carousel.on('refreshed.owl.carousel', counter); 14612 $carousel.on('resized.owl.carousel', counter); 14613 $carousel.on('changed.owl.carousel', counter); 14614 14615 var totalSlides = 0; 14616 14617 function counter(event) { 14618 if (!event.namespace) { 14619 return; 14620 } 14621 var slides = event.relatedTarget, 14622 current = slides._current, 14623 loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop, 14624 item = event.item, 14625 page = event.page, 14626 countPages = Math.ceil(item.count / page.size), 14627 $currentSlide = $carousel.find('.owl-item').eq(current), 14628 itemIndex = Math.floor($currentSlide.attr('data-index')) , 14629 activeSlide = Math.ceil(itemIndex / page.size), 14630 $prev = $nav.find('.uncode-nav-prev'), 14631 $next = $nav.find('.uncode-nav-next'), 14632 $col = $currentSlide.find('.uncol').first(); 14633 14634 if ( totalSlides != countPages ) { 14635 totalSlides = countPages; 14636 $navDots.html(''); 14637 var nav_html = ''; 14638 for (var sl_ind = 0; sl_ind < countPages; sl_ind++) { 14639 var padN = sl_ind+1; 14640 if ( digit && digit > 1 ) { 14641 padN = String(padN).padStart(digit, '0'); 14642 } 14643 nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>'; 14644 } 14645 $navDots.html(nav_html); 14646 14647 var totalSlidesDigit = totalSlides; 14648 14649 if ( counterDigit && counterDigit > 1 ) { 14650 totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0'); 14651 } 14652 $counterTotal.html(totalSlidesDigit); 14653 } 14654 14655 if ( loop !== true ) { 14656 $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled'); 14657 if ( itemIndex === 1 ) { 14658 $prev.addClass('uncode-nav-disabled'); 14659 } else if ( ( itemIndex - 1 + page.size ) >= item.count ) { 14660 $next.addClass('uncode-nav-disabled');
14661 activeSlide = Math.ceil(item.count / page.size); 14662 } 14663 } 14664 14665 $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index'); 14666 var activeSlideDigit = activeSlide; 14667 14668 if ( counterDigit && counterDigit > 1 ) { 14669 activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0'); 14670 } 14671 $counterIndex.html(activeSlideDigit); 14672 14673 if ( skinInherit ) { 14674 if ( $col.hasClass('style-light') ){ 14675 $nav.removeClass('style-dark').addClass('style-light'); 14676 } else if ( $col.hasClass('style-dark') ) { 14677 $nav.removeClass('style-light').addClass('style-dark'); 14678 } 14679 } 14680 14681 $inner.removeClass('uncode-owl-nav-waiting'); 14682 14683 if ( $nav.hasClass('outer-width') ) { 14684 var navW = $nav.outerWidth(), 14685 nexW = $next.outerWidth(), 14686 prevW = $prev.outerWidth(), 14687 margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) ); 14688 14689 if ( $nav.hasClass('h-align-justify') ) { 14690 $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'}); 14691 if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) { 14692 $inner.css({'margin': 'auto'}); 14693 } else { 14694 $inner.css({'margin': ''}); 14695 } 14696 } else { 14697 $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'}); 14698 if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) { 14699 $inner.css({'margin': 'auto'}); 14700 } else { 14701 $inner.css({'margin': ''}); 14702 } 14703 } 14704 } 14705 } 14706 14707 $nav.on('click', '.uncode-nav-index', function(){ 14708 var $bullet = $(this), 14709 slide_index = parseFloat( $bullet.attr('data-key') ); 14710 $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]); 14711 }); 14712 $nav.on('click', '.uncode-nav-prev', function(){ 14713 $carousel.trigger('prev.owl.carousel', [navSpeed]); 14714 }); 14715 $nav.on('click', '.uncode-nav-next', function(){ 14716 $carousel.trigger('next.owl.carousel', [navSpeed]); 14717 }); 14718 14719 if ( $nav.hasClass('animated-arrows') ) { 14720 $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){ 14721 $(this).addClass("hover"); 14722 }).on('animationend', function(){ 14723 $(this).removeClass("hover"); 14724 }); 14725 } 14726 14727 var positionNav = function(){ 14728 if ( $nav.hasClass('window-width') ) { 14729 var navOff = parseFloat( $nav.offset().left ) * -1; 14730 if ( navOff > 0 ) { 14731 $inner.css({ transform: 'translateX(' + navOff + 'px)' }); 14732 } else { 14733 $inner.css({ transform: 'none' }); 14734 } 14735 } 14736 } 14737 positionNav(); 14738 $(window).on('resize', positionNav); 14739 }); 14740 14741 $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended'); 14742}; 14743 14744 UNCODE.init = function() { 14745 var wfl_check = false, wfl_request, waypoint_request; 14746 UNCODE.preventDoubleTransition(); 14747 UNCODE.betterResize(); 14748 UNCODE.utils(); 14749 UNCODE.magnetic(); 14750 if (typeof UNCODE.rowParallax !== 'undefined') { 14751 UNCODE.rowParallax(); 14752 } 14753 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 14754 UNCODE.changeSkinOnScroll(); 14755 } 14756 if (typeof UNCODE.share !== 'undefined') { 14757 UNCODE.share(); 14758 } 14759 if (typeof UNCODE.tooltip !== 'undefined') { 14760 UNCODE.tooltip(); 14761 } 14762 if (typeof UNCODE.counters !== 'undefined') { 14763 UNCODE.counters(); 14764 } 14765 if (typeof UNCODE.countdowns !== 'undefined') { 14766 UNCODE.countdowns(); 14767 } 14768 if (typeof UNCODE.tabs !== 'undefined') { 14769 UNCODE.tabs(); 14770 } 14771 if (typeof UNCODE.collapse !== 'undefined') { 14772 UNCODE.collapse(); 14773 } 14774 if (typeof UNCODE.bigText !== 'undefined') { 14775 UNCODE.bigText(); 14776 } 14777 UNCODE.menuSystem(); 14778 if (typeof UNCODE.bgChanger !== 'undefined') { 14779 UNCODE.bgChanger(); 14780 } 14781 if (typeof UNCODE.magicCursor !== 'undefined') { 14782 UNCODE.magicCursor(); 14783 } 14784 if (typeof UNCODE.magneticCursor !== 'undefined') { 14785 UNCODE.magneticCursor(); 14786 } 14787 if (typeof UNCODE.dropImage !== 'undefined') { 14788 UNCODE.dropImage(); 14789 } 14790 if (typeof UNCODE.postTable !== 'undefined') { 14791 UNCODE.postTable(); 14792 } 14793 if (typeof UNCODE.rotatingTxt !== 'undefined') { 14794 UNCODE.rotatingTxt(); 14795 } 14796 if (typeof UNCODE.okvideo !== 'undefined') { 14797 UNCODE.okvideo(); 14798 window.addEventListener( "uncode-more-items-loaded", function() { 14799 UNCODE.okvideo("uncode-more-items-loaded"); 14800 }); 14801 } 14802 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 14803 UNCODE.backgroundSelfVideos(); 14804 } 14805 UNCODE.tapHover(); 14806 if (typeof UNCODE.isotopeLayout !== 'undefined') { 14807 UNCODE.isotopeLayout(); 14808 } 14809 if (typeof UNCODE.justifiedGallery !== 'undefined') { 14810 UNCODE.justifiedGallery(); 14811 } 14812 if (typeof UNCODE.cssGrid !== 'undefined') { 14813 UNCODE.cssGrid(); 14814 } 14815 if (typeof UNCODE.linearGrid !== 'undefined') { 14816 UNCODE.linearGrid(); 14817 } 14818 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 14819 UNCODE.lightbox(); 14820 } 14821 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 14822 $(window).on('load more-items-loaded',function(){ 14823 UNCODE.lightgallery(); 14824 }); 14825 } 14826 if (typeof UNCODE.carousel !== 'undefined') { 14827 UNCODE.carousel($('body')); 14828 } 14829 if (typeof UNCODE.lettering !== 'undefined') { 14830 UNCODE.lettering(); 14831 } 14832 UNCODE.animations(); 14833 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 14834 UNCODE.stickyElements(); 14835 } 14836 if (typeof UNCODE.twentytwenty !== 'undefined') { 14837 UNCODE.twentytwenty(); 14838 } 14839 UNCODE.disableHoverScroll(); 14840 UNCODE.printScreen(); 14841 if (typeof UNCODE.particles !== 'undefined') { 14842 UNCODE.particles(); 14843 } 14844 if (typeof UNCODE.filters !== 'undefined') { 14845 UNCODE.filters(); 14846 } 14847 if (typeof UNCODE.ajax_filters !== 'undefined') { 14848 UNCODE.ajax_filters(); 14849 } 14850 if (typeof UNCODE.widgets !== 'undefined') { 14851 UNCODE.widgets(); 14852 } 14853 if (typeof UNCODE.unmodal !== 'undefined') { 14854 UNCODE.unmodal(); 14855 } 14856 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 14857 if ( !UNCODE.isFullPage ) { 14858 UNCODE.checkScrollForTabs(); 14859 } 14860 } 14861 if (typeof UNCODE.onePage !== 'undefined') { 14862 UNCODE.onePage(UNCODE.isMobile); 14863 } 14864 if (typeof UNCODE.fullPage !== 'undefined') { 14865 $(document).ready(function(){ 14866 UNCODE.fullPage(); 14867 }); 14868 } 14869 if (typeof UNCODE.skewIt !== 'undefined') { 14870 UNCODE.skewIt(); 14871 } 14872 if (typeof UNCODE.rotateIt !== 'undefined') { 14873 UNCODE.rotateIt(); 14874 } 14875 if (typeof UNCODE.textMarquee !== 'undefined') { 14876 UNCODE.textMarquee(); 14877 } 14878 if (typeof UNCODE.stickyScroll !== 'undefined') { 14879 UNCODE.stickyScroll(); 14880 } 14881 if (typeof UNCODE.stickyTrigger !== 'undefined') { 14882 UNCODE.stickyTrigger(); 14883 } 14884 if (typeof UNCODE.areaTextReveal !== 'undefined') { 14885 UNCODE.areaTextReveal(); 14886 }
14887 if (typeof UNCODE.thumbsReveal !== 'undefined') { 14888 UNCODE.thumbsReveal(); 14889 } 14890 if (typeof UNCODE.verticalText !== 'undefined') { 14891 UNCODE.verticalText(); 14892 } 14893 if (typeof UNCODE.videoThumbs !== 'undefined') { 14894 UNCODE.videoThumbs(); 14895 } 14896 if (typeof UNCODE.revslider !== 'undefined') { 14897 UNCODE.revslider(); 14898 } 14899 if (typeof UNCODE.layerslider !== 'undefined') { 14900 UNCODE.layerslider(); 14901 } 14902 if (typeof UNCODE.lottie !== 'undefined') { 14903 UNCODE.lottie(); 14904 } 14905 if (typeof UNCODE.inlineImgs !== 'undefined') { 14906 UNCODE.inlineImgs(); 14907 } 14908 if (typeof UNCODE.animatedBgGradient !== 'undefined') { 14909 UNCODE.animatedBgGradient(); 14910 } 14911 if (typeof UNCODE.readMoreCol !== 'undefined') { 14912 UNCODE.readMoreCol(); 14913 } 14914 if (typeof UNCODE.multibg !== 'undefined') { 14915 UNCODE.multibg(); 14916 } 14917 if (typeof UNCODE.flexEqual !== 'undefined') { 14918 UNCODE.flexEqual(); 14919 } 14920 $(window).on('load',function(){ 14921 clearRequestTimeout(waypoint_request); 14922 waypoint_request = requestTimeout( function(){ 14923 Waypoint.refreshAll(); 14924 }, 1000); 14925 }); 14926 $(window).one('load',function(){ 14927 if (typeof UNCODE.parallax !== 'undefined') { 14928 UNCODE.parallax(); 14929 } 14930 }); 14931 } 14932 14933 if ( ! SiteParameters.is_frontend_editor ) { 14934 UNCODE.init(); 14935 } 14936 14937 14938})(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.