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 $('li[data-network]', share_button_element).each(function(){ 986 var label = SiteParameters.uncode_share_label, 987 network = $(this).attr('data-network'); 988 label = label.replace("%", network); 989 $(this).attr('aria-label', label); 990 }); 991 } 992}; 993 994UNCODE.tooltip = function() { 995 if (typeof jQuery.fn.tooltip !== 'undefined') { 996 $('.btn-tooltip').tooltip(); 997 } 998}; 999 1000UNCODE.counters = function() { 1001 var $counters = $('.uncode-counter:not(.counter-init)'); 1002 $counters.each(function(){ 1003 var $counter = $(this).addClass('counter-init'); 1004 if ( SiteParameters.is_frontend_editor ) { 1005 $counter.addClass('started'); 1006 } 1007 if ( $counter.closest( '.owl-carousel' ).length ) { 1008 return; 1009 } 1010 $counter.addClass('started').counterUp({ 1011 delay: 10, 1012 time: 1500 1013 }); 1014 }); 1015}; 1016 1017UNCODE.countdowns = function() { 1018 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 1019 $countdowns.each(function() { 1020 var $this = $(this).addClass('counter-init'), 1021 finalDate = $(this).data('uncode-countdown'); 1022 $this.countdown(finalDate, function(event) { 1023 $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>')); 1024 }); 1025 }); 1026}; 1027 1028UNCODE.tabs = function() { 1029 1030 var tabSwitcher = function($el){ 1031 $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vert
1031ical):not(.tab-switch)', $el).each(function(key, value){ 1032 var $navs = $(value), 1033 $active = $('li.active', $navs), 1034 $active_a = $('> a', $active), 1035 $active_span = $('> span', $active_a), 1036 vertical = $navs.closest('.vertical-tab-menu').length; 1037 1038 if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { 1039 $navs.append('<span class="switcher-cursor" aria-hidden="true" tabindex="-1" />'); 1040 } 1041 1042 var $cursor = $('.switcher-cursor', $navs), 1043 active_w = $('a', $active).outerWidth(), 1044 span_w = $active_span.outerWidth(), 1045 active_pos = $active.position(), 1046 active_a_pos = $active_a.position(), 1047 span_pos = $active_span.position(), 1048 cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w, 1049 cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; 1050 1051 cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); 1052 1053 if ( ! vertical ) { 1054 $cursor.css({ 1055 left: cursor_left, 1056 width: cursor_w 1057 }); 1058 } 1059 1060 $navs.addClass('switch-init'); 1061 }); 1062 }; 1063 1064 var $body = $('body'); 1065 tabSwitcher($body); 1066 1067 var tabHoverIntent = function(){ 1068 var setHover; 1069 $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') 1070 .on('mouseover', function(e){ 1071 var $this = $(e.target); 1072 setHover = requestTimeout(function() { 1073 $this.trigger('hover-int'); 1074 }, 50); 1075 }) 1076 .on('mouseout', function(){ 1077 clearRequestTimeout(setHover); 1078 }); 1079 }; 1080 tabHoverIntent(); 1081 1082 var tabInit = function(){ 1083 $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { 1084 e.preventDefault() 1085 var $el = $(this); 1086 $el.tab('show'); 1087 var $container = $el.closest('.uncode-tabs'); 1088 tabSwitcher($container); 1089 requestTimeout(function() { 1090 window.dispatchEvent(UNCODE.boxEvent); 1091 var $tabs = $(e.currentTarget).closest('.uncode-tabs'); 1092 1093 if ( $tabs.hasClass('tabs-trigger-box-resized') ) { 1094 window.dispatchEvent(new CustomEvent('boxResized')); 1095 } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { 1096 window.dispatchEvent(new Event('resize')); 1097 $(window).trigger('uncode.re-layout'); 1098 } 1099 1100 var $active_panel = $('.tab-pane.active', $tabs); 1101 1102 $.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) { 1103 var element = $(val), 1104 delayAttr = element.attr('data-delay'); 1105 if (delayAttr == undefined) delayAttr = 0; 1106 requestTimeout(function() { 1107 element.addClass('start_animation'); 1108 }, delayAttr); 1109 }); 1110 1111 }, 300); 1112 1113 var $li = $el.closest('li'), 1114 mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 1115 $('li', $container).not($li).find('.tab-pane').slideUp(250) 1116 $('.tab-pane', $li).slideDown(250); 1117 var completeSlideDown = requestTimeout(function(){ 1118 if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { 1119 var pos = $el.offset(), 1120 rect = $el[0].getBoundingClientRect(), 1121 $masthead = $('#masthead > .menu-container'), 1122 considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; 1123 1124 if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { 1125 $('html, body').animate({ 1126 scrollTop: ( pos.top ) - considerMenu 1127 },{ 1128 easing: 'easeInOutQuad', 1129 duration: 250 1130 }); 1131 } 1132 } 1133 }, 260); 1134 }); 1135 } 1136 tabInit(); 1137 1138 var tabResponsive = function(){ 1139 if ( SiteParameters.is_frontend_editor ) { 1140 return true; 1141 } 1142 var $tabContainers = $('.tab-container.tabs-breakpoint'); 1143 $tabContainers.each(function(){ 1144 var $tabContainer = $(this), 1145 $tabContent = $('.tab-content', $tabContainer), 1146 $nav = $('.nav-tabs', $tabContainer), 1147 mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 1148 1149 $('> li', $nav).each(function(){ 1150 var $li = $(this), 1151 dataID = $li.attr('data-tab-id'); 1152 1153 if ( UNCODE.wwidth <= mQuery ) { 1154 if ( ! $('.tab-pane', $li ).length ) { 1155 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); 1156 $tabContainer.addClass('tabs-appended'); 1157 $li.append($append_pane); 1158 } 1159 1160 if ( $li.hasClass('active') ) { 1161 $('> a', $li).click(); 1162 } 1163 } else { 1164 if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { 1165 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); 1166 $tabContainer.removeClass('tabs-appended');
1167 $tabContent.prepend($append_pane.removeAttr('style')); 1168 } 1169 } 1170 }); 1171 }); 1172 1173 } 1174 tabResponsive(); 1175 1176 $(window).on('wwResize', function(){ 1177 tabHoverIntent(); 1178 tabSwitcher($body); 1179 }); 1180 1181 var setCTA; 1182 $(window).on( 'resize', function(){ 1183 clearRequestTimeout(setCTA); 1184 setCTA = requestTimeout( tabResponsive, 100 ); 1185 }); 1186 1187 $('.nav-tabs').each(function(){ 1188 var $nav = $(this), 1189 $lis = $('> li:not(.active)', $nav), 1190 $links = $('.tab-excerpt-link', $nav); 1191 $('.tab-excerpt', $lis).slideUp(400, function(){ 1192 $(this).addClass('init'); 1193 }); 1194 1195 $links.each(function(){ 1196 var $link = $(this), 1197 $par_a = $link.closest('a'), 1198 href = $link.attr('data-href'), 1199 target = $link.attr('data-target'); 1200 $par_a.addClass('inner-link'); 1201 $link.on('click', function(){ 1202 var _link = document.createElement('a'); 1203 _link.href = href; 1204 _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; 1205 _link.click(); 1206 }); 1207 }); 1208 $nav.addClass('tab-init'); 1209 }); 1210 1211 $('.uncode-tabs.tabs-no-lazy').each(function(){ 1212 var $tabs = $(this), 1213 $panes = $('.tab-pane:not(.active)', $tabs); 1214 $panes.each(function(){ 1215 var $pane = $(this), 1216 $imgs = $('img[loading="lazy"]', $pane); 1217 $imgs.removeAttr('loading'); 1218 $imgs.removeAttr('decoding'); 1219 }); 1220 }); 1221 1222}; 1223UNCODE.collapse = function() { 1224 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 1225 var $this = $(this), 1226 href 1227 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 1228 var $target = $(target) 1229 var parent = $this.attr('data-parent') 1230 var $parent = parent && $(parent) 1231 var $title = $(this).parent() 1232 var $accordion = $(e.target).closest('.uncode-accordion') 1233 var $group = $this.closest('.group') 1234 var $panel_group = $this.closest('.panel-group') 1235 if ($parent) { 1236 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 1237 if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { 1238 $title.removeClass('active'); 1239 $group.removeClass('active-group'); 1240 } else { 1241 if ( $panel_group.attr('data-no-toggle') != true ) { 1242 $parent.find('.panel-title').removeClass('active') 1243 $parent.find('.group').removeClass('active-group') 1244 } 1245 $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') 1246 $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') 1247 } 1248 } 1249 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 1250 requestTimeout(function() { 1251 var $accordion = $(e.target).closest('.uncode-accordion'); 1252 if ( $accordion.hasClass('tabs-trigger-box-resized') ) { 1253 window.dispatchEvent(new CustomEvent('boxResized')); 1254 } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { 1255 window.dispatchEvent(new Event('resize')); 1256 $(window).trigger('uncode.re-layout'); 1257 } 1258 1259 var $active_panel = $('.panel.active-group', $parent); 1260 1261 $.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) { 1262 var element = $(val), 1263 delayAttr = element.attr('data-delay'); 1264 if (delayAttr == undefined) delayAttr = 0; 1265 requestTimeout(function() { 1266 element.addClass('start_animation'); 1267 }, delayAttr); 1268 }); 1269 1270 }, 500); 1271 }); 1272 1273 $('.uncode-accordion.tabs-no-lazy').each(function(){ 1274 var $accordion = $(this), 1275 $panes = $('.panel:not(.active-group)', $accordion); 1276 $panes.each(function(){ 1277 var $pane = $(this), 1278 $imgs = $('img[loading="lazy"]', $pane); 1279 $imgs.removeAttr('loading'); 1280 $imgs.removeAttr('decoding'); 1281 }); 1282 }); 1283}; 1284 1285UNCODE.accessibility = function() { 1286 if ( ! SiteParameters.uncode_is_accessible ) { 1287 return; 1288 } 1289 1290 // 1291 1292}; 1293UNCODE.bigText = function(el) { 1294 var bigTextLaunch = function(){ 1295 if (el == undefined) { 1296 el = $('body'); 1297 } 1298 $.each($('.bigtext', el), function(index, val) { 1299 $(val).bigtext({ 1300 minfontsize: 24 1301 }); 1302 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 1303 opacity: 1 1304 }); 1305 requestTimeout(function() { 1306 if ($(val).find('.animate_when_almost_visible').length != 0) { 1307 $(val).css({opacity: 1}); 1308 } 1309 }, 400); 1310 }); 1311 }; 1312 1313 if ( UNCODE.wwidth > UNCODE.mediaQuery ) { 1314 bigTextLaunch(); 1315 } 1316 $(window).on( 'load', bigTextLaunch ); 1317}; 1318 1319UNCODE.process_shortpixel_image = function(image) { 1320 var data = { 1321 action: 'shortpixel_manual_optimization', 1322 image_id: image,
1323 cleanup: true 1324 }; 1325 1326 $.get(SiteParameters.ajax_url, data); 1327}; 1328 1329UNCODE.menuSystem = function() { 1330 1331 function menuMobile() { 1332 var $body = $('body'), 1333 scrolltop, 1334 $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), 1335 $masthead = $('#masthead'), 1336 $box, 1337 $el, 1338 $el_transp, 1339 elHeight, 1340 offCanvasAnim, 1341 check, 1342 animating = false, 1343 stickyMobile = false, 1344 menuClose = new CustomEvent('menuMobileClose'), 1345 menuOpen = new CustomEvent('menuMobileOpen'); 1346 UNCODE.menuOpened = false; 1347 $mobileToggleButton.on('click', function(event) { 1348 event.stopPropagation(); 1349 var btn = this; 1350 if ($(btn).hasClass('overlay-close')) return; 1351 event.preventDefault(); 1352 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 1353 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 1354 $box = $(this).closest('.box-container').find('.main-menu-container'); 1355 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 1356 $el_transp = $('.menu-absolute.menu-transparent'); 1357 if (UNCODE.isMobile) { 1358 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 ) { 1359 stickyMobile = true; 1360 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 1361 } else { 1362 elHeight = 0; 1363 $.each($box.find('> div'), function(index, val) { 1364 elHeight += $(val).outerHeight(); 1365 }); 1366 } 1367 } else { 1368 elHeight = 0; 1369 $.each($el, function(index, val) { 1370 elHeight += $(val).outerHeight(); 1371 }); 1372 } 1373 var open = function() { 1374 clearTimeout(offCanvasAnim); 1375 if (!animating) { 1376 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 1377 scrolltop = $(window).scrollTop(); 1378 window.dispatchEvent(menuOpen); 1379 animating = true; 1380 UNCODE.menuOpened = true; 1381 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 1382 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 1383 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1384 } 1385 if ($('body.menu-offcanvas').length) { 1386 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1387 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1388 } else { 1389 if ( $('.menu-hide, .menu-sticky').length ) { 1390 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 1391 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1392 } 1393 } 1394 } 1395 } 1396 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { 1397 //$("#masthead")[0].scrollIntoView(); 1398 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1399 } 1400 $box.addClass('open-items'); 1401 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 1402 $el_transp.addClass('is_mobile_open'); 1403 } 1404 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1405 btn.classList.add('close'); 1406 $box.animate({ 1407 height: elHeight 1408 }, 600, "easeInOutCirc", function() { 1409 animating = false; 1410 if (!stickyMobile) $box.css('height', 'auto'); 1411 }); 1412 } else { 1413 animating = false; 1414 } 1415 } 1416 }; 1417 1418 var close = function() { 1419 clearTimeout(offCanvasAnim); 1420 if (!animating) { 1421 window.dispatchEvent(menuClose); 1422 animating = true; 1423 UNCODE.menuOpened = false;
1424 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1425 btn.classList.remove('close'); 1426 btn.classList.add('closing'); 1427 } 1428 $box.addClass('close'); 1429 requestTimeout(function() { 1430 $box.removeClass('close'); 1431 $box.removeClass('open-items'); 1432 btn.classList.remove('closing'); 1433 if ($el_transp.length) { 1434 $el_transp.removeClass('is_mobile_open'); 1435 } 1436 }, 500); 1437 $body.removeClass('opening-overlay-menu'); 1438 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1439 $box.animate({ 1440 height: 0 1441 }, { 1442 duration: 600, 1443 easing: "easeInOutCirc", 1444 complete: function(elements) { 1445 $(elements).css('height', ''); 1446 animating = false; 1447 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 1448 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 1449 } 1450 $body.removeClass('open-overlay-menu'); 1451 } 1452 }); 1453 } else { 1454 animating = false; 1455 offCanvasAnim = setTimeout(function(){ 1456 $body.removeClass('open-overlay-menu'); 1457 }, 1000); 1458 } 1459 } 1460 }; 1461 check = (!UNCODE.menuOpened) ? open() : close(); 1462 } 1463 }); 1464 1465 $('html').on('click', function(event){ 1466 if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { 1467 $('.uncode-close-offcanvas-mobile').trigger('click'); 1468 } 1469 }); 1470 1471 window.addEventListener('menuMobileTrigged', function(e) { 1472 $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); 1473 }); 1474 window.addEventListener('orientationchange', function(e) { 1475 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 1476 }); 1477 window.addEventListener("resize", function() { 1478 if ($(window).width() < UNCODE.mediaQuery) { 1479 if (UNCODE.isMobile) { 1480 var $box = $('.box-container .main-menu-container'), 1481 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 1482 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 1483 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 1484 elHeight = 0; 1485 $.each($el, function(index, val) { 1486 elHeight += $(val).outerHeight(); 1487 }); 1488 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; 1489 $($box).css('height', elHeight + 'px'); 1490 } 1491 } 1492 } 1493 } else { 1494 $('.menu-hide-vertical').removeAttr('style'); 1495 $('.menu-container-mobile').removeAttr('style'); 1496 $('.vmenu-container.menu-container').removeAttr('style'); 1497 } 1498 }); 1499 1500 $(window).on('scroll', function(){ 1501 if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { 1502 $(window).scrollTop(scrolltop); 1503 return false; 1504 } 1505 }); 1506 1507 }; 1508 1509 function menuOffCanvas() { 1510 var menuClose = new CustomEvent('menuCanvasClose'), 1511 menuOpen = new CustomEvent('menuCanvasOpen'); 1512 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { 1513 if ($(window).width() > UNCODE.mediaQuery) { 1514 if ( $('body.vmenu-offcanvas-overlay').length ) { 1515 if ($(event.currentTarget).hasClass('off-close')) { 1516 $(event.currentTarget).removeClass('off-close'); 1517 requestTimeout(function() { 1518 window.dispatchEvent(menuClose); 1519 }, 500); 1520 1521 } else { 1522 $(event.currentTarget).addClass('off-close'); 1523 window.dispatchEvent(menuOpen); 1524 } 1525 } else { 1526 if ($(event.currentTarget).hasClass('close')) { 1527 $(event.currentTarget).removeClass('close'); 1528 $(event.currentTarget).addClass('closing'); 1529 requestTimeout(function() { 1530 $(event.currentTarget).removeClass('closing'); 1531 window.dispatchEvent(menuClose); 1532 }, 500); 1533 1534 } else { 1535 $(event.currentTarget).addClass('close'); 1536 window.dispatchEvent(menuOpen); 1537 } 1538 } 1539 } 1540 1541 $('body').toggleClass('off-opened'); 1542 }); 1543 1544 $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ 1545 if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { 1546 var $vMenuCont = $('#masthead .vmenu-container'), 1547 $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), 1548 1549 vmenu_h = parseFloat( $vMenuCont.outerHeight() ), 1550 vmenu_w = parseFloat( $vMenuCont.outerWidth() ), 1551 vmenu_off = $vMenuCont.offset(), 1552 vmenu_l = parseFloat(vmenu_off.left), 1553 vmenu_t = parseFloat(vmenu_off.top), 1554 vmenu_r = vmenu_l + vmenu_w, 1555 vmenu_b = vmenu_t + vmenu_h, 1556 1557 close_h = parseFloat( $close_menu.outerHeight() ), 1558 close_w = parseFloat( $close_menu.outerWidth() ), 1559 close_off = $close_menu.offset(), 1560 close_l = parseFloat(close_off.left), 1561 close_t = parseFloat(close_off.top), 1562 close_r = close_l + close_w, 1563 close_b = close_t + close_h; 1564 if ( 1565 !( 1566 e.clientX > vmenu_l && 1567 e.clientX < vmenu_r && 1568 e.clientY > vmenu_t && 1569 e.clientY < vmenu_b 1570 ) 1571 || 1572 ( 1573 e.clientX > close_l && 1574 e.clientX < close_r && 1575 e.clientY > close_t && 1576 e.clientY < close_b 1577 ) 1578 ) { 1579 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); 1580 } 1581 } 1582 }); 1583 }; 1584 1585 function menuOverlay() { 1586 if ( $('.overlay').length ) { 1587 $('.overlay').removeClass('hidden'); 1588 } 1589 if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { 1590 $('.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) { 1591 var transDelay = (index / 20) + 0.1; 1592 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1593 transDelay = transDelay + 0.3; 1594 $(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'); 1595 }); 1596 } 1597 1598 }; 1599 var $secondary_parent; 1600 function menuAppend() { 1601 var $body = $('body'), 1602 $menuCont = $('.menu-container:not(.vmenu-container)'), 1603 $vMenuCont = $('.menu-container.vmenu-container'), 1604 $cta = $('.navbar-cta'), 1605 $socials = $('.navbar-social:not(.appended-navbar)'), 1606 $ul = $('.navbar-main ul.menu-primary-inner'), 1607 $ulCta, 1608 $ulSocials, 1609 $navLast, 1610 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1611 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1612 $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), 1613 $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), 1614 $ulFirst = $('> ul', $firstNav), 1615 $ulSecond = $('> ul', $secondNav), 1616 setCTA, 1617 appendCTA = function(){ 1618 return true; 1619 }, 1620 appendSocials = function(){ 1621 return true; 1622 }, 1623 appendSplit = function(){ 1624 return true; 1625 }; 1626 1627 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1628 $ulCta = $('> ul', $cta); 1629 $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); 1630 1631 appendCTA = function(){ 1632 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1633 $ul.after($ulCta); 1634 } else { 1635 $cta.append($ulCta); 1636 } 1637 } 1638 } 1639 1640 if ( ! $body.hasClass('cta-not-appended') ) { 1641 appendCTA(); 1642 } 1643 1644 var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); 1645 $smartSocial.each(function(){ 1646 var $_smartSocial = $(this); 1647 $('> li', $_smartSocial).each(function(){ 1648 var $li = $(this); 1649 if ( $li.hasClass('mobile-hidden') ) { 1650 $_smartSocial.addClass('mobile-hidden'); 1651 } else { 1652 $_smartSocial.removeClass('mobile-hidden'); 1653 return false;
1654 } 1655 }); 1656 1657 $('> li', $_smartSocial).each(function(){ 1658 var $li = $(this); 1659 if ( $li.hasClass('tablet-hidden') ) { 1660 $_smartSocial.addClass('tablet-hidden'); 1661 } else { 1662 $_smartSocial.removeClass('tablet-hidden'); 1663 return false; 1664 } 1665 }); 1666 }); 1667 1668 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { 1669 $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); 1670 if ( $body.hasClass('hmenu-center-split') ) { 1671 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1672 } else { 1673 $navLast = $('.navbar-nav-last', $vMenuCont); 1674 } 1675 1676 if ( ! $navLast.length ) { 1677 var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />'); 1678 if ( $body.hasClass('hmenu-center-split') ) { 1679 $('.menu-horizontal-inner', $menuCont).append(_navLast); 1680 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1681 } else { 1682 $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); 1683 $navLast = $('.navbar-nav-last', $vMenuCont); 1684 } 1685 } 1686 1687 appendSocials = function(){ 1688 if ( !$body.hasClass('menu-overlay-center') ) { 1689 // if ( !$navLast.find('ul.menu-smart-social').length ) { 1690 // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); 1691 // $navLast.append('<ul class="menu-smart menu-smart-social" />'); 1692 // $ulSocials.each(function(){ 1693 // var $li_social = $(this); 1694 // $navLast.find('ul.menu-smart-social').append($li_social); 1695 // }); 1696 // } 1697 // } else { 1698 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1699 $socials.addClass('mobile-hidden').addClass('tablet-hidden') 1700 if ( ! $('> ul.menu-smart-social li', $socials).length ) { 1701 $('> ul.menu-smart-social li', $socials).remove(); 1702 } 1703 $navLast.append($ulSocials); 1704 } else { 1705 if ( ! $('> ul.menu-smart-social li', $navLast).length ) { 1706 $('> ul.menu-smart-social li', $navLast).remove(); 1707 } 1708 $socials.append($ulSocials); 1709 } 1710 } 1711 } 1712 appendSocials(); 1713 } 1714 1715 if ( $vMenuCont.length ) { 1716 var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); 1717 } else { 1718 var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); 1719 } 1720 if ( $accordion_secondary.length ) { 1721 var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); 1722 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1723 if ( !$accordion_secondary_ph.length ) { 1724 $accordion_secondary.after('<span class="accordion-secondary-ph" />'); 1725 } 1726 if ( $vMenuCont.length ) { 1727 $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); 1728 } else { 1729 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1730 $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); 1731 } else { 1732 $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); 1733 } 1734 } 1735 } else { 1736 if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { 1737 $accordion_secondary_ph.before($accordion_secondary); 1738 } 1739 } 1740 } 1741 1742 if ( $vMenuCont.length ) { 1743 var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); 1744 } else { 1745 var $extra_icons = $('.navbar-extra-icons', $menuCont); 1746 } 1747 1748 if ( $extra_icons.length ) { 1749 if ( $vMenuCont.length ) { 1750 if ( $('li:not(.social-icon)', $extra_icons).length ) { 1751 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1752 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1753 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1754 $not_social.each(function(){ 1755 if ( ! $primary_after.length ) { 1756 $('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />'); 1757 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1758 $primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />'); 1759 } 1760 var $extra_li = $(this); 1761 $primary_after.find('> ul').append($extra_li); 1762 }); 1763 } else { 1764 var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), 1765 $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1766 $not_social.each(function(){ 1767 var $extra_li = $(this); 1768 $extra_icons.find('> ul').append($extra_li); 1769 }); 1770 } 1771 } /*else { 1772 var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); 1773 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1774 if ( !$extra_icons_ph.length ) { 1775 $extra_icons.after('<span class="extra-icons-ph" />'); 1776 } 1777 if ( $('.navbar-accordion-cta', $vMenuCont).length ) { 1778 $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); 1779 } else { 1780 $('.menu-accordion-primary', $vMenuCont).after($extra_icons); 1781 } 1782 } else { 1783 if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { 1784 $extra_icons_ph.before($extra_icons); 1785 } 1786 } 1787 }*/ 1788 } else { 1789 if ( ! $body.hasClass('hmenu-center-double') ) { 1790 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1791 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1792 $primary_after = $('.nav.navbar-main-after', $menuCont); 1793 1794 if ( ! $primary_after.length && $not_social.length ) { 1795 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1796 $('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />'); 1797 } else { 1798 $('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />'); 1799 } 1800 $primary_after = $('.nav.navbar-main-after', $menuCont); 1801 $primary_after.append('<ul class="menu-smart sm menu-smart-social" role="menu" />'); 1802 } 1803 var tablet_hidden = true, 1804 mobile_hidden = true; 1805 $not_social.each(function(){ 1806 var $extra_li = $(this); 1807 $primary_after.find('> ul').append($extra_li); 1808 if ( ! $extra_li.hasClass('tablet-hidden') ) { 1809 tablet_hidden = false;
1810 } 1811 if ( ! $extra_li.hasClass('mobile-hidden') ) { 1812 mobile_hidden = false; 1813 } 1814 }); 1815 if ( tablet_hidden === true && $not_social.length ) { 1816 $primary_after.addClass('tablet-hidden'); 1817 } 1818 if ( mobile_hidden === true && $not_social.length ) { 1819 $primary_after.addClass('mobile-hidden'); 1820 } 1821 } else { 1822 var $primary_after = $('.nav.navbar-main-after', $menuCont); 1823 1824 if ( $primary_after.length ) { 1825 var $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1826 $not_social.each(function(){ 1827 var $extra_li = $(this); 1828 $extra_icons.find('> ul').append($extra_li); 1829 }); 1830 $primary_after.remove(); 1831 } 1832 } 1833 } 1834 } 1835 } 1836 1837 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1838 appendSplit = function(){ 1839 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1840 if ( $extra_icons.length ) { 1841 if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { 1842 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1843 $append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />'); 1844 $not_social.each(function(){ 1845 var $extra_li = $(this); 1846 $append_ul.append($extra_li); 1847 }); 1848 if ( $secondNav.length ) { 1849 $secondNav.append($append_ul); 1850 } else { 1851 $('.menu-horizontal-inner', $menuCont).prepend($append_ul); 1852 } 1853 } 1854 } 1855 if ( $secondNav.length ) { 1856 $secondNav.prepend($ulFirst); 1857 } else { 1858 $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); 1859 } 1860 $firstMenu.hide(); 1861 } else { 1862 $firstNav.append($ulFirst); 1863 var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); 1864 if ( $append_ul.length ) { 1865 var $not_social = $('> li:not(.social-icon)', $append_ul); 1866 $not_social.each(function(){ 1867 var $extra_li = $(this); 1868 $extra_icons.find('> ul').append($extra_li); 1869 }); 1870 } 1871 $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); 1872 $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); 1873 $firstMenu.css({ 1874 'display': 'table-cell' 1875 }); 1876 } 1877 } 1878 } 1879 appendSplit(); 1880 1881 $(window).on( 'wwresize', function(){ 1882 clearRequestTimeout(setCTA); 1883 setCTA = requestTimeout( function() { 1884 appendCTA(); 1885 appendSocials(); 1886 appendSplit(); 1887 }, 10 ); 1888 }); 1889 } 1890 //menuMobileButton(); 1891 menuMobile(); 1892 menuOffCanvas(); 1893 menuAppend(); 1894 menuOverlay(); 1895 1896 var stickyDropdownSearch = function(){ 1897 var $masthead = $('#masthead'), 1898 $ddSearch = $('.overlay.overlay-search', $masthead), 1899 $styles = $('#stickyDropdownSearch').remove(); 1900 if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { 1901 var $menuWrapper = $('.menu-wrapper'), 1902 $navbar = $('.menu-container-mobile', $menuWrapper), 1903 navbarH = $navbar.outerHeight(), 1904 //$topbar = $('.top-menu', $menuWrapper), 1905 //topbarH = $topbar.outerHeight(), 1906 _css; 1907 1908 _css = '<style id="stickyDropdownSearch">'; 1909 _css += '@media (max-width: 959px) {'; 1910 _css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {'; 1911 _css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;'; 1912 _css += '}'; 1913 _css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {'; 1914 _css += 'position: fixed;'; 1915 _css += 'top: 0;'; 1916 _css += '}'; 1917 _css += '</style>'; 1918 1919 $(_css).appendTo($('head')); 1920 } 1921 } 1922 stickyDropdownSearch(); 1923 1924 var setMenuOverlay; 1925 $(window).on( 'wwResize', function(){ 1926 if ( $('.overlay').length && $(window).width() > 1024 ) { 1927 $('.overlay').addClass('hidden'); 1928 } 1929 clearRequestTimeout(setMenuOverlay); 1930 setMenuOverlay = requestTimeout( function(){ 1931 menuOverlay(); 1932 menuAppend(); 1933 stickyDropdownSearch(); 1934 }, 150 ); 1935 }); 1936 UNCODE.menuSmartInit(); 1937}; 1938 1939UNCODE.menuSmartInit = function() { 1940 var $menusmart = $('[class*="menu-smart"]'), 1941 $masthead = $('#masthead'), 1942 $hMenu = $('.menu-horizontal-inner', $masthead), 1943 $focus = $('.overlay-menu-focus'), 1944 showTimeout = 50, 1945 hideTimeout = 50, 1946 showTimeoutFunc, hideTimeoutFunc; 1947 1948 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1949 $(this).data('hover', true); 1950 }, function(){ 1951 $(this).data('hover', false); 1952 }); 1953 1954 $('> li.menu-item-has-children', $menusmart).each(function(){ 1955 var $a = $('> a', this).attr('aria-haspopup', 'true').attr('aria-expanded', 'false') 1956 }); 1957 1958 $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ 1959 e.preventDefault(); 1960 }); 1961 1962 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1963 var $notLis = $('> .nav > ul > li a', $hMenu), 1964 $menuA = $('a', $masthead).not($notLis), 1965 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1966 showFuncCond = function() { return true }; 1967 1968 if ( $('body').hasClass('focus-megamenu') ) { 1969 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1970 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1971 } else if ( $('body').hasClass('focus-links') ) { 1972 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1973 } 1974 1975 $hoverSelector.hover(function(){ 1976 clearRequestTimeout(hideTimeoutFunc);
1977 showTimeoutFunc = requestTimeout(function(){ 1978 $('body').addClass('navbar-hover'); 1979 }, showTimeout*2); 1980 }, function(){ 1981 hideTimeoutFunc = requestTimeout(function(){ 1982 if ( ! $('.overlay-search.open', $masthead).length ) { 1983 $('body').removeClass('navbar-hover'); 1984 } 1985 }, hideTimeout*2); 1986 }); 1987 } else { 1988 showFuncCond = function() { return false }; 1989 } 1990 1991 if ($menusmart.length > 0) { 1992 $menusmart.smartmenus({ 1993 subIndicators: false, 1994 subIndicatorsPos: 'append', 1995 //subMenusMinWidth: '13em', 1996 subIndicatorsText: '', 1997 showTimeout: showTimeout, 1998 hideTimeout: hideTimeout, 1999 scrollStep: 8, 2000 showFunction: function($ul, complete) { 2001 clearRequestTimeout(showTimeoutFunc); 2002 $ul.fadeIn(0, 'linear', function(){ 2003 complete(); 2004 if ( $ul.hasClass('vc_row') ) { 2005 $ul.css({ 2006 'display': 'table' 2007 }); 2008 } 2009 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 2010 $('body').addClass('open-megamenu'); 2011 } 2012 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 2013 $('body').addClass('navbar-hover'); 2014 } 2015 }).addClass('open-animated'); 2016 }, 2017 hideFunction: function($ul, complete) { 2018 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 2019 $('body').removeClass('open-megamenu'); 2020 } 2021 var fixIE = $('html.ie').length; 2022 if (fixIE) { 2023 var $rowParent = $($ul).closest('.main-menu-container'); 2024 $rowParent.height('auto'); 2025 } 2026 $ul.fadeOut(0, 'linear', function(){ 2027 complete(); 2028 $ul.removeClass('open-animated'); 2029 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 2030 $('body').removeClass('open-submenu'); 2031 } 2032 }); 2033 }, 2034 collapsibleShowFunction: function($ul, complete) { 2035 $ul.slideDown(400, 'easeInOutCirc', complete); 2036 }, 2037 collapsibleHideFunction: function($ul, complete) { 2038 $ul.slideUp(200, 'easeInOutCirc', complete); 2039 }, 2040 hideOnClick: SiteParameters.menuHideOnClick, 2041 }); 2042 2043 if ( $('body').hasClass('menu-accordion-active') ) { 2044 $menusmart.each(function(key, menu){ 2045 $(menu).addClass('menu-smart-init'); 2046 $(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) ); 2047 }); 2048 } 2049 2050 $(document).on( 'uncode.smartmenu-appended', function(){ 2051 requestTimeout(function(){ 2052 $menusmart.smartmenus( 'refresh' ); 2053 }, 1000); 2054 }); 2055 } 2056 2057 $('.main-menu-container').each(function(){ 2058 var $main_cont = $(this), 2059 $uls = $('ul', $main_cont); 2060 2061 $uls.each(function(){ 2062 var $ul = $(this), 2063 mobile_hidden = true, 2064 tablet_hidden = true; 2065 $('> li:not(.hidden)', $ul).each(function(){ 2066 if ( !$(this).hasClass('mobile-hidden') ) { 2067 mobile_hidden = false; 2068 return false; 2069 } 2070 }); 2071 $('> li:not(.hidden)', $ul).each(function(){ 2072 if ( !$(this).hasClass('tablet-hidden') ) { 2073 tablet_hidden = false; 2074 return false; 2075 } 2076 }); 2077 if ( mobile_hidden ) { 2078 $ul.addClass('mobile-hidden'); 2079 } 2080 if ( tablet_hidden ) { 2081 $ul.addClass('tablet-hidden'); 2082 } 2083 }); 2084 2085 var $divUlsMB = $('div:has(>ul.mobile-hidden)'); 2086 2087 $divUlsMB.each(function(){ 2088 var $divUlMB = $(this), 2089 div_mobile_hidden = true, 2090 div_tablet_hidden = true; 2091 2092 $('> ul:not(.hidden)', $divUlMB).each(function(){ 2093 if ( !$(this).hasClass('mobile-hidden') ) { 2094 div_mobile_hidden = false; 2095 return false; 2096 } 2097 }); 2098 $('> ul:not(.hidden)', $divUlMB).each(function(){ 2099 if ( !$(this).hasClass('tablet-hidden') ) { 2100 div_tablet_hidden = false; 2101 return false; 2102 } 2103 }); 2104 if ( div_mobile_hidden ) { 2105 $divUlMB.addClass('mobile-hidden'); 2106 } 2107 if ( div_tablet_hidden ) { 2108 $divUlMB.addClass('tablet-hidden'); 2109 } 2110 }); 2111 }); 2112 2113 var overlaySearchButton = function(){ 2114 var $search_wrap = $('.overlay.overlay-search, .widget_search'); 2115 2116 $search_wrap.each(function(){ 2117 var $form = $('form', this), 2118 $icon = $('i', $form); 2119 2120 $icon.on('click', function(){ 2121 $form.submit(); 2122 }); 2123 }); 2124 }; 2125 overlaySearchButton(); 2126} 2127 2128UNCODE.okvideo = function(ev) { 2129 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 2130 $.okvideo = function(options) { 2131 // if the option var was just a string, turn it into an object 2132 if (typeof options !== 'object') options = { 2133 'video': options 2134 }; 2135 var base = this; 2136 // kick things off 2137 base.init = function() { 2138 base.options = $.extend({}, $.okvideo.options, options); 2139 // support older versions of okvideo 2140 if (base.options.video === null) base.options.video = base.options.source; 2141 base.setOptions(); 2142 var target = base.options.target || $('body'); 2143 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 2144 var zIndex = base.options.controls === 3 ? -999 : "auto"; 2145 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 2146 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>'; 2147 if (OKEvents.utils.isMobile()) { 2148 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>'); 2149 } else { 2150 if (base.options.controls === 3) { 2151 target.append(mask) 2152 } 2153 if (base.options.adproof === 1) { 2154 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>'); 2155 } else { 2156 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>'); 2157 } 2158 } 2159 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 2160 if (base.options.playlist.list === null) { 2161 if (base.options.video.provider === 'youtube') { 2162 base.loadYouTubeAPI(); 2163 } else if (base.options.video.provider === 'vimeo') { 2164 base.options.volume /= 100; 2165 base.loadVimeoAPI(); 2166 } 2167 } else { 2168 base.loadYouTubeAPI(); 2169 } 2170 } 2171 }; 2172 // clean the options 2173 base.setOptions = function() { 2174 // exchange 'true' for '1' and 'false' for 3 2175 for (var key in this.options) { 2176 if (this.options[key] === true) this.options[key] = 1; 2177 if (this.options[key] === false) this.options[key] = 3; 2178 } 2179 if (base.options.playlist.list === null) { 2180 base.options.video = base.determineProvider(); 2181 } 2182 // pass options to the window 2183 $(window).data('okoptions-' + base.options.id, base.options); 2184 };
2185 // insert js into the head and exectue a callback function 2186 base.insertJS = function(src, callback, provider){ 2187 var tag; 2188 if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) { 2189 delete UNCODE.insertedSripts[src]; 2190 var tags = document.getElementsByTagName('script'); 2191 for (var i = tags.length; i >= 0; i--){ 2192 if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) { 2193 tags[i].parentNode.removeChild(tags[i]); 2194 } 2195 } 2196 } else { 2197 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 2198 tag = UNCODE.insertedSripts[src]; 2199 if (callback){ 2200 if (tag.readyState){ //IE 2201 tag.onreadystatechange = function(){ 2202 if (tag.readyState === "loaded" || 2203 tag.readyState === "complete"){ 2204 tag.onreadystatechange = null; 2205 callback(); 2206 } 2207 }; 2208 } else { 2209 $(tag).on('load', callback); 2210 } 2211 } 2212 return; 2213 } 2214 } 2215 tag = document.createElement('script'); 2216 if (callback){ 2217 if (tag.readyState){ //IE 2218 tag.onreadystatechange = function(){ 2219 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 2220 tag.onreadystatechange = null; 2221 callback(); 2222 } 2223 }; 2224 } else { 2225 tag.onload = function() { 2226 callback(); 2227 }; 2228 } 2229 } 2230 tag.src = src; 2231 var firstScriptTag = document.getElementsByTagName('script')[0]; 2232 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2233 if ( ! UNCODE.insertedSripts ) { 2234 UNCODE.insertedSripts = []; 2235 } 2236 UNCODE.insertedSripts[src] = tag; 2237 }; 2238 // load the youtube api 2239 base.loadYouTubeAPI = function(callback) { 2240 if ( ev === 'uncode-more-items-loaded' ) { 2241 onYouTubeIframeAPIReady(); 2242 } else { 2243 base.insertJS('https://www.youtube.com/player_api', false, 'youtube'); 2244 } 2245 }; 2246 base.loadYouTubePlaylist = function() { 2247 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 2248 }; 2249 // load the vimeo api by replacing the div with an iframe and loading js 2250 base.loadVimeoAPI = function() { 2251 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', 2252 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >'); 2253 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 2254 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 2255 base.insertJS('//player.vimeo.com/api/player.js', function() { 2256 vimeoPlayerReady(base.options.id); 2257 }, 'vimeo'); 2258 }; 2259 // is it from youtube or vimeo? 2260 base.determineProvider = function() { 2261 var a = document.createElement('a'); 2262 a.href = base.options.video; 2263 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 2264 var videoid = a.href.split('/')[3].toString(); 2265 var query = videoid.substring(videoid.indexOf('?') + 1); 2266 if (query != '') { 2267 var vars = query.split('&'); 2268 for (var i = 0; i < vars.length; i++) { 2269 var pair = vars[i].split('='); 2270 if (pair[0] == 'v') { 2271 videoid = pair[1]; 2272 } 2273 } 2274 } 2275 return { 2276 "provider": "youtube", 2277 "id": videoid 2278 }; 2279 } else if (/vimeo.com/.test(base.options.video)) { 2280 return { 2281 "provider": "vimeo", 2282 "id": (a.href.split('/')[3].toString()).split('#')[0], 2283 }; 2284 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 2285 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 2286 if (id.length == 11) { 2287 return { 2288 "provider": "youtube", 2289 "id": id.toString() 2290 }; 2291 } else { 2292 for (var i = 0; i < base.options.video.length; i++) { 2293 if (typeof parseInt(base.options.video[i]) !== "number") { 2294 throw 'not vimeo but thought it was for a sec'; 2295 } 2296 } 2297 return { 2298 "provider": "vimeo", 2299 "id": base.options.video 2300 }; 2301 } 2302 } else { 2303 throw "OKVideo: Invalid video source"; 2304 } 2305 }; 2306 base.init(); 2307 }; 2308 2309 var checkResize, 2310 newW = UNCODE.wwidth; 2311 2312 $.okvideo.options = { 2313 id: null, 2314 source: null, // Deprecate dis l8r 2315 video: null, 2316 playlist: { // eat ur heart out @brokyo 2317 list: null, 2318 index: 0, 2319 startSeconds: 0, 2320 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 2321 }, 2322 disableKeyControl: 1, 2323 captions: 0, 2324 loop: 1, 2325 hd: 1, 2326 volume: 0, 2327 adproof: false, 2328 unstarted: null, 2329 onFinished: null, 2330 onReady: null, 2331 onPlay: null, 2332 onPause: null, 2333 buffering: null, 2334 controls: false, 2335 autoplay: true, 2336 annotations: true, 2337 cued: null 2338 }; 2339 $.fn.okvideo = function(options) { 2340 options.target = this; 2341 return this.each(function() { 2342 (new $.okvideo(options)); 2343 }); 2344 }; 2345 2346 var checkForVideos = function(){ 2347 $(".uncode-video-container.video").each(function(index, el) { 2348 var $this = $(this), 2349 mobile_ready = $this.hasClass('no-control-mobile-autoplay'), 2350 url = $this.attr('data-video'), 2351 id = $this.attr('data-id'), 2352 cloned = $this.closest('.owl-item'); 2353 2354 if ( mobile_ready || newW >= UNCODE.mediaQuery ) { 2355 if (!cloned.hasClass('cloned') || cloned.length == 0) { 2356 $this.okvideo({ 2357 id: id, 2358 source: url.split('#')[0], 2359 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 2360 autoplay: 1, 2361 controls: 0, 2362 volume: 0, 2363 adproof: 0, 2364 caller: $this, 2365 hd: 1, 2366 onReady: function(player) { 2367 var getPlayer = player.c || player.h || player, 2368 $iframe, 2369 getContainer = $(getPlayer).closest('.background-element'); 2370 if (getContainer.length) { 2371 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 2372 } 2373 2374 if ( $this.hasClass('drop-move') ) { 2375 2376 var $iframe = $(getPlayer), 2377 w = parseFloat($iframe.attr('width')), 2378 h = parseFloat($iframe.attr('height')), 2379 ratio = h / w, 2380 setResizeiFto, 2381 resizeiFrame = function(){ 2382 var dataW = $this.attr('data-w'), 2383 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2384 newH = newW * ratio; 2385 $iframe.css({ 2386 width: newW, 2387 height: newH 2388 }); 2389 }; 2390 resizeiFrame(); 2391 $(window).on( 'load', resizeiFrame ); 2392 $(window).on( 'resize', function(){ 2393 clearRequestTimeout(setResizeiFto); 2394 setResizeiFto = requestTimeout( function() { 2395 resizeiFrame(); 2396 }, 10 ); 2397 }); 2398 2399 } 2400 2401 } 2402 }); 2403 } 2404 } 2405 }); 2406 }; 2407 2408 checkForVideos(); 2409 2410 $(window).on('load', function(){ 2411 $('.mejs-fullscreen-button button').on('click', function(){ 2412 var $button = $(this), 2413 $stuck = $button.closest('.is_stucked'); 2414 2415 if ( $stuck.length ) { 2416 $stuck = $(this).trigger("sticky_kit:detach"); 2417 window.scrollTo(0, 0); 2418 } 2419 }); 2420 }); 2421 2422 var checkVideoResize = function(){ 2423 clearRequestTimeout(checkResize); 2424 checkResize = requestTimeout(function(){ 2425 if ( newW !== UNCODE.wwidth ) { 2426 newW = UNCODE.wwidth; 2427 checkForVideos(); 2428 } 2429 }, 1000); 2430 }; 2431 2432 $(window).off('resize', checkVideoResize) 2433 .on( 'resize', checkVideoResize); 2434 2435}; 2436 2437$(document).on('uncode-ajax-filtered.videos', function(){ 2438 UNCODE.okvideo("uncode-more-items-loaded"); 2439}); 2440UNCODE.backgroundSelfVideos = function( $ctx ) { 2441 2442 var backgroundSelfVideosInit = function( $ctx ) { 2443 if ( SiteParameters.block_mobile_videos === true ) { 2444 return false;
2445 } 2446 if (typeof MediaElement === "function") { 2447 if ( typeof $ctx === 'undefined' ) { 2448 $ctx = document; 2449 } 2450 2451 $(".background-video-shortcode", $ctx).each(function(index, el) { 2452 if ( $(this).closest('mediaelementwrapper').length ) { 2453 return true; 2454 } 2455 var $video_el = $(this), 2456 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 2457 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 2458 video_id = $video_el.attr('id'); 2459 2460 if ( SiteParameters.is_frontend_editor ) { 2461 video_id = video_id + '_' + index; 2462 $video_el.attr('id', video_id); 2463 } 2464 2465 var media = new MediaElement(video_id, { 2466 startVolume: 0, 2467 loop: true, 2468 success: function(mediaElement, domObject) { 2469 domObject.volume = 0; 2470 $(mediaElement).data('started', false); 2471 mediaElement.addEventListener('timeupdate', function(e) { 2472 if (!$(e.target).data('started')) { 2473 $(mediaElement).data('started', true); 2474 } 2475 }); 2476 mediaElement.addEventListener('loadedmetadata', function(e) { 2477 $('body').removeClass('video-not-supported'); 2478 mediaElement.play(); 2479 }); 2480 if (!UNCODE.isMobile) { 2481 requestTimeout(function() { 2482 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 2483 }, 100); 2484 } 2485 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 2486 mediaElement.play(); 2487 } 2488 2489 if ( $parent_drop_move.length ) { 2490 var setResizeMEto, 2491 resizeMediaElement = function(){ 2492 var dataW = $parent_drop_move.attr('data-w'), 2493 videoW = domObject.width, 2494 videoH = domObject.height, 2495 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2496 newH = newW / ( videoW / videoH ); 2497 2498 $(domObject).css({ 2499 'height': newH, 2500 'width': newW 2501 }); 2502 }; 2503 $(window).on( 'resize load', function(){ 2504 clearRequestTimeout(setResizeMEto); 2505 setResizeMEto = requestTimeout( function() { 2506 resizeMediaElement(); 2507 }, 10 ); 2508 }); 2509 } 2510 2511 mediaElement.addEventListener('play', function() { 2512 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2513 $(mediaElement).closest('#page-header').addClass('video-started'); 2514 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2515 }, true); 2516 2517 }, 2518 // fires when a problem is detected 2519 error: function() {} 2520 }); 2521 }); 2522 } else { 2523 2524 if ( typeof $ctx === 'undefined' ) { 2525 $ctx = document; 2526 } 2527 2528 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 2529 Array.from(videos).forEach(function(video_el) { 2530 video_el.addEventListener('loadedmetadata', function(e) { 2531 $('body').removeClass('video-not-supported'); 2532 video_el.play(); 2533 }); 2534 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 2535 video_el.muted = true; 2536 video_el.loop = true; 2537 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2538 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 2539 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2540 $('body').removeClass('video-not-supported'); 2541 video_el.play(); 2542 } else { 2543 requestTimeout(function(){ 2544 backgroundSelfVideosInit( $ctx ); 2545 }, 1000); 2546 } 2547 }); 2548 } 2549 }; 2550 2551 backgroundSelfVideosInit( $ctx ); 2552 2553 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2554 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 2555 var $el = model.view.$el, 2556 shortcode = model.attributes.shortcode; 2557 2558 if (typeof MediaElement === "function") { 2559 backgroundSelfVideosInit( $el ); 2560 } else { 2561 backgroundSelfVideosInit( $el[0] ); 2562 } 2563 }); 2564 } 2565}; 2566 2567UNCODE.is_scrolling = false; 2568 2569UNCODE.disableHoverScroll = function() { 2570 2571 if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor && (!SiteParameters.smoothScroll || SiteParameters.smoothScrollDisableHover )) { 2572 var body = document.body, 2573 timer; 2574 2575 window.addEventListener('scroll', function() {
2576 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 2577 clearRequestTimeout(timer); 2578 if ( body.classList && !body.classList.contains('disable-hover') ) { 2579 body.classList.add('disable-hover'); 2580 window.dispatchEvent(new CustomEvent('disable-hover')); 2581 } 2582 UNCODE.is_scrolling = true; 2583 2584 timer = requestTimeout(function() { 2585 if ( body.classList ) { 2586 body.classList.remove('disable-hover'); 2587 window.dispatchEvent(new CustomEvent('enable-hover')); 2588 } 2589 UNCODE.is_scrolling = false; 2590 }, delay); 2591 }, false); 2592 } 2593}; 2594 2595UNCODE.isotopeLayout = function() { 2596 if ($('.isotope-layout').length > 0) { 2597 var isotopeContainersArray = [], 2598 typeGridArray = [], 2599 layoutGridArray = [], 2600 screenLgArray = [], 2601 screenMdArray = [], 2602 screenSmArray = [], 2603 transitionDuration = [], 2604 $filterItems = [], 2605 $filters = $('.isotope-system .isotope-filters'), 2606 $itemSelector = '.tmb-iso', 2607 $items, 2608 itemMargin, 2609 correctionFactor = 0, 2610 firstLoad = true, 2611 isOriginLeft = $('body').hasClass('rtl') ? false : true; 2612 $('[class*="isotope-container"]').each(function(index) { 2613 var _this = $(this); 2614 var isoData = _this.data(), 2615 $data_lg, 2616 $data_md, 2617 $data_sm; 2618 _this.children('.tmb').addClass('tmb-iso'); 2619 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 2620 else $data_lg = '1000'; 2621 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 2622 else $data_md = '600'; 2623 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 2624 else $data_sm = '480'; 2625 screenLgArray.push($data_lg); 2626 screenMdArray.push($data_md); 2627 screenSmArray.push($data_sm); 2628 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 2629 if (isoData.type == 'metro') typeGridArray.push(true); 2630 else typeGridArray.push(false); 2631 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 2632 else layoutGridArray.push('masonry'); 2633 isotopeContainersArray.push(_this); 2634 _this.attr('data-iso-index', index); 2635 }); 2636 var colWidth = function(index) { 2637 $(isotopeContainersArray[index]).width(''); 2638 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 2639 widthAvailable = $(isotopeContainersArray[index]).width(), 2640 columnNum = 12, 2641 columnWidth = 0, 2642 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 2643 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 2644 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 2645 $rowContainer, 2646 paddingRow, 2647 $colContainer, 2648 paddingCol; 2649 2650 if ( consider_menu ) 2651 winHeight = winHeight - UNCODE.menuHeight; 2652 2653 if ( data_vp_height === '1' ) { 2654 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 2655 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2656 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 2657 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 2658 winHeight = winHeight - ( paddingRow + paddingCol ); 2659 } 2660 2661 if (isPx) { 2662 columnWidth = Math.ceil(widthAvailable / columnNum); 2663 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 2664 } else { 2665 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 2666 } 2667 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 2668 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 2669 for (var i = 0, len = $items.length; i < len; i++) { 2670 var $item = $($items[i]), 2671 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 2672 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 2673 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 2674 2675 2676 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 2677 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 2678 } 2679 2680 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 2681 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 2682 } 2683 2684 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 2685 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2686 switch (parseInt(multiplier_w[1])) { 2687 case (5): 2688 case (4): 2689 case (3): 2690 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2691 multiplier_w[1] = 6; 2692 break; 2693 case (2): 2694 case (1): 2695 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 2696 multiplier_w[1] = 3; 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] && widthAvailable < screenMdArray[index]) { 2710 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2711 switch (parseInt(multiplier_w[1])) { 2712 case (5): 2713 case (4): 2714 case (3): 2715 case (2): 2716 case (1): 2717 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2718 multiplier_w[1] = 6; 2719 break; 2720 default: 2721 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2722 multiplier_w[1] = 12; 2723 break; 2724 } 2725 2726 if (multiplier_w[1] == 2.4) { // 5 columns 2727 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2728 multiplier_w[1] = 6; 2729 } 2730 } 2731 } else if (widthAvailable < screenSmArray[index]) { 2732 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2733 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2734 multiplier_w[1] = 12; 2735 if (typeGridArray[index]) multiplier_h[1] = 12; 2736 } 2737 } 2738 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 2739 height; 2740 2741 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 2742 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 2743 if ( widthAvailable < screenSmArray[index] ) { 2744 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 2745 } 2746 } else { 2747 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 2748 } 2749 2750 if (width >= widthAvailable) { 2751 $item.css({ 2752 width: widthAvailable 2753 }); 2754 if (typeGridArray[index]) { 2755 $item.children().add($item.find('.backimg')).css({ 2756 height: height 2757 }); 2758 } 2759 } else { 2760 $item.css({ 2761 width: width 2762 }); 2763 if (typeGridArray[index]) { 2764 $item.children().add($item.find('.backimg')).css({ 2765 height: height 2766 }); 2767 } 2768 } 2769 } 2770 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 2771 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 2772 } else { 2773 return columnWidth; 2774 } 2775 }, 2776 init_isotope = function() { 2777 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 2778 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 2779 isotopeId = isotopeSystem.attr('id'), 2780 $layoutMode = layoutGridArray[i], 2781 setIsotopeFirstRowTimeOut, 2782 setIsotopeFirstRow = function(items){ 2783 var firstRow = true; 2784 $(items).each(function(index, val){ 2785 var el = items[index].element, 2786 el_top = items[index].position.y, 2787 $el = $(el); 2788 if ( index > 0 && el_top > 0 && firstRow ) { 2789 firstRow = false;
2790 } else if ( index == 0 && el_top == 0 ) { 2791 firstRow = true; 2792 } 2793 if ( firstRow ) { 2794 $el.removeClass('tmb-isotope-further-row'); 2795 } else { 2796 $el.addClass('tmb-isotope-further-row'); 2797 } 2798 }); 2799 }; 2800 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 2801 //resizable: true, 2802 itemSelector: $itemSelector, 2803 layoutMode: $layoutMode, 2804 transitionDuration: transitionDuration[i], 2805 masonry: { 2806 columnWidth: colWidth(i) 2807 }, 2808 vertical: { 2809 horizontalAlignment: 0.5, 2810 }, 2811 sortBy: 'original-order', 2812 isOriginLeft: isOriginLeft 2813 }) 2814 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 2815 .on('layoutComplete', function( event, items ){ 2816 if ( typeof items[0] !== 'undefined' ) { 2817 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2818 setIsotopeFirstRow(items); 2819 } 2820 } 2821 }) 2822 .on('arrangeComplete', function( event, items ){ 2823 if ( typeof items[0] !== 'undefined' ) { 2824 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2825 clearRequestTimeout(setIsotopeFirstRowTimeOut); 2826 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 2827 setIsotopeFirstRow(items); 2828 }, 100); 2829 } 2830 } 2831 }); 2832 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 2833 $(isotopeContainersArray[i]).infinitescroll({ 2834 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 2835 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 2836 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 2837 animate: false, 2838 behavior: 'local', 2839 debug: false, 2840 loading: { 2841 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 2842 speed: 0, 2843 finished: undefined, 2844 msg: $('#' + isotopeId + ' .loadmore-button'), 2845 }, 2846 errorCallback: function() { 2847 var isotope_system = $(this).closest('.isotope-system'); 2848 $('.loading-button', isotope_system).hide(); 2849 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 2850 } 2851 }, 2852 // append the new items to isotope on the infinitescroll callback function. 2853 function(newElements, opts) { 2854 var $isotope = $(this), 2855 isotope_system = $isotope.closest('.isotope-system'), 2856 isotopeId = isotope_system.attr('id'), 2857 filters = new Array(), 2858 $loading_button = isotope_system.find('.loading-button'), 2859 $infinite_button = isotope_system.find('.loadmore-button'), 2860 $numPages = $('a', $infinite_button).data('pages'), 2861 $woo_results, 2862 delay = 300; 2863 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 2864 $infinite_button.show(); 2865 $loading_button.hide(); 2866 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 2867 $('> li', $isotope).remove(); 2868 $('.isotope-container').find('.woocommerce-result-count-wrapper').remove(); 2869 $.each($(newElements), function (index, val) { 2870 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 2871 $woo_results = $(val); 2872 delete newElements[index]; 2873 } else { 2874 $(val).addClass('tmb-iso'); 2875 if ($(val).is("li")) { 2876 filters.push($(val)[0]); 2877 } 2878 } 2879 $(val).addClass('uncode-appended'); 2880 }); 2881 newElements = newElements.filter(function(x) { 2882 return filters.indexOf(x) < 0 2883 }); 2884 $.each($(filters), function(index, val) { 2885 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 2886 }); 2887 if ($woo_results && $woo_results.length > 0) { 2888 var old_count = isotope_system.find('.woocommerce-result-count').text(); 2889 var new_count = $woo_results.find('.woocommerce-result-count').text(); 2890 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 2891 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 2892 function replaceMatch(match, p1, p2) { 2893 return old_start + '–' + new_end; 2894 } 2895 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 2896 isotope_system.find('.woocommerce-result-count').text(new_count_text); 2897 } 2898 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 2899 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2900 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 2901 if (typeof getLightbox === 'object') { 2902 getLightbox.refresh(); 2903 } else { 2904 UNCODE.lightbox(); 2905 } 2906 } 2907 if ( typeof twttr !== 'undefined' ) 2908 twttr.widgets.load(isotopeContainersArray[i]); 2909 2910 requestTimeout(function() { 2911 Waypoint.refreshAll(); 2912 $isotope.trigger('more-items-loaded'); 2913 $(window).trigger('more-items-loaded'); 2914 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 2915 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 2916 $(document).trigger('uncode-scrolltrigger-refresh'); 2917 } 2918 }, 1000); 2919 2920 }); 2921 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 2922 var $infinite_isotope = $(isotopeContainersArray[i]), 2923 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 2924 $infinite_isotope.infinitescroll('pause'); 2925 $infinite_button.on('click', function(event) { 2926 event.preventDefault(); 2927 var $infinite_system = $(event.target).closest('.isotope-system'), 2928 $infinite_isotope = $infinite_system.find('.isotope-container'), 2929 isotopeId = $infinite_system.attr('id'); 2930 $(event.currentTarget).html(SiteParameters.loading); 2931 $infinite_isotope.infinitescroll('resume'); 2932 $infinite_isotope.infinitescroll('retrieve'); 2933 $infinite_isotope.infinitescroll('pause'); 2934 }); 2935 } 2936 } 2937 } 2938 }, 2939 onLayout = function(isotopeObj, startIndex, needsReload) { 2940 var needsReload = needsReload ? true : false;
2941 2942 if (typeof UNCODE.bigText !== 'undefined') { 2943 UNCODE.bigText(); 2944 } 2945 isotopeObj.css('opacity', 1); 2946 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 2947 2948 requestTimeout(function() { 2949 if (startIndex > 0) { 2950 reloadIsotope(isotopeObj); 2951 if (SiteParameters.dynamic_srcset_active === '1') { 2952 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2953 UNCODE.adaptive_srcset(isotopeObj); 2954 } 2955 // window.dispatchEvent(UNCODE.boxEvent); 2956 } else if (needsReload) { 2957 reloadIsotope(isotopeObj); 2958 } 2959 2960 UNCODE.adaptive(); 2961 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 2962 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2963 } 2964 if (typeof MediaElement === "function") { 2965 $(isotopeObj).find('audio,video').each(function() { 2966 $(this).mediaelementplayer({ 2967 pauseOtherPlayers: false, 2968 }); 2969 }); 2970 } 2971 if ($(isotopeObj).find('.nested-carousel').length) { 2972 if (typeof UNCODE.carousel !== 'undefined') { 2973 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 2974 } 2975 requestTimeout(function() { 2976 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2977 }, 200); 2978 } else { 2979 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2980 } 2981 isotopeObj.trigger('isotope-layout-complete'); 2982 2983 }, 100); 2984 2985 }, 2986 boxAnimation = function(items, startIndex, sequential, container) { 2987 var $allItems = items.length - startIndex, 2988 showed = 0, 2989 index = 0; 2990 if (container.closest('.owl-item').length == 1) return false; 2991 $.each(items, function(index, val) { 2992 var $this = $(val), 2993 elInner = $('> .t-inside', val); 2994 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2995 return; 2996 } 2997 if (val[0]) val = val[0]; 2998 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 2999 new Waypoint({ 3000 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3001 element: val, 3002 handler: function() { 3003 var element = $('> .t-inside', this.element), 3004 parent = $(this.element), 3005 currentIndex = parent.index(); 3006 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 3007 delayAttr = parseInt(element.attr('data-delay')); 3008 if (isNaN(delayAttr)) delayAttr = 100; 3009 delay -= showed; 3010 var objTimeout = requestTimeout(function() { 3011 element.removeClass('zoom-reverse').addClass('start_animation'); 3012 showed = parent.index(); 3013 if ( container.data('isotope') ) { 3014 container.isotope('layout'); 3015 } 3016 }, delay * delayAttr) 3017 parent.data('objTimeout', objTimeout); 3018 if (!UNCODE.isUnmodalOpen) { 3019 this.destroy(); 3020 } 3021 }, 3022 offset: '100%' 3023 }) 3024 } else { 3025 if (elInner.hasClass('force-anim')) { 3026 elInner.addClass('start_animation'); 3027 } else { 3028 elInner.css('opacity', 1); 3029 } 3030 container.isotope('layout'); 3031 } 3032 3033 index++; 3034 }); 3035 }, 3036 reloadIsotope = function(isotopeObj) { 3037 var isoIndex = $(isotopeObj).attr('data-iso-index'); 3038 var $layoutMode = ($(isotopeObj).data('layout')); 3039 if ($layoutMode === undefined) { 3040 $layoutMode = 'masonry'; 3041 } 3042 if (isotopeObj.data('isotope')) { 3043 isotopeObj.isotope({ 3044 itemSelector: $itemSelector, 3045 layoutMode: $layoutMode, 3046 transitionDuration: transitionDuration[isoIndex], 3047 masonry: { 3048 columnWidth: colWidth(isoIndex) 3049 }, 3050 vertical: { 3051 horizontalAlignment: 0.5, 3052 }, 3053 sortBy: 'original-order', 3054 isOriginLeft: isOriginLeft 3055 }); 3056 } 3057 } 3058 ; 3059 if ($('.isotope-pagination').length > 0) { 3060 $('.isotope-system').on('click', '.pagination a', function(evt) { 3061 evt.preventDefault(); 3062 3063 if (SiteParameters.index_pagination_disable_scroll !== '1') { 3064 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 3065 container = $(this).closest('.isotope-system'), 3066 pagination_disable_scroll = container.attr('data-pagination-scroll'), 3067 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 3068 calc_scroll -= UNCODE.get_scroll_offset(); 3069 3070 if ( pagination_disable_scroll === 'disabled' ) { 3071 return; 3072 } 3073 3074 var menu_container = $('.menu-sticky'); 3075 var menu = menu_container.find('.menu-container'); 3076 3077 if (menu_container.length > 0 && menu.length > 0) { 3078 calc_scroll = calc_scroll - menu.outerHeight(); 3079 } 3080 3081 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3082 delta = bodyTop - calc_scroll, 3083 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 3084 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3085 3086 if (!UNCODE.isFullPage) { 3087 if (scrollSpeed == 0) { 3088 $('html, body').scrollTop(calc_scroll); 3089 } else { 3090 $('html, body').animate({ 3091 scrollTop: calc_scroll 3092 }, {
3093 easing: 'easeInOutQuad', 3094 duration: scrollSpeed, 3095 complete: function () { 3096 UNCODE.scrolling = false; 3097 } 3098 }); 3099 } 3100 } 3101 } 3102 3103 loadIsotope($(this), true); 3104 }); 3105 } 3106 $filters.on('click', 'a.isotope-nav-link', function(evt) { 3107 if ($(this).hasClass('no-isotope-filter')) { 3108 return; 3109 } 3110 var $filter = $(this), 3111 filterContainer = $filter.closest('.isotope-filters'), 3112 filterValue = $filter.attr('data-filter'), 3113 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 3114 transitionDuration = container.data().isotope.options.transitionDuration, 3115 delay = 300, 3116 filterItems = []; 3117 3118 var filter_items = function(){ 3119 if (filterValue !== undefined) { 3120 container.addClass('grid-filtering'); 3121 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 3122 var parent = $(val).parent(), 3123 objTimeout = parent.data('objTimeout'); 3124 if (objTimeout) { 3125 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3126 clearRequestTimeout(objTimeout); 3127 } 3128 if (transitionDuration == 0) { 3129 if ($(val).hasClass('animate_when_almost_visible')) { 3130 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3131 } else { 3132 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 3133 } 3134 } 3135 }); 3136 requestTimeout(function(){ 3137 if ( filterValue == '*' ) { 3138 container.removeClass('isotope-filtered'); 3139 } else { 3140 container.addClass('isotope-filtered'); 3141 } 3142 container.isotope({ 3143 filter: function() { 3144 var block = $(this), 3145 filterable = (filterValue == '*') || block.hasClass(filterValue), 3146 lightboxElements = $('[data-lbox^=ilightbox]', block); 3147 if (filterable) { 3148 if (lightboxElements.length) { 3149 lightboxElements.removeClass('lb-disabled'); 3150 container.data('lbox', $(lightboxElements[0]).data('lbox')); 3151 } 3152 filterItems.push(block); 3153 } else { 3154 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 3155 } 3156 container.trigger('more-items-loaded'); 3157 $(window).trigger('more-items-loaded'); 3158 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 3159 return filterable; 3160 } 3161 }); 3162 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 3163 3164 }, delay); 3165 3166 /** once filtered - start **/ 3167 container.isotope('once', 'arrangeComplete', function() { 3168 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3169 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 3170 if (typeof getLightbox === 'object') { 3171 getLightbox.refresh(); 3172 } else { 3173 UNCODE.lightbox(); 3174 } 3175 } 3176 if (transitionDuration == 0) { 3177 requestTimeout(function() { 3178 boxAnimation(filterItems, 0, false, container); 3179 }, 100); 3180 } 3181 requestTimeout(function() { 3182 Waypoint.refreshAll(); 3183 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 3184 $(document).trigger('uncode-scrolltrigger-refresh'); 3185 } 3186 container.removeClass('grid-filtering'); 3187 }, 2000); 3188 }); 3189 /** once filtered - end **/ 3190 } else { 3191 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3192 $.each(UNCODE.lightboxArray, function(index, val) { 3193 UNCODE.lightboxArray[index].destroy(); 3194 }); 3195 } 3196 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 3197 var parent = $(val).parent(), 3198 objTimeout = parent.data('objTimeout'); 3199 if (objTimeout) { 3200 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3201 clearRequestTimeout(objTimeout); 3202 } 3203 if (transitionDuration == 0) { 3204 if ($(val).hasClass('animate_when_almost_visible')) { 3205 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3206 } else { 3207 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 3208 } 3209 } 3210 }); 3211 container.parent().addClass('grid-loading'); 3212 loadIsotope($filter); 3213 } 3214 }; 3215 3216 if (!$filter.hasClass('active')) { 3217 /** Scroll top with filtering */ 3218 if (filterContainer.hasClass('filter-scroll')) { 3219 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 3220 calc_scroll -= UNCODE.get_scroll_offset(); 3221 3222 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3223 delta = bodyTop - calc_scroll, 3224 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 3225 filterTolerance = false, 3226 filter_timeout; 3227 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3228 3229 if ( !UNCODE.isFullPage ) { 3230 if (scrollSpeed == 0) { 3231 $('html, body').scrollTop(calc_scroll); 3232 UNCODE.scrolling = false;
3233 filter_items(); 3234 } else { 3235 3236 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 3237 filter_items(); 3238 filterTolerance = true; 3239 } 3240 3241 $('html, body').animate({ 3242 scrollTop: calc_scroll 3243 },{ 3244 easing: 'easeInOutQuad', 3245 duration: scrollSpeed, 3246 complete: function(){ 3247 UNCODE.scrolling = false; 3248 if ( !filterTolerance ) { 3249 filter_timeout = setTimeout(function(){ 3250 clearTimeout(filter_timeout); 3251 filter_items(); 3252 }, 200); 3253 } 3254 } 3255 }); 3256 } 3257 } 3258 } else { 3259 filter_items(); 3260 } 3261 } 3262 evt.preventDefault(); 3263 }); 3264 3265 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 3266 var params = UNCODE.getURLParams(window.location); 3267 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 3268 3269 UNCODE.lastURL = window.location.href; 3270 3271 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) { 3272 return; 3273 } 3274 3275 if (params.id === undefined) { 3276 $.each($('.isotope-system'), function(index, val) { 3277 loadIsotope($(val)); 3278 }); 3279 } else { 3280 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 3281 loadIsotope($('#' + params.id)); 3282 } 3283 } 3284 }); 3285 3286 var loadIsotope = function($href, $paginating) { 3287 var is_paginating = false; 3288 3289 if (undefined !== $paginating && $paginating) { 3290 var is_paginating = $paginating; 3291 } 3292 3293 var href = ($href.is("a") ? $href.attr('href') : location), 3294 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 3295 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 3296 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 3297 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 3298 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 3299 isotopeId = isotopeSystem.attr('id'); 3300 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 3301 UNCODE.lastURL = href; 3302 history.pushState({ 3303 myIsotope: true 3304 }, document.title, href); 3305 } 3306 if (is_paginating) { 3307 isotopeWrapper.addClass('grid-filtering'); 3308 } 3309 $.ajax({ 3310 url: href 3311 }).done(function(data) { 3312 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 3313 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 3314 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 3315 isotopeWrapper.addClass('isotope-reloaded'); 3316 requestTimeout(function() { 3317 isotopeWrapper.removeClass('grid-loading'); 3318 isotopeWrapper.removeClass('isotope-reloaded'); 3319 isotopeWrapper.removeClass('grid-filtering'); 3320 }, 500); 3321 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 3322 var parent = $(val).parent(), 3323 objTimeout = parent.data('objTimeout'); 3324 if (objTimeout) { 3325 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3326 clearRequestTimeout(objTimeout); 3327 } 3328 if ($(val).hasClass('animate_when_almost_visible')) { 3329 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3330 } else { 3331 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 3332 } 3333 }); 3334 requestTimeout(function() { 3335 if (isotopeContainer.data('isotope')) { 3336 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 3337 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 3338 UNCODE.adaptive(); 3339 if (SiteParameters.dynamic_srcset_active === '1') { 3340 UNCODE.adaptive_srcset(isotopeContainer); 3341 } 3342 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3343 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 3344 if (typeof getLightbox === 'object') { 3345 getLightbox.refresh(); 3346 } else { 3347 UNCODE.lightbox(); 3348 } 3349 } 3350 } 3351 isotopeContainer.trigger('more-items-loaded'); 3352 $(window).trigger('more-items-loaded'); 3353 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 3354 }, 300); 3355 $('.pagination', isotopeFooter).remove(); 3356 isotopeFooter.append($resultPagination); 3357 3358 if (isotopeResultCount.length > 0) { 3359 $('.woocommerce-result-count', isotopeResultCount).remove(); 3360 isotopeResultCount.append($resultCount); 3361 } 3362 }); 3363 }; 3364 $filters.each(function(i, buttonGroup) { 3365 var $buttonGroup = $(buttonGroup); 3366 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 3367 $buttonGroup.find('.active').removeClass('active'); 3368 $(this).addClass('active'); 3369 3370 }); 3371 3372 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 3373 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 3374 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 3375 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 3376 e.preventDefault(); 3377 $cats_filters.slideToggle(400, 'easeInOutCirc'); 3378 }); 3379 3380 }); 3381 window.addEventListener('boxResized', function(e) { 3382 if (UNCODE.printDialogOpen !== false) { 3383 return false;
3384 } 3385 $.each($('.isotope-layout'), function(index, val) { 3386 var $layoutMode = ($(this).data('layout')); 3387 if ($layoutMode === undefined) $layoutMode = 'masonry'; 3388 if ($(this).data('isotope')) { 3389 $(this).isotope({ 3390 itemSelector: $itemSelector, 3391 layoutMode: $layoutMode, 3392 transitionDuration: transitionDuration[index], 3393 masonry: { 3394 columnWidth: colWidth(index) 3395 }, 3396 vertical: { 3397 horizontalAlignment: 0.5, 3398 }, 3399 sortBy: 'original-order', 3400 isOriginLeft: isOriginLeft 3401 }); 3402 $(this).isotope('unbindResize'); 3403 if (SiteParameters.dynamic_srcset_active === '1') { 3404 UNCODE.refresh_dynamic_srcset_size($(this)); 3405 } 3406 } 3407 $(this).find('.mejs-video,.mejs-audio').each(function() { 3408 $(this).trigger('resize'); 3409 }); 3410 }); 3411 }, false); 3412 3413 init_isotope(); 3414 }; 3415} 3416 3417UNCODE.lightbox = function() { 3418 if ( SiteParameters.lbox_enhanced ) { 3419 return true; 3420 } 3421 UNCODE.lightboxArray = {}; 3422 requestTimeout(function() { 3423 var groupsArr = {}; 3424 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 3425 var group = this.getAttribute("data-lbox"), 3426 values = $(this).data(); 3427 $(this).attr('data-lbox-init','true') 3428 groupsArr[group] = values; 3429 }); 3430 for (var i in groupsArr) { 3431 var skin = groupsArr[i].skin || 'black', 3432 path = groupsArr[i].dir || 'horizontal', 3433 thumbs = !groupsArr[i].notmb || false, 3434 arrows = !groupsArr[i].noarr || false, 3435 social = groupsArr[i].social || false, 3436 deeplink = groupsArr[i].deep || false, 3437 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 3438 counter = $els.length, 3439 dataAlbum = $els.attr('data-album'); 3440 if (social) social = { 3441 facebook: true, 3442 twitter: true, 3443 reddit: true, 3444 digg: true 3445 }; 3446 UNCODE.lightboxArray[i] = $els.iLightBox({ 3447 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 3448 skin: skin, 3449 path: path, 3450 linkId: deeplink, 3451 infinite: false, 3452 //fullViewPort: 'fit', 3453 smartRecognition: false, 3454 fullAlone: true, 3455 maxScale: 1, 3456 minScale: .02, 3457 //fullStretchTypes: 'flash, video', 3458 overlay: { 3459 opacity: .94 3460 }, 3461 controls: { 3462 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 3463 fullscreen: true, 3464 thumbnail: thumbs, 3465 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 3466 }, 3467 show: { 3468 speed: 200 3469 }, 3470 hide: { 3471 speed: 200 3472 }, 3473 social: { 3474 start: false, 3475 buttons: social 3476 }, 3477 caption: { 3478 start: false 3479 }, 3480 styles: { 3481 nextOpacity: 1, 3482 nextScale: 1, 3483 prevOpacity: 1, 3484 prevScale: 1 3485 }, 3486 effects: { 3487 switchSpeed: 400 3488 }, 3489 slideshow: { 3490 pauseTime: 5000 3491 }, 3492 thumbnails: { 3493 maxWidth: 60, 3494 maxHeight: 60, 3495 activeOpacity: .2 3496 }, 3497 html5video: { 3498 preload: true 3499 }, 3500 callback: { 3501 onOpen: function(){ 3502 $(window).trigger('uncode-custom-cursor'); 3503 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3504 iNoBounce.enable(); 3505 } 3506 }, 3507 onHide: function(){ 3508 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3509 iNoBounce.disable() 3510 } 3511 }, 3512 } 3513 }); 3514 3515 $(document).on('infinite-loaded', function(){ 3516 UNCODE.lightboxArray[i].refresh(); 3517 }); 3518 3519 $(window).on('gdprOpen', function(){ 3520 UNCODE.lightboxArray[i].close(); 3521 }); 3522 }; 3523 }, 100); 3524 3525 $(document).on('click', '.lb-disabled', function(e){ 3526 e.preventDefault(); 3527 }); 3528}; 3529 3530UNCODE.lightgallery = function( $el ) { 3531 var createSelectors = function(){ 3532 $('a[data-lbox]:not([data-lbox-init]):not([data-album])' + SiteParameters.uncode_lb_add_items).each(function(){ 3533 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3534 $(this).addClass('lbox-trigger-item'); 3535 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3536 $(this).addClass('lbox-nested-item'); 3537 } else { 3538 $(this).removeClass('lbox-trigger-item'); 3539 $(this).removeClass('lbox-nested-item'); 3540 } 3541 }); 3542 }; 3543 3544 createSelectors(); 3545 3546 var galleries = [], 3547 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3548 return !$(this).closest('.nested-carousel').length; 3549 }), 3550 $_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 *'), 3551 $galleries = $_galleries.filter(function( index ) { 3552 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3553 }), 3554 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 3555 3556 if ( typeof $el === 'undefined' ) { 3557 $el = $galleries.add( $nested ); 3558 } 3559 3560 var $disabled = $('a.lb-disabled'); 3561 $disabled.on('click', function(e){ 3562 e.preventDefault(); 3563 }); 3564 3565 var beforeSlide = function(event) { 3566 var detail = event.detail, 3567 info = detail.info, 3568 item = detail.item, 3569 $slide = $(detail.currentSlide.selector), 3570 $video = $('video', $slide), 3571 $previous = $(detail.previousSlide.selector), 3572 $prevVideo = $('video', $previous), 3573 isAudio = false;
3574 3575 if ( typeof info.src !== 'undefined' ) { 3576 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 3577 } 3578 3579 if ( ! $video.length && ( info.video || isAudio ) ) { 3580 if ( info.video ) { 3581 if ( typeof info.video === 'object' ) { 3582 var infoJson = info.video; 3583 } else { 3584 var infoJson = JSON.parse(info.video); 3585 } 3586 var src = infoJson.source[0].src, 3587 autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes', 3588 muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes', 3589 loop = $(item).attr('data-loop'); 3590 3591 } else if ( isAudio ) { 3592 var src = info.src, 3593 autoplay = true, 3594 loop = false; 3595 } 3596 if ( typeof src !== 'undefined' ) { 3597 $slide.addClass('has-html5'); 3598 var video = document.createElement('video'); 3599 video.src = src; 3600 video.preload = 'auto'; 3601 video.controls = 'controls'; 3602 video.controlsList = 'nodownload'; 3603 if ( autoplay ) { 3604 video.autoplay = 'autoplay'; 3605 } 3606 if ( muted ) { 3607 video.muted = 'muted'; 3608 } 3609 if ( loop ) { 3610 video.loop = 'loop'; 3611 } 3612 $(video).appendTo($slide); 3613 } 3614 } else { 3615 var $video = $('video', $slide); 3616 if ( $video.length ) { 3617 $video[0].currentTime = 0; 3618 if ( $video[0].autoplay ) { 3619 $video[0].play(); 3620 } 3621 } 3622 } 3623 if ( $prevVideo.length ) { 3624 $prevVideo[0].currentTime = 0; 3625 $prevVideo[0].pause(); 3626 } 3627 }; 3628 3629 var beforeOpen = function(event) { 3630 var detail = event.detail, 3631 items = detail.items, 3632 galleryItems = detail.galleryItems, 3633 outer = detail.outer.selector, 3634 i, ii; 3635 for ( i = 0; i < galleryItems.length; i++ ) { 3636 var item = galleryItems[i]; 3637 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 3638 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 3639 } 3640 } 3641 for ( ii = 0; ii < items.length; ii++ ) { 3642 var item = items[ii]; 3643 if ( $(item).attr('data-icon') === 'video' ) { 3644 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 3645 } 3646 } 3647 3648 }; 3649 3650 //caption builder 3651 var captionBuilder = function($el){ 3652 $el.each( function( index, val ) { 3653 var $gallery = $(this).attr('data-lbox-init','true'), 3654 $_a = '.lbox-trigger-item', 3655 $_nested_a = '.lbox-nested-item'; 3656 3657 $gallery.find($_a, $_nested_a).each(function(){ 3658 var $a = $(this), 3659 $img = $('img', $a).first(), 3660 imgw = $img.attr('data-width'), 3661 imgh = $img.attr('data-height'), 3662 caption = $a.attr('data-caption'), 3663 title = $a.attr('data-title'); 3664 3665 if ( $img.length && $img.attr('data-crop') != true ) { 3666 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 3667 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 3668 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 3669 $a.attr('data-external-thumb-image', $img[0].src); 3670 } 3671 } 3672 3673 if ( typeof title !== 'undefined' && title !== '' ) { 3674 title = '<h6>' + title + '</h6>'; 3675 } else { 3676 title = ''; 3677 } 3678 3679 if ( typeof caption !== 'undefined' && caption !== '' ) { 3680 caption = '<p>' + caption + '</p>'; 3681 title += caption; 3682 } 3683 3684 if ( title !== '' ) { 3685 $a.attr( 'title', title ); 3686 } 3687 3688 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') ) ) { 3689 $a.attr('data-lg-size', imgw + '-' + imgh); 3690 } 3691 }); 3692 }); 3693 }; 3694 captionBuilder($el); 3695 3696 //regular galleries 3697 $el.each( function( index, val ) { 3698 var $gallery = $(this), 3699 $_a = '.lbox-trigger-item', 3700 $_nested_a = '.lbox-nested-item', 3701 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 3702 galleryID = $_first.attr('data-lbox'), 3703 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 3704 tmb = $_first.attr('data-notmb'), 3705 social = $_first.attr('data-social'), 3706 deep = $_first.attr('data-deep'), 3707 zoom = $_first.attr('data-zoom-origin'), 3708 actual = $_first.attr('data-actual-size'), 3709 download = $_first.attr('data-download'), 3710 controls = $_first.attr('data-arrows') !== 'no', 3711 fullScreen = $_first.attr('data-full'),
3712 counter = $_first.attr('data-counter'), 3713 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 3714 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3715 connect = $_first.attr('data-connect'), 3716 lgPlugins = [lgVideo], 3717 itemsLoadedTimeOut; 3718 3719 if ( typeof galleryID === 'undefined' ) { 3720 galleryID = $gallery.attr('id'); 3721 } 3722 3723 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3724 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3725 3726 if ( typeof tmb == 'undefined' || !tmb ) { 3727 lgPlugins.push(lgThumbnail); 3728 } 3729 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 3730 lgPlugins.push(lgZoom); 3731 } 3732 if ( typeof deep != 'undefined' && deep != '' ) { 3733 lgPlugins.push(lgHash); 3734 } 3735 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3736 lgPlugins.push(lgFullscreen); 3737 } 3738 if ( social ) { 3739 lgPlugins.push(lgShare); 3740 } 3741 3742 if ( galleries.indexOf( galleryID ) !== -1 ) { 3743 return true; 3744 } 3745 3746 galleries.push( galleryID ); 3747 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 3748 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 3749 var gallery = lightGallery( $triggerGal[0], { 3750 addClass: containerClass, 3751 plugins: lgPlugins, 3752 mode: transition, 3753 selector: $selector, 3754 galleryId: galleryID, 3755 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3756 iframeWidth: '848px', 3757 iframeMaxWidth: '90%', 3758 iframeMaxHeight: '90%', 3759 exThumbImage: 'data-external-thumb-image', 3760 loadYouTubeThumbnail: false, 3761 autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ), 3762 // autoplayFirstVideo: false, 3763 pager: false, 3764 startClass: 'lg-start-opacity', 3765 zoomFromOrigin: zoom, 3766 controls: controls, 3767 download: ( typeof download != 'undefined' && download != '' ), 3768 thumbWidth: 50, 3769 thumbHeight: '50px', 3770 counter: $triggerGal.find($selector).length > 1 ? counter : false, 3771 loadYouTubePoster: false, 3772 enableDrag: $triggerGal.find($selector).length > 1, 3773 mobileSettings: { 3774 showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true, 3775 }, 3776 }); 3777 3778 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 3779 e.preventDefault(); 3780 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 3781 gallery.openGallery(index-1); 3782 }); 3783 3784 $triggerGal.on('more-items-loaded', function(e, items) { 3785 clearRequestTimeout(itemsLoadedTimeOut); 3786 itemsLoadedTimeOut = requestTimeout(function(){ 3787 createSelectors(); 3788 captionBuilder($triggerGal); 3789 gallery.refresh(); 3790 }, 100); 3791 }); 3792 3793 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3794 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3795 $el = model.view.$el; 3796 if ( $el.find($triggerGal).length ) { 3797 gallery.destroy(); 3798 } 3799 }); 3800 } 3801 3802 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 3803 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 3804 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 3805 $(window).trigger('uncode-custom-cursor'); 3806 }); 3807 3808 }); 3809 3810 if ( typeof $el !== 'undefined' ) { 3811 3812 //album galleries 3813 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 3814 var album = val, 3815 galleryID = index, 3816 $album = $(album), 3817 params = $album.attr('data-album'), 3818 tmb = $(val).attr('data-notmb'), 3819 social = $(val).attr('data-social'), 3820 deep = $(val).attr('data-deep'), 3821 actual = $(val).attr('data-actual-size'), 3822 download = $(val).attr('data-download'), 3823 controls = $(val).attr('data-arrows') !== 'no', 3824 fullScreen = $(val).attr('data-full'), 3825 counter = $(val).attr('data-counter'), 3826 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 3827 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3828 lgPlugins = [lgVideo]; 3829 3830 $(val).attr('data-lbox-init','true'); 3831 3832 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3833 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3834 3835 if ( typeof tmb == 'undefined' || !tmb ) { 3836 lgPlugins.push(lgThumbnail); 3837 } 3838 if ( typeof actual != 'undefined' && actual != '' ) { 3839 lgPlugins.push(lgZoom); 3840 } 3841 if ( typeof deep != 'undefined' && deep != '' ) { 3842 lgPlugins.push(lgHash); 3843 } 3844 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3845 lgPlugins.push(lgFullscreen); 3846 } 3847 if ( social ) { 3848 lgPlugins.push(lgShare); 3849 } 3850 3851 var gallery = window.lightGallery(album, { 3852 dynamic: true, 3853 plugins: lgPlugins, 3854 dynamicEl: JSON.parse(params), 3855 galleryId: galleryID, 3856 addClass: containerClass, 3857 mode: transition, 3858 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3859 iframeWidth: '848px', 3860 iframeMaxWidth: '90%', 3861 iframeMaxHeight: '90%', 3862 loadYouTubeThumbnail: false, 3863 autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ), 3864 // autoplayFirstVideo: false, 3865 pager: false, 3866 startClass: 'lg-start-opacity', 3867 zoomFromOrigin: false, 3868 controls: controls, 3869 download: ( typeof download != 'undefined' && download != '' ), 3870 thumbWidth: 50, 3871 thumbHeight: '50px', 3872 loadYouTubePoster: false, 3873 counter: counter, 3874 exThumbImage: 'data-external-thumb-image', 3875 loadYouTubePoster: false, 3876 mobileSettings: { 3877 showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true, 3878 }, 3879 }); 3880 3881 $album.on('click', function(){ 3882 gallery.openGallery(0); 3883 }); 3884 3885 album.addEventListener('lgBeforeSlide', beforeSlide); 3886 album.addEventListener('lgBeforeOpen', beforeOpen); 3887 album.addEventListener('lgAfterOpen', function(){ 3888 $(window).trigger('uncode-custom-cursor'); 3889 }); 3890 3891 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3892 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3893 $el = model.view.$el; 3894 if ( $el.find($album).length ) { 3895 gallery.destroy(); 3896 } 3897 }); 3898 } 3899 3900 }); 3901 3902 //single images 3903 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 3904 var gallery = lightGallery( $('.page-wrapper')[0], { 3905 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 3906 iframeWidth: '848px', 3907 iframeMaxWidth: '90%', 3908 iframeMaxHeight: '90%', 3909 loadYouTubeThumbnail: false, 3910 // autoplayFirstVideo: false, 3911 startClass: 'lg-start-opacity', 3912 thumbWidth: 50, 3913 thumbHeight: '50px', 3914 download: false, 3915 loadYouTubePoster: false, 3916 counter: false 3917 }); 3918 3919 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 3920 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 3921 }); 3922 } 3923}; 3924 3925UNCODE.carousel = function(container) { 3926 var $owlContainers = $('.owl-carousel-container', container); 3927 $owlContainers.each(function() { 3928 var $owlContainer = $(this), 3929 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 3930 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 3931 values = {}, 3932 tempTimeStamp, 3933 newWidth = UNCODE.wwidth, 3934 $owlInsideEqual = []; 3935 $owlSelector.each(function() { 3936 var itemID = $(this).attr('id'), 3937 $elSelector = $(('#' + itemID).toString()); 3938 values['id'] = itemID; 3939 values['items'] = 1;
3940 values['columns'] = 3; 3941 values['fade'] = false; 3942 values['nav'] = false; 3943 values['navmobile'] = false; 3944 values['navskin'] = 'light'; 3945 values['navspeed'] = 400; 3946 values['dots'] = false; 3947 values['dotsmobile'] = false; 3948 values['loop'] = false; 3949 values['autoplay'] = false; 3950 values['timeout'] = 3000; 3951 values['autoheight'] = false; 3952 values['stagepadding'] = 0; 3953 values['margin'] = 0; 3954 values['lg'] = 1; 3955 values['md'] = 1; 3956 values['sm'] = 1; 3957 $.each($(this).data(), function(i, v) { 3958 values[i] = v; 3959 }); 3960 3961 if ($(this).closest('.uncode-slider').length) { 3962 values['navskin'] = ''; 3963 values['navmobile'] = false; 3964 //values['dotsmobile'] = true; 3965 } else { 3966 values['navskin'] = ' style-'+values['navskin']+' style-override'; 3967 } 3968 3969 var setIndexActive = function(event, init){ 3970 var init = typeof init === 'undefined' ? false : init, 3971 thiis = $(event.currentTarget); 3972 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 3973 var scrolltop = $(document).scrollTop(), 3974 size = event.page.size, 3975 i; 3976 var setIndex = requestTimeout(function() { 3977 for ( i = 0; i < size; i++ ) { 3978 var itemCont = event.item.index != null ? (event.item.index + i) : i; 3979 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 3980 if (thiis.closest('.row-slider').length) { 3981 if (currentItem == undefined) { 3982 currentItem = thiis.children()[i]; 3983 } 3984 if ($(currentItem).closest('#page-header').length) { 3985 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3986 UNCODE.switchColorsMenu(scrolltop, 'dark'); 3987 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3988 UNCODE.switchColorsMenu(scrolltop, 'light'); 3989 } 3990 } 3991 var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit'); 3992 if (owlCustomNav.length) { 3993 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3994 owlCustomNav.addClass('style-dark').removeClass('style-light'); 3995 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3996 owlCustomNav.addClass('style-light').removeClass('style-dark'); 3997 } 3998 } 3999 } 4000 var itendIndex = $(currentItem).attr('data-index'); 4001 if ( isNaN(itendIndex) ) { 4002 itendIndex = 1; 4003 } 4004 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 4005 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 4006 if ($.fn.counterUp) { 4007 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 4008 var $counter = $(this); 4009 $counter.addClass('started').counterUp({ 4010 delay: 10, 4011 time: 1500 4012 }); 4013 }); 4014 } 4015 } 4016 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 4017 }, 200); 4018 } 4019 tempTimeStamp = event.timeStamp; 4020 } 4021 4022 /** Initialize */ 4023 $elSelector.on('initialize.owl.carousel', function(event) { 4024 if (typeof UNCODE.owlNav !== 'undefined') { 4025 UNCODE.owlNav(itemID, event); 4026 } 4027 4028 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4029 window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) { 4030 var shortcode = model.attributes.shortcode, 4031 $el = model.view.$el, 4032 $row_wrap = $el.closest('.row'); 4033 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4034 $row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove(); 4035 } 4036 }); 4037 window.parent.vc.events.on('shortcodeView:updated', function(model) { 4038 var shortcode = model.attributes.shortcode; 4039 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4040 tempTimeStamp = Math.floor(Date.now() / 1000); 4041 } 4042 }); 4043 window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) { 4044 var shortcode = model.attributes.shortcode; 4045 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 4046 UNCODE.owlNav(itemID, event); 4047 $elSelector.trigger('refresh.owl.carousel'); 4048 } 4049 }); 4050 } 4051 }); 4052 4053 /** Initialized */ 4054 $elSelector.on('initialized.owl.carousel', function(event) { 4055 4056 if ( $('.isotope-container', event.currentTarget).length ) { 4057 window.dispatchEvent(UNCODE.boxEvent); 4058 } 4059 4060 $('.owl-dot.active', $elSelector).on('click', function(){ 4061 return false;
4062 }); 4063 4064 var thiis = $(event.currentTarget), 4065 // get the time from the data method 4066 time = thiis.data("timer-id"), 4067 rowParent = thiis.closest('.row-parent'); 4068 4069 if ( typeof rowParent[0] !== 'undefined' ) { 4070 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 4071 } 4072 4073 if (time) { 4074 clearRequestTimeout(time); 4075 } 4076 4077 thiis.addClass('showControls'); 4078 var new_time = requestTimeout(function() { 4079 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 4080 if (thiis.hasClass('owl-height-viewport')) 4081 setItemsRelHeight(thiis); 4082 if (thiis.hasClass('owl-height-equal')) 4083 setItemsHeight(thiis); 4084 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 4085 if (thiis.closest('.unequal, .unexpand').length) { 4086 UNCODE.setRowHeight(rowParent[0], true); 4087 } 4088 if (SiteParameters.dynamic_srcset_active === '1') { 4089 UNCODE.refresh_dynamic_srcset_size(thiis); 4090 } 4091 }, 350); 4092 // save the new time 4093 thiis.data("timer-id", new_time); 4094 4095 var scrolltop = $(document).scrollTop(); 4096 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 4097 4098 //if (!UNCODE.isMobile) { 4099 /** fix autoplay when visible **/ 4100 $(window).on('load', function(){ 4101 if (thiis.data('autoplay')) { 4102 if ( !thiis.closest('.sticky-element').length ) { 4103 thiis.trigger('stop.autoplay.owl'); 4104 } else { 4105 thiis.trigger('play.owl.autoplay'); 4106 } 4107 } 4108 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 4109 return; 4110 } 4111 if ( ! thiis.closest('.sticky-element').length ) { 4112 var carouselInView = new Waypoint.Inview({ 4113 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4114 element: thiis[0], 4115 exited: function() { 4116 var el = $(this.element); 4117 if (el.data('autoplay') ) { 4118 el.trigger('stop.owl.autoplay'); 4119 el.data('stopped','true'); 4120 } 4121 }, 4122 enter: function(direction) { 4123 var el = $(this.element); 4124 requestTimeout(function() { 4125 if (el.data('autoplay')) { 4126 el.trigger('play.owl.autoplay'); 4127 el.data('stopped','false'); 4128 } 4129 }, 100); 4130 } 4131 }); 4132 } 4133 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4134 setTimeout(function(){ 4135 window.lenis.resize(); 4136 }, 1000); 4137 } 4138 4139 $('.owl-dot', event.currentTarget).each(function(key, val){ 4140 $(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1)); 4141 }); 4142 4143 }); 4144 //} 4145 4146 // $(window).on('frontend:carousel_updated', function(){ 4147 // Waypoint.refreshAll(); 4148 // }); 4149 4150 if (!thiis.closest('.isotope-system').length) { 4151 requestTimeout(function() { 4152 animate_thumb($('.t-inside', el), event); 4153 }, 400); 4154 } else { 4155 requestTimeout(function() { 4156 thiis.closest('.isotope-container').isotope('layout'); 4157 }, 400); 4158 } 4159 4160 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4161 currentIndex = $(currentItem).attr('data-index'); 4162 4163 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4164 if ($(val).closest('.uncode-slider').length) { 4165 $(val).removeClass('start_animation'); 4166 } 4167 }); 4168 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4169 if ($(val).closest('.uncode-slider').length) { 4170 $(val).removeClass('already-animated'); 4171 } 4172 }); 4173 4174 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4175 if ($(val).closest('.uncode-slider').length) { 4176 $(val).removeAttr('data-animated'); 4177 } 4178 }); 4179 4180 $.each($('.owl-item.cloned', thiis), function(index, val) { 4181 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 4182 }); 4183 4184 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4185 if ($(val).attr('data-index') != currentIndex) { 4186 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4187 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4188 } 4189 if ($(val).attr('data-index') != currentIndex) { 4190 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 4191 } 4192 if ($(val).attr('data-index') == currentIndex) { 4193 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4194 } 4195 }); 4196 4197 if (thiis.closest('.uncode-slider').length) { 4198 var el = thiis.closest('.row-parent')[0], 4199 section = thiis.closest('.vc_section'); 4200 if ( section.length ) { 4201 el = $('> .row-parent', section)[0]; 4202 } 4203 if ($(el).data('imgready')) { 4204 firstLoaded(el, event); 4205 } else { 4206 el.addEventListener("imgLoaded", function(el) { 4207 firstLoaded(el.target, event); 4208 }, false); 4209 } 4210 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 4211 if (transHeight != null) { 4212 requestTimeout(function() { 4213 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 4214 }, 100); 4215 } 4216 } else { 4217 var el = thiis; 4218 el.closest('.uncode-slider').addClass('slider-loaded'); 4219 } 4220 4221 requestTimeout(function() { 4222 if (typeof UNCODE.bigText !== 'undefined') { 4223 UNCODE.bigText(thiis); 4224 } 4225 if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) { 4226 if (thiis.data('autoplay')) pauseOnHover(thiis); 4227 } 4228 }, 500); 4229 4230 if (thiis.closest('.unequal').length) { 4231 $owlInsideEqual.push(thiis.closest('.row-parent')); 4232 } 4233 4234 var containerClasses = '', 4235 containerStyle = '';
4236 if ( $('.owl-dots-classes', $owlContainer).length ) { 4237 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 4238 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 4239 $('.owl-dots-classes', $owlContainer).remove(); 4240 } 4241 4242 if ( containerClasses !== '' ) { 4243 requestTimeout(function() { 4244 if ( containerClasses !== '' ) 4245 $('.owl-dots', $owlContainer).attr('style', containerStyle); 4246 if ( containerStyle !== '' ) 4247 $('.owl-dots', $owlContainer).addClass(containerClasses); 4248 }, 100); 4249 } 4250 4251 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 4252 $(val).closest('.row-inner').css({ 4253 'margin-top': '-1px' 4254 }); 4255 }); 4256 4257 if ($.fn.isotope) { 4258 if ( thiis.closest('.isotope-container').length ) { 4259 if (thiis.closest('.isotope-container').data('isotope')) { 4260 requestTimeout(function(){ 4261 thiis.closest('.isotope-container').isotope('layout'); 4262 }, 300); 4263 } 4264 $(window).on('load', function(){ 4265 if (thiis.closest('.isotope-container').data('isotope')) { 4266 thiis.closest('.isotope-container').isotope('layout'); 4267 } 4268 }); 4269 } 4270 } 4271 4272 if (thiis.data('autoplay')) { 4273 $(window).on('menuOpen', function(){ 4274 thiis.trigger('stop.owl.autoplay'); 4275 thiis.data('stopped','true'); 4276 }).on('menuClose', function(){ 4277 4278 }); 4279 } 4280 $(window).on('menuClose', function(){ 4281 if (thiis.data('autoplay')) { 4282 thiis.trigger('play.owl.autoplay'); 4283 thiis.data('stopped','false'); 4284 } 4285 }); 4286 4287 setIndexActive(event, true); 4288 4289 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 4290 return !$(this).closest('.nested-carousel').length; 4291 }), 4292 $_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), 4293 $galleries = $_galleries.filter(function( index ) { 4294 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 4295 }); 4296 4297 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 4298 UNCODE.lightgallery( $galleries ); 4299 } 4300 4301 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4302 $(document).trigger('uncode-scrolltrigger-refresh'); 4303 } 4304 }); 4305 4306 $elSelector.on('resized.owl.carousel', function(event) { 4307 var thiis = $(event.currentTarget); 4308 // if ($(this).closest('.nested-carousel').length) { 4309 // requestTimeout(function() { 4310 // window.dispatchEvent(UNCODE.boxEvent); 4311 // }, 200); 4312 // } 4313 if ( thiis.hasClass('owl-height-equal') ) 4314 setItemsHeight(thiis); 4315 4316 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4317 newWidth = UNCODE.wwidth; 4318 setItemsRelHeight($elSelector); 4319 } 4320 4321 setIndexActive(event); 4322 4323 if (SiteParameters.dynamic_srcset_active === '1') { 4324 UNCODE.refresh_dynamic_srcset_size(thiis); 4325 } 4326 4327 if ($.fn.isotope) { 4328 $(window).on('load', function(){ 4329 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 4330 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 4331 } 4332 }); 4333 } 4334 4335 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4336 setTimeout(function(){ 4337 window.lenis.resize(); 4338 }, 1000); 4339 } 4340 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4341 $(document).trigger('uncode-scrolltrigger-refresh'); 4342 } 4343 }); 4344 4345 $elSelector.on('refreshed.owl.carousel', function(event) { 4346 setIndexActive(event); 4347 }); 4348 4349 /** detect resize window for fluid height layout */ 4350 var setFluidResize; 4351 function manageFluidCarouseHeight() { 4352 clearRequestTimeout(setFluidResize); 4353 setFluidResize = requestTimeout(function(){ 4354 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4355 newWidth = UNCODE.wwidth; 4356 setItemsRelHeight($elSelector); 4357 } 4358 }, 100); 4359 }
4360 window.addEventListener('resize', manageFluidCarouseHeight); 4361 4362 /** Change */ 4363 $elSelector.on('change.owl.carousel', function(event) { 4364 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 4365 }); 4366 4367 /** Changed */ 4368 $elSelector.on('changed.owl.carousel', function(event) { 4369 var $row = $elSelector.parents('.row')[0]; 4370 if ( typeof $row !== 'undefined' ) { 4371 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 4372 } 4373 setIndexActive(event); 4374 }); 4375 4376 var checkDrag = function(e) { 4377 $elSelector.addClass('owl-dragging'); 4378 }; 4379 $elSelector.on('drag.owl.carousel', function(event) { 4380 document.addEventListener("mousemove", checkDrag); 4381 }); 4382 4383 $elSelector.on('dragged.owl.carousel', function(event) { 4384 $elSelector.removeClass('owl-dragging'); 4385 document.removeEventListener("mousemove", checkDrag); 4386 }); 4387 4388 $elSelector.on('translate.owl.carousel', function(event) { 4389 if (UNCODE.isMobile) { 4390 $(event.currentTarget).addClass('owl-translating'); 4391 } 4392 }); 4393 4394 /** Translated */ 4395 $elSelector.on('translated.owl.carousel', function(event) { 4396 4397 var thiis = $(event.currentTarget), 4398 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4399 currentIndex = $(currentItem).attr('data-index'), 4400 stagePadding = thiis.data('stagepadding'); 4401 4402 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4403 4404 if (!UNCODE.isMobile) { 4405 UNCODE.owlPlayVideo(thiis); 4406 } 4407 4408 requestTimeout(function(){ 4409 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 4410 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 4411 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 4412 if (lastDelayElems == undefined) lastDelayElems = 0; 4413 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4414 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4415 thiis.trigger('stop.owl.autoplay'); 4416 requestTimeout(function() { 4417 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 4418 }, maxDelay); 4419 } 4420 }, 200); 4421 4422 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4423 if ($(val).closest('.uncode-slider').length) { 4424 $(val).removeClass('start_animation'); 4425 } 4426 }); 4427 4428 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4429 if ($(val).closest('.uncode-slider').length) { 4430 $(val).removeClass('already-animated'); 4431 } 4432 }); 4433 4434 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4435 if ($(val).closest('.uncode-slider').length) { 4436 $(val).removeAttr('data-animated'); 4437 } 4438 }); 4439 4440 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4441 if ($(val).attr('data-index') != currentIndex) { 4442 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4443 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4444 } 4445 if ($(val).attr('data-index') != currentIndex) { 4446 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4447 } 4448 if ($(val).attr('data-index') == currentIndex) { 4449 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4450 } 4451 }); 4452 4453 if (UNCODE.isMobile) { 4454 thiis.removeClass('owl-translating'); 4455 } 4456 4457 setIndexActive(event); 4458 }); 4459 4460 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4461 4462 /** Init carousel */ 4463 $elSelector.not('.showControls').owlCarousel({ 4464 items: values['items'], 4465 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4466 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4467 nav: values['nav'], 4468 dots: values['dots'], 4469 loop: values['loop'], 4470 stagePadding: values['stagepadding'], 4471 margin: 0, 4472 video: true, 4473 autoWidth: false, 4474 autoplay: false, 4475 autoplayTimeout: values['timeout'], 4476 autoplaySpeed: values['navspeed'], 4477 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4478 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4479 rtl: $('body').hasClass('rtl') ? true : false, 4480 fluidSpeed: true, 4481 navSpeed: values['navspeed'], 4482 dotsSpeed: values['navspeed'] / values['items'], 4483 navElement: ['button type="button" role="presentation" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" role="presentation" aria-label="' + SiteParameters.uncode_next_label + '"'], 4484 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4485 navText: ['<div class="owl-nav-container btn-default btn-hover-nobg" tabindex="0"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg" aria-label="' + SiteParameters.uncode_next_label + '" tabindex="0"><i class="fa fa-fw fa-angle-right"></i></div>'], 4486 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4487 responsiveClass: true, 4488 responsiveBaseElement: '.box-container', 4489 responsive: { 4490 0: { 4491 items: values['sm'], 4492 nav: values['navmobile'], 4493 dots: values['dotsmobile'], 4494 dotsSpeed: values['navspeed'] / values['sm'], 4495 }, 4496 480: { 4497 items: values['sm'], 4498 nav: values['navmobile'], 4499 dots: values['dotsmobile'], 4500 dotsSpeed: values['navspeed'] / values['sm'], 4501 }, 4502 570: { 4503 items: values['md'], 4504 nav: values['navmobile'], 4505 dots: values['dotsmobile'], 4506 dotsSpeed: values['navspeed'] / values['md'], 4507 }, 4508 960: { 4509 items: values['lg'], 4510 dotsSpeed: values['navspeed'] / values['lg'], 4511 } 4512 } 4513 }); 4514 4515 var transDuration = parseFloat(values['navspeed']) * 0.3; 4516 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4517 4518 $('.owl-item .tmb', $elSelector).css({ 4519 '-webkit-transition-delay': transDuration + 'ms', 4520 '-moz-transition-delay': transDuration + 'ms', 4521 '-o-transition-delay': transDuration + 'ms', 4522 'transition-delay': transDuration + 'ms', 4523 '-webkit-transition-duration': transDuration2 + 'ms', 4524 '-moz-transition-duration': transDuration2 + 'ms', 4525 '-o-transition-duration': transDuration2 + 'ms', 4526 'transition-duration': transDuration2 + 'ms', 4527 }); 4528 4529 requestTimeout(function() { 4530 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4531 UNCODE.setRowHeight($owlInsideEqual[i]); 4532 }; 4533 }, 300); 4534 4535 $(window).on('load', function(){ 4536 var $elCarousel = $elSelector.data('owl.carousel'); 4537 if ( typeof $elCarousel !== 'undefined' ) { 4538 $elCarousel.trigger('refreshed'); 4539 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4540 UNCODE.setRowHeight($owlInsideEqual[i]); 4541 }; 4542 } 4543 }); 4544 4545 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4546 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4547 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4548 $('#' + carousel_id).find('.owl-item').each( function() { 4549 var $item = $(this), 4550 index = ( $item.index() + 1 ); 4551 $item.attr('data-index', index); 4552 }); 4553 } 4554 }); 4555 4556 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4557 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4558 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4559 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4560 $('#' + carousel_id).find('.owl-item').each( function() { 4561 var $item = $(this), 4562 index = ( $item.index() + 1 ); 4563 $item.attr('data-index', index); 4564 }); 4565 } 4566 }); 4567 } 4568 4569 }); 4570 4571 function firstLoaded(el, event) { 4572 var el = $(el), 4573 uncode_slider = el.find('.uncode-slider'); 4574 el.find('.owl-carousel').css('opacity', 1); 4575 uncode_slider.addClass('slider-loaded'); 4576 if (typeof UNCODE.bigText !== 'undefined') { 4577 UNCODE.bigText(el.find('.owl-item.active')); 4578 } 4579 //if (!UNCODE.isMobile) { 4580 requestTimeout(function() { 4581 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4582 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4583 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4584 if (lastDelayElems == undefined) lastDelayElems = 0; 4585 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4586 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4587 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4588 requestTimeout(function() { 4589 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4590 }, maxDelay); 4591 } 4592 }, 500); 4593 4594 //} 4595 } 4596 4597 function navHover(el) { 4598 var $owlCont = el, 4599 $owlPrev = $owlCont.find('.owl-prev'), 4600 $owlNext = $owlCont.find('.owl-next'), 4601 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4602 $owlPagination = $owlCont.next(), 4603 owlPrevW = $owlPrev.outerWidth(), 4604 owlNextW = $owlNext.outerWidth(), 4605 owlDotsH = $owlDots.innerHeight(), 4606 owlTime = 400, 4607 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4608 if ( $('body').hasClass('rtl') ) { 4609 $owlPrev.css("margin-right", -owlPrevW); 4610 $owlNext.css("margin-left", -owlNextW); 4611 } else { 4612 $owlPrev.css("margin-left", -owlPrevW); 4613 $owlNext.css("margin-right", -owlNextW); 4614 } 4615 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4616 $owlCont.mouseenter(function() { 4617 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4618 $owlPrev.add($owlNext).css({ 4619 marginLeft: 0, 4620 marginRight: 0 4621 }); 4622 if (!owlNested) { 4623 $owlDots.css({ 4624 opacity: 1, 4625 bottom: 0 4626 }); 4627 } 4628 }).mouseleave(function() { 4629 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4630 if ( $('body').hasClass('rtl') ) { 4631 $owlPrev.css("margin-right", -owlPrevW); 4632 $owlNext.css("margin-left", -owlNextW); 4633 } else { 4634 $owlPrev.css("margin-left", -owlPrevW); 4635 $owlNext.css("margin-right", -owlNextW); 4636 } 4637 if (!owlNested) { 4638 $owlDots.css({ 4639 opacity: 1, 4640 bottom: -owlDotsH 4641 }); 4642 } 4643 }); 4644 }; 4645 4646 function animate_elems($this) { 4647 var lastDelay; 4648 $.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) { 4649 var element = $(val), 4650 delayAttr = element.attr('data-delay'), 4651 $first_item = element.closest('.owl-item[data-index="1"]'); 4652 4653 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4654 return false;
4655 } 4656 4657 if (delayAttr == undefined) delayAttr = 0; 4658 requestTimeout(function() { 4659 element.addClass('start_animation'); 4660 }, delayAttr); 4661 lastDelay = delayAttr; 4662 }); 4663 return lastDelay; 4664 } 4665 4666 function animate_thumb(items, event) { 4667 var lastDelay, 4668 itemIndex, 4669 thiis = $(event.currentTarget), 4670 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4671 numActives = $('.owl-item.active', thiis).length, 4672 stagePadding = thiis.data('stagepadding'); 4673 4674 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4675 4676 thiis.data('tempIndex', event.item.index); 4677 $.each(items, function(index, val) { 4678 var parent = $(val).closest('.owl-item'); 4679 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4680 return; 4681 } 4682 if (!$(val).hasClass('start_animation')) { 4683 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4684 var thumbInView = new Waypoint.Inview({ 4685 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4686 element: val, 4687 enter: function(direction) { 4688 var element = $(this.element), 4689 delayAttr = parseInt(element.attr('data-delay')), 4690 itemIndex = element.closest('.owl-item').index() + 1, 4691 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4692 if (itemIndex > tempIndex) { 4693 thiis.data('tempIndex', itemIndex); 4694 } 4695 if (isNaN(delayAttr)) delayAttr = 100; 4696 if (stagePadding) { 4697 var objTimeout = requestTimeout(function() { 4698 element.addClass('start_animation'); 4699 }, index * delayAttr); 4700 lastDelay = index * delayAttr; 4701 } else { 4702 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4703 var objTimeout = requestTimeout(function() { 4704 element.addClass('start_animation'); 4705 }, diffItem * delayAttr); 4706 lastDelay = diffItem * delayAttr; 4707 } 4708 parent.data('objTimeout', objTimeout); 4709 if (!UNCODE.isUnmodalOpen) { 4710 this.destroy(); 4711 } 4712 } 4713 }); 4714 } 4715 } 4716 }); 4717 return lastDelay; 4718 } 4719 4720 function setItemsHeight(item) { 4721 $.each($('.owl-item', item), function(index, val) { 4722 var availableThumbHeight = $('.t-inside', $(val)).height(), 4723 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4724 difference = availableThumbHeight - innerThumbHeight; 4725 if ($('.tmb-content-under', val).length) { 4726 var visualPart = $('.t-entry-visual', val); 4727 if (visualPart.length) { 4728 difference -= $('.t-entry-visual', val).height(); 4729 } 4730 } 4731 if (! $('.tmb-content-lateral', val).length) 4732 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4733 }); 4734 } 4735 4736 function setItemsRelHeight(item) { 4737 $.each($('.owl-item', item), function(index, val) { 4738 var $rowContainer = $(item).parents('.row-parent').eq(0), 4739 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4740 $colContainer = $(item).parents('.uncell').eq(0), 4741 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4742 winHeight = UNCODE.wheight, 4743 multiplier_h = parseInt($(item).attr('data-vp-height')), 4744 data_viewport_h, 4745 consider_menu = $(item).data('vp-menu'); 4746 4747 if ( consider_menu ) { 4748 winHeight = winHeight - UNCODE.menuHeight; 4749 } 4750 4751 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4752 $('.t-inside', val).css( 'height', data_viewport_h ); 4753 }); 4754 } 4755 4756 function pauseOnHover(slider) { 4757 var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next'); 4758 $('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({ 4759 mouseenter: function () { 4760 $(slider).addClass('owl-mouseenter'); 4761 $(slider).trigger('stop.owl.autoplay'); 4762 }, 4763 mouseleave: function () { 4764 $(slider).removeClass('owl-mouseenter'); 4765 $(slider).trigger('play.owl.autoplay'); 4766 } 4767 }); 4768 } 4769 }); 4770}; 4771 4772UNCODE.owlPlayVideo = function(carousel) { 4773 var player, iframe; 4774 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4775 var content = $(val).html(); 4776 if (content == '') { 4777 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4778 $(val).append(getCloned); 4779 } 4780 if ($(this).attr('data-provider') == 'vimeo') { 4781 iframe = $(this).find('iframe'); 4782 player = new Vimeo.Player(iframe[0]); 4783 player.play(); 4784 } else if ($(this).attr('data-provider') == 'youtube') { 4785 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4786 } else { 4787 var player = $(this).find('video'); 4788 if (player.length) { 4789 $(this).find('video')[0].volume = 0; 4790 $(this).find('video')[0].play(); 4791 $(val).css('opacity', 1); 4792 } 4793 } 4794 }); 4795}; 4796 4797UNCODE.owlStopVideo = function(carousel) { 4798 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4799 var player, iframe; 4800 if ($(this).attr('data-provider') == 'vimeo') { 4801 iframe = $(this).find('iframe'); 4802 player = new Vimeo.Player(iframe[0]); 4803 player.pause(); 4804 } else if ($(this).attr('data-provider') == 'youtube') { 4805 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4806 } else { 4807 var player = $(this).find('video'); 4808 if (player.length) { 4809 $(this).find('video')[0].volume = 0; 4810 $(this).find('video')[0].play(); 4811 } 4812 } 4813 }); 4814}; 4815 4816UNCODE.animations = function() { 4817 4818 var runWaypoints_TO, 4819 runWaypoints_carousel_TO, 4820 runWaypoints_delay = 0, 4821 highlightComplexFunc = function($wrap, ev){ 4822 4823 var $lines = $('.heading-line-wrap', $wrap), 4824 not_animate = false;
4825 4826 if ( $wrap.data('animate') === true ) { 4827 not_animate = true; 4828 } 4829 4830 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4831 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4832 return; 4833 } 4834 4835 $lines.each(function(_key, _value){ 4836 var $line = $(_value), 4837 $inners = $('.split-word-inner', $line), 4838 $highlights = $('.heading-text-highlight-inner', $line); 4839 4840 var highlitInnerFunc = function(ev){ 4841 var delay = 0; 4842 $highlights.each(function(h_key, high){ 4843 var $highlight = $(high), 4844 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4845 $nextSplit = $split.nextUntil(), 4846 $next = $('.heading-text-highlight-inner', $nextSplit), 4847 countCh = $split.text().length; 4848 4849 $highlight.css({ 4850 '-webkit-transition-duration': (30 * countCh) + 'ms', 4851 '-moz-transition-duration': (30 * countCh) + 'ms', 4852 '-o-transition-duration': (30 * countCh) + 'ms', 4853 'transition-duration': (30 * countCh) + 'ms', 4854 }); 4855 4856 delay += (30 * countCh); 4857 4858 $next.css({ 4859 '-webkit-transition-delay': delay + 'ms', 4860 '-moz-transition-delay': delay + 'ms', 4861 '-o-transition-delay': delay + 'ms', 4862 'transition-delay': delay + 'ms', 4863 }); 4864 }); 4865 $highlights.removeAttr('data-animated'); 4866 if ( _key+1 === $lines.length ) { 4867 $wrap.data('animate', true); 4868 } 4869 }; 4870 4871 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4872 if ( not_animate ) { 4873 $highlights.each(function(h_key, high){ 4874 var $highlight = $(high); 4875 $highlight.css({ 4876 '-webkit-transition-duration': '0ms', 4877 '-moz-transition-duration': '0ms', 4878 '-o-transition-duration': '0ms', 4879 'transition-duration': '0ms', 4880 }); 4881 }); 4882 $highlights.removeAttr('data-animated'); 4883 } else { 4884 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4885 highlitInnerFunc(); 4886 } else { 4887 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4888 } 4889 } 4890 } 4891 }); 4892 }; 4893 4894 $.each($('.header-content-inner'), function(index, val) { 4895 var element = $(val), 4896 transition = ''; 4897 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4898 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4899 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4900 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4901 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4902 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4903 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4904 if (transition != '') { 4905 $(val).removeClass(transition); 4906 var container = element, 4907 containerDelay = container.attr('data-delay'), 4908 containerSpeed = container.attr('data-speed'), 4909 items = $('.header-title > *, .post-info', container); 4910 $.each(items, function(index, val) { 4911 var element = $(val), 4912 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4913 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4914 if (!element.hasClass('animate_when_almost_visible')) { 4915 delayAttr = Number(delayAttr) + (400 * index); 4916 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4917 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4918 } 4919 }); 4920 container.css('opacity', 1); 4921 } 4922 }); 4923 4924 function animate_css_grids_on_load() { 4925 $('.cssgrid-system').each(function() { 4926 var grid = $(this); 4927 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4928 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4929 }); 4930 } 4931 4932 var delayAdd = 0; 4933 4934 window.waypoint_animation = function(ev) { 4935 $.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) { 4936 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 ) ) { 4937 return true; 4938 } 4939 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4940 return; 4941 } 4942 var run = true, 4943 $carousel = $(val).closest('.owl-carousel'), 4944 marquee = $(val).closest('.tmb-linear').length; 4945 if ( $carousel.length ) { 4946 run = false;
4947 } 4948 if (run) { 4949 new Waypoint({ 4950 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4951 element: val, 4952 handler: function() { 4953 var element = $(this.element), 4954 index = element.index(), 4955 delayAttr = element.attr('data-delay'); 4956 if (delayAttr == undefined) delayAttr = 0; 4957 // delayAttr = parseFloat(delayAttr) + delayAdd; 4958 // if ( marquee ) { 4959 // delayAdd += 50; 4960 // } else { 4961 // delayAdd = 0; 4962 // } 4963 requestTimeout(function() { 4964 element.addClass('start_animation'); 4965 }, delayAttr); 4966 if (!UNCODE.isUnmodalOpen) { 4967 this.destroy(); 4968 } 4969 }, 4970 offset: UNCODE.isFullPage ? '100%' : '90%' 4971 }); 4972 } 4973 }); 4974 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4975 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4976 return; 4977 } 4978 var run = true, 4979 $carousel = $(val).closest('.owl-carousel'); 4980 if ( $carousel.length ) { 4981 run = false; 4982 } 4983 if (run) { 4984 new Waypoint({ 4985 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4986 element: val, 4987 handler: function() { 4988 var $element = $(this.element), 4989 $childs = $('.animate_when_parent_almost_visible', $element); 4990 $childs.each(function(key,el){ 4991 var $child = $(el), 4992 delaySpeed = $child.attr('data-speed'), 4993 delayAttr = $child.attr('data-delay'), 4994 intervalAttr = $child.attr('data-interval'); 4995 if (delayAttr == undefined) { 4996 delayAttr = 50*key; 4997 } 4998 requestTimeout(function() { 4999 $child.addClass('start_animation'); 5000 if ( $child.hasClass('anim-line-checker') ) { 5001 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5002 var $line = $child.closest('.heading-line-wrap'); 5003 }); 5004 } 5005 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 5006 highlightComplexFunc($wrapText, ev); 5007 if ( $child.hasClass('anim-tot-checker') ) { 5008 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5009 if ( $child.hasClass('anim-tot-checker') ) { 5010 $wrapText.addClass('already-animated'); 5011 $element.trigger('already-animated'); 5012 } 5013 }); 5014 } 5015 }, delayAttr ); 5016 }); 5017 $element.addClass('start_animation'); 5018 if (!UNCODE.isUnmodalOpen) { 5019 this.destroy(); 5020 } 5021 }, 5022 offset: UNCODE.isFullPage ? '100%' : '90%' 5023 }); 5024 } 5025 }); 5026 } 5027 window.waypoint_carousel_animation = function(ev) { 5028 $.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) { 5029 if ( $(val).hasClass('el-text-split') ) { 5030 return true; 5031 } 5032 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5033 return; 5034 } 5035 var run = true, 5036 $carousel = $(val).closest('.owl-carousel'), 5037 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5038 $all_first = $('.owl-item[data-index="1"]', $carousel); 5039 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5040 run = false; 5041 } 5042 if (run) { 5043 new Waypoint({ 5044 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5045 element: val, 5046 handler: function() { 5047 var element = $(this.element), 5048 index = element.index(), 5049 delayAttr = element.attr('data-delay'); 5050 if (delayAttr == undefined) delayAttr = 0; 5051 requestTimeout(function() { 5052 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5053 $all_first.attr('data-already-reached', 'true'); 5054 } 5055 element.addClass('start_animation'); 5056 }, delayAttr); 5057 if (!UNCODE.isUnmodalOpen) { 5058 this.destroy(); 5059 } 5060 }, 5061 offset: UNCODE.isFullPage ? '100%' : '90%' 5062 }); 5063 } 5064 }); 5065 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 5066 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5067 return; 5068 } 5069 var run = true, 5070 $carousel = $(val).closest('.owl-carousel'), 5071 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5072 $all_first = $('.owl-item[data-index="1"]', $carousel); 5073 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5074 run = false;
5075 } 5076 if (run) { 5077 new Waypoint({ 5078 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5079 element: val, 5080 handler: function() { 5081 var $element = $(this.element), 5082 $childs = $('.animate_when_parent_almost_visible', $element); 5083 $childs.each(function(key,el){ 5084 var $child = $(el), 5085 delaySpeed = $child.attr('data-speed'), 5086 delayAttr = $child.attr('data-delay'), 5087 intervalAttr = $child.attr('data-interval'); 5088 if (delayAttr == undefined) { 5089 delayAttr = 50*key; 5090 } 5091 requestTimeout(function() { 5092 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5093 $all_first.attr('data-already-reached', 'true'); 5094 } 5095 $child.addClass('start_animation'); 5096 if ( $child.hasClass('anim-line-checker') ) { 5097 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5098 var $line = $child.closest('.heading-line-wrap'); 5099 }); 5100 } 5101 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 5102 highlightComplexFunc($wrapText, ev); 5103 if ( $child.hasClass('anim-tot-checker') ) { 5104 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5105 if ( $child.hasClass('anim-tot-checker') ) { 5106 $wrapText.addClass('already-animated'); 5107 } 5108 }); 5109 } 5110 }, delayAttr ); 5111 }); 5112 $element.addClass('start_animation'); 5113 if (!UNCODE.isUnmodalOpen) { 5114 this.destroy(); 5115 } 5116 }, 5117 offset: UNCODE.isFullPage ? '100%' : '90%' 5118 }); 5119 } 5120 }); 5121 } 5122 5123 var runWaypoints = function(ev){ 5124 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 5125 runWaypoints_delay = 400; 5126 } 5127 clearRequestTimeout(runWaypoints_TO); 5128 runWaypoints_TO = requestTimeout(function() { 5129 window.waypoint_animation(ev); 5130 }, runWaypoints_delay); 5131 5132 clearRequestTimeout(runWaypoints_carousel_TO); 5133 runWaypoints_carousel_TO = requestTimeout(function() { 5134 window.waypoint_carousel_animation(ev); 5135 }, 400); 5136 }; 5137 runWaypoints(); 5138 animate_css_grids_on_load(); 5139 5140 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 5141 runWaypoints(ev); 5142 }); 5143 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 5144 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 5145 window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints ); 5146 } 5147}; 5148 5149UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 5150 var $allItems = elements.length - startIndex, 5151 showed = 0, 5152 index = 0, 5153 use_index = false 5154 ; 5155 5156 if (filtering) { 5157 if (sequential) { 5158 use_index = true; 5159 } 5160 sequential = false; 5161 } 5162 5163 $.each(elements, function(index, val) { 5164 var $this = $(val), 5165 elInner = $('> .t-inside', val); 5166 5167 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5168 return; 5169 } 5170 if (val[0]) val = val[0]; 5171 5172 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 5173 new Waypoint({ 5174 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5175 element: val, 5176 handler: function() { 5177 var element = $('> .t-inside', this.element), 5178 parent = $(this.element); 5179 var _index = use_index? index : 0; 5180 5181 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 5182 delayAttr = parseInt(element.attr('data-delay')); 5183 if (isNaN(delayAttr)) delayAttr = 100; 5184 if (sequential || use_index) { 5185 delay -= showed; 5186 } 5187 var objTimeout = requestTimeout(function() { 5188 element.removeClass('zoom-reverse').addClass('start_animation'); 5189 showed = index; 5190 }, delay * delayAttr); 5191 parent.data('objTimeout', objTimeout); 5192 if (!UNCODE.isUnmodalOpen) { 5193 this.destroy(); 5194 } 5195 }, 5196 offset: UNCODE.isFullPage ? '100%' : '90%' 5197 }); 5198 } 5199 5200 index++; 5201 }); 5202}; 5203 5204UNCODE.tapHover = function() { 5205 5206 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
5206isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 5207 elClass = "hover"; 5208 5209 $(window).on('click', function() { 5210 $el.removeClass(elClass); 5211 }); 5212 5213 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 5214 e.stopPropagation(); 5215 var link = $(this); 5216 if ( ! link.hasClass(elClass)) { 5217 e.preventDefault(); 5218 link.addClass("hover"); 5219 $el.not(this).removeClass(elClass); 5220 return false; 5221 } 5222 }); 5223}; 5224 5225UNCODE.onePage = function(isMobile) { 5226 var current = 0, 5227 last = 0, 5228 lastScrollTop = 0, 5229 forceScroll = false, 5230 lastScrolled = 0, 5231 isSectionscroller = ($('.main-onepage').length) ? true : false, 5232 isOnePage = false, 5233 getOffset = function () { 5234 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); 5235 return calculateOffset; 5236 } 5237 5238 isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile; 5239 5240 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 5241 // return false; 5242 5243 function init_onepage() { 5244 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 5245 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 5246 } 5247 last = $('.onepage-pagination li').last().find('a').data('index'); 5248 $.each($('div[data-parent="true"]'), function(index, val) { 5249 $(this).attr('data-section', index); 5250 if (isMobile) return; 5251 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5252 return; 5253 } 5254 var sectionDown = new Waypoint({ 5255 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5256 element: val, 5257 handler: function(direction) { 5258 if (direction == 'down') { 5259 changeMenuActive(this.element, index); 5260 } 5261 }, 5262 offset: function() { 5263 return 5 + getOffset() 5264 } 5265 }); 5266 var sectionUp = new Waypoint({ 5267 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5268 element: val, 5269 handler: function(direction) { 5270 if (direction == 'up') { 5271 changeMenuActive(this.element, index); 5272 } 5273 }, 5274 offset: function() { 5275 return -5 - getOffset() 5276 } 5277 }); 5278 5279 if (isSectionscroller) { 5280 var label; 5281 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 5282 else label = ''; 5283 var getName = $(this).attr('data-name'); 5284 if (getName == undefined) getName = index; 5285 if (label != '') { 5286 isOnePage = true; 5287 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 5288 $('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 5289 } 5290 } 5291 }); 5292 5293 if (isSectionscroller) { 5294 $.each($('ul.onepage-pagination li'), function(index, val) { 5295 var $this = $(val), 5296 $a = ('a', $this); 5297 $a.on('click', function(evt) { 5298 if ( $('.is-selected', $this).length || UNCODE.scrolling ) { 5299 return false; 5300 } 5301 if ( $('body').hasClass('uncode-scroll-no-history') ) { 5302 evt.preventDefault(); 5303 } 5304 Waypoint.refreshAll(); 5305 var el = $('a', evt.currentTarget); 5306 current = lastScrolled = parseInt(el.attr('data-index')); 5307 lastScrolled += 1; 5308 scrollBody(current); 5309 }); 5310 }); 5311 } 5312 5313 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 5314 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 5315 goToSection = String(window.location.hash).replace(/^#/, ""); 5316 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 5317 } 5318 5319 if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) { 5320 current = lastScrolled = goToSection; 5321 $(window).on('load', function(){ 5322 if ( $('.owl-carousel').length ) { 5323 requestTimeout(function(){ 5324 scrollBody(goToSection); 5325 }, 400); 5326 } else { 5327 scrollBody(goToSection); 5328 } 5329 }); 5330 } 5331 5332 } 5333 5334 function changeMenuActive(section, index) { 5335 current = lastScrolled = parseInt($(section).attr('data-section')); 5336 if (isOnePage) { 5337 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 5338 if (newSection.length) { 5339 $('ul.onepage-pagination li a').removeClass('is-selected'); 5340 newSection.addClass('is-selected'); 5341 } 5342 var getName = $('[data-section="' + index + '"]').attr('data-name'); 5343 if (getName != undefined && getName !== '') { 5344 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 5345 var get_href = $(val).attr('href'); 5346 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5347 $(val).closest('.menu-smart').find('.active').removeClass('active'); 5348 $(val).parent().addClass('active'); 5349 } 5350 }); 5351 } 5352 } 5353 } 5354 5355 if (isOnePage) { 5356 $(window).on('scroll', function() { 5357 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 5358 if (bodyTop == 0) { 5359 $('ul.onepage-pagination li a').removeClass('is-selected'); 5360 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 5361 var getName = $('[data-section=0]').attr('data-name'); 5362 if (getName != undefined && getName !== '') { 5363 $.each($('.menu-container .menu-item > a'), function(i, val) { 5364 var get_href = $(val).attr('href'); 5365 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5366 $(val).closest('ul').find('.active').removeClass('active'); 5367 $(val).parent().addClass('active'); 5368 } 5369 }); 5370 } 5371 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 5372 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 5373 if (lastSection.length) { 5374 $('ul.onepage-pagination li a').removeClass('is-selected'); 5375 lastSection.addClass('is-selected'); 5376 } 5377 } 5378 }); 5379 } 5380 5381 var scrollBody = function(index) { 5382 $('ul.onepage-pagination li a').removeClass('is-selected'); 5383 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 5384 5385 var getSection = $('[data-section=' + index + ']'), 5386 scrollTo; 5387 5388 if (getSection == undefined) return; 5389 5390 var body = $("html, body"), 5391 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5392 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 5393 getOffset = UNCODE.get_scroll_offset(index); 5394 if ( typeof getSection.offset() === 'undefined' ) 5395 return; 5396 scrollTo = getSection.offset().top; 5397
5398 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 5399 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 5400 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 5401 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 5402 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 5403 } 5404 5405 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 5406 if ( index === 0 ) { 5407 scrollTo = 0; 5408 } else { 5409 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 5410 } 5411 } else { 5412 scrollTo -= getOffset; 5413 } 5414 } 5415 5416 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5417 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5418 5419 if (index != 0) { 5420 UNCODE.scrolling = true; 5421 } 5422 5423 if (scrollSpeed == 0) { 5424 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 5425 UNCODE.scrolling = false; 5426 } else { 5427 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5428 $(this).stop(); 5429 }).animate({ 5430 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5431 }, scrollSpeed, 'easeInOutCubic', function() { 5432 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5433 UNCODE.scrolling = false; 5434 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 5435 || 5436 $('.menu-hided').length ) { 5437 scrollTo = getSection.offset().top; 5438 getOffset = UNCODE.get_scroll_offset(index); 5439 scrollTo -= getOffset; 5440 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5441 $(this).stop(); 5442 }).animate({ 5443 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5444 }, scrollSpeed, 'easeInOutCubic', function() { 5445 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5446 UNCODE.scrolling = false; 5447 } 5448 ); 5449 } 5450 }); 5451 } 5452 5453 }; 5454 5455 init_onepage(); 5456}; 5457 5458UNCODE.stickyElements = function() { 5459 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5460 if (!isMobile_wide ) { 5461 5462 var $pageHeader = $('#page-header'), 5463 $headerRow = $('.vc_row', $pageHeader), 5464 $headerSection = $headerRow.closest('section[data-parent]'), 5465 startSticky = false; 5466 5467 if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) { 5468 $headerRow.removeClass('sticky-element'); 5469 $pageHeader.addClass('sticky-element'); 5470 startSticky = true; 5471 } 5472 5473 var calculateOffset = function(el) { 5474 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5475 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5476 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0, 5477 elTop = window.pageYOffset + el.getBoundingClientRect().top; 5478 5479 sideOffset += UNCODE.bodyBorder; 5480 5481 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5482 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) { 5483 if ($('.menu-shrink').length) { 5484 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5485 } else { 5486 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5487 } 5488 } 5489 5490 return sideOffset; 5491 5492 }, 5493 5494 initStickyElement = function($els) { 5495 if ( $('body').hasClass('vc-safe-mode') ) { 5496 return true; 5497 } 5498 if ( typeof $els === 'undefined' ) { 5499 $els = $('.sticky-element'); 5500 } 5501 $.each($els, function(index, element) { 5502 if ($(element).closest('.tab-pane').length) { 5503 var $paneParent = $(element).closest('.tab-pane'); 5504 if ( !$paneParent.hasClass('active') ) { 5505 return true; 5506 } 5507 } 5508 $(element).stick_in_parent({ 5509 sticky_class: 'is_stucked', 5510 offset_top: calculateOffset(element), 5511 bottoming: true, 5512 inner_scrolling: SiteParameters.sticky_elements === 'on' 5513 }); 5514 }); 5515 }; 5516 5517 var oldW = UNCODE.wwidth, 5518 oldH = UNCODE.wHeight; 5519 5520 requestTimeout(function() { 5521 if ($('.sticky-element').length) { 5522 5523 if ($(window).width() > UNCODE.mediaQuery) { 5524 initStickyElement(); 5525
5526 if ( startSticky === true ) { 5527 $('#page-header').trigger('sticky_kit:recalc'); 5528 } 5529 } 5530 5531 $(window).on('resize lateral_resize', function(event) { 5532 if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) { 5533 $(".sticky-element").trigger("sticky_kit:detach"); 5534 if ($(window).width() > UNCODE.mediaQuery) { 5535 initStickyElement(); 5536 } 5537 oldW = UNCODE.wwidth; 5538 oldH = UNCODE.wHeight; 5539 } 5540 }); 5541 } 5542 }, 1000); 5543 5544 if ($('.sticky-element').length) { 5545 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5546 requestTimeout(function() { 5547 $(document.body).trigger("sticky_kit:recalc"); 5548 }, 100); 5549 }); 5550 } 5551 5552 var $panels = $('.panel-collapse'); 5553 if ( $panels.length ) { 5554 $panels.each(function(){ 5555 var $panel = $(this); 5556 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5557 $(document.body).trigger("sticky_kit:recalc"); 5558 }); 5559 }); 5560 } 5561 5562 $('.nav-tabs a').on('shown.bs.tab', function(e){ 5563 var $tabs = $(e.target).closest('.tab-container'), 5564 $panel = $('.tab-pane.active', $tabs), 5565 $els = $(e.target).nextAll(".sticky-element"); 5566 5567 $els.trigger("sticky_kit:detach"); 5568 initStickyElement($els); 5569 }); 5570 5571 $(window).on('vc-safe-mode-on', function(){ 5572 $(".sticky-element").trigger("sticky_kit:detach"); 5573 }); 5574 5575 $(window).on('vc-safe-mode-off', function(){ 5576 initStickyElement(); 5577 }); 5578 } 5579}; 5580 5581UNCODE.twentytwenty = function() { 5582 5583 if (!$('.twentytwenty-container').length) return; 5584 5585// DOM.event.move 5586// 5587// 2.0.0 5588// 5589// Stephen Band 5590// 5591// Triggers 'movestart', 'move' and 'moveend' events after 5592// mousemoves following a mousedown cross a distance threshold, 5593// similar to the native 'dragstart', 'drag' and 'dragend' events. 5594// Move events are throttled to animation frames. Move event objects 5595// have the properties: 5596// 5597// pageX: 5598// pageY: Page coordinates of pointer. 5599// startX: 5600// startY: Page coordinates of pointer at movestart. 5601// distX: 5602// distY: Distance the pointer has moved since movestart. 5603// deltaX: 5604// deltaY: Distance the finger has moved since last event. 5605// velocityX: 5606// velocityY: Average velocity over last few events. 5607 5608 5609(function(fn) { 5610 if (typeof define === 'function' && define.amd) { 5611 define([], fn); 5612 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5613 module.exports = fn; 5614 } else { 5615 fn(); 5616 } 5617})(function(){ 5618 var assign = Object.assign || window.jQuery && jQuery.extend; 5619 5620 // Number of pixels a pressed pointer travels before movestart 5621 // event is fired. 5622 var threshold = 8; 5623 5624 // Shim for requestAnimationFrame, falling back to timer. See: 5625 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5626 var requestFrame = (function(){ 5627 return ( 5628 window.requestAnimationFrame || 5629 window.webkitRequestAnimationFrame || 5630 window.mozRequestAnimationFrame || 5631 window.oRequestAnimationFrame || 5632 window.msRequestAnimationFrame || 5633 function(fn, element){ 5634 return window.setTimeout(function(){ 5635 fn(); 5636 }, 25); 5637 } 5638 ); 5639 })(); 5640 5641 // Shim for customEvent 5642 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5643 (function () { 5644 if ( typeof window.CustomEvent === "function" ) return false; 5645 function CustomEvent ( event, params ) { 5646 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5647 var evt = document.createEvent( 'CustomEvent' ); 5648 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5649 return evt; 5650 } 5651 5652 CustomEvent.prototype = window.Event.prototype; 5653 window.CustomEvent = CustomEvent; 5654 })(); 5655 5656 var ignoreTags = { 5657 textarea: true, 5658 input: true, 5659 select: true, 5660 button: true 5661 }; 5662 5663 var mouseevents = { 5664 move: 'mousemove', 5665 cancel: 'mouseup dragstart', 5666 end: 'mouseup' 5667 }; 5668 5669 var touchevents = { 5670 move: 'touchmove', 5671 cancel: 'touchend', 5672 end: 'touchend' 5673 }; 5674 5675 var rspaces = /\s+/; 5676 5677 5678 // DOM Events 5679 5680 var eventOptions = { bubbles: true, cancelable: true }; 5681 5682 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5683 5684 function createEvent(type) { 5685 return new CustomEvent(type, eventOptions); 5686 } 5687 5688 function getEvents(node) { 5689 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5690 } 5691 5692 function on(node, types, fn, data, selector) {
5693 types = types.split(rspaces); 5694 5695 var events = getEvents(node); 5696 var i = types.length; 5697 var handlers, type; 5698 5699 function handler(e) { fn(e, data); } 5700 5701 while (i--) { 5702 type = types[i]; 5703 handlers = events[type] || (events[type] = []); 5704 handlers.push([fn, handler]); 5705 node.addEventListener(type, handler); 5706 } 5707 } 5708 5709 function off(node, types, fn, selector) { 5710 types = types.split(rspaces); 5711 5712 var events = getEvents(node); 5713 var i = types.length; 5714 var type, handlers, k; 5715 5716 if (!events) { return; } 5717 5718 while (i--) { 5719 type = types[i]; 5720 handlers = events[type]; 5721 if (!handlers) { continue; } 5722 k = handlers.length; 5723 while (k--) { 5724 if (handlers[k][0] === fn) { 5725 node.removeEventListener(type, handlers[k][1]); 5726 handlers.splice(k, 1); 5727 } 5728 } 5729 } 5730 } 5731 5732 function trigger(node, type, properties) { 5733 // Don't cache events. It prevents you from triggering an event of a 5734 // given type from inside the handler of another event of that type. 5735 var event = createEvent(type); 5736 if (properties) { assign(event, properties); } 5737 node.dispatchEvent(event); 5738 } 5739 5740 5741 // Constructors 5742 5743 function Timer(fn){ 5744 var callback = fn, 5745 active = false, 5746 running = false; 5747 5748 function trigger(time) { 5749 if (active){ 5750 callback(); 5751 requestFrame(trigger); 5752 running = true; 5753 active = false; 5754 } 5755 else { 5756 running = false; 5757 } 5758 } 5759 5760 this.kick = function(fn) { 5761 active = true; 5762 if (!running) { trigger(); } 5763 }; 5764 5765 this.end = function(fn) { 5766 var cb = callback; 5767 5768 if (!fn) { return; } 5769 5770 // If the timer is not running, simply call the end callback. 5771 if (!running) { 5772 fn(); 5773 } 5774 // If the timer is running, and has been kicked lately, then 5775 // queue up the current callback and the end callback, otherwise 5776 // just the end callback. 5777 else { 5778 callback = active ? 5779 function(){ cb(); fn(); } : 5780 fn ; 5781 5782 active = true; 5783 } 5784 }; 5785 } 5786 5787 5788 // Functions 5789 5790 function noop() {} 5791 5792 function preventDefault(e) { 5793 e.preventDefault(); 5794 } 5795 5796 function isIgnoreTag(e) { 5797 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5798 } 5799 5800 function isPrimaryButton(e) { 5801 // Ignore mousedowns on any button other than the left (or primary) 5802 // mouse button, or when a modifier key is pressed. 5803 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5804 } 5805 5806 function identifiedTouch(touchList, id) { 5807 var i, l; 5808 5809 if (touchList.identifiedTouch) { 5810 return touchList.identifiedTouch(id); 5811 } 5812 5813 // touchList.identifiedTouch() does not exist in 5814 // webkit yet… we must do the search ourselves... 5815 5816 i = -1; 5817 l = touchList.length; 5818 5819 while (++i < l) { 5820 if (touchList[i].identifier === id) { 5821 return touchList[i]; 5822 } 5823 } 5824 } 5825 5826 function changedTouch(e, data) { 5827 var touch = identifiedTouch(e.changedTouches, data.identifier); 5828 5829 // This isn't the touch you're looking for. 5830 if (!touch) { return; } 5831 5832 // Chrome Android (at least) includes touches that have not 5833 // changed in e.changedTouches. That's a bit annoying. Check 5834 // that this touch has changed. 5835 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5836 5837 return touch; 5838 } 5839 5840 5841 // Handlers that decide when the first movestart is triggered 5842 5843 function mousedown(e){ 5844 // Ignore non-primary buttons 5845 if (!isPrimaryButton(e)) { return; } 5846 5847 // Ignore form and interactive elements 5848 if (isIgnoreTag(e)) { return; } 5849 5850 on(document, mouseevents.move, mousemove, e); 5851 on(document, mouseevents.cancel, mouseend, e); 5852 } 5853 5854 function mousemove(e, data){ 5855 checkThreshold(e, data, e, removeMouse); 5856 } 5857 5858 function mouseend(e, data) { 5859 removeMouse(); 5860 } 5861 5862 function removeMouse() { 5863 off(document, mouseevents.move, mousemove); 5864 off(document, mouseevents.cancel, mouseend); 5865 } 5866 5867 function touchstart(e) { 5868 // Don't get in the way of interaction with form elements 5869 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5870 5871 var touch = e.changedTouches[0]; 5872 5873 // iOS live updates the touch objects whereas Android gives us copies. 5874 // That means we can't trust the touchstart object to stay the same, 5875 // so we must copy the data. This object acts as a template for 5876 // movestart, move and moveend event objects. 5877 var data = { 5878 target: touch.target, 5879 pageX: touch.pageX, 5880 pageY: touch.pageY, 5881 identifier: touch.identifier, 5882 5883 // The only way to make handlers individually unbindable is by 5884 // making them unique. 5885 touchmove: function(e, data) { touchmove(e, data); }, 5886 touchend: function(e, data) { touchend(e, data); } 5887 }; 5888 5889 on(document, touchevents.move, data.touchmove, data); 5890 on(document, touchevents.cancel, data.touchend, data); 5891 } 5892 5893 function touchmove(e, data) { 5894 var touch = changedTouch(e, data); 5895 if (!touch) { return; } 5896 checkThreshold(e, data, touch, removeTouch); 5897 } 5898 5899 function touchend(e, data) { 5900 var touch = identifiedTouch(e.changedTouches, data.identifier); 5901 if (!touch) { return; } 5902 removeTouch(data); 5903 } 5904 5905 function removeTouch(data) { 5906 off(document, touchevents.move, data.touchmove); 5907 off(document, touchevents.cancel, data.touchend); 5908 } 5909 5910 function checkThreshold(e, data, touch, fn) { 5911 var distX = touch.pageX - data.pageX; 5912 var distY = touch.pageY - data.pageY; 5913
5914 // Do nothing if the threshold has not been crossed. 5915 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5916 5917 triggerStart(e, data, touch, distX, distY, fn); 5918 } 5919 5920 function triggerStart(e, data, touch, distX, distY, fn) { 5921 var touches = e.targetTouches; 5922 var time = e.timeStamp - data.timeStamp; 5923 5924 // Create a movestart object with some special properties that 5925 // are passed only to the movestart handlers. 5926 var template = { 5927 altKey: e.altKey, 5928 ctrlKey: e.ctrlKey, 5929 shiftKey: e.shiftKey, 5930 startX: data.pageX, 5931 startY: data.pageY, 5932 distX: distX, 5933 distY: distY, 5934 deltaX: distX, 5935 deltaY: distY, 5936 pageX: touch.pageX, 5937 pageY: touch.pageY, 5938 velocityX: distX / time, 5939 velocityY: distY / time, 5940 identifier: data.identifier, 5941 targetTouches: touches, 5942 finger: touches ? touches.length : 1, 5943 enableMove: function() { 5944 this.moveEnabled = true; 5945 this.enableMove = noop; 5946 e.preventDefault(); 5947 } 5948 }; 5949 5950 // Trigger the movestart event. 5951 trigger(data.target, 'movestart', template); 5952 5953 // Unbind handlers that tracked the touch or mouse up till now. 5954 fn(data); 5955 } 5956 5957 5958 // Handlers that control what happens following a movestart 5959 5960 function activeMousemove(e, data) { 5961 var timer = data.timer; 5962 5963 data.touch = e; 5964 data.timeStamp = e.timeStamp; 5965 timer.kick(); 5966 } 5967 5968 function activeMouseend(e, data) { 5969 var target = data.target; 5970 var event = data.event; 5971 var timer = data.timer; 5972 5973 removeActiveMouse(); 5974 5975 endEvent(target, event, timer, function() { 5976 // Unbind the click suppressor, waiting until after mouseup 5977 // has been handled. 5978 setTimeout(function(){ 5979 off(target, 'click', preventDefault); 5980 }, 0); 5981 }); 5982 } 5983 5984 function removeActiveMouse() { 5985 off(document, mouseevents.move, activeMousemove); 5986 off(document, mouseevents.end, activeMouseend); 5987 } 5988 5989 function activeTouchmove(e, data) { 5990 var event = data.event; 5991 var timer = data.timer; 5992 var touch = changedTouch(e, event); 5993 5994 if (!touch) { return; } 5995 5996 // Stop the interface from gesturing 5997 e.preventDefault(); 5998 5999 event.targetTouches = e.targetTouches; 6000 data.touch = touch; 6001 data.timeStamp = e.timeStamp; 6002 6003 timer.kick(); 6004 } 6005 6006 function activeTouchend(e, data) { 6007 var target = data.target; 6008 var event = data.event; 6009 var timer = data.timer; 6010 var touch = identifiedTouch(e.changedTouches, event.identifier); 6011 6012 // This isn't the touch you're looking for. 6013 if (!touch) { return; } 6014 6015 removeActiveTouch(data); 6016 endEvent(target, event, timer); 6017 } 6018 6019 function removeActiveTouch(data) { 6020 off(document, touchevents.move, data.activeTouchmove); 6021 off(document, touchevents.end, data.activeTouchend); 6022 } 6023 6024 6025 // Logic for triggering move and moveend events 6026 6027 function updateEvent(event, touch, timeStamp) { 6028 var time = timeStamp - event.timeStamp; 6029 6030 event.distX = touch.pageX - event.startX; 6031 event.distY = touch.pageY - event.startY; 6032 event.deltaX = touch.pageX - event.pageX; 6033 event.deltaY = touch.pageY - event.pageY; 6034 6035 // Average the velocity of the last few events using a decay 6036 // curve to even out spurious jumps in values. 6037 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 6038 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 6039 event.pageX = touch.pageX; 6040 event.pageY = touch.pageY; 6041 } 6042 6043 function endEvent(target, event, timer, fn) { 6044 timer.end(function(){ 6045 trigger(target, 'moveend', event); 6046 return fn && fn(); 6047 }); 6048 } 6049 6050 6051 // Set up the DOM 6052 6053 function movestart(e) { 6054 if (e.defaultPrevented) { return; } 6055 if (!e.moveEnabled) { return; } 6056 6057 var event = { 6058 startX: e.startX, 6059 startY: e.startY, 6060 pageX: e.pageX, 6061 pageY: e.pageY, 6062 distX: e.distX, 6063 distY: e.distY, 6064 deltaX: e.deltaX, 6065 deltaY: e.deltaY, 6066 velocityX: e.velocityX, 6067 velocityY: e.velocityY, 6068 identifier: e.identifier, 6069 targetTouches: e.targetTouches, 6070 finger: e.finger 6071 }; 6072 6073 var data = { 6074 target: e.target, 6075 event: event, 6076 timer: new Timer(update), 6077 touch: undefined, 6078 timeStamp: e.timeStamp 6079 }; 6080 6081 function update(time) { 6082 updateEvent(event, data.touch, data.timeStamp); 6083 trigger(data.target, 'move', event); 6084 } 6085 6086 if (e.identifier === undefined) { 6087 // We're dealing with a mouse event. 6088 // Stop clicks from propagating during a move 6089 on(e.target, 'click', preventDefault); 6090 on(document, mouseevents.move, activeMousemove, data); 6091 on(document, mouseevents.end, activeMouseend, data); 6092 } 6093 else { 6094 // In order to unbind correct handlers they have to be unique 6095 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 6096 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 6097 6098 // We're dealing with a touch. 6099 on(document, touchevents.move, data.activeTouchmove, data); 6100 on(document, touchevents.end, data.activeTouchend, data); 6101 } 6102 } 6103 6104 on(document, 'mousedown', mousedown); 6105 on(document, 'touchstart', touchstart); 6106 on(document, 'movestart', movestart); 6107 6108 6109 // jQuery special events 6110 // 6111 // jQuery event objects are copies of DOM event objects. They need 6112 // a little help copying the move properties across. 6113 6114 if (!window.jQuery) { return; } 6115 6116 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 6117 6118 function enableMove1(e) { e.enableMove(); } 6119 function enableMove2(e) { e.enableMove(); } 6120 function enableMove3(e) { e.enableMove(); } 6121 6122 function add(handleObj) { 6123 var handler = handleObj.handler; 6124 6125 handleObj.handler = function(e) { 6126 // Copy move properties across from originalEvent 6127 var i = properties.length; 6128 var property; 6129 6130 while(i--) { 6131 property = properties[i]; 6132 e[property] = e.originalEvent[property]; 6133 } 6134 6135 handler.apply(this, arguments); 6136 }; 6137 } 6138 6139 jQuery.event.special.movestart = { 6140 setup: function() { 6141 // Movestart must be enabled to allow other move events 6142 on(this, 'movestart', enableMove1); 6143 6144 // Do listen to DOM events 6145 return false;
6146 }, 6147 6148 teardown: function() { 6149 off(this, 'movestart', enableMove1); 6150 return false; 6151 }, 6152 6153 add: add 6154 }; 6155 6156 jQuery.event.special.move = { 6157 setup: function() { 6158 on(this, 'movestart', enableMove2); 6159 return false; 6160 }, 6161 6162 teardown: function() { 6163 off(this, 'movestart', enableMove2); 6164 return false; 6165 }, 6166 6167 add: add 6168 }; 6169 6170 jQuery.event.special.moveend = { 6171 setup: function() { 6172 on(this, 'movestart', enableMove3); 6173 return false; 6174 }, 6175 6176 teardown: function() { 6177 off(this, 'movestart', enableMove3); 6178 return false; 6179 }, 6180 6181 add: add 6182 }; 6183}); 6184 6185 $.fn.twentytwenty = function(options) { 6186 var options = $.extend({ 6187 default_offset_pct: 0.5, 6188 orientation: 'horizontal', 6189 before_label: 'Before', 6190 after_label: 'After', 6191 no_overlay: false, 6192 move_slider_on_hover: false, 6193 move_with_handle_only: true, 6194 click_to_move: false 6195 }, options); 6196 6197 return this.each(function() { 6198 6199 var sliderPct = options.default_offset_pct; 6200 var container = $(this); 6201 var sliderOrientation = options.orientation; 6202 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 6203 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 6204 6205 6206 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 6207 if(!options.no_overlay) { 6208 container.append("<div class='twentytwenty-overlay'></div>"); 6209 var overlay = container.find(".twentytwenty-overlay"); 6210 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 6211 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 6212 } 6213 var beforeImg = container.find("img:first"); 6214 var afterImg = container.find("img:last"); 6215 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 6216 var slider = container.find(".twentytwenty-handle"); 6217 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 6218 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 6219 container.addClass("twentytwenty-container"); 6220 beforeImg.addClass("twentytwenty-before"); 6221 afterImg.addClass("twentytwenty-after"); 6222 6223 var calcOffset = function(dimensionPct) { 6224 var w = beforeImg.width(); 6225 var h = beforeImg.height(); 6226 return { 6227 w: w+"px", 6228 h: h+"px", 6229 cw: (dimensionPct*w)+"px", 6230 ch: (dimensionPct*h)+"px" 6231 }; 6232 }; 6233 6234 var adjustContainer = function(offset) { 6235 if (sliderOrientation === 'vertical') { 6236 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 6237 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 6238 } 6239 else { 6240 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 6241 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 6242 } 6243 container.css("height", offset.h); 6244 }; 6245 6246 var adjustSlider = function(pct) { 6247 var offset = calcOffset(pct); 6248 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 6249 adjustContainer(offset); 6250 }; 6251 6252 // Return the number specified or the min/max number if it outside the range given. 6253 var minMaxNumber = function(num, min, max) { 6254 return Math.max(min, Math.min(max, num)); 6255 }; 6256 6257 // Calculate the slider percentage based on the position. 6258 var getSliderPercentage = function(positionX, positionY) { 6259 var sliderPercentage = (sliderOrientation === 'vertical') ? 6260 (positionY-offsetY)/imgHeight : 6261 (positionX-offsetX)/imgWidth; 6262 6263 return minMaxNumber(sliderPercentage, 0, 1); 6264 }; 6265 6266 6267 $(window).on("resize.twentytwenty", function(e) { 6268 adjustSlider(sliderPct); 6269 }); 6270 6271 var offsetX = 0; 6272 var offsetY = 0; 6273 var imgWidth = 0; 6274 var imgHeight = 0; 6275 var onMoveStart = function(e) { 6276 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 6277 e.preventDefault(); 6278 } 6279 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 6280 e.preventDefault(); 6281 } 6282 container.addClass("active"); 6283 offsetX = container.offset().left; 6284 offsetY = container.offset().top; 6285 imgWidth = beforeImg.width(); 6286 imgHeight = beforeImg.height(); 6287 }; 6288 var onMove = function(e) { 6289 if (container.hasClass("active")) { 6290 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6291 adjustSlider(sliderPct); 6292 } 6293 }; 6294 var onMoveEnd = function() { 6295 container.removeClass("active"); 6296 }; 6297 6298 var moveTarget = options.move_with_handle_only ? slider : container; 6299 moveTarget.on("movestart",onMoveStart); 6300 moveTarget.on("move",onMove); 6301 moveTarget.on("moveend",onMoveEnd); 6302 6303 if (options.move_slider_on_hover) { 6304 container.on("mouseenter", onMoveStart); 6305 container.on("mousemove", onMove); 6306 container.on("mouseleave", onMoveEnd); 6307 } 6308 6309 slider.on("touchmove", function(e) { 6310 e.preventDefault(); 6311 }); 6312 6313 container.find("img").on("mousedown", function(event) { 6314 event.preventDefault(); 6315 }); 6316 6317 if (options.click_to_move) { 6318 container.on('click', function(e) { 6319 offsetX = container.offset().left; 6320 offsetY = container.offset().top; 6321 imgWidth = beforeImg.width(); 6322 imgHeight = beforeImg.height(); 6323 6324 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6325 adjustSlider(sliderPct); 6326 }); 6327 } 6328 6329 $(window).trigger("resize.twentytwenty"); 6330 }); 6331 }; 6332 6333 6334 $(window).on("load", function(e) { 6335 $('.twentytwenty-container').each(function(){ 6336 var $container = $(this); 6337 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6338 $container.twentytwenty(); 6339 } 6340 $('img', $container).on('async-done', function(){ 6341 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6342 $container.twentytwenty(); 6343 } 6344 }); 6345 }); 6346 }); 6347} 6348 6349UNCODE.justifiedGallery = function() { 6350 6351 var breakPointMe = function( val ) { 6352 val = parseInt( val ); 6353 if ( isNaN(val) ) { 6354 return false;
6355 } 6356 if ( val >= 1500 ) { 6357 return 1; 6358 } else if ( val < 1500 && val >= 960 ) { 6359 return 2; 6360 } else if ( val < 960 && val >= 570 ) { 6361 return 3; 6362 } else if ( val < 570 ) { 6363 return 4; 6364 } 6365 } 6366 6367 var gutterByBreakpoint = function( bp, gutter ) { 6368 var ret; 6369 switch(gutter) { 6370 case 'no-gutter': 6371 ret = 0; 6372 break; 6373 case 'px-gutter': 6374 ret = 1; 6375 break; 6376 case 'half-gutter': 6377 ret = 18; 6378 break; 6379 case 'double-gutter': 6380 switch(bp) { 6381 case 3: 6382 case 4: 6383 ret = 36; 6384 break; 6385 default: 6386 ret = 72; 6387 break; 6388 } 6389 break; 6390 case 'triple-gutter': 6391 switch(bp) { 6392 case 3: 6393 case 4: 6394 ret = 36; 6395 break; 6396 default: 6397 ret = 108; 6398 break; 6399 } 6400 break; 6401 case 'quad-gutter': 6402 switch(bp) { 6403 case 2: 6404 ret = 108; 6405 break; 6406 case 3: 6407 ret = 72; 6408 break; 6409 case 4: 6410 ret = 36; 6411 break; 6412 default: 6413 ret = 144; 6414 break; 6415 } 6416 break; 6417 default: 6418 ret = 36;//single-gutter 6419 } 6420 return ret; 6421 } 6422 6423 if ($('.justified-layout').length > 0) { 6424 var justifiedContainersArray = [], 6425 typeGridArray = [], 6426 layoutGridArray = [], 6427 transitionDuration = [], 6428 $filterItems = [], 6429 $filters = $('.justified-system .isotope-filters'), 6430 $itemSelector = '.tmb', 6431 $items, 6432 itemMargin, 6433 correctionFactor = 0, 6434 firstLoad = true, 6435 isOriginLeft = $('body').hasClass('rtl') ? false : true, 6436 prevW = breakPointMe(UNCODE.wwidth); 6437 $('[class*="justified-container"]').each(function() { 6438 var isoData = $(this).data(); 6439 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6440 if (isoData.type == 'metro') typeGridArray.push(true); 6441 else typeGridArray.push(false); 6442 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 6443 else layoutGridArray.push('justified'); 6444 justifiedContainersArray.push($(this)); 6445 }); 6446 var init_justifiedGallery = function() { 6447 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 6448 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 6449 justifiedId = justifiedSystem.attr('id'), 6450 $layoutMode = layoutGridArray[i], 6451 gutter = $(justifiedContainersArray[i]).data('gutter'), 6452 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 6453 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 6454 lastRow = $(justifiedContainersArray[i]).data('last-row'), 6455 margins; 6456 6457 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 6458 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 6459 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6460 6461 margins = gutterByBreakpoint(prevW, gutter); 6462 6463 $(justifiedContainersArray[i]).justifiedGallery({ 6464 rowHeight: rowHeight, 6465 maxRowHeight: maxRowHeight, 6466 margins: margins, 6467 cssAnimation: true, 6468 lastRow: lastRow, 6469 waitThumbnailsLoad: false 6470 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 6471 6472 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 6473 $(justifiedContainersArray[i]).infinitescroll({ 6474 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 6475 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6476 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 6477 animate: false, 6478 behavior: 'local', 6479 debug: false, 6480 loading: { 6481 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 6482 speed: 0, 6483 finished: undefined, 6484 msg: $('#' + justifiedId + ' .loadmore-button'), 6485 }, 6486 errorCallback: function() { 6487 var justified_system = $(this).closest('.justified-system'); 6488 $('.loading-button', justified_system).hide(); 6489 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6490 } 6491 }, 6492 // append the new items to galleryJustified on the infinitescroll callback function. 6493 function(newElements, opts) { 6494 var $galleryJustified = $(this), 6495 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6496 filters = new Array(), 6497 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6498 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6499 $numPages = $('a', $infinite_button).data('pages'),
6500 delay = 300; 6501 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6502 $infinite_button.show(); 6503 $loading_button.hide(); 6504 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6505 $('> li', $galleryJustified).remove(); 6506 $.each($(newElements), function(index, val) { 6507 $(val).addClass('tmb-iso'); 6508 if ($(val).is("li")) { 6509 filters.push($(val)[0]); 6510 } 6511 $(val).addClass('uncode-appended'); 6512 }); 6513 newElements = newElements.filter(function(x) { 6514 return filters.indexOf(x) < 0 6515 }); 6516 $.each($(filters), function(index, val) { 6517 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6518 }); 6519 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6520 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6521 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6522 if (typeof getLightbox === 'object') { 6523 getLightbox.refresh(); 6524 } else { 6525 UNCODE.lightbox(); 6526 } 6527 } 6528 if ( typeof twttr !== 'undefined' ) 6529 twttr.widgets.load(justifiedContainersArray[i]); 6530 6531 requestTimeout(function() { 6532 $galleryJustified.trigger('more-items-loaded'); 6533 $(window).trigger('more-items-loaded'); 6534 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6535 }, 1000); 6536 }); 6537 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6538 var $infinite_justified = $(justifiedContainersArray[i]), 6539 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6540 $infinite_justified.infinitescroll('pause'); 6541 $infinite_button.on('click', function(event) { 6542 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6543 $.each(UNCODE.lightboxArray, function(index, val) { 6544 UNCODE.lightboxArray[index].destroy(); 6545 }); 6546 } 6547 event.preventDefault(); 6548 var $justified_system = $(event.target).closest('.justified-system'), 6549 $infinite_justified = $justified_system.find('.justified-container'), 6550 justifiedId = $justified_system.attr('id'); 6551 $(event.currentTarget).html(SiteParameters.loading); 6552 $infinite_justified.infinitescroll('resume'); 6553 $infinite_justified.infinitescroll('retrieve'); 6554 $infinite_justified.infinitescroll('pause'); 6555 $infinite_justified.trigger('more-items-loaded'); 6556 $(window).trigger('more-items-loaded'); 6557 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6558 }); 6559 } 6560 } 6561 } 6562 }, 6563 onLayout = function(justifiedObj, startIndex) { 6564 justifiedObj.css('opacity', 1); 6565 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6566 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6567 6568 requestTimeout(function() { 6569 // window.dispatchEvent(UNCODE.boxEvent); 6570 UNCODE.adaptive(); 6571 if (SiteParameters.dynamic_srcset_active === '1') { 6572 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6573 } 6574 if (typeof MediaElement === "function") { 6575 $(justifiedObj).find('audio,video').each(function() { 6576 $(this).mediaelementplayer({ 6577 pauseOtherPlayers: false, 6578 }); 6579 }); 6580 } 6581 if ($(justifiedObj).find('.nested-carousel').length) { 6582 if (typeof UNCODE.carousel !== 'undefined') { 6583 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6584 } 6585 requestTimeout(function() { 6586 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6587 justifiedObj.addClass('justified-gallery-finished') 6588 Waypoint.refreshAll(); 6589 }, 200); 6590 } else { 6591 requestTimeout(function() { 6592 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6593 justifiedObj.addClass('justified-gallery-finished') 6594 Waypoint.refreshAll(); 6595 }, 300); 6596 } 6597 }, 100); 6598 6599 }, 6600 boxAnimation = function(items, startIndex, sequential, container) { 6601 var $allItems = items.length - startIndex, 6602 showed = 0, 6603 index = 0; 6604 if (container.closest('.owl-item').length == 1) return false;
6605 $.each(items, function(index, val) { 6606 var elInner = $('> .t-inside', val); 6607 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6608 return; 6609 } 6610 if (val[0]) val = val[0]; 6611 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6612 new Waypoint({ 6613 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6614 element: val, 6615 handler: function() { 6616 var element = $('> .t-inside', this.element), 6617 parent = $(this.element), 6618 currentIndex = parent.index(); 6619 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6620 delayAttr = parseInt(element.attr('data-delay')); 6621 if (isNaN(delayAttr)) delayAttr = 100; 6622 delay -= showed; 6623 var objTimeout = requestTimeout(function() { 6624 element.removeClass('zoom-reverse').addClass('start_animation'); 6625 showed = parent.index(); 6626 }, delay * delayAttr); 6627 parent.data('objTimeout', objTimeout); 6628 if (!UNCODE.isUnmodalOpen) { 6629 this.destroy(); 6630 } 6631 }, 6632 offset: '100%' 6633 }) 6634 } else { 6635 elInner.removeClass('animate_when_almost_visible'); 6636 $(val).addClass('no-waypoint-animation'); 6637 /*if (elInner.hasClass('force-anim')) { 6638 elInner.addClass('start_animation'); 6639 } else { 6640 elInner.css('opacity', 1); 6641 }*/ 6642 } 6643 index++; 6644 }); 6645 }; 6646 $filters.on('click', 'a[data-filter]', function(evt) { 6647 var $filter = $(this), 6648 filterContainer = $filter.closest('.isotope-filters'), 6649 filterValue = $filter.attr('data-filter'), 6650 container = $filter.closest('.justified-system').find($('.justified-layout')), 6651 lastRow = container.data('last-row'), 6652 transitionDuration = 0, 6653 delay = 300, 6654 filterItems = []; 6655 6656 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6657 6658 var filter_items = function(){ 6659 if (filterValue !== undefined) { 6660 $.each($('> .tmb > .t-inside', container), function(index, val) { 6661 var parent = $(val).parent(), 6662 objTimeout = parent.data('objTimeout'); 6663 if (objTimeout) { 6664 $(val).removeClass('zoom-reverse'); 6665 clearRequestTimeout(objTimeout); 6666 } 6667 if (transitionDuration == 0) { 6668 if ($(val).hasClass('animate_when_almost_visible')) { 6669 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6670 } else { 6671 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6672 } 6673 } 6674 }); 6675 6676 requestTimeout(function() { 6677 var $block, 6678 selector, 6679 lightboxElements, 6680 $boxes; 6681 6682 if ( filterValue !== '' && filterValue !== '*' ) { 6683 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6684 selector = '.' + filterValue; 6685 $.each($(selector, container), function(index, block) { 6686 lightboxElements = $('[data-lbox^=ilightbox]', block); 6687 if (lightboxElements.length) { 6688 lightboxElements.removeClass('lb-disabled'); 6689 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6690 } 6691 filterItems.push(block); 6692 }); 6693 container.justifiedGallery({ 6694 filter: selector, 6695 lastRow: 'nojustify' 6696 }); 6697 } else { 6698 container.justifiedGallery({ 6699 filter: false, 6700 lastRow: lastRow 6701 }); 6702 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6703 filterItems = $('> .tmb', container); 6704 } 6705 container.trigger('more-items-loaded'); 6706 $(window).trigger('more-items-loaded'); 6707 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6708 6709 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6710 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6711 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6712 if (typeof getLightbox === 'object') { 6713 getLightbox.refresh(); 6714 } else { 6715 UNCODE.lightbox(); 6716 } 6717 } 6718 6719 if (transitionDuration == 0) { 6720 requestTimeout(function() { 6721 boxAnimation(filterItems, 0, false, container); 6722 }, 100); 6723 } 6724 requestTimeout(function() { 6725 Waypoint.refreshAll(); 6726 container.trigger('more-items-loaded'); 6727 $(window).trigger('more-items-loaded'); 6728 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6729 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 6730 $(document).trigger('uncode-scrolltrigger-refresh'); 6731 } 6732 }, 2000); 6733 6734 }, delay); 6735 } else { 6736 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6737 $.each(UNCODE.lightboxArray, function(index, val) { 6738 UNCODE.lightboxArray[index].destroy(); 6739 }); 6740 } 6741 $.each($('> .tmb > .t-inside', container), function(index, val) { 6742 var parent = $(val).parent(), 6743 objTimeout = parent.data('objTimeout'); 6744 if (objTimeout) { 6745 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6746 clearRequestTimeout(objTimeout); 6747 } 6748 if (transitionDuration == 0) { 6749 if ($(val).hasClass('animate_when_almost_visible')) { 6750 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6751 } else { 6752 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6753 } 6754 } 6755 }); 6756 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6757 UNCODE.lightbox(); 6758 } 6759 container.parent().addClass('justified-loading'); 6760 container.trigger('more-items-loaded'); 6761 $(window).trigger('more-items-loaded'); 6762 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6763 } 6764 }; 6765 6766 if (!$filter.hasClass('active')) { 6767 /** Scroll top with filtering */ 6768 if (filterContainer.hasClass('filter-scroll')) { 6769 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6770 calc_scroll -= UNCODE.get_scroll_offset(); 6771 6772 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6773 delta = bodyTop - calc_scroll, 6774 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6775 filterTolerance = false, 6776 filter_timeout; 6777 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6778 6779 if ( !UNCODE.isFullPage ) { 6780 if (scrollSpeed == 0) { 6781 $('html, body').scrollTop(calc_scroll); 6782 UNCODE.scrolling = false;
6783 filter_items(); 6784 } else { 6785 6786 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6787 filter_items(); 6788 filterTolerance = true; 6789 } 6790 6791 $('html, body').animate({ 6792 scrollTop: calc_scroll 6793 },{ 6794 easing: 'easeInOutQuad', 6795 duration: scrollSpeed, 6796 complete: function(){ 6797 UNCODE.scrolling = false; 6798 if ( !filterTolerance ) { 6799 filter_timeout = setTimeout(function(){ 6800 clearTimeout(filter_timeout); 6801 filter_items(); 6802 }, 200); 6803 } 6804 } 6805 }); 6806 } 6807 } 6808 } else { 6809 filter_items(); 6810 } 6811 } 6812 evt.preventDefault(); 6813 }); 6814 6815 $filters.each(function(i, buttonGroup) { 6816 var $buttonGroup = $(buttonGroup); 6817 $buttonGroup.on('click', 'a', function() { 6818 $buttonGroup.find('.active').removeClass('active'); 6819 $(this).addClass('active'); 6820 }); 6821 6822 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6823 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6824 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6825 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6826 e.preventDefault(); 6827 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6828 }); 6829 }); 6830 window.addEventListener('boxResized', function(e) { 6831 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6832 prevW = breakPointMe(UNCODE.wwidth); 6833 $.each($('.justified-layout'), function(index, val) { 6834 var gutter = $(this).data('gutter'), 6835 margins = gutterByBreakpoint( prevW, gutter); 6836 $(this).justifiedGallery({ 6837 margins: margins 6838 }); 6839 $(this).find('.mejs-video,.mejs-audio').each(function() { 6840 $(this).trigger('resize'); 6841 }); 6842 }); 6843 } 6844 }, false); 6845 6846 init_justifiedGallery(); 6847 }; 6848}; 6849 6850UNCODE.cssGrid = function() { 6851 if ($('.cssgrid-layout').length > 0) { 6852 var cssGridContainersArray = []; 6853 var transitionDuration = []; 6854 var $filters = $('.cssgrid-system .cssgrid-filters'); 6855 6856 $('[class*="cssgrid-container"]').each(function() { 6857 cssGridContainersArray.push($(this)); 6858 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6859 }); 6860 6861 var init_cssGridAjax = function() { 6862 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6863 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6864 cssGridId = cssGridSystem.attr('id'); 6865 6866 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6867 6868 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6869 $(cssGridContainersArray[i]).infinitescroll({ 6870 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6871 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6872 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 6873 animate: false, 6874 behavior: 'local', 6875 debug: false, 6876 loading: { 6877 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6878 speed: 0, 6879 finished: undefined, 6880 msg: $('#' + cssGridId + ' .loadmore-button'), 6881 }, 6882 errorCallback: function() { 6883 var cssgrid_system = $(this).closest('.cssgrid-system'); 6884 $('.loading-button', cssgrid_system).hide(); 6885 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6886 } 6887 }, 6888 // append the new items to cssGrid on the infinitescroll callback function. 6889 function(newElements, opts) { 6890 var $cssGrid = $(this), 6891 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6892 cssGridId = cssGridSystemCont.attr('id'), 6893 filters = new Array(), 6894 $loading_button = cssGridSystemCont.find('.loading-button'), 6895 $infinite_button = cssGridSystemCont.find('.loadmore-button'), 6896 $numPages = $('a', $infinite_button).data('pages'), 6897 $woo_results,
6898 delay = 300; 6899 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6900 $infinite_button.show(); 6901 $loading_button.hide(); 6902 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6903 $('> li', $cssGrid).remove(); 6904 $('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove(); 6905 $.each($(newElements), function (index, val) { 6906 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 6907 $woo_results = $(val); 6908 delete newElements[index]; 6909 } else { 6910 $(val).addClass('tmb-grid'); 6911 if ($(val).is("li")) { 6912 filters.push($(val)[0]); 6913 } 6914 } 6915 $(val).addClass('uncode-appended'); 6916 }); 6917 newElements = newElements.filter(function(x) { 6918 return filters.indexOf(x) < 0 6919 }); 6920 $.each($(filters), function(index, val) { 6921 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6922 }); 6923 if ($woo_results && $woo_results.length > 0) { 6924 var old_count = cssGridSystemCont.find('.woocommerce-result-count').text(); 6925 var new_count = $woo_results.find('.woocommerce-result-count').text(); 6926 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 6927 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 6928 function replaceMatch(match, p1, p2) { 6929 return old_start + '–' + new_end; 6930 } 6931 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 6932 cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text); 6933 } 6934 6935 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6936 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6937 if (filterValue !== undefined && filterValue != '*') { 6938 $(newElements).hide(); 6939 var els_to_show = $(); 6940 $(newElements).each(function() { 6941 var el = $(this); 6942 if (el.hasClass(filterValue)) { 6943 els_to_show = els_to_show.add(el); 6944 el.show(); 6945 } 6946 }); 6947 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6948 } else { 6949 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6950 } 6951 6952 UNCODE.adaptive(); 6953 if (SiteParameters.dynamic_srcset_active === '1') { 6954 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6955 } 6956 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6957 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6958 if (typeof getLightbox === 'object') { 6959 getLightbox.refresh(); 6960 } else { 6961 UNCODE.lightbox(); 6962 } 6963 } 6964 if ( typeof twttr !== 'undefined' ) { 6965 twttr.widgets.load(cssGridContainersArray[i]); 6966 } 6967 6968 UNCODE.carousel($(newElements)); 6969 requestTimeout(function() { 6970 $cssGrid.trigger('more-items-loaded'); 6971 $(window).trigger('more-items-loaded'); 6972 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6973 }, 1000); 6974 6975 }); 6976 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6977 var $cssgrid_el = $(cssGridContainersArray[i]), 6978 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6979 $cssgrid_el.infinitescroll('pause'); 6980 $infinite_button.on('click', function(event) { 6981 event.preventDefault(); 6982 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6983 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6984 cssGridId = $cssgrid_system.attr('id'); 6985 $(event.currentTarget).html(SiteParameters.loading); 6986 $cssgrid_el.infinitescroll('resume'); 6987 $cssgrid_el.infinitescroll('retrieve'); 6988 $cssgrid_el.infinitescroll('pause'); 6989 }); 6990 } 6991 } 6992 } 6993 }; 6994 6995 init_cssGridAjax(); 6996 6997 if ($('.cssgrid-pagination').length > 0) { 6998 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 6999 evt.preventDefault(); 7000 7001 if (SiteParameters.index_pagination_disable_scroll !== '1') { 7002 var container = $(this).closest('.cssgrid-system'), 7003 pagination_disable_scroll = container.attr('data-pagination-scroll'), 7004 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 7005 7006 if ( pagination_disable_scroll === 'disabled' ) { 7007 return; 7008 } 7009 7010 calc_scroll -= UNCODE.get_scroll_offset(); 7011 7012 var menu_container = $('.menu-sticky'); 7013 var menu = menu_container.find('.menu-container'); 7014 7015 if (menu_container.length > 0 && menu.length > 0) { 7016 calc_scroll = calc_scroll - menu.outerHeight(); 7017 } 7018 7019 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7020 delta = bodyTop - calc_scroll, 7021 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7022 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7023 7024 if ( !UNCODE.isFullPage ) { 7025 if (scrollSpeed == 0) { 7026 $('html, body').scrollTop(calc_scroll); 7027 } else { 7028 $('html, body').animate({ 7029 scrollTop: calc_scroll 7030 },{ 7031 easing: 'easeInOutQuad', 7032 duration: scrollSpeed, 7033 complete: function(){ 7034 UNCODE.scrolling = false; 7035 } 7036 }); 7037 } 7038 } 7039 } 7040 7041 loadCssGrid($(this), true); 7042 }); 7043 } 7044 7045 $filters.on('click', 'a.grid-nav-link', function(evt) { 7046 if ($(this).hasClass('no-grid-filter')) { 7047 return; 7048 } 7049 var $filter = $(this), 7050 filterContainer = $filter.closest('.cssgrid-filters'), 7051 filterValue = $filter.attr('data-filter'), 7052 containerSystem = $filter.closest('.cssgrid-system'), 7053 container = containerSystem.find($('.cssgrid-layout')), 7054 transitionDuration = containerSystem.data('transitionDuration'),
7055 delay = 300, 7056 filterItems = [], 7057 all_thumbs = container.find('.tmb-grid'); 7058 7059 var filter_items = function(){ 7060 if (filterValue !== undefined) { 7061 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7062 var parent = $(val).parent(), 7063 objTimeout = parent.data('objTimeout'); 7064 if (objTimeout) { 7065 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7066 clearRequestTimeout(objTimeout); 7067 } 7068 if (transitionDuration == 0) { 7069 if ($(val).hasClass('animate_when_almost_visible')) { 7070 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7071 } else { 7072 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7073 } 7074 } 7075 }); 7076 requestTimeout(function(){ 7077 if ( filterValue == '*' ) { 7078 all_thumbs.show(); 7079 all_thumbs.each(function(index, val) { 7080 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7081 filterItems.push($(this)); 7082 }); 7083 } else { 7084 all_thumbs.each(function() { 7085 var _tmb = $(this); 7086 if (_tmb.hasClass(filterValue)) { 7087 _tmb.show(); 7088 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7089 filterItems.push(_tmb); 7090 } else { 7091 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 7092 _tmb.hide(); 7093 } 7094 }); 7095 } 7096 7097 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 7098 7099 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7100 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 7101 var lightboxElements = $('[data-lbox^=ilightbox]', container); 7102 if (lightboxElements.length) { 7103 container.data('lbox', $(lightboxElements[0]).data('lbox')); 7104 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7105 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 7106 if (typeof getLightbox === 'object') { 7107 getLightbox.refresh(); 7108 } else { 7109 UNCODE.lightbox(); 7110 } 7111 } 7112 } 7113 container.trigger('more-items-loaded'); 7114 $(window).trigger('more-items-loaded'); 7115 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7116 }, delay); 7117 } else { 7118 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7119 var parent = $(val).parent(), 7120 objTimeout = parent.data('objTimeout'); 7121 if (objTimeout) { 7122 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7123 clearRequestTimeout(objTimeout); 7124 } 7125 if (transitionDuration == 0) { 7126 if ($(val).hasClass('animate_when_almost_visible')) { 7127 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7128 } else { 7129 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7130 } 7131 } 7132 }); 7133 loadCssGrid($filter); 7134 } 7135 }; 7136 7137 if (!$filter.hasClass('active')) { 7138 /** Scroll top with filtering */ 7139 if (filterContainer.hasClass('filter-scroll')) { 7140 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 7141 calc_scroll -= UNCODE.get_scroll_offset(); 7142 7143 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7144 delta = bodyTop - calc_scroll, 7145 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 7146 filterTolerance = false, 7147 filter_timeout; 7148 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7149 7150 if ( !UNCODE.isFullPage ) { 7151 if (scrollSpeed == 0) { 7152 $('html, body').scrollTop(calc_scroll); 7153 UNCODE.scrolling = false; 7154 filter_items(); 7155 } else { 7156 7157 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 7158 filter_items(); 7159 filterTolerance = true; 7160 } 7161 7162 $('html, body').animate({ 7163 scrollTop: calc_scroll 7164 },{ 7165 easing: 'easeInOutQuad', 7166 duration: scrollSpeed, 7167 complete: function(){ 7168 UNCODE.scrolling = false;
7169 if ( !filterTolerance ) { 7170 filter_timeout = setTimeout(function(){ 7171 clearTimeout(filter_timeout); 7172 filter_items(); 7173 }, 200); 7174 } 7175 } 7176 }); 7177 } 7178 } 7179 } else { 7180 filter_items(); 7181 } 7182 } 7183 evt.preventDefault(); 7184 }); 7185 7186 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 7187 var params = UNCODE.getURLParams(window.location); 7188 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 7189 7190 UNCODE.lastURL = window.location.href; 7191 7192 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) { 7193 return; 7194 } 7195 7196 if (params.id === undefined) { 7197 $.each($('.cssgrid-system'), function(index, val) { 7198 loadCssGrid($(val)); 7199 }); 7200 } else { 7201 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 7202 loadCssGrid($('#' + params.id)); 7203 } 7204 } 7205 }); 7206 7207 var loadCssGrid = function($href, $paginating) { 7208 var is_paginating = false; 7209 7210 if (undefined !== $paginating && $paginating) { 7211 var is_paginating = $paginating; 7212 } 7213 7214 var href = ($href.is("a") ? $href.attr('href') : location), 7215 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 7216 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 7217 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 7218 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 7219 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 7220 cssgridId = cssgridSystem.attr('id'); 7221 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 7222 UNCODE.lastURL = href; 7223 history.pushState({ 7224 myCSSgrid: true 7225 }, document.title, href); 7226 } 7227 cssgridWrapper.addClass('cssgrid-loading'); 7228 if (is_paginating) { 7229 cssgridWrapper.addClass('grid-filtering'); 7230 } 7231 $.ajax({ 7232 url: href 7233 }).done(function(data) { 7234 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 7235 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 7236 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 7237 requestTimeout(function() { 7238 cssgridContainer.html($resultItems); 7239 cssgridWrapper.removeClass('cssgrid-loading'); 7240 cssgridWrapper.removeClass('grid-filtering'); 7241 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7242 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 7243 UNCODE.adaptive(); 7244 if (SiteParameters.dynamic_srcset_active === '1') { 7245 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 7246 } 7247 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7248 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 7249 if (typeof getLightbox === 'object') { 7250 getLightbox.refresh(); 7251 } else { 7252 UNCODE.lightbox(); 7253 } 7254 } 7255 cssgridContainer.trigger('more-items-loaded'); 7256 $(window).trigger('more-items-loaded'); 7257 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7258 }, 300); 7259 7260 $('.pagination', cssgridFooter).remove(); 7261 cssgridFooter.append($resultPagination); 7262 7263 if (cssgridResultCount.length > 0) { 7264 $('.woocommerce-result-count', cssgridResultCount).remove(); 7265 cssgridResultCount.append($resultCount); 7266 } 7267 }); 7268 }; 7269 7270 $filters.each(function(i, buttonGroup) { 7271 var $buttonGroup = $(buttonGroup); 7272 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 7273 $buttonGroup.find('.active').removeClass('active'); 7274 $(this).addClass('active'); 7275 7276 }); 7277 7278 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 7279 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 7280 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 7281 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 7282 e.preventDefault(); 7283 $cats_filters.slideToggle(400, 'easeInOutCirc'); 7284 }); 7285 7286 }); 7287 }; 7288}; 7289 7290UNCODE.linearGrid = function(){ 7291 $('.linear-wrapper').each(function(){ 7292 var $wrap = $(this), 7293 $system = $wrap.closest('.linear-system'), 7294 $dragger = $('[data-dragger]', $system), 7295 $row = $wrap.closest('.vc_row[data-parent]'),
7296 _row = $row[0], 7297 $cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap), 7298 vertical = $cont.hasClass('linear-or-vertical'), 7299 clone = $wrap.attr('data-infinite') === 'yes' || vertical, 7300 freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop', 7301 freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile', 7302 dataSpeed = parseFloat( $wrap.attr('data-speed') ), 7303 isInViewport = false, 7304 isHover = false, 7305 init = false, 7306 stableHeight = UNCODE.wheight, 7307 wCont, hCont, docH, marqueeTL; 7308 7309 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 7310 var dataX = dataSpeed; 7311 7312 dataSpeed += 5; 7313 7314 var checkLinearGridSize = function(){ 7315 if ( !$wrap.is(':visible') ) { 7316 return; 7317 } 7318 $wrap.find('.cont-appended').remove(); 7319 7320 if ( vertical ) { 7321 if ( ! SiteParameters.is_frontend_editor ) { 7322 hCont = $cont.outerHeight(); 7323 docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed ); 7324 if ( hCont < docH ) { 7325 var res = docH - hCont * 3, 7326 times = 2 * Math.round((res/hCont+1) / 2); 7327 } 7328 for ( var i = 0; i < times; i++ ) { 7329 var $cloneCont = $cont.clone(), 7330 $cloneCont2 = $cont.clone(), 7331 trans = ( (i+2) ) * 100; 7332 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'})); 7333 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'})); 7334 $cloneCont.find('a[data-lbox]').each(function(){ 7335 var dataLbox = $(this).attr('data-lbox'); 7336 $(this).attr('data-lbox', dataLbox + '_' + i); 7337 }); 7338 $cloneCont.find('.wp-video-shortcode').each(function(){ 7339 var thisID = $(this).attr('id'); 7340 $(this).attr('id', thisID + '_' + i); 7341 }); 7342 $cloneCont2.find('a[data-lbox]').each(function(){ 7343 var dataLbox = $(this).attr('data-lbox'); 7344 $(this).attr('data-lbox', dataLbox + '_2' + i); 7345 }); 7346 $cloneCont2.find('.wp-video-shortcode').each(function(){ 7347 var thisID = $(this).attr('id'); 7348 $(this).attr('id', thisID + '__' + i); 7349 }); 7350 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7351 UNCODE.lightgallery($cloneCont); 7352 UNCODE.lightgallery($cloneCont2); 7353 } 7354 } 7355 } 7356 } else { 7357 wCont = $cont.outerWidth(); 7358 if ( (wCont) < UNCODE.wwidth*2 ) { 7359 var res = UNCODE.wwidth*2 - (wCont), 7360 times = 2 * Math.round((res/wCont+1) / 2); 7361 } 7362 for ( var i = 0; i < times; i++ ) { 7363 var $cloneCont = $cont.clone(), 7364 $cloneCont2 = $cont.clone(), 7365 trans = ( (i+2) ) * 100; 7366 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'})); 7367 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'})); 7368 $cloneCont.find('a[data-lbox]').each(function(){ 7369 var dataLbox = $(this).attr('data-lbox'); 7370 $(this).attr('data-lbox', dataLbox + '_' + i); 7371 }); 7372 $cloneCont.find('[id]').each(function(){ 7373 var thisID = $(this).attr('id'); 7374 $(this).attr('id', thisID + '_' + i); 7375 }); 7376 $cloneCont2.find('a[data-lbox]').each(function(){ 7377 var dataLbox = $(this).attr('data-lbox'); 7378 $(this).attr('data-lbox', dataLbox + '_2' + i); 7379 }); 7380 $cloneCont2.find('[id]').each(function(){ 7381 var thisID = $(this).attr('id'); 7382 $(this).attr('id', thisID + '__' + i); 7383 }); 7384 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7385 UNCODE.lightgallery($cloneCont); 7386 UNCODE.lightgallery($cloneCont2); 7387 } 7388 } 7389 } 7390 }; 7391 if ( clone ) { 7392 checkLinearGridSize(); 7393 $(window).on('resize.linearGrid', function(){ 7394 checkLinearGridSize(); 7395 }); 7396 } 7397 7398 var continuousLinearMarquee = function(_xStrt){ 7399 if ( !$wrap.is(':visible') ) { 7400 return; 7401 } 7402 var ease = 'none'; 7403 wCont = $cont.outerWidth(); 7404 hCont = $cont.outerHeight(); 7405 7406 var xStrt = typeof _xStrt === 'undefined' ? 0 : _xStrt, 7407 xEnd = vertical ? hCont : wCont, 7408 direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7409 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed, 7410 speedSlow = (xEnd + xStrt) / 45, 7411 freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7412 7413 marqueeTL = new TimelineMax({paused:true, reversed:true}); 7414 7415 if ( isInViewport && !isHover && !freezed ) { 7416 marqueeTL.play(); 7417 7418 if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) { 7419 var $column = $wrap.closest('.wpb_column'), 7420 $col_link = $('.col-link', $column), 7421 $hover_sel = $wrap; 7422 7423 if ( $col_link.length ) { 7424 $hover_sel = $wrap.add($column); 7425 } 7426 7427 $hover_sel.on('mouseover', function(){ 7428 if ( $wrap.attr('data-hover') === 'yes' ) { 7429 //speed = ( 10 - dataSpeed ) * 5; 7430 ease = 'power2.out'; 7431 marqueeTL.duration( speedSlow ); 7432 } else { 7433 marqueeTL.pause(); 7434 } 7435 isHover = true; 7436 }).on('mouseout', function(){ 7437 if ( $wrap.attr('data-hover') === 'yes' ) { 7438 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed; 7439 ease = 'power2.in'; 7440 marqueeTL.duration( speed ); 7441 } else { 7442 marqueeTL.play(); 7443 } 7444 isHover = false;
7445 }); 7446 } 7447 7448 } 7449 7450 gsap.killTweensOf($wrap); 7451 if ( vertical ) { 7452 marqueeTL.fromTo( $wrap, { 7453 y: xStrt * direction 7454 }, 7455 { 7456 duration: speed, 7457 y: xEnd * direction * -1, 7458 onComplete: function(){ 7459 continuousLinearMarquee(); 7460 }, 7461 ease: ease, 7462 paused: freezed 7463 }); 7464 } else { 7465 marqueeTL.fromTo( $wrap, { 7466 x: xStrt * direction 7467 }, 7468 { 7469 duration: speed, 7470 x: xEnd * direction * -1, 7471 onComplete: function(){ 7472 continuousLinearMarquee(); 7473 }, 7474 ease: ease, 7475 paused: freezed 7476 }); 7477 } 7478 }; 7479 7480 var dragLinearContinuous = function(){ 7481 if ( !$wrap.is(':visible') ) { 7482 return; 7483 } 7484 var matrix, _x, _y, 7485 dragAction = false; 7486 Draggable.create($wrap[0], { 7487 type: vertical ? "y" : "x", 7488 bounds: document.getElementById("container"), 7489 inertia: false, 7490 onPress: function (e) { 7491 }, 7492 onRelease: function (e) { 7493 if ( dragAction === true ) { 7494 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7495 _x = matrix[12] || matrix[4]; 7496 _y = matrix[13] || matrix[5]; 7497 if ( vertical ) { 7498 continuousLinearMarquee(_y * -1); 7499 } else { 7500 continuousLinearMarquee(_x * -1); 7501 } 7502 $wrap.removeClass('linear-dragging'); 7503 } 7504 }, 7505 onDrag: function (e) { 7506 dragAction = true; 7507 $wrap.addClass('linear-dragging'); 7508 }, 7509 onDragEnd: function (e) { 7510 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7511 _x = matrix[12] || matrix[4]; 7512 _y = matrix[13] || matrix[5]; 7513 wCont = $cont.outerWidth(); 7514 hCont = $cont.outerHeight(); 7515 if ( vertical ) { 7516 if ( Math.abs(_y) > hCont ) { 7517 if ( _y < 0 ) { 7518 _y = hCont + parseFloat( _y ); 7519 } else { 7520 _y = parseFloat( _y ) - hCont; 7521 } 7522 } 7523 continuousLinearMarquee(_y * -1); 7524 } else { 7525 if ( Math.abs(_x) > wCont ) { 7526 if ( _x < 0 ) { 7527 _x = wCont + parseFloat( _x ); 7528 } else { 7529 _x = parseFloat( _x ) - wCont; 7530 } 7531 } 7532 continuousLinearMarquee(_x * -1); 7533 } 7534 $wrap.removeClass('linear-dragging'); 7535 dragAction = false; 7536 }, 7537 }); 7538 }; 7539 7540 var runScrollLinear = function(){ 7541 var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7542 if ( !$wrap.is(':visible') || freezed ) { 7543 return; 7544 } 7545 var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7546 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 7547 7548 var linearGridScroll = function(){ 7549 if ( isInViewport ) { 7550 var bound = _row.getBoundingClientRect(); 7551 7552 var bound_top = bound.top, 7553 gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction ); 7554 7555 if ( vertical ) { 7556 $wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7557 } else { 7558 $wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7559 } 7560 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7561 requestAnimationFrame(linearGridScroll); 7562 } 7563 } 7564 if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) { 7565 window.addEventListener("scroll", linearGridScroll); 7566 } 7567 }; 7568 7569 $(window).on( 'load wwResize', function(e) { 7570 stableHeight = UNCODE.wheight; 7571 linearGridScroll(); 7572 }); 7573 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7574 requestAnimationFrame(linearGridScroll); 7575 } 7576 }; 7577 7578 var dragLinear = function(){ 7579 if ( !$wrap.is(':visible') ) { 7580 return; 7581 } 7582 var matrix, _x, _y; 7583 Draggable.create($dragger[0], { 7584 type: vertical ? "y" : "x", 7585 bounds: document.getElementById("container"), 7586 inertia: false, 7587 onPress: function (e) { 7588 }, 7589 onRelease: function (e) { 7590 }, 7591 onDrag: function (e) { 7592 $wrap.addClass('linear-dragging'); 7593 }, 7594 onDragEnd: function (e) { 7595 matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7596 _x = matrix[12] || matrix[4]; 7597 _y = matrix[13] || matrix[5]; 7598 wCont = $cont.outerWidth(); 7599 hCont = $cont.outerHeight(); 7600 if ( vertical ) { 7601 if ( Math.abs(_y) > hCont ) { 7602 if ( _y < 0 ) { 7603 _y = hCont + parseFloat( _y ); 7604 } else { 7605 _y = parseFloat( _y ) - hCont; 7606 } 7607 gsap.to( $dragger[0], { 7608 duration: 0, 7609 y: _y, 7610 }); 7611 } 7612 } else { 7613 if ( Math.abs(_x) > wCont ) { 7614 if ( _x < 0 ) { 7615 _x = wCont + parseFloat( _x ); 7616 } else { 7617 _x = parseFloat( _x ) - wCont; 7618 } 7619 gsap.to( $dragger[0], { 7620 duration: 0, 7621 x: _x, 7622 }); 7623 } 7624 } 7625 $wrap.removeClass('linear-dragging'); 7626 }, 7627 }); 7628 }; 7629 7630 if ( ! $('body').hasClass('compose-mode') ) { 7631 if ( $wrap.attr('data-animation') === 'marquee' || $wrap.attr('data-animation') === 'marquee-opposite' ) { 7632 continuousLinearMarquee(); 7633 $(window).on( 'wwResize', function(e) { 7634 continuousLinearMarquee(); 7635 }); 7636 if ( $wrap.attr('data-draggable') === 'yes' ) { 7637 dragLinearContinuous(); 7638 } 7639 } 7640 7641 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7642 runScrollLinear(); 7643 if ( $wrap.attr('data-draggable') === 'yes' ) { 7644 dragLinear(); 7645 } 7646 } 7647 7648 if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7649 var observer = new IntersectionObserver(function(entries) { 7650
7651 entries.forEach(function(entry){ 7652 if ( entry.isIntersecting ) { 7653 isInViewport = true; 7654 if ( !init ) { 7655 init = true; 7656 continuousLinearMarquee(); 7657 } else { 7658 if ( typeof marqueeTL !== 'undefined' ) { 7659 marqueeTL.play(); 7660 } 7661 } 7662 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7663 requestAnimFrame(runScrollLinear); 7664 } 7665 } else { 7666 isInViewport = false; 7667 if ( typeof marqueeTL !== 'undefined' ) { 7668 marqueeTL.pause(); 7669 } 7670 } 7671 }); 7672 }, { 7673 root: document, 7674 }); 7675 7676 observer.observe(_row); 7677 7678 } else { 7679 7680 var checkVisible = function( el, off ) { 7681 if (typeof jQuery === "function" && el instanceof jQuery) { 7682 el = el[0]; 7683 } 7684 7685 off = typeof off=='undefined' ? 50 : off; 7686 7687 var rect = el.getBoundingClientRect(); 7688 7689 return ( 7690 ( 7691 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7692 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7693 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7694 ) 7695 ); 7696 }; 7697 7698 var checkVisibility = function(){ 7699 7700 if ( checkVisible($row) ) { 7701 isInViewport = true; 7702 if ( typeof marqueeTL !== 'undefined' ) { 7703 marqueeTL.play(); 7704 } 7705 } else { 7706 isInViewport = false; 7707 if ( typeof marqueeTL !== 'undefined' ) { 7708 marqueeTL.pause(); 7709 } 7710 } 7711 } 7712 7713 window.addEventListener("scroll", checkVisibility); 7714 checkVisibility(); 7715 7716 } 7717 } 7718 }); 7719}; 7720UNCODE.preventDoubleTransition = function() { 7721 $('.sticky-element .animate_when_almost_visible').each(function(){ 7722 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 7723 $el.addClass('do_not_reanimate'); 7724 }); 7725 }); 7726}; 7727 7728UNCODE.checkScrollForTabs = function(){ 7729 var goToSection = window.location.hash.replace('#', ''), 7730 $index; 7731 7732 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 7733 goToSection = encodeURIComponent(goToSection); 7734 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 7735 7736 $index.attr('data-parent', 'parent-' + goToSection); 7737 7738 if (window.location.hash != undefined && window.location.hash != '') { 7739 requestTimeout(function() { 7740 scrollBody('parent-' + goToSection); 7741 }, 500); 7742 } 7743 7744 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 7745 var hash = (e.currentTarget).hash, 7746 index = (e.currentTarget).closest('.uncode-tabs'); 7747 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 7748 $('a[href="' + hash + '"][data-tab-history]').click(); 7749 scrollBody(index); 7750 } 7751 }); 7752 7753 var scrollBody = function(index) { 7754 7755 var getSection = $('a[href="' + index + '"][data-tab-history]'), 7756 scrollTo, 7757 safeGap = 27; 7758 7759 if ( ! getSection.length ) { 7760 getSection = $('div[data-parent="' + index + '"]'); 7761 7762 if ( getSection.attr('data-target') == 'row' ) { 7763 getSection = getSection.closest('.vc_row'); 7764 safeGap = 0; 7765 } 7766 } 7767 7768 if (typeof getSection === 'undefined' || ! getSection.length ) { 7769 return; 7770 } 7771 7772 var body = $("html, body"), 7773 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7774 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 7775 getOffset = UNCODE.get_scroll_offset(); 7776 if ( typeof getSection.offset() === 'undefined' ) 7777 return; 7778 scrollTo = getSection.offset().top - safeGap; 7779 scrollTo -= getOffset; 7780 7781 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7782 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7783 7784 if (index != 0) { 7785 UNCODE.scrolling = true; 7786 } 7787 7788 if (scrollSpeed == 0) { 7789 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 7790 UNCODE.scrolling = false; 7791 } else { 7792 body.animate({ 7793 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 7794 }, scrollSpeed, 'easeInOutQuad', function() { 7795 requestTimeout(function() { 7796 UNCODE.scrolling = false;
7797 if (getOffset != UNCODE.get_scroll_offset()) { 7798 scrollBody(index); 7799 } 7800 }, 100); 7801 }); 7802 } 7803 7804 }; 7805}; 7806 7807UNCODE.printScreen = function() { 7808 var inlineMediaStyle = null, 7809 setResize; 7810 7811 function changeMediaStyle() { 7812 clearRequestTimeout(setResize); 7813 setResize = requestTimeout(function(){ 7814 var $head = document.getElementsByTagName('head')[0], 7815 $newStyle = document.createElement('style'), 7816 winW = window.innerWidth, 7817 printH = window.innerHeight; 7818 7819 $newStyle.setAttribute('type', 'text/css'); 7820 $newStyle.setAttribute('media', 'print'); 7821 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 7822 7823 if (inlineMediaStyle != null) { 7824 $head.replaceChild($newStyle, inlineMediaStyle) 7825 } else { 7826 $head.appendChild($newStyle); 7827 } 7828 inlineMediaStyle = $newStyle; 7829 }, 1000); 7830 } 7831 7832 changeMediaStyle(); 7833 window.addEventListener('resize', changeMediaStyle); 7834}; 7835 7836UNCODE.fullPage = function() { 7837 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 7838 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 7839 return false; 7840 } else { 7841 requestTimeout(function() { 7842 window.scrollTo(0, 0); 7843 }, 10); 7844 } 7845 7846 var $masthead = $('#masthead'), 7847 $logo = $('#logo-container-mobile'), 7848 $logolink = $('[data-minheight]', $logo), 7849 logoMinScale = $logolink.data('minheight'), 7850 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 7851 $container = $('.main-container .post-content'), 7852 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 7853 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 7854 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 7855 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 7856 headerWithOpacity = $('.header-scroll-opacity', $header).length, 7857 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 7858 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 7859 scrollBar = true, 7860 effect, 7861 animationEndTimeOut, 7862 fp_anim_time = 900, 7863 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 7864 is_scrolling = false, 7865 dataNames = [], 7866 is_first = true, 7867 no_history = $('body').hasClass('uncode-scroll-no-history'), 7868 theres_footer = true; 7869 7870 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 7871 $('> div', $footer).each(function(index, el){ 7872 if ( $(el).outerHeight() < 2 ) 7873 theres_footer = false; 7874 else 7875 theres_footer = true; 7876 }); 7877 } 7878 7879 if ( !$footer.length ) 7880 theres_footer = false; 7881 7882 if ( !UNCODE.isFullPageSnap ) { 7883 7884 if ( $('body').hasClass('uncode-fullpage-zoom') ) 7885 effect = 'scaleDown'; 7886 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 7887 effect = 'moveparallax'; 7888 else 7889 effect = 'movecurtain'; 7890 } 7891 7892 if ( $('body').hasClass('uncode-fullpage-trid') ) 7893 fp_anim_time = fp_anim_time*2; 7894 7895 if ( $header.length ) { 7896 if ( headerName !== '' ) 7897 $header.attr('data-name', headerName); 7898 if ( headerLabel !== '' ) 7899 $header.attr('data-label', headerLabel); 7900 $container.prepend($header); 7901 } 7902 if ( theres_footer ) { 7903 $container.append($footer); 7904 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 7905 $('aside.widget ul', $footer).addClass('no-list'); 7906 } 7907 7908 var $all = $rows.add($header); 7909 7910 if ( theres_footer ) 7911 $all = $all.add($footer); 7912 7913 $all.each(function(index, row) { 7914 if( index === 0 ) 7915 $(row).addClass('uncode-scroll-active'); 7916 }); 7917 7918 var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile; 7919 7920 if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) { 7921 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 7922 } 7923 7924 $all.each(function(index, val) { 7925 var getName = $(val).data('name'), 7926 label; 7927 7928 if (typeof getName == 'undefined' || getName == 'undefined') 7929 getName = SiteParameters.slide_name + '-' + index; 7930 7931 //if ( dataNames.includes(getName) ) { 7932 if ( dataNames.indexOf(getName) > 0 ) { 7933 getName += '_' + index; 7934 $(val).data('name', getName); 7935 } 7936 7937 dataNames.push(getName); 7938 7939 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 7940 7941 if (typeof $(val).attr('data-label') !== 'undefined') 7942 label = $(val).attr('data-label'); 7943 else label = ''; 7944 7945 if ( $(val).is($footer) ) 7946 return; 7947 7948 if (label != '' ) { 7949 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 7950 $('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + label + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 7951 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 7952 $('ul.onepage-pagination').append("<li><a class='one-dot-link' aria-label='" + SiteParameters.uncode_one_dot_label + " " + index + "' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>"); 7953 } 7954 }); 7955 7956 var checkVisible = function( el, off ) { 7957 if (typeof jQuery === "function" && el instanceof jQuery) { 7958 el = el[0]; 7959 } 7960 7961 off = typeof off=='undefined' ? 50 : off; 7962 7963 var rect = el.getBoundingClientRect(); 7964 7965 return ( 7966 ( 7967 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7968 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7969 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7970 ) 7971 ); 7972 }; 7973 7974 var animationEndAction = function( index, nextIndex ) { 7975 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7976 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7977 player, iframe; 7978 7979 if ( !$nextSlide.is($footer) ) { 7980 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7981 } 7982 7983 if ( !UNCODE.isFullPageSnap ) { 7984 activateKBurns( nextIndex ); 7985 } 7986 7987 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7988 if ($(this).attr('data-provider') == 'vimeo') { 7989 iframe = $(this).find('iframe'); 7990 player = new Vimeo.Player(iframe[0]); 7991 player.pause(); 7992 } else if ($(this).attr('data-provider') == 'youtube') { 7993 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7994 } else { 7995 if ($(this).is('video')) { 7996 $(this)[0].volume = 0; 7997 $(this)[0].pause(); 7998 } 7999 } 8000 }); 8001 8002 if ( ! UNCODE.isMobile && headerWithOpacity ) { 8003 if ( $nextSlide.is($header) ) 8004 $header.removeClass('header-scrolled'); 8005 } 8006 8007 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 8008 $otherEl.each(function(){ 8009 var $otherThis = $(this), 8010 $bgwrapperOther = $('.background-inner', $otherThis); 8011 if ( !checkVisible($otherThis) ) 8012 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 8013 8014 }); 8015 8016 if ( !checkVisible($currentSlide) ) { 8017 $currentSlide.removeClass('uncode-scroll-visible'); 8018 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 8019 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8020 currentScroll.scrollTo(0, 0, 0); 8021 } 8022 8023 clearRequestTimeout(animationEndTimeOut); 8024 animationEndTimeOut = requestTimeout(function(){ 8025 Waypoint.refreshAll(); 8026 $( document.body ).trigger('uncode_waypoints'); 8027 var eventFP = new CustomEvent('fp-slide-changed'); 8028 window.dispatchEvent(eventFP); 8029 is_scrolling = false; 8030 8031 if ( is_first ) { 8032 $('ul.onepage-pagination a').removeClass('is-selected'); 8033 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8034 is_first = false; 8035 } 8036 8037 }, 500); 8038 }; 8039 8040 var postLeaveActions = function( nextIndex ){ 8041 if ( menuHidden && ! UNCODE.isMobile ) 8042 return false; 8043 8044 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8045 $cols = $('.uncol', $el), 8046 anchor = $el.data('anchor'); 8047 8048 if ( ! UNCODE.isFullPageSnap ) { 8049 $.each($cols, function(index, val){ 8050 if ( $(val).hasClass('style-light') ){ 8051 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 8052 return false; 8053 } else if ( $(val).hasClass('style-dark') ) { 8054 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 8055 return false; 8056 } 8057 }); 8058 } 8059 8060 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 8061 $('.menu-item' ).removeClass('active'); 8062 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8063 } 8064 8065 if ( !UNCODE.isFullPageSnap ) { 8066 activateBackWash( nextIndex ); 8067 } 8068 }; 8069 8070 var activateBackWash = function( nextIndex ){ 8071 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8072 $bgwrapper; 8073 8074 if ( $el.length ) { 8075 if ( $el.hasClass('with-zoomout') ) { 8076 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8077 } else if ( $('.with-zoomout', $el).length ) { 8078 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 8079 } else { 8080 return false; 8081 } 8082 } else { 8083 return false; 8084 } 8085 8086 $bgwrapper.addClass('uncode-zoomout'); 8087 8088 }; 8089 8090 var activateKBurns = function( nextIndex ){ 8091 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8092 $bgwrapper; 8093 8094 if ( $el.length ) { 8095 if ( $el.hasClass('with-kburns') ) { 8096 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8097 } else if ( $('.with-kburns', $el).length ) { 8098 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 8099 } else { 8100 return false; 8101 } 8102 } else { 8103 return false; 8104 } 8105 8106 $bgwrapper.addClass('uncode-kburns'); 8107 8108 }; 8109 8110 var activateParallax = function( nextIndex, direction ){ 8111 8112 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8113 $cell = $('.fp-tableCell', $el), 8114 animationEnd = 'webkitAnimationEnd animationend', 8115 cellAnim; 8116 8117 switch( direction ) { 8118 case 'up': 8119 cellAnim = 'moveFromTopInner'; 8120 break; 8121 default: 8122 cellAnim = 'moveFromBottomInner'; 8123 } 8124 8125 $cell.css({ 8126 'animation-name': cellAnim, 8127 'animation-duration': fp_anim_time + 'ms', 8128 'animation-delay': '', 8129 'animation-timing-function': fp_easing, 8130 'animation-fill-mode': 'both', 8131 }).off(animationEnd) 8132 .on(animationEnd, function(event) { 8133 if ( event.originalEvent.animationName === cellAnim ) { 8134 $cell 8135 .css({ 8136 'animation-name': '', 8137 'animation-duration': '', 8138 'animation-delay': '', 8139 'animation-timing-function': '', 8140 'animation-fill-mode': '', 8141 }); 8142 } 8143 }); 8144 }; 8145 8146 var scrollHashes = function(){ 8147 var hash = window.location.hash.replace('#', '').split('/'), 8148 hashInd; 8149 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 8150 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 8151 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 8152 $.fn.fullpage.moveTo(hashInd+1); 8153 } 8154 } else if( hash[0] === '' ) { 8155 $.fn.fullpage.moveTo(1); 8156 } 8157 }; 8158 8159 var hideMenu = function( index, nextIndex ){ 8160 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 8161 return false; 8162 8163 var hMenu = UNCODE.menuHeight, 8164 transTime = hMenu * 2; 8165 8166 if ( index === 1 && nextIndex > 1 ) { 8167 hMenu = hMenu * -1; 8168 } else if ( index !== 1 && nextIndex === 1 ) { 8169 hMenu = 0; 8170 } else { 8171 return false;
8172 } 8173 8174 $masthead.css({ 8175 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8176 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8177 '-webkit-transition': 'transform 0.5s ease-in-out', 8178 'transition': 'transform 0.5s ease-in-out' 8179 }); 8180 }; 8181 8182 var shrinkMenu = function( index, nextIndex ){ 8183 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 8184 return false; 8185 8186 if ( index === 1 && nextIndex > 1 ) { 8187 $logo.addClass('shrinked'); 8188 $('div', $logo).each(function(index, val){ 8189 $(val).css({ 8190 'height': logoMinScale, 8191 'line-height': logoMinScale 8192 }); 8193 if ($(val).hasClass('text-logo')) { 8194 $(val).css({ 8195 'font-size': logoMinScale + 'px' 8196 }); 8197 } 8198 }); 8199 requestTimeout(function() { 8200 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8201 }, 300); 8202 } else if ( index !== 1 && nextIndex === 1 ) { 8203 $logo.removeClass('shrinked'); 8204 $('div', $logo).each(function(index, val){ 8205 $(val).css({ 8206 'height': logoMaxScale, 8207 'line-height': logoMaxScale 8208 }); 8209 if ($(val).hasClass('text-logo')) { 8210 $(val).css({ 8211 'font-size': logoMaxScale + 'px' 8212 }); 8213 } 8214 }); 8215 requestTimeout(function() { 8216 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8217 }, 300); 8218 } else { 8219 return false; 8220 } 8221 8222 }; 8223 8224 var anchorLink = function(){ 8225 8226 $container.add('.menu-item').find('a[href*="#"]').on('click', function(e) { 8227 var $this = $(e.currentTarget), 8228 hash = e.currentTarget.href.split('#'), 8229 current = window.location.href.split('#'), 8230 ind, 8231 currentMenuOpened = UNCODE.menuOpened, 8232 go = false; 8233 8234 var hash_url = hash[0].replace(/\/?$/, '/'), 8235 current_url = current[0].replace(/\/?$/, '/'); 8236 8237 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 8238 hash = '#'+hash[1]; 8239 e.preventDefault(); 8240 go = true; 8241 } 8242 8243 if ( go ) { 8244 8245 if ( $(hash).length ) { 8246 ind = $(hash).closest('.fp-section').index(); 8247 } else { 8248 hash = hash.slice(1); 8249 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 8250 } 8251 8252 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 8253 ind = $this.closest('.fp-section').index(); 8254 8255 UNCODE.menuOpened = false; 8256 8257 $.fn.fullpage.moveTo(ind+1); 8258 8259 UNCODE.menuOpened = currentMenuOpened; 8260 if (UNCODE.menuOpened) { 8261 if (UNCODE.wwidth < UNCODE.mediaQuery) { 8262 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 8263 } else { 8264 $('.mmb-container-overlay .overlay-close').trigger('click'); 8265 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 8266 } 8267 } 8268 8269 } 8270 8271 }); 8272 8273 $('.header-scrolldown').on('click', function(event) { 8274 event.preventDefault(); 8275 var scrollDown = $(this), 8276 ind = scrollDown.closest('.fp-section').index(); 8277 8278 $.fn.fullpage.moveTo(ind+2); 8279 }); 8280 8281 var anchor = $('.fp-section.active').data('anchor'); 8282 8283 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 8284 $('.menu-item').removeClass('active'); 8285 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8286 } 8287 8288 }; 8289 8290 var slideLeave = function( index, nextIndex, direction ) { 8291 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 8292 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8293 animationEnd = 'webkitAnimationEnd animationend', 8294 transitionEnd = 'webkitTransitionEnd transitionend', 8295 animOut = effect != 'scaleDown' ? effect + direction : effect, 8296 animIn, 8297 isFooter = false, 8298 isFooterNext = false, 8299 footerH = $footer.outerHeight(), 8300 timeout, 8301 player, iframe, 8302 footerCoeff; 8303 switch( direction ) { 8304 case 'up': 8305 animIn = 'moveFromTop'; 8306 break; 8307 default: 8308 animIn = 'moveFromBottom'; 8309 } 8310 8311 if ( $('body').hasClass('uncode-fullpage-trid') ) { 8312 animOut = animIn + 'trid'; 8313 animIn = animOut + 'In'; 8314 } else if ( UNCODE.isFullPageSnap ) { 8315 animIn = animOut = 'none'; 8316 } 8317 8318 hideMenu(index, nextIndex); 8319 shrinkMenu(index, nextIndex); 8320 8321 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 8322 if ($(this).attr('data-provider') == 'vimeo') { 8323 iframe = $(this).find('iframe'); 8324 player = new Vimeo.Player(iframe[0]); 8325 player.pause(); 8326 } else if ($(this).attr('data-provider') == 'youtube') { 8327 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 8328 } else { 8329 if ($(this).is('video')) { 8330 $(this)[0].volume = 0; 8331 $(this)[0].pause(); 8332 } 8333 } 8334 }); 8335 8336 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 8337 if ($(this).attr('data-provider') == 'vimeo') { 8338 iframe = $(this).find('iframe'); 8339 iframe.on('load', function(){ 8340 player = new Vimeo.Player(iframe); 8341 player.setVolume(0); 8342 player.play(); 8343 }); 8344 player = new Vimeo.Player(iframe); 8345 player.setVolume(0); 8346 player.play(); 8347 } else if ($(this).attr('data-provider') == 'youtube') { 8348 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 8349 } else { 8350 if ($(this).is('video')) { 8351 $(this)[0].volume = 0; 8352 $(this)[0].play(); 8353 } 8354 } 8355 }); 8356 8357 if ( $currentSlide.is($footer) ) 8358 isFooter = true; 8359 8360 if ( $nextSlide.is($footer) ) 8361 isFooterNext = true; 8362 8363 if ( ! UNCODE.isMobile && headerWithOpacity ) { 8364 if ( $currentSlide.is($header) ) 8365 $header.addClass('header-scrolled'); 8366 } 8367 8368 footerCoeff = footerH; 8369 8370 if ( UNCODE.isFullPageSnap ) { 8371 postLeaveActions( nextIndex ); 8372 activateBackWash( nextIndex ); 8373 activateKBurns( nextIndex ); 8374 requestTimeout(function(){ 8375 animationEndAction( index, nextIndex ); 8376 }, fp_anim_time+150); 8377 } else { 8378 if ( isFooterNext ) { 8379 8380 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 8381 $iscrollWrapper.addClass('no-scrolloverflow'); 8382 8383 $nextSlide 8384 .add($currentSlide) 8385 .addClass('uncode-scroll-front') 8386 .addClass('uncode-scroll-active') 8387 .addClass('uncode-scroll-visible'); 8388 $container.css({ 8389 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8390 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8391 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8392 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8393 }).off(transitionEnd) 8394 .one(transitionEnd, function(){ 8395 animationEndAction( index, nextIndex ); 8396 }); 8397 8398 } else if ( isFooter ) { 8399 8400 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 8401 .add($currentSlide) 8402 .addClass('uncode-scroll-front') 8403 .addClass('uncode-scroll-active') 8404 .addClass('uncode-scroll-visible'); 8405 $container.css({ 8406 '-webkit-transform': 'translate3d(0, 0, 0)', 8407 'transform': 'translate3d(0, 0, 0)', 8408 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8409 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8410 }) 8411 .one(transitionEnd, function(){ 8412 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 8413 clearRequestTimeout(timeout); 8414 timeout = requestTimeout(function(){ 8415 $.fn.fullpage.moveTo(nextIndex); 8416 slideLeave( index-1, nextIndex, 'up' ); 8417 $container.off(transitionEnd); 8418 }, 50); 8419 } 8420 animationEndAction( index, nextIndex ); 8421 }); 8422 8423 } else { 8424 8425 postLeaveActions( nextIndex ); 8426 8427 if ( !$('body').hasClass('uncode-fullpage-trid') ) 8428 activateParallax( nextIndex, direction ); 8429 8430 var $outBg = $('.background-wrapper', $currentSlide); 8431 8432 $nextSlide 8433 .addClass('uncode-scroll-front') 8434 .addClass('uncode-scroll-active') 8435 .addClass('uncode-scroll-visible') 8436 .addClass('uncode-scroll-animating-in') 8437 .css({ 8438 'z-index':4, 8439 'animation-name': animIn, 8440 'animation-duration': fp_anim_time + 'ms', 8441 'animation-delay': '', 8442 'animation-timing-function': fp_easing, 8443 'animation-fill-mode': 'both', 8444 'transition': 'initial', 8445 }).off(animationEnd) 8446 .on(animationEnd, function(event) { 8447 if ( event.originalEvent.animationName === animIn ) { 8448 $(this) 8449 .addClass('uncode-scroll-already') 8450 .removeClass('uncode-scroll-front') 8451 .removeClass('uncode-scroll-animating-in') 8452 .css({ 8453 'animation-name': '', 8454 'animation-duration': '', 8455 'animation-delay': '', 8456 'animation-timing-function': '', 8457 'animation-fill-mode': '', 8458 'transition': 'initial', 8459 }); 8460 8461 $currentSlide 8462 .removeClass('uncode-scroll-active') 8463 .add($outBg) 8464 .css({ 8465 'animation-name': '', 8466 'animation-duration': '', 8467 'animation-delay': '', 8468 'animation-timing-function': '', 8469 'animation-fill-mode': '', 8470 'transition': 'initial', 8471 }); 8472 8473 animationEndAction( index, nextIndex ); 8474 8475 } 8476 8477 if ( nextIndex > 1 ) 8478 $('body').addClass('window-scrolled'); 8479 else 8480 $('body').removeClass('window-scrolled'); 8481 }); 8482 8483 $currentSlide 8484 .addClass('uncode-scroll-animating-out') 8485 .removeClass('uncode-scroll-front') 8486 .css({ 8487 'z-index':'1', 8488 'animation-name': animOut, 8489 'animation-duration': fp_anim_time + 'ms', 8490 'animation-delay': '', 8491 'animation-timing-function': fp_easing, 8492 'animation-fill-mode': 'both', 8493 'transition': 'initial', 8494 'will-change': 'auto' 8495 }).off(animationEnd) 8496 .on(animationEnd, function(event) { 8497 if ( event.originalEvent.animationName === animOut ) { 8498 $currentSlide.removeClass('uncode-scroll-animating-out'); 8499 } 8500 }); 8501 8502 if ( $('body').hasClass('uncode-fp-opacity') ) { 8503 $currentSlide.find('> div').css({ 8504 'animation-name': 'opacityout', 8505 'animation-duration': fp_anim_time + 'ms', 8506 'animation-delay': '', 8507 'animation-timing-function': fp_easing, 8508 'animation-fill-mode': 'both', 8509 'transition': 'initial', 8510 }).off(animationEnd) 8511 .on(animationEnd, function(event) { 8512 if ( event.originalEvent.animationName === 'opacityout' ) { 8513 $(event.currentTarget).css({ 8514 'animation-name': '', 8515 'animation-duration': '', 8516 'animation-delay': '', 8517 'animation-timing-function': '', 8518 'animation-fill-mode': '', 8519 'transition': '', 8520 }); 8521 } 8522 }); 8523 } 8524 } 8525 } 8526 8527 $('.scroll-top').on('click', function(e){ 8528 $.fn.fullpage.moveTo(1); 8529 return false;
8530 }); 8531 8532 }; 8533 8534 var init_fullPage = function(mode){ 8535 8536 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 8537 // scrollBar = false; 8538 // } 8539 8540 var checkFPeffects; 8541 8542 $container.fullpage({ 8543 sectionSelector: '.uncode-scroll-lock', 8544 scrollOverflow: true, 8545 scrollOverflowOptions: { 8546 click: false, 8547 preventDefaultException: { tagName:/.*/ } 8548 }, 8549 navigation: false, 8550 scrollBar: scrollBar, 8551 scrollingSpeed: fp_anim_time, 8552 verticalCentered: true, 8553 anchors: no_history ? false : dataNames, 8554 recordHistory: !no_history, 8555 afterRender: function(){ 8556 $('body').removeClass('fp-waiting'); 8557 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 8558 var $invisible = $(this).addClass('hidden-scroll');//, 8559 }); 8560 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 8561 var $visible = $(this).addClass('uncode-scroll-visible'), 8562 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 8563 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 8564 }); 8565 8566 $('ul.onepage-pagination a').on('click', function(e){ 8567 e.preventDefault(); 8568 var $a = $(this), 8569 toIndex = $a.data('index'); 8570 8571 $.fn.fullpage.moveTo(toIndex+1); 8572 }); 8573 8574 requestTimeout(function(){ 8575 scrollHashes(); 8576 }, 1000); 8577 8578 $(window).on('hashchange', function(e){ 8579 requestTimeout(function(){ 8580 scrollHashes(); 8581 }, 500); 8582 }); 8583 8584 anchorLink(); 8585 8586 if ( $('body').hasClass('uncode-fp-opacity') ) { 8587 $all.each(function(index, row) { 8588 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 8589 classBg; 8590 8591 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 8592 classBg = testmatch[0]; 8593 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 8594 } 8595 }); 8596 } 8597 8598 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 8599 $(window).on('menuOpen gdprOpen', function(){ 8600 $.fn.fullpage.setAutoScrolling(false); 8601 }).on('menuClose gdprClose', function(){ 8602 $.fn.fullpage.setAutoScrolling(true); 8603 }); 8604 } 8605 8606 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 8607 requestTimeout(function(){ 8608 $.fn.fullpage.setAutoScrolling(false); 8609 }, 1000); 8610 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 8611 $.fn.fullpage.setAutoScrolling(true); 8612 }); 8613 8614 if ( !UNCODE.isFullPageSnap ) { 8615 clearRequestTimeout(checkFPeffects); 8616 checkFPeffects = requestTimeout(function(){ 8617 activateBackWash( 1 ); 8618 activateKBurns( 1 ); 8619 }, 100); 8620 } 8621 8622 }, 8623 onLeave: function( index, nextIndex, direction ){ 8624 8625 if ( UNCODE.menuOpened || is_scrolling ) 8626 return false; 8627 8628 is_scrolling = true; 8629 8630 var event = new CustomEvent('fp-slide-leave'); 8631 window.dispatchEvent(event); 8632 8633 slideLeave( index, nextIndex, direction ); 8634 8635 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 8636 if ( direction === 'up' ) { 8637 $.fn.fullpage.moveTo(nextIndex-1); 8638 } else { 8639 $.fn.fullpage.moveTo(nextIndex+1); 8640 } 8641 return false; 8642 } 8643 8644 $('ul.onepage-pagination a').removeClass('is-selected'); 8645 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8646 8647 } 8648 }); 8649 }; 8650 8651 init_fullPage(); 8652 $(window).on('load', function(){ 8653 requestTimeout(function(){ 8654 $.fn.fullpage.reBuild(); 8655 }, 3000); 8656 }); 8657 8658 var addScrollingClass, 8659 removeScrollingClass; 8660 8661 window.addEventListener("fp-slide-scroll", function(){ 8662 addScrollingClass = requestTimeout( function(){ 8663 $('body').addClass('fp-slide-scrolling'); 8664 }, 10 ); 8665 8666 clearRequestTimeout(removeScrollingClass); 8667 removeScrollingClass = requestTimeout( function(){ 8668 $('body').removeClass('fp-slide-scrolling'); 8669 }, 150 ); 8670 8671 Waypoint.refreshAll(); 8672 }, false); 8673 8674 var setFPheight = function(){ 8675 var $body = document.body, 8676 $footer = document.getElementById('colophon'), 8677 $maincontainer = document.querySelector('.main-wrapper'), 8678 $boxcontainer = document.querySelector('.box-container'), 8679 $sections = document.querySelectorAll('.fp-section'), 8680 rect = $maincontainer.getBoundingClientRect(), 8681 rect2 = $boxcontainer.getBoundingClientRect(), 8682 $masthead = document.getElementById('masthead'), 8683 _hideMenu = false, 8684 menuHeight = UNCODE.menuHeight; 8685 $body.style.height = UNCODE.wheight + 'px'; 8686 8687 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 8688 _hideMenu = true; 8689 } 8690 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 8691 menuHeight = 0 8692 } 8693 8694 8695 if ( theres_footer ) 8696 $footer.style.top = (rect.height || rect2.height) + 'px'; 8697 8698 for (var i = 0; i < $sections.length; i++) { 8699 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 8700 } 8701 }; 8702 8703 setFPheight(); 8704 8705 window.addEventListener('resize', setFPheight, false); 8706 window.addEventListener('orientationchange', setFPheight, false); 8707 8708}; 8709 8710UNCODE.particles = function() { 8711 $(".vc-particles-background").each(function() { 8712 var $particle = $(this); 8713 var $parent = $particle.closest('[data-parent]'); 8714
8715 $parent.prepend($particle); 8716 // $(window).trigger('resize'); 8717 }) 8718}; 8719 8720 8721UNCODE.readMoreCol = function( $el ){ 8722 if ( typeof $el === 'undefined' || $el === null ) { 8723 $el = $('body'); 8724 } 8725 var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el); 8726 $readMoreCols.each(function(){ 8727 var $uncont = $(this), 8728 $row = $uncont.closest('.row-container'), 8729 max_h = $uncont.attr('data-ov-height'), 8730 max_h_mobile = $uncont.attr('data-ov-height-mobile'), 8731 actual_max_h = $uncont.outerHeight(), 8732 inner_h, 8733 $read_more = $('+ .btn-more-wrap', $uncont), 8734 read_more_resize = $read_more.hasClass('trigger-resize'), 8735 marginClosedBtn = $uncont.attr('data-margin-closed'), 8736 marginClosed = 0, 8737 marginOpenBtn = $uncont.attr('data-margin-open'), 8738 marginOpen = 0, 8739 anim_t = 250, 8740 resized = false; 8741 8742 max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile; 8743 8744 switch (marginClosedBtn) { 8745 case 'sm': 8746 marginClosed = 18 8747 break; 8748 8749 case 'std': 8750 marginClosed = 36 8751 break; 8752 8753 case 'lg': 8754 marginClosed = 72 8755 break; 8756 8757 case '': 8758 default: 8759 marginClosed = 0 8760 break; 8761 8762 } 8763 8764 switch (marginOpenBtn) { 8765 case 'sm': 8766 marginOpen = 18 8767 break; 8768 8769 case 'std': 8770 marginOpen = 36 8771 break; 8772 8773 case 'lg': 8774 marginOpen = 72 8775 break; 8776 8777 case 'no': 8778 marginOpen = 0 8779 break; 8780 8781 } 8782 8783 var checkToggleMobile = function(){ 8784 if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) { 8785 resized = true; 8786 if ( $read_more.hasClass('state-closed') ) { 8787 $uncont[0].style.height = ''; 8788 $uncont[0].style.maxHeight = max_h_mobile; 8789 } 8790 } if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) { 8791 if ( $read_more.hasClass('state-closed') ) { 8792 $uncont[0].style.height = ''; 8793 $uncont[0].style.maxHeight = max_h; 8794 } 8795 resized = false; 8796 } 8797 } 8798 checkToggleMobile(); 8799 $(window).on('resize', function() { 8800 checkToggleMobile(); 8801 }); 8802 8803 $('a', $read_more).on('click', function(e){ 8804 e.preventDefault(); 8805 8806 var $a = $(this); 8807 8808 if ( $read_more.hasClass('state-closed') ) { 8809 8810 $read_more 8811 .removeClass('state-closed') 8812 .addClass('state-open'); 8813 8814 $uncont.css({ 8815 'max-height': 'none', 8816 'height': 'auto', 8817 }); 8818 8819 inner_h = parseFloat( $uncont.outerHeight() ); 8820 8821 $uncont.css({ 8822 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8823 }); 8824 8825 anim_t = inner_h - actual_max_h; 8826 if ( anim_t < 250 ) { 8827 anim_t = 250; 8828 } else if ( anim_t > 1000 ) { 8829 anim_t = 1000; 8830 } 8831 8832 $uncont.css({ 8833 'transition-duration' : anim_t + 'ms' 8834 }).addClass('overflow-mask-animation').animate({ 8835 'height': inner_h 8836 }, anim_t, 'easeInOutCubic', function(){ 8837 $uncont.css({ 8838 'height' : 'auto' 8839 }).removeClass('overflow-mask'); 8840 if ( read_more_resize === true ) { 8841 window.dispatchEvent(new Event('resize')); 8842 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8843 ScrollTrigger.refresh(true); 8844 } 8845 } 8846 }); 8847 8848 if ( marginOpen != '' ) { 8849 $read_more.animate({ 8850 'margin-top' : marginOpen 8851 }, anim_t, 'easeInOutCubic'); 8852 } 8853 8854 } else { 8855 $read_more 8856 .removeClass('state-open') 8857 .addClass('state-closed'); 8858 8859 $uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({ 8860 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8861 }, anim_t, 'easeInOutCubic', function(){ 8862 if ( read_more_resize === true ) { 8863 window.dispatchEvent(new Event('resize')); 8864 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8865 ScrollTrigger.refresh(true); 8866 } 8867 } 8868 }); 8869 8870 if ( marginClosed !== '' ) { 8871 $read_more.animate({ 8872 'margin-top' : marginClosed 8873 }, anim_t, 'easeInOutCubic'); 8874 } 8875 8876 if ( $a.hasClass('toggle-scroll') ) { 8877 var $masthead = $('#masthead > div:first-child'), 8878 headH = $masthead.outerHeight(), 8879 rectTop = $row[0].getBoundingClientRect().top, 8880 checkNavBar = $a.hasClass('toggle-navbar'), 8881 checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'), 8882 offCont = ( $row.offset().top ); 8883 8884 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 8885 checkNavBar = checkNavBarMobile; 8886 } 8887 8888 if ( checkNavBar ) { 8889 offCont = offCont - headH; 8890 } 8891 8892 if ( rectTop < headH ) { 8893 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 8894 $(this).stop(); 8895 }).animate({ 8896 scrollTop: offCont 8897 }, anim_t, 'easeInOutCubic'); 8898 } 8899 } 8900 8901 } 8902 }); 8903 }); 8904} 8905UNCODE.filters = function() { 8906 var $systems = $('.isotope-system, .cssgrid-system'); 8907 8908 $systems.each(function(index, val){ 8909 var $system = $(this), 8910 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 8911 $widgets = $('.widgetized-cb-wrapper', $system), 8912 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 8913 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 8914 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 8915 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 8916 8917 if ($system.hasClass('isotope-processed')) { 8918 return; 8919 } 8920 8921 $cats_trigger.on('click', function(e) { 8922 if ( ! $('html').hasClass('screen-sm') ) { 8923 // $widgets.add($sorting_dd).slideUp(400); 8924 e.preventDefault(); 8925 $widgets.slideUp(400, 'easeInOutCirc'); 8926 } 8927 }); 8928 8929 $('.filters-toggle-trigger', $system).on('click', function(e) { 8930 e.preventDefault(); 8931 var $filters = $('.isotope-filters .menu-horizontal', $system); 8932 $filters.slideToggle(400, 'easeInOutCirc');
8933 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8934 }); 8935 8936 $widget_trgr.on('click', function(e) { 8937 e.preventDefault(); 8938 $widgets.slideToggle(400, 'easeInOutCirc'); 8939 if (!$('html').hasClass('screen-sm')) { 8940 $cats_filters.slideUp(400, 'easeInOutCirc'); 8941 } 8942 window.dispatchEvent(new CustomEvent('boxResized')); 8943 }); 8944 8945 $sorting_trgr.on('click', function(e) { 8946 e.preventDefault(); 8947 if (!$('html').hasClass('screen-sm')) { 8948 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8949 } 8950 }); 8951 8952 $system.addClass('isotope-processed'); 8953 }); 8954 8955}; 8956 8957UNCODE.widgets = function() { 8958 var widget_collapses = $('.widget-collapse'); 8959 8960 widget_collapses.each(function(){ 8961 var widget_collapse = $(this), 8962 widget_title = widget_collapse.find('.widget-title'), 8963 widget = widget_title.closest('.widget'), 8964 content = widget.children().not('.widget-title'), 8965 setCTA; 8966 8967 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 8968 widget_title.toggleClass('open'); 8969 } 8970 8971 widget_title.each(function() { 8972 var _this = $(this); 8973 var content = _this.closest('.widget').find('.widget-collapse-content'); 8974 8975 $(window).on('load resize', function(){ 8976 clearRequestTimeout(setCTA); 8977 setCTA = requestTimeout( function() { 8978 if ( content.is(':visible') ) { 8979 _this.addClass( 'open' ); 8980 } else { 8981 _this.removeClass( 'open' ); 8982 } 8983 }, 10 ); 8984 }) 8985 8986 _this.on( 'click', function(){ 8987 8988 // Get content of :after element (+ icon) to check the visibility 8989 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 8990 8991 if (icon_content === 'none' || !icon_content) { 8992 return false; 8993 } 8994 8995 _this.toggleClass('open'); 8996 var isOpen = _this.hasClass('open'), 8997 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 8998 content.animate({ 8999 height: 'toggle', 9000 padding: 'toggle', 9001 opacity: 'toggle', 9002 top: isOpen ? 0 : hasBorder 9003 }, { 9004 duration: 400, 9005 easing: "easeInOutCirc", 9006 }); 9007 9008 return false; 9009 9010 }); 9011 }); 9012 }); 9013 9014 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 9015}; 9016 9017UNCODE.unmodal = function() { 9018 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 9019 $('.unmodal-overlay').fadeIn(); 9020 $('.unmodal-overlay').addClass('loading'); 9021 $('body').addClass('uncode-unmodal-overlay-visible'); 9022 $(window).trigger('unmodal-open'); 9023 }); 9024 9025 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 9026 $('.unmodal-overlay').fadeOut(); 9027 $('.unmodal').fadeOut(); 9028 $('body').removeClass('uncode-unmodal-overlay-visible'); 9029 $('body').removeClass('uncode-unmodal-open'); 9030 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 9031 $(document).trigger('unmodal-close'); 9032 UNCODE.isUnmodalOpen = false; 9033 }); 9034 9035 $(document).on('uncode-unmodal-show-content', function() { 9036 $('.unmodal-overlay').removeClass('loading'); 9037 $('.unmodal').show(); 9038 $('.unmodal').addClass('show-unmodal-with-animation'); 9039 $('.unmodal-content')[0].scrollTop = 0; 9040 $('body').addClass('uncode-unmodal-open'); 9041 UNCODE.isUnmodalOpen = true; 9042 9043 if ($('body').hasClass('qw-body-scroll-disabled')) { 9044 $('html').addClass('uncode-unmodal-body-disable-scroll'); 9045 } 9046 9047 if ($('.unmodal').hasClass('auto-height')) { 9048 set_modal_height(); 9049 } 9050 }); 9051 9052 var set_modal_height = function() { 9053 var modal = $('.unmodal').css({height: 'auto'}); 9054 var window_height = $(window).outerHeight(); 9055 var modal_height = modal.outerHeight(); 9056 9057 modal.css('height', 'auto'); 9058 9059 if (modal_height > window_height) { 9060 modal.outerHeight(window_height); 9061 } 9062 } 9063 9064 if ($('.unmodal').hasClass('auto-height')) { 9065 var setCTA; 9066 9067 $(window).on('resize', function() { 9068 clearRequestTimeout(setCTA); 9069 setCTA = requestTimeout(function() { 9070 set_modal_height(); 9071 }, 100); 9072 }); 9073 } 9074}; 9075 9076UNCODE.bgChanger = function() { 9077 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 9078 $bg_first = $('.vc_row[data-bg-remove]'), 9079 bg_remove = $bg_first.attr('data-bg-remove'), 9080 $first = $bg_changers.first(), 9081 $last = $bg_changers.last(), 9082 $bg_wrapper = $('#changer-back-color'), 9083 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 9084 setCTA, localH = UNCODE.wheight, 9085 isScrolling; 9086 9087 $bg_first.removeClass(bg_remove); 9088 9089 var bgChange = function($col, bgColor, skin, tmbskin){ 9090 $bg_wrapper.attr( 'class', bgColor ); 9091 var menuskin; 9092 if ( typeof skin !== 'undefined' ) { 9093 menuskin = skin.replace('style', 'menu') 9094 } 9095 9096 if ( $col.length ) { 9097 $('.uncol[data-skin-change]').each(function(){ 9098 var $isoFooter = $('.isotope-footer', this); 9099 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 9100 if ( menuskin !== '' ) {
9101 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 9102 } 9103 }); 9104 9105 $('.tmb[data-skin-change]').each(function(){ 9106 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 9107 }); 9108 } 9109 }; 9110 9111 var $masthead = $('#masthead'), 9112 transDesktop, 9113 transMobile, 9114 changeSkin, 9115 9116 checkTransparencyAndChange = function( skin ){ 9117 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 9118 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 9119 changeSkin = $masthead.hasClass('menu-change-skin'); 9120 9121 if ( ! transDesktop && ! transMobile ) { 9122 return false; 9123 } 9124 9125 if ( ! changeSkin ) { 9126 return false; 9127 } 9128 9129 if ( skin === 'style-light' ){ 9130 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 9131 return false; 9132 } else if ( skin === 'style-dark' ) { 9133 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 9134 return false; 9135 } 9136 }; 9137 9138 var bg_waypoints = function(){ 9139 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 9140 9141 $.each($bg_changers, function(index, row) { 9142 9143 var $row = $(row), 9144 $col = $('.uncol[data-skin-change]', $row).eq(0), 9145 skin, 9146 $tmbs, 9147 tmbskin, 9148 bgColor = $row.attr('data-bg-color'); 9149 9150 if ( ! $row.is(':visible') ) { 9151 return false; 9152 } 9153 9154 if ( $col.length ) { 9155 skin = $col.attr('data-skin-change'); 9156 $tmbs = $('.tmb[data-skin-change]', $row); 9157 tmbskin = skin.replace('style', 'tmb'); 9158 } 9159 9160 if ( ! $row.hasClass('unscroll-horizontal') ) { 9161 $row.waypoint(function( dir ) { 9162 if ( dir === 'down' ) { 9163 bgChange($col, bgColor, skin, tmbskin); 9164 checkTransparencyAndChange(skin); 9165 } else { 9166 return; 9167 } 9168 }, {
9169 offset: '50%' 9170 }); 9171 9172 $row.waypoint(function( dir ) { 9173 if ( dir === 'up' ) { 9174 bgChange($col, bgColor, skin, tmbskin); 9175 checkTransparencyAndChange(skin); 9176 } else { 9177 return; 9178 } 9179 }, { 9180 offset: function() { 9181 var clH = this.element.clientHeight, 9182 wH = window.innerHeight, 9183 ret = clH > 200 ? -100 : clH * -0.5; 9184 return ( wH / 2 ) - clH; 9185 } 9186 }); 9187 } 9188 9189 }); 9190 9191 $('body').addClass('bg-changer-init'); 9192 9193 } 9194 }; 9195 9196 var body = document.body, 9197 edges = false; 9198 9199 var throttle = function(fn, wait) { 9200 var time = Date.now(); 9201 return function() { 9202 if ((time + wait - Date.now()) < 0) { 9203 fn(); 9204 time = Date.now(); 9205 } 9206 } 9207 } 9208 9209 var $wrapper = document.querySelector(".main-wrapper"), 9210 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 9211 9212 var $title = document.querySelector('#rotating'); 9213 if ( $title !== null ) { 9214 $title.style.whiteSpace = 'nowrap'; 9215 $title.style.transition = 'transform 200ms linear'; 9216 } 9217 9218 window.addEventListener( 'scroll', throttle( function() { 9219 window.clearRequestTimeout( isScrolling ); 9220 9221 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 9222 9223 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 9224 body = document.body, 9225 html = document.documentElement, 9226 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9227 $row = false, 9228 firstOff, 9229 lastOff; 9230 9231 if ( scrolled < 100 && $first.length ) { 9232 firstOff = $first.offset().top; 9233 if ( firstOff < 100 ) { 9234 var $row = $first; 9235 } 9236 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 9237 lastOff = $last.offset().top + $last.outerHeight(); 9238 if ( lastOff > ( docH - 100 ) ) { 9239 var $row = $last; 9240 } 9241 } 9242 9243 if ( $row.length ) { 9244 var $col = $('.uncol[data-skin-change]', $row).eq(0), 9245 skin, 9246 $tmbs, 9247 tmbskin, 9248 bgColor = $row.attr('data-bg-color'); 9249 9250 if ( $col.length ) { 9251 skin = $col.attr('data-skin-change'); 9252 $tmbs = $('.tmb[data-skin-change]', $row); 9253 tmbskin = skin.replace('style', 'tmb'); 9254 } 9255 9256 bgChange($col, bgColor, skin, tmbskin); 9257 checkTransparencyAndChange(skin); 9258 edges = true; 9259 } 9260 9261 }, 150); 9262 9263 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 9264 bg_waypoints(); 9265 Waypoint.refreshAll(); 9266 edges = false; 9267 } 9268 9269 }, 100), false); 9270 9271 $(window).on('resize', function() { 9272 clearRequestTimeout(setCTA); 9273 setCTA = requestTimeout(function() { 9274 if ( localH != UNCODE.wheight ) { 9275 localH = UNCODE.wheight; 9276 bg_waypoints(); 9277 Waypoint.refreshAll(); 9278 } 9279 }, 100); 9280 }); 9281 9282 bg_waypoints(); 9283 9284}; 9285 9286UNCODE.skewIt = function() { 9287 9288 if ( $('body').hasClass('compose-mode') ) { 9289 return; 9290 } 9291 9292 var justscrolled = false; 9293 9294 var loadSkewIt = function(){ 9295 9296 var $pageHeader = $('#page-header'), 9297 $page_body = $('.page-body'), 9298 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 9299 9300 if ( $header_skew.length ) { 9301 $pageHeader.addClass('uncode-skew').css({ 9302 position: 'relative', 9303 zIndex: 1 9304 }); 9305 $header_skew.removeClass('uncode-skew'); 9306 $page_body.css({ 9307 position: 'relative', 9308 zIndex: 0 9309 }); 9310 } 9311 9312 var $skew = $('.uncode-skew'), 9313 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 9314 horizontal = $horizontal.length, 9315 stopSkewing, 9316 lastOffset = 0, 9317 lastDate = Date.now(); 9318 9319 if ( ! $skew.length ) { 9320 return; 9321 } 9322 9323 var dropSkew = function(){ 9324 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 9325 return; 9326 9327 $skew.each(function(){ 9328 var $this = $(this), 9329 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9330 9331 if ( $drop.length ) { 9332 $this.css({ 9333 'transform': 'skew(0)' 9334 }); 9335 var bound = $this[0].getBoundingClientRect(); 9336 $drop.css({ 9337 left: bound.x * -1, 9338 top: bound.y * -1, 9339 }); 9340 } 9341 }); 9342 }; 9343 dropSkew(); 9344 9345 $(window).on('resize', dropSkew); 9346 9347 window.addEventListener( 'scroll', function() { 9348 9349 if ( justscrolled !== true ) { 9350 justscrolled = true; 9351 return; 9352 } 9353 9354 window.clearRequestTimeout( stopSkewing ); 9355 9356 var now = Date.now(), 9357 delayInMs = now - lastDate, 9358 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9359 newOffset = offset - lastOffset, 9360 speed = Math.pow((newOffset / delayInMs), 3) * -1, 9361 body = document.body, 9362 html = document.documentElement, 9363 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9364 wait = 50, 9365 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 9366 9367 if ((lastDate + wait - now) < 0) { 9368 9369 lastDate = now; 9370 lastOffset = offset; 9371 9372 if ( speed > 6 ) { 9373 speed = 6; 9374 } else if ( speed < -6 ) { 9375 speed = -6; 9376 } 9377 9378 if ( speed > 2 && offset < UNCODE.wheight ) { 9379 speed = 2; 9380 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 9381 speed = -2; 9382 } 9383 9384 var speedY = speed, 9385 speedX = speed * 1.25; 9386 9387 if ( horizontal ) { 9388 speedY = 0; 9389 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9390 speedX = 0; 9391 return; 9392 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 9393 speedX = 0; 9394 return; 9395 } 9396 } else { 9397 speedX = 0; 9398 } 9399 9400 if ( ! $skew.closest('.enter-st').length ) { 9401 speedX = 0; 9402 } 9403 9404 gsap.killTweensOf($skew); 9405 gsap.to( $skew, { 9406 duration: 0.2, 9407 skewY: (speedY * maxSpeed) + "deg", 9408 skewX: (speedX * maxSpeed) + "deg", 9409 ease: Power0.easeNone, 9410 transformOrigin: 'center', 9411 }); 9412 9413 } 9414 9415 stopSkewing = requestTimeout(function() { 9416 gsap.killTweensOf($skew); 9417 gsap.to( $skew, { 9418 duration: 0.5, 9419 skewY: "0deg", 9420 skewX: "0deg", 9421 transformOrigin: 'center', 9422 ease: Expo.easeOut, 9423 }); 9424 9425 $skew.each(function(){ 9426 var $this = $(this), 9427 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9428 9429 if ( $drop.length ) { 9430 var bound = $this[0].getBoundingClientRect() 9431 $drop.css({ 9432 left: bound.x * -1, 9433 top: bound.y * -1, 9434 }); 9435 } 9436 }); 9437 9438 }, 200); 9439 9440 }, false); 9441 9442 }; 9443 9444 $(window).on('load', loadSkewIt); 9445 9446}; 9447 9448UNCODE.rotateIt = function() { 9449 9450 if ( $('body').hasClass('compose-mode') ) { 9451 return; 9452 } 9453 9454 var frameRotate = false;
9455 var loadRotateIt = function(){ 9456 9457 var $toRotate = $('.uncode-rotate'); 9458 9459 $toRotate.each(function(){ 9460 var $rotate = $(this), 9461 deg = 0, 9462 dir = true, 9463 coeff = 1, 9464 lastOffset = 0, 9465 lastDate = Date.now(); 9466 9467 var checkScroll = function($rotate){ 9468 // if ( ! $rotate.length ) { 9469 // return; 9470 // } 9471 9472 var now = Date.now(), 9473 delayInMs = now - lastDate, 9474 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9475 newOffset = offset - lastOffset, 9476 speed = (newOffset / delayInMs) * 5, 9477 body = document.body, 9478 html = document.documentElement, 9479 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 9480 9481 lastDate = now; 9482 lastOffset = offset; 9483 9484 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 9485 deg = 0; 9486 } 9487 9488 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 9489 deg = parseFloat(deg) + parseFloat(speed); 9490 } 9491 9492 if ( $rotate.hasClass('uncode-rotate-hover') ) { 9493 $rotate.hover(function(){ 9494 coeff = 1.75; 9495 }, function(){ 9496 coeff = 1; 9497 }); 9498 } 9499 9500 // if ( speed > 0 ) { 9501 // dir = true 9502 // } else if ( speed < 0 ) { 9503 // dir = false 9504 // } 9505 9506 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 9507 deg = deg+coeff; 9508 // if ( dir ) { 9509 // deg = deg+coeff; 9510 // } else { 9511 // deg = deg-coeff; 9512 // } 9513 } 9514 9515 if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9516 return false; 9517 } 9518 9519 if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) { 9520 var undeg = deg*-1; 9521 $rotate[0].style.transform = 'rotate(' + undeg + 'deg)'; 9522 } else { 9523 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 9524 } 9525 9526 requestAnimationFrame(function() { 9527 if ( frameRotate === true ) { 9528 frameRotate = false; 9529 return; 9530 } 9531 checkScroll($rotate); 9532 }); 9533 }; 9534 9535 checkScroll($rotate); 9536 9537 }); 9538 9539 }; 9540 9541 $(window).on('load', loadRotateIt); 9542 9543 var checkRotate; 9544 var resizeRotate = function(){ 9545 var $inlineRotates = $('.inline-rotate'); 9546 $inlineRotates.each(function(){ 9547 $(this).addClass('inline-rotate-standby'); 9548 }); 9549 clearTimeout(checkRotate); 9550 checkRotate = setTimeout(function(){ 9551 $('.inline-rotate').each(function(){ 9552 $(this).removeClass('inline-rotate-standby'); 9553 frameRotate = true; 9554 }); 9555 loadRotateIt(); 9556 }, 500); 9557 }; 9558 9559 $(window).off('resize.inline-rotate', resizeRotate) 9560 .on('resize.inline-rotate', resizeRotate); 9561 9562}; 9563 9564var marqueeAttempts = 0, 9565 marqueeTO, 9566 marqueeCheckResize, 9567 initMarquee; 9568 9569UNCODE.textMarquee = function( $titles ) { 9570 9571 var isInitMarque = false; 9572 9573 var initTextMarquee = function( $titles ){ 9574 9575 if ( typeof $titles == 'undefined' ) { 9576 $titles = $('.un-text-marquee'); 9577 } 9578 9579 if ( ! $titles.length ) { 9580 return; 9581 } 9582 9583 isInitMarque = true; 9584 9585 var stableHeight = UNCODE.wheight; 9586 9587 $titles.each(function(){ 9588 var $title = $(this), 9589 $span = $('> span, > i > span', $title), 9590 txt, 9591 first = true, 9592 dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ), 9593 dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ), 9594 dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'), 9595 hasSticky = false, 9596 dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'), 9597 dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'), 9598 newW = UNCODE.wwidth, 9599 marqueeTL, inview; 9600 9601 if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) { 9602 hasSticky = true; 9603 dataTrigger = 'row'; 9604 } 9605 9606 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 9607 dataNavBar = dataNavBarMobile; 9608 } 9609 9610 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 9611 dataSpace = isNaN(dataSpace) ? 'default' : dataSpace; 9612 var dataX = dataSpeed; 9613 9614 dataSpeed += 5; 9615 9616 $('.marquee-clone-wrap', $title).remove(); 9617 9618 txt = $span.html(); 9619 9620 if ( ! $('.marquee-original-core', $span).length ) { 9621 txt = $span.html(); 9622 $span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 9623 } else { 9624 txt = $('.marquee-original-core', $span).html(); 9625 } 9626 9627 var spanW, 9628 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 9629 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 9630 speed = 10 - dataSpeed; 9631 9632 $span.prepend($prepended); 9633 $span.append($appended); 9634 9635 var continuousTextMarquee = function () { 9636 var bound = $title 9637 .css({ 9638 transform: "none", 9639 opacity: 0, 9640 }) 9641 .offset(), 9642 ease = "none"; 9643 9644 var xStrt = 9645 first || $title.hasClass("un-marquee-infinite") 9646 ? 0 9647 : UNCODE.wwidth - bound.left, 9648 xEnd = $title.hasClass("un-marquee-infinite") 9649 ? spanW 9650 : spanW + bound.left, 9651 xSpeed = 9652 ((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) * 9653 dataSpeed, 9654 direction = $title.hasClass("un-marquee-opposite") ? 1 : -1, 9655 speedSlow = (xEnd + xStrt) / 45, 9656 transFormVal, 9657 translX; 9658 9659 marqueeTL = new TimelineMax({ paused: true, reversed: true }); 9660 marqueeTL.play(); 9661 9662 var inViewElement = 9663 dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0], 9664 wayOff = 9665 dataTrigger === "row" && dataNavBar === "yes" 9666 ? UNCODE.menuHeight 9667 : 0; 9668 9669 inview = new Waypoint.Inview({ 9670 element: inViewElement, 9671 offset: wayOff, 9672 enter: function (direction) { 9673 marqueeTL.play(); 9674 }, 9675 exited: function (direction) { 9676 if (!$title.closest(".pin-spacer").length) { 9677 marqueeTL.pause(); 9678 } 9679 }, 9680 }); 9681 9682 if ($title.hasClass("un-marquee-hover")) { 9683 var $column = $title.closest(".wpb_column"), 9684 $col_link = $(".col-link", $column), 9685 $hover_sel = $title; 9686 9687 if ($col_link.length) { 9688 $hover_sel = $title.add($column); 9689 } 9690 $hover_sel 9691 .on("mouseover", function () { 9692 ease = "power2.out";
9693 transFormVal = $title.css("transform").split(/[()]/)[1]; 9694 translX = transFormVal.split(",")[4]; 9695 speedSlow = (xEnd + (xStrt - translX)) / 45; 9696 marqueeTL.duration(speedSlow); 9697 }) 9698 .on("mouseout", function () { 9699 ease = "power2.in"; 9700 transFormVal = $title.css("transform").split(/[()]/)[1]; 9701 translX = transFormVal.split(",")[4]; 9702 speedSlow = 9703 ((xEnd + (xStrt - translX)) / 9704 (dataSpeed * dataSpeed * dataSpeed) / 9705 5) * 9706 dataSpeed; 9707 marqueeTL.duration(speedSlow); 9708 }); 9709 } 9710 9711 gsap.killTweensOf($title); 9712 marqueeTL.fromTo( $title, { 9713 opacity: 1, 9714 x: xStrt * direction * -1 9715 }, 9716 { 9717 duration: xSpeed, 9718 x: xEnd * direction, 9719 onComplete: function(){ 9720 first = false; 9721 continuousTextMarquee(); 9722 }, 9723 onUpdate: function(){ 9724 if ( ! $title[0].isConnected ) { 9725 marqueeTL.kill(); 9726 initTextMarquee(); 9727 } 9728 }, 9729 ease: ease 9730 }); 9731 9732 }; 9733 9734 var runTextMarquee = function(){ 9735 var time = Date.now(); 9736 9737 var textMarqueeScroll = function(){ 9738 var $row = $title.closest('.vc_row'); 9739 if ( hasSticky ) { 9740 $row = $title.closest('.sticky-trigger, .sticky-element').parent(); 9741 } 9742 var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title; 9743 9744 if ( !$bound.length ) { 9745 return; 9746 } 9747 9748 var bound = $bound[0].getBoundingClientRect(), 9749 wait = 100, 9750 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1, 9751 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 9752 9753 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 9754 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 9755 marqueeAttempts < 2 ) { 9756 9757 clearRequestTimeout(marqueeTO); 9758 9759 marqueeTO = requestTimeout(function(){ 9760 marqueeAttempts++; 9761 initTextMarquee(); 9762 }, 100); 9763 } 9764 9765 9766 var bound_top = bound.top, 9767 gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction; 9768 9769 if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) { 9770 if ( dataTrigger === 'row-middle' ) { 9771 bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5) 9772 } 9773 if ( dataNavBar === 'yes' ) { 9774 bound_top = bound_top - UNCODE.menuHeight; 9775 } 9776 gsap_calc = ( bound_top * dataMove ) * 0.5 * direction; 9777 } 9778 9779 gsap.killTweensOf($title); 9780 gsap.to( $title, { 9781 duration: 0.24, 9782 x: gsap_calc, 9783 }); 9784 }; 9785 9786 textMarqueeScroll(); 9787 $(window).on( 'load scroll', function(e) { 9788 textMarqueeScroll(); 9789 }); 9790 9791 }; 9792 9793 var cloneSpan = function($_title, cntnt){ 9794 9795 if ( $_title.hasClass('un-marquee-infinite') ) { 9796 $('> span.marquee-clone-wrap', $_title).text(''); 9797 } 9798 9799 gsap.to( $_title, { 9800 duration: 0, 9801 x: 0 9802 }); 9803 spanW = $span.outerWidth(); 9804 9805 if ( !spanW ) { 9806 return; 9807 } 9808 9809 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2, 9810 spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0"; 9811 9812 if ( $_title.hasClass('un-marquee-infinite') ) { 9813 9814 for ( var i = 0; i < part; i++ ) { 9815 $prepended.append(cntnt + spaceSpan); 9816 $appended.append(cntnt + spaceSpan); 9817 } 9818 } 9819 9820 if ( $('body').hasClass('compose-mode') ) { 9821 $('.uncode_fe_safe').remove(); 9822 return; 9823 } 9824 9825 if ( $title.closest('.marquee-freezed').length ) { 9826 return; 9827 } 9828 9829 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 9830 continuousTextMarquee(); 9831 } 9832 9833 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 9834 runTextMarquee(); 9835 } 9836 9837 }; 9838 9839 var marqueeResize = function(e){ 9840 clearRequestTimeout(marqueeCheckResize); 9841 marqueeCheckResize = requestTimeout(function(){ 9842 if ( newW !== UNCODE.wwidth ) { 9843 gsap.killTweensOf($title); 9844 if ( typeof inview !== 'undefined' && inview !== null ) { 9845 inview.destroy(); 9846 } 9847 if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) { 9848 marqueeTL.kill(); 9849 } 9850 first = true; 9851 initTextMarquee(); 9852 newW = UNCODE.wwidth; 9853 } 9854 }, 1000); 9855 }; 9856 9857 $(window).off('resize', marqueeResize) 9858 .on( 'resize', marqueeResize); 9859 $(window).off('uncode.re-layout', marqueeResize) 9860 .on( 'uncode.re-layout', marqueeResize); 9861 9862 cloneSpan($title, txt); 9863 9864 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9865 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 9866 var $_titles = $('.un-text-marquee',e.view.$el); 9867 clearRequestTimeout(marqueeCheckResize); 9868 marqueeCheckResize = requestTimeout(function(){ 9869 initTextMarquee($_titles); 9870 }, 1000); 9871 }); 9872 } 9873 }); 9874 9875 $(window).on( 'load wwResize', function(e) { 9876 stableHeight = UNCODE.wheight; 9877 }); 9878 9879 }; 9880 9881 document.addEventListener("DOMContentLoaded", function() { 9882 if ( isInitMarque !== true ) { 9883 initTextMarquee(); 9884 } 9885 }); 9886 9887 $(window).on('focus load resize',function(){ 9888 clearTimeout(initMarquee); 9889 initMarquee = setTimeout(function(){ 9890 if ( isInitMarque !== true ) { 9891 initTextMarquee(); 9892 } 9893 }, 500); 9894 }); 9895 9896 $(document).on('pumAfterOpen pumAfterClose', function(args){ 9897 initTextMarquee(); 9898 }); 9899 9900}; 9901 9902UNCODE.parallax = function() { 9903 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 9904 if ($('.parallax-el').length > 0) { 9905 var parallax_elements = new Rellax('.parallax-el'); 9906 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 9907 window.addEventListener('boxResized', function(e) { 9908 parallax_elements.refresh(); 9909 }, false); 9910 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 9911 requestTimeout(function() { 9912 parallax_elements.refresh(); 9913 }, 100); 9914 }); 9915 9916 if ( typeof UNCODE.hDoc === 'undefined' ) { 9917 UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9918 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9919 } 9920 9921 function paralraf(time) { 9922 requestAnimationFrame(paralraf) 9923 9924 var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9925 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9926 9927 if ( UNCODE.hDoc !== newHdoc ) { 9928 UNCODE.hDoc = newHdoc; 9929 parallax_elements.refresh(); 9930 } 9931 } 9932 9933 requestAnimationFrame(paralraf) 9934 9935 } 9936 } 9937}; 9938 9939UNCODE.magicCursor = function(){ 9940 var $customCursor = $('#uncode-custom-cursor'), 9941 $customPilot = $('#uncode-custom-cursor-pilot'), 9942 $tooltip = $('.title-tooltip', $customCursor),
9943 $cursorSpan = $('> span', $tooltip), 9944 currentBg = false, 9945 fromTitle = false, 9946 setTime, 9947 mouseEvent; 9948 9949 var spanW, spanH, 9950 maxW = false; 9951 9952 function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){ 9953 if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) { 9954 $tooltip.css({opacity: 0}); 9955 delayt_time += 400; 9956 } 9957 clearRequestTimeout(setTime); 9958 setTime = requestTimeout(function() { 9959 9960 $tooltip.css({opacity: ''}); 9961 9962 $customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing'); 9963 9964 if ( cursorTitle !== '' ) { 9965 if ( fromTitle && dataTitle === 'boing' ) { 9966 setTimeout(function(){ 9967 $customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing'); 9968 }, 5); 9969 } 9970 $cursorSpan.attr('class', fontClass).html( cursorTitle ); 9971 } else { 9972 if ( cursorType !== 'auto' ) { 9973 $cursorSpan.html(''); 9974 } 9975 } 9976 9977 $cursorSpan.addClass('in-tooltip'); 9978 9979 $customCursor.attr('data-cursor', cursorType); 9980 9981 if ( fromTitle ) { 9982 $customCursor.addClass('from-tooltip-title'); 9983 } else { 9984 $customCursor.removeClass('from-tooltip-title'); 9985 } 9986 9987 if ( cursorBg !== false ) { 9988 $customCursor.attr('data-bg', 'transparent'); 9989 } else { 9990 $customCursor.removeAttr('data-bg'); 9991 } 9992 9993 currentBg = cursorBg; 9994 9995 if ( cursorTitle !== '' ) { 9996 fromTitle = true; 9997 $customCursor.attr('data-cursor', cursorType); 9998 $customCursor.attr('data-title', 'true'); 9999 $cursorSpan.css({width: ''}); 10000 } else { 10001 fromTitle = false; 10002 $customCursor.removeAttr('data-title'); 10003 } 10004 spanW = $cursorSpan.outerWidth(); 10005 10006 if ( spanW >= maxW && maxW !== false ) { 10007 $customCursor.find('> span:first-child').add($tooltip).addClass('max-width'); 10008 $customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({ 10009 width: maxW 10010 }); 10011 spanW = maxW; 10012 } else { 10013 $customCursor.find('> span:first-child').removeClass('max-width'); 10014 } 10015 spanH = $cursorSpan.outerHeight(); 10016 if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) { 10017 $customCursor.find('> span:first-child').add($tooltip).css({ 10018 width: spanW, 10019 height: spanH 10020 }); 10021 } else { 10022 $customCursor.find('> span:first-child').add($tooltip).removeAttr("style"); 10023 } 10024 if ( $customPilot.length ) { 10025 $customPilot.attr('data-cursor', cursorType); 10026 } 10027 }, delayt_time); 10028 } 10029 10030 function changeCursor($wrap){ 10031 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 10032 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 10033 $href = $wrap.find(href), 10034 cursorType, 10035 cursorTitle = '', 10036 tooltip_class = '', 10037 cursorBg = false; 10038 10039 $wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) { 10040 var $this = $(this).addClass("cursor-init"), 10041 $tmb = $this.closest('.tmb'), 10042 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 10043 cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'), 10044 data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'), 10045 data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'), 10046 custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')), 10047 $title = $('.t-entry-title', $tmb), 10048 is_frontend_editor = $this.closest('.vc_controls').length, 10049 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 10050 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 10051 10052 if ( is_frontend_editor ) { 10053 cursorType = 'auto'; 10054 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 10055 cursorType = data_cursor; 10056 } else if ( $parent_cursor.length ) { 10057 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 10058 cursorType = 'icon-light'; 10059 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 10060 cursorType = 'icon-diff'; 10061 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 10062 cursorType = 'icon-accent'; 10063 } else { 10064 cursorType = 'icon-dark'; 10065 } 10066 } else { 10067 cursorType = 'pointer'; 10068 } 10069 10070 if ( typeof data_title !== 'undefined' && data_title !== '' ) { 10071 if ( typeof custom_text !== 'undefined' && custom_text !== '' ) { 10072 cursorTitle = custom_text; 10073 } else { 10074 cursorTitle = $title.clone(); 10075 $('a', cursorTitle).replaceWith(function() { 10076 return this.childNodes; 10077 }); 10078 $('*', cursorTitle).replaceWith(function(){ 10079 return $(this).removeAttr('class'); 10080 });
10081 cursorTitle = cursorTitle.html(); 10082 } 10083 } else { 10084 cursorTitle = ''; 10085 } 10086 10087 if ( typeof data_class !== 'undefined' && data_class !== '' ) { 10088 tooltip_class = data_class; 10089 } else { 10090 tooltip_class = ''; 10091 } 10092 10093 if ( cursor_bg == 'true' ) { 10094 cursorBg = true; 10095 } else { 10096 cursorBg = false; 10097 } 10098 10099 delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class); 10100 }).on("mouseleave.cursor", href, function(e) { 10101 var outTime = 150; 10102 if ( currentBg !== false && cursorBg === false ) { 10103 outTime = 0; 10104 } 10105 delayChangeCursor('auto', '', false, outTime, false, ''); 10106 }); 10107 10108 $(window).on('disable-hover', function(event) { 10109 document.addEventListener("mousemove", function(e) { 10110 mouseEvent = e; 10111 }); 10112 delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, ''); 10113 }); 10114 10115 $(window).on('enable-hover', function(event) { 10116 if ( typeof mouseEvent !== 'undefined' ) { 10117 var x = mouseEvent.clientX, 10118 y = mouseEvent.clientY; 10119 10120 var elements = document.elementsFromPoint(x, y), 10121 $element = $(elements[0]); 10122 10123 $element.closest(href).trigger('mouseenter'); 10124 } 10125 }); 10126 10127 } 10128 10129 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10130 changeCursor(); 10131 }); 10132 10133 $(document).ajaxComplete(function( event, xhr, settings ) { 10134 changeCursor(); 10135 }); 10136 10137 $('.isotope-container').on('isotope-layout-complete', function() { 10138 var $this = $(this); 10139 changeCursor($this); 10140 }); 10141 10142}; 10143 10144UNCODE.magneticCursor = function(){ 10145 function magneticCursor($wrap){ 10146 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 10147 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')); 10148 10149 $magnetics.on('mousemove', function(e){ 10150 var $this = $(this), 10151 $el, 10152 bound = e.currentTarget.getBoundingClientRect(), 10153 coeff = 30, 10154 hor = (bound.width / 2) - (e.clientX - bound.left), 10155 ver = (bound.height / 2) - (e.clientY - bound.top), 10156 toX = hor / bound.width * coeff, 10157 toY = ver / bound.height * coeff, 10158 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 10159 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 10160 toScale = Math.max(scaleX, scaleY); 10161 10162 if ( $this.hasClass('magnetic') ) { 10163 $el = $('.background-inner, .header-bg', $this); 10164 } else { 10165 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10166 } 10167 10168 gsap.killTweensOf($el); 10169 gsap.to( $el, { 10170 duration: 0.75, 10171 x: toX, 10172 y: toY, 10173 scale: toScale, 10174 ease: Power1.easeOut, 10175 transformPerspective: 900, 10176 transformOrigin: 'center', 10177 force3D: true 10178 }); 10179 }).on('mouseout', function(e){ 10180 var $this = $(this), 10181 $el 10182 if ( $this.hasClass('magnetic') ) { 10183 $el = $('.background-inner, .header-bg', $this); 10184 } else { 10185 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10186 } 10187 gsap.killTweensOf($el); 10188 gsap.to( $el, { 10189 duration: 0.6, 10190 y: 0, 10191 x: 0, 10192 scale: 1, 10193 ease: Power1.easeOut, 10194 transformPerspective: 900, 10195 transformOrigin: 'center', 10196 force3D: true 10197 }); 10198 }); 10199 }; 10200 10201 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10202 magneticCursor(); 10203 }); 10204 10205 $(document).ajaxComplete(function( event, xhr, settings ) { 10206 magneticCursor(); 10207 }); 10208 10209 $('.isotope-container').on('isotope-layout-complete', function() { 10210 var $this = $(this); 10211 magneticCursor($this); 10212 }); 10213 10214}; 10215 10216UNCODE.dropImage = function() { 10217 10218 /**************************** 10219 * Image hover * 10220 ****************************/ 10221 function imageHover(){ 10222 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10223 return; 10224 } 10225 10226 var $postLists = $('.uncode-post-titles'); 10227 $postLists.each(function(){ 10228 var $list = $(this), 10229 timing = parseFloat( $list.attr('data-timing') ), 10230 default_image = $list.hasClass('uncode-post-titles-default-image'), 10231 default_title = $list.hasClass('uncode-post-titles-default-title'), 10232 $tmbs = $('.tmb', $list), 10233 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 10234 clientX, 10235 clientY, 10236 $row_parent = $list.closest('.vc_row'), 10237 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 10238 $col_parent = $list.closest('.uncell'), 10239 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 10240 stoppedScrolling = true, 10241 setCTA; 10242 10243 timing *= 0.001; 10244 10245 var drop_bgs = function(){ 10246 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 10247 var $drop = $(this), 10248 srcset = $drop.attr('data-bgset'), 10249 setArr = srcset.split(","), 10250 setArrOrder = [], 10251 biggest = 0, 10252 checkBg = false, 10253 desktopBG = $drop.data('[data-background-image]'), 10254 mobileBG = $drop.data('[data-mobile-background-image]'); 10255 10256 if ( $drop.hasClass('srcset-bg-async') ) { 10257 10258 if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) { 10259 return; 10260 } 10261 10262 } 10263 10264 if ( SiteParameters.uncode_adaptive == true ) { 10265 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 10266 $drop.css({ 10267 'background-image' : 'url(' + setArr[0] + ')' 10268 }); 10269 } 10270 } else { 10271 for ( var i = 0; i < setArr.length; i++ ) { 10272 var setLoop = setArr[i].trim().split(" ");
10273 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 10274 var parseSet = parseFloat(setLoop[1]); 10275 if ( biggest < parseSet ) { 10276 biggest = parseSet; 10277 } 10278 setArrOrder[parseSet] = setLoop[0]; 10279 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 10280 checkBg = true; 10281 $drop.css({ 10282 'background-image' : 'url(' + setLoop[0] + ')' 10283 }); 10284 } 10285 } 10286 } 10287 10288 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 10289 $drop.css({ 10290 'background-image' : 'url(' + setArrOrder[biggest] + ')' 10291 }); 10292 } 10293 } 10294 10295 }); 10296 }; 10297 10298 drop_bgs(); 10299 10300 var dropMovesSize = function(){ 10301 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 10302 return; 10303 } 10304 $drop_moves.each(function(){ 10305 var $drop_move = $(this), 10306 dataW = $drop_move.attr('data-w'), 10307 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 10308 if ( typeof dataW !== 'undefined' && dataW !== null ) { 10309 dataW = screenInfo.width / 12 * parseFloat( dataW ); 10310 } 10311 $drop_moves.css({ 10312 width: dataW 10313 }); 10314 10315 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10316 $anim_parent.on('animationend', function(){ 10317 var bound = $anim_parent[0].getBoundingClientRect(); 10318 $drop_move.css({ 10319 left: bound.x * -1, 10320 top: bound.y * -1, 10321 }); 10322 }); 10323 } 10324 }); 10325 10326 10327 }; 10328 10329 dropMovesSize(); 10330 10331 $(window).on( 'resize', function(){ 10332 clearRequestTimeout(setCTA); 10333 setCTA = requestTimeout( function() { 10334 drop_bgs(); 10335 dropMovesSize(); 10336 }, 100 ); 10337 }); 10338 10339 if ( $drop_row_parents.length ) { 10340 $row_parent.addClass( 'drop-added' ); 10341 } 10342 10343 $drop_row_parents.each(function(index, val){ 10344 var $drop = $(val); 10345 $row_parent.prepend($drop); 10346 manageVideos($drop, false); 10347 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10348 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10349 } 10350 if ( default_image && index == 0 ) { 10351 manageVideos($drop, true); 10352 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10353 image_ph = new Image(); 10354 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10355 image_ph.onload = function() { 10356 $drop.addClass('active'); 10357 if ( default_title ) { 10358 $list.addClass('drop-hover'); 10359 $tmbs.first().addClass('drop-active'); 10360 } 10361 }; 10362 image_ph.src = bg_img; 10363 } 10364 } 10365 }); 10366 10367 if ( $drop_col_parents.length ) { 10368 $col_parent.addClass( 'drop-added' ); 10369 } 10370 10371 $drop_col_parents.each(function(index, val){ 10372 var $drop = $(this); 10373 $col_parent.prepend($drop); 10374 manageVideos($drop, false); 10375 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10376 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10377 } 10378 if ( default_image && index == 0 ) { 10379 manageVideos($drop, true); 10380 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10381 image_ph = new Image(); 10382 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10383 image_ph.onload = function() { 10384 $drop.addClass('active'); 10385 if ( default_title ) { 10386 $list.addClass('drop-hover'); 10387 $tmbs.first().addClass('drop-active'); 10388 } 10389 }; 10390 image_ph.src = bg_img; 10391 } 10392 } 10393 }); 10394 10395 function manageVideos( $el, start ) { 10396 var videoElem = $('video', $el), 10397 $iframe = $('iframe', $el), 10398 iframeID = $iframe.attr('id'); 10399 if ( videoElem.length ) { 10400 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 10401 if ( start ) { 10402 videoElem[0].setCurrentTime(0); 10403 videoElem[0].play(); 10404 } else { 10405 videoElem[0].pause(); 10406 videoElem[0].setCurrentTime(0); 10407 } 10408 } else { 10409 if ( start ) { 10410 videoElem[0].currentTime = 0; 10411 videoElem[0].play(); 10412 } else { 10413 videoElem[0].pause(); 10414 videoElem[0].currentTime = 0; 10415 } 10416 } 10417 } 10418 10419 $el.data('active', start); 10420 10421 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 10422 var iframeIDv = iframeID.replace('okplayer-', ''), 10423 optionsV = $(window).data('okoptions-' + iframeIDv), 10424 vimeo = $iframe[0], 10425 playerV = new Vimeo.Player(vimeo), 10426 timeV = 0; 10427 10428 if (optionsV.time != null) { 10429 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 10430 for ( var i = 0; i < timeArr.length; i++ ) { 10431 if ( timeArr[i] === 'h' ) { 10432 timeV += parseFloat(timeArr[i-1]) * 3600; 10433 } else if ( timeArr[i] === 'm' ) { 10434 timeV += parseFloat(timeArr[i-1]) * 60; 10435 } else if ( timeArr[i] === 's' ) { 10436 timeV += parseFloat(timeArr[i-1]); 10437 } 10438 } 10439 } 10440 playerV.setCurrentTime(timeV); 10441 if ( start ) { 10442 playerV.setVolume(0); 10443 playerV.play(); 10444 } else { 10445 playerV.pause(); 10446 } 10447 } else if ( $el.attr('data-provider') === 'youtube' ) { 10448 if ( start ) { 10449 $el.trigger('uncode-resume'); 10450 } else { 10451 $el.trigger('uncode-pause'); 10452 } 10453 } 10454 10455 } 10456 10457 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10458 10459 document.addEventListener("mousemove", function(e) { 10460 $drop_moves.each(function(){ 10461 var $drop_move = $(this), 10462 duration = 0.4; 10463 10464 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 10465 duration = 0.8; 10466 } 10467 10468 clientX = e.clientX; 10469 clientY = e.clientY; 10470 10471 gsap.to( $drop_move, { 10472 duration: duration, 10473 x: clientX, 10474 y: clientY, 10475 ease: Power1.easeOut, 10476 }); 10477 }); 10478 }); 10479 10480 } else { 10481 10482 $(window).on("touchend scroll", function(e) { 10483 $list.removeClass('drop-hover'); 10484 $drop_moves.removeClass('active'); 10485 $tmbs.removeClass('drop-active'); 10486 }); 10487 10488 $drop_moves.each(function(){ 10489 var $drop_move = $(this), 10490 $tmb = $drop_move.closest('.tmb'), 10491 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 10492 10493 if ( $anim_parent.hasClass('uncode-skew') ) { 10494 $anim_parent.css({ 10495 'transform': 'skew(0)' 10496 }); 10497 } 10498 10499 $tmb.on('touchend', function(e){ 10500 e.stopPropagation(); 10501 10502 $drop_moves.removeClass('active'); 10503 $tmbs.removeClass('drop-active'); 10504 10505 $list.addClass('drop-hover'); 10506 $tmb.addClass('drop-active'); 10507 $drop_move.addClass('active'); 10508 manageVideos($drop_move, true); 10509 clientX = e.changedTouches[0].clientX; 10510 clientY = e.changedTouches[0].clientY; 10511 10512 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10513 var bound = $anim_parent[0].getBoundingClientRect(); 10514 clientX = clientX - bound.x; 10515 clientY = clientY - bound.y; 10516 } 10517 10518 $drop_move.css({ 10519 left: clientX, 10520 top: clientY 10521 }); 10522 }); 10523 }); 10524 10525 } 10526 10527 $tmbs.each(function(e){ 10528 var $tmb = $(this), 10529 // $trgr = $('a', $tmb), 10530 $trgr = $tmb, 10531 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 10532 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10532(.t-inside), .parallax-el'), 10533 $video = $('video', $tmb), 10534 $iframe = $('iframe', $tmb), 10535 $entryTxt = $('.t-entry-text', $tmb), 10536 stopBounding; 10537 10538 $entryTxt.add($drop_move).css({ 10539 'transition-duration': timing + 's' 10540 }); 10541 10542 if ( $video.length ) { 10543 var vidH = $video[0].videoHeight, 10544 vidW = $video[0].videoWidth; 10545 $video.css({ 10546 'height': vidH, 10547 'width': vidW 10548 }); 10549 } 10550 10551 if ( $iframe.length ) { 10552 var vidH = $drop_move.attr('data-height'), 10553 vidW = $drop_move.attr('data-width'); 10554 $iframe.css({ 10555 'height': vidH, 10556 'width': vidW 10557 }); 10558 } 10559 10560 $iframe.each(function(){ 10561 var $video = $(this), 10562 vidH = $video[0].videoHeight, 10563 vidW = $video[0].videoWidth; 10564 $video.css({ 10565 'height': vidH, 10566 'width': vidW 10567 }); 10568 }); 10569 10570 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10571 $trgr.on('mouseenter',function(e){ 10572 10573 $list.addClass('drop-hover'); 10574 $tmbs.removeClass('drop-active'); 10575 $tmb.addClass('drop-active'); 10576 $drop_move.addClass('active'); 10577 manageVideos($drop_move, true); 10578 10579 var clientX = e.clientX, 10580 clientY = e.clientY; 10581 $drop_move.css({ 10582 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 10583 }); 10584 10585 }) 10586 .on('mouseleave', function(e){ 10587 $list.removeClass('drop-hover'); 10588 $drop_move.css({ 10589 'transition-duration': ( timing*1.25 ) + 's' 10590 }); 10591 $drop_move.removeClass('active'); 10592 $tmb.removeClass('drop-active'); 10593 $drop_move.on('transitionend', function(e){ 10594 $drop_move.off('transitionend'); 10595 $drop_move.css({ 10596 'transition-duration': timing + 's' 10597 }); 10598 manageVideos($drop_move,false); 10599 }); 10600 }); 10601 10602 document.addEventListener('visibilitychange', function(){ 10603 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 10604 $drop_move.css({ 10605 'transition-duration': '0s' 10606 }); 10607 $drop_move.removeClass('active'); 10608 manageVideos($drop_move, false); 10609 } 10610 }); 10611 10612 document.addEventListener('scroll', function(){ 10613 window.clearRequestTimeout( stopBounding ); 10614 if ( stoppedScrolling ) { 10615 stoppedScrolling = false; 10616 if ( $drop_move.hasClass('active') ) { 10617 $list.removeClass('drop-hover'); 10618 $tmbs.removeClass('drop-active'); 10619 $drop_move.removeClass('active'); 10620 $drop_move.on('transitionend', function(e){ 10621 $drop_move.off('transitionend'); 10622 $drop_move.css({ 10623 'transition-duration': timing + 's' 10624 }); 10625 manageVideos($drop_move,false); 10626 }); 10627 } 10628 } 10629 10630 stopBounding = requestTimeout(function() { 10631 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10632 var bound = $anim_parent[0].getBoundingClientRect(); 10633 $drop_move.css({ 10634 left: bound.x * -1, 10635 top: bound.y * -1, 10636 }); 10637 } 10638 stoppedScrolling = true; 10639 }, 500); 10640 }); 10641 } 10642 10643 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 10644 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 10645 10646 $drop.css({ 10647 'transition-duration': timing + 's' 10648 }); 10649 10650 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 10651 $trgr.on('mouseenter',function(e){ 10652 $row_parent.add($col_parent).addClass('drop-list-loaded'); 10653 $list.addClass('drop-hover'); 10654 10655 if ( !$tmb.hasClass('drop-active') ) { 10656 $tmbs.removeClass('drop-active'); 10657 $tmb.addClass('drop-active'); 10658 if ( default_image && !$drop.hasClass('active') ) { 10659 var $prev = $('[data-drop].active', $row_parent); 10660 $prev.css({ 10661 'transition-duration': (timing*1.5) + 's' 10662 }); 10663 $prev.removeClass('active'); 10664 $prev.on('transitionend', function(e){ 10665 $prev.off('transitionend'); 10666 manageVideos($prev,false); 10667 }); 10668 } 10669 $drop.css({ 10670 'transition-duration': timing + 's' 10671 }); 10672 $drop.off('transitionend'); 10673 $drop.addClass('active'); 10674 manageVideos($drop, true); 10675 } 10676 }) 10677 .on('mouseleave', function(e){ 10678 if ( ( default_image && !default_title ) || !default_image ) { 10679 $list.removeClass('drop-hover'); 10680 $tmb.removeClass('drop-active'); 10681 } 10682 if ( ! default_image ) { 10683 $drop.css({ 10684 'transition-duration': (timing*1.5) + 's' 10685 }); 10686 $drop.removeClass('active'); 10687 10688 $drop.on('transitionend', function(e){ 10689 $drop.off('transitionend'); 10690 manageVideos($drop,false); 10691 }); 10692 } 10693 }); 10694 10695 document.addEventListener('visibilitychange', function(){ 10696 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 10697 $drop.css({ 10698 'transition-duration': '0s' 10699 }); 10700 $drop.removeClass('active'); 10701 manageVideos($drop, false); 10702 } 10703 }); 10704 } 10705 }); 10706 10707 }); 10708 }; 10709 10710 $(window).on('load', function(event) { 10711 imageHover(); 10712 }); 10713 10714 var drop_wp_animation = function() { 10715 var $postLists = $('.uncode-post-titles'); 10716 $postLists.each(function(){ 10717 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10718 new Waypoint({ 10719 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10720 element: val, 10721 handler: function() { 10722 var element = $(this.element), 10723 parent = element.closest('.tmb'), 10724 currentIndex = parent.index(),
10725 delay = currentIndex, 10726 delayAttr = parseInt(element.attr('data-delay')); 10727 if (isNaN(delayAttr)) delayAttr = 100; 10728 var objTimeout = requestTimeout(function() { 10729 element.addClass('start_animation'); 10730 10731 var nextTimeout = requestTimeout(function() { 10732 $('.drop-image-separator', parent).addClass('start_animation'); 10733 }, 50); 10734 10735 }, delay * delayAttr); 10736 if (!UNCODE.isUnmodalOpen) { 10737 this.destroy(); 10738 } 10739 }, 10740 offset: UNCODE.isFullPage ? '100%' : '90%' 10741 }) 10742 }); 10743 }); 10744 } 10745 10746 var runWaypoints_TO, 10747 runWaypoints_delay = 0; 10748 10749 var runWaypoints = function(){ 10750 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10751 runWaypoints_delay = 400; 10752 } 10753 clearRequestTimeout(runWaypoints_TO); 10754 runWaypoints_TO = requestTimeout(function() { 10755 drop_wp_animation(); 10756 }, runWaypoints_delay); 10757 }; 10758 runWaypoints(); 10759 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10760 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10761 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10762 // imageHover(); 10763 runWaypoints(); 10764 }); 10765 } 10766}; 10767 10768UNCODE.postTable = function() { 10769 10770 var clickRow = function(){ 10771 var $postLists = $('.uncode-post-table'); 10772 10773 $postLists.each(function(){ 10774 var $postList = $(this), 10775 $tmbClicks = $('.tmb.tmb-click-row', $postList); 10776 10777 $tmbClicks.each(function(){ 10778 var $tmb = $(this), 10779 $click = $('.table-click-row', $tmb); 10780 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 10781 e.preventDefault(); 10782 e.stopPropagation(); 10783 $click[0].click(); 10784 return false; 10785 }); 10786 }); 10787 10788 }) 10789 }; 10790 10791 clickRow(); 10792 10793 var hoverRow = function(){ 10794 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 10795 10796 $postLists.on('mouseenter', function(){ 10797 $(this).addClass('post-table-hover'); 10798 }); 10799 $postLists.on('mouseleave', function(){ 10800 $(this).removeClass('post-table-hover'); 10801 }); 10802 } 10803 10804 hoverRow(); 10805 10806 var drop_wp_animation = function() { 10807 var $postLists = $('.uncode-post-table'); 10808 $postLists.each(function(){ 10809 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10810 new Waypoint({ 10811 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10812 element: val, 10813 handler: function() { 10814 var element = $(this.element), 10815 parent = element.closest('.tmb'), 10816 currentIndex = parent.index(), 10817 delay = currentIndex, 10818 delayAttr = parseInt(element.attr('data-delay')); 10819 if (isNaN(delayAttr)) delayAttr = 100; 10820 var objTimeout = requestTimeout(function() { 10821 element.addClass('start_animation'); 10822 }, delay * delayAttr); 10823 if (!UNCODE.isUnmodalOpen) { 10824 this.destroy(); 10825 } 10826 }, 10827 offset: UNCODE.isFullPage ? '100%' : '90%' 10828 }) 10829 }); 10830 }); 10831 } 10832 10833 var runWaypoints_TO, 10834 runWaypoints_delay = 0; 10835 10836 var runWaypoints = function(){ 10837 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10838 runWaypoints_delay = 400; 10839 } 10840 clearRequestTimeout(runWaypoints_TO); 10841 runWaypoints_TO = requestTimeout(function() { 10842 drop_wp_animation(); 10843 }, runWaypoints_delay); 10844 }; 10845 runWaypoints(); 10846 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10847 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10848 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10849 runWaypoints(); 10850 // clickRow(); 10851 }); 10852 } 10853}; 10854 10855UNCODE.rotatingTxt = function($ctxt) { 10856 10857 if ( $('body').hasClass('compose-mode') ) { 10858 return; 10859 } 10860 10861 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 10862 var setCTA; 10863 10864 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 10865 var $heading = $(this), 10866 // debug = 0, 10867 cycle = 0, 10868 $trgt, 10869 $toMove, 10870 $highl, 10871 $col = $heading.closest('.uncont'), 10872 txt, 10873 arrTxt, 10874 textFadeIn, textFadeOut, 10875 removeWraps; 10876 10877 var defineObjs = function() { 10878 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 10879 var $rtx = $(this), 10880 fx = $rtx.attr('data-fx'), 10881 wait = $rtx.attr('data-wait'), 10882 $prev = $(this).prev().addClass('prev-rotating-start'), 10883 splitToMove = [], 10884 splitArray = [], 10885 lineArray = [], 10886 lineIndex = 0, 10887 lineStart = true, 10888 lineEnd = false, 10889 startSplit = false, 10890 $line_wrap = $rtx.closest('.heading-line-wrap'), 10891 same_line = true, 10892 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 10893 indexRtx = $splits.index($rtx); 10894 10895 fx = typeof fx === 'undefined' ? '' : fx;
10896 wait = typeof wait === 'undefined' ? '' : wait; 10897 10898 $splits.each(function(key, val){ 10899 var $split = $(this), 10900 $new_line_wrap = $split.closest('.heading-line-wrap'); 10901 10902 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 10903 splitArray.push( $split ); 10904 } 10905 10906 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10907 startSplit = false; 10908 } 10909 10910 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10911 splitArray.push( $split ); 10912 10913 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 10914 same_line = true; 10915 } else { 10916 same_line = false; 10917 } 10918 } 10919 10920 if ( key == indexRtx ) { 10921 if ( /\S/.test($split.text()) ) { 10922 startSplit = true; 10923 $line_wrap = $split.closest('.heading-line-wrap'); 10924 splitArray.push( $split ); 10925 } else { 10926 indexRtx++; 10927 } 10928 } 10929 10930 $line_wrap = $new_line_wrap; 10931 }); 10932 10933 $toMove = $($.map(splitToMove, function(el){return el.get();})); 10934 $trgt = $($.map(splitArray, function(el){return el.get();})); 10935 10936 if ( same_line ) { 10937 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 10938 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 10939 } 10940 10941 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 10942 $prev.addClass('empty-span-hidden'); 10943 } 10944 10945 $highl = $('.heading-text-highlight-inner', $trgt); 10946 10947 $rtx.attr('data-animated', 'true'); 10948 if ( cycle == 0 ) { 10949 $( document.body ).trigger('defer-highlights'); 10950 cycle++; 10951 defineObjs(); 10952 return; 10953 } 10954 cycle++; 10955 10956 txt = $rtx.attr('data-text'); 10957 arrTxt = txt.split("|"); 10958 10959 textFadeOut($trgt); 10960 10961 }); 10962 }; 10963 10964 removeWraps = function(){ 10965 10966 // if ( debug == 1 ) return; 10967 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 10968 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 10969 10970 10971 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 10972 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 10973 10974 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 10975 10976 $splitFlow.each(function(){ 10977 $(this).append($temp_highl); 10978 }); 10979 10980 var $line_wrap = $wraps[wrap_k]; 10981 var $parent_wrap = $line_wrap.parentNode; 10982 if ( $parent_wrap !== null ) { 10983 while ( $line_wrap.firstChild ) { 10984 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 10985 } 10986 $parent_wrap.removeChild($line_wrap); 10987 } 10988 } 10989 // debug++; 10990 defineObjs(); 10991 }; 10992 10993 var loop = 0; 10994 textFadeIn = function($trgt){ 10995 var word = arrTxt[loop].split(" "), 10996 worsSpan = '', 10997 $wrap = $trgt.closest('.uncode-rotating-wrap'), 10998 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 10999 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 11000 11001 for (var w = 0; w < word.length; w++) { 11002 var highl; 11003 if ( $highl.length ) { 11004 highl = $highl[0].outerHTML; 11005 } else { 11006 highl = ''; 11007 } 11008 11009 if ( w > 0 ) { 11010 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 11011 } 11012 var charachters = word[w].split(''); 11013 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 11014 if ( ! SiteParameters.uncode_has_ligatures ) { 11015 for (var c = 0; c < charachters.length; c++) { 11016 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 11017 } 11018 } else { 11019 worsSpan += word[w]; 11020 } 11021 worsSpan += '</span>' + highl + '</span></span>'; 11022 } 11023 11024 if ( $wrap.length && $wrap_inner.length ) { 11025 var words_w = $wrap_inner.outerWidth(); 11026 $wrap.css({ 11027 width: words_w 11028 }); 11029 11030 $highl = $('.heading-text-highlight-inner', $wrap); 11031 $highl.prependTo($wrap); 11032 11033 $wrap_inner.css({ 11034 opacity: 0 11035 }); 11036 11037 $wrap_inner.html(worsSpan); 11038 $('.heading-text-highlight-inner', $wrap_inner).remove(); 11039 words_w = $wrap_inner.innerWidth(); 11040 11041 var duration = 0.45; 11042 11043 $heading.removeClass('auto-width'); 11044 if ( words_w > $col.width() ) { 11045 $heading.addClass('auto-width'); 11046 words_w = 'auto'; 11047 duration = 0; 11048 } 11049 11050 $wrap.css({ 11051 'width': words_w, 11052 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 11053 }); 11054 11055 var $word_inner = $('.split-word-inner', $wrap_inner), 11056 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 11057 11058 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11059 11060 if ( !$target_fx.length ) { 11061 return; 11062 } 11063 11064 gsap.killTweensOf($target_fx); 11065 11066 if ( fx !== 'zoom' ) { 11067 gsap.fromTo( $target_fx, { 11068 y: fx === 'opacity' ? '0%' : '-10%' 11069 },{ 11070 delay: duration, 11071 duration: 0.25, 11072 y: '0%', 11073 ease: Circ.easeOut, 11074 }); 11075 11076 if ( !$wrap_inner.length ) { 11077 return; 11078 } 11079 11080 gsap.fromTo( $wrap_inner, { 11081 opacity: 0, 11082 },{ 11083 delay: duration, 11084 duration: 0.25, 11085 opacity: 1, 11086 ease: Circ.easeOut, 11087 onComplete: function(){ 11088 $('> .heading-text-highlight-inner', $wrap).remove(); 11089 $wrap_inner.html(worsSpan); 11090 removeWraps(); 11091 } 11092 }) 11093 11094 } else { 11095 gsap.fromTo( $target_fx, { 11096 transformOrigin: '50%', 11097 opacity: 0, 11098 scale: 0.875, 11099 },{ 11100 opacity: 1, 11101 delay: duration, 11102 duration: 0.25, 11103 scale: 1, 11104 ease: Circ.easeOut, 11105 onComplete: function(){ 11106 $('> .heading-text-highlight-inner', $wrap).remove(); 11107 $wrap_inner.html(worsSpan); 11108 removeWraps(); 11109 } 11110 }); 11111 } 11112 11113 } else { 11114 11115 if ( !$wrap_inner.length ) { 11116 return; 11117 } 11118 11119 gsap.to( $wrap_inner, { 11120 duration: 0.4, 11121 opacity: 0, 11122 ease: Power1.easeOut, 11123 onComplete: function(){ 11124 $wrap_inner.html(worsSpan); 11125 words_w = $wrap_inner.innerWidth(); 11126 11127 gsap.to( $wrap_inner, { 11128 duration: 0.2, 11129 opacity: 1, 11130 ease: Power1.easeOut, 11131 onComplete: function(){ 11132 $('> .heading-text-highlight-inner', $wrap).remove(); 11133 $wrap_inner.html(worsSpan); 11134 removeWraps(); 11135 } 11136 }) 11137 } 11138 }); 11139 } 11140 11141 if ( loop < arrTxt.length-1 ) { 11142 loop++; 11143 } else { 11144 loop = 0; 11145 } 11146 11147 }; 11148 11149 textFadeOut = function($trgt){ 11150 var $word_inner = $('.split-word-inner', $trgt), 11151 $wrap = $trgt.closest('.uncode-rotating-wrap'), 11152 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 11153 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 11154 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 11155 11156 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 11157 11158 var gsap_param = { 11159 delay: wait, 11160 duration: 0.25, 11161 y: fx === '' ? '10%' : '0%', 11162 opacity: 0, 11163 ease: Circ.easeOut, 11164 onStart: function(){ 11165 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 11166 $highl = $('.heading-text-highlight-inner', $wrap); 11167 $highl.prependTo($wrap); 11168 } 11169 }, 11170 onComplete: textFadeIn, 11171 onCompleteParams: [$trgt] 11172 }; 11173 11174 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11175 11176 if ( fx === '' ) { 11177 gsap_param.y = '10%'; 11178 } else if ( fx === 'zoom' ) { 11179 gsap_param.scale = '1.045'; 11180 } 11181 11182 if ( !$target_fx.length ) { 11183 return; 11184 } 11185 11186 if ( $heading.data('waypoint') !== true ) { 11187 var textInView = new Waypoint.Inview({ 11188 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 11189 element: $heading[0], 11190 enter: function(direction) { 11191 $heading.data('waypoint',true); 11192 gsap.fromTo( $target_fx, { 11193 transformOrigin: '50%' 11194 }, gsap_param ); 11195 } 11196 }); 11197 } else { 11198 gsap.fromTo( $target_fx, { 11199 transformOrigin: '50%' 11200 }, gsap_param ); 11201 } 11202 }; 11203 11204 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 11205 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 11206 var $el = model.view.$el, 11207 shortcode = model.attributes.shortcode; 11208 11209 UNCODE.rotatingTxt($el); 11210 }); 11211 } else { 11212 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 11213 $heading.on('already-animated', function(){ 11214 removeWraps(); 11215 window.addEventListener('removeOldLines', function(){ 11216 clearRequestTimeout(setCTA); 11217 setCTA = requestTimeout( removeWraps, 150 ); 11218 }); 11219 }); 11220 } else { 11221 $(window).on('load', function(){ 11222 removeWraps(); 11223 window.addEventListener('removeOldLines', function(){ 11224 clearRequestTimeout(setCTA); 11225 setCTA = requestTimeout( removeWraps, 150 ); 11226 }); 11227 }); 11228 } 11229 } 11230 }); 11231 11232}; 11233 11234UNCODE.verticalText = function() { 11235 $(window).on('menuCanvasOpen', function(){ 11236 $('.vertical-text--fixed').fadeOut(500); 11237 $('.horizontal-text--fixed').fadeOut(500); 11238 }).on('menuCanvasClose', function(){ 11239 $('.vertical-text--fixed').fadeIn(500); 11240 $('.horizontal-text--fixed').fadeIn(500); 11241 }); 11242 11243 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 11244 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 11245 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 11246 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 11247 11248 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 11249 window.addEventListener('scroll', function(e) { 11250 var totalPageHeight = document.body.scrollHeight; 11251 var scrollPoint = window.scrollY + window.innerHeight; 11252 11253 if (window.scrollY > 0) { 11254 showOnTopVerticalTexts.fadeOut(); 11255 showOnTopHorizontalTexts.fadeOut(); 11256 } else { 11257 showOnTopVerticalTexts.fadeIn(); 11258 showOnTopHorizontalTexts.fadeIn(); 11259 } 11260 11261 if (scrollPoint >= totalPageHeight) { 11262 hideOnBottomVerticalTexts.fadeOut(); 11263 hideOnBottomHorizontalTexts.fadeOut(); 11264 } else { 11265 hideOnBottomVerticalTexts.fadeIn(); 11266 hideOnBottomHorizontalTexts.fadeIn(); 11267 } 11268 }, false); 11269 } 11270}; 11271 11272UNCODE.stickyScroll = function( $el ) { 11273 if ( typeof $el === 'undefined' || $el === null ) { 11274 $el = $('body'); 11275 } 11276 var checkVisible = function( el, dir ) { 11277 if (typeof jQuery === "function" && el instanceof jQuery) { 11278 el = el[0]; 11279 } 11280 11281 var off = 50; 11282 dir = typeof dir=='undefined' ? 'right' : dir; 11283 var rect = el.getBoundingClientRect(); 11284 11285 return ( 11286 ( 11287 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11288 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11289 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 11290 ) && 11291 ( 11292 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 11293 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 11294 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 11295 ( rect.right <= window.innerWidth && rect.left >= 0 ) 11296 ) 11297 ); 11298 }; 11299 11300 var setItemsRelHeight = function(reset) { 11301 var $_el = $el; 11302 if ( $el.is('.index-scroll') ) { 11303 var $_el = $el.closest('.uncont'); 11304 } 11305 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 11306 $.each($('.tmb', item), function(index, val) { 11307 if ( reset === true ) { 11308 $(val).css( 'visibility', 'hidden' ); 11309 } else { 11310 $(val).css( 'visibility', 'visible' ); 11311 } 11312 }); 11313 }); 11314 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 11315 $.each($('.tmb', item), function(index, val) { 11316 if ( reset === true ) { 11317 $(val).css( 'visibility', 'hidden' ); 11318 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 11319 } else { 11320 var $rowParent = $(item).closest('.row-parent'), 11321 rowRatio = $rowParent.attr('data-height-ratio'), 11322 $rowInner = $(item).closest('.row-child'), 11323 rowRatioInner = $rowInner.attr('data-height'), 11324 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11325 $colContainer = $(item).closest('.uncell'), 11326 $uncont = $(item).closest('.uncont'), 11327 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 11328 safe_heigth = $(item).data('safe-height'), 11329 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 11330 offSet = $(item).offset().top - $uncont.offset().top, 11331 multiplier_h, 11332 data_viewport_h, 11333 body_border = $('.body-borders .top-border').outerHeight() * 2, 11334 remove_menu = $(item).data('vp-menu'); 11335 11336 if ( rowRatio === 'full' || rowRatio === '' ) { 11337 rowRatio = 1; 11338 } else { 11339 rowRatio = rowRatio / 100; 11340 } 11341 11342 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 11343 rowRatio = rowRatio; 11344 } else { 11345 rowRatio = rowRatio * rowRatioInner / 100; 11346 } 11347 11348 winHeight = winHeight * rowRatio; 11349 11350 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 11351 multiplier_h = parseInt($(item).attr('data-vp-height')); 11352 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 11353 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 11354 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 11355 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 11356 } 11357 11358 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 11359 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 11360 if ( remove_menu === true ) { 11361 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 11362 } 11363 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 11364 } else { 11365 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 11366 } 11367 11368 } 11369 }); 11370 }); 11371 $('.index-scroll', $_el).each(function(i, item){ 11372 var $uncoltable = $(item).closest('.uncoltable'), 11373 $rowParent = $(item).closest('.row-parent'), 11374 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11375 body_border = $('.body-borders .top-border').outerHeight() * 2, 11376 $index_row = $('.index-row', item), 11377 safe_heigth = $index_row.data('safe-height'), 11378 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 11379 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 11380 var data_viewport_h = winHeight - ( paddingRow + body_border ); 11381 $uncoltable.css({ 11382 'min-height': data_viewport_h 11383 }); 11384 } else { 11385 $uncoltable.css({ 11386 'min-height': 'auto' 11387 }); 11388 } 11389 }); 11390 11391 } 11392 setItemsRelHeight(); 11393 11394 var $index_scrolls = $('.index-scroll', $el); 11395
11396 $index_scrolls.each(function(key, value){ 11397 var $index = $(this), 11398 $parent_row = $index.closest('.vc_row[data-parent]'), 11399 $index_row = $('.index-row', $index), 11400 dir = $index_row.attr('data-direction'); 11401 dir = typeof dir === 'undefined' ? 'right' : dir; 11402 11403 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 11404 }); 11405 11406 var $horScrolls = $('.unscroll-horizontal', $el); 11407 11408 if ( $horScrolls.length ) { 11409 11410 $('body').addClass('scrolling-trigger'); 11411 11412 $horScrolls.each(function(key, value){ 11413 var $section = $(this), 11414 $index_scroll = $('.index-scroll', $section), 11415 $index_row = $('.index-row', $index_scroll), 11416 dir = $section.attr('data-direction'), 11417 wrap = $index_row.attr('data-wrap'), 11418 $pinWrap, 11419 $pinTrigger; 11420 11421 dir = typeof dir === 'undefined' ? 'right' : dir; 11422 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 11423 $pinWrap = $('<div class="pin-wrap" />'); 11424 if ( SiteParameters.is_frontend_editor ) { 11425 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 11426 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 11427 } else { 11428 if ( wrap === 'column' ) { 11429 $index_scroll.wrapInner( $pinWrap ); 11430 } else { 11431 $('> .row', $section).wrap( $pinWrap ); 11432 } 11433 $section.wrapInner( $pinTrigger ); 11434 } 11435 11436 }); 11437 11438 var $pinWraps = $('.pin-wrap', $el); 11439 11440 var horScrollSizes = function(){ 11441 11442 $pinWraps.each(function(key, val){ 11443 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 11444 $pinTrigger = $pinWrap.closest('.pin-trigger'), 11445 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 11446 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 11447 $boxContainer = $('.box-container'), 11448 box_m = $boxContainer.css('margin-left'), 11449 st_active = true; 11450 11451 var setHorW, 11452 horWidth = function(){ 11453 $index_scroll.each(function(){ 11454 var $this = $(this), 11455 $index_row = $('.index-row', $this), 11456 $rowContainer = $index_row.closest('.vc_row'), 11457 $rowInner = $index_row.closest('.wpb_row'), 11458 $rowParent = $index_row.closest('.row-parent'), 11459 $tmbs = $('.tmb', $index_row), 11460 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 11461 $uncont = $index_row.closest('.uncont'), 11462 $parent_col = $index_row.closest('.wpb_column'), 11463 col_w = $uncont.width(), 11464 data_lg = parseFloat( $index_row.attr('data-lg') ), 11465 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 11466 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 11467 tmb_w; 11468 11469 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 11470 tmb_w = ( col_w + padding_tmb ) / data_lg; 11471 11472 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 11473 tmb_w = ( col_w + padding_tmb ) / data_sm; 11474 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 11475 tmb_w = ( col_w + padding_tmb ) / data_md; 11476 } 11477 11478 if ( !isNaN(tmb_w) ) { 11479 $tmbs.css({ 11480 'width': tmb_w 11481 }); 11482 } 11483 11484 $tmbs.css({ 11485 'visibility': 'visible' 11486 }); 11487 11488 }); 11489 }; 11490 11491 horWidth(); 11492 clearRequestTimeout(setHorW); 11493 setHorW = requestTimeout( function(){ 11494 setItemsRelHeight(); 11495 horWidth(); 11496 }, 100 ); 11497 11498 if ( SiteParameters.is_frontend_editor ) { 11499 return; 11500 } 11501 11502 var $vmenu = $('body.vmenu .vmenu-container'), 11503 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 11504 winWidth = window.innerWidth - vmenuW, 11505 $tmb = $('.tmb', $index_scroll).eq(0), 11506 paddingRight = parseFloat( $tmb.css('padding-right') ), 11507 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 11508 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 11509 scroll_anim; 11510 11511 if ( $('body').hasClass('rtl') ) { 11512 if ( dir === 'left' ) { 11513 scroll_anim = gsap.fromTo( $pinWrap, { 11514 x: stickyScrollLength 11515 },{ 11516 x: 0, 11517 ease: "none" 11518 }); 11519 } else { 11520 scroll_anim = gsap.fromTo( $pinWrap, { 11521 x: 0 11522 },{ 11523 x: stickyScrollLength, 11524 ease: "none" 11525 }); 11526 } 11527 } else { 11528 if ( dir === 'left' ) { 11529 scroll_anim = gsap.fromTo( $pinWrap, { 11530 x: -stickyScrollLength 11531 },{ 11532 x: 0, 11533 ease: "none" 11534 }); 11535 } else { 11536 scroll_anim = gsap.fromTo( $pinWrap, { 11537 x: 0 11538 },{ 11539 x: -stickyScrollLength, 11540 ease: "none" 11541 }); 11542 } 11543 } 11544 11545 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 11546 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 11547 } 11548 11549 var animationIncrease; 11550 11551 var checkForAnimations = function(){ 11552 animationIncrease = 0 11553 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11554 var _this = this; 11555 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 11556 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11557 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11558 requestTimeout(function() { 11559 $(_this).addClass('start_animation'); 11560 }, delayAttr + animationIncrease); 11561 animationIncrease += 150; 11562 } 11563 }); 11564 11565 var batchTime = 0; 11566 11567 var resetBatch = function(){ 11568 batchTime = 0; 11569 } 11570 11571 if (ScrollTrigger.isScrolling()) { 11572 resetBatch(); 11573 } 11574 11575 $('.tmb-mask-reveal', $pinTrigger).each(function(){ 11576 var _this = this, 11577 $this = $(_this), 11578 $inside = $('.t-inside', $this),
11579 delay = parseFloat( $inside.attr('data-delay') ), 11580 speed = parseFloat( $inside.attr('data-speed') ), 11581 easing = $inside.attr('data-easing'), 11582 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 11583 11584 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 11585 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 11586 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 11587 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 11588 11589 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) { 11590 $this.addClass('tmb-mask-init'); 11591 if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) { 11592 gsap.to($('.t-entry-visual-tc', $this), speed, { 11593 clipPath: 'inset(0% 0% 0% 0%)', 11594 delay: delay + batchTime, 11595 ease: easing, 11596 }); 11597 gsap.to($('.t-entry-visual-cont', $this), speed, { 11598 clipPath: 'inset(0% 0% 0% 0%)', 11599 scale: 1, 11600 delay: delay + batchTime + (speed*bgDelay), 11601 ease: easing, 11602 onComplete: resetBatch, 11603 }); 11604 } else { 11605 gsap.to($('.t-entry-visual-cont', $this), speed, { 11606 clipPath: 'inset(0% 0% 0% 0%)', 11607 scale: 1, 11608 delay: delay + batchTime, 11609 ease: easing, 11610 onComplete: resetBatch, 11611 }); 11612 } 11613 batchTime += 0.1; 11614 } 11615 }); 11616 11617 }; 11618 checkForAnimations(); 11619 11620 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 11621 var start = 0; 11622 11623 var horST = ScrollTrigger.create({ 11624 id: "stickySectionScrolling" + key, 11625 scrub: true, 11626 trigger: $pinTrigger[0], 11627 pin: true, 11628 anticipatePin: 1, 11629 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 11630 end: function() { return "+="+stickyScrollLength; }, 11631 animation: scroll_anim, 11632 ease: Sine.easeOut, 11633 onUpdate: checkForAnimations, 11634 invalidateOnRefresh: true, 11635 onEnter: function(){ 11636 $pinTrigger.addClass('enter-st'); 11637 }, 11638 onEnterBack: function(){ 11639 $pinTrigger.addClass('enter-st'); 11640 }, 11641 onLeave: function(){ 11642 $pinTrigger.removeClass('enter-st'); 11643 }, 11644 onLeaveBack: function(){ 11645 $pinTrigger.removeClass('enter-st'); 11646 } 11647 }); 11648 11649 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 11650 window.dispatchEvent(new CustomEvent('boxResized')); 11651 11652 var testSecondTrigger = function(){ 11653 animationIncrease = 0 11654 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11655 var _this = this; 11656 if ( checkVisible(_this) ) { 11657 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11658 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11659 requestTimeout(function() { 11660 $(_this).addClass('start_animation'); 11661 }, delayAttr + animationIncrease); 11662 animationIncrease += 150; 11663 } 11664 }); 11665 11666 }; 11667 11668 var verST = ScrollTrigger.create({ 11669 id: "verticalSectionScrolling" + key, 11670 trigger: $pinTrigger[0], 11671 start: "top center", 11672 end: function() { return "+="+UNCODE.wheight; }, 11673 onUpdate: testSecondTrigger, 11674 invalidateOnRefresh: true 11675 }); 11676 11677 var setCTA, 11678 11679 dis_enable_ST = function(){ 11680 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 11681 horST.kill(); 11682 verST.kill(); 11683 $pinTrigger.addClass('disabled'); 11684 st_active = false; 11685 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 11686 horST.kill(); 11687 verST.kill(); 11688 $pinTrigger.addClass('disabled'); 11689 st_active = false; 11690 } 11691 }; 11692 11693 $(window).on('resize load', function() { 11694 clearRequestTimeout(setCTA); 11695 setCTA = requestTimeout(function() { 11696 dis_enable_ST(); 11697 checkForAnimations(); 11698 }, 500); 11699 }); 11700 11701 }); 11702 }; 11703 11704 $(window).on( 'load', function(){ 11705 horScrollSizes(); 11706 }); 11707 var setResize, 11708 setReLayout, 11709 doubleResize = true; 11710 $(window).on( 'load', function(){ 11711 if ( $('.body-borders .top-border').outerHeight() > 0 ) { 11712 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11713 Array.prototype.forEach.call($row_inners, function(el) { 11714 el.style.height = ''; 11715 el.style.marginBottom = ''; 11716 }); 11717 setItemsRelHeight(); 11718 horScrollSizes(); 11719 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11720 $(document).trigger('uncode-scrolltrigger-refresh'); 11721 } 11722 } 11723 var carousel = document.querySelector(".owl-carousel"), 11724 grid = document.querySelector(".isotope-container"), 11725 stickyAll = document.querySelectorAll(".index-scroll"); 11726 11727 if ( stickyAll.length ) { 11728 var sticky = stickyAll[(stickyAll.length-1)]; 11729 } 11730 11731 if ( typeof sticky !== "undefined" ) { 11732 11733 if ( typeof carousel !== "undefined" && carousel !== null ) { 11734 var carousel_position = sticky.compareDocumentPosition(carousel); 11735 } 11736 if ( typeof grid !== "undefined" && grid !== null ) { 11737 var grid_position = sticky.compareDocumentPosition(grid); 11738 } 11739 11740 if ( carousel_position === 2 || grid_position === 2 ) { 11741 setTimeout(function(){ 11742 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11743 $(document).trigger('uncode-scrolltrigger-refresh'); 11744 } 11745 }, 500); 11746 } 11747 11748 } 11749 11750 }); 11751 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11752 android = /Android/.test(navigator.userAgent) && !window.MSStream; 11753 $(window).on( 'resize orientationchange', function(e){ 11754 if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11755 return; 11756 } 11757 setItemsRelHeight(true); 11758 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11759 Array.prototype.forEach.call($row_inners, function(el) { 11760 el.style.height = ''; 11761 el.style.marginBottom = ''; 11762 }); 11763 clearRequestTimeout(setResize); 11764 setResize = requestTimeout( function(){ 11765 setItemsRelHeight(); 11766 horScrollSizes(); 11767 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11768 $(document).trigger('uncode-scrolltrigger-refresh'); 11769 } 11770 if ( doubleResize === true ) { 11771 window.dispatchEvent(new Event('resize')); 11772 doubleResize = false;
11773 } else { 11774 doubleResize = true; 11775 } 11776 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 11777 }, 100 ); 11778 }); 11779 11780 var show_pins = function(){ 11781 $('.index-scroll').css({'opacity':'1'}); 11782 }; 11783 ScrollTrigger.addEventListener("refresh", show_pins); 11784 $(window).on( 'uncode.re-layout', function(){ 11785 //$('.index-scroll').css({'opacity':'0'}); 11786 $('.pin-spacer').each(function(){ 11787 var space_h = $(this).outerHeight(), 11788 $row = $(this).closest('.row-container'); 11789 $row.css({ 11790 'height': space_h, 11791 'overflow': 'hidden' 11792 }); 11793 }); 11794 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11795 ScrollTrigger.refresh(true); 11796 } 11797 clearRequestTimeout(setReLayout); 11798 setReLayout = requestTimeout( function(){ 11799 $('.row-container').each(function(){ 11800 $(this).css({ 11801 'height': '', 11802 'overflow': '' 11803 }); 11804 }); 11805 }, 1000); 11806 }); 11807 } 11808 11809}; 11810 11811UNCODE.stickyTrigger = function( $el ) { 11812 if ( SiteParameters.is_frontend_editor ) { 11813 return false; 11814 } 11815 11816 var stickyTrigger = function(){ 11817 var stickyTrick = $('.sticky-trigger').each(function(){ 11818 var $sticky = $(this), 11819 $inside = $('> div', $sticky), 11820 insideH = $inside.outerHeight(), 11821 $row = $sticky.closest('.vc_row'), 11822 $uncont = $sticky.closest('.uncont'), 11823 rowBottom, 11824 uncontBottom, 11825 diffBottom; 11826 11827 ScrollTrigger.create({ 11828 trigger: $sticky, 11829 start: function(){ return "top center-=" + insideH/2; }, 11830 endTrigger: $row, 11831 end: function(){ 11832 rowBottom = $row.offset().top + $row.outerHeight(); 11833 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 11834 diffBottom = rowBottom - uncontBottom; 11835 return "bottom center+=" + ( insideH/2 + diffBottom ); 11836 }, 11837 anticipatePin: true, 11838 pin: true, 11839 pinSpacing: false, 11840 scrub: true, 11841 invalidateOnRefresh: true, 11842 }); 11843 11844 }); 11845 }, 11846 setResizeSticky; 11847 11848 $(window).on( 'load', function(){ 11849 stickyTrigger(); 11850 var carousel = document.querySelector(".owl-carousel"), 11851 grid = document.querySelector(".isotope-container"), 11852 stickyAll = document.querySelectorAll(".sticky-trigger"); 11853 11854 if ( stickyAll.length ) { 11855 var sticky = stickyAll[(stickyAll.length-1)]; 11856 } 11857 11858 if ( typeof sticky !== "undefined" ) { 11859 11860 if ( typeof carousel !== "undefined" && carousel !== null ) { 11861 var carousel_position = sticky.compareDocumentPosition(carousel); 11862 } 11863 if ( typeof grid !== "undefined" && grid !== null ) { 11864 var grid_position = sticky.compareDocumentPosition(grid); 11865 } 11866 11867 if ( carousel_position === 2 || grid_position === 2 ) { 11868 setTimeout(function(){ 11869 $(document).trigger('uncode-scrolltrigger-refresh'); 11870 }, 500); 11871 } 11872 11873 } 11874 }); 11875 11876 var oldW = UNCODE.wwidth; 11877 $(window).on( 'resize uncode.re-layout', function(e){ 11878 clearRequestTimeout(setResizeSticky); 11879 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 11880 return; 11881 } else { 11882 oldW = UNCODE.wwidth; 11883 } 11884 setResizeSticky = requestTimeout( function(){ 11885 stickyTrigger(); 11886 $(document).trigger('uncode-scrolltrigger-refresh'); 11887 }, 1000 ); 11888 }); 11889 11890 11891}; 11892 11893UNCODE.areaTextReveal = function() { 11894 if ( ! $('.text-reveal, .scroll-trigger-el').length ) { 11895 return; 11896 } 11897 if ( ! SiteParameters.is_frontend_editor ) { 11898 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11899 android = /Android/.test(navigator.userAgent) && !window.MSStream, 11900 prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11901 prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11902 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11903 firstObs = true, 11904 isMobileUsing = false;
11905 11906 var observer = new ResizeObserver(function(){ 11907 var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11908 newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11909 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11910 set = false; 11911 if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11912 set = true; 11913 prevW = newW; 11914 } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11915 set = true; 11916 prevH = newH; 11917 } 11918 if ( set || firstObs ) { 11919 window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe')); 11920 firstObs = false; 11921 } 11922 }).observe(document.body); 11923 11924 if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11925 window.scrollTo = function() { 11926 return; 11927 }; 11928 isMobileUsing = true; 11929 11930 $('html, body').css({ 11931 'overscroll-behavior': 'none' 11932 }); 11933 } 11934 11935 var setTriggerObserve; 11936 11937 ScrollTrigger.observe({ 11938 trigger: 'body', 11939 type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
11940 onUp: function() { ScrollTrigger.update(); }, 11941 }); 11942 } 11943 11944 var textReveal = function(){ 11945 11946 if ( SiteParameters.is_frontend_editor ) { 11947 return; 11948 } 11949 11950 var setTxtReveal, 11951 txtTrggrStart = false; 11952 11953 function headingReveal($sel){ 11954 txtTrggrStart = true; 11955 $('.text-reveal', $sel).each(function(val, key){ 11956 var $txtReveal = $(this).attr('data-init-reveal', true), 11957 $trigger = $txtReveal, 11958 $rowParent = $txtReveal.closest('.row-container[data-parent]'), 11959 hReveal = $txtReveal.outerHeight(), 11960 $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'), 11961 $sticky = $txtReveal.closest('.sticky-element'), 11962 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 11963 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 11964 dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')), 11965 $lines = $('.heading-line-wrap', $txtReveal), 11966 $words = $('.split-word-inner', $txtReveal), 11967 $chars = $('.split-char', $txtReveal), 11968 $elToReveal = $words; 11969 11970 if ( $pin.length ) { 11971 return; 11972 } else if ( $sticky.length ) { 11973 hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop); 11974 $trigger = $sticky.parent(); 11975 } 11976 11977 if ( dataReveal === 'chars' ) { 11978 $elToReveal = $chars; 11979 } else if ( dataReveal === 'lines' ) { 11980 $elToReveal = $lines; 11981 } 11982 11983 var tl = gsap.timeline({ 11984 scrollTrigger: { 11985 trigger: $trigger, 11986 start: "top +=" + (window.innerHeight/100*dataTop) + "px", 11987 end: "+=" + hReveal + "px", 11988 id: "txt_reveal_" + key, 11989 scrub: true, 11990 } 11991 }); 11992 gsap.set( 11993 $elToReveal, { 11994 opacity: dataRevealOpacity, 11995 } 11996 ) 11997 tl.fromTo($elToReveal, { 11998 opacity: dataRevealOpacity, 11999 duration: 1, 12000 }, { 12001 opacity: 1, 12002 stagger: 0.05, 12003 duration: 1, 12004 12005 }); 12006 $(window).on('uncode.tl-refresh', function(){ 12007 if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) { 12008 tl.scrollTrigger.refresh(); 12009 } 12010 }); 12011 12012 $rowParent.one( 'uncodeWordLines', function(){ 12013 clearRequestTimeout(setTxtReveal); 12014 setTxtReveal = requestTimeout( function(){ 12015 gsap.set($elToReveal, {clearProps: true}); 12016 tl.kill(true); 12017 if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) { 12018 ScrollTrigger.getById("txt_reveal_" + key).kill(true); 12019 } 12020 headingReveal($sel) 12021 }, 100); 12022 }); 12023 12024 }); 12025 }; 12026 12027 window.addEventListener("load", function (e) { 12028 if (!txtTrggrStart) { 12029 headingReveal($("body")); 12030 $(window).trigger("resize"); 12031 } 12032 }); 12033 12034 $('.row-container[data-parent]').each(function(){ 12035 if (!txtTrggrStart) { 12036 var $this = $(this); 12037 $this.on('uncodeWordLines', function(){ 12038 headingReveal($this); 12039 }); 12040 } 12041 }); 12042 12043 $(window).on('uncode-sticky-trigger-observe', function(e){ 12044 clearRequestTimeout(setTriggerObserve); 12045 setTriggerObserve = requestTimeout( function(){ 12046 $(window).trigger('uncode.tl-refresh'); 12047 }, 2000 ); 12048 }); 12049 12050 }; 12051 textReveal(); 12052 12053 var areaReveal = function(){ 12054 if ( SiteParameters.is_frontend_editor ) { 12055 return; 12056 } 12057
12058 $('.scroll-trigger-el').each(function(){ 12059 var $scrollTrgrEl = $(this), 12060 $row = $('> .row', $scrollTrgrEl), 12061 $row_in = $('> .row-inner', $row), 12062 cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length, 12063 stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows', 12064 animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes', 12065 stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false, 12066 $animateTrgrEl = $scrollTrgrEl, 12067 noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes', 12068 noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'), 12069 els = $scrollTrgrEl.attr('data-anim-els'), 12070 sticky = $scrollTrgrEl.attr('data-anim-sticky'), 12071 noSpace = $scrollTrgrEl.attr('data-anim-no-space'), 12072 state = $scrollTrgrEl.attr('data-anim-state'), 12073 target = $scrollTrgrEl.attr('data-anim-target'), 12074 origin = $scrollTrgrEl.attr('data-anim-origin'), 12075 mask = $scrollTrgrEl.attr('data-anim-mask'), 12076 _scale = $scrollTrgrEl.attr('data-anim-scale'), 12077 stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes', 12078 opacity = $scrollTrgrEl.attr('data-anim-opacity'), 12079 radius = $scrollTrgrEl.attr('data-anim-radius'), 12080 radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'), 12081 clip_path = $scrollTrgrEl.attr('data-clip-path'), 12082 animation_x = $scrollTrgrEl.attr('data-anim-x'), 12083 animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'), 12084 animation_y = $scrollTrgrEl.attr('data-anim-y'), 12085 blur = $scrollTrgrEl.attr('data-anim-blur'), 12086 perspective = $scrollTrgrEl.attr('data-anim-perspective'), 12087 rotate = $scrollTrgrEl.attr('data-anim-rotate'), 12088 rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'), 12089 topBottom = $scrollTrgrEl.attr('data-anim-start'), 12090 offTop = $scrollTrgrEl.attr('data-anim-top'), 12091 offBottom = $scrollTrgrEl.attr('data-anim-bottom'), 12092 safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0, 12093 animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'), 12094 easeOut = $scrollTrgrEl.attr('data-anim-ease'), 12095 offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'), 12096 stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards, 12097 $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(), 12098 setTxtReveal, 12099 txtTrggrStart = false, 12100 alreadyareaAnimateScrollTl = false; 12101 12102 _scale = _scale === '' ? 0 : parseFloat( _scale ); 12103 perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001; 12104 offTop = offTop === '' ? 0 : parseFloat( offTop ); 12105 offBottom = offBottom === '' ? 0 : parseFloat( offBottom ); 12106 offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard ); 12107 12108 function areaAnimateScrollTl($el, id, last) { 12109 alreadyareaAnimateScrollTl = true; 12110 12111 var pTop = parseFloat( $row.css('padding-top') ), 12112 innerGap = pTop + offSetCard * id, 12113 scale = _scale; 12114 12115 if ( isMobileUsing ) { 12116 innerGap = 0; 12117 } 12118 12119 if ( stepScale ) { 12120 if ( _scale < 100 ) { 12121 scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) ); 12122 } 12123 } 12124 12125 if ( els === 'content' ) { 12126 $animateTrgrEl = $('> .row', $scrollTrgrEl); 12127 } else if ( els === 'bg' ) { 12128 $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl); 12129 } else { 12130 $animateTrgrEl = $el; 12131 } 12132 12133 if ( rotate_alt === 'yes') { 12134 rotate *= -1; 12135 perspective *= -1; 12136 } 12137 12138 if ( animation_x_alt === 'yes') { 12139 animation_x *= -1; 12140 } 12141 12142 var $parentDiv = $el.closest('div[data-sticky]'); 12143 12144 var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px"; 12145 12146 var scrllTrggr = { 12147 trigger: $parentDiv, 12148 end: function(){ 12149 return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom))) 12150 }, 12151 start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12152 pin: sticky === 'yes' || stickyCards ? true : false, 12153 pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0), 12154 scrub: true, 12155 id: 'sticky_' + id, 12156 anticipatePin: 1, 12157 invalidateOnRefresh: true, 12158 // markers: { 12159 // indent: 150 * id 12160 // }, 12161 onToggle: function(){ 12162 $scrollTrgrEl.attr('data-revealed', true); 12163 }, 12164 }; 12165 12166 if ( !stickyLast && state === 'end' ) { 12167 last = false; 12168 } 12169 12170 if ( stickyCards ) { 12171 if ( state !== 'end' ) { 12172 if ( animation_rows_start === 'center' ) { 12173 scrllTrggr.start = "center center"; 12174 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight); 12175 } else if ( animation_rows_start === 'bottom' ) { 12176 if ( stickyOpts !== 'no' ) { 12177 scrllTrggr.start = "bottom bottom"; 12178 scrllTrggr.end = "bottom bottom"; 12179 } 12180 } else { 12181 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2); 12182 } 12183 if ( stickyOpts === 'no' ) { 12184 scrllTrggr.endTrigger = $el; 12185 scrllTrggr.end = "+=100%"; 12186 } else { 12187 scrllTrggr.endTrigger = $row; 12188 } 12189 } else { 12190 if ( animation_rows_start === 'center' ) { 12191 scrllTrggr.start = "center center"; 12192 } else if ( animation_rows_start === 'bottom' ) { 12193 scrllTrggr.start = "bottom bottom"; 12194 } 12195 if ( stickyOpts !== 'no' ) { 12196 scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1)); 12197 scrllTrggr.endTrigger = $lastEl; 12198 } else { 12199 scrllTrggr.end = "bottom bottom"; 12200 } 12201 } 12202 } 12203 12204 var tl = gsap.timeline({ 12205 scrollTrigger: scrllTrggr 12206 }); 12207 12208 // var mark = last ? { 12209 // startColor:"blue", 12210 // endColor:"orange", 12211 // } : false; 12212 12213 if ( !stickyCards ) { 12214 var tlConds = tl; 12215 } else { 12216 var scrllTrggrConds = { 12217 trigger: $parentDiv, 12218 end: function(){ 12219 return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom))) 12220 }, 12221 pin: (state === 'end' && last), 12222 pinSpacing: false, 12223 scrub: true, 12224 id: 'card_' + id, 12225 invalidateOnRefresh: true, 12226 // markers: true, 12227 }; 12228 if ( stickyCards ) { 12229 if ( state !== 'end' ) { 12230 if ( stickyOpts === '' ) { 12231 scrllTrggrConds.end = "bottom bottom-=100%"; 12232 scrllTrggrConds.endTrigger = $row_in; 12233 } 12234 12235 if ( animation_rows_start === 'bottom' ) { 12236 if ( stickyOpts !== 'no') { 12237 scrllTrggrConds.start = "top top+=" + window.innerHeight; 12238 scrllTrggrConds.end = "bottom bottom"; 12239 } 12240 } else if ( animation_rows_start === 'center' ) { 12241 scrllTrggrConds.start = "center center"; 12242 } else { 12243 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12244 } 12245 12246 } else { 12247 if ( stickyOpts === '' ) { 12248 if ( animLast ) { 12249 scrllTrggrConds.end = "bottom bottom-=100%"; 12250 } else { 12251 scrllTrggrConds.end = "bottom bottom"; 12252 } 12253 scrllTrggrConds.endTrigger = $lastEl; 12254 } 12255 12256 if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) { 12257 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12258 scrllTrggrConds.start = "bottom bottom"; 12259 } else { 12260 scrllTrggrConds.start = "top top+=" + $el.outerHeight(); 12261 } 12262 } else if ( animation_rows_start === 'center' ) { 12263 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12264 scrllTrggrConds.start = "center center"; 12265 } else { 12266 scrllTrggrConds.start = "top+=" + ($el.outerHeight()/2) + " top+="
12266+ window.innerHeight/2; 12267 } 12268 } else { 12269 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12270 scrllTrggrConds.start = "top top"; 12271 } else { 12272 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12273 } 12274 } 12275 12276 } 12277 12278 } else { 12279 scrllTrggrConds.start = start_topBottom; 12280 } 12281 12282 var tlConds = gsap.timeline({ 12283 scrollTrigger: scrllTrggrConds 12284 }); 12285 } 12286 12287 if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) { 12288 if ( target === 'mask' ) { 12289 if ( state !== 'end' ) { 12290 if ( mask === 'auto' ) { 12291 gsap.set( 12292 $animateTrgrEl, { 12293 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12294 opacity: parseFloat(opacity)/100, 12295 filter: 'blur(' + blur + 'px)', 12296 visibility: 'visible', 12297 } 12298 ) 12299 tlConds.fromTo($animateTrgrEl, { 12300 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12301 opacity: parseFloat(opacity)/100, 12302 filter: 'blur(' + blur + 'px)', 12303 duration: 1, 12304 }, { 12305 opacity: 1, 12306 clipPath: 'inset(0% 0px round 0' + radiu
12306s_unit + ')', 12307 filter: 'blur(0px)', 12308 duration: 1, 12309 ease: easeOut, 12310 //delay: 0.1 12311 }); 12312 } else { 12313 tlConds.fromTo($animateTrgrEl, { 12314 opacity: parseFloat(opacity)/100, 12315 clipPath: clip_path, 12316 filter: 'blur(' + blur + 'px)', 12317 duration: 1, 12318 }, { 12319 opacity: 1, 12320 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12321 filter: 'blur(0px)', 12322 duration: 1, 12323 ease: easeOut, 12324 //delay: 0.1 12325 }); 12326 } 12327 } else { 12328 if ( mask === 'auto' ) { 12329 tlConds.fromTo($animateTrgrEl, { 12330 opacity: 1, 12331 clipPath: 'inset(0% 0px round 0' + radiu
12331s_unit + ')', 12332 filter: 'blur(0px)', 12333 duration: 1, 12334 },{ 12335 opacity: parseFloat(opacity)/100, 12336 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12337 filter: 'blur(' + blur + 'px)', 12338 ease: easeOut, 12339 duration: 1, 12340 //delay: 0.1 12341 }); 12342 } else { 12343 tlConds.fromTo($animateTrgrEl, { 12344 opacity: 1, 12345 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12346 filter: 'blur(0px)', 12347 duration: 1, 12348 },{ 12349 opacity: parseFloat(opacity)/100, 12350 clipPath: clip_path, 12351 filter: 'blur(' + blur + 'px)', 12352 duration: 1, 12353 ease: easeOut, 12354 //delay: 0.1 12355 }); 12356 } 12357 } 12358 } else { 12359 if ( state !== 'end' ) { 12360 if ( scale === 'auto' ) { 12361 if ( radius ) { 12362 gsap.set( 12363 $animateTrgrEl, { 12364 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12365 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12366 x: animation_x + 'vw', 12367 y: animation_y + 'vh', 12368 filter: 'blur(' + blur + 'px)', 12369 rotation: rotate, 12370 rotationX: rotate == 0 ? perspective : 0, 12371 transformPerspective: '100vw', 12372 opacity: parseFloat(opacity)/100, 12373 transformOrigin: origin, 12374 borderRadius: radius + radius_unit, 12375 visibility: 'visible', 12376 } 12377 ) 12378 tlConds.fromTo($animateTrgrEl, { 12379 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12380 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12381 x: animation_x + 'vw', 12382 y: animation_y + 'vh', 12383 filter: 'blur(' + blur + 'px)', 12384 rotation: rotate, 12385 rotationX: rotate == 0 ? perspective : 0, 12386 transformPerspective: '100vw', 12387 opacity: parseFloat(opacity)/100, 12388 borderRadius: radius + radius_unit, 12389 transformOrigin: origin, 12390 duration: 1, 12391 }, { 12392 scaleX: 1, 12393 scaleY: 1, 12394 x: 0, 12395 y: 0, 12396 filter: 'blur(0px)', 12397 rotation: 0, 12398 rotationX: 0, 12399 opacity: 1, 12400 borderRadius: 0 + radius_unit, 12401 transformOrigin: origin, 12402 duration: 1, 12403 ease: easeOut, 12404 //delay: 0.1 12405 }); 12406 } else { 12407 gsap.set( 12408 $animateTrgrEl, { 12409 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12410 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12411 x: animation_x + 'vw', 12412 y: animation_y + 'vh', 12413 filter: 'blur(' + blur + 'px)', 12414 rotation: rotate, 12415 rotationX: rotate == 0 ? perspective : 0, 12416 transformPerspective: '100vw', 12417 opacity: parseFloat(opacity)/100, 12418 transformOrigin: origin, 12419 visibility: 'visible', 12420 } 12421 ) 12422 tlConds.fromTo($animateTrgrEl, { 12423 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12424 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12425 x: animation_x + 'vw', 12426 y: animation_y + 'vh', 12427 filter: 'blur(' + blur + 'px)', 12428 rotation: rotate, 12429 rotationX: rotate == 0 ? perspective : 0, 12430 transformPerspective: '100vw', 12431 opacity: parseFloat(opacity)/100, 12432 transformOrigin: origin, 12433 duration: 1, 12434 }, { 12435 scaleX: 1, 12436 scaleY: 1, 12437 x: 0, 12438 y: 0, 12439 filter: 'blur(0px)', 12440 rotation: 0, 12441 rotationX: 0, 12442 opacity: 1, 12443 transformOrigin: origin, 12444 duration: 1, 12445 ease: easeOut, 12446 //delay: 0.1 12447 }); 12448 } 12449 } else {
12450 if ( radius ) { 12451 gsap.set( 12452 $animateTrgrEl, { 12453 scaleX: parseFloat( scale ) / 100, 12454 scaleY: parseFloat( scale ) / 100, 12455 opacity: parseFloat(opacity)/100, 12456 x: animation_x + 'vw', 12457 y: animation_y + 'vh', 12458 filter: 'blur(' + blur + 'px)', 12459 rotation: rotate, 12460 rotationX: rotate == 0 ? perspective : 0, 12461 transformPerspective: '100vw', 12462 transformOrigin: origin, 12463 borderRadius: radius + radius_unit, 12464 visibility: 'visible', 12465 } 12466 ) 12467 tlConds.fromTo($animateTrgrEl, { 12468 scaleX: parseFloat( scale ) / 100, 12469 scaleY: parseFloat( scale ) / 100, 12470 opacity: parseFloat(opacity)/100, 12471 x: animation_x + 'vw', 12472 y: animation_y + 'vh', 12473 filter: 'blur(' + blur + 'px)', 12474 rotation: rotate, 12475 rotationX: rotate == 0 ? perspective : 0, 12476 transformPerspective: '100vw', 12477 borderRadius: radius + radius_unit, 12478 transformOrigin: origin, 12479 duration: 1, 12480 }, { 12481 scaleX: 1, 12482 scaleY: 1, 12483 opacity: 1, 12484 x: 0, 12485 y: 0, 12486 filter: 'blur(0px)', 12487 rotation: 0, 12488 rotationX: 0, 12489 transformOrigin: origin, 12490 ease: easeOut, 12491 duration: 1, 12492 borderRadius: 0 + radius_unit, 12493 //delay: 0.1 12494 }); 12495 } else { 12496 gsap.set( 12497 $animateTrgrEl, { 12498 scaleX: parseFloat( scale ) / 100, 12499 scaleY: parseFloat( scale ) / 100, 12500 opacity: parseFloat(opacity)/100, 12501 x: animation_x + 'vw', 12502 y: animation_y + 'vh', 12503 filter: 'blur(' + blur + 'px)', 12504 rotation: rotate, 12505 rotationX: rotate == 0 ? perspective : 0, 12506 transformPerspective: '100vw', 12507 transformOrigin: origin, 12508 visibility: 'visible', 12509 } 12510 ) 12511 tlConds.fromTo($animateTrgrEl, { 12512 scaleX: parseFloat( scale ) / 100, 12513 scaleY: parseFloat( scale ) / 100, 12514 opacity: parseFloat(opacity)/100, 12515 x: animation_x + 'vw', 12516 y: animation_y + 'vh', 12517 filter: 'blur(' + blur + 'px)', 12518 rotation: rotate, 12519 rotationX: rotate == 0 ? perspective : 0, 12520 transformPerspective: '100vw', 12521 transformOrigin: origin, 12522 duration: 1, 12523 }, { 12524 scaleX: 1, 12525 scaleY: 1, 12526 opacity: 1, 12527 x: 0, 12528 y: 0, 12529 filter: 'blur(0px)', 12530 rotation: 0, 12531 rotationX: 0, 12532 transformOrigin: origin, 12533 duration: 1, 12534 ease: easeOut, 12535 //delay: 0.1 12536 }); 12537 } 12538 } 12539 } else { 12540 if ( scale === 'auto' ) { 12541 tlConds.fromTo($animateTrgrEl, { 12542 scaleX: 1, 12543 scaleY: 1, 12544 opacity: 1, 12545 x: 0, 12546 y: 0, 12547 filter: 'blur(0px)', 12548 rotation: 0, 12549 rotationX: 0, 12550 transformOrigin: origin, 12551 duration: 1, 12552 }, { 12553 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12554 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12555 opacity: parseFloat(opacity)/100, 12556 x: animation_x + 'vw', 12557 y: animation_y + 'vh', 12558 filter: 'blur(' + blur + 'px)', 12559 rotation: rotate, 12560 rotationX: rotate == 0 ? perspective : 0, 12561 transformPerspective: '100vw', 12562 transformOrigin: origin, 12563 duration: 1, 12564 ease: easeOut, 12565 //delay: 0.1 12566 }) 12567 } else { 12568 tlConds.fromTo($animateTrgrEl, { 12569 scaleX: 1, 12570 scaleY: 1, 12571 opacity: 1, 12572 x: 0, 12573 y: 0, 12574 filter: 'blur(0px)', 12575 rotation: 0, 12576 rotationX: 0, 12577 transformPerspective: '100vw', 12578 transformOrigin: origin, 12579 borderRadius: 0 + radius_unit, 12580 duration: 1, 12581 }, { 12582 scaleX: parseFloat( scale ) / 100, 12583 scaleY: parseFloat( scale ) / 100, 12584 opacity: parseFloat(opacity)/100, 12585 x: animation_x + 'vw', 12586 y: animation_y + 'vh', 12587 filter: 'blur(' + blur + 'px)', 12588 rotation: rotate, 12589 rotationX: rotate == 0 ? perspective : 0, 12590 transformPerspective: '100vw', 12591 transformOrigin: origin, 12592 borderRadius: radius + radius_unit, 12593 duration: 1, 12594 ease: easeOut, 12595 //delay: 0.1 12596 }) 12597 } 12598 } 12599 } 12600 } 12601 12602 function headingReveal($el){ 12603 txtTrggrStart = true; 12604 $('.text-reveal', $el).each(function(_key, _val){ 12605 var $txtReveal = $(_val), 12606 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 12607 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 12608 $lines = $('.heading-line-wrap', $txtReveal), 12609 $words = $('.split-word-inner', $txtReveal), 12610 $chars = $('.split-char', $txtReveal), 12611 _setTxtReveal, 12612 $elToReveal = $words; 12613 12614 if ( !(sticky === 'yes' || stickyCards) ) { 12615 return; 12616 } 12617 12618 easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut; 12619 12620 if ( dataReveal === 'chars' ) { 12621 $elToReveal = $chars; 12622 } else if ( dataReveal === 'lines' ) { 12623 $elToReveal = $lines; 12624 } 12625 12626 var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr; 12627 scrllTrggrTxt.id = "txt_reveal_" + _key;
12628 scrllTrggrTxt.pin = false; 12629 12630 gsap.set($elToReveal, {opacity: dataRevealOpacity}); 12631 var _tl = gsap.timeline({ 12632 scrollTrigger: scrllTrggrTxt 12633 }); 12634 _tl.fromTo($elToReveal, { 12635 opacity: dataRevealOpacity, 12636 }, { 12637 opacity: 1, 12638 stagger: 0.05 12639 }); 12640 12641 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12642 clearRequestTimeout(_setTxtReveal); 12643 _setTxtReveal = requestTimeout( function(){ 12644 gsap.set($elToReveal, {clearProps: true}); 12645 _tl.kill(true); 12646 if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) { 12647 ScrollTrigger.getById("txt_reveal_" + _key).kill(true); 12648 } 12649 headingReveal($el) 12650 }, 100); 12651 }); 12652 12653 }); 12654 }; 12655 12656 if (!txtTrggrStart) { 12657 headingReveal($el); 12658 } 12659 12660 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12661 if (!txtTrggrStart) { 12662 headingReveal($el); 12663 } 12664 }); 12665 12666 var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 12667 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12668 var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 12669 document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12670 12671 $(window).on('uncode-sticky-trigger-observe', function(e){ 12672 var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12673 var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12674 $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false}); 12675 //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style'); 12676 if ( stickyCards ) { 12677 $('.tmb', $scrollTrgrEl).removeAttr('style'); 12678 } 12679 var scrollnow = document.body.scrollTop || document.documentElement.scrollTop; 12680 clearRequestTimeout(setTxtReveal); 12681 setTxtReveal = requestTimeout( function(){ 12682 $(document).trigger('uncode-scrolltrigger-refresh'); 12683 if ( isMobileUsing ) { 12684 if ( typeof tl !== 'undefined' ) { 12685 tl.scrollTrigger.refresh(); 12686 } 12687 if ( typeof tlConds !== 'undefined' ) { 12688 tlConds.scrollTrigger.refresh(); 12689 } 12690 $(window).trigger('scroll'); 12691 _width = __width; 12692 } else if ( _width !== __width && ( isMobileUsing ) ) { 12693 window.dispatchEvent(new CustomEvent('vc-resize')); 12694 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 12695 window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){ 12696 if ( typeof tl !== 'undefined' ) { 12697 tl.scrollTrigger.refresh(); 12698 } 12699 if ( typeof tlConds !== 'undefined' ) { 12700 tlConds.scrollTrigger.refresh(); 12701 } 12702 window.lenis.scrollTo(scrollnow, {duration: 0.01}); 12703 }}); 12704 } else { 12705 if ( typeof tl !== 'undefined' ) { 12706 tl.scrollTrigger.refresh(); 12707 } 12708 if ( typeof tlConds !== 'undefined' ) { 12709 tlConds.scrollTrigger.refresh(); 12710 } 12711 $(window).trigger('scroll'); 12712 } 12713 _height = __height; 12714 } 12715 }, 500); 12716 }); 12717 12718 12719 $(window).on('load ', function(e){ 12720 var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12721 if ( _height !== ___height ) { 12722 $scrollTrgrEl.attr('data-toggled', true); 12723 $(window).trigger('resize'); 12724 if ( typeof tl !== 'undefined' ) { 12725 tl.scrollTrigger.refresh(); 12726 } 12727 if ( typeof tlConds !== 'undefined' ) { 12728 tlConds.scrollTrigger.refresh(); 12729 } 12730 _height = ___height; 12731 } 12732 12733 12734 12735 $(document).trigger('uncode-scrolltrigger-refresh'); 12736 12737 }); 12738 12739 }; 12740 12741 var callAreaAnimateScrollTl = function() { 12742 if ( stickyCards ) { 12743 $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){ 12744 if ( key+1 < cardL || animLast || state !== 'end' ) { 12745 var $this = $(val), 12746 last = key+1===cardL; 12747 areaAnimateScrollTl($this, key, last); 12748 } 12749 }); 12750 } else {
12751 areaAnimateScrollTl($scrollTrgrEl, 0, false); 12752 } 12753 }; 12754 12755 $(window).on('wwResize', function(){ 12756 if ( !alreadyareaAnimateScrollTl ) { 12757 if ( noMobile ) { 12758 if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) { 12759 return; 12760 } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12761 return; 12762 } 12763 } 12764 12765 callAreaAnimateScrollTl(); 12766 } 12767 }) 12768 12769 if ( noMobile ) { 12770 if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) { 12771 return; 12772 } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12773 return; 12774 } 12775 } 12776 12777 callAreaAnimateScrollTl(); 12778 12779 }); 12780 12781 }; 12782 12783 areaReveal(); 12784 12785}; 12786 12787UNCODE.thumbsReveal = function() { 12788 var revealThumbs = function( $el ){ 12789 if ( typeof $el === 'undefined' || $el === null || !$el.length ) { 12790 $el = $('body'); 12791 } 12792 $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){ 12793 var $container = $(this), 12794 $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container), 12795 isContainer = false; 12796 12797 if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) { 12798 $stickys.each(function(){ 12799 var $sticky = $(this).addClass('tmb-mask-init'), 12800 $inside = $('.t-inside', $sticky), 12801 $media = $('img, video, .fluid-object', $sticky), 12802 val = parseFloat( $inside.attr('data-scroll-val') ); 12803 12804 val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val; 12805 12806 if ( $sticky.hasClass('tmb-mask-scroll') ) { 12807 12808 var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both')) 12809 ? val*0.05 : 0; 12810 var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) 12811 ? val*4 : 0; 12812 var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0; 12813 12814 var tl = gsap.timeline({ 12815 scrollTrigger: { 12816 trigger: $sticky, 12817 scrub: true, 12818 } 12819 }); 12820 12821 tl.fromTo($media, { 12822 yPercent: -(parax), 12823 scale: 1 + zoom + extra, 12824 }, { 12825 yPercent: parax, 12826 scale: 1 + extra, 12827 ease: "none", 12828 }); 12829 } 12830 }); 12831 } 12832 12833 if ( $container.has('.tmb-mask-reveal') ) { 12834 var $markTrigger = ".tmb-mask-reveal .t-entry-visual", 12835 staggerTime = 0.1; 12836 12837 $('.t-inside', $container).each(function(){ 12838 var checkEasing = $(this).attr('data-easing'); 12839 if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') { 12840 gsap.registerPlugin(CustomEase); 12841 return false; 12842 } 12843 }); 12844 12845 if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) { 12846 $markTrigger = $container; 12847 isContainer = true; 12848 staggerTime = 0; 12849 } 12850 12851 ScrollTrigger.batch( $markTrigger, { 12852 start: function( el ){ 12853 /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) { 12854 return "bottom bottom"; 12855 } else {*/ 12856 return "top 96%"; 12857 //} 12858 }, 12859 onEnter: function(batch){ 12860 var $inside = $(batch).closest('.t-inside'); 12861 12862 if ( isContainer ) { 12863 var $inside = $(batch).find('.t-inside').first(); 12864 } 12865
12866 var delay = parseFloat( $inside.attr('data-delay') ), 12867 speed = parseFloat( $inside.attr('data-speed') ), 12868 easing = $inside.attr('data-easing'), 12869 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 12870 12871 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 12872 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 12873 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 12874 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 12875 12876 if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) { 12877 gsap.to($('.t-entry-visual-tc', batch), speed, { 12878 clipPath: 'inset(0% 0% 0% 0%)', 12879 stagger: staggerTime, 12880 delay: delay, 12881 ease: easing, 12882 }); 12883 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12884 clipPath: 'inset(0% 0% 0% 0%)', 12885 stagger: staggerTime, 12886 scale: 1, 12887 delay: delay + (speed*bgDelay), 12888 ease: easing, 12889 }); 12890 } else { 12891 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12892 clipPath: 'inset(0% 0% 0% 0%)', 12893 stagger: staggerTime, 12894 scale: 1, 12895 delay: delay, 12896 ease: easing, 12897 }); 12898 } 12899 12900 } 12901 }); 12902 } 12903 12904 }); 12905 12906 }; 12907 $(window).on( 'load more-items-loaded', function(){ 12908 revealThumbs(); 12909 }); 12910 12911 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 12912 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 12913 var $el = model.view.$el, 12914 shortcode = model.attributes.shortcode; 12915 12916 if ( $el.is('.custom-grid-container') ) { 12917 $el = $el.parent(); 12918 } 12919 12920 if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') { 12921 revealThumbs($el); 12922 } 12923 }); 12924 } 12925 12926}; 12927 12928UNCODE.revslider = function() { 12929 var revSlider6In = function(){ 12930 $('rs-module').each(function(){ 12931 var $slider = $(this); 12932 12933 $slider.on('revolution.slide.onloaded', function(e, data){ 12934 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12935 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 12936 scrolltop = $(document).scrollTop(); 12937 if ( style != undefined ) { 12938 UNCODE.switchColorsMenu(scrolltop, style); 12939 } 12940 } 12941 }); 12942 12943 $slider.on('revolution.slide.onchange', function(e, data){ 12944 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12945 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 12946 scrolltop = $(document).scrollTop(); 12947 if ( style != undefined ) { 12948 UNCODE.switchColorsMenu(scrolltop, style); 12949 } 12950 } 12951 }); 12952 12953 }); 12954 12955 }; 12956 revSlider6In(); 12957 $(window).on("load", revSlider6In ); 12958 12959 document.addEventListener("sr.module.ready", function(e) { 12960 var $slider = $('#'+e.id), 12961 settings = SR7.JSON[e.id]; 12962 12963 if ( typeof settings !== 'undefined' && settings !== null ) { 12964 if ( $slider.closest(".header-revslider").length ) { 12965 var style = settings.slides[1].slide.attr.data, 12966 scrolltop = $(document).scrollTop(); 12967 style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/); 12968 style = style[1]; 12969 if ( style[1] != undefined ) { 12970 UNCODE.switchColorsMenu(scrolltop, style); 12971 } 12972 } 12973 } 12974 }); 12975 12976 document.addEventListener("sr.slide.afterChange", function(e) { 12977 var $slider = $('#'+e.id), 12978 settings = SR7.JSON[e.id]; 12979 12980 if ( typeof settings !== 'undefined' && settings !== null ) { 12981 if ( $slider.closest(".header-revslider").length ) { 12982 var style = settings.slides[e.current.id].slide.attr.data, 12983 scrolltop = $(document).scrollTop(); 12984 style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/); 12985 style = style[1]; 12986 if ( style != undefined ) { 12987 UNCODE.switchColorsMenu(scrolltop, style); 12988 } 12989 } 12990 } 12991 }); 12992 12993}; 12994UNCODE.layerslider = function() { 12995 $(window).on("load", function() { 12996 12997 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 12998 12999 var slideData = slider.slides.current.data, 13000 scrolltop = $(document).scrollTop(); 13001 if( slideData && slideData.skin ) { 13002 13003 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 13004 13005 } 13006 }); 13007 13008 }); 13009}; 13010 13011UNCODE.ajax_filters = function () { 13012 var isAjaxing = false;
13013 13014/************************* 13015 * 13016 * Filters Menu and Widgets Area 13017 * 13018 ************************/ 13019 13020 var clear_clicked = false; 13021 13022 var init_ajax_grid = function(){ 13023 13024 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 13025 $grids.each(function(index, val){ 13026 var $body = $('body'), 13027 $grid = $(val).addClass('init-ajax-grid'), 13028 starting_point = $grid.attr('data-toggle'), 13029 $trigger = $('.uncode-toggle-ajax-filters', $grid), 13030 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 13031 $isotope_wrapper = $('.isotope-wrapper', $grid), 13032 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 13033 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 13034 $footprint = $('.ajax-filter-footprint', $grid), 13035 sidebar_w, 13036 data_w = parseFloat( $sidebar.attr('data-max-width') ), 13037 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 13038 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 13039 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 13040 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 13041 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 13042 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 13043 sidew, 13044 $inside_row = $('> .row-parent', $vc_row), 13045 bg_row, 13046 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 13047 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 13048 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer), 13049 sidebar_overlay = false, 13050 sidebar_hover = false, 13051 switchMobile = false, 13052 scrollTop; 13053 13054 if ( $vc_row.attr('class') ) { 13055 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 13056 } 13057 13058 if ( bg_row != null ) { 13059 $side_header.add($side_footer).addClass(bg_row[0]); 13060 } 13061 13062 $trigger.add($apply_filters).on('click', function(e){ 13063 e.preventDefault(); 13064 e.stopPropagation(); 13065 $grid = $('.ajax-grid-system').eq(0); 13066 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 13067 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 13068 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13069 sidebar_w = $sidebar_wrapper.width(); 13070 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13071 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 13072 $(this).trigger('uncode-ajax-clear-filters'); 13073 } 13074 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 13075 $grid.toggleClass('ajax-hide-filters-blanks'); 13076 $sidebar.slideToggle({ 13077 duration: 400, 13078 easing: 'easeOutQuad', 13079 }); 13080 } else { 13081 $grid.removeClass('ajax-hide-filters-blanks'); 13082 $grid.toggleClass('ajax-hide-filters'); 13083 if ( $grid.hasClass('ajax-hide-filters') ) { 13084 $body.addClass('ajax-hide-filters'); 13085 } else { 13086 scrollTop = $('html, body').scrollTop(); 13087 $body.removeClass('ajax-hide-filters'); 13088 } 13089 } 13090 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 13091 $('html, body').scrollTop(scrollTop); 13092 } 13093 return false; 13094 }); 13095 13096 $close_btn.on('click', function(e){ 13097 e.preventDefault(); 13098 $grid = $('.ajax-grid-system').eq(0); 13099 $grid.addClass('ajax-hide-filters'); 13100 if ( $grid.hasClass('ajax-hide-filters') ) { 13101 $body.addClass('ajax-hide-filters'); 13102 } else { 13103 scrollTop = $('html, body').scrollTop(); 13104 $body.removeClass('ajax-hide-filters'); 13105 } 13106 $('html, body').scrollTop(scrollTop); 13107 }); 13108 13109 $sidebar_wrapper.on('mouseover',function(){ 13110 sidebar_hover = true; 13111 }).on('mouseout', function(){ 13112 sidebar_hover = false; 13113 }); 13114 13115 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 13116 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 13117 return; 13118 } 13119 if (undefined !== from && from === 'select_active_attributes') { 13120 return; 13121 } 13122 if ($(e.target).closest('.select2-container--open').length ) { 13123 return; 13124 } 13125 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 13126 $grid.add($body).addClass('ajax-hide-filters'); 13127 } 13128 }); 13129 13130 $sorting_trgr.on('click', function(e) { 13131 e.preventDefault(); 13132 }); 13133 13134 var inside_width = function(){ 13135 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13136 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13137 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13138 $inside_row = $('> .row-parent', $vc_row); 13139 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 13140 sidew = $sidebar.width(); 13141 $inside_row.css({ 13142 width: sidew 13143 }); 13144 } else { 13145 $inside_row.css({ 13146 width: '' 13147 }); 13148 } 13149 }; 13150 inside_width(); 13151 13152 var ajax_sidebar_position = function(e, f_editor){ 13153 $grid = $('.ajax-grid-system').eq(0); 13154 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13155 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 13156 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13157 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13158 $inside_row = $('> .row-parent', $vc_row); 13159 scrollTop = $('html, body').scrollTop(); 13160 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 13161 $grid.add($body).addClass('ajax-hide-filters'); 13162 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 13163 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13164 sidebar_overlay = true; 13165 $body.addClass('ajax-filter-sidebar-overlay'); 13166 $sidebar_wrapper.addClass(skin); 13167 var sideHeadH = $side_header.outerHeight(), 13168 sideFooterH = $side_footer.outerHeight(); 13169 if ( data_w !== '' && data_w > 0 ) { 13170 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 13171 $sidebar.css({ 13172 'max-width': data_w 13173 }); 13174 } else { 13175 $sidebar.css({ 13176 'max-width':'none' 13177 }); 13178 } 13179 } 13180 $vc_row.css({ 13181 'padding-top':sideHeadH, 13182 'padding-bottom':sideFooterH 13183 }); 13184 var sidew = $sidebar.width(); 13185 $inside_row.css({ 13186 width: sidew 13187 }); 13188 switchMobile = true; 13189 } else { 13190 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 13191 scrollTop = $('html, body').scrollTop(); 13192 $grid.add($body).removeClass('ajax-hide-filters'); 13193 } 13194 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 13195 $grid.addClass('ajax-hide-filters-blanks'); 13196 $sidebar.hide(); 13197 } 13198 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 13199 $('.ajax-sidebar-placeholder', $grid).remove(); 13200 sidebar_overlay = false; 13201 $body.removeClass('ajax-filter-sidebar-overlay'); 13202 $sidebar_wrapper.removeClass(skin); 13203 if ( data_w !== '' && data_w > 0 ) { 13204 $sidebar.css({ 13205 'max-width':'none' 13206 }); 13207 } 13208 $vc_row.css({ 13209 'padding-top':0, 13210 'padding-bottom':0, 13211 }); 13212 13213 $inside_row.css({ 13214 width: '' 13215 }); 13216 13217 if ( f_editor === true ) { 13218 UNCODE.ajax_filters(); 13219 } 13220 13221 switchMobile = false; 13222 } 13223 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 13224 $('html, body').scrollTop(scrollTop); 13225 } 13226 }; 13227 13228 var sidebar_width = function(){ 13229 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 13230 sidebar_w = $footprint.width(); 13231 $sidebar.css({ width: sidebar_w }); 13232 } else { 13233 $sidebar.css({ width: '' }); 13234 } 13235 }; 13236 sidebar_width(); 13237 13238 if ( SiteParameters.is_frontend_editor ) { 13239 ajax_sidebar_position(); 13240 } 13241 13242 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 13243 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 13244 ajax_sidebar_position(e); 13245 } 13246 sidebar_width(); 13247 }); 13248 13249 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 13250 ajax_sidebar_position(e, true); 13251 }); 13252 13253 $isotope_wrapper.on('transitionend', function(e){ 13254 if ( $(e.target).hasClass('isotope-wrapper') ) { 13255 window.dispatchEvent(new CustomEvent('boxResized')); 13256 } 13257 return false; 13258 }); 13259 13260 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 13261 var $grid = $('.ajax-grid-system').eq(0); 13262 $grid.addClass('ajax-hide-filters'); 13263 } 13264 13265 }); 13266 }; 13267 13268 init_ajax_grid(); 13269 $(document).on('uncode-ajax-filtered', init_ajax_grid); 13270 13271/************************* 13272 * 13273 * Hover hack 13274 * 13275 ************************/ 13276 var widget_hover_hack = function() { 13277 $('.widget, .uncode_widget').each(function(){ 13278 var $widget = $(this), 13279 class_w = $widget.attr('class'), 13280 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 13281 $footer = $widget.closest('#colophon'); 13282 13283 if ( class_w.indexOf('widget_yith') > 0 ) { 13284 return true; 13285 } 13286 13287 $lis.each(function(){ 13288 var $li = $(this), 13289 $a = $('a', $li), 13290 $label = $a.closest('label'); 13291 13292 if ( !$footer.length ) { 13293 $li.addClass('no-evts'); 13294 } 13295 13296 if ( ! $('span', $a).length ) { 13297 $li.addClass( 'li-hover' ); 13298 } 13299 13300 $('li', $li).hover(function(e){ 13301 $(e.target).parents('li').each(function(){ 13302 $(this).addClass( 'parent-li-hover' ); 13303 }); 13304 }, function (e) { 13305 $(e.target).parents('li').each(function(key, val){ 13306 if ( key === 0) { 13307 $(val).removeClass( 'parent-li-hover' ); 13308 } 13309 }); 13310 }); 13311 13312 $li.off('mouseup').on('mouseup', function (e) { 13313 if (e.which !== 3) { 13314 e.stopPropagation(); 13315 var $a = $('a', this).first(); 13316 $a[0].click(); 13317 } 13318 }); 13319 }); 13320 }); 13321 } 13322 if (SiteParameters.disable_hover_hack !== '1') { 13323 widget_hover_hack(); 13324 $(document).on('uncode-ajax-filtered', widget_hover_hack); 13325 } 13326 13327/************************* 13328 * 13329 * Init Filters 13330 * 13331 ************************/ 13332 13333 function init_filters() { 13334 $(document).on('click', '.term-filter-link', function(e) { 13335 var _this = $(this); 13336 var widget = _this.closest('.uncode_widget'); 13337 var container = get_filters_container(); 13338 13339 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13340 return true; 13341 } 13342 13343 e.preventDefault(); 13344 13345 if (widget.hasClass('widget-ajax-filters--checkbox')) { 13346 _this.parent().find('input[type="checkbox"]').trigger('click'); 13347 } else { 13348 if (_this.hasClass('term-filter-link--active')) { 13349 _this.removeClass('term-filter-link--active'); 13350 } else { 13351 _this.addClass('term-filter-link--active'); 13352 13353 if (widget.hasClass('widget-ajax-filters--single')) { 13354 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 13355 } 13356 } 13357 13358 var url = _this.attr('href'); 13359 13360 reload_items(container, url, true); 13361 } 13362 }); 13363 13364 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 13365 var _this = $(this); 13366 var widget = _this.closest('.uncode_widget'); 13367 var link = _this.closest('.term-filter').find('.term-filter-link'); 13368 var url = link.attr('href'); 13369 var container = get_filters_container(); 13370 13371 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13372 window.location = url; 13373 return; 13374 } 13375 13376 if (widget.hasClass('widget-ajax-filters--single')) { 13377 widget.find('input[type="checkbox"]').each(function() { 13378 if (_this.attr('id') !== $(this).attr('id')) { 13379 $(this).prop('checked', false); 13380 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 13381 } 13382 }); 13383 } 13384 13385 if (_this.prop('checked')) { 13386 link.addClass('term-filter-link--active'); 13387 } else { 13388 link.removeClass('term-filter-link--active'); 13389 } 13390 13391 reload_items(container, url, true); 13392 }); 13393 13394 $(document).on('change', 'select.select--term-filters', function(e) { 13395 var _this = $(this); 13396 var selected = _this.find('option:selected'); 13397 var option = $(selected); 13398 var url = option.attr('data-term-filter-url'); 13399 var container = get_filters_container(); 13400 var widget = _this.closest('.uncode_widget'); 13401 13402 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13403 window.location = url; 13404 } else { 13405 reload_items(container, url, true); 13406 } 13407 }); 13408 13409 $(document).on('click', '.filter-list__link', function(e) { 13410 if (SiteParameters.is_frontend_editor) { 13411 return false;
13412 } 13413 13414 e.preventDefault(); 13415 13416 var _this = $(this); 13417 var container = get_filters_container(); 13418 var url = _this.attr('href'); 13419 reload_items(container, url, true); 13420 }); 13421 13422 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 13423 var _this = $(this); 13424 var container = get_filters_container(); 13425 var url = _this.attr('href'); 13426 reload_items(container, url, true); 13427 }); 13428 13429 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 13430 13431 var _this = $(this); 13432 var container = get_filters_container(); 13433 var url = _this.attr('href'); 13434 13435 if ( container.length ) { 13436 e.preventDefault(); 13437 reload_items(container, url, true); 13438 } 13439 }); 13440 13441 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 13442 var _this = $(this); 13443 var container = get_filters_container(); 13444 13445 if (container.length > 0) { 13446 e.preventDefault(); 13447 13448 var min_price = $('#min_price').val(); 13449 var max_price = $('#max_price').val(); 13450 var location = window.location; 13451 var url = location.href; 13452 var page_uri = location.origin + location.pathname; 13453 var is_filtered = page_uri !== url; 13454 13455 if (is_filtered) { 13456 url = remove_parameter_from_url(url, 'min_price'); 13457 url = remove_parameter_from_url(url, 'max_price'); 13458 } 13459 13460 var concat = page_uri === url ? '?' : '&'; 13461 var params = {'min_price': min_price, 'max_price': max_price}; 13462 13463 url = url + concat + $.param(params); 13464 13465 reload_items(container, url, true); 13466 } 13467 }); 13468 13469 var search_timer; 13470 13471 $(document).on('keyup', '.term-filters-search-input', function(e) { 13472 var _this = $(this); 13473 var container = get_filters_container(); 13474 var value = _this.val(); 13475 13476 if (search_timer) { 13477 clearTimeout(search_timer); 13478 } 13479 13480 search_timer = setTimeout(function() { 13481 update_search_url(container, value); 13482 }, 500); 13483 }); 13484 } 13485 13486 function update_search_url(container, search_value) { 13487 var location = window.location; 13488 var url = location.href; 13489 var page_uri = location.origin + location.pathname; 13490 var is_filtered = page_uri !== url; 13491 var key_search = SiteParameters.ajax_filter_key_search; 13492 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 13493 13494 if (is_filtered) { 13495 url = remove_parameter_from_url(url, key_search); 13496 url = remove_parameter_from_url(url, key_unfilter); 13497 } 13498 13499 if (search_value) { 13500 var concat = page_uri === url ? '?' : '&'; 13501 var params = {}; 13502 13503 params[key_search] = search_value; 13504 params[key_unfilter] = 1; 13505 url = url + concat + $.param(params); 13506 } else { 13507 url = remove_parameter_from_url(url, key_search); 13508 } 13509 13510 reload_items(container, url, true); 13511 } 13512 13513 function remove_parameter_from_url(url, parameter) { 13514 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 13515 } 13516 13517 function get_filters_container() { 13518 var container = $('.ajax-grid-system'); 13519 13520 if (container.length == 0) { 13521 container = $('.ajax-filters'); 13522 } 13523 13524 return container; 13525 } 13526 13527 function update_widgets_state(widgets_states, container) { 13528 for (var i = widgets_states.length - 1; i >= 0; i--) { 13529 var state = widgets_states[i]; 13530 13531 if (!state.collapse) { 13532 continue; 13533 } 13534 13535 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 13536 13537 if (state.open) { 13538 new_widget.find('.widget-title').addClass('open'); 13539 if (state.css) { 13540 new_widget.find('.widget-collapse-content').attr('style', state.css); 13541 } 13542 } else { 13543 new_widget.find('.widget-title').removeClass('open'); 13544 if (state.css) { 13545 new_widget.find('.widget-collapse-content').attr('style', state.css); 13546 } 13547 } 13548 } 13549 } 13550 13551 // Reload items via AJAX 13552 function reload_items(container, url, push) { 13553 if (isAjaxing) { 13554 return 13555 }; 13556 13557 isAjaxing = true; 13558 13559 container.addClass('grid-filtering'); 13560 13561 $.ajax({ 13562 url : url, 13563 success : function(response) { 13564 if (!response) { 13565 return; 13566 } 13567 13568 $(document).trigger('uncode-ajax-pre-filtered'); 13569 13570 var container_id = container.attr('id'); 13571 var pagination = $('.row-navigation'); 13572 13573 if (container_id) { 13574 var container_to_append = $(response).find('#' + container_id); 13575 var pagination_to_append = $(response).find('.row-navigation'); 13576 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13577 13578 // Remember open/closed widgets 13579 var widgets = $('.uncode_widget'); 13580 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 13581 var widgets_states = []; 13582 13583 widgets.each(function() { 13584 var widget = $(this); 13585 var id = widget.attr('data-id'); 13586 var state = { 13587 'id': id, 13588 'collapse': false, 13589 'open': false, 13590 'css': false, 13591 }; 13592 13593 var collapse_wrapper = widget.find('.widget-collapse-content'); 13594 13595 if (collapse_wrapper.length > 0) { 13596 state.collapse = true; 13597 13598 var collapse_wrapper_css = collapse_wrapper.attr('style'); 13599 var title = widget.find('.widget-title'); 13600 13601 state.css = collapse_wrapper_css; 13602 13603 if (title.hasClass('open')) { 13604 state.open = true; 13605 } else { 13606 state.open = false;
13607 } 13608 } 13609 13610 widgets_states.push(state); 13611 }); 13612 13613 // Update widgets state 13614 if (offcanvas_sidebar_wrapper.length === 0) { 13615 update_widgets_state(widgets_states, container_to_append); 13616 } 13617 13618 // Update default sidebar state 13619 if (!container.hasClass('ajax-hide-filters')) { 13620 container_to_append.removeClass('ajax-hide-filters'); 13621 } 13622 13623 // Update horizontal sidebar 13624 if (!container.hasClass('ajax-hide-filters-blanks')) { 13625 container_to_append.removeClass('ajax-hide-filters-blanks'); 13626 } 13627 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 13628 if (horizontal_sidebar_wrapper.length > 0) { 13629 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 13630 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 13631 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 13632 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 13633 13634 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 13635 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 13636 } 13637 13638 // Append container 13639 container.replaceWith(container_to_append); 13640 13641 // Hide first thumbnail until the new srcset is loaded 13642 if (SiteParameters.dynamic_srcset_active === '1') { 13643 container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations'); 13644 } 13645 13646 // Remove loading attribute to images 13647 container_to_append.find('img').attr('loading', ''); 13648 13649 // Append pagination 13650 if (pagination.length > 0) { 13651 if (pagination_to_append.length > 0) { 13652 pagination.html(pagination_to_append.html()); 13653 } else { 13654 pagination.html(''); 13655 } 13656 } else { 13657 if (pagination_to_append.length > 0) { 13658 $('.post-wrapper').append(pagination_to_append); 13659 } 13660 } 13661 13662 // Update off canvas sidebar (mobile and overlay) 13663 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13664 13665 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 13666 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 13667 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 13668 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 13669 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 13670 13671 // Update widgets state 13672 update_widgets_state(widgets_states, sidebar_to_append); 13673 13674 // Update sidebar 13675 sidebar_container.html(sidebar_to_append.html()); 13676 } 13677 13678 if (push) { 13679 UNCODE.lastURL = url; 13680 window.history.pushState( 13681 { pageTitle: document.title }, 13682 '', 13683 url 13684 ); 13685 } 13686 13687 if (typeof UNCODE.isotopeLayout !== 'undefined') { 13688 UNCODE.isotopeLayout(); 13689 } 13690 if (typeof UNCODE.justifiedGallery !== 'undefined') { 13691 UNCODE.justifiedGallery(); 13692 } 13693 if (typeof UNCODE.cssGrid !== 'undefined') { 13694 UNCODE.cssGrid(); 13695 } 13696 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 13697 UNCODE.lightbox(); 13698 } 13699 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 13700 UNCODE.lightgallery(); 13701 } 13702 if (typeof UNCODE.carousel !== 'undefined') { 13703 UNCODE.carousel($('body')); 13704 } 13705 UNCODE.animations(); 13706 if (typeof UNCODE.filters !== 'undefined') { 13707 UNCODE.filters(); 13708 } 13709 if (typeof UNCODE.widgets !== 'undefined') { 13710 UNCODE.widgets(); 13711 } 13712 13713 if (SiteParameters.dynamic_srcset_active === '1') { 13714 UNCODE.refresh_dynamic_srcset_size(); 13715 } 13716 13717 if (typeof UNCODE.menuSmartInit !== 'undefined') { 13718 UNCODE.menuSmartInit(); 13719 } 13720 13721 if (typeof UNCODE.parallax !== 'undefined') { 13722 UNCODE.parallax(); 13723 } 13724 13725 maybe_scroll_to_top(); 13726 13727 var woo_select2_cats = $('.dropdown_product_cat'); 13728 13729 if (woo_select2_cats.length > 0) { 13730 woo_select2_cats.on( 'change', function() { 13731 if ( $(this).val() != '' ) { 13732 var this_page = ''; 13733 var home_url = UncodeWCParameters.uncode_wc_widget_product_categories_home_url; 13734 if ( home_url.indexOf( '?' ) > 0 ) { 13735 this_page = home_url + '&product_cat=' + $(this).val(); 13736 } else { 13737 this_page = home_url + '?product_cat=' + $(this).val(); 13738 } 13739 location.href = this_page; 13740 } else { 13741 location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url; 13742 } 13743 }); 13744 13745 if ( $().selectWoo ) { 13746 var wc_product_cat_select = function() { 13747 woo_select2_cats.selectWoo( { 13748 placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder, 13749 minimumResultsForSearch: 5, 13750 width: '100%', 13751 allowClear: true, 13752 language: { 13753 noResults: function() { 13754 return UncodeWCParameters.uncode_wc_widget_product_categories_no_results; 13755 } 13756 } 13757 } ); 13758 }; 13759 wc_product_cat_select(); 13760 } 13761 } 13762 13763 $(document).trigger('uncode-ajax-filtered'); 13764 $(document.body).trigger('init_price_filter'); 13765 window.dispatchEvent(new CustomEvent('uncode-ajax-filtered')); 13766 window.document.dispatchEvent(new Event("DOMContentLoaded", { 13767 bubbles: true, 13768 cancelable: true 13769 })); 13770 13771 isAjaxing = false;
13772 } 13773 }, 13774 error: function() { 13775 container.removeClass('grid-filtering'); 13776 13777 isAjaxing = false; 13778 13779 if (SiteParameters.enable_debug == true) { 13780 // This console log is disabled by default 13781 // So nothing is printed in a typical installation 13782 // 13783 // It can be enabled for debugging purposes setting 13784 // the 'uncode_enable_debug_on_js_scripts' filter to true 13785 console.log('There was an error retrieving the products'); 13786 } 13787 } 13788 }); 13789 } 13790 13791 // Scroll to top after filtering 13792 function maybe_scroll_to_top() { 13793 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13794 13795 if (offcanvas_sidebar_wrapper.length > 0) { 13796 return; 13797 } 13798 13799 var container = get_filters_container(); 13800 var bound = container[0].getBoundingClientRect(); 13801 13802 if (bound.y < 0) { 13803 $(window).scrollTop(container.offset().top); 13804 } 13805 } 13806 13807 // Back/forward browser buttons 13808 $(window).on("popstate.ajaxfilters", function(e) { 13809 var location = window.location; 13810 var url = location.href; 13811 var params = UNCODE.getURLParams(window.location); 13812 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 13813 13814 UNCODE.lastURL = url; 13815 13816 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) { 13817 return; 13818 } 13819 13820 var container = get_filters_container(); 13821 13822 reload_items(container, url, false); 13823 }); 13824 13825 // Destroy load more before to init a new one 13826 $(window).on('uncode-ajax-pre-filtered', function() { 13827 if ($.fn.infinitescroll) { 13828 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 13829 } 13830 }); 13831 13832 init_filters(); 13833}; 13834 13835UNCODE.videoThumbs = function() { 13836 var checkResize, 13837 newW = UNCODE.wwidth; 13838 var checkForVideos = function(){ 13839 13840 $(window).on('okevents.y.change', function(e, y){ 13841 var $video = $(y.target.g), 13842 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13843 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13844 restart = !$video_wrap.hasClass('play-pause'), 13845 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13846 setTime; 13847 if ( newW >= UNCODE.mediaQuery ) { 13848 13849 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 13850 $video_wrap.data('hovered', true); 13851 $video_wrap.addClass('played-on'); 13852 y.target.pauseVideo(); 13853 $tmb.on('mouseenter', function(){ 13854 if ( restart ) { 13855 y.target.seekTo(0); 13856 } 13857 y.target.playVideo(); 13858 }).on('mouseleave', function(){ 13859 clearTimeout(setTime); 13860 setTime = setTimeout(function(){ 13861 y.target.pauseVideo(); 13862 }, 300); 13863 }); 13864 } 13865 13866 } else { 13867 if( $mobile_video_wrap.length ) { 13868 $video_wrap.addClass('played-on'); 13869 y.target.playVideo(); 13870 } 13871 } 13872 13873 }); 13874 13875 $(window).on('okevents.v.loaded', function(e, playerV){ 13876 var $video = $(playerV.element), 13877 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13878 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13879 restart = !$video_wrap.hasClass('play-pause'), 13880 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13881 setTime; 13882 13883 if ( newW >= UNCODE.mediaQuery ) { 13884 13885 if( $video_wrap.length ) { 13886 13887 var playPromise = playerV.play(); 13888 if (playPromise !== undefined) { 13889 playPromise.then(function( value ) { 13890 playerV.pause(); 13891 }); 13892 } 13893 $video_wrap.addClass('played-on'); 13894 $tmb.on('mouseenter', function(){ 13895 if ( restart ) { 13896 playerV.setCurrentTime(0) 13897 } 13898 playerV.play(); 13899 }).on('mouseleave', function(){ 13900 clearTimeout(setTime); 13901 setTime = setTimeout(function(){ 13902 playerV.pause(); 13903 }, 300); 13904 }); 13905 } 13906 13907 } else { 13908 13909 if( $mobile_video_wrap.length ) { 13910 var playPromise = playerV.play(); 13911 if (playPromise !== undefined) { 13912 playPromise.then(function( value ) { 13913 playerV.play(); 13914 }); 13915 } 13916 $video_wrap.addClass('played-on'); 13917 } 13918 } 13919 }); 13920 13921 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 13922 var $video = $(video), 13923 $noscript = $('noscript', $video), 13924 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13925 restart = !$video_wrap.hasClass('play-pause'), 13926 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13927 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
13927: $video.closest('.t-entry-visual, .un-inline-image'), 13928 setTime, 13929 manageVideo = function(){ 13930 video.currentTime = 0; 13931 video.pause(); 13932 if ( newW >= UNCODE.mediaQuery ) { 13933 if ( $video_wrap.length ) { 13934 $video_wrap.addClass('played-on'); 13935 $tmb.on('mouseenter', function(){ 13936 if ( restart ) { 13937 video.currentTime = 0; 13938 } 13939 video.play(); 13940 }).on('mouseleave', function(){ 13941 clearTimeout(setTime); 13942 setTime = setTimeout(function(){ 13943 video.pause(); 13944 }, 300); 13945 }); 13946 } else { 13947 video.play(); 13948 } 13949 } else { 13950 if ( $mobile_video_wrap.length ) { 13951 $mobile_video_wrap.addClass('played-on'); 13952 video.play(); 13953 } 13954 } 13955 13956 }; 13957 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 13958 $noscript.each(function(key, val){ 13959 $noscript.after(val.textContent || val.innerText || val.innerHTML); 13960 $noscript.remove(); 13961 }); 13962 } 13963 13964 if (typeof MediaElement === "function") { 13965 $video.has('source[src]').mediaelementplayer({ 13966 pauseOtherPlayers: false, 13967 }); 13968 } 13969 if (video.readyState > 0) { 13970 manageVideo(); 13971 } else { 13972 $video.on("loadedmetadata", function(_event) { 13973 manageVideo(); 13974 }); 13975 }; 13976 }); 13977 13978 }; 13979 13980 checkForVideos(); 13981 13982 var checkVideoResize = function(){ 13983 clearRequestTimeout(checkResize); 13984 checkResize = requestTimeout(function(){ 13985 if ( newW !== UNCODE.wwidth ) { 13986 checkForVideos(); 13987 newW = UNCODE.wwidth; 13988 } 13989 }, 1000); 13990 }; 13991 13992 $(window).off('resize.videos', checkVideoResize) 13993 .on( 'resize.videos', checkVideoResize); 13994 13995 $(window).off('more-items-loaded.videos', checkForVideos) 13996 .on('more-items-loaded.videos', checkForVideos); 13997 13998 $(document).off('uncode-ajax-filtered.videos', checkForVideos) 13999 .on('uncode-ajax-filtered.videos', checkForVideos); 14000 14001}; 14002UNCODE.inlineImgs = function() { 14003 var linkInlineImgs = function(){ 14004 $('.un-inline-image').each(function(){ 14005 var $img = $(this), 14006 href = $(this).attr('data-link-href'), 14007 dataImg = $img.data(); 14008 if ( dataImg != '' && href != null && href !== '' ) { 14009 var class_stra_a = 'unline-image-link'; 14010 if ( $(this).hasClass('un-inline-space-over') ) { 14011 class_stra_a += ' un-inline-space-over'; 14012 } else if ( $(this).hasClass('un-inline-space-gutter') ) { 14013 class_stra_a += ' un-inline-space-gutter'; 14014 } 14015 var str_a = '<a class="' + class_stra_a + '" '; 14016 for (var key in dataImg) { 14017 if (dataImg.hasOwnProperty(key) && key.startsWith("link")) { 14018 str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\""; 14019 } 14020 } 14021 str_a += ' />'; 14022 $img.wrap(str_a); 14023 } 14024 }); 14025 }; 14026 $(window).on('load', linkInlineImgs ); 14027}; 14028UNCODE.lottie = function() { 14029 if ( SiteParameters.is_frontend_editor ) { 14030 var $lottie_wraps = $('div.uncode-lottie-wrap'); 14031 $lottie_wraps.each(function(){ 14032 var $lottie_wrap = $(this), 14033 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 14034 $player_clone = $div_player.clone(), 14035 player_id = $div_player.attr('data-id'), 14036 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 14037 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 14038 if ( $('#'+player_id).length ) { 14039 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 14040 } 14041 $player_clone.attr('id', player_id); 14042 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 14043 $div_player.after($player_clone); 14044 $div_player.attr('data-init',true); 14045 } 14046 }); 14047 } 14048 var $players = $('.uncode-lottie-wrap lottie-player'); 14049 $players.each(function(){ 14050 var player = this, 14051 this_id = $(player).attr('id'), 14052 _player = document.getElementById(this_id), 14053 trigger = $(player).attr('data-trigger'), 14054 pFrames = $(player).attr('data-frames').split(','), 14055 srcPlayer = $(player).attr('src'); 14056 14057 _player.load(srcPlayer); 14058 14059 _player.addEventListener("ready", function() { 14060 14061 var $_shadow = _player.shadowRoot; 14062 $($_shadow).find('.error').remove(); 14063 14064 var tFrames = _player.getLottie().totalFrames / 100, 14065 pFrame_from = Math.round(tFrames * pFrames[0]), 14066 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 14067 loop = $(player).attr('loop'), 14068 mode, 14069 actions; 14070 14071 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 14072 if ( trigger === 'scroll' ) { 14073 mode = 'scroll'; 14074 actions = [ 14075 { 14076 visibility:[0, 1.0], 14077 type: "seek",
14078 frames: [pFrame_from, pFrame_to], 14079 } 14080 ]; 14081 } else if ( trigger === 'viewport') { 14082 mode = 'scroll'; 14083 actions = [ 14084 { 14085 visibility: [0.20, 1.0], 14086 frames: [pFrame_from, pFrame_to], 14087 type: loop ? "loop" : "play" 14088 } 14089 ]; 14090 } else if ( trigger === 'hover') { 14091 $(player).on('mouseenter', function(){ 14092 _player.play(); 14093 }).on('mouseleave', function(){ 14094 _player.pause(); 14095 }); 14096 if ( pFrame_from > 0 && pFrame_from < 99 ) { 14097 _player.seek(pFrame_from); 14098 _player.addEventListener("frame", function(){ 14099 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14100 _player.seek(pFrame_from); 14101 } 14102 }); 14103 } 14104 } 14105 LottieInteractivity.create({
14106 player: '#' + this_id, 14107 mode: mode, 14108 actions: actions 14109 }); 14110 } else { 14111 if ( pFrame_from > 0 && pFrame_from < 99 ) { 14112 _player.seek(pFrame_from); 14113 _player.addEventListener("frame", function(){ 14114 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14115 _player.seek(pFrame_from); 14116 } 14117 }); 14118 } 14119 } 14120 }); 14121 14122 $(window).on('unlottie-destroy', function(){ 14123 _player.destroy(); 14124 }); 14125 }); 14126}; 14127 14128UNCODE.animatedBgGradient = function( _el ) { 14129 14130 var ev; 14131 14132 if ( typeof _el === 'undefined' || _el === null ) { 14133 _el = document; 14134 ev = false; 14135 } else { 14136 _el = _el[0]; 14137 ev = 'shortcode:update'; 14138 } 14139 14140 var simplex = new SimplexNoise(); 14141 14142 var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) { 14143 this.block = blockOverlay; 14144 this.wrap = canvasWrap; 14145 this.config(); 14146 this.checker(); 14147 this.loopRAF(); 14148 this.animLoader(); 14149 }; 14150 14151 var AnimGradient = Uncode_BG_Animated_Gradient.prototype; 14152 14153 AnimGradient.config = function() { 14154 this.canvas = document.createElement('canvas'); 14155 this.wrap.appendChild(this.canvas); 14156 this.ctx = this.canvas.getContext('2d'); 14157 this.count = 0; 14158 this.isOrientationChanged = false; 14159 this.res = UNCODE.isMobile ? 90 : 110; 14160 this.resPercent = 100/this.res; 14161 this.resAround = this.resPercent/100; 14162 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; 14163 14164 this.canvas.classList.add('uncode-bg-animated-gradient'); 14165 this.canvas.setAttribute('height', this.res); 14166 this.canvas.setAttribute('width', this.res); 14167 this.canvas.style = 'height: 100%; position: relative; width:100%;'; 14168 14169 this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); 14170 14171 this.cx = this.canvas.width/2; 14172 this.cy = this.canvas.height/2; 14173 this.data = this.imgdata.data; 14174 14175 this.opts = { 14176 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, 14177 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, 14178 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 14179 }; 14180 14181 this.lavaTime = 1; 14182 this.bg_colors = []; 14183 14184 if ( this.opts.col_1st === false && this.opts.col_2nd === false ) { 14185 return; 14186 } 14187 14188 if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) { 14189 this.singleColor = true; 14190 } 14191 14192 if( this.opts.col_1st ) { 14193 14194 var rgbColor1 = this.hexToRGB(this.opts.col_1st); 14195 14196 this.bg_colors.push({ 14197 r: rgbColor1.r, 14198 g: rgbColor1.g, 14199 b: rgbColor1.b 14200 }); 14201 } 14202 14203 if( this.opts.col_2nd ) { 14204 14205 var rgbColor2 = this.hexToRGB(this.opts.col_2nd); 14206 14207 this.bg_colors.push({ 14208 r: rgbColor2.r, 14209 g: rgbColor2.g, 14210 b: rgbColor2.b 14211 }); 14212 } 14213 14214 }; 14215 14216 AnimGradient.checker = function() { 14217 var scope = this; 14218 this.checkInViewPort(); 14219 14220 window.addEventListener('resize', function() { 14221 if(UNCODE.isMobile && !scope.isOrientationChanged) { 14222 return; 14223 } 14224 scope.ratioCalc(); 14225 }); 14226 14227 window.addEventListener("orientationchange", function() { 14228 scope.isOrientationChanged = true; 14229 }); 14230 14231 this.ratioCalc(); 14232 }; 14233 14234 AnimGradient.ratioCalc = function() { 14235 14236 var blockW = this.block.clientWidth, 14237 blockH = this.block.clientHeight; 14238 14239 var blockRatio = blockH/blockW; 14240 14241 if(blockRatio < 1) { 14242 this.ratioParam = { 14243 x: 1.4, 14244 y: blockRatio*1.4 14245 } 14246 } else { 14247 this.ratioParam = { 14248 x: blockRatio/3, 14249 y: 1 14250 } 14251 } 14252 14253 }; 14254 14255 AnimGradient.checkInViewPort = function() { 14256 if( 'IntersectionObserver' in window ) { 14257 var scope = this, 14258 observer = new IntersectionObserver(function(entries) { 14259
14260 entries.forEach(function(entry){ 14261 if ( entry.isIntersecting ) { 14262 scope.isInViewport = true; 14263 } else { 14264 scope.isInViewport = false; 14265 } 14266 }); 14267 14268 }, { 14269 root: document, 14270 }); 14271 14272 observer.observe(this.block); 14273 } 14274 }; 14275 14276 AnimGradient.hexToRGB = function(hexval) { 14277 var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval); 14278 if (!hexecuted) { 14279 return false; 14280 } 14281 return { 14282 r: parseInt(hexecuted[1], 16), 14283 g: parseInt(hexecuted[2], 16), 14284 b: parseInt(hexecuted[3], 16) 14285 } 14286 }; 14287 14288 AnimGradient.factor = function(val_1, val_2, lava) { 14289 return val_1 * (1 - lava) + val_2 * lava; 14290 }; 14291 14292 AnimGradient.factorNoise = function(wave_l, x, y, noise) { 14293 if (this.singleColor) { 14294 return this.bg_colors[0][wave_l]; 14295 } 14296 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 ); 14297 // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) ); 14298 }; 14299 14300 AnimGradient.lava = function(x, y, grade) { 14301 var radians = (Math.PI / 180) * grade, 14302 cos = Math.cos(radians), 14303 sin = Math.sin(radians), 14304 nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx; 14305 return nx; 14306 }; 14307 14308 AnimGradient.loopRAF = function() { 14309 14310 var scope = this; 14311 14312 if( this.isInViewport ) { 14313 for (var x = 0; x < this.res; x++) { 14314 for (var y = 0; y < this.res; y++) { 14315 14316 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 14317 14318 this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise); 14319 this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise); 14320 this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise); 14321 this.data[(x + y * this.res) * 4 + 3] = noise*265; 14322 14323 } 14324 } 14325 14326 this.count++; 14327 14328 this.ctx.putImageData(this.imgdata, 0, 0); 14329 14330 } 14331 14332 requestAnimationFrame(function() { 14333 scope.loopRAF(); 14334 }); 14335 }; 14336 14337 AnimGradient.animLoader = function() { 14338 this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded'); 14339 }; 14340 14341 var anim_init = function() { 14342 var bgs = _el.querySelectorAll('.block-bg-overlay'); 14343 14344 bgs.forEach(function(blockOverlay) { 14345 var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap'); 14346 if( !blockOverlay || !canvasWrap ) { 14347 return; 14348 } 14349 new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap); 14350 }); 14351 } 14352 14353 $(window).on('load', function(){ 14354 anim_init(); 14355 }); 14356 14357 if ( ev === 'shortcode:update' ) { 14358 anim_init(); 14359 } 14360 14361}; 14362UNCODE.multibg = function(){ 14363 var $bgsWraps = $('.uncode-multi-bgs'), 14364 $body = $('body'); 14365 $bgsWraps.each(function(){ 14366 var $bgWrap = $(this), 14367 transition = $bgWrap.attr('data-transition'), 14368 transitionTime = $bgWrap.attr('data-transition-time'), 14369 dataPace = $bgWrap.attr('data-transition-pace'), 14370 dataThreshold = $bgWrap.attr('data-transition-threshold'), 14371 dataTime = $bgWrap.attr('data-carousel-time'), 14372 dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'), 14373 random = $bgWrap.attr('data-multi-random'), 14374 _bgWrap = $bgWrap[0], 14375 $multiBgs = $('.multi-background', $bgWrap), 14376 imgFirst, 14377 bgAmount = $multiBgs.length, 14378 isInViewport = false, 14379 lastScrollTop = 0, 14380 counter = 0, 14381 totMove = 0, 14382 autoScroll = typeof dataPace === 'undefined' && transition === 'scroll', 14383 pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ), 14384 threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0, 14385 offX, offY, 14386 wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250, 14387 carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000, 14388 requestCarousel, 14389 is_header = $bgWrap.closest('#page-header').length, 14390 startTime = new Date(); 14391 14392 transition = typeof transition === 'undefined' ? '' : transition; 14393 14394 if ( random === 'true' ) { 14395 UNCODE.shuffle($multiBgs); 14396 } 14397 14398 imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, ""); 14399 14400 var loadFirst = function(){
14401 $multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({ 14402 opacity: 1 14403 }, 250, 'easeInQuad').css({ 14404 zIndex: 1 14405 }); 14406 } 14407 14408 var loadError = function(){ 14409 console.log('Multi BG loading error'); 14410 } 14411 14412 UNCODE.checkImgLoad( imgFirst, loadFirst, loadError ); 14413 14414 var loadSlides = function( $thisBg ){ 14415 $thisBg.attr('data-load', 'loaded'); 14416 } 14417 14418 $multiBgs.not('[data-load="loaded"]').each(function(ind, val){ 14419 var $thisBg = $(val); 14420 14421 if ( typeof $thisBg !== 'undefined' && $thisBg.length ) { 14422 14423 var _imgBg = $(val).find('.background-inner').css('background-image'); 14424 14425 if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) { 14426 $thisBg.attr('data-load', 'loaded'); 14427 } else { 14428 _imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, ""); 14429 if ( typeof _imgBg !== 'undefined' ) { 14430 UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg ); 14431 } 14432 } 14433 } 14434 }); 14435 14436 var multiCarousel = function(e) { 14437 14438 clearRequestTimeout(requestCarousel); 14439 14440 var checkTime = new Date(); 14441 if ( checkTime - startTime >= carouselTime && isInViewport ) { 14442 var $checkEl = $multiBgs.eq((counter+1)%bgAmount); 14443 14444 if ( $checkEl.attr('data-load') !== 'loaded' ) { 14445 requestTimeout(function(){
14446 multiCarousel(); 14447 }, 100); 14448 return; 14449 } 14450 14451 counter++; 14452 14453 $multiBgs.each(function(ind, val){ 14454 if ( ind === counter%bgAmount ) { 14455 $(val).stop(true,false).animate({ 14456 opacity: 1 14457 }, wait, 'easeInQuad').css({ 14458 zIndex: 1 14459 }); 14460 } else { 14461 $(val).stop(true,false).animate({ 14462 opacity: 0 14463 }, wait, 'easeInQuad').css({ 14464 zIndex: 0 14465 }); 14466 } 14467 }); 14468 14469 } 14470 14471 if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 14472 requestCarousel = requestTimeout(multiCarousel, carouselTime); 14473 } 14474 14475 }; 14476 14477 var multiMove = function(e) { 14478 if ( $body.hasClass('navbar-hover') ) { 14479 return; 14480 } 14481 var checkTime = new Date(), 14482 bound = $bgWrap[0].getBoundingClientRect(), 14483 windowTop = (window.clientYOffset || document.documentElement.scrollTop); 14484 if (offX) { 14485 totMove += Math.sqrt( 14486 Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2) 14487 ); 14488 } 14489 if ( 14490 totMove >= pace && 14491 checkTime - startTime >= wait && 14492 e.clientX <= (bound.left + bound.width) && 14493 e.clientX >= bound.left && 14494 e.clientY <= (bound.top + bound.height) && 14495 e.clientY >= bound.top 14496 ) { 14497 counter++; 14498 startTime = checkTime; 14499 $multiBgs.each(function(ind, val){ 14500 if ( ind === counter%bgAmount ) { 14501 $(val).stop(true,false).animate({ 14502 opacity: 1 14503 }, wait, 'easeInQuad').css({ 14504 zIndex: 1 14505 }); 14506 } else { 14507 $(val).stop(true,false).animate({ 14508 opacity: 0 14509 }, wait, 'easeInQuad').css({ 14510 zIndex: 0 14511 }); 14512 } 14513 }); 14514 14515 totMove = 0; 14516 } 14517 14518 offX = e.clientX; 14519 offY = e.clientY; 14520 14521 }; 14522 14523 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14524 document.addEventListener("mousemove", multiMove); 14525 } 14526 14527 window.addEventListener('resize', function() { 14528 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14529 document.removeEventListener("mousemove", multiMove); 14530 document.addEventListener("mousemove", multiMove); 14531 } 14532 }); 14533 14534 var lightLoopRAF = function() { 14535 14536 var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), 14537 checkTime = new Date(), 14538 bound = $bgWrap[0].getBoundingClientRect(), 14539 thresholdHeader = is_header ? 100 : threshold, 14540 rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace); 14541 if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) { 14542 counter++; 14543 lastScrollTop = scrollTop; 14544 startTime = checkTime; 14545 14546 $multiBgs.each(function(ind, val){ 14547 if ( ind === counter%bgAmount ) { 14548 $(val).stop(true,false).animate({ 14549 opacity: 1 14550 }, wait, 'easeInQuad').css({ 14551 zIndex: 1 14552 }); 14553 } else { 14554 $(val).stop(true,false).animate({ 14555 opacity: 0 14556 }, wait, 'easeInQuad').css({ 14557 zIndex: 0 14558 }); 14559 } 14560 }); 14561 14562 } 14563 14564 requestAnimationFrame(function() { 14565 if ( isInViewport ) { 14566 lightLoopRAF(); 14567 } 14568 }); 14569 }; 14570 14571 var currentInd = 0; 14572 14573 var loopRAF = function() { 14574 14575 var multiBgRotate = function(slideInd){ 14576 currentInd = slideInd; 14577 $multiBgs.each(function(ind, val){ 14578 if ( ind === slideInd ) { 14579 $(val).stop(true,false).animate({ 14580 opacity: 1 14581 }, wait, 'easeInQuad').css({ 14582 zIndex: 1 14583 }); 14584 } else { 14585 $(val).stop(true,false).animate({ 14586 opacity: 0 14587 }, wait, 'easeInQuad').css({ 14588 zIndex: 0 14589 }); 14590 } 14591 }); 14592 }; 14593 var bound = $bgWrap[0].getBoundingClientRect(), 14594 thresholdPX = UNCODE.wheight * threshold / 100, 14595 totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))), 14596 movePX = totMove / bgAmount, 14597 moving = UNCODE.wheight - (bound.top + thresholdPX), 14598 slideInd = 0; 14599 14600 if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) { 14601 multiBgRotate(0); 14602 } else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) { 14603 multiBgRotate(bgAmount-1); 14604 } else { 14605 slideInd = Math.ceil(moving/movePX) - 1; 14606 if ( slideInd < 0 ) { 14607 slideInd = 0; 14608 } else if ( slideInd >= bgAmount ) { 14609 slideInd = bgAmount-1; 14610 } 14611 if ( slideInd !== currentInd ) { 14612 multiBgRotate(slideInd); 14613 } 14614 } 14615 14616 requestAnimationFrame(function() { 14617 if ( isInViewport ) { 14618 loopRAF(); 14619 } 14620 }); 14621 }; 14622 14623 if( 'IntersectionObserver' in window ) { 14624 var observer = new IntersectionObserver(function(entries) { 14625
14626 entries.forEach(function(entry){ 14627 if ( entry.isIntersecting ) { 14628 isInViewport = true; 14629 if ( transition === 'scroll' ) { 14630 if ( autoScroll ) { 14631 loopRAF(); 14632 } else { 14633 lightLoopRAF(); 14634 } 14635 } else { 14636 multiCarousel(); 14637 } 14638 } else { 14639 isInViewport = false; 14640 } 14641 }); 14642 14643 }, { 14644 root: document, 14645 rootMargin: is_header ? '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px' 14646 }); 14647 14648 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14649 observer.observe(_bgWrap); 14650 } 14651 14652 window.addEventListener('resize', function() { 14653 observer.unobserve(_bgWrap); 14654 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14655 observer.observe(_bgWrap); 14656 } 14657 }); 14658 14659 } 14660 14661 }); 14662} 14663 14664UNCODE.owlNav = function(target, ev) { 14665 target = target.replace(/#\S+/g, ''); 14666 var $carousel = $('#'+target), 14667 $slider = $carousel.closest('.uncode-slider'), 14668 $checkNavs = $('.uncode-owl-nav'); 14669 if ( !$checkNavs.length ) { 14670 return; 14671 } 14672 14673 if ( $slider.length ){ 14674 target = $slider.attr('id'); 14675 } 14676 14677 var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'), 14678 $row; 14679 14680 if ( ! $navs.length ) { 14681 $row = $carousel.closest('.vc_row.row-container'); 14682 $navs = $('.uncode-owl-nav:not([data-target])', $row); 14683 } 14684 14685 if ( ! $navs.length ) { 14686 return; 14687 } 14688 14689 $navs.each(function(){ 14690 var $nav = $(this), 14691 $outer = $nav.closest('.uncode-owl-nav-out'), 14692 $inner = $nav.find('.uncode-owl-nav-in'), 14693 $navDots = $('.uncode-nav-dots', $nav), 14694 $navCounter = $('.uncode-nav-counter', $nav), 14695 $counterIndex = $('.uncode-nav-counter-index', $navCounter), 14696 $counterTotal = $('.uncode-nav-counter-total', $navCounter), 14697 skinInherit = $nav.hasClass('skin-inherit'), 14698 digit = parseFloat($nav.attr('data-digit')), 14699 counterDigit = parseFloat($nav.attr('data-counter-digit')), 14700 navSpeed = parseFloat($carousel.attr('data-navspeed')); 14701 navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400; 14702 14703 if ( $nav.hasClass('pos-abs') ){ 14704 if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) { 14705 $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />'); 14706 } 14707 $carousel.closest('.owl-carousel-wrapper-nav').append($outer); 14708 } 14709 14710 $carousel.on('refreshed.owl.carousel', counter); 14711 $carousel.on('resized.owl.carousel', counter); 14712 $carousel.on('changed.owl.carousel', counter); 14713 14714 var totalSlides = 0; 14715 14716 function counter(event) { 14717 if (!event.namespace) { 14718 return; 14719 } 14720 var slides = event.relatedTarget, 14721 current = slides._current, 14722 loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop, 14723 item = event.item, 14724 page = event.page, 14725 countPages = Math.ceil(item.count / page.size), 14726 $currentSlide = $carousel.find('.owl-item').eq(current), 14727 itemIndex = Math.floor($currentSlide.attr('data-index')) , 14728 activeSlide = Math.ceil(itemIndex / page.size), 14729 $prev = $nav.find('.uncode-nav-prev'), 14730 $next = $nav.find('.uncode-nav-next'), 14731 $col = $currentSlide.find('.uncol').first(); 14732 14733 if ( totalSlides != countPages ) { 14734 totalSlides = countPages; 14735 $navDots.html(''); 14736 var nav_html = ''; 14737 for (var sl_ind = 0; sl_ind < countPages; sl_ind++) { 14738 var padN = sl_ind+1; 14739 if ( digit && digit > 1 ) { 14740 padN = String(padN).padStart(digit, '0'); 14741 } 14742 nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>'; 14743 } 14744 $navDots.html(nav_html); 14745 14746 var totalSlidesDigit = totalSlides; 14747 14748 if ( counterDigit && counterDigit > 1 ) { 14749 totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0'); 14750 } 14751 $counterTotal.html(totalSlidesDigit); 14752 } 14753 14754 if ( loop !== true ) { 14755 $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled'); 14756 if ( itemIndex === 1 ) { 14757 $prev.addClass('uncode-nav-disabled'); 14758 } else if ( ( itemIndex - 1 + page.size ) >= item.count ) { 14759 $next.addClass('uncode-nav-disabled');
14760 activeSlide = Math.ceil(item.count / page.size); 14761 } 14762 } 14763 14764 $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index'); 14765 var activeSlideDigit = activeSlide; 14766 14767 if ( counterDigit && counterDigit > 1 ) { 14768 activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0'); 14769 } 14770 $counterIndex.html(activeSlideDigit); 14771 14772 if ( skinInherit ) { 14773 if ( $col.hasClass('style-light') ){ 14774 $nav.removeClass('style-dark').addClass('style-light'); 14775 } else if ( $col.hasClass('style-dark') ) { 14776 $nav.removeClass('style-light').addClass('style-dark'); 14777 } 14778 } 14779 14780 $inner.removeClass('uncode-owl-nav-waiting'); 14781 14782 if ( $nav.hasClass('outer-width') ) { 14783 var navW = $nav.outerWidth(), 14784 nexW = $next.outerWidth(), 14785 prevW = $prev.outerWidth(), 14786 margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) ); 14787 14788 if ( $nav.hasClass('h-align-justify') ) { 14789 $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'}); 14790 if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) { 14791 $inner.css({'margin': 'auto'}); 14792 } else { 14793 $inner.css({'margin': ''}); 14794 } 14795 } else { 14796 $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'}); 14797 if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) { 14798 $inner.css({'margin': 'auto'}); 14799 } else { 14800 $inner.css({'margin': ''}); 14801 } 14802 } 14803 } 14804 } 14805 14806 $nav.on('click', '.uncode-nav-index', function(){ 14807 var $bullet = $(this), 14808 slide_index = parseFloat( $bullet.attr('data-key') ); 14809 $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]); 14810 }); 14811 $nav.on('click', '.uncode-nav-prev', function(){ 14812 $carousel.trigger('prev.owl.carousel', [navSpeed]); 14813 }); 14814 $nav.on('click', '.uncode-nav-next', function(){ 14815 $carousel.trigger('next.owl.carousel', [navSpeed]); 14816 }); 14817 14818 if ( $nav.hasClass('animated-arrows') ) { 14819 $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){ 14820 $(this).addClass("hover"); 14821 }).on('animationend', function(){ 14822 $(this).removeClass("hover"); 14823 }); 14824 } 14825 14826 var positionNav = function(){ 14827 if ( $nav.hasClass('window-width') ) { 14828 var navOff = parseFloat( $nav.offset().left ) * -1; 14829 if ( navOff > 0 ) { 14830 $inner.css({ transform: 'translateX(' + navOff + 'px)' }); 14831 } else { 14832 $inner.css({ transform: 'none' }); 14833 } 14834 } 14835 } 14836 positionNav(); 14837 $(window).on('resize', positionNav); 14838 }); 14839 14840 $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended'); 14841}; 14842 14843 UNCODE.init = function() { 14844 var wfl_check = false, wfl_request, waypoint_request; 14845 UNCODE.preventDoubleTransition(); 14846 UNCODE.betterResize(); 14847 UNCODE.utils(); 14848 UNCODE.magnetic(); 14849 if (typeof UNCODE.accessibility !== 'undefined') { 14850 UNCODE.accessibility(); 14851 } 14852 if (typeof UNCODE.rowParallax !== 'undefined') { 14853 UNCODE.rowParallax(); 14854 } 14855 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 14856 UNCODE.changeSkinOnScroll(); 14857 } 14858 if (typeof UNCODE.share !== 'undefined') { 14859 UNCODE.share(); 14860 } 14861 if (typeof UNCODE.tooltip !== 'undefined') { 14862 UNCODE.tooltip(); 14863 } 14864 if (typeof UNCODE.counters !== 'undefined') { 14865 UNCODE.counters(); 14866 } 14867 if (typeof UNCODE.countdowns !== 'undefined') { 14868 UNCODE.countdowns(); 14869 } 14870 if (typeof UNCODE.tabs !== 'undefined') { 14871 UNCODE.tabs(); 14872 } 14873 if (typeof UNCODE.collapse !== 'undefined') { 14874 UNCODE.collapse(); 14875 } 14876 if (typeof UNCODE.bigText !== 'undefined') { 14877 UNCODE.bigText(); 14878 } 14879 UNCODE.menuSystem(); 14880 if (typeof UNCODE.bgChanger !== 'undefined') { 14881 UNCODE.bgChanger(); 14882 } 14883 if (typeof UNCODE.magicCursor !== 'undefined') { 14884 UNCODE.magicCursor(); 14885 } 14886 if (typeof UNCODE.magneticCursor !== 'undefined') { 14887 UNCODE.magneticCursor(); 14888 } 14889 if (typeof UNCODE.dropImage !== 'undefined') { 14890 UNCODE.dropImage(); 14891 } 14892 if (typeof UNCODE.postTable !== 'undefined') { 14893 UNCODE.postTable(); 14894 } 14895 if (typeof UNCODE.rotatingTxt !== 'undefined') { 14896 UNCODE.rotatingTxt(); 14897 } 14898 if (typeof UNCODE.okvideo !== 'undefined') { 14899 UNCODE.okvideo(); 14900 window.addEventListener( "uncode-more-items-loaded", function() { 14901 UNCODE.okvideo("uncode-more-items-loaded"); 14902 }); 14903 } 14904 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 14905 UNCODE.backgroundSelfVideos(); 14906 } 14907 UNCODE.tapHover(); 14908 if (typeof UNCODE.isotopeLayout !== 'undefined') { 14909 UNCODE.isotopeLayout(); 14910 } 14911 if (typeof UNCODE.justifiedGallery !== 'undefined') { 14912 UNCODE.justifiedGallery(); 14913 } 14914 if (typeof UNCODE.cssGrid !== 'undefined') { 14915 UNCODE.cssGrid(); 14916 } 14917 if (typeof UNCODE.linearGrid !== 'undefined') { 14918 UNCODE.linearGrid(); 14919 } 14920 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 14921 UNCODE.lightbox(); 14922 } 14923 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 14924 $(window).on('load more-items-loaded',function(){ 14925 UNCODE.lightgallery(); 14926 }); 14927 } 14928 if (typeof UNCODE.carousel !== 'undefined') { 14929 UNCODE.carousel($('body')); 14930 } 14931 if (typeof UNCODE.lettering !== 'undefined') { 14932 UNCODE.lettering(); 14933 } 14934 UNCODE.animations(); 14935 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 14936 UNCODE.stickyElements(); 14937 } 14938 if (typeof UNCODE.twentytwenty !== 'undefined') { 14939 UNCODE.twentytwenty(); 14940 } 14941 UNCODE.disableHoverScroll(); 14942 UNCODE.printScreen(); 14943 if (typeof UNCODE.particles !== 'undefined') { 14944 UNCODE.particles(); 14945 } 14946 if (typeof UNCODE.filters !== 'undefined') { 14947 UNCODE.filters(); 14948 } 14949 if (typeof UNCODE.ajax_filters !== 'undefined') { 14950 UNCODE.ajax_filters(); 14951 } 14952 if (typeof UNCODE.widgets !== 'undefined') { 14953 UNCODE.widgets(); 14954 } 14955 if (typeof UNCODE.unmodal !== 'undefined') { 14956 UNCODE.unmodal(); 14957 } 14958 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 14959 if ( !UNCODE.isFullPage ) { 14960 UNCODE.checkScrollForTabs(); 14961 } 14962 } 14963 if (typeof UNCODE.onePage !== 'undefined') { 14964 UNCODE.onePage(UNCODE.isMobile); 14965 } 14966 if (typeof UNCODE.fullPage !== 'undefined') { 14967 $(document).ready(function(){ 14968 UNCODE.fullPage(); 14969 }); 14970 } 14971 if (typeof UNCODE.skewIt !== 'undefined') { 14972 UNCODE.skewIt(); 14973 } 14974 if (typeof UNCODE.rotateIt !== 'undefined') { 14975 UNCODE.rotateIt(); 14976 } 14977 if (typeof UNCODE.textMarquee !== 'undefined') { 14978 UNCODE.textMarquee(); 14979 } 14980 if (typeof UNCODE.stickyScroll !== 'undefined') { 14981 UNCODE.stickyScroll(); 14982 } 14983 if (typeof UNCODE.stickyTrigger !== 'undefined') { 14984 UNCODE.stickyTrigger(); 14985 } 14986 if (typeof UNCODE.areaTextReveal !== 'undefined') { 14987 UNCODE.areaTextReveal(); 14988 }
14989 if (typeof UNCODE.thumbsReveal !== 'undefined') { 14990 UNCODE.thumbsReveal(); 14991 } 14992 if (typeof UNCODE.verticalText !== 'undefined') { 14993 UNCODE.verticalText(); 14994 } 14995 if (typeof UNCODE.videoThumbs !== 'undefined') { 14996 UNCODE.videoThumbs(); 14997 } 14998 if (typeof UNCODE.revslider !== 'undefined') { 14999 UNCODE.revslider(); 15000 } 15001 if (typeof UNCODE.layerslider !== 'undefined') { 15002 UNCODE.layerslider(); 15003 } 15004 if (typeof UNCODE.lottie !== 'undefined') { 15005 UNCODE.lottie(); 15006 } 15007 if (typeof UNCODE.inlineImgs !== 'undefined') { 15008 UNCODE.inlineImgs(); 15009 } 15010 if (typeof UNCODE.animatedBgGradient !== 'undefined') { 15011 UNCODE.animatedBgGradient(); 15012 } 15013 if (typeof UNCODE.readMoreCol !== 'undefined') { 15014 UNCODE.readMoreCol(); 15015 } 15016 if (typeof UNCODE.multibg !== 'undefined') { 15017 UNCODE.multibg(); 15018 } 15019 if (typeof UNCODE.flexEqual !== 'undefined') { 15020 UNCODE.flexEqual(); 15021 } 15022 $(window).on('load',function(){ 15023 clearRequestTimeout(waypoint_request); 15024 waypoint_request = requestTimeout( function(){ 15025 Waypoint.refreshAll(); 15026 }, 1000); 15027 }); 15028 $(window).one('load',function(){ 15029 if (typeof UNCODE.parallax !== 'undefined') { 15030 UNCODE.parallax(); 15031 } 15032 }); 15033 } 15034 15035 if ( ! SiteParameters.is_frontend_editor ) { 15036 UNCODE.init(); 15037 } 15038 15039 15040})(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.