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.navigation', function(event) { 4055 $('.owl-dot', event.currentTarget).each(function(key, val){ 4056 $(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1)); 4057 }); 4058 }); 4059 4060 $elSelector.on('initialized.owl.carousel', function(event) { 4061 4062 if ( $('.isotope-container', event.currentTarget).length ) { 4063 window.dispatchEvent(UNCODE.boxEvent); 4064 } 4065 4066 $('.owl-dot.active', $elSelector).on('click', function(){ 4067 return false;
4068 }); 4069 4070 var thiis = $(event.currentTarget), 4071 // get the time from the data method 4072 time = thiis.data("timer-id"), 4073 rowParent = thiis.closest('.row-parent'); 4074 4075 if ( typeof rowParent[0] !== 'undefined' ) { 4076 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 4077 } 4078 4079 if (time) { 4080 clearRequestTimeout(time); 4081 } 4082 4083 thiis.addClass('showControls'); 4084 var new_time = requestTimeout(function() { 4085 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 4086 if (thiis.hasClass('owl-height-viewport')) 4087 setItemsRelHeight(thiis); 4088 if (thiis.hasClass('owl-height-equal')) 4089 setItemsHeight(thiis); 4090 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 4091 if (thiis.closest('.unequal, .unexpand').length) { 4092 UNCODE.setRowHeight(rowParent[0], true); 4093 } 4094 if (SiteParameters.dynamic_srcset_active === '1') { 4095 UNCODE.refresh_dynamic_srcset_size(thiis); 4096 } 4097 }, 350); 4098 // save the new time 4099 thiis.data("timer-id", new_time); 4100 4101 var scrolltop = $(document).scrollTop(); 4102 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 4103 4104 //if (!UNCODE.isMobile) { 4105 /** fix autoplay when visible **/ 4106 $(window).on('load', function(){ 4107 if (thiis.data('autoplay')) { 4108 if ( !thiis.closest('.sticky-element').length ) { 4109 thiis.trigger('stop.autoplay.owl'); 4110 } else { 4111 thiis.trigger('play.owl.autoplay'); 4112 } 4113 } 4114 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 4115 return; 4116 } 4117 if ( ! thiis.closest('.sticky-element').length ) { 4118 var carouselInView = new Waypoint.Inview({ 4119 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4120 element: thiis[0], 4121 exited: function() { 4122 var el = $(this.element); 4123 if (el.data('autoplay') ) { 4124 el.trigger('stop.owl.autoplay'); 4125 el.data('stopped','true'); 4126 } 4127 }, 4128 enter: function(direction) { 4129 var el = $(this.element); 4130 requestTimeout(function() { 4131 if (el.data('autoplay')) { 4132 el.trigger('play.owl.autoplay'); 4133 el.data('stopped','false'); 4134 } 4135 }, 100); 4136 } 4137 }); 4138 } 4139 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4140 setTimeout(function(){ 4141 window.lenis.resize(); 4142 }, 1000); 4143 } 4144 4145 }); 4146 //} 4147 4148 // $(window).on('frontend:carousel_updated', function(){ 4149 // Waypoint.refreshAll(); 4150 // }); 4151 4152 if (!thiis.closest('.isotope-system').length) { 4153 requestTimeout(function() { 4154 animate_thumb($('.t-inside', el), event); 4155 }, 400); 4156 } else { 4157 requestTimeout(function() { 4158 thiis.closest('.isotope-container').isotope('layout'); 4159 }, 400); 4160 } 4161 4162 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4163 currentIndex = $(currentItem).attr('data-index'); 4164 4165 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4166 if ($(val).closest('.uncode-slider').length) { 4167 $(val).removeClass('start_animation'); 4168 } 4169 }); 4170 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4171 if ($(val).closest('.uncode-slider').length) { 4172 $(val).removeClass('already-animated'); 4173 } 4174 }); 4175 4176 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4177 if ($(val).closest('.uncode-slider').length) { 4178 $(val).removeAttr('data-animated'); 4179 } 4180 }); 4181 4182 $.each($('.owl-item.cloned', thiis), function(index, val) { 4183 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 4184 }); 4185 4186 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4187 if ($(val).attr('data-index') != currentIndex) { 4188 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4189 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4190 } 4191 if ($(val).attr('data-index') != currentIndex) { 4192 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 4193 } 4194 if ($(val).attr('data-index') == currentIndex) { 4195 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4196 } 4197 }); 4198 4199 if (thiis.closest('.uncode-slider').length) { 4200 var el = thiis.closest('.row-parent')[0], 4201 section = thiis.closest('.vc_section'); 4202 if ( section.length ) { 4203 el = $('> .row-parent', section)[0]; 4204 } 4205 if ($(el).data('imgready')) { 4206 firstLoaded(el, event); 4207 } else { 4208 el.addEventListener("imgLoaded", function(el) { 4209 firstLoaded(el.target, event); 4210 }, false); 4211 } 4212 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 4213 if (transHeight != null) { 4214 requestTimeout(function() { 4215 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 4216 }, 100); 4217 } 4218 } else { 4219 var el = thiis; 4220 el.closest('.uncode-slider').addClass('slider-loaded'); 4221 } 4222 4223 requestTimeout(function() { 4224 if (typeof UNCODE.bigText !== 'undefined') { 4225 UNCODE.bigText(thiis); 4226 } 4227 if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) { 4228 if (thiis.data('autoplay')) pauseOnHover(thiis); 4229 } 4230 }, 500); 4231 4232 if (thiis.closest('.unequal').length) { 4233 $owlInsideEqual.push(thiis.closest('.row-parent')); 4234 } 4235 4236 var containerClasses = '', 4237 containerStyle = '';
4238 if ( $('.owl-dots-classes', $owlContainer).length ) { 4239 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 4240 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 4241 $('.owl-dots-classes', $owlContainer).remove(); 4242 } 4243 4244 if ( containerClasses !== '' ) { 4245 requestTimeout(function() { 4246 if ( containerClasses !== '' ) 4247 $('.owl-dots', $owlContainer).attr('style', containerStyle); 4248 if ( containerStyle !== '' ) 4249 $('.owl-dots', $owlContainer).addClass(containerClasses); 4250 }, 100); 4251 } 4252 4253 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 4254 $(val).closest('.row-inner').css({ 4255 'margin-top': '-1px' 4256 }); 4257 }); 4258 4259 if ($.fn.isotope) { 4260 if ( thiis.closest('.isotope-container').length ) { 4261 if (thiis.closest('.isotope-container').data('isotope')) { 4262 requestTimeout(function(){ 4263 thiis.closest('.isotope-container').isotope('layout'); 4264 }, 300); 4265 } 4266 $(window).on('load', function(){ 4267 if (thiis.closest('.isotope-container').data('isotope')) { 4268 thiis.closest('.isotope-container').isotope('layout'); 4269 } 4270 }); 4271 } 4272 } 4273 4274 if (thiis.data('autoplay')) { 4275 $(window).on('menuOpen', function(){ 4276 thiis.trigger('stop.owl.autoplay'); 4277 thiis.data('stopped','true'); 4278 }).on('menuClose', function(){ 4279 4280 }); 4281 } 4282 $(window).on('menuClose', function(){ 4283 if (thiis.data('autoplay')) { 4284 thiis.trigger('play.owl.autoplay'); 4285 thiis.data('stopped','false'); 4286 } 4287 }); 4288 4289 setIndexActive(event, true); 4290 4291 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 4292 return !$(this).closest('.nested-carousel').length; 4293 }), 4294 $_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), 4295 $galleries = $_galleries.filter(function( index ) { 4296 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 4297 }); 4298 4299 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 4300 UNCODE.lightgallery( $galleries ); 4301 } 4302 4303 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4304 $(document).trigger('uncode-scrolltrigger-refresh'); 4305 } 4306 }); 4307 4308 $elSelector.on('resized.owl.carousel', function(event) { 4309 $('.owl-dot', event.currentTarget).each(function(key, val){ 4310 $(val).attr('aria-label', SiteParameters.uncode_slide_label + ' ' + (key+1)); 4311 }); 4312 }); 4313 4314 $elSelector.on('resized.owl.carousel', function(event) { 4315 var thiis = $(event.currentTarget); 4316 // if ($(this).closest('.nested-carousel').length) { 4317 // requestTimeout(function() { 4318 // window.dispatchEvent(UNCODE.boxEvent); 4319 // }, 200); 4320 // } 4321 if ( thiis.hasClass('owl-height-equal') ) 4322 setItemsHeight(thiis); 4323 4324 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4325 newWidth = UNCODE.wwidth; 4326 setItemsRelHeight($elSelector); 4327 } 4328 4329 setIndexActive(event); 4330 4331 if (SiteParameters.dynamic_srcset_active === '1') { 4332 UNCODE.refresh_dynamic_srcset_size(thiis); 4333 } 4334 4335 if ($.fn.isotope) { 4336 $(window).on('load', function(){ 4337 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 4338 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 4339 } 4340 }); 4341 } 4342 4343 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 4344 setTimeout(function(){ 4345 window.lenis.resize(); 4346 }, 1000); 4347 } 4348 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 4349 $(document).trigger('uncode-scrolltrigger-refresh'); 4350 } 4351 }); 4352 4353 $elSelector.on('refreshed.owl.carousel', function(event) { 4354 setIndexActive(event); 4355 }); 4356 4357 /** detect resize window for fluid height layout */ 4358 var setFluidResize;
4359 function manageFluidCarouseHeight() { 4360 clearRequestTimeout(setFluidResize); 4361 setFluidResize = requestTimeout(function(){ 4362 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4363 newWidth = UNCODE.wwidth; 4364 setItemsRelHeight($elSelector); 4365 } 4366 }, 100); 4367 } 4368 window.addEventListener('resize', manageFluidCarouseHeight); 4369 4370 /** Change */ 4371 $elSelector.on('change.owl.carousel', function(event) { 4372 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 4373 }); 4374 4375 /** Changed */ 4376 $elSelector.on('changed.owl.carousel', function(event) { 4377 var $row = $elSelector.parents('.row')[0]; 4378 if ( typeof $row !== 'undefined' ) { 4379 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 4380 } 4381 setIndexActive(event); 4382 }); 4383 4384 var checkDrag = function(e) { 4385 $elSelector.addClass('owl-dragging'); 4386 }; 4387 $elSelector.on('drag.owl.carousel', function(event) { 4388 document.addEventListener("mousemove", checkDrag); 4389 }); 4390 4391 $elSelector.on('dragged.owl.carousel', function(event) { 4392 $elSelector.removeClass('owl-dragging'); 4393 document.removeEventListener("mousemove", checkDrag); 4394 }); 4395 4396 $elSelector.on('translate.owl.carousel', function(event) { 4397 if (UNCODE.isMobile) { 4398 $(event.currentTarget).addClass('owl-translating'); 4399 } 4400 }); 4401 4402 /** Translated */ 4403 $elSelector.on('translated.owl.carousel', function(event) { 4404 4405 var thiis = $(event.currentTarget), 4406 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4407 currentIndex = $(currentItem).attr('data-index'), 4408 stagePadding = thiis.data('stagepadding'); 4409 4410 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4411 4412 if (!UNCODE.isMobile) { 4413 UNCODE.owlPlayVideo(thiis); 4414 } 4415 4416 requestTimeout(function(){ 4417 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 4418 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 4419 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 4420 if (lastDelayElems == undefined) lastDelayElems = 0; 4421 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4422 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4423 thiis.trigger('stop.owl.autoplay'); 4424 requestTimeout(function() { 4425 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 4426 }, maxDelay); 4427 } 4428 }, 200); 4429 4430 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4431 if ($(val).closest('.uncode-slider').length) { 4432 $(val).removeClass('start_animation'); 4433 } 4434 }); 4435 4436 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4437 if ($(val).closest('.uncode-slider').length) { 4438 $(val).removeClass('already-animated'); 4439 } 4440 }); 4441 4442 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4443 if ($(val).closest('.uncode-slider').length) { 4444 $(val).removeAttr('data-animated'); 4445 } 4446 }); 4447 4448 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4449 if ($(val).attr('data-index') != currentIndex) { 4450 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4451 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4452 } 4453 if ($(val).attr('data-index') != currentIndex) { 4454 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4455 } 4456 if ($(val).attr('data-index') == currentIndex) { 4457 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4458 } 4459 }); 4460 4461 if (UNCODE.isMobile) { 4462 thiis.removeClass('owl-translating'); 4463 } 4464 4465 setIndexActive(event); 4466 }); 4467 4468 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4469 4470 /** Init carousel */ 4471 $elSelector.not('.showControls').owlCarousel({ 4472 items: values['items'], 4473 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4474 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4475 nav: values['nav'], 4476 dots: values['dots'], 4477 loop: values['loop'], 4478 stagePadding: values['stagepadding'], 4479 margin: 0, 4480 video: true, 4481 autoWidth: false, 4482 autoplay: false, 4483 autoplayTimeout: values['timeout'], 4484 autoplaySpeed: values['navspeed'], 4485 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4486 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4487 rtl: $('body').hasClass('rtl') ? true : false, 4488 fluidSpeed: true, 4489 navSpeed: values['navspeed'], 4490 dotsSpeed: values['navspeed'] / values['items'], 4491 navElement: ['button type="button" aria-label="' + SiteParameters.uncode_prev_label + '"', 'button type="button" aria-label="' + SiteParameters.uncode_next_label + '"'], 4492 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4493 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>'], 4494 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4495 responsiveClass: true, 4496 responsiveBaseElement: '.box-container', 4497 responsive: { 4498 0: { 4499 items: values['sm'], 4500 nav: values['navmobile'], 4501 dots: values['dotsmobile'], 4502 dotsSpeed: values['navspeed'] / values['sm'], 4503 }, 4504 480: { 4505 items: values['sm'], 4506 nav: values['navmobile'], 4507 dots: values['dotsmobile'], 4508 dotsSpeed: values['navspeed'] / values['sm'], 4509 }, 4510 570: { 4511 items: values['md'], 4512 nav: values['navmobile'], 4513 dots: values['dotsmobile'], 4514 dotsSpeed: values['navspeed'] / values['md'], 4515 }, 4516 960: { 4517 items: values['lg'], 4518 dotsSpeed: values['navspeed'] / values['lg'], 4519 } 4520 } 4521 }); 4522 4523 var transDuration = parseFloat(values['navspeed']) * 0.3; 4524 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4525 4526 $('.owl-item .tmb', $elSelector).css({ 4527 '-webkit-transition-delay': transDuration + 'ms', 4528 '-moz-transition-delay': transDuration + 'ms', 4529 '-o-transition-delay': transDuration + 'ms', 4530 'transition-delay': transDuration + 'ms', 4531 '-webkit-transition-duration': transDuration2 + 'ms', 4532 '-moz-transition-duration': transDuration2 + 'ms', 4533 '-o-transition-duration': transDuration2 + 'ms', 4534 'transition-duration': transDuration2 + 'ms', 4535 }); 4536 4537 requestTimeout(function() { 4538 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4539 UNCODE.setRowHeight($owlInsideEqual[i]); 4540 }; 4541 }, 300); 4542 4543 $(window).on('load', function(){ 4544 var $elCarousel = $elSelector.data('owl.carousel'); 4545 if ( typeof $elCarousel !== 'undefined' ) { 4546 $elCarousel.trigger('refreshed'); 4547 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4548 UNCODE.setRowHeight($owlInsideEqual[i]); 4549 }; 4550 } 4551 }); 4552 4553 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4554 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4555 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4556 $('#' + carousel_id).find('.owl-item').each( function() { 4557 var $item = $(this), 4558 index = ( $item.index() + 1 ); 4559 $item.attr('data-index', index); 4560 }); 4561 } 4562 }); 4563 4564 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4565 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4566 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4567 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4568 $('#' + carousel_id).find('.owl-item').each( function() { 4569 var $item = $(this), 4570 index = ( $item.index() + 1 ); 4571 $item.attr('data-index', index); 4572 }); 4573 } 4574 }); 4575 } 4576 4577 }); 4578 4579 function firstLoaded(el, event) { 4580 var el = $(el), 4581 uncode_slider = el.find('.uncode-slider'); 4582 el.find('.owl-carousel').css('opacity', 1); 4583 uncode_slider.addClass('slider-loaded'); 4584 if (typeof UNCODE.bigText !== 'undefined') { 4585 UNCODE.bigText(el.find('.owl-item.active')); 4586 } 4587 //if (!UNCODE.isMobile) { 4588 requestTimeout(function() { 4589 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4590 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4591 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4592 if (lastDelayElems == undefined) lastDelayElems = 0; 4593 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4594 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4595 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4596 requestTimeout(function() { 4597 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4598 }, maxDelay); 4599 } 4600 }, 500); 4601 4602 //} 4603 } 4604 4605 function navHover(el) { 4606 var $owlCont = el, 4607 $owlPrev = $owlCont.find('.owl-prev'), 4608 $owlNext = $owlCont.find('.owl-next'), 4609 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4610 $owlPagination = $owlCont.next(), 4611 owlPrevW = $owlPrev.outerWidth(), 4612 owlNextW = $owlNext.outerWidth(), 4613 owlDotsH = $owlDots.innerHeight(), 4614 owlTime = 400, 4615 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4616 if ( $('body').hasClass('rtl') ) { 4617 $owlPrev.css("margin-right", -owlPrevW); 4618 $owlNext.css("margin-left", -owlNextW); 4619 } else { 4620 $owlPrev.css("margin-left", -owlPrevW); 4621 $owlNext.css("margin-right", -owlNextW); 4622 } 4623 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4624 $owlCont.mouseenter(function() { 4625 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4626 $owlPrev.add($owlNext).css({ 4627 marginLeft: 0, 4628 marginRight: 0 4629 }); 4630 if (!owlNested) { 4631 $owlDots.css({ 4632 opacity: 1, 4633 bottom: 0 4634 }); 4635 } 4636 }).mouseleave(function() { 4637 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4638 if ( $('body').hasClass('rtl') ) { 4639 $owlPrev.css("margin-right", -owlPrevW); 4640 $owlNext.css("margin-left", -owlNextW); 4641 } else { 4642 $owlPrev.css("margin-left", -owlPrevW); 4643 $owlNext.css("margin-right", -owlNextW); 4644 } 4645 if (!owlNested) { 4646 $owlDots.css({ 4647 opacity: 1, 4648 bottom: -owlDotsH 4649 }); 4650 } 4651 }); 4652 }; 4653 4654 function animate_elems($this) { 4655 var lastDelay; 4656 $.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) { 4657 var element = $(val), 4658 delayAttr = element.attr('data-delay'), 4659 $first_item = element.closest('.owl-item[data-index="1"]'); 4660 4661 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4662 return false;
4663 } 4664 4665 if (delayAttr == undefined) delayAttr = 0; 4666 requestTimeout(function() { 4667 element.addClass('start_animation'); 4668 }, delayAttr); 4669 lastDelay = delayAttr; 4670 }); 4671 return lastDelay; 4672 } 4673 4674 function animate_thumb(items, event) { 4675 var lastDelay, 4676 itemIndex, 4677 thiis = $(event.currentTarget), 4678 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4679 numActives = $('.owl-item.active', thiis).length, 4680 stagePadding = thiis.data('stagepadding'); 4681 4682 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4683 4684 thiis.data('tempIndex', event.item.index); 4685 $.each(items, function(index, val) { 4686 var parent = $(val).closest('.owl-item'); 4687 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4688 return; 4689 } 4690 if (!$(val).hasClass('start_animation')) { 4691 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4692 var thumbInView = new Waypoint.Inview({ 4693 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4694 element: val, 4695 enter: function(direction) { 4696 var element = $(this.element), 4697 delayAttr = parseInt(element.attr('data-delay')), 4698 itemIndex = element.closest('.owl-item').index() + 1, 4699 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4700 if (itemIndex > tempIndex) { 4701 thiis.data('tempIndex', itemIndex); 4702 } 4703 if (isNaN(delayAttr)) delayAttr = 100; 4704 if (stagePadding) { 4705 var objTimeout = requestTimeout(function() { 4706 element.addClass('start_animation'); 4707 }, index * delayAttr); 4708 lastDelay = index * delayAttr; 4709 } else { 4710 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4711 var objTimeout = requestTimeout(function() { 4712 element.addClass('start_animation'); 4713 }, diffItem * delayAttr); 4714 lastDelay = diffItem * delayAttr; 4715 } 4716 parent.data('objTimeout', objTimeout); 4717 if (!UNCODE.isUnmodalOpen) { 4718 this.destroy(); 4719 } 4720 } 4721 }); 4722 } 4723 } 4724 }); 4725 return lastDelay; 4726 } 4727 4728 function setItemsHeight(item) { 4729 $.each($('.owl-item', item), function(index, val) { 4730 var availableThumbHeight = $('.t-inside', $(val)).height(), 4731 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4732 difference = availableThumbHeight - innerThumbHeight; 4733 if ($('.tmb-content-under', val).length) { 4734 var visualPart = $('.t-entry-visual', val); 4735 if (visualPart.length) { 4736 difference -= $('.t-entry-visual', val).height(); 4737 } 4738 } 4739 if (! $('.tmb-content-lateral', val).length) 4740 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4741 }); 4742 } 4743 4744 function setItemsRelHeight(item) { 4745 $.each($('.owl-item', item), function(index, val) { 4746 var $rowContainer = $(item).parents('.row-parent').eq(0), 4747 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4748 $colContainer = $(item).parents('.uncell').eq(0), 4749 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4750 winHeight = UNCODE.wheight, 4751 multiplier_h = parseInt($(item).attr('data-vp-height')), 4752 data_viewport_h, 4753 consider_menu = $(item).data('vp-menu'); 4754 4755 if ( consider_menu ) { 4756 winHeight = winHeight - UNCODE.menuHeight; 4757 } 4758 4759 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4760 $('.t-inside', val).css( 'height', data_viewport_h ); 4761 }); 4762 } 4763 4764 function pauseOnHover(slider) { 4765 var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next'); 4766 $('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({ 4767 mouseenter: function () { 4768 $(slider).addClass('owl-mouseenter'); 4769 $(slider).trigger('stop.owl.autoplay'); 4770 }, 4771 mouseleave: function () { 4772 $(slider).removeClass('owl-mouseenter'); 4773 $(slider).trigger('play.owl.autoplay'); 4774 } 4775 }); 4776 } 4777 }); 4778}; 4779 4780UNCODE.owlPlayVideo = function(carousel) { 4781 var player, iframe; 4782 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4783 var content = $(val).html(); 4784 if (content == '') { 4785 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4786 $(val).append(getCloned); 4787 } 4788 if ($(this).attr('data-provider') == 'vimeo') { 4789 iframe = $(this).find('iframe'); 4790 player = new Vimeo.Player(iframe[0]); 4791 player.play(); 4792 } else if ($(this).attr('data-provider') == 'youtube') { 4793 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4794 } else { 4795 var player = $(this).find('video'); 4796 if (player.length) { 4797 $(this).find('video')[0].volume = 0; 4798 $(this).find('video')[0].play(); 4799 $(val).css('opacity', 1); 4800 } 4801 } 4802 }); 4803}; 4804 4805UNCODE.owlStopVideo = function(carousel) { 4806 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4807 var player, iframe; 4808 if ($(this).attr('data-provider') == 'vimeo') { 4809 iframe = $(this).find('iframe'); 4810 player = new Vimeo.Player(iframe[0]); 4811 player.pause(); 4812 } else if ($(this).attr('data-provider') == 'youtube') { 4813 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4814 } else { 4815 var player = $(this).find('video'); 4816 if (player.length) { 4817 $(this).find('video')[0].volume = 0; 4818 $(this).find('video')[0].play(); 4819 } 4820 } 4821 }); 4822}; 4823 4824UNCODE.animations = function() { 4825 4826 var runWaypoints_TO, 4827 runWaypoints_carousel_TO, 4828 runWaypoints_delay = 0, 4829 highlightComplexFunc = function($wrap, ev){ 4830 4831 var $lines = $('.heading-line-wrap', $wrap), 4832 not_animate = false;
4833 4834 if ( $wrap.data('animate') === true ) { 4835 not_animate = true; 4836 } 4837 4838 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4839 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4840 return; 4841 } 4842 4843 $lines.each(function(_key, _value){ 4844 var $line = $(_value), 4845 $inners = $('.split-word-inner', $line), 4846 $highlights = $('.heading-text-highlight-inner', $line); 4847 4848 var highlitInnerFunc = function(ev){ 4849 var delay = 0; 4850 $highlights.each(function(h_key, high){ 4851 var $highlight = $(high), 4852 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4853 $nextSplit = $split.nextUntil(), 4854 $next = $('.heading-text-highlight-inner', $nextSplit), 4855 countCh = $split.text().length; 4856 4857 $highlight.css({ 4858 '-webkit-transition-duration': (30 * countCh) + 'ms', 4859 '-moz-transition-duration': (30 * countCh) + 'ms', 4860 '-o-transition-duration': (30 * countCh) + 'ms', 4861 'transition-duration': (30 * countCh) + 'ms', 4862 }); 4863 4864 delay += (30 * countCh); 4865 4866 $next.css({ 4867 '-webkit-transition-delay': delay + 'ms', 4868 '-moz-transition-delay': delay + 'ms', 4869 '-o-transition-delay': delay + 'ms', 4870 'transition-delay': delay + 'ms', 4871 }); 4872 }); 4873 $highlights.removeAttr('data-animated'); 4874 if ( _key+1 === $lines.length ) { 4875 $wrap.data('animate', true); 4876 } 4877 }; 4878 4879 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4880 if ( not_animate ) { 4881 $highlights.each(function(h_key, high){ 4882 var $highlight = $(high); 4883 $highlight.css({ 4884 '-webkit-transition-duration': '0ms', 4885 '-moz-transition-duration': '0ms', 4886 '-o-transition-duration': '0ms', 4887 'transition-duration': '0ms', 4888 }); 4889 }); 4890 $highlights.removeAttr('data-animated'); 4891 } else { 4892 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4893 highlitInnerFunc(); 4894 } else { 4895 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4896 } 4897 } 4898 } 4899 }); 4900 }; 4901 4902 $.each($('.header-content-inner'), function(index, val) { 4903 var element = $(val), 4904 transition = ''; 4905 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4906 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4907 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4908 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4909 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4910 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4911 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4912 if (transition != '') { 4913 $(val).removeClass(transition); 4914 var container = element, 4915 containerDelay = container.attr('data-delay'), 4916 containerSpeed = container.attr('data-speed'), 4917 items = $('.header-title > *, .post-info', container); 4918 $.each(items, function(index, val) { 4919 var element = $(val), 4920 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4921 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4922 if (!element.hasClass('animate_when_almost_visible')) { 4923 delayAttr = Number(delayAttr) + (400 * index); 4924 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4925 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4926 } 4927 }); 4928 container.css('opacity', 1); 4929 } 4930 }); 4931 4932 function animate_css_grids_on_load() { 4933 $('.cssgrid-system').each(function() { 4934 var grid = $(this); 4935 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4936 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4937 }); 4938 } 4939 4940 var delayAdd = 0; 4941 4942 window.waypoint_animation = function(ev) { 4943 $.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) { 4944 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 ) ) { 4945 return true; 4946 } 4947 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4948 return; 4949 } 4950 var run = true, 4951 $carousel = $(val).closest('.owl-carousel'), 4952 marquee = $(val).closest('.tmb-linear').length; 4953 if ( $carousel.length ) { 4954 run = false;
4955 } 4956 if (run) { 4957 new Waypoint({ 4958 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4959 element: val, 4960 handler: function() { 4961 var element = $(this.element), 4962 index = element.index(), 4963 delayAttr = element.attr('data-delay'); 4964 if (delayAttr == undefined) delayAttr = 0; 4965 // delayAttr = parseFloat(delayAttr) + delayAdd; 4966 // if ( marquee ) { 4967 // delayAdd += 50; 4968 // } else { 4969 // delayAdd = 0; 4970 // } 4971 requestTimeout(function() { 4972 element.addClass('start_animation'); 4973 }, delayAttr); 4974 if (!UNCODE.isUnmodalOpen) { 4975 this.destroy(); 4976 } 4977 }, 4978 offset: UNCODE.isFullPage ? '100%' : '90%' 4979 }); 4980 } 4981 }); 4982 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4983 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4984 return; 4985 } 4986 var run = true, 4987 $carousel = $(val).closest('.owl-carousel'); 4988 if ( $carousel.length ) { 4989 run = false; 4990 } 4991 if (run) { 4992 new Waypoint({ 4993 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4994 element: val, 4995 handler: function() { 4996 var $element = $(this.element), 4997 $childs = $('.animate_when_parent_almost_visible', $element); 4998 $childs.each(function(key,el){ 4999 var $child = $(el), 5000 delaySpeed = $child.attr('data-speed'), 5001 delayAttr = $child.attr('data-delay'), 5002 intervalAttr = $child.attr('data-interval'); 5003 if (delayAttr == undefined) { 5004 delayAttr = 50*key; 5005 } 5006 requestTimeout(function() { 5007 $child.addClass('start_animation'); 5008 if ( $child.hasClass('anim-line-checker') ) { 5009 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5010 var $line = $child.closest('.heading-line-wrap'); 5011 }); 5012 } 5013 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 5014 highlightComplexFunc($wrapText, ev); 5015 if ( $child.hasClass('anim-tot-checker') ) { 5016 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5017 if ( $child.hasClass('anim-tot-checker') ) { 5018 $wrapText.addClass('already-animated'); 5019 $element.trigger('already-animated'); 5020 } 5021 }); 5022 } 5023 }, delayAttr ); 5024 }); 5025 $element.addClass('start_animation'); 5026 if (!UNCODE.isUnmodalOpen) { 5027 this.destroy(); 5028 } 5029 }, 5030 offset: UNCODE.isFullPage ? '100%' : '90%' 5031 }); 5032 } 5033 }); 5034 } 5035 window.waypoint_carousel_animation = function(ev) { 5036 $.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) { 5037 if ( $(val).hasClass('el-text-split') ) { 5038 return true; 5039 } 5040 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5041 return; 5042 } 5043 var run = true, 5044 $carousel = $(val).closest('.owl-carousel'), 5045 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5046 $all_first = $('.owl-item[data-index="1"]', $carousel); 5047 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5048 run = false; 5049 } 5050 if (run) { 5051 new Waypoint({ 5052 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5053 element: val, 5054 handler: function() { 5055 var element = $(this.element), 5056 index = element.index(), 5057 delayAttr = element.attr('data-delay'); 5058 if (delayAttr == undefined) delayAttr = 0; 5059 requestTimeout(function() { 5060 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5061 $all_first.attr('data-already-reached', 'true'); 5062 } 5063 element.addClass('start_animation'); 5064 }, delayAttr); 5065 if (!UNCODE.isUnmodalOpen) { 5066 this.destroy(); 5067 } 5068 }, 5069 offset: UNCODE.isFullPage ? '100%' : '90%' 5070 }); 5071 } 5072 }); 5073 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 5074 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5075 return; 5076 } 5077 var run = true, 5078 $carousel = $(val).closest('.owl-carousel'), 5079 $first_item = $(val).closest('.owl-item[data-index="1"]'), 5080 $all_first = $('.owl-item[data-index="1"]', $carousel); 5081 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 5082 run = false;
5083 } 5084 if (run) { 5085 new Waypoint({ 5086 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5087 element: val, 5088 handler: function() { 5089 var $element = $(this.element), 5090 $childs = $('.animate_when_parent_almost_visible', $element); 5091 $childs.each(function(key,el){ 5092 var $child = $(el), 5093 delaySpeed = $child.attr('data-speed'), 5094 delayAttr = $child.attr('data-delay'), 5095 intervalAttr = $child.attr('data-interval'); 5096 if (delayAttr == undefined) { 5097 delayAttr = 50*key; 5098 } 5099 requestTimeout(function() { 5100 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 5101 $all_first.attr('data-already-reached', 'true'); 5102 } 5103 $child.addClass('start_animation'); 5104 if ( $child.hasClass('anim-line-checker') ) { 5105 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5106 var $line = $child.closest('.heading-line-wrap'); 5107 }); 5108 } 5109 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 5110 highlightComplexFunc($wrapText, ev); 5111 if ( $child.hasClass('anim-tot-checker') ) { 5112 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 5113 if ( $child.hasClass('anim-tot-checker') ) { 5114 $wrapText.addClass('already-animated'); 5115 } 5116 }); 5117 } 5118 }, delayAttr ); 5119 }); 5120 $element.addClass('start_animation'); 5121 if (!UNCODE.isUnmodalOpen) { 5122 this.destroy(); 5123 } 5124 }, 5125 offset: UNCODE.isFullPage ? '100%' : '90%' 5126 }); 5127 } 5128 }); 5129 } 5130 5131 var runWaypoints = function(ev){ 5132 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 5133 runWaypoints_delay = 400; 5134 } 5135 clearRequestTimeout(runWaypoints_TO); 5136 runWaypoints_TO = requestTimeout(function() { 5137 window.waypoint_animation(ev); 5138 }, runWaypoints_delay); 5139 5140 clearRequestTimeout(runWaypoints_carousel_TO); 5141 runWaypoints_carousel_TO = requestTimeout(function() { 5142 window.waypoint_carousel_animation(ev); 5143 }, 400); 5144 }; 5145 runWaypoints(); 5146 animate_css_grids_on_load(); 5147 5148 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 5149 runWaypoints(ev); 5150 }); 5151 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 5152 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 5153 window.parent.vc.events.on( 'shortcodeView:ready', runWaypoints ); 5154 } 5155}; 5156 5157UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 5158 var $allItems = elements.length - startIndex, 5159 showed = 0, 5160 index = 0, 5161 use_index = false 5162 ; 5163 5164 if (filtering) { 5165 if (sequential) { 5166 use_index = true; 5167 } 5168 sequential = false; 5169 } 5170 5171 $.each(elements, function(index, val) { 5172 var $this = $(val), 5173 elInner = $('> .t-inside', val); 5174 5175 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5176 return; 5177 } 5178 if (val[0]) val = val[0]; 5179 5180 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 5181 new Waypoint({ 5182 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5183 element: val, 5184 handler: function() { 5185 var element = $('> .t-inside', this.element), 5186 parent = $(this.element); 5187 var _index = use_index? index : 0; 5188 5189 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 5190 delayAttr = parseInt(element.attr('data-delay')); 5191 if (isNaN(delayAttr)) delayAttr = 100; 5192 if (sequential || use_index) { 5193 delay -= showed; 5194 } 5195 var objTimeout = requestTimeout(function() { 5196 element.removeClass('zoom-reverse').addClass('start_animation'); 5197 showed = index; 5198 }, delay * delayAttr); 5199 parent.data('objTimeout', objTimeout); 5200 if (!UNCODE.isUnmodalOpen) { 5201 this.destroy(); 5202 } 5203 }, 5204 offset: UNCODE.isFullPage ? '100%' : '90%' 5205 }); 5206 } 5207 5208 index++; 5209 }); 5210}; 5211 5212UNCODE.tapHover = function() { 5213 5214 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
5214isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 5215 elClass = "hover"; 5216 5217 $(window).on('click', function() { 5218 $el.removeClass(elClass); 5219 }); 5220 5221 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 5222 e.stopPropagation(); 5223 var link = $(this); 5224 if ( ! link.hasClass(elClass)) { 5225 e.preventDefault(); 5226 link.addClass("hover"); 5227 $el.not(this).removeClass(elClass); 5228 return false; 5229 } 5230 }); 5231}; 5232 5233UNCODE.onePage = function(isMobile) { 5234 var current = 0, 5235 last = 0, 5236 lastScrollTop = 0, 5237 forceScroll = false, 5238 lastScrolled = 0, 5239 isSectionscroller = ($('.main-onepage').length) ? true : false, 5240 isOnePage = false, 5241 getOffset = function () { 5242 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); 5243 return calculateOffset; 5244 } 5245 5246 isMobile = SiteParameters.uncode_force_onepage_dots ? false : isMobile; 5247 5248 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 5249 // return false; 5250 5251 function init_onepage() { 5252 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 5253 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 5254 } 5255 last = $('.onepage-pagination li').last().find('a').data('index'); 5256 $.each($('div[data-parent="true"]'), function(index, val) { 5257 $(this).attr('data-section', index); 5258 if (isMobile) return; 5259 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5260 return; 5261 } 5262 var sectionDown = new Waypoint({ 5263 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5264 element: val, 5265 handler: function(direction) { 5266 if (direction == 'down') { 5267 changeMenuActive(this.element, index); 5268 } 5269 }, 5270 offset: function() { 5271 return 5 + getOffset() 5272 } 5273 }); 5274 var sectionUp = new Waypoint({ 5275 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5276 element: val, 5277 handler: function(direction) { 5278 if (direction == 'up') { 5279 changeMenuActive(this.element, index); 5280 } 5281 }, 5282 offset: function() { 5283 return -5 - getOffset() 5284 } 5285 }); 5286 5287 if (isSectionscroller) { 5288 var label; 5289 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 5290 else label = ''; 5291 var getName = $(this).attr('data-name'); 5292 if (getName == undefined) getName = index; 5293 if (label != '') { 5294 isOnePage = true; 5295 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 5296 $('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>"); 5297 } 5298 } 5299 }); 5300 5301 if (isSectionscroller) { 5302 $.each($('ul.onepage-pagination li'), function(index, val) { 5303 var $this = $(val), 5304 $a = ('a', $this); 5305 $a.on('click', function(evt) { 5306 if ( $('.is-selected', $this).length || UNCODE.scrolling ) { 5307 return false; 5308 } 5309 if ( $('body').hasClass('uncode-scroll-no-history') ) { 5310 evt.preventDefault(); 5311 } 5312 Waypoint.refreshAll(); 5313 var el = $('a', evt.currentTarget); 5314 current = lastScrolled = parseInt(el.attr('data-index')); 5315 lastScrolled += 1; 5316 scrollBody(current); 5317 }); 5318 }); 5319 } 5320 5321 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 5322 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 5323 goToSection = String(window.location.hash).replace(/^#/, ""); 5324 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 5325 } 5326 5327 if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) { 5328 current = lastScrolled = goToSection; 5329 $(window).on('load', function(){ 5330 if ( $('.owl-carousel').length ) { 5331 requestTimeout(function(){ 5332 scrollBody(goToSection); 5333 }, 400); 5334 } else { 5335 scrollBody(goToSection); 5336 } 5337 }); 5338 } 5339 5340 } 5341 5342 function changeMenuActive(section, index) { 5343 current = lastScrolled = parseInt($(section).attr('data-section')); 5344 if (isOnePage) { 5345 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 5346 if (newSection.length) { 5347 $('ul.onepage-pagination li a').removeClass('is-selected'); 5348 newSection.addClass('is-selected'); 5349 } 5350 var getName = $('[data-section="' + index + '"]').attr('data-name'); 5351 if (getName != undefined && getName !== '') { 5352 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 5353 var get_href = $(val).attr('href'); 5354 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5355 $(val).closest('.menu-smart').find('.active').removeClass('active'); 5356 $(val).parent().addClass('active'); 5357 } 5358 }); 5359 } 5360 } 5361 } 5362 5363 if (isOnePage) { 5364 $(window).on('scroll', function() { 5365 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 5366 if (bodyTop == 0) { 5367 $('ul.onepage-pagination li a').removeClass('is-selected'); 5368 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 5369 var getName = $('[data-section=0]').attr('data-name'); 5370 if (getName != undefined && getName !== '') { 5371 $.each($('.menu-container .menu-item > a'), function(i, val) { 5372 var get_href = $(val).attr('href'); 5373 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5374 $(val).closest('ul').find('.active').removeClass('active'); 5375 $(val).parent().addClass('active'); 5376 } 5377 }); 5378 } 5379 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 5380 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 5381 if (lastSection.length) { 5382 $('ul.onepage-pagination li a').removeClass('is-selected'); 5383 lastSection.addClass('is-selected'); 5384 } 5385 } 5386 }); 5387 } 5388 5389 var scrollBody = function(index) { 5390 $('ul.onepage-pagination li a').removeClass('is-selected'); 5391 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 5392 5393 var getSection = $('[data-section=' + index + ']'), 5394 scrollTo; 5395 5396 if (getSection == undefined) return; 5397 5398 var body = $("html, body"), 5399 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5400 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 5401 getOffset = UNCODE.get_scroll_offset(index); 5402 if ( typeof getSection.offset() === 'undefined' ) 5403 return; 5404 scrollTo = getSection.offset().top; 5405
5406 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 5407 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 5408 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 5409 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 5410 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 5411 } 5412 5413 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 5414 if ( index === 0 ) { 5415 scrollTo = 0; 5416 } else { 5417 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 5418 } 5419 } else { 5420 scrollTo -= getOffset; 5421 } 5422 } 5423 5424 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5425 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5426 5427 if (index != 0) { 5428 UNCODE.scrolling = true; 5429 } 5430 5431 if (scrollSpeed == 0) { 5432 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 5433 UNCODE.scrolling = false; 5434 } else { 5435 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5436 $(this).stop(); 5437 }).animate({ 5438 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5439 }, scrollSpeed, 'easeInOutCubic', function() { 5440 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5441 UNCODE.scrolling = false; 5442 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 5443 || 5444 $('.menu-hided').length ) { 5445 scrollTo = getSection.offset().top; 5446 getOffset = UNCODE.get_scroll_offset(index); 5447 scrollTo -= getOffset; 5448 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5449 $(this).stop(); 5450 }).animate({ 5451 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5452 }, scrollSpeed, 'easeInOutCubic', function() { 5453 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5454 UNCODE.scrolling = false; 5455 } 5456 ); 5457 } 5458 }); 5459 } 5460 5461 }; 5462 5463 init_onepage(); 5464}; 5465 5466UNCODE.stickyElements = function() { 5467 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5468 if (!isMobile_wide ) { 5469 5470 var $pageHeader = $('#page-header'), 5471 $headerRow = $('.vc_row', $pageHeader), 5472 $headerSection = $headerRow.closest('section[data-parent]'), 5473 startSticky = false; 5474 5475 if ( $headerRow.hasClass('sticky-element') && !$headerSection.length ) { 5476 $headerRow.removeClass('sticky-element'); 5477 $pageHeader.addClass('sticky-element'); 5478 startSticky = true; 5479 } 5480 5481 var calculateOffset = function(el) { 5482 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5483 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5484 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0, 5485 elTop = window.pageYOffset + el.getBoundingClientRect().top; 5486 5487 sideOffset += UNCODE.bodyBorder; 5488 5489 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5490 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) { 5491 if ($('.menu-shrink').length) { 5492 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5493 } else { 5494 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5495 } 5496 } 5497 5498 return sideOffset; 5499 5500 }, 5501 5502 initStickyElement = function($els) { 5503 if ( $('body').hasClass('vc-safe-mode') ) { 5504 return true; 5505 } 5506 if ( typeof $els === 'undefined' ) { 5507 $els = $('.sticky-element'); 5508 } 5509 $.each($els, function(index, element) { 5510 if ($(element).closest('.tab-pane').length) { 5511 var $paneParent = $(element).closest('.tab-pane'); 5512 if ( !$paneParent.hasClass('active') ) { 5513 return true; 5514 } 5515 } 5516 $(element).stick_in_parent({ 5517 sticky_class: 'is_stucked', 5518 offset_top: calculateOffset(element), 5519 bottoming: true, 5520 inner_scrolling: SiteParameters.sticky_elements === 'on' 5521 }); 5522 }); 5523 }; 5524 5525 var oldW = UNCODE.wwidth, 5526 oldH = UNCODE.wHeight; 5527 5528 requestTimeout(function() { 5529 if ($('.sticky-element').length) { 5530 5531 if ($(window).width() > UNCODE.mediaQuery) { 5532 initStickyElement(); 5533
5534 if ( startSticky === true ) { 5535 $('#page-header').trigger('sticky_kit:recalc'); 5536 } 5537 } 5538 5539 $(window).on('resize lateral_resize', function(event) { 5540 if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) { 5541 $(".sticky-element").trigger("sticky_kit:detach"); 5542 if ($(window).width() > UNCODE.mediaQuery) { 5543 initStickyElement(); 5544 } 5545 oldW = UNCODE.wwidth; 5546 oldH = UNCODE.wHeight; 5547 } 5548 }); 5549 } 5550 }, 1000); 5551 5552 if ($('.sticky-element').length) { 5553 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5554 requestTimeout(function() { 5555 $(document.body).trigger("sticky_kit:recalc"); 5556 }, 100); 5557 }); 5558 } 5559 5560 var $panels = $('.panel-collapse'); 5561 if ( $panels.length ) { 5562 $panels.each(function(){ 5563 var $panel = $(this); 5564 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5565 $(document.body).trigger("sticky_kit:recalc"); 5566 }); 5567 }); 5568 } 5569 5570 $('.nav-tabs a').on('shown.bs.tab', function(e){ 5571 var $tabs = $(e.target).closest('.tab-container'), 5572 $panel = $('.tab-pane.active', $tabs), 5573 $els = $(e.target).nextAll(".sticky-element"); 5574 5575 $els.trigger("sticky_kit:detach"); 5576 initStickyElement($els); 5577 }); 5578 5579 $(window).on('vc-safe-mode-on', function(){ 5580 $(".sticky-element").trigger("sticky_kit:detach"); 5581 }); 5582 5583 $(window).on('vc-safe-mode-off', function(){ 5584 initStickyElement(); 5585 }); 5586 } 5587}; 5588 5589UNCODE.twentytwenty = function() { 5590 5591 if (!$('.twentytwenty-container').length) return; 5592 5593// DOM.event.move 5594// 5595// 2.0.0 5596// 5597// Stephen Band 5598// 5599// Triggers 'movestart', 'move' and 'moveend' events after 5600// mousemoves following a mousedown cross a distance threshold, 5601// similar to the native 'dragstart', 'drag' and 'dragend' events. 5602// Move events are throttled to animation frames. Move event objects 5603// have the properties: 5604// 5605// pageX: 5606// pageY: Page coordinates of pointer. 5607// startX: 5608// startY: Page coordinates of pointer at movestart. 5609// distX: 5610// distY: Distance the pointer has moved since movestart. 5611// deltaX: 5612// deltaY: Distance the finger has moved since last event. 5613// velocityX: 5614// velocityY: Average velocity over last few events. 5615 5616 5617(function(fn) { 5618 if (typeof define === 'function' && define.amd) { 5619 define([], fn); 5620 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5621 module.exports = fn; 5622 } else { 5623 fn(); 5624 } 5625})(function(){ 5626 var assign = Object.assign || window.jQuery && jQuery.extend; 5627 5628 // Number of pixels a pressed pointer travels before movestart 5629 // event is fired. 5630 var threshold = 8; 5631 5632 // Shim for requestAnimationFrame, falling back to timer. See: 5633 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5634 var requestFrame = (function(){ 5635 return ( 5636 window.requestAnimationFrame || 5637 window.webkitRequestAnimationFrame || 5638 window.mozRequestAnimationFrame || 5639 window.oRequestAnimationFrame || 5640 window.msRequestAnimationFrame || 5641 function(fn, element){ 5642 return window.setTimeout(function(){ 5643 fn(); 5644 }, 25); 5645 } 5646 ); 5647 })(); 5648 5649 // Shim for customEvent 5650 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5651 (function () { 5652 if ( typeof window.CustomEvent === "function" ) return false; 5653 function CustomEvent ( event, params ) { 5654 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5655 var evt = document.createEvent( 'CustomEvent' ); 5656 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5657 return evt; 5658 } 5659 5660 CustomEvent.prototype = window.Event.prototype; 5661 window.CustomEvent = CustomEvent; 5662 })(); 5663 5664 var ignoreTags = { 5665 textarea: true, 5666 input: true, 5667 select: true, 5668 button: true 5669 }; 5670 5671 var mouseevents = { 5672 move: 'mousemove', 5673 cancel: 'mouseup dragstart', 5674 end: 'mouseup' 5675 }; 5676 5677 var touchevents = { 5678 move: 'touchmove', 5679 cancel: 'touchend', 5680 end: 'touchend' 5681 }; 5682 5683 var rspaces = /\s+/; 5684 5685 5686 // DOM Events 5687 5688 var eventOptions = { bubbles: true, cancelable: true }; 5689 5690 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5691 5692 function createEvent(type) { 5693 return new CustomEvent(type, eventOptions); 5694 } 5695 5696 function getEvents(node) { 5697 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5698 } 5699 5700 function on(node, types, fn, data, selector) {
5701 types = types.split(rspaces); 5702 5703 var events = getEvents(node); 5704 var i = types.length; 5705 var handlers, type; 5706 5707 function handler(e) { fn(e, data); } 5708 5709 while (i--) { 5710 type = types[i]; 5711 handlers = events[type] || (events[type] = []); 5712 handlers.push([fn, handler]); 5713 node.addEventListener(type, handler); 5714 } 5715 } 5716 5717 function off(node, types, fn, selector) { 5718 types = types.split(rspaces); 5719 5720 var events = getEvents(node); 5721 var i = types.length; 5722 var type, handlers, k; 5723 5724 if (!events) { return; } 5725 5726 while (i--) { 5727 type = types[i]; 5728 handlers = events[type]; 5729 if (!handlers) { continue; } 5730 k = handlers.length; 5731 while (k--) { 5732 if (handlers[k][0] === fn) { 5733 node.removeEventListener(type, handlers[k][1]); 5734 handlers.splice(k, 1); 5735 } 5736 } 5737 } 5738 } 5739 5740 function trigger(node, type, properties) { 5741 // Don't cache events. It prevents you from triggering an event of a 5742 // given type from inside the handler of another event of that type. 5743 var event = createEvent(type); 5744 if (properties) { assign(event, properties); } 5745 node.dispatchEvent(event); 5746 } 5747 5748 5749 // Constructors 5750 5751 function Timer(fn){ 5752 var callback = fn, 5753 active = false, 5754 running = false; 5755 5756 function trigger(time) { 5757 if (active){ 5758 callback(); 5759 requestFrame(trigger); 5760 running = true; 5761 active = false; 5762 } 5763 else { 5764 running = false; 5765 } 5766 } 5767 5768 this.kick = function(fn) { 5769 active = true; 5770 if (!running) { trigger(); } 5771 }; 5772 5773 this.end = function(fn) { 5774 var cb = callback; 5775 5776 if (!fn) { return; } 5777 5778 // If the timer is not running, simply call the end callback. 5779 if (!running) { 5780 fn(); 5781 } 5782 // If the timer is running, and has been kicked lately, then 5783 // queue up the current callback and the end callback, otherwise 5784 // just the end callback. 5785 else { 5786 callback = active ? 5787 function(){ cb(); fn(); } : 5788 fn ; 5789 5790 active = true; 5791 } 5792 }; 5793 } 5794 5795 5796 // Functions 5797 5798 function noop() {} 5799 5800 function preventDefault(e) { 5801 e.preventDefault(); 5802 } 5803 5804 function isIgnoreTag(e) { 5805 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5806 } 5807 5808 function isPrimaryButton(e) { 5809 // Ignore mousedowns on any button other than the left (or primary) 5810 // mouse button, or when a modifier key is pressed. 5811 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5812 } 5813 5814 function identifiedTouch(touchList, id) { 5815 var i, l; 5816 5817 if (touchList.identifiedTouch) { 5818 return touchList.identifiedTouch(id); 5819 } 5820 5821 // touchList.identifiedTouch() does not exist in 5822 // webkit yet… we must do the search ourselves... 5823 5824 i = -1; 5825 l = touchList.length; 5826 5827 while (++i < l) { 5828 if (touchList[i].identifier === id) { 5829 return touchList[i]; 5830 } 5831 } 5832 } 5833 5834 function changedTouch(e, data) { 5835 var touch = identifiedTouch(e.changedTouches, data.identifier); 5836 5837 // This isn't the touch you're looking for. 5838 if (!touch) { return; } 5839 5840 // Chrome Android (at least) includes touches that have not 5841 // changed in e.changedTouches. That's a bit annoying. Check 5842 // that this touch has changed. 5843 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5844 5845 return touch; 5846 } 5847 5848 5849 // Handlers that decide when the first movestart is triggered 5850 5851 function mousedown(e){ 5852 // Ignore non-primary buttons 5853 if (!isPrimaryButton(e)) { return; } 5854 5855 // Ignore form and interactive elements 5856 if (isIgnoreTag(e)) { return; } 5857 5858 on(document, mouseevents.move, mousemove, e); 5859 on(document, mouseevents.cancel, mouseend, e); 5860 } 5861 5862 function mousemove(e, data){ 5863 checkThreshold(e, data, e, removeMouse); 5864 } 5865 5866 function mouseend(e, data) { 5867 removeMouse(); 5868 } 5869 5870 function removeMouse() { 5871 off(document, mouseevents.move, mousemove); 5872 off(document, mouseevents.cancel, mouseend); 5873 } 5874 5875 function touchstart(e) { 5876 // Don't get in the way of interaction with form elements 5877 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5878 5879 var touch = e.changedTouches[0]; 5880 5881 // iOS live updates the touch objects whereas Android gives us copies. 5882 // That means we can't trust the touchstart object to stay the same, 5883 // so we must copy the data. This object acts as a template for 5884 // movestart, move and moveend event objects. 5885 var data = { 5886 target: touch.target, 5887 pageX: touch.pageX, 5888 pageY: touch.pageY, 5889 identifier: touch.identifier, 5890 5891 // The only way to make handlers individually unbindable is by 5892 // making them unique. 5893 touchmove: function(e, data) { touchmove(e, data); }, 5894 touchend: function(e, data) { touchend(e, data); } 5895 }; 5896 5897 on(document, touchevents.move, data.touchmove, data); 5898 on(document, touchevents.cancel, data.touchend, data); 5899 } 5900 5901 function touchmove(e, data) { 5902 var touch = changedTouch(e, data); 5903 if (!touch) { return; } 5904 checkThreshold(e, data, touch, removeTouch); 5905 } 5906 5907 function touchend(e, data) { 5908 var touch = identifiedTouch(e.changedTouches, data.identifier); 5909 if (!touch) { return; } 5910 removeTouch(data); 5911 } 5912 5913 function removeTouch(data) { 5914 off(document, touchevents.move, data.touchmove); 5915 off(document, touchevents.cancel, data.touchend); 5916 } 5917 5918 function checkThreshold(e, data, touch, fn) { 5919 var distX = touch.pageX - data.pageX; 5920 var distY = touch.pageY - data.pageY; 5921
5922 // Do nothing if the threshold has not been crossed. 5923 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5924 5925 triggerStart(e, data, touch, distX, distY, fn); 5926 } 5927 5928 function triggerStart(e, data, touch, distX, distY, fn) { 5929 var touches = e.targetTouches; 5930 var time = e.timeStamp - data.timeStamp; 5931 5932 // Create a movestart object with some special properties that 5933 // are passed only to the movestart handlers. 5934 var template = { 5935 altKey: e.altKey, 5936 ctrlKey: e.ctrlKey, 5937 shiftKey: e.shiftKey, 5938 startX: data.pageX, 5939 startY: data.pageY, 5940 distX: distX, 5941 distY: distY, 5942 deltaX: distX, 5943 deltaY: distY, 5944 pageX: touch.pageX, 5945 pageY: touch.pageY, 5946 velocityX: distX / time, 5947 velocityY: distY / time, 5948 identifier: data.identifier, 5949 targetTouches: touches, 5950 finger: touches ? touches.length : 1, 5951 enableMove: function() { 5952 this.moveEnabled = true; 5953 this.enableMove = noop; 5954 e.preventDefault(); 5955 } 5956 }; 5957 5958 // Trigger the movestart event. 5959 trigger(data.target, 'movestart', template); 5960 5961 // Unbind handlers that tracked the touch or mouse up till now. 5962 fn(data); 5963 } 5964 5965 5966 // Handlers that control what happens following a movestart 5967 5968 function activeMousemove(e, data) { 5969 var timer = data.timer; 5970 5971 data.touch = e; 5972 data.timeStamp = e.timeStamp; 5973 timer.kick(); 5974 } 5975 5976 function activeMouseend(e, data) { 5977 var target = data.target; 5978 var event = data.event; 5979 var timer = data.timer; 5980 5981 removeActiveMouse(); 5982 5983 endEvent(target, event, timer, function() { 5984 // Unbind the click suppressor, waiting until after mouseup 5985 // has been handled. 5986 setTimeout(function(){ 5987 off(target, 'click', preventDefault); 5988 }, 0); 5989 }); 5990 } 5991 5992 function removeActiveMouse() { 5993 off(document, mouseevents.move, activeMousemove); 5994 off(document, mouseevents.end, activeMouseend); 5995 } 5996 5997 function activeTouchmove(e, data) { 5998 var event = data.event; 5999 var timer = data.timer; 6000 var touch = changedTouch(e, event); 6001 6002 if (!touch) { return; } 6003 6004 // Stop the interface from gesturing 6005 e.preventDefault(); 6006 6007 event.targetTouches = e.targetTouches; 6008 data.touch = touch; 6009 data.timeStamp = e.timeStamp; 6010 6011 timer.kick(); 6012 } 6013 6014 function activeTouchend(e, data) { 6015 var target = data.target; 6016 var event = data.event; 6017 var timer = data.timer; 6018 var touch = identifiedTouch(e.changedTouches, event.identifier); 6019 6020 // This isn't the touch you're looking for. 6021 if (!touch) { return; } 6022 6023 removeActiveTouch(data); 6024 endEvent(target, event, timer); 6025 } 6026 6027 function removeActiveTouch(data) { 6028 off(document, touchevents.move, data.activeTouchmove); 6029 off(document, touchevents.end, data.activeTouchend); 6030 } 6031 6032 6033 // Logic for triggering move and moveend events 6034 6035 function updateEvent(event, touch, timeStamp) { 6036 var time = timeStamp - event.timeStamp; 6037 6038 event.distX = touch.pageX - event.startX; 6039 event.distY = touch.pageY - event.startY; 6040 event.deltaX = touch.pageX - event.pageX; 6041 event.deltaY = touch.pageY - event.pageY; 6042 6043 // Average the velocity of the last few events using a decay 6044 // curve to even out spurious jumps in values. 6045 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 6046 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 6047 event.pageX = touch.pageX; 6048 event.pageY = touch.pageY; 6049 } 6050 6051 function endEvent(target, event, timer, fn) { 6052 timer.end(function(){ 6053 trigger(target, 'moveend', event); 6054 return fn && fn(); 6055 }); 6056 } 6057 6058 6059 // Set up the DOM 6060 6061 function movestart(e) { 6062 if (e.defaultPrevented) { return; } 6063 if (!e.moveEnabled) { return; } 6064 6065 var event = { 6066 startX: e.startX, 6067 startY: e.startY, 6068 pageX: e.pageX, 6069 pageY: e.pageY, 6070 distX: e.distX, 6071 distY: e.distY, 6072 deltaX: e.deltaX, 6073 deltaY: e.deltaY, 6074 velocityX: e.velocityX, 6075 velocityY: e.velocityY, 6076 identifier: e.identifier, 6077 targetTouches: e.targetTouches, 6078 finger: e.finger 6079 }; 6080 6081 var data = { 6082 target: e.target, 6083 event: event, 6084 timer: new Timer(update), 6085 touch: undefined, 6086 timeStamp: e.timeStamp 6087 }; 6088 6089 function update(time) { 6090 updateEvent(event, data.touch, data.timeStamp); 6091 trigger(data.target, 'move', event); 6092 } 6093 6094 if (e.identifier === undefined) { 6095 // We're dealing with a mouse event. 6096 // Stop clicks from propagating during a move 6097 on(e.target, 'click', preventDefault); 6098 on(document, mouseevents.move, activeMousemove, data); 6099 on(document, mouseevents.end, activeMouseend, data); 6100 } 6101 else { 6102 // In order to unbind correct handlers they have to be unique 6103 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 6104 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 6105 6106 // We're dealing with a touch. 6107 on(document, touchevents.move, data.activeTouchmove, data); 6108 on(document, touchevents.end, data.activeTouchend, data); 6109 } 6110 } 6111 6112 on(document, 'mousedown', mousedown); 6113 on(document, 'touchstart', touchstart); 6114 on(document, 'movestart', movestart); 6115 6116 6117 // jQuery special events 6118 // 6119 // jQuery event objects are copies of DOM event objects. They need 6120 // a little help copying the move properties across. 6121 6122 if (!window.jQuery) { return; } 6123 6124 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 6125 6126 function enableMove1(e) { e.enableMove(); } 6127 function enableMove2(e) { e.enableMove(); } 6128 function enableMove3(e) { e.enableMove(); } 6129 6130 function add(handleObj) { 6131 var handler = handleObj.handler; 6132 6133 handleObj.handler = function(e) { 6134 // Copy move properties across from originalEvent 6135 var i = properties.length; 6136 var property; 6137 6138 while(i--) { 6139 property = properties[i]; 6140 e[property] = e.originalEvent[property]; 6141 } 6142 6143 handler.apply(this, arguments); 6144 }; 6145 } 6146 6147 jQuery.event.special.movestart = { 6148 setup: function() { 6149 // Movestart must be enabled to allow other move events 6150 on(this, 'movestart', enableMove1); 6151 6152 // Do listen to DOM events 6153 return false;
6154 }, 6155 6156 teardown: function() { 6157 off(this, 'movestart', enableMove1); 6158 return false; 6159 }, 6160 6161 add: add 6162 }; 6163 6164 jQuery.event.special.move = { 6165 setup: function() { 6166 on(this, 'movestart', enableMove2); 6167 return false; 6168 }, 6169 6170 teardown: function() { 6171 off(this, 'movestart', enableMove2); 6172 return false; 6173 }, 6174 6175 add: add 6176 }; 6177 6178 jQuery.event.special.moveend = { 6179 setup: function() { 6180 on(this, 'movestart', enableMove3); 6181 return false; 6182 }, 6183 6184 teardown: function() { 6185 off(this, 'movestart', enableMove3); 6186 return false; 6187 }, 6188 6189 add: add 6190 }; 6191}); 6192 6193 $.fn.twentytwenty = function(options) { 6194 var options = $.extend({ 6195 default_offset_pct: 0.5, 6196 orientation: 'horizontal', 6197 before_label: 'Before', 6198 after_label: 'After', 6199 no_overlay: false, 6200 move_slider_on_hover: false, 6201 move_with_handle_only: true, 6202 click_to_move: false 6203 }, options); 6204 6205 return this.each(function() { 6206 6207 var sliderPct = options.default_offset_pct; 6208 var container = $(this); 6209 var sliderOrientation = options.orientation; 6210 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 6211 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 6212 6213 6214 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 6215 if(!options.no_overlay) { 6216 container.append("<div class='twentytwenty-overlay'></div>"); 6217 var overlay = container.find(".twentytwenty-overlay"); 6218 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 6219 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 6220 } 6221 var beforeImg = container.find("img:first"); 6222 var afterImg = container.find("img:last"); 6223 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 6224 var slider = container.find(".twentytwenty-handle"); 6225 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 6226 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 6227 container.addClass("twentytwenty-container"); 6228 beforeImg.addClass("twentytwenty-before"); 6229 afterImg.addClass("twentytwenty-after"); 6230 6231 var calcOffset = function(dimensionPct) { 6232 var w = beforeImg.width(); 6233 var h = beforeImg.height(); 6234 return { 6235 w: w+"px", 6236 h: h+"px", 6237 cw: (dimensionPct*w)+"px", 6238 ch: (dimensionPct*h)+"px" 6239 }; 6240 }; 6241 6242 var adjustContainer = function(offset) { 6243 if (sliderOrientation === 'vertical') { 6244 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 6245 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 6246 } 6247 else { 6248 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 6249 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 6250 } 6251 container.css("height", offset.h); 6252 }; 6253 6254 var adjustSlider = function(pct) { 6255 var offset = calcOffset(pct); 6256 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 6257 adjustContainer(offset); 6258 }; 6259 6260 // Return the number specified or the min/max number if it outside the range given. 6261 var minMaxNumber = function(num, min, max) { 6262 return Math.max(min, Math.min(max, num)); 6263 }; 6264 6265 // Calculate the slider percentage based on the position. 6266 var getSliderPercentage = function(positionX, positionY) { 6267 var sliderPercentage = (sliderOrientation === 'vertical') ? 6268 (positionY-offsetY)/imgHeight : 6269 (positionX-offsetX)/imgWidth; 6270 6271 return minMaxNumber(sliderPercentage, 0, 1); 6272 }; 6273 6274 6275 $(window).on("resize.twentytwenty", function(e) { 6276 adjustSlider(sliderPct); 6277 }); 6278 6279 var offsetX = 0; 6280 var offsetY = 0; 6281 var imgWidth = 0; 6282 var imgHeight = 0; 6283 var onMoveStart = function(e) { 6284 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 6285 e.preventDefault(); 6286 } 6287 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 6288 e.preventDefault(); 6289 } 6290 container.addClass("active"); 6291 offsetX = container.offset().left; 6292 offsetY = container.offset().top; 6293 imgWidth = beforeImg.width(); 6294 imgHeight = beforeImg.height(); 6295 }; 6296 var onMove = function(e) { 6297 if (container.hasClass("active")) { 6298 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6299 adjustSlider(sliderPct); 6300 } 6301 }; 6302 var onMoveEnd = function() { 6303 container.removeClass("active"); 6304 }; 6305 6306 var moveTarget = options.move_with_handle_only ? slider : container; 6307 moveTarget.on("movestart",onMoveStart); 6308 moveTarget.on("move",onMove); 6309 moveTarget.on("moveend",onMoveEnd); 6310 6311 if (options.move_slider_on_hover) { 6312 container.on("mouseenter", onMoveStart); 6313 container.on("mousemove", onMove); 6314 container.on("mouseleave", onMoveEnd); 6315 } 6316 6317 slider.on("touchmove", function(e) { 6318 e.preventDefault(); 6319 }); 6320 6321 container.find("img").on("mousedown", function(event) { 6322 event.preventDefault(); 6323 }); 6324 6325 if (options.click_to_move) { 6326 container.on('click', function(e) { 6327 offsetX = container.offset().left; 6328 offsetY = container.offset().top; 6329 imgWidth = beforeImg.width(); 6330 imgHeight = beforeImg.height(); 6331 6332 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6333 adjustSlider(sliderPct); 6334 }); 6335 } 6336 6337 $(window).trigger("resize.twentytwenty"); 6338 }); 6339 }; 6340 6341 6342 $(window).on("load", function(e) { 6343 $('.twentytwenty-container').each(function(){ 6344 var $container = $(this); 6345 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6346 $container.twentytwenty(); 6347 } 6348 $('img', $container).on('async-done', function(){ 6349 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6350 $container.twentytwenty(); 6351 } 6352 }); 6353 }); 6354 }); 6355} 6356 6357UNCODE.justifiedGallery = function() { 6358 6359 var breakPointMe = function( val ) { 6360 val = parseInt( val ); 6361 if ( isNaN(val) ) { 6362 return false;
6363 } 6364 if ( val >= 1500 ) { 6365 return 1; 6366 } else if ( val < 1500 && val >= 960 ) { 6367 return 2; 6368 } else if ( val < 960 && val >= 570 ) { 6369 return 3; 6370 } else if ( val < 570 ) { 6371 return 4; 6372 } 6373 } 6374 6375 var gutterByBreakpoint = function( bp, gutter ) { 6376 var ret; 6377 switch(gutter) { 6378 case 'no-gutter': 6379 ret = 0; 6380 break; 6381 case 'px-gutter': 6382 ret = 1; 6383 break; 6384 case 'half-gutter': 6385 ret = 18; 6386 break; 6387 case 'double-gutter': 6388 switch(bp) { 6389 case 3: 6390 case 4: 6391 ret = 36; 6392 break; 6393 default: 6394 ret = 72; 6395 break; 6396 } 6397 break; 6398 case 'triple-gutter': 6399 switch(bp) { 6400 case 3: 6401 case 4: 6402 ret = 36; 6403 break; 6404 default: 6405 ret = 108; 6406 break; 6407 } 6408 break; 6409 case 'quad-gutter': 6410 switch(bp) { 6411 case 2: 6412 ret = 108; 6413 break; 6414 case 3: 6415 ret = 72; 6416 break; 6417 case 4: 6418 ret = 36; 6419 break; 6420 default: 6421 ret = 144; 6422 break; 6423 } 6424 break; 6425 default: 6426 ret = 36;//single-gutter 6427 } 6428 return ret; 6429 } 6430 6431 if ($('.justified-layout').length > 0) { 6432 var justifiedContainersArray = [], 6433 typeGridArray = [], 6434 layoutGridArray = [], 6435 transitionDuration = [], 6436 $filterItems = [], 6437 $filters = $('.justified-system .isotope-filters'), 6438 $itemSelector = '.tmb', 6439 $items, 6440 itemMargin, 6441 correctionFactor = 0, 6442 firstLoad = true, 6443 isOriginLeft = $('body').hasClass('rtl') ? false : true, 6444 prevW = breakPointMe(UNCODE.wwidth); 6445 $('[class*="justified-container"]').each(function() { 6446 var isoData = $(this).data(); 6447 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6448 if (isoData.type == 'metro') typeGridArray.push(true); 6449 else typeGridArray.push(false); 6450 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 6451 else layoutGridArray.push('justified'); 6452 justifiedContainersArray.push($(this)); 6453 }); 6454 var init_justifiedGallery = function() { 6455 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 6456 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 6457 justifiedId = justifiedSystem.attr('id'), 6458 $layoutMode = layoutGridArray[i], 6459 gutter = $(justifiedContainersArray[i]).data('gutter'), 6460 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 6461 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 6462 lastRow = $(justifiedContainersArray[i]).data('last-row'), 6463 margins; 6464 6465 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 6466 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 6467 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6468 6469 margins = gutterByBreakpoint(prevW, gutter); 6470 6471 $(justifiedContainersArray[i]).justifiedGallery({ 6472 rowHeight: rowHeight, 6473 maxRowHeight: maxRowHeight, 6474 margins: margins, 6475 cssAnimation: true, 6476 lastRow: lastRow, 6477 waitThumbnailsLoad: false 6478 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 6479 6480 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 6481 $(justifiedContainersArray[i]).infinitescroll({ 6482 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 6483 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6484 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 6485 animate: false, 6486 behavior: 'local', 6487 debug: false, 6488 loading: { 6489 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 6490 speed: 0, 6491 finished: undefined, 6492 msg: $('#' + justifiedId + ' .loadmore-button'), 6493 }, 6494 errorCallback: function() { 6495 var justified_system = $(this).closest('.justified-system'); 6496 $('.loading-button', justified_system).hide(); 6497 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6498 } 6499 }, 6500 // append the new items to galleryJustified on the infinitescroll callback function. 6501 function(newElements, opts) { 6502 var $galleryJustified = $(this), 6503 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6504 filters = new Array(), 6505 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6506 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6507 $numPages = $('a', $infinite_button).data('pages'),
6508 delay = 300; 6509 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6510 $infinite_button.show(); 6511 $loading_button.hide(); 6512 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6513 $('> li', $galleryJustified).remove(); 6514 $.each($(newElements), function(index, val) { 6515 $(val).addClass('tmb-iso'); 6516 if ($(val).is("li")) { 6517 filters.push($(val)[0]); 6518 } 6519 $(val).addClass('uncode-appended'); 6520 }); 6521 newElements = newElements.filter(function(x) { 6522 return filters.indexOf(x) < 0 6523 }); 6524 $.each($(filters), function(index, val) { 6525 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6526 }); 6527 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6528 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6529 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6530 if (typeof getLightbox === 'object') { 6531 getLightbox.refresh(); 6532 } else { 6533 UNCODE.lightbox(); 6534 } 6535 } 6536 if ( typeof twttr !== 'undefined' ) 6537 twttr.widgets.load(justifiedContainersArray[i]); 6538 6539 requestTimeout(function() { 6540 $galleryJustified.trigger('more-items-loaded'); 6541 $(window).trigger('more-items-loaded'); 6542 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6543 }, 1000); 6544 }); 6545 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6546 var $infinite_justified = $(justifiedContainersArray[i]), 6547 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6548 $infinite_justified.infinitescroll('pause'); 6549 $infinite_button.on('click', function(event) { 6550 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6551 $.each(UNCODE.lightboxArray, function(index, val) { 6552 UNCODE.lightboxArray[index].destroy(); 6553 }); 6554 } 6555 event.preventDefault(); 6556 var $justified_system = $(event.target).closest('.justified-system'), 6557 $infinite_justified = $justified_system.find('.justified-container'), 6558 justifiedId = $justified_system.attr('id'); 6559 $(event.currentTarget).html(SiteParameters.loading); 6560 $infinite_justified.infinitescroll('resume'); 6561 $infinite_justified.infinitescroll('retrieve'); 6562 $infinite_justified.infinitescroll('pause'); 6563 $infinite_justified.trigger('more-items-loaded'); 6564 $(window).trigger('more-items-loaded'); 6565 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6566 }); 6567 } 6568 } 6569 } 6570 }, 6571 onLayout = function(justifiedObj, startIndex) { 6572 justifiedObj.css('opacity', 1); 6573 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6574 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6575 6576 requestTimeout(function() { 6577 // window.dispatchEvent(UNCODE.boxEvent); 6578 UNCODE.adaptive(); 6579 if (SiteParameters.dynamic_srcset_active === '1') { 6580 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6581 } 6582 if (typeof MediaElement === "function") { 6583 $(justifiedObj).find('audio,video').each(function() { 6584 $(this).mediaelementplayer({ 6585 pauseOtherPlayers: false, 6586 }); 6587 }); 6588 } 6589 if ($(justifiedObj).find('.nested-carousel').length) { 6590 if (typeof UNCODE.carousel !== 'undefined') { 6591 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6592 } 6593 requestTimeout(function() { 6594 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6595 justifiedObj.addClass('justified-gallery-finished') 6596 Waypoint.refreshAll(); 6597 }, 200); 6598 } else { 6599 requestTimeout(function() { 6600 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6601 justifiedObj.addClass('justified-gallery-finished') 6602 Waypoint.refreshAll(); 6603 }, 300); 6604 } 6605 }, 100); 6606 6607 }, 6608 boxAnimation = function(items, startIndex, sequential, container) { 6609 var $allItems = items.length - startIndex, 6610 showed = 0, 6611 index = 0; 6612 if (container.closest('.owl-item').length == 1) return false;
6613 $.each(items, function(index, val) { 6614 var elInner = $('> .t-inside', val); 6615 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6616 return; 6617 } 6618 if (val[0]) val = val[0]; 6619 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6620 new Waypoint({ 6621 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6622 element: val, 6623 handler: function() { 6624 var element = $('> .t-inside', this.element), 6625 parent = $(this.element), 6626 currentIndex = parent.index(); 6627 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6628 delayAttr = parseInt(element.attr('data-delay')); 6629 if (isNaN(delayAttr)) delayAttr = 100; 6630 delay -= showed; 6631 var objTimeout = requestTimeout(function() { 6632 element.removeClass('zoom-reverse').addClass('start_animation'); 6633 showed = parent.index(); 6634 }, delay * delayAttr); 6635 parent.data('objTimeout', objTimeout); 6636 if (!UNCODE.isUnmodalOpen) { 6637 this.destroy(); 6638 } 6639 }, 6640 offset: '100%' 6641 }) 6642 } else { 6643 elInner.removeClass('animate_when_almost_visible'); 6644 $(val).addClass('no-waypoint-animation'); 6645 /*if (elInner.hasClass('force-anim')) { 6646 elInner.addClass('start_animation'); 6647 } else { 6648 elInner.css('opacity', 1); 6649 }*/ 6650 } 6651 index++; 6652 }); 6653 }; 6654 $filters.on('click', 'a[data-filter]', function(evt) { 6655 var $filter = $(this), 6656 filterContainer = $filter.closest('.isotope-filters'), 6657 filterValue = $filter.attr('data-filter'), 6658 container = $filter.closest('.justified-system').find($('.justified-layout')), 6659 lastRow = container.data('last-row'), 6660 transitionDuration = 0, 6661 delay = 300, 6662 filterItems = []; 6663 6664 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6665 6666 var filter_items = function(){ 6667 if (filterValue !== undefined) { 6668 $.each($('> .tmb > .t-inside', container), function(index, val) { 6669 var parent = $(val).parent(), 6670 objTimeout = parent.data('objTimeout'); 6671 if (objTimeout) { 6672 $(val).removeClass('zoom-reverse'); 6673 clearRequestTimeout(objTimeout); 6674 } 6675 if (transitionDuration == 0) { 6676 if ($(val).hasClass('animate_when_almost_visible')) { 6677 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6678 } else { 6679 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6680 } 6681 } 6682 }); 6683 6684 requestTimeout(function() { 6685 var $block, 6686 selector, 6687 lightboxElements, 6688 $boxes; 6689 6690 if ( filterValue !== '' && filterValue !== '*' ) { 6691 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6692 selector = '.' + filterValue; 6693 $.each($(selector, container), function(index, block) { 6694 lightboxElements = $('[data-lbox^=ilightbox]', block); 6695 if (lightboxElements.length) { 6696 lightboxElements.removeClass('lb-disabled'); 6697 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6698 } 6699 filterItems.push(block); 6700 }); 6701 container.justifiedGallery({ 6702 filter: selector, 6703 lastRow: 'nojustify' 6704 }); 6705 } else { 6706 container.justifiedGallery({ 6707 filter: false, 6708 lastRow: lastRow 6709 }); 6710 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6711 filterItems = $('> .tmb', container); 6712 } 6713 container.trigger('more-items-loaded'); 6714 $(window).trigger('more-items-loaded'); 6715 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6716 6717 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6718 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6719 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6720 if (typeof getLightbox === 'object') { 6721 getLightbox.refresh(); 6722 } else { 6723 UNCODE.lightbox(); 6724 } 6725 } 6726 6727 if (transitionDuration == 0) { 6728 requestTimeout(function() { 6729 boxAnimation(filterItems, 0, false, container); 6730 }, 100); 6731 } 6732 requestTimeout(function() { 6733 Waypoint.refreshAll(); 6734 container.trigger('more-items-loaded'); 6735 $(window).trigger('more-items-loaded'); 6736 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6737 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 6738 $(document).trigger('uncode-scrolltrigger-refresh'); 6739 } 6740 }, 2000); 6741 6742 }, delay); 6743 } else { 6744 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6745 $.each(UNCODE.lightboxArray, function(index, val) { 6746 UNCODE.lightboxArray[index].destroy(); 6747 }); 6748 } 6749 $.each($('> .tmb > .t-inside', container), function(index, val) { 6750 var parent = $(val).parent(), 6751 objTimeout = parent.data('objTimeout'); 6752 if (objTimeout) { 6753 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6754 clearRequestTimeout(objTimeout); 6755 } 6756 if (transitionDuration == 0) { 6757 if ($(val).hasClass('animate_when_almost_visible')) { 6758 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6759 } else { 6760 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6761 } 6762 } 6763 }); 6764 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6765 UNCODE.lightbox(); 6766 } 6767 container.parent().addClass('justified-loading'); 6768 container.trigger('more-items-loaded'); 6769 $(window).trigger('more-items-loaded'); 6770 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6771 } 6772 }; 6773 6774 if (!$filter.hasClass('active')) { 6775 /** Scroll top with filtering */ 6776 if (filterContainer.hasClass('filter-scroll')) { 6777 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6778 calc_scroll -= UNCODE.get_scroll_offset(); 6779 6780 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6781 delta = bodyTop - calc_scroll, 6782 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6783 filterTolerance = false, 6784 filter_timeout; 6785 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6786 6787 if ( !UNCODE.isFullPage ) { 6788 if (scrollSpeed == 0) { 6789 $('html, body').scrollTop(calc_scroll); 6790 UNCODE.scrolling = false;
6791 filter_items(); 6792 } else { 6793 6794 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6795 filter_items(); 6796 filterTolerance = true; 6797 } 6798 6799 $('html, body').animate({ 6800 scrollTop: calc_scroll 6801 },{ 6802 easing: 'easeInOutQuad', 6803 duration: scrollSpeed, 6804 complete: function(){ 6805 UNCODE.scrolling = false; 6806 if ( !filterTolerance ) { 6807 filter_timeout = setTimeout(function(){ 6808 clearTimeout(filter_timeout); 6809 filter_items(); 6810 }, 200); 6811 } 6812 } 6813 }); 6814 } 6815 } 6816 } else { 6817 filter_items(); 6818 } 6819 } 6820 evt.preventDefault(); 6821 }); 6822 6823 $filters.each(function(i, buttonGroup) { 6824 var $buttonGroup = $(buttonGroup); 6825 $buttonGroup.on('click', 'a', function() { 6826 $buttonGroup.find('.active').removeClass('active'); 6827 $(this).addClass('active'); 6828 }); 6829 6830 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6831 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6832 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6833 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6834 e.preventDefault(); 6835 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6836 }); 6837 }); 6838 window.addEventListener('boxResized', function(e) { 6839 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6840 prevW = breakPointMe(UNCODE.wwidth); 6841 $.each($('.justified-layout'), function(index, val) { 6842 var gutter = $(this).data('gutter'), 6843 margins = gutterByBreakpoint( prevW, gutter); 6844 $(this).justifiedGallery({ 6845 margins: margins 6846 }); 6847 $(this).find('.mejs-video,.mejs-audio').each(function() { 6848 $(this).trigger('resize'); 6849 }); 6850 }); 6851 } 6852 }, false); 6853 6854 init_justifiedGallery(); 6855 }; 6856}; 6857 6858UNCODE.cssGrid = function() { 6859 if ($('.cssgrid-layout').length > 0) { 6860 var cssGridContainersArray = []; 6861 var transitionDuration = []; 6862 var $filters = $('.cssgrid-system .cssgrid-filters'); 6863 6864 $('[class*="cssgrid-container"]').each(function() { 6865 cssGridContainersArray.push($(this)); 6866 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6867 }); 6868 6869 var init_cssGridAjax = function() { 6870 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6871 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6872 cssGridId = cssGridSystem.attr('id'); 6873 6874 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6875 6876 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6877 $(cssGridContainersArray[i]).infinitescroll({ 6878 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6879 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6880 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 6881 animate: false, 6882 behavior: 'local', 6883 debug: false, 6884 loading: { 6885 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6886 speed: 0, 6887 finished: undefined, 6888 msg: $('#' + cssGridId + ' .loadmore-button'), 6889 }, 6890 errorCallback: function() { 6891 var cssgrid_system = $(this).closest('.cssgrid-system'); 6892 $('.loading-button', cssgrid_system).hide(); 6893 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6894 } 6895 }, 6896 // append the new items to cssGrid on the infinitescroll callback function. 6897 function(newElements, opts) { 6898 var $cssGrid = $(this), 6899 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6900 cssGridId = cssGridSystemCont.attr('id'), 6901 filters = new Array(), 6902 $loading_button = cssGridSystemCont.find('.loading-button'), 6903 $infinite_button = cssGridSystemCont.find('.loadmore-button'), 6904 $numPages = $('a', $infinite_button).data('pages'), 6905 $woo_results,
6906 delay = 300; 6907 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6908 $infinite_button.show(); 6909 $loading_button.hide(); 6910 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6911 $('> li', $cssGrid).remove(); 6912 $('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove(); 6913 $.each($(newElements), function (index, val) { 6914 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 6915 $woo_results = $(val); 6916 delete newElements[index]; 6917 } else { 6918 $(val).addClass('tmb-grid'); 6919 if ($(val).is("li")) { 6920 filters.push($(val)[0]); 6921 } 6922 } 6923 $(val).addClass('uncode-appended'); 6924 }); 6925 newElements = newElements.filter(function(x) { 6926 return filters.indexOf(x) < 0 6927 }); 6928 $.each($(filters), function(index, val) { 6929 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6930 }); 6931 if ($woo_results && $woo_results.length > 0) { 6932 var old_count = cssGridSystemCont.find('.woocommerce-result-count').text(); 6933 var new_count = $woo_results.find('.woocommerce-result-count').text(); 6934 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 6935 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 6936 function replaceMatch(match, p1, p2) { 6937 return old_start + '–' + new_end; 6938 } 6939 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 6940 cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text); 6941 } 6942 6943 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6944 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6945 if (filterValue !== undefined && filterValue != '*') { 6946 $(newElements).hide(); 6947 var els_to_show = $(); 6948 $(newElements).each(function() { 6949 var el = $(this); 6950 if (el.hasClass(filterValue)) { 6951 els_to_show = els_to_show.add(el); 6952 el.show(); 6953 } 6954 }); 6955 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6956 } else { 6957 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6958 } 6959 6960 UNCODE.adaptive(); 6961 if (SiteParameters.dynamic_srcset_active === '1') { 6962 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6963 } 6964 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6965 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6966 if (typeof getLightbox === 'object') { 6967 getLightbox.refresh(); 6968 } else { 6969 UNCODE.lightbox(); 6970 } 6971 } 6972 if ( typeof twttr !== 'undefined' ) { 6973 twttr.widgets.load(cssGridContainersArray[i]); 6974 } 6975 6976 UNCODE.carousel($(newElements)); 6977 requestTimeout(function() { 6978 $cssGrid.trigger('more-items-loaded'); 6979 $(window).trigger('more-items-loaded'); 6980 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 6981 }, 1000); 6982 6983 }); 6984 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6985 var $cssgrid_el = $(cssGridContainersArray[i]), 6986 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6987 $cssgrid_el.infinitescroll('pause'); 6988 $infinite_button.on('click', function(event) { 6989 event.preventDefault(); 6990 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6991 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6992 cssGridId = $cssgrid_system.attr('id'); 6993 $(event.currentTarget).html(SiteParameters.loading); 6994 $cssgrid_el.infinitescroll('resume'); 6995 $cssgrid_el.infinitescroll('retrieve'); 6996 $cssgrid_el.infinitescroll('pause'); 6997 }); 6998 } 6999 } 7000 } 7001 }; 7002 7003 init_cssGridAjax(); 7004 7005 if ($('.cssgrid-pagination').length > 0) { 7006 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 7007 evt.preventDefault(); 7008 7009 if (SiteParameters.index_pagination_disable_scroll !== '1') { 7010 var container = $(this).closest('.cssgrid-system'), 7011 pagination_disable_scroll = container.attr('data-pagination-scroll'), 7012 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 7013 7014 if ( pagination_disable_scroll === 'disabled' ) { 7015 return; 7016 } 7017 7018 calc_scroll -= UNCODE.get_scroll_offset(); 7019 7020 var menu_container = $('.menu-sticky'); 7021 var menu = menu_container.find('.menu-container'); 7022 7023 if (menu_container.length > 0 && menu.length > 0) { 7024 calc_scroll = calc_scroll - menu.outerHeight(); 7025 } 7026 7027 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7028 delta = bodyTop - calc_scroll, 7029 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7030 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7031 7032 if ( !UNCODE.isFullPage ) { 7033 if (scrollSpeed == 0) { 7034 $('html, body').scrollTop(calc_scroll); 7035 } else { 7036 $('html, body').animate({ 7037 scrollTop: calc_scroll 7038 },{ 7039 easing: 'easeInOutQuad', 7040 duration: scrollSpeed, 7041 complete: function(){ 7042 UNCODE.scrolling = false; 7043 } 7044 }); 7045 } 7046 } 7047 } 7048 7049 loadCssGrid($(this), true); 7050 }); 7051 } 7052 7053 $filters.on('click', 'a.grid-nav-link', function(evt) { 7054 if ($(this).hasClass('no-grid-filter')) { 7055 return; 7056 } 7057 var $filter = $(this), 7058 filterContainer = $filter.closest('.cssgrid-filters'), 7059 filterValue = $filter.attr('data-filter'), 7060 containerSystem = $filter.closest('.cssgrid-system'), 7061 container = containerSystem.find($('.cssgrid-layout')), 7062 transitionDuration = containerSystem.data('transitionDuration'),
7063 delay = 300, 7064 filterItems = [], 7065 all_thumbs = container.find('.tmb-grid'); 7066 7067 var filter_items = function(){ 7068 if (filterValue !== undefined) { 7069 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7070 var parent = $(val).parent(), 7071 objTimeout = parent.data('objTimeout'); 7072 if (objTimeout) { 7073 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7074 clearRequestTimeout(objTimeout); 7075 } 7076 if (transitionDuration == 0) { 7077 if ($(val).hasClass('animate_when_almost_visible')) { 7078 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7079 } else { 7080 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7081 } 7082 } 7083 }); 7084 requestTimeout(function(){ 7085 if ( filterValue == '*' ) { 7086 all_thumbs.show(); 7087 all_thumbs.each(function(index, val) { 7088 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7089 filterItems.push($(this)); 7090 }); 7091 } else { 7092 all_thumbs.each(function() { 7093 var _tmb = $(this); 7094 if (_tmb.hasClass(filterValue)) { 7095 _tmb.show(); 7096 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 7097 filterItems.push(_tmb); 7098 } else { 7099 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 7100 _tmb.hide(); 7101 } 7102 }); 7103 } 7104 7105 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 7106 7107 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7108 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 7109 var lightboxElements = $('[data-lbox^=ilightbox]', container); 7110 if (lightboxElements.length) { 7111 container.data('lbox', $(lightboxElements[0]).data('lbox')); 7112 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7113 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 7114 if (typeof getLightbox === 'object') { 7115 getLightbox.refresh(); 7116 } else { 7117 UNCODE.lightbox(); 7118 } 7119 } 7120 } 7121 container.trigger('more-items-loaded'); 7122 $(window).trigger('more-items-loaded'); 7123 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7124 }, delay); 7125 } else { 7126 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 7127 var parent = $(val).parent(), 7128 objTimeout = parent.data('objTimeout'); 7129 if (objTimeout) { 7130 $(val).removeClass('zoom-reverse').removeClass('start_animation') 7131 clearRequestTimeout(objTimeout); 7132 } 7133 if (transitionDuration == 0) { 7134 if ($(val).hasClass('animate_when_almost_visible')) { 7135 $(val).addClass('zoom-reverse').removeClass('start_animation'); 7136 } else { 7137 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 7138 } 7139 } 7140 }); 7141 loadCssGrid($filter); 7142 } 7143 }; 7144 7145 if (!$filter.hasClass('active')) { 7146 /** Scroll top with filtering */ 7147 if (filterContainer.hasClass('filter-scroll')) { 7148 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 7149 calc_scroll -= UNCODE.get_scroll_offset(); 7150 7151 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7152 delta = bodyTop - calc_scroll, 7153 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 7154 filterTolerance = false, 7155 filter_timeout; 7156 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7157 7158 if ( !UNCODE.isFullPage ) { 7159 if (scrollSpeed == 0) { 7160 $('html, body').scrollTop(calc_scroll); 7161 UNCODE.scrolling = false; 7162 filter_items(); 7163 } else { 7164 7165 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 7166 filter_items(); 7167 filterTolerance = true; 7168 } 7169 7170 $('html, body').animate({ 7171 scrollTop: calc_scroll 7172 },{ 7173 easing: 'easeInOutQuad', 7174 duration: scrollSpeed, 7175 complete: function(){ 7176 UNCODE.scrolling = false;
7177 if ( !filterTolerance ) { 7178 filter_timeout = setTimeout(function(){ 7179 clearTimeout(filter_timeout); 7180 filter_items(); 7181 }, 200); 7182 } 7183 } 7184 }); 7185 } 7186 } 7187 } else { 7188 filter_items(); 7189 } 7190 } 7191 evt.preventDefault(); 7192 }); 7193 7194 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 7195 var params = UNCODE.getURLParams(window.location); 7196 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 7197 7198 UNCODE.lastURL = window.location.href; 7199 7200 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) { 7201 return; 7202 } 7203 7204 if (params.id === undefined) { 7205 $.each($('.cssgrid-system'), function(index, val) { 7206 loadCssGrid($(val)); 7207 }); 7208 } else { 7209 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 7210 loadCssGrid($('#' + params.id)); 7211 } 7212 } 7213 }); 7214 7215 var loadCssGrid = function($href, $paginating) { 7216 var is_paginating = false; 7217 7218 if (undefined !== $paginating && $paginating) { 7219 var is_paginating = $paginating; 7220 } 7221 7222 var href = ($href.is("a") ? $href.attr('href') : location), 7223 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 7224 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 7225 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 7226 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 7227 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 7228 cssgridId = cssgridSystem.attr('id'); 7229 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 7230 UNCODE.lastURL = href; 7231 history.pushState({ 7232 myCSSgrid: true 7233 }, document.title, href); 7234 } 7235 cssgridWrapper.addClass('cssgrid-loading'); 7236 if (is_paginating) { 7237 cssgridWrapper.addClass('grid-filtering'); 7238 } 7239 $.ajax({ 7240 url: href 7241 }).done(function(data) { 7242 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 7243 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 7244 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 7245 requestTimeout(function() { 7246 cssgridContainer.html($resultItems); 7247 cssgridWrapper.removeClass('cssgrid-loading'); 7248 cssgridWrapper.removeClass('grid-filtering'); 7249 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 7250 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 7251 UNCODE.adaptive(); 7252 if (SiteParameters.dynamic_srcset_active === '1') { 7253 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 7254 } 7255 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 7256 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 7257 if (typeof getLightbox === 'object') { 7258 getLightbox.refresh(); 7259 } else { 7260 UNCODE.lightbox(); 7261 } 7262 } 7263 cssgridContainer.trigger('more-items-loaded'); 7264 $(window).trigger('more-items-loaded'); 7265 window.dispatchEvent(new CustomEvent('uncode-more-items-loaded')); 7266 }, 300); 7267 7268 $('.pagination', cssgridFooter).remove(); 7269 cssgridFooter.append($resultPagination); 7270 7271 if (cssgridResultCount.length > 0) { 7272 $('.woocommerce-result-count', cssgridResultCount).remove(); 7273 cssgridResultCount.append($resultCount); 7274 } 7275 }); 7276 }; 7277 7278 $filters.each(function(i, buttonGroup) { 7279 var $buttonGroup = $(buttonGroup); 7280 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 7281 $buttonGroup.find('.active').removeClass('active'); 7282 $(this).addClass('active'); 7283 7284 }); 7285 7286 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 7287 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 7288 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 7289 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 7290 e.preventDefault(); 7291 $cats_filters.slideToggle(400, 'easeInOutCirc'); 7292 }); 7293 7294 }); 7295 }; 7296}; 7297 7298UNCODE.linearGrid = function(){ 7299 $('.linear-wrapper').each(function(){ 7300 var $wrap = $(this), 7301 $system = $wrap.closest('.linear-system'), 7302 $dragger = $('[data-dragger]', $system), 7303 $row = $wrap.closest('.vc_row[data-parent]'),
7304 _row = $row[0], 7305 $cont = $('.linear-container.cont-leader:not(.cont-appended)', $wrap), 7306 vertical = $cont.hasClass('linear-or-vertical'), 7307 clone = $wrap.attr('data-infinite') === 'yes' || vertical, 7308 freezedDesktop = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'desktop', 7309 freezedMobile = $wrap.attr('data-freeze') === 'always' || $wrap.attr('data-freeze') === 'mobile', 7310 dataSpeed = parseFloat( $wrap.attr('data-speed') ), 7311 isInViewport = false, 7312 isHover = false, 7313 init = false, 7314 stableHeight = UNCODE.wheight, 7315 wCont, hCont, docH, marqueeTL; 7316 7317 if ( ! $('.tmb', $cont).length ) { 7318 return; 7319 } 7320 7321 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 7322 var dataX = dataSpeed; 7323 7324 dataSpeed += 5; 7325 7326 var checkLinearGridSize = function(){ 7327 if ( !$wrap.is(':visible') ) { 7328 return; 7329 } 7330 $wrap.find('.cont-appended').remove(); 7331 7332 if ( vertical ) { 7333 if ( ! SiteParameters.is_frontend_editor ) { 7334 hCont = $cont.outerHeight(); 7335 docH = Math.max($row.outerHeight(), stableHeight) + ( hCont * dataSpeed ); 7336 if ( hCont < docH ) { 7337 var res = docH - hCont * 3, 7338 times = 2 * Math.round((res/hCont+1) / 2); 7339 } 7340 for ( var i = 0; i < times; i++ ) { 7341 var $cloneCont = $cont.clone(), 7342 $cloneCont2 = $cont.clone(), 7343 trans = ( (i+2) ) * 100; 7344 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateY('+ trans +'%)'})); 7345 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateY(-'+ trans +'%)'})); 7346 $cloneCont.find('a[data-lbox]').each(function(){ 7347 var dataLbox = $(this).attr('data-lbox'); 7348 $(this).attr('data-lbox', dataLbox + '_' + i); 7349 }); 7350 $cloneCont.find('.wp-video-shortcode').each(function(){ 7351 var thisID = $(this).attr('id'); 7352 $(this).attr('id', thisID + '_' + i); 7353 }); 7354 $cloneCont2.find('a[data-lbox]').each(function(){ 7355 var dataLbox = $(this).attr('data-lbox'); 7356 $(this).attr('data-lbox', dataLbox + '_2' + i); 7357 }); 7358 $cloneCont2.find('.wp-video-shortcode').each(function(){ 7359 var thisID = $(this).attr('id'); 7360 $(this).attr('id', thisID + '__' + i); 7361 }); 7362 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7363 UNCODE.lightgallery($cloneCont); 7364 UNCODE.lightgallery($cloneCont2); 7365 } 7366 } 7367 } 7368 } else { 7369 wCont = $cont.outerWidth(); 7370 if ( (wCont) < UNCODE.wwidth*2 ) { 7371 var res = UNCODE.wwidth*2 - (wCont), 7372 times = 2 * Math.round((res/wCont+1) / 2); 7373 } 7374 for ( var i = 0; i < times; i++ ) { 7375 var $cloneCont = $cont.clone(), 7376 $cloneCont2 = $cont.clone(), 7377 trans = ( (i+2) ) * 100; 7378 $wrap.append($cloneCont.addClass('cont-appended').css({'transform':'translateX('+ trans +'%)'})); 7379 $wrap.append($cloneCont2.addClass('cont-appended').css({'transform':'translateX(-'+ trans +'%)'})); 7380 $cloneCont.find('a[data-lbox]').each(function(){ 7381 var dataLbox = $(this).attr('data-lbox'); 7382 $(this).attr('data-lbox', dataLbox + '_' + i); 7383 }); 7384 $cloneCont.find('[id]').each(function(){ 7385 var thisID = $(this).attr('id'); 7386 $(this).attr('id', thisID + '_' + i); 7387 }); 7388 $cloneCont2.find('a[data-lbox]').each(function(){ 7389 var dataLbox = $(this).attr('data-lbox'); 7390 $(this).attr('data-lbox', dataLbox + '_2' + i); 7391 }); 7392 $cloneCont2.find('[id]').each(function(){ 7393 var thisID = $(this).attr('id'); 7394 $(this).attr('id', thisID + '__' + i); 7395 }); 7396 if ( $('.lbox-trigger-item', $cloneCont).length ) { 7397 UNCODE.lightgallery($cloneCont); 7398 UNCODE.lightgallery($cloneCont2); 7399 } 7400 } 7401 } 7402 }; 7403 if ( clone ) { 7404 checkLinearGridSize(); 7405 $(window).on('resize.linearGrid', function(){ 7406 checkLinearGridSize(); 7407 }); 7408 } 7409 7410 var continuousLinearMarquee = function(_xStrt){ 7411 if ( !$wrap.is(':visible') ) { 7412 return; 7413 } 7414 var ease = 'none'; 7415 wCont = $cont.outerWidth(); 7416 hCont = $cont.outerHeight(); 7417 7418 var xStrt = typeof _xStrt === 'undefined' ? 0 : _xStrt, 7419 xEnd = vertical ? hCont : wCont, 7420 direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7421 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed, 7422 speedSlow = (xEnd + xStrt) / 45, 7423 freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7424 7425 marqueeTL = new TimelineMax({paused:true, reversed:true}); 7426 7427 if ( isInViewport && !isHover && !freezed ) { 7428 marqueeTL.play(); 7429 7430 if ( $wrap.attr('data-hover') === 'yes' || $wrap.attr('data-hover') === 'pause' ) { 7431 var $column = $wrap.closest('.wpb_column'), 7432 $col_link = $('.col-link', $column), 7433 $hover_sel = $wrap; 7434 7435 if ( $col_link.length ) { 7436 $hover_sel = $wrap.add($column); 7437 } 7438 7439 $hover_sel.on('mouseover', function(){ 7440 if ( $wrap.attr('data-hover') === 'yes' ) { 7441 //speed = ( 10 - dataSpeed ) * 5; 7442 ease = 'power2.out'; 7443 marqueeTL.duration( speedSlow ); 7444 } else { 7445 marqueeTL.pause(); 7446 } 7447 isHover = true; 7448 }).on('mouseout', function(){ 7449 if ( $wrap.attr('data-hover') === 'yes' ) { 7450 speed = (xEnd + xStrt) / (dataSpeed*dataSpeed*dataSpeed) / 5*dataSpeed; 7451 ease = 'power2.in'; 7452 marqueeTL.duration( speed ); 7453 } else { 7454 marqueeTL.play(); 7455 } 7456 isHover = false;
7457 }); 7458 } 7459 7460 } 7461 7462 gsap.killTweensOf($wrap); 7463 if ( vertical ) { 7464 marqueeTL.fromTo( $wrap, { 7465 y: xStrt * direction 7466 }, 7467 { 7468 duration: speed, 7469 y: xEnd * direction * -1, 7470 onComplete: function(){ 7471 continuousLinearMarquee(); 7472 }, 7473 ease: ease, 7474 paused: freezed 7475 }); 7476 } else { 7477 marqueeTL.fromTo( $wrap, { 7478 x: xStrt * direction 7479 }, 7480 { 7481 duration: speed, 7482 x: xEnd * direction * -1, 7483 onComplete: function(){ 7484 continuousLinearMarquee(); 7485 }, 7486 ease: ease, 7487 paused: freezed 7488 }); 7489 } 7490 }; 7491 7492 var dragLinearContinuous = function(){ 7493 if ( !$wrap.is(':visible') ) { 7494 return; 7495 } 7496 var matrix, _x, _y, 7497 dragAction = false; 7498 Draggable.create($wrap[0], { 7499 type: vertical ? "y" : "x", 7500 bounds: document.getElementById("container"), 7501 inertia: false, 7502 onPress: function (e) { 7503 }, 7504 onRelease: function (e) { 7505 if ( dragAction === true ) { 7506 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7507 _x = matrix[12] || matrix[4]; 7508 _y = matrix[13] || matrix[5]; 7509 if ( vertical ) { 7510 continuousLinearMarquee(_y * -1); 7511 } else { 7512 continuousLinearMarquee(_x * -1); 7513 } 7514 $wrap.removeClass('linear-dragging'); 7515 } 7516 }, 7517 onDrag: function (e) { 7518 dragAction = true; 7519 $wrap.addClass('linear-dragging'); 7520 }, 7521 onDragEnd: function (e) { 7522 matrix = $wrap.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7523 _x = matrix[12] || matrix[4]; 7524 _y = matrix[13] || matrix[5]; 7525 wCont = $cont.outerWidth(); 7526 hCont = $cont.outerHeight(); 7527 if ( vertical ) { 7528 if ( Math.abs(_y) > hCont ) { 7529 if ( _y < 0 ) { 7530 _y = hCont + parseFloat( _y ); 7531 } else { 7532 _y = parseFloat( _y ) - hCont; 7533 } 7534 } 7535 continuousLinearMarquee(_y * -1); 7536 } else { 7537 if ( Math.abs(_x) > wCont ) { 7538 if ( _x < 0 ) { 7539 _x = wCont + parseFloat( _x ); 7540 } else { 7541 _x = parseFloat( _x ) - wCont; 7542 } 7543 } 7544 continuousLinearMarquee(_x * -1); 7545 } 7546 $wrap.removeClass('linear-dragging'); 7547 dragAction = false; 7548 }, 7549 }); 7550 }; 7551 7552 var runScrollLinear = function(){ 7553 var freezed = freezedDesktop && UNCODE.wwidth >= UNCODE.mediaQuery || freezedMobile && UNCODE.wwidth < UNCODE.mediaQuery; 7554 if ( !$wrap.is(':visible') || freezed ) { 7555 return; 7556 } 7557 var direction = $wrap.attr('data-animation').indexOf('opposite') > 0 ? -1 : 1, 7558 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 7559 7560 var linearGridScroll = function(){ 7561 if ( isInViewport ) { 7562 var bound = _row.getBoundingClientRect(); 7563 7564 var bound_top = bound.top, 7565 gsap_calc = parseFloat( ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction ); 7566 7567 if ( vertical ) { 7568 $wrap.css({ 'transform': 'translateY(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7569 } else { 7570 $wrap.css({ 'transform': 'translateX(' + gsap_calc * -1 + 'px) translateZ(0px)'}) 7571 } 7572 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7573 requestAnimationFrame(linearGridScroll); 7574 } 7575 } 7576 if ( ! ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) ) { 7577 window.addEventListener("scroll", linearGridScroll); 7578 } 7579 }; 7580 7581 $(window).on( 'load wwResize', function(e) { 7582 stableHeight = UNCODE.wheight; 7583 linearGridScroll(); 7584 }); 7585 if ( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7586 requestAnimationFrame(linearGridScroll); 7587 } 7588 }; 7589 7590 var dragLinear = function(){ 7591 if ( !$wrap.is(':visible') ) { 7592 return; 7593 } 7594 var matrix, _x, _y; 7595 Draggable.create($dragger[0], { 7596 type: vertical ? "y" : "x", 7597 bounds: document.getElementById("container"), 7598 inertia: false, 7599 onPress: function (e) { 7600 }, 7601 onRelease: function (e) { 7602 }, 7603 onDrag: function (e) { 7604 $wrap.addClass('linear-dragging'); 7605 }, 7606 onDragEnd: function (e) { 7607 matrix = $dragger.css('transform').replace(/[^0-9\-.,]/g, '').split(','); 7608 _x = matrix[12] || matrix[4]; 7609 _y = matrix[13] || matrix[5]; 7610 wCont = $cont.outerWidth(); 7611 hCont = $cont.outerHeight(); 7612 if ( vertical ) { 7613 if ( Math.abs(_y) > hCont ) { 7614 if ( _y < 0 ) { 7615 _y = hCont + parseFloat( _y ); 7616 } else { 7617 _y = parseFloat( _y ) - hCont; 7618 } 7619 gsap.to( $dragger[0], { 7620 duration: 0, 7621 y: _y, 7622 }); 7623 } 7624 } else { 7625 if ( Math.abs(_x) > wCont ) { 7626 if ( _x < 0 ) { 7627 _x = wCont + parseFloat( _x ); 7628 } else { 7629 _x = parseFloat( _x ) - wCont; 7630 } 7631 gsap.to( $dragger[0], { 7632 duration: 0, 7633 x: _x, 7634 }); 7635 } 7636 } 7637 $wrap.removeClass('linear-dragging'); 7638 }, 7639 }); 7640 }; 7641 7642 if ( ! $('body').hasClass('compose-mode') ) { 7643 if ( $wrap.attr('data-animation') === 'marquee' || $wrap.attr('data-animation') === 'marquee-opposite' ) { 7644 continuousLinearMarquee(); 7645 $(window).on( 'wwResize', function(e) { 7646 continuousLinearMarquee(); 7647 }); 7648 if ( $wrap.attr('data-draggable') === 'yes' ) { 7649 dragLinearContinuous(); 7650 } 7651 } 7652 7653 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7654 runScrollLinear(); 7655 if ( $wrap.attr('data-draggable') === 'yes' ) { 7656 dragLinear(); 7657 } 7658 } 7659 7660 if( 'IntersectionObserver' in window && ! UNCODE.isMobile ) { 7661 var observer = new IntersectionObserver(function(entries) { 7662
7663 entries.forEach(function(entry){ 7664 if ( entry.isIntersecting ) { 7665 isInViewport = true; 7666 if ( !init ) { 7667 init = true; 7668 continuousLinearMarquee(); 7669 } else { 7670 if ( typeof marqueeTL !== 'undefined' ) { 7671 marqueeTL.play(); 7672 } 7673 } 7674 if ( $wrap.attr('data-animation') === 'marquee-scroll' || $wrap.attr('data-animation') === 'marquee-scroll-opposite' ) { 7675 requestAnimFrame(runScrollLinear); 7676 } 7677 } else { 7678 isInViewport = false; 7679 if ( typeof marqueeTL !== 'undefined' ) { 7680 marqueeTL.pause(); 7681 } 7682 } 7683 }); 7684 }, { 7685 root: document, 7686 }); 7687 7688 observer.observe(_row); 7689 7690 } else { 7691 7692 var checkVisible = function( el, off ) { 7693 if (typeof jQuery === "function" && el instanceof jQuery) { 7694 el = el[0]; 7695 } 7696 7697 off = typeof off=='undefined' ? 50 : off; 7698 7699 var rect = el.getBoundingClientRect(); 7700 7701 return ( 7702 ( 7703 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7704 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7705 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7706 ) 7707 ); 7708 }; 7709 7710 var checkVisibility = function(){ 7711 7712 if ( checkVisible($row) ) { 7713 isInViewport = true; 7714 if ( typeof marqueeTL !== 'undefined' ) { 7715 marqueeTL.play(); 7716 } 7717 } else { 7718 isInViewport = false; 7719 if ( typeof marqueeTL !== 'undefined' ) { 7720 marqueeTL.pause(); 7721 } 7722 } 7723 } 7724 7725 window.addEventListener("scroll", checkVisibility); 7726 checkVisibility(); 7727 7728 } 7729 } 7730 }); 7731}; 7732UNCODE.preventDoubleTransition = function() { 7733 $('.sticky-element .animate_when_almost_visible').each(function(){ 7734 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 7735 $el.addClass('do_not_reanimate'); 7736 }); 7737 }); 7738}; 7739 7740UNCODE.checkScrollForTabs = function(){ 7741 var goToSection = window.location.hash.replace('#', ''), 7742 $index; 7743 7744 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 7745 goToSection = encodeURIComponent(goToSection); 7746 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 7747 7748 $index.attr('data-parent', 'parent-' + goToSection); 7749 7750 if (window.location.hash != undefined && window.location.hash != '') { 7751 requestTimeout(function() { 7752 scrollBody('parent-' + goToSection); 7753 }, 500); 7754 } 7755 7756 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 7757 var hash = (e.currentTarget).hash, 7758 index = (e.currentTarget).closest('.uncode-tabs'); 7759 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 7760 $('a[href="' + hash + '"][data-tab-history]').click(); 7761 scrollBody(index); 7762 } 7763 }); 7764 7765 var scrollBody = function(index) { 7766 7767 var getSection = $('a[href="' + index + '"][data-tab-history]'), 7768 scrollTo, 7769 safeGap = 27; 7770 7771 if ( ! getSection.length ) { 7772 getSection = $('div[data-parent="' + index + '"]'); 7773 7774 if ( getSection.attr('data-target') == 'row' ) { 7775 getSection = getSection.closest('.vc_row'); 7776 safeGap = 0; 7777 } 7778 } 7779 7780 if (typeof getSection === 'undefined' || ! getSection.length ) { 7781 return; 7782 } 7783 7784 var body = $("html, body"), 7785 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7786 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 7787 getOffset = UNCODE.get_scroll_offset(); 7788 if ( typeof getSection.offset() === 'undefined' ) 7789 return; 7790 scrollTo = getSection.offset().top - safeGap; 7791 scrollTo -= getOffset; 7792 7793 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7794 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7795 7796 if (index != 0) { 7797 UNCODE.scrolling = true; 7798 } 7799 7800 if (scrollSpeed == 0) { 7801 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 7802 UNCODE.scrolling = false; 7803 } else { 7804 body.animate({ 7805 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 7806 }, scrollSpeed, 'easeInOutQuad', function() { 7807 requestTimeout(function() { 7808 UNCODE.scrolling = false;
7809 if (getOffset != UNCODE.get_scroll_offset()) { 7810 scrollBody(index); 7811 } 7812 }, 100); 7813 }); 7814 } 7815 7816 }; 7817}; 7818 7819UNCODE.printScreen = function() { 7820 var inlineMediaStyle = null, 7821 setResize; 7822 7823 function changeMediaStyle() { 7824 clearRequestTimeout(setResize); 7825 setResize = requestTimeout(function(){ 7826 var $head = document.getElementsByTagName('head')[0], 7827 $newStyle = document.createElement('style'), 7828 winW = window.innerWidth, 7829 printH = window.innerHeight; 7830 7831 $newStyle.setAttribute('type', 'text/css'); 7832 $newStyle.setAttribute('media', 'print'); 7833 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 7834 7835 if (inlineMediaStyle != null) { 7836 $head.replaceChild($newStyle, inlineMediaStyle) 7837 } else { 7838 $head.appendChild($newStyle); 7839 } 7840 inlineMediaStyle = $newStyle; 7841 }, 1000); 7842 } 7843 7844 changeMediaStyle(); 7845 window.addEventListener('resize', changeMediaStyle); 7846}; 7847 7848UNCODE.fullPage = function() { 7849 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 7850 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 7851 return false; 7852 } else { 7853 requestTimeout(function() { 7854 window.scrollTo(0, 0); 7855 }, 10); 7856 } 7857 7858 var $masthead = $('#masthead'), 7859 $logo = $('#logo-container-mobile'), 7860 $logolink = $('[data-minheight]', $logo), 7861 logoMinScale = $logolink.data('minheight'), 7862 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 7863 $container = $('.main-container .post-content'), 7864 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 7865 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 7866 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 7867 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 7868 headerWithOpacity = $('.header-scroll-opacity', $header).length, 7869 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 7870 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 7871 scrollBar = true, 7872 effect, 7873 animationEndTimeOut, 7874 fp_anim_time = 900, 7875 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 7876 is_scrolling = false, 7877 dataNames = [], 7878 is_first = true, 7879 no_history = $('body').hasClass('uncode-scroll-no-history'), 7880 theres_footer = true; 7881 7882 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 7883 $('> div', $footer).each(function(index, el){ 7884 if ( $(el).outerHeight() < 2 ) 7885 theres_footer = false; 7886 else 7887 theres_footer = true; 7888 }); 7889 } 7890 7891 if ( !$footer.length ) 7892 theres_footer = false; 7893 7894 if ( !UNCODE.isFullPageSnap ) { 7895 7896 if ( $('body').hasClass('uncode-fullpage-zoom') ) 7897 effect = 'scaleDown'; 7898 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 7899 effect = 'moveparallax'; 7900 else 7901 effect = 'movecurtain'; 7902 } 7903 7904 if ( $('body').hasClass('uncode-fullpage-trid') ) 7905 fp_anim_time = fp_anim_time*2; 7906 7907 if ( $header.length ) { 7908 if ( headerName !== '' ) 7909 $header.attr('data-name', headerName); 7910 if ( headerLabel !== '' ) 7911 $header.attr('data-label', headerLabel); 7912 $container.prepend($header); 7913 } 7914 if ( theres_footer ) { 7915 $container.append($footer); 7916 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 7917 $('aside.widget ul', $footer).addClass('no-list'); 7918 } 7919 7920 var $all = $rows.add($header); 7921 7922 if ( theres_footer ) 7923 $all = $all.add($footer); 7924 7925 $all.each(function(index, row) { 7926 if( index === 0 ) 7927 $(row).addClass('uncode-scroll-active'); 7928 }); 7929 7930 var isMobile = SiteParameters.uncode_force_onepage_dots ? false : UNCODE.isMobile; 7931 7932 if ( !isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) { 7933 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 7934 } 7935 7936 $all.each(function(index, val) { 7937 var getName = $(val).data('name'), 7938 label; 7939 7940 if (typeof getName == 'undefined' || getName == 'undefined') 7941 getName = SiteParameters.slide_name + '-' + index; 7942 7943 //if ( dataNames.includes(getName) ) { 7944 if ( dataNames.indexOf(getName) > 0 ) { 7945 getName += '_' + index; 7946 $(val).data('name', getName); 7947 } 7948 7949 dataNames.push(getName); 7950 7951 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 7952 7953 if (typeof $(val).attr('data-label') !== 'undefined') 7954 label = $(val).attr('data-label'); 7955 else label = ''; 7956 7957 if ( $(val).is($footer) ) 7958 return; 7959 7960 if (label != '' ) { 7961 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 7962 $('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>"); 7963 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 7964 $('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>"); 7965 } 7966 }); 7967 7968 var checkVisible = function( el, off ) { 7969 if (typeof jQuery === "function" && el instanceof jQuery) { 7970 el = el[0]; 7971 } 7972 7973 off = typeof off=='undefined' ? 50 : off; 7974 7975 var rect = el.getBoundingClientRect(); 7976 7977 return ( 7978 ( 7979 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7980 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7981 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7982 ) 7983 ); 7984 }; 7985 7986 var animationEndAction = function( index, nextIndex ) { 7987 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7988 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7989 player, iframe; 7990 7991 if ( !$nextSlide.is($footer) ) { 7992 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7993 } 7994 7995 if ( !UNCODE.isFullPageSnap ) { 7996 activateKBurns( nextIndex ); 7997 } 7998 7999 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 8000 if ($(this).attr('data-provider') == 'vimeo') { 8001 iframe = $(this).find('iframe'); 8002 player = new Vimeo.Player(iframe[0]); 8003 player.pause(); 8004 } else if ($(this).attr('data-provider') == 'youtube') { 8005 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 8006 } else { 8007 if ($(this).is('video')) { 8008 $(this)[0].volume = 0; 8009 $(this)[0].pause(); 8010 } 8011 } 8012 }); 8013 8014 if ( ! UNCODE.isMobile && headerWithOpacity ) { 8015 if ( $nextSlide.is($header) ) 8016 $header.removeClass('header-scrolled'); 8017 } 8018 8019 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 8020 $otherEl.each(function(){ 8021 var $otherThis = $(this), 8022 $bgwrapperOther = $('.background-inner', $otherThis); 8023 if ( !checkVisible($otherThis) ) 8024 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 8025 8026 }); 8027 8028 if ( !checkVisible($currentSlide) ) { 8029 $currentSlide.removeClass('uncode-scroll-visible'); 8030 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 8031 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
8032 currentScroll.scrollTo(0, 0, 0); 8033 } 8034 8035 clearRequestTimeout(animationEndTimeOut); 8036 animationEndTimeOut = requestTimeout(function(){ 8037 Waypoint.refreshAll(); 8038 $( document.body ).trigger('uncode_waypoints'); 8039 var eventFP = new CustomEvent('fp-slide-changed'); 8040 window.dispatchEvent(eventFP); 8041 is_scrolling = false; 8042 8043 if ( is_first ) { 8044 $('ul.onepage-pagination a').removeClass('is-selected'); 8045 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8046 is_first = false; 8047 } 8048 8049 }, 500); 8050 }; 8051 8052 var postLeaveActions = function( nextIndex ){ 8053 if ( menuHidden && ! UNCODE.isMobile ) 8054 return false; 8055 8056 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8057 $cols = $('.uncol', $el), 8058 anchor = $el.data('anchor'); 8059 8060 if ( ! UNCODE.isFullPageSnap ) { 8061 $.each($cols, function(index, val){ 8062 if ( $(val).hasClass('style-light') ){ 8063 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 8064 return false; 8065 } else if ( $(val).hasClass('style-dark') ) { 8066 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 8067 return false; 8068 } 8069 }); 8070 } 8071 8072 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 8073 $('.menu-item' ).removeClass('active'); 8074 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8075 } 8076 8077 if ( !UNCODE.isFullPageSnap ) { 8078 activateBackWash( nextIndex ); 8079 } 8080 }; 8081 8082 var activateBackWash = function( nextIndex ){ 8083 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8084 $bgwrapper; 8085 8086 if ( $el.length ) { 8087 if ( $el.hasClass('with-zoomout') ) { 8088 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8089 } else if ( $('.with-zoomout', $el).length ) { 8090 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 8091 } else { 8092 return false; 8093 } 8094 } else { 8095 return false; 8096 } 8097 8098 $bgwrapper.addClass('uncode-zoomout'); 8099 8100 }; 8101 8102 var activateKBurns = function( nextIndex ){ 8103 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8104 $bgwrapper; 8105 8106 if ( $el.length ) { 8107 if ( $el.hasClass('with-kburns') ) { 8108 $bgwrapper = $('.background-inner:nth-child(1)', $el); 8109 } else if ( $('.with-kburns', $el).length ) { 8110 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 8111 } else { 8112 return false; 8113 } 8114 } else { 8115 return false; 8116 } 8117 8118 $bgwrapper.addClass('uncode-kburns'); 8119 8120 }; 8121 8122 var activateParallax = function( nextIndex, direction ){ 8123 8124 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8125 $cell = $('.fp-tableCell', $el), 8126 animationEnd = 'webkitAnimationEnd animationend', 8127 cellAnim; 8128 8129 switch( direction ) { 8130 case 'up': 8131 cellAnim = 'moveFromTopInner'; 8132 break; 8133 default: 8134 cellAnim = 'moveFromBottomInner'; 8135 } 8136 8137 $cell.css({ 8138 'animation-name': cellAnim, 8139 'animation-duration': fp_anim_time + 'ms', 8140 'animation-delay': '', 8141 'animation-timing-function': fp_easing, 8142 'animation-fill-mode': 'both', 8143 }).off(animationEnd) 8144 .on(animationEnd, function(event) { 8145 if ( event.originalEvent.animationName === cellAnim ) { 8146 $cell 8147 .css({ 8148 'animation-name': '', 8149 'animation-duration': '', 8150 'animation-delay': '', 8151 'animation-timing-function': '', 8152 'animation-fill-mode': '', 8153 }); 8154 } 8155 }); 8156 }; 8157 8158 var scrollHashes = function(){ 8159 var hash = window.location.hash.replace('#', '').split('/'), 8160 hashInd; 8161 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 8162 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 8163 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 8164 $.fn.fullpage.moveTo(hashInd+1); 8165 } 8166 } else if( hash[0] === '' ) { 8167 $.fn.fullpage.moveTo(1); 8168 } 8169 }; 8170 8171 var hideMenu = function( index, nextIndex ){ 8172 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 8173 return false; 8174 8175 var hMenu = UNCODE.menuHeight, 8176 transTime = hMenu * 2; 8177 8178 if ( index === 1 && nextIndex > 1 ) { 8179 hMenu = hMenu * -1; 8180 } else if ( index !== 1 && nextIndex === 1 ) { 8181 hMenu = 0; 8182 } else { 8183 return false;
8184 } 8185 8186 $masthead.css({ 8187 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8188 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 8189 '-webkit-transition': 'transform 0.5s ease-in-out', 8190 'transition': 'transform 0.5s ease-in-out' 8191 }); 8192 }; 8193 8194 var shrinkMenu = function( index, nextIndex ){ 8195 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 8196 return false; 8197 8198 if ( index === 1 && nextIndex > 1 ) { 8199 $logo.addClass('shrinked'); 8200 $('div', $logo).each(function(index, val){ 8201 $(val).css({ 8202 'height': logoMinScale, 8203 'line-height': logoMinScale 8204 }); 8205 if ($(val).hasClass('text-logo')) { 8206 $(val).css({ 8207 'font-size': logoMinScale + 'px' 8208 }); 8209 } 8210 }); 8211 requestTimeout(function() { 8212 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8213 }, 300); 8214 } else if ( index !== 1 && nextIndex === 1 ) { 8215 $logo.removeClass('shrinked'); 8216 $('div', $logo).each(function(index, val){ 8217 $(val).css({ 8218 'height': logoMaxScale, 8219 'line-height': logoMaxScale 8220 }); 8221 if ($(val).hasClass('text-logo')) { 8222 $(val).css({ 8223 'font-size': logoMaxScale + 'px' 8224 }); 8225 } 8226 }); 8227 requestTimeout(function() { 8228 UNCODE.menuMobileHeight = $masthead.outerHeight(); 8229 }, 300); 8230 } else { 8231 return false; 8232 } 8233 8234 }; 8235 8236 var anchorLink = function(){ 8237 8238 $container.add('.menu-item').find('a[href*="#"]').on('click', function(e) { 8239 var $this = $(e.currentTarget), 8240 hash = e.currentTarget.href.split('#'), 8241 current = window.location.href.split('#'), 8242 ind, 8243 currentMenuOpened = UNCODE.menuOpened, 8244 go = false; 8245 8246 var hash_url = hash[0].replace(/\/?$/, '/'), 8247 current_url = current[0].replace(/\/?$/, '/'); 8248 8249 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 8250 hash = '#'+hash[1]; 8251 e.preventDefault(); 8252 go = true; 8253 } 8254 8255 if ( go ) { 8256 8257 if ( $(hash).length ) { 8258 ind = $(hash).closest('.fp-section').index(); 8259 } else { 8260 hash = hash.slice(1); 8261 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 8262 } 8263 8264 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 8265 ind = $this.closest('.fp-section').index(); 8266 8267 UNCODE.menuOpened = false; 8268 8269 $.fn.fullpage.moveTo(ind+1); 8270 8271 UNCODE.menuOpened = currentMenuOpened; 8272 if (UNCODE.menuOpened) { 8273 if (UNCODE.wwidth < UNCODE.mediaQuery) { 8274 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 8275 } else { 8276 $('.mmb-container-overlay .overlay-close').trigger('click'); 8277 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 8278 } 8279 } 8280 8281 } 8282 8283 }); 8284 8285 $('.header-scrolldown').on('click', function(event) { 8286 event.preventDefault(); 8287 var scrollDown = $(this), 8288 ind = scrollDown.closest('.fp-section').index(); 8289 8290 $.fn.fullpage.moveTo(ind+2); 8291 }); 8292 8293 var anchor = $('.fp-section.active').data('anchor'); 8294 8295 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 8296 $('.menu-item').removeClass('active'); 8297 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 8298 } 8299 8300 }; 8301 8302 var slideLeave = function( index, nextIndex, direction ) { 8303 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 8304 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 8305 animationEnd = 'webkitAnimationEnd animationend', 8306 transitionEnd = 'webkitTransitionEnd transitionend', 8307 animOut = effect != 'scaleDown' ? effect + direction : effect, 8308 animIn, 8309 isFooter = false, 8310 isFooterNext = false, 8311 footerH = $footer.outerHeight(), 8312 timeout, 8313 player, iframe, 8314 footerCoeff; 8315 switch( direction ) { 8316 case 'up': 8317 animIn = 'moveFromTop'; 8318 break; 8319 default: 8320 animIn = 'moveFromBottom'; 8321 } 8322 8323 if ( $('body').hasClass('uncode-fullpage-trid') ) { 8324 animOut = animIn + 'trid'; 8325 animIn = animOut + 'In'; 8326 } else if ( UNCODE.isFullPageSnap ) { 8327 animIn = animOut = 'none'; 8328 } 8329 8330 hideMenu(index, nextIndex); 8331 shrinkMenu(index, nextIndex); 8332 8333 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 8334 if ($(this).attr('data-provider') == 'vimeo') { 8335 iframe = $(this).find('iframe'); 8336 player = new Vimeo.Player(iframe[0]); 8337 player.pause(); 8338 } else if ($(this).attr('data-provider') == 'youtube') { 8339 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 8340 } else { 8341 if ($(this).is('video')) { 8342 $(this)[0].volume = 0; 8343 $(this)[0].pause(); 8344 } 8345 } 8346 }); 8347 8348 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 8349 if ($(this).attr('data-provider') == 'vimeo') { 8350 iframe = $(this).find('iframe'); 8351 iframe.on('load', function(){ 8352 player = new Vimeo.Player(iframe); 8353 player.setVolume(0); 8354 player.play(); 8355 }); 8356 player = new Vimeo.Player(iframe); 8357 player.setVolume(0); 8358 player.play(); 8359 } else if ($(this).attr('data-provider') == 'youtube') { 8360 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 8361 } else { 8362 if ($(this).is('video')) { 8363 $(this)[0].volume = 0; 8364 $(this)[0].play(); 8365 } 8366 } 8367 }); 8368 8369 if ( $currentSlide.is($footer) ) 8370 isFooter = true; 8371 8372 if ( $nextSlide.is($footer) ) 8373 isFooterNext = true; 8374 8375 if ( ! UNCODE.isMobile && headerWithOpacity ) { 8376 if ( $currentSlide.is($header) ) 8377 $header.addClass('header-scrolled'); 8378 } 8379 8380 footerCoeff = footerH; 8381 8382 if ( UNCODE.isFullPageSnap ) { 8383 postLeaveActions( nextIndex ); 8384 activateBackWash( nextIndex ); 8385 activateKBurns( nextIndex ); 8386 requestTimeout(function(){ 8387 animationEndAction( index, nextIndex ); 8388 }, fp_anim_time+150); 8389 } else { 8390 if ( isFooterNext ) { 8391 8392 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 8393 $iscrollWrapper.addClass('no-scrolloverflow'); 8394 8395 $nextSlide 8396 .add($currentSlide) 8397 .addClass('uncode-scroll-front') 8398 .addClass('uncode-scroll-active') 8399 .addClass('uncode-scroll-visible'); 8400 $container.css({ 8401 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8402 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 8403 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8404 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8405 }).off(transitionEnd) 8406 .one(transitionEnd, function(){ 8407 animationEndAction( index, nextIndex ); 8408 }); 8409 8410 } else if ( isFooter ) { 8411 8412 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 8413 .add($currentSlide) 8414 .addClass('uncode-scroll-front') 8415 .addClass('uncode-scroll-active') 8416 .addClass('uncode-scroll-visible'); 8417 $container.css({ 8418 '-webkit-transform': 'translate3d(0, 0, 0)', 8419 'transform': 'translate3d(0, 0, 0)', 8420 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8421 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 8422 }) 8423 .one(transitionEnd, function(){ 8424 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 8425 clearRequestTimeout(timeout); 8426 timeout = requestTimeout(function(){ 8427 $.fn.fullpage.moveTo(nextIndex); 8428 slideLeave( index-1, nextIndex, 'up' ); 8429 $container.off(transitionEnd); 8430 }, 50); 8431 } 8432 animationEndAction( index, nextIndex ); 8433 }); 8434 8435 } else { 8436 8437 postLeaveActions( nextIndex ); 8438 8439 if ( !$('body').hasClass('uncode-fullpage-trid') ) 8440 activateParallax( nextIndex, direction ); 8441 8442 var $outBg = $('.background-wrapper', $currentSlide); 8443 8444 $nextSlide 8445 .addClass('uncode-scroll-front') 8446 .addClass('uncode-scroll-active') 8447 .addClass('uncode-scroll-visible') 8448 .addClass('uncode-scroll-animating-in') 8449 .css({ 8450 'z-index':4, 8451 'animation-name': animIn, 8452 'animation-duration': fp_anim_time + 'ms', 8453 'animation-delay': '', 8454 'animation-timing-function': fp_easing, 8455 'animation-fill-mode': 'both', 8456 'transition': 'initial', 8457 }).off(animationEnd) 8458 .on(animationEnd, function(event) { 8459 if ( event.originalEvent.animationName === animIn ) { 8460 $(this) 8461 .addClass('uncode-scroll-already') 8462 .removeClass('uncode-scroll-front') 8463 .removeClass('uncode-scroll-animating-in') 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 $currentSlide 8474 .removeClass('uncode-scroll-active') 8475 .add($outBg) 8476 .css({ 8477 'animation-name': '', 8478 'animation-duration': '', 8479 'animation-delay': '', 8480 'animation-timing-function': '', 8481 'animation-fill-mode': '', 8482 'transition': 'initial', 8483 }); 8484 8485 animationEndAction( index, nextIndex ); 8486 8487 } 8488 8489 if ( nextIndex > 1 ) 8490 $('body').addClass('window-scrolled'); 8491 else 8492 $('body').removeClass('window-scrolled'); 8493 }); 8494 8495 $currentSlide 8496 .addClass('uncode-scroll-animating-out') 8497 .removeClass('uncode-scroll-front') 8498 .css({ 8499 'z-index':'1', 8500 'animation-name': animOut, 8501 'animation-duration': fp_anim_time + 'ms', 8502 'animation-delay': '', 8503 'animation-timing-function': fp_easing, 8504 'animation-fill-mode': 'both', 8505 'transition': 'initial', 8506 'will-change': 'auto' 8507 }).off(animationEnd) 8508 .on(animationEnd, function(event) { 8509 if ( event.originalEvent.animationName === animOut ) { 8510 $currentSlide.removeClass('uncode-scroll-animating-out'); 8511 } 8512 }); 8513 8514 if ( $('body').hasClass('uncode-fp-opacity') ) { 8515 $currentSlide.find('> div').css({ 8516 'animation-name': 'opacityout', 8517 'animation-duration': fp_anim_time + 'ms', 8518 'animation-delay': '', 8519 'animation-timing-function': fp_easing, 8520 'animation-fill-mode': 'both', 8521 'transition': 'initial', 8522 }).off(animationEnd) 8523 .on(animationEnd, function(event) { 8524 if ( event.originalEvent.animationName === 'opacityout' ) { 8525 $(event.currentTarget).css({ 8526 'animation-name': '', 8527 'animation-duration': '', 8528 'animation-delay': '', 8529 'animation-timing-function': '', 8530 'animation-fill-mode': '', 8531 'transition': '', 8532 }); 8533 } 8534 }); 8535 } 8536 } 8537 } 8538 8539 $('.scroll-top').on('click', function(e){ 8540 $.fn.fullpage.moveTo(1); 8541 return false;
8542 }); 8543 8544 }; 8545 8546 var init_fullPage = function(mode){ 8547 8548 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 8549 // scrollBar = false; 8550 // } 8551 8552 var checkFPeffects; 8553 8554 $container.fullpage({ 8555 sectionSelector: '.uncode-scroll-lock', 8556 scrollOverflow: true, 8557 scrollOverflowOptions: { 8558 click: false, 8559 preventDefaultException: { tagName:/.*/ } 8560 }, 8561 navigation: false, 8562 scrollBar: scrollBar, 8563 scrollingSpeed: fp_anim_time, 8564 verticalCentered: true, 8565 anchors: no_history ? false : dataNames, 8566 recordHistory: !no_history, 8567 afterRender: function(){ 8568 $('body').removeClass('fp-waiting'); 8569 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 8570 var $invisible = $(this).addClass('hidden-scroll');//, 8571 }); 8572 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 8573 var $visible = $(this).addClass('uncode-scroll-visible'), 8574 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 8575 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 8576 }); 8577 8578 $('ul.onepage-pagination a').on('click', function(e){ 8579 e.preventDefault(); 8580 var $a = $(this), 8581 toIndex = $a.data('index'); 8582 8583 $.fn.fullpage.moveTo(toIndex+1); 8584 }); 8585 8586 requestTimeout(function(){ 8587 scrollHashes(); 8588 }, 1000); 8589 8590 $(window).on('hashchange', function(e){ 8591 requestTimeout(function(){ 8592 scrollHashes(); 8593 }, 500); 8594 }); 8595 8596 anchorLink(); 8597 8598 if ( $('body').hasClass('uncode-fp-opacity') ) { 8599 $all.each(function(index, row) { 8600 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 8601 classBg; 8602 8603 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 8604 classBg = testmatch[0]; 8605 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 8606 } 8607 }); 8608 } 8609 8610 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 8611 $(window).on('menuOpen gdprOpen', function(){ 8612 $.fn.fullpage.setAutoScrolling(false); 8613 }).on('menuClose gdprClose', function(){ 8614 $.fn.fullpage.setAutoScrolling(true); 8615 }); 8616 } 8617 8618 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 8619 requestTimeout(function(){ 8620 $.fn.fullpage.setAutoScrolling(false); 8621 }, 1000); 8622 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 8623 $.fn.fullpage.setAutoScrolling(true); 8624 }); 8625 8626 if ( !UNCODE.isFullPageSnap ) { 8627 clearRequestTimeout(checkFPeffects); 8628 checkFPeffects = requestTimeout(function(){ 8629 activateBackWash( 1 ); 8630 activateKBurns( 1 ); 8631 }, 100); 8632 } 8633 8634 }, 8635 onLeave: function( index, nextIndex, direction ){ 8636 8637 if ( UNCODE.menuOpened || is_scrolling ) 8638 return false; 8639 8640 is_scrolling = true; 8641 8642 var event = new CustomEvent('fp-slide-leave'); 8643 window.dispatchEvent(event); 8644 8645 slideLeave( index, nextIndex, direction ); 8646 8647 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 8648 if ( direction === 'up' ) { 8649 $.fn.fullpage.moveTo(nextIndex-1); 8650 } else { 8651 $.fn.fullpage.moveTo(nextIndex+1); 8652 } 8653 return false; 8654 } 8655 8656 $('ul.onepage-pagination a').removeClass('is-selected'); 8657 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 8658 8659 } 8660 }); 8661 }; 8662 8663 init_fullPage(); 8664 $(window).on('load', function(){ 8665 requestTimeout(function(){ 8666 $.fn.fullpage.reBuild(); 8667 }, 3000); 8668 }); 8669 8670 var addScrollingClass, 8671 removeScrollingClass; 8672 8673 window.addEventListener("fp-slide-scroll", function(){ 8674 addScrollingClass = requestTimeout( function(){ 8675 $('body').addClass('fp-slide-scrolling'); 8676 }, 10 ); 8677 8678 clearRequestTimeout(removeScrollingClass); 8679 removeScrollingClass = requestTimeout( function(){ 8680 $('body').removeClass('fp-slide-scrolling'); 8681 }, 150 ); 8682 8683 Waypoint.refreshAll(); 8684 }, false); 8685 8686 var setFPheight = function(){ 8687 var $body = document.body, 8688 $footer = document.getElementById('colophon'), 8689 $maincontainer = document.querySelector('.main-wrapper'), 8690 $boxcontainer = document.querySelector('.box-container'), 8691 $sections = document.querySelectorAll('.fp-section'), 8692 rect = $maincontainer.getBoundingClientRect(), 8693 rect2 = $boxcontainer.getBoundingClientRect(), 8694 $masthead = document.getElementById('masthead'), 8695 _hideMenu = false, 8696 menuHeight = UNCODE.menuHeight; 8697 $body.style.height = UNCODE.wheight + 'px'; 8698 8699 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 8700 _hideMenu = true; 8701 } 8702 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 8703 menuHeight = 0 8704 } 8705 8706 8707 if ( theres_footer ) 8708 $footer.style.top = (rect.height || rect2.height) + 'px'; 8709 8710 for (var i = 0; i < $sections.length; i++) { 8711 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 8712 } 8713 }; 8714 8715 setFPheight(); 8716 8717 window.addEventListener('resize', setFPheight, false); 8718 window.addEventListener('orientationchange', setFPheight, false); 8719 8720}; 8721 8722UNCODE.particles = function() { 8723 $(".vc-particles-background").each(function() { 8724 var $particle = $(this); 8725 var $parent = $particle.closest('[data-parent]'); 8726
8727 $parent.prepend($particle); 8728 // $(window).trigger('resize'); 8729 }) 8730}; 8731 8732 8733UNCODE.readMoreCol = function( $el ){ 8734 if ( typeof $el === 'undefined' || $el === null ) { 8735 $el = $('body'); 8736 } 8737 var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el); 8738 $readMoreCols.each(function(){ 8739 var $uncont = $(this), 8740 $row = $uncont.closest('.row-container'), 8741 max_h = $uncont.attr('data-ov-height'), 8742 max_h_mobile = $uncont.attr('data-ov-height-mobile'), 8743 actual_max_h = $uncont.outerHeight(), 8744 inner_h, 8745 $read_more = $('+ .btn-more-wrap', $uncont), 8746 read_more_resize = $read_more.hasClass('trigger-resize'), 8747 marginClosedBtn = $uncont.attr('data-margin-closed'), 8748 marginClosed = 0, 8749 marginOpenBtn = $uncont.attr('data-margin-open'), 8750 marginOpen = 0, 8751 anim_t = 250, 8752 resized = false; 8753 8754 max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile; 8755 8756 switch (marginClosedBtn) { 8757 case 'sm': 8758 marginClosed = 18 8759 break; 8760 8761 case 'std': 8762 marginClosed = 36 8763 break; 8764 8765 case 'lg': 8766 marginClosed = 72 8767 break; 8768 8769 case '': 8770 default: 8771 marginClosed = 0 8772 break; 8773 8774 } 8775 8776 switch (marginOpenBtn) { 8777 case 'sm': 8778 marginOpen = 18 8779 break; 8780 8781 case 'std': 8782 marginOpen = 36 8783 break; 8784 8785 case 'lg': 8786 marginOpen = 72 8787 break; 8788 8789 case 'no': 8790 marginOpen = 0 8791 break; 8792 8793 } 8794 8795 var checkToggleMobile = function(){ 8796 if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) { 8797 resized = true; 8798 if ( $read_more.hasClass('state-closed') ) { 8799 $uncont[0].style.height = ''; 8800 $uncont[0].style.maxHeight = max_h_mobile; 8801 } 8802 } if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) { 8803 if ( $read_more.hasClass('state-closed') ) { 8804 $uncont[0].style.height = ''; 8805 $uncont[0].style.maxHeight = max_h; 8806 } 8807 resized = false; 8808 } 8809 } 8810 checkToggleMobile(); 8811 $(window).on('resize', function() { 8812 checkToggleMobile(); 8813 }); 8814 8815 $('a', $read_more).on('click', function(e){ 8816 e.preventDefault(); 8817 8818 var $a = $(this); 8819 8820 if ( $read_more.hasClass('state-closed') ) { 8821 8822 $read_more 8823 .removeClass('state-closed') 8824 .addClass('state-open'); 8825 8826 $uncont.css({ 8827 'max-height': 'none', 8828 'height': 'auto', 8829 }); 8830 8831 inner_h = parseFloat( $uncont.outerHeight() ); 8832 8833 $uncont.css({ 8834 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8835 }); 8836 8837 anim_t = inner_h - actual_max_h; 8838 if ( anim_t < 250 ) { 8839 anim_t = 250; 8840 } else if ( anim_t > 1000 ) { 8841 anim_t = 1000; 8842 } 8843 8844 $uncont.css({ 8845 'transition-duration' : anim_t + 'ms' 8846 }).addClass('overflow-mask-animation').animate({ 8847 'height': inner_h 8848 }, anim_t, 'easeInOutCubic', function(){ 8849 $uncont.css({ 8850 'height' : 'auto' 8851 }).removeClass('overflow-mask'); 8852 if ( read_more_resize === true ) { 8853 window.dispatchEvent(new Event('resize')); 8854 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8855 ScrollTrigger.refresh(true); 8856 } 8857 } 8858 }); 8859 8860 if ( marginOpen != '' ) { 8861 $read_more.animate({ 8862 'margin-top' : marginOpen 8863 }, anim_t, 'easeInOutCubic'); 8864 } 8865 8866 } else { 8867 $read_more 8868 .removeClass('state-open') 8869 .addClass('state-closed'); 8870 8871 $uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({ 8872 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8873 }, anim_t, 'easeInOutCubic', function(){ 8874 if ( read_more_resize === true ) { 8875 window.dispatchEvent(new Event('resize')); 8876 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8877 ScrollTrigger.refresh(true); 8878 } 8879 } 8880 }); 8881 8882 if ( marginClosed !== '' ) { 8883 $read_more.animate({ 8884 'margin-top' : marginClosed 8885 }, anim_t, 'easeInOutCubic'); 8886 } 8887 8888 if ( $a.hasClass('toggle-scroll') ) { 8889 var $masthead = $('#masthead > div:first-child'), 8890 headH = $masthead.outerHeight(), 8891 rectTop = $row[0].getBoundingClientRect().top, 8892 checkNavBar = $a.hasClass('toggle-navbar'), 8893 checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'), 8894 offCont = ( $row.offset().top ); 8895 8896 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 8897 checkNavBar = checkNavBarMobile; 8898 } 8899 8900 if ( checkNavBar ) { 8901 offCont = offCont - headH; 8902 } 8903 8904 if ( rectTop < headH ) { 8905 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 8906 $(this).stop(); 8907 }).animate({ 8908 scrollTop: offCont 8909 }, anim_t, 'easeInOutCubic'); 8910 } 8911 } 8912 8913 } 8914 }); 8915 }); 8916} 8917UNCODE.filters = function() { 8918 var $systems = $('.isotope-system, .cssgrid-system'); 8919 8920 $systems.each(function(index, val){ 8921 var $system = $(this), 8922 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 8923 $widgets = $('.widgetized-cb-wrapper', $system), 8924 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 8925 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 8926 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 8927 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 8928 8929 if ($system.hasClass('isotope-processed')) { 8930 return; 8931 } 8932 8933 $cats_trigger.on('click', function(e) { 8934 if ( ! $('html').hasClass('screen-sm') ) { 8935 // $widgets.add($sorting_dd).slideUp(400); 8936 e.preventDefault(); 8937 $widgets.slideUp(400, 'easeInOutCirc'); 8938 } 8939 }); 8940 8941 $('.filters-toggle-trigger', $system).on('click', function(e) { 8942 e.preventDefault(); 8943 var $filters = $('.isotope-filters .menu-horizontal', $system); 8944 $filters.slideToggle(400, 'easeInOutCirc');
8945 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8946 }); 8947 8948 $widget_trgr.on('click', function(e) { 8949 e.preventDefault(); 8950 $widgets.slideToggle(400, 'easeInOutCirc'); 8951 if (!$('html').hasClass('screen-sm')) { 8952 $cats_filters.slideUp(400, 'easeInOutCirc'); 8953 } 8954 window.dispatchEvent(new CustomEvent('boxResized')); 8955 }); 8956 8957 $sorting_trgr.on('click', function(e) { 8958 e.preventDefault(); 8959 if (!$('html').hasClass('screen-sm')) { 8960 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8961 } 8962 }); 8963 8964 $system.addClass('isotope-processed'); 8965 }); 8966 8967}; 8968 8969UNCODE.widgets = function() { 8970 var widget_collapses = $('.widget-collapse'); 8971 8972 widget_collapses.each(function(){ 8973 var widget_collapse = $(this), 8974 widget_title = widget_collapse.find('.widget-title'), 8975 widget = widget_title.closest('.widget'), 8976 content = widget.children().not('.widget-title'), 8977 setCTA; 8978 8979 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 8980 widget_title.toggleClass('open'); 8981 } 8982 8983 widget_title.each(function() { 8984 var _this = $(this); 8985 var content = _this.closest('.widget').find('.widget-collapse-content'); 8986 8987 $(window).on('load resize', function(){ 8988 clearRequestTimeout(setCTA); 8989 setCTA = requestTimeout( function() { 8990 if ( content.is(':visible') ) { 8991 _this.addClass( 'open' ); 8992 } else { 8993 _this.removeClass( 'open' ); 8994 } 8995 }, 10 ); 8996 }) 8997 8998 _this.on( 'click', function(){ 8999 9000 // Get content of :after element (+ icon) to check the visibility 9001 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 9002 9003 if (icon_content === 'none' || !icon_content) { 9004 return false; 9005 } 9006 9007 _this.toggleClass('open'); 9008 var isOpen = _this.hasClass('open'), 9009 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 9010 content.animate({ 9011 height: 'toggle', 9012 padding: 'toggle', 9013 opacity: 'toggle', 9014 top: isOpen ? 0 : hasBorder 9015 }, { 9016 duration: 400, 9017 easing: "easeInOutCirc", 9018 }); 9019 9020 return false; 9021 9022 }); 9023 }); 9024 }); 9025 9026 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 9027}; 9028 9029UNCODE.unmodal = function() { 9030 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 9031 $('.unmodal-overlay').fadeIn(); 9032 $('.unmodal-overlay').addClass('loading'); 9033 $('body').addClass('uncode-unmodal-overlay-visible'); 9034 $(window).trigger('unmodal-open'); 9035 }); 9036 9037 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 9038 $('.unmodal-overlay').fadeOut(); 9039 $('.unmodal').fadeOut(); 9040 $('body').removeClass('uncode-unmodal-overlay-visible'); 9041 $('body').removeClass('uncode-unmodal-open'); 9042 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 9043 $(document).trigger('unmodal-close'); 9044 UNCODE.isUnmodalOpen = false; 9045 }); 9046 9047 $(document).on('uncode-unmodal-show-content', function() { 9048 $('.unmodal-overlay').removeClass('loading'); 9049 $('.unmodal').show(); 9050 $('.unmodal').addClass('show-unmodal-with-animation'); 9051 $('.unmodal-content')[0].scrollTop = 0; 9052 $('body').addClass('uncode-unmodal-open'); 9053 UNCODE.isUnmodalOpen = true; 9054 9055 if ($('body').hasClass('qw-body-scroll-disabled')) { 9056 $('html').addClass('uncode-unmodal-body-disable-scroll'); 9057 } 9058 9059 if ($('.unmodal').hasClass('auto-height')) { 9060 set_modal_height(); 9061 } 9062 }); 9063 9064 var set_modal_height = function() { 9065 var modal = $('.unmodal').css({height: 'auto'}); 9066 var window_height = $(window).outerHeight(); 9067 var modal_height = modal.outerHeight(); 9068 9069 modal.css('height', 'auto'); 9070 9071 if (modal_height > window_height) { 9072 modal.outerHeight(window_height); 9073 } 9074 } 9075 9076 if ($('.unmodal').hasClass('auto-height')) { 9077 var setCTA; 9078 9079 $(window).on('resize', function() { 9080 clearRequestTimeout(setCTA); 9081 setCTA = requestTimeout(function() { 9082 set_modal_height(); 9083 }, 100); 9084 }); 9085 } 9086}; 9087 9088UNCODE.bgChanger = function() { 9089 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 9090 $bg_first = $('.vc_row[data-bg-remove]'), 9091 bg_remove = $bg_first.attr('data-bg-remove'), 9092 $first = $bg_changers.first(), 9093 $last = $bg_changers.last(), 9094 $bg_wrapper = $('#changer-back-color'), 9095 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 9096 setCTA, localH = UNCODE.wheight, 9097 isScrolling; 9098 9099 $bg_first.removeClass(bg_remove); 9100 9101 var bgChange = function($col, bgColor, skin, tmbskin){ 9102 $bg_wrapper.attr( 'class', bgColor ); 9103 var menuskin; 9104 if ( typeof skin !== 'undefined' ) { 9105 menuskin = skin.replace('style', 'menu') 9106 } 9107 9108 if ( $col.length ) { 9109 $('.uncol[data-skin-change]').each(function(){ 9110 var $isoFooter = $('.isotope-footer', this); 9111 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 9112 if ( menuskin !== '' ) {
9113 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 9114 } 9115 }); 9116 9117 $('.tmb[data-skin-change]').each(function(){ 9118 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 9119 }); 9120 } 9121 }; 9122 9123 var $masthead = $('#masthead'), 9124 transDesktop, 9125 transMobile, 9126 changeSkin, 9127 9128 checkTransparencyAndChange = function( skin ){ 9129 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 9130 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 9131 changeSkin = $masthead.hasClass('menu-change-skin'); 9132 9133 if ( ! transDesktop && ! transMobile ) { 9134 return false; 9135 } 9136 9137 if ( ! changeSkin ) { 9138 return false; 9139 } 9140 9141 if ( skin === 'style-light' ){ 9142 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 9143 return false; 9144 } else if ( skin === 'style-dark' ) { 9145 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 9146 return false; 9147 } 9148 }; 9149 9150 var bg_waypoints = function(){ 9151 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 9152 9153 $.each($bg_changers, function(index, row) { 9154 9155 var $row = $(row), 9156 $col = $('.uncol[data-skin-change]', $row).eq(0), 9157 skin, 9158 $tmbs, 9159 tmbskin, 9160 bgColor = $row.attr('data-bg-color'); 9161 9162 if ( ! $row.is(':visible') ) { 9163 return false; 9164 } 9165 9166 if ( $col.length ) { 9167 skin = $col.attr('data-skin-change'); 9168 $tmbs = $('.tmb[data-skin-change]', $row); 9169 tmbskin = skin.replace('style', 'tmb'); 9170 } 9171 9172 if ( ! $row.hasClass('unscroll-horizontal') ) { 9173 $row.waypoint(function( dir ) { 9174 if ( dir === 'down' ) { 9175 bgChange($col, bgColor, skin, tmbskin); 9176 checkTransparencyAndChange(skin); 9177 } else { 9178 return; 9179 } 9180 }, {
9181 offset: '50%' 9182 }); 9183 9184 $row.waypoint(function( dir ) { 9185 if ( dir === 'up' ) { 9186 bgChange($col, bgColor, skin, tmbskin); 9187 checkTransparencyAndChange(skin); 9188 } else { 9189 return; 9190 } 9191 }, { 9192 offset: function() { 9193 var clH = this.element.clientHeight, 9194 wH = window.innerHeight, 9195 ret = clH > 200 ? -100 : clH * -0.5; 9196 return ( wH / 2 ) - clH; 9197 } 9198 }); 9199 } 9200 9201 }); 9202 9203 $('body').addClass('bg-changer-init'); 9204 9205 } 9206 }; 9207 9208 var body = document.body, 9209 edges = false; 9210 9211 var throttle = function(fn, wait) { 9212 var time = Date.now(); 9213 return function() { 9214 if ((time + wait - Date.now()) < 0) { 9215 fn(); 9216 time = Date.now(); 9217 } 9218 } 9219 } 9220 9221 var $wrapper = document.querySelector(".main-wrapper"), 9222 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 9223 9224 var $title = document.querySelector('#rotating'); 9225 if ( $title !== null ) { 9226 $title.style.whiteSpace = 'nowrap'; 9227 $title.style.transition = 'transform 200ms linear'; 9228 } 9229 9230 window.addEventListener( 'scroll', throttle( function() { 9231 window.clearRequestTimeout( isScrolling ); 9232 9233 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 9234 9235 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 9236 body = document.body, 9237 html = document.documentElement, 9238 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9239 $row = false, 9240 firstOff, 9241 lastOff; 9242 9243 if ( scrolled < 100 && $first.length ) { 9244 firstOff = $first.offset().top; 9245 if ( firstOff < 100 ) { 9246 var $row = $first; 9247 } 9248 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 9249 lastOff = $last.offset().top + $last.outerHeight(); 9250 if ( lastOff > ( docH - 100 ) ) { 9251 var $row = $last; 9252 } 9253 } 9254 9255 if ( $row.length ) { 9256 var $col = $('.uncol[data-skin-change]', $row).eq(0), 9257 skin, 9258 $tmbs, 9259 tmbskin, 9260 bgColor = $row.attr('data-bg-color'); 9261 9262 if ( $col.length ) { 9263 skin = $col.attr('data-skin-change'); 9264 $tmbs = $('.tmb[data-skin-change]', $row); 9265 tmbskin = skin.replace('style', 'tmb'); 9266 } 9267 9268 bgChange($col, bgColor, skin, tmbskin); 9269 checkTransparencyAndChange(skin); 9270 edges = true; 9271 } 9272 9273 }, 150); 9274 9275 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 9276 bg_waypoints(); 9277 Waypoint.refreshAll(); 9278 edges = false; 9279 } 9280 9281 }, 100), false); 9282 9283 $(window).on('resize', function() { 9284 clearRequestTimeout(setCTA); 9285 setCTA = requestTimeout(function() { 9286 if ( localH != UNCODE.wheight ) { 9287 localH = UNCODE.wheight; 9288 bg_waypoints(); 9289 Waypoint.refreshAll(); 9290 } 9291 }, 100); 9292 }); 9293 9294 bg_waypoints(); 9295 9296}; 9297 9298UNCODE.skewIt = function() { 9299 9300 if ( $('body').hasClass('compose-mode') ) { 9301 return; 9302 } 9303 9304 var justscrolled = false; 9305 9306 var loadSkewIt = function(){ 9307 9308 var $pageHeader = $('#page-header'), 9309 $page_body = $('.page-body'), 9310 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 9311 9312 if ( $header_skew.length ) { 9313 $pageHeader.addClass('uncode-skew').css({ 9314 position: 'relative', 9315 zIndex: 1 9316 }); 9317 $header_skew.removeClass('uncode-skew'); 9318 $page_body.css({ 9319 position: 'relative', 9320 zIndex: 0 9321 }); 9322 } 9323 9324 var $skew = $('.uncode-skew'), 9325 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 9326 horizontal = $horizontal.length, 9327 stopSkewing, 9328 lastOffset = 0, 9329 lastDate = Date.now(); 9330 9331 if ( ! $skew.length ) { 9332 return; 9333 } 9334 9335 var dropSkew = function(){ 9336 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 9337 return; 9338 9339 $skew.each(function(){ 9340 var $this = $(this), 9341 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9342 9343 if ( $drop.length ) { 9344 $this.css({ 9345 'transform': 'skew(0)' 9346 }); 9347 var bound = $this[0].getBoundingClientRect(); 9348 $drop.css({ 9349 left: bound.x * -1, 9350 top: bound.y * -1, 9351 }); 9352 } 9353 }); 9354 }; 9355 dropSkew(); 9356 9357 $(window).on('resize', dropSkew); 9358 9359 window.addEventListener( 'scroll', function() { 9360 9361 if ( justscrolled !== true ) { 9362 justscrolled = true; 9363 return; 9364 } 9365 9366 window.clearRequestTimeout( stopSkewing ); 9367 9368 var now = Date.now(), 9369 delayInMs = now - lastDate, 9370 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9371 newOffset = offset - lastOffset, 9372 speed = Math.pow((newOffset / delayInMs), 3) * -1, 9373 body = document.body, 9374 html = document.documentElement, 9375 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 9376 wait = 50, 9377 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 9378 9379 if ((lastDate + wait - now) < 0) { 9380 9381 lastDate = now; 9382 lastOffset = offset; 9383 9384 if ( speed > 6 ) { 9385 speed = 6; 9386 } else if ( speed < -6 ) { 9387 speed = -6; 9388 } 9389 9390 if ( speed > 2 && offset < UNCODE.wheight ) { 9391 speed = 2; 9392 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 9393 speed = -2; 9394 } 9395 9396 var speedY = speed, 9397 speedX = speed * 1.25; 9398 9399 if ( horizontal ) { 9400 speedY = 0; 9401 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9402 speedX = 0; 9403 return; 9404 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 9405 speedX = 0; 9406 return; 9407 } 9408 } else { 9409 speedX = 0; 9410 } 9411 9412 if ( ! $skew.closest('.enter-st').length ) { 9413 speedX = 0; 9414 } 9415 9416 gsap.killTweensOf($skew); 9417 gsap.to( $skew, { 9418 duration: 0.2, 9419 skewY: (speedY * maxSpeed) + "deg", 9420 skewX: (speedX * maxSpeed) + "deg", 9421 ease: Power0.easeNone, 9422 transformOrigin: 'center', 9423 }); 9424 9425 } 9426 9427 stopSkewing = requestTimeout(function() { 9428 gsap.killTweensOf($skew); 9429 gsap.to( $skew, { 9430 duration: 0.5, 9431 skewY: "0deg", 9432 skewX: "0deg", 9433 transformOrigin: 'center', 9434 ease: Expo.easeOut, 9435 }); 9436 9437 $skew.each(function(){ 9438 var $this = $(this), 9439 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 9440 9441 if ( $drop.length ) { 9442 var bound = $this[0].getBoundingClientRect() 9443 $drop.css({ 9444 left: bound.x * -1, 9445 top: bound.y * -1, 9446 }); 9447 } 9448 }); 9449 9450 }, 200); 9451 9452 }, false); 9453 9454 }; 9455 9456 $(window).on('load', loadSkewIt); 9457 9458}; 9459 9460UNCODE.rotateIt = function() { 9461 9462 if ( $('body').hasClass('compose-mode') ) { 9463 return; 9464 } 9465 9466 var frameRotate = false;
9467 var loadRotateIt = function(){ 9468 9469 var $toRotate = $('.uncode-rotate'); 9470 9471 $toRotate.each(function(){ 9472 var $rotate = $(this), 9473 deg = 0, 9474 dir = true, 9475 coeff = 1, 9476 lastOffset = 0, 9477 lastDate = Date.now(); 9478 9479 var checkScroll = function($rotate){ 9480 // if ( ! $rotate.length ) { 9481 // return; 9482 // } 9483 9484 var now = Date.now(), 9485 delayInMs = now - lastDate, 9486 offset = window.pageYOffset || window.document.documentElement.scrollTop, 9487 newOffset = offset - lastOffset, 9488 speed = (newOffset / delayInMs) * 5, 9489 body = document.body, 9490 html = document.documentElement, 9491 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 9492 9493 lastDate = now; 9494 lastOffset = offset; 9495 9496 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 9497 deg = 0; 9498 } 9499 9500 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 9501 deg = parseFloat(deg) + parseFloat(speed); 9502 } 9503 9504 if ( $rotate.hasClass('uncode-rotate-hover') ) { 9505 $rotate.hover(function(){ 9506 coeff = 1.75; 9507 }, function(){ 9508 coeff = 1; 9509 }); 9510 } 9511 9512 // if ( speed > 0 ) { 9513 // dir = true 9514 // } else if ( speed < 0 ) { 9515 // dir = false 9516 // } 9517 9518 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 9519 deg = deg+coeff; 9520 // if ( dir ) { 9521 // deg = deg+coeff; 9522 // } else { 9523 // deg = deg-coeff; 9524 // } 9525 } 9526 9527 if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9528 return false; 9529 } 9530 9531 if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) { 9532 var undeg = deg*-1; 9533 $rotate[0].style.transform = 'rotate(' + undeg + 'deg)'; 9534 } else { 9535 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 9536 } 9537 9538 requestAnimationFrame(function() { 9539 if ( frameRotate === true ) { 9540 frameRotate = false; 9541 return; 9542 } 9543 checkScroll($rotate); 9544 }); 9545 }; 9546 9547 checkScroll($rotate); 9548 9549 }); 9550 9551 }; 9552 9553 $(window).on('load', loadRotateIt); 9554 9555 var checkRotate; 9556 var resizeRotate = function(){ 9557 var $inlineRotates = $('.inline-rotate'); 9558 $inlineRotates.each(function(){ 9559 $(this).addClass('inline-rotate-standby'); 9560 }); 9561 clearTimeout(checkRotate); 9562 checkRotate = setTimeout(function(){ 9563 $('.inline-rotate').each(function(){ 9564 $(this).removeClass('inline-rotate-standby'); 9565 frameRotate = true; 9566 }); 9567 loadRotateIt(); 9568 }, 500); 9569 }; 9570 9571 $(window).off('resize.inline-rotate', resizeRotate) 9572 .on('resize.inline-rotate', resizeRotate); 9573 9574}; 9575 9576var marqueeAttempts = 0, 9577 marqueeTO, 9578 marqueeCheckResize, 9579 initMarquee; 9580 9581UNCODE.textMarquee = function( $titles ) { 9582 9583 var isInitMarque = false; 9584 9585 var initTextMarquee = function( $titles ){ 9586 9587 if ( typeof $titles == 'undefined' ) { 9588 $titles = $('.un-text-marquee'); 9589 } 9590 9591 if ( ! $titles.length ) { 9592 return; 9593 } 9594 9595 isInitMarque = true; 9596 9597 var stableHeight = UNCODE.wheight; 9598 9599 $titles.each(function(){ 9600 var $title = $(this), 9601 $span = $('> span, > i > span', $title), 9602 txt, 9603 first = true, 9604 dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ), 9605 dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ), 9606 dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'), 9607 hasSticky = false, 9608 dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'), 9609 dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'), 9610 newW = UNCODE.wwidth, 9611 marqueeTL, inview; 9612 9613 if ( $title.closest('.sticky-trigger').length || $title.closest('.sticky-element').length || $title.closest('.pin-spacer').length ) { 9614 hasSticky = true; 9615 dataTrigger = 'row'; 9616 } 9617 9618 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 9619 dataNavBar = dataNavBarMobile; 9620 } 9621 9622 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 9623 dataSpace = isNaN(dataSpace) ? 'default' : dataSpace; 9624 var dataX = dataSpeed; 9625 9626 dataSpeed += 5; 9627 9628 $('.marquee-clone-wrap', $title).remove(); 9629 9630 txt = $span.html(); 9631 9632 if ( ! $('.marquee-original-core', $span).length ) { 9633 txt = $span.html(); 9634 $span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 9635 } else { 9636 txt = $('.marquee-original-core', $span).html(); 9637 } 9638 9639 var spanW, 9640 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 9641 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 9642 speed = 10 - dataSpeed; 9643 9644 $span.prepend($prepended); 9645 $span.append($appended); 9646 9647 var continuousTextMarquee = function () { 9648 var bound = $title 9649 .css({ 9650 transform: "none", 9651 opacity: 0, 9652 }) 9653 .offset(), 9654 ease = "none"; 9655 9656 var xStrt = 9657 first || $title.hasClass("un-marquee-infinite") 9658 ? 0 9659 : UNCODE.wwidth - bound.left, 9660 xEnd = $title.hasClass("un-marquee-infinite") 9661 ? spanW 9662 : spanW + bound.left, 9663 xSpeed = 9664 ((xEnd + xStrt) / (dataSpeed * dataSpeed * dataSpeed) / 5) * 9665 dataSpeed, 9666 direction = $title.hasClass("un-marquee-opposite") ? 1 : -1, 9667 speedSlow = (xEnd + xStrt) / 45, 9668 transFormVal, 9669 translX; 9670 9671 marqueeTL = new TimelineMax({ paused: true, reversed: true }); 9672 marqueeTL.play(); 9673 9674 var inViewElement = 9675 dataTrigger === "row" ? ( hasSticky ? $title.closest('.sticky-trigger, .sticky-element').parent()[0] : $title.closest(".vc_row")[0] ) : $title[0], 9676 wayOff = 9677 dataTrigger === "row" && dataNavBar === "yes" 9678 ? UNCODE.menuHeight 9679 : 0; 9680 9681 inview = new Waypoint.Inview({ 9682 element: inViewElement, 9683 offset: wayOff, 9684 enter: function (direction) { 9685 marqueeTL.play(); 9686 }, 9687 exited: function (direction) { 9688 if (!$title.closest(".pin-spacer").length) { 9689 marqueeTL.pause(); 9690 } 9691 }, 9692 }); 9693 9694 if ($title.hasClass("un-marquee-hover")) { 9695 var $column = $title.closest(".wpb_column"), 9696 $col_link = $(".col-link", $column), 9697 $hover_sel = $title; 9698 9699 if ($col_link.length) { 9700 $hover_sel = $title.add($column); 9701 } 9702 $hover_sel 9703 .on("mouseover", function () { 9704 ease = "power2.out";
9705 transFormVal = $title.css("transform").split(/[()]/)[1]; 9706 translX = transFormVal.split(",")[4]; 9707 speedSlow = (xEnd + (xStrt - translX)) / 45; 9708 marqueeTL.duration(speedSlow); 9709 }) 9710 .on("mouseout", function () { 9711 ease = "power2.in"; 9712 transFormVal = $title.css("transform").split(/[()]/)[1]; 9713 translX = transFormVal.split(",")[4]; 9714 speedSlow = 9715 ((xEnd + (xStrt - translX)) / 9716 (dataSpeed * dataSpeed * dataSpeed) / 9717 5) * 9718 dataSpeed; 9719 marqueeTL.duration(speedSlow); 9720 }); 9721 } 9722 9723 gsap.killTweensOf($title); 9724 marqueeTL.fromTo( $title, { 9725 opacity: 1, 9726 x: xStrt * direction * -1 9727 }, 9728 { 9729 duration: xSpeed, 9730 x: xEnd * direction, 9731 onComplete: function(){ 9732 first = false; 9733 continuousTextMarquee(); 9734 }, 9735 onUpdate: function(){ 9736 if ( ! $title[0].isConnected ) { 9737 marqueeTL.kill(); 9738 initTextMarquee(); 9739 } 9740 }, 9741 ease: ease 9742 }); 9743 9744 }; 9745 9746 var runTextMarquee = function(){ 9747 var time = Date.now(); 9748 9749 var textMarqueeScroll = function(){ 9750 var $row = $title.closest('.vc_row'); 9751 if ( hasSticky ) { 9752 $row = $title.closest('.sticky-trigger, .sticky-element').parent(); 9753 } 9754 var $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title; 9755 9756 if ( !$bound.length ) { 9757 return; 9758 } 9759 9760 var bound = $bound[0].getBoundingClientRect(), 9761 wait = 100, 9762 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1, 9763 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 9764 9765 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 9766 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 9767 marqueeAttempts < 2 ) { 9768 9769 clearRequestTimeout(marqueeTO); 9770 9771 marqueeTO = requestTimeout(function(){ 9772 marqueeAttempts++; 9773 initTextMarquee(); 9774 }, 100); 9775 } 9776 9777 9778 var bound_top = bound.top, 9779 gsap_calc = ( ( stableHeight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction; 9780 9781 if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) { 9782 if ( dataTrigger === 'row-middle' ) { 9783 bound_top = (bound.top + bound.height*0.5) - (stableHeight * 0.5) 9784 } 9785 if ( dataNavBar === 'yes' ) { 9786 bound_top = bound_top - UNCODE.menuHeight; 9787 } 9788 gsap_calc = ( bound_top * dataMove ) * 0.5 * direction; 9789 } 9790 9791 gsap.killTweensOf($title); 9792 gsap.to( $title, { 9793 duration: 0.24, 9794 x: gsap_calc, 9795 }); 9796 }; 9797 9798 textMarqueeScroll(); 9799 $(window).on( 'load scroll', function(e) { 9800 textMarqueeScroll(); 9801 }); 9802 9803 }; 9804 9805 var cloneSpan = function($_title, cntnt){ 9806 9807 if ( $_title.hasClass('un-marquee-infinite') ) { 9808 $('> span.marquee-clone-wrap', $_title).text(''); 9809 } 9810 9811 gsap.to( $_title, { 9812 duration: 0, 9813 x: 0 9814 }); 9815 spanW = $span.outerWidth(); 9816 9817 if ( !spanW ) { 9818 return; 9819 } 9820 9821 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2, 9822 spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0"; 9823 9824 if ( $_title.hasClass('un-marquee-infinite') ) { 9825 9826 for ( var i = 0; i < part; i++ ) { 9827 $prepended.append(cntnt + spaceSpan); 9828 $appended.append(cntnt + spaceSpan); 9829 } 9830 } 9831 9832 if ( $('body').hasClass('compose-mode') ) { 9833 $('.uncode_fe_safe').remove(); 9834 return; 9835 } 9836 9837 if ( $title.closest('.marquee-freezed').length ) { 9838 return; 9839 } 9840 9841 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 9842 continuousTextMarquee(); 9843 } 9844 9845 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 9846 runTextMarquee(); 9847 } 9848 9849 }; 9850 9851 var marqueeResize = function(e){ 9852 clearRequestTimeout(marqueeCheckResize); 9853 marqueeCheckResize = requestTimeout(function(){ 9854 if ( newW !== UNCODE.wwidth ) { 9855 gsap.killTweensOf($title); 9856 if ( typeof inview !== 'undefined' && inview !== null ) { 9857 inview.destroy(); 9858 } 9859 if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) { 9860 marqueeTL.kill(); 9861 } 9862 first = true; 9863 initTextMarquee(); 9864 newW = UNCODE.wwidth; 9865 } 9866 }, 1000); 9867 }; 9868 9869 $(window).off('resize', marqueeResize) 9870 .on( 'resize', marqueeResize); 9871 $(window).off('uncode.re-layout', marqueeResize) 9872 .on( 'uncode.re-layout', marqueeResize); 9873 9874 cloneSpan($title, txt); 9875 9876 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9877 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 9878 var $_titles = $('.un-text-marquee',e.view.$el); 9879 clearRequestTimeout(marqueeCheckResize); 9880 marqueeCheckResize = requestTimeout(function(){ 9881 initTextMarquee($_titles); 9882 }, 1000); 9883 }); 9884 } 9885 }); 9886 9887 $(window).on( 'load wwResize', function(e) { 9888 stableHeight = UNCODE.wheight; 9889 }); 9890 9891 }; 9892 9893 document.addEventListener("DOMContentLoaded", function() { 9894 if ( isInitMarque !== true ) { 9895 initTextMarquee(); 9896 } 9897 }); 9898 9899 $(window).on('focus load resize',function(){ 9900 clearTimeout(initMarquee); 9901 initMarquee = setTimeout(function(){ 9902 if ( isInitMarque !== true ) { 9903 initTextMarquee(); 9904 } 9905 }, 500); 9906 }); 9907 9908 $(document).on('pumAfterOpen pumAfterClose', function(args){ 9909 initTextMarquee(); 9910 }); 9911 9912}; 9913 9914UNCODE.parallax = function() { 9915 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 9916 if ($('.parallax-el').length > 0) { 9917 var parallax_elements = new Rellax('.parallax-el'); 9918 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 9919 window.addEventListener('boxResized', function(e) { 9920 parallax_elements.refresh(); 9921 }, false); 9922 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 9923 requestTimeout(function() { 9924 parallax_elements.refresh(); 9925 }, 100); 9926 }); 9927 9928 if ( typeof UNCODE.hDoc === 'undefined' ) { 9929 UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9930 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9931 } 9932 9933 function paralraf(time) { 9934 requestAnimationFrame(paralraf) 9935 9936 var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, 9937 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 9938 9939 if ( UNCODE.hDoc !== newHdoc ) { 9940 UNCODE.hDoc = newHdoc; 9941 parallax_elements.refresh(); 9942 } 9943 } 9944 9945 requestAnimationFrame(paralraf) 9946 9947 } 9948 } 9949}; 9950 9951UNCODE.magicCursor = function(){ 9952 var $customCursor = $('#uncode-custom-cursor'), 9953 $customPilot = $('#uncode-custom-cursor-pilot'), 9954 $tooltip = $('.title-tooltip', $customCursor),
9955 $cursorSpan = $('> span', $tooltip), 9956 currentBg = false, 9957 fromTitle = false, 9958 setTime, 9959 mouseEvent; 9960 9961 var spanW, spanH, 9962 maxW = false; 9963 9964 function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){ 9965 if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) { 9966 $tooltip.css({opacity: 0}); 9967 delayt_time += 400; 9968 } 9969 clearRequestTimeout(setTime); 9970 setTime = requestTimeout(function() { 9971 9972 $tooltip.css({opacity: ''}); 9973 9974 $customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing'); 9975 9976 if ( cursorTitle !== '' ) { 9977 if ( fromTitle && dataTitle === 'boing' ) { 9978 setTimeout(function(){ 9979 $customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing'); 9980 }, 5); 9981 } 9982 $cursorSpan.attr('class', fontClass).html( cursorTitle ); 9983 } else { 9984 if ( cursorType !== 'auto' ) { 9985 $cursorSpan.html(''); 9986 } 9987 } 9988 9989 $cursorSpan.addClass('in-tooltip'); 9990 9991 $customCursor.attr('data-cursor', cursorType); 9992 9993 if ( fromTitle ) { 9994 $customCursor.addClass('from-tooltip-title'); 9995 } else { 9996 $customCursor.removeClass('from-tooltip-title'); 9997 } 9998 9999 if ( cursorBg !== false ) { 10000 $customCursor.attr('data-bg', 'transparent'); 10001 } else { 10002 $customCursor.removeAttr('data-bg'); 10003 } 10004 10005 currentBg = cursorBg; 10006 10007 if ( cursorTitle !== '' ) { 10008 fromTitle = true; 10009 $customCursor.attr('data-cursor', cursorType); 10010 $customCursor.attr('data-title', 'true'); 10011 $cursorSpan.css({width: ''}); 10012 } else { 10013 fromTitle = false; 10014 $customCursor.removeAttr('data-title'); 10015 } 10016 spanW = $cursorSpan.outerWidth(); 10017 10018 if ( spanW >= maxW && maxW !== false ) { 10019 $customCursor.find('> span:first-child').add($tooltip).addClass('max-width'); 10020 $customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({ 10021 width: maxW 10022 }); 10023 spanW = maxW; 10024 } else { 10025 $customCursor.find('> span:first-child').removeClass('max-width'); 10026 } 10027 spanH = $cursorSpan.outerHeight(); 10028 if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) { 10029 $customCursor.find('> span:first-child').add($tooltip).css({ 10030 width: spanW, 10031 height: spanH 10032 }); 10033 } else { 10034 $customCursor.find('> span:first-child').add($tooltip).removeAttr("style"); 10035 } 10036 if ( $customPilot.length ) { 10037 $customPilot.attr('data-cursor', cursorType); 10038 } 10039 }, delayt_time); 10040 } 10041 10042 function changeCursor($wrap){ 10043 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 10044 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 10045 $href = $wrap.find(href), 10046 cursorType, 10047 cursorTitle = '', 10048 tooltip_class = '', 10049 cursorBg = false; 10050 10051 $wrap.filter(":not(.cursor-init)").on("mouseenter.cursor", href, function (e) { 10052 var $this = $(this).addClass("cursor-init"), 10053 $tmb = $this.closest('.tmb'), 10054 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 10055 cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'), 10056 data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'), 10057 data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'), 10058 custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')), 10059 $title = $('.t-entry-title', $tmb), 10060 is_frontend_editor = $this.closest('.vc_controls').length, 10061 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 10062 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 10063 10064 if ( is_frontend_editor ) { 10065 cursorType = 'auto'; 10066 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 10067 cursorType = data_cursor; 10068 } else if ( $parent_cursor.length ) { 10069 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 10070 cursorType = 'icon-light'; 10071 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 10072 cursorType = 'icon-diff'; 10073 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 10074 cursorType = 'icon-accent'; 10075 } else { 10076 cursorType = 'icon-dark'; 10077 } 10078 } else { 10079 cursorType = 'pointer'; 10080 } 10081 10082 if ( typeof data_title !== 'undefined' && data_title !== '' ) { 10083 if ( typeof custom_text !== 'undefined' && custom_text !== '' ) { 10084 cursorTitle = custom_text; 10085 } else { 10086 cursorTitle = $title.clone(); 10087 $('a', cursorTitle).replaceWith(function() { 10088 return this.childNodes; 10089 }); 10090 $('*', cursorTitle).replaceWith(function(){ 10091 return $(this).removeAttr('class'); 10092 });
10093 cursorTitle = cursorTitle.html(); 10094 } 10095 } else { 10096 cursorTitle = ''; 10097 } 10098 10099 if ( typeof data_class !== 'undefined' && data_class !== '' ) { 10100 tooltip_class = data_class; 10101 } else { 10102 tooltip_class = ''; 10103 } 10104 10105 if ( cursor_bg == 'true' ) { 10106 cursorBg = true; 10107 } else { 10108 cursorBg = false; 10109 } 10110 10111 delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class); 10112 }).on("mouseleave.cursor", href, function(e) { 10113 var outTime = 150; 10114 if ( currentBg !== false && cursorBg === false ) { 10115 outTime = 0; 10116 } 10117 delayChangeCursor('auto', '', false, outTime, false, ''); 10118 }); 10119 10120 $(window).on('disable-hover', function(event) { 10121 document.addEventListener("mousemove", function(e) { 10122 mouseEvent = e; 10123 }); 10124 delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, ''); 10125 }); 10126 10127 $(window).on('enable-hover', function(event) { 10128 if ( typeof mouseEvent !== 'undefined' ) { 10129 var x = mouseEvent.clientX, 10130 y = mouseEvent.clientY; 10131 10132 var elements = document.elementsFromPoint(x, y), 10133 $element = $(elements[0]); 10134 10135 $element.closest(href).trigger('mouseenter'); 10136 } 10137 }); 10138 10139 } 10140 10141 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10142 changeCursor(); 10143 }); 10144 10145 $(document).ajaxComplete(function( event, xhr, settings ) { 10146 changeCursor(); 10147 }); 10148 10149 $('.isotope-container').on('isotope-layout-complete', function() { 10150 var $this = $(this); 10151 changeCursor($this); 10152 }); 10153 10154}; 10155 10156UNCODE.magneticCursor = function(){ 10157 function magneticCursor($wrap){ 10158 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 10159 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')); 10160 10161 $magnetics.on('mousemove', function(e){ 10162 var $this = $(this), 10163 $el, 10164 bound = e.currentTarget.getBoundingClientRect(), 10165 coeff = 30, 10166 hor = (bound.width / 2) - (e.clientX - bound.left), 10167 ver = (bound.height / 2) - (e.clientY - bound.top), 10168 toX = hor / bound.width * coeff, 10169 toY = ver / bound.height * coeff, 10170 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 10171 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 10172 toScale = Math.max(scaleX, scaleY); 10173 10174 if ( $this.hasClass('magnetic') ) { 10175 $el = $('.background-inner, .header-bg', $this); 10176 } else { 10177 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10178 } 10179 10180 gsap.killTweensOf($el); 10181 gsap.to( $el, { 10182 duration: 0.75, 10183 x: toX, 10184 y: toY, 10185 scale: toScale, 10186 ease: Power1.easeOut, 10187 transformPerspective: 900, 10188 transformOrigin: 'center', 10189 force3D: true 10190 }); 10191 }).on('mouseout', function(e){ 10192 var $this = $(this), 10193 $el 10194 if ( $this.hasClass('magnetic') ) { 10195 $el = $('.background-inner, .header-bg', $this); 10196 } else { 10197 $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover', $this); 10198 } 10199 gsap.killTweensOf($el); 10200 gsap.to( $el, { 10201 duration: 0.6, 10202 y: 0, 10203 x: 0, 10204 scale: 1, 10205 ease: Power1.easeOut, 10206 transformPerspective: 900, 10207 transformOrigin: 'center', 10208 force3D: true 10209 }); 10210 }); 10211 }; 10212 10213 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 10214 magneticCursor(); 10215 }); 10216 10217 $(document).ajaxComplete(function( event, xhr, settings ) { 10218 magneticCursor(); 10219 }); 10220 10221 $('.isotope-container').on('isotope-layout-complete', function() { 10222 var $this = $(this); 10223 magneticCursor($this); 10224 }); 10225 10226}; 10227 10228UNCODE.dropImage = function() { 10229 10230 /**************************** 10231 * Image hover * 10232 ****************************/ 10233 function imageHover(){ 10234 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10235 return; 10236 } 10237 10238 var $postLists = $('.uncode-post-titles'); 10239 $postLists.each(function(){ 10240 var $list = $(this), 10241 timing = parseFloat( $list.attr('data-timing') ), 10242 default_image = $list.hasClass('uncode-post-titles-default-image'), 10243 default_title = $list.hasClass('uncode-post-titles-default-title'), 10244 $tmbs = $('.tmb', $list), 10245 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 10246 clientX, 10247 clientY, 10248 $row_parent = $list.closest('.vc_row'), 10249 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 10250 $col_parent = $list.closest('.uncell'), 10251 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 10252 stoppedScrolling = true, 10253 setCTA; 10254 10255 timing *= 0.001; 10256 10257 var drop_bgs = function(){ 10258 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 10259 var $drop = $(this), 10260 srcset = $drop.attr('data-bgset'), 10261 setArr = srcset.split(","), 10262 setArrOrder = [], 10263 biggest = 0, 10264 checkBg = false, 10265 desktopBG = $drop.data('[data-background-image]'), 10266 mobileBG = $drop.data('[data-mobile-background-image]'); 10267 10268 if ( $drop.hasClass('srcset-bg-async') ) { 10269 10270 if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) { 10271 return; 10272 } 10273 10274 } 10275 10276 if ( SiteParameters.uncode_adaptive == true ) { 10277 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 10278 $drop.css({ 10279 'background-image' : 'url(' + setArr[0] + ')' 10280 }); 10281 } 10282 } else { 10283 for ( var i = 0; i < setArr.length; i++ ) { 10284 var setLoop = setArr[i].trim().split(" ");
10285 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 10286 var parseSet = parseFloat(setLoop[1]); 10287 if ( biggest < parseSet ) { 10288 biggest = parseSet; 10289 } 10290 setArrOrder[parseSet] = setLoop[0]; 10291 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 10292 checkBg = true; 10293 $drop.css({ 10294 'background-image' : 'url(' + setLoop[0] + ')' 10295 }); 10296 } 10297 } 10298 } 10299 10300 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 10301 $drop.css({ 10302 'background-image' : 'url(' + setArrOrder[biggest] + ')' 10303 }); 10304 } 10305 } 10306 10307 }); 10308 }; 10309 10310 drop_bgs(); 10311 10312 var dropMovesSize = function(){ 10313 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 10314 return; 10315 } 10316 $drop_moves.each(function(){ 10317 var $drop_move = $(this), 10318 dataW = $drop_move.attr('data-w'), 10319 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 10320 if ( typeof dataW !== 'undefined' && dataW !== null ) { 10321 dataW = screenInfo.width / 12 * parseFloat( dataW ); 10322 } 10323 $drop_moves.css({ 10324 width: dataW 10325 }); 10326 10327 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10328 $anim_parent.on('animationend', function(){ 10329 var bound = $anim_parent[0].getBoundingClientRect(); 10330 $drop_move.css({ 10331 left: bound.x * -1, 10332 top: bound.y * -1, 10333 }); 10334 }); 10335 } 10336 }); 10337 10338 10339 }; 10340 10341 dropMovesSize(); 10342 10343 $(window).on( 'resize', function(){ 10344 clearRequestTimeout(setCTA); 10345 setCTA = requestTimeout( function() { 10346 drop_bgs(); 10347 dropMovesSize(); 10348 }, 100 ); 10349 }); 10350 10351 if ( $drop_row_parents.length ) { 10352 $row_parent.addClass( 'drop-added' ); 10353 } 10354 10355 $drop_row_parents.each(function(index, val){ 10356 var $drop = $(val); 10357 $row_parent.prepend($drop); 10358 manageVideos($drop, false); 10359 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10360 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10361 } 10362 if ( default_image && index == 0 ) { 10363 manageVideos($drop, true); 10364 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10365 image_ph = new Image(); 10366 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10367 image_ph.onload = function() { 10368 $drop.addClass('active'); 10369 if ( default_title ) { 10370 $list.addClass('drop-hover'); 10371 $tmbs.first().addClass('drop-active'); 10372 } 10373 }; 10374 image_ph.src = bg_img; 10375 } 10376 } 10377 }); 10378 10379 if ( $drop_col_parents.length ) { 10380 $col_parent.addClass( 'drop-added' ); 10381 } 10382 10383 $drop_col_parents.each(function(index, val){ 10384 var $drop = $(this); 10385 $col_parent.prepend($drop); 10386 manageVideos($drop, false); 10387 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 10388 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 10389 } 10390 if ( default_image && index == 0 ) { 10391 manageVideos($drop, true); 10392 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 10393 image_ph = new Image(); 10394 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 10395 image_ph.onload = function() { 10396 $drop.addClass('active'); 10397 if ( default_title ) { 10398 $list.addClass('drop-hover'); 10399 $tmbs.first().addClass('drop-active'); 10400 } 10401 }; 10402 image_ph.src = bg_img; 10403 } 10404 } 10405 }); 10406 10407 function manageVideos( $el, start ) { 10408 var videoElem = $('video', $el), 10409 $iframe = $('iframe', $el), 10410 iframeID = $iframe.attr('id'); 10411 if ( videoElem.length ) { 10412 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 10413 if ( start ) { 10414 videoElem[0].setCurrentTime(0); 10415 videoElem[0].play(); 10416 } else { 10417 videoElem[0].pause(); 10418 videoElem[0].setCurrentTime(0); 10419 } 10420 } else { 10421 if ( start ) { 10422 videoElem[0].currentTime = 0; 10423 videoElem[0].play(); 10424 } else { 10425 videoElem[0].pause(); 10426 videoElem[0].currentTime = 0; 10427 } 10428 } 10429 } 10430 10431 $el.data('active', start); 10432 10433 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 10434 var iframeIDv = iframeID.replace('okplayer-', ''), 10435 optionsV = $(window).data('okoptions-' + iframeIDv), 10436 vimeo = $iframe[0], 10437 playerV = new Vimeo.Player(vimeo), 10438 timeV = 0; 10439 10440 if (optionsV.time != null) { 10441 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 10442 for ( var i = 0; i < timeArr.length; i++ ) { 10443 if ( timeArr[i] === 'h' ) { 10444 timeV += parseFloat(timeArr[i-1]) * 3600; 10445 } else if ( timeArr[i] === 'm' ) { 10446 timeV += parseFloat(timeArr[i-1]) * 60; 10447 } else if ( timeArr[i] === 's' ) { 10448 timeV += parseFloat(timeArr[i-1]); 10449 } 10450 } 10451 } 10452 playerV.setCurrentTime(timeV); 10453 if ( start ) { 10454 playerV.setVolume(0); 10455 playerV.play(); 10456 } else { 10457 playerV.pause(); 10458 } 10459 } else if ( $el.attr('data-provider') === 'youtube' ) { 10460 if ( start ) { 10461 $el.trigger('uncode-resume'); 10462 } else { 10463 $el.trigger('uncode-pause'); 10464 } 10465 } 10466 10467 } 10468 10469 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10470 10471 document.addEventListener("mousemove", function(e) { 10472 $drop_moves.each(function(){ 10473 var $drop_move = $(this), 10474 duration = 0.4; 10475 10476 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 10477 duration = 0.8; 10478 } 10479 10480 clientX = e.clientX; 10481 clientY = e.clientY; 10482 10483 gsap.to( $drop_move, { 10484 duration: duration, 10485 x: clientX, 10486 y: clientY, 10487 ease: Power1.easeOut, 10488 }); 10489 }); 10490 }); 10491 10492 } else { 10493 10494 $(window).on("touchend scroll", function(e) { 10495 $list.removeClass('drop-hover'); 10496 $drop_moves.removeClass('active'); 10497 $tmbs.removeClass('drop-active'); 10498 }); 10499 10500 $drop_moves.each(function(){ 10501 var $drop_move = $(this), 10502 $tmb = $drop_move.closest('.tmb'), 10503 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 10504 10505 if ( $anim_parent.hasClass('uncode-skew') ) { 10506 $anim_parent.css({ 10507 'transform': 'skew(0)' 10508 }); 10509 } 10510 10511 $tmb.on('touchend', function(e){ 10512 e.stopPropagation(); 10513 10514 $drop_moves.removeClass('active'); 10515 $tmbs.removeClass('drop-active'); 10516 10517 $list.addClass('drop-hover'); 10518 $tmb.addClass('drop-active'); 10519 $drop_move.addClass('active'); 10520 manageVideos($drop_move, true); 10521 clientX = e.changedTouches[0].clientX; 10522 clientY = e.changedTouches[0].clientY; 10523 10524 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10525 var bound = $anim_parent[0].getBoundingClientRect(); 10526 clientX = clientX - bound.x; 10527 clientY = clientY - bound.y; 10528 } 10529 10530 $drop_move.css({ 10531 left: clientX, 10532 top: clientY 10533 }); 10534 }); 10535 }); 10536 10537 } 10538 10539 $tmbs.each(function(e){ 10540 var $tmb = $(this), 10541 // $trgr = $('a', $tmb), 10542 $trgr = $tmb, 10543 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 10544 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
10544(.t-inside), .parallax-el'), 10545 $video = $('video', $tmb), 10546 $iframe = $('iframe', $tmb), 10547 $entryTxt = $('.t-entry-text', $tmb), 10548 stopBounding; 10549 10550 $entryTxt.add($drop_move).css({ 10551 'transition-duration': timing + 's' 10552 }); 10553 10554 if ( $video.length ) { 10555 var vidH = $video[0].videoHeight, 10556 vidW = $video[0].videoWidth; 10557 $video.css({ 10558 'height': vidH, 10559 'width': vidW 10560 }); 10561 } 10562 10563 if ( $iframe.length ) { 10564 var vidH = $drop_move.attr('data-height'), 10565 vidW = $drop_move.attr('data-width'); 10566 $iframe.css({ 10567 'height': vidH, 10568 'width': vidW 10569 }); 10570 } 10571 10572 $iframe.each(function(){ 10573 var $video = $(this), 10574 vidH = $video[0].videoHeight, 10575 vidW = $video[0].videoWidth; 10576 $video.css({ 10577 'height': vidH, 10578 'width': vidW 10579 }); 10580 }); 10581 10582 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10583 $trgr.on('mouseenter',function(e){ 10584 10585 $list.addClass('drop-hover'); 10586 $tmbs.removeClass('drop-active'); 10587 $tmb.addClass('drop-active'); 10588 $drop_move.addClass('active'); 10589 manageVideos($drop_move, true); 10590 10591 var clientX = e.clientX, 10592 clientY = e.clientY; 10593 $drop_move.css({ 10594 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 10595 }); 10596 10597 }) 10598 .on('mouseleave', function(e){ 10599 $list.removeClass('drop-hover'); 10600 $drop_move.css({ 10601 'transition-duration': ( timing*1.25 ) + 's' 10602 }); 10603 $drop_move.removeClass('active'); 10604 $tmb.removeClass('drop-active'); 10605 $drop_move.on('transitionend', function(e){ 10606 $drop_move.off('transitionend'); 10607 $drop_move.css({ 10608 'transition-duration': timing + 's' 10609 }); 10610 manageVideos($drop_move,false); 10611 }); 10612 }); 10613 10614 document.addEventListener('visibilitychange', function(){ 10615 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 10616 $drop_move.css({ 10617 'transition-duration': '0s' 10618 }); 10619 $drop_move.removeClass('active'); 10620 manageVideos($drop_move, false); 10621 } 10622 }); 10623 10624 document.addEventListener('scroll', function(){ 10625 window.clearRequestTimeout( stopBounding ); 10626 if ( stoppedScrolling ) { 10627 stoppedScrolling = false; 10628 if ( $drop_move.hasClass('active') ) { 10629 $list.removeClass('drop-hover'); 10630 $tmbs.removeClass('drop-active'); 10631 $drop_move.removeClass('active'); 10632 $drop_move.on('transitionend', function(e){ 10633 $drop_move.off('transitionend'); 10634 $drop_move.css({ 10635 'transition-duration': timing + 's' 10636 }); 10637 manageVideos($drop_move,false); 10638 }); 10639 } 10640 } 10641 10642 stopBounding = requestTimeout(function() { 10643 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 10644 var bound = $anim_parent[0].getBoundingClientRect(); 10645 $drop_move.css({ 10646 left: bound.x * -1, 10647 top: bound.y * -1, 10648 }); 10649 } 10650 stoppedScrolling = true; 10651 }, 500); 10652 }); 10653 } 10654 10655 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 10656 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 10657 10658 $drop.css({ 10659 'transition-duration': timing + 's' 10660 }); 10661 10662 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 10663 $trgr.on('mouseenter',function(e){ 10664 $row_parent.add($col_parent).addClass('drop-list-loaded'); 10665 $list.addClass('drop-hover'); 10666 10667 if ( !$tmb.hasClass('drop-active') ) { 10668 $tmbs.removeClass('drop-active'); 10669 $tmb.addClass('drop-active'); 10670 if ( default_image && !$drop.hasClass('active') ) { 10671 var $prev = $('[data-drop].active', $row_parent); 10672 $prev.css({ 10673 'transition-duration': (timing*1.5) + 's' 10674 }); 10675 $prev.removeClass('active'); 10676 $prev.on('transitionend', function(e){ 10677 $prev.off('transitionend'); 10678 manageVideos($prev,false); 10679 }); 10680 } 10681 $drop.css({ 10682 'transition-duration': timing + 's' 10683 }); 10684 $drop.off('transitionend'); 10685 $drop.addClass('active'); 10686 manageVideos($drop, true); 10687 } 10688 }) 10689 .on('mouseleave', function(e){ 10690 if ( ( default_image && !default_title ) || !default_image ) { 10691 $list.removeClass('drop-hover'); 10692 $tmb.removeClass('drop-active'); 10693 } 10694 if ( ! default_image ) { 10695 $drop.css({ 10696 'transition-duration': (timing*1.5) + 's' 10697 }); 10698 $drop.removeClass('active'); 10699 10700 $drop.on('transitionend', function(e){ 10701 $drop.off('transitionend'); 10702 manageVideos($drop,false); 10703 }); 10704 } 10705 }); 10706 10707 document.addEventListener('visibilitychange', function(){ 10708 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 10709 $drop.css({ 10710 'transition-duration': '0s' 10711 }); 10712 $drop.removeClass('active'); 10713 manageVideos($drop, false); 10714 } 10715 }); 10716 } 10717 }); 10718 10719 }); 10720 }; 10721 10722 $(window).on('load', function(event) { 10723 imageHover(); 10724 }); 10725 10726 var drop_wp_animation = function() { 10727 var $postLists = $('.uncode-post-titles'); 10728 $postLists.each(function(){ 10729 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10730 new Waypoint({ 10731 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10732 element: val, 10733 handler: function() { 10734 var element = $(this.element), 10735 parent = element.closest('.tmb'), 10736 currentIndex = parent.index(),
10737 delay = currentIndex, 10738 delayAttr = parseInt(element.attr('data-delay')); 10739 if (isNaN(delayAttr)) delayAttr = 100; 10740 var objTimeout = requestTimeout(function() { 10741 element.addClass('start_animation'); 10742 10743 var nextTimeout = requestTimeout(function() { 10744 $('.drop-image-separator', parent).addClass('start_animation'); 10745 }, 50); 10746 10747 }, delay * delayAttr); 10748 if (!UNCODE.isUnmodalOpen) { 10749 this.destroy(); 10750 } 10751 }, 10752 offset: UNCODE.isFullPage ? '100%' : '90%' 10753 }) 10754 }); 10755 }); 10756 } 10757 10758 var runWaypoints_TO, 10759 runWaypoints_delay = 0; 10760 10761 var runWaypoints = function(){ 10762 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10763 runWaypoints_delay = 400; 10764 } 10765 clearRequestTimeout(runWaypoints_TO); 10766 runWaypoints_TO = requestTimeout(function() { 10767 drop_wp_animation(); 10768 }, runWaypoints_delay); 10769 }; 10770 runWaypoints(); 10771 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10772 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10773 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10774 // imageHover(); 10775 runWaypoints(); 10776 }); 10777 } 10778}; 10779 10780UNCODE.postTable = function() { 10781 10782 var clickRow = function(){ 10783 var $postLists = $('.uncode-post-table'); 10784 10785 $postLists.each(function(){ 10786 var $postList = $(this), 10787 $tmbClicks = $('.tmb.tmb-click-row', $postList); 10788 10789 $tmbClicks.each(function(){ 10790 var $tmb = $(this), 10791 $click = $('.table-click-row', $tmb); 10792 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 10793 e.preventDefault(); 10794 e.stopPropagation(); 10795 $click[0].click(); 10796 return false; 10797 }); 10798 }); 10799 10800 }) 10801 }; 10802 10803 clickRow(); 10804 10805 var hoverRow = function(){ 10806 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 10807 10808 $postLists.on('mouseenter', function(){ 10809 $(this).addClass('post-table-hover'); 10810 }); 10811 $postLists.on('mouseleave', function(){ 10812 $(this).removeClass('post-table-hover'); 10813 }); 10814 } 10815 10816 hoverRow(); 10817 10818 var drop_wp_animation = function() { 10819 var $postLists = $('.uncode-post-table'); 10820 $postLists.each(function(){ 10821 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10822 new Waypoint({ 10823 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10824 element: val, 10825 handler: function() { 10826 var element = $(this.element), 10827 parent = element.closest('.tmb'), 10828 currentIndex = parent.index(), 10829 delay = currentIndex, 10830 delayAttr = parseInt(element.attr('data-delay')); 10831 if (isNaN(delayAttr)) delayAttr = 100; 10832 var objTimeout = requestTimeout(function() { 10833 element.addClass('start_animation'); 10834 }, delay * delayAttr); 10835 if (!UNCODE.isUnmodalOpen) { 10836 this.destroy(); 10837 } 10838 }, 10839 offset: UNCODE.isFullPage ? '100%' : '90%' 10840 }) 10841 }); 10842 }); 10843 } 10844 10845 var runWaypoints_TO, 10846 runWaypoints_delay = 0; 10847 10848 var runWaypoints = function(){ 10849 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10850 runWaypoints_delay = 400; 10851 } 10852 clearRequestTimeout(runWaypoints_TO); 10853 runWaypoints_TO = requestTimeout(function() { 10854 drop_wp_animation(); 10855 }, runWaypoints_delay); 10856 }; 10857 runWaypoints(); 10858 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10859 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10860 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10861 runWaypoints(); 10862 // clickRow(); 10863 }); 10864 } 10865}; 10866 10867UNCODE.rotatingTxt = function($ctxt) { 10868 10869 if ( $('body').hasClass('compose-mode') ) { 10870 return; 10871 } 10872 10873 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 10874 var setCTA; 10875 10876 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 10877 var $heading = $(this), 10878 // debug = 0, 10879 cycle = 0, 10880 $trgt, 10881 $toMove, 10882 $highl, 10883 $col = $heading.closest('.uncont'), 10884 txt, 10885 arrTxt, 10886 textFadeIn, textFadeOut, 10887 removeWraps; 10888 10889 var defineObjs = function() { 10890 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 10891 var $rtx = $(this), 10892 fx = $rtx.attr('data-fx'), 10893 wait = $rtx.attr('data-wait'), 10894 $prev = $(this).prev().addClass('prev-rotating-start'), 10895 splitToMove = [], 10896 splitArray = [], 10897 lineArray = [], 10898 lineIndex = 0, 10899 lineStart = true, 10900 lineEnd = false, 10901 startSplit = false, 10902 $line_wrap = $rtx.closest('.heading-line-wrap'), 10903 same_line = true, 10904 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 10905 indexRtx = $splits.index($rtx); 10906 10907 fx = typeof fx === 'undefined' ? '' : fx;
10908 wait = typeof wait === 'undefined' ? '' : wait; 10909 10910 $splits.each(function(key, val){ 10911 var $split = $(this), 10912 $new_line_wrap = $split.closest('.heading-line-wrap'); 10913 10914 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 10915 splitArray.push( $split ); 10916 } 10917 10918 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10919 startSplit = false; 10920 } 10921 10922 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10923 splitArray.push( $split ); 10924 10925 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 10926 same_line = true; 10927 } else { 10928 same_line = false; 10929 } 10930 } 10931 10932 if ( key == indexRtx ) { 10933 if ( /\S/.test($split.text()) ) { 10934 startSplit = true; 10935 $line_wrap = $split.closest('.heading-line-wrap'); 10936 splitArray.push( $split ); 10937 } else { 10938 indexRtx++; 10939 } 10940 } 10941 10942 $line_wrap = $new_line_wrap; 10943 }); 10944 10945 $toMove = $($.map(splitToMove, function(el){return el.get();})); 10946 $trgt = $($.map(splitArray, function(el){return el.get();})); 10947 10948 if ( same_line ) { 10949 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 10950 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 10951 } 10952 10953 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 10954 $prev.addClass('empty-span-hidden'); 10955 } 10956 10957 $highl = $('.heading-text-highlight-inner', $trgt); 10958 10959 $rtx.attr('data-animated', 'true'); 10960 if ( cycle == 0 ) { 10961 $( document.body ).trigger('defer-highlights'); 10962 cycle++; 10963 defineObjs(); 10964 return; 10965 } 10966 cycle++; 10967 10968 txt = $rtx.attr('data-text'); 10969 arrTxt = txt.split("|"); 10970 10971 textFadeOut($trgt); 10972 10973 }); 10974 }; 10975 10976 removeWraps = function(){ 10977 10978 // if ( debug == 1 ) return; 10979 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 10980 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 10981 10982 10983 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 10984 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 10985 10986 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 10987 10988 $splitFlow.each(function(){ 10989 $(this).append($temp_highl); 10990 }); 10991 10992 var $line_wrap = $wraps[wrap_k]; 10993 var $parent_wrap = $line_wrap.parentNode; 10994 if ( $parent_wrap !== null ) { 10995 while ( $line_wrap.firstChild ) { 10996 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 10997 } 10998 $parent_wrap.removeChild($line_wrap); 10999 } 11000 } 11001 // debug++; 11002 defineObjs(); 11003 }; 11004 11005 var loop = 0; 11006 textFadeIn = function($trgt){ 11007 var word = arrTxt[loop].split(" "), 11008 worsSpan = '', 11009 $wrap = $trgt.closest('.uncode-rotating-wrap'), 11010 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 11011 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 11012 11013 for (var w = 0; w < word.length; w++) { 11014 var highl; 11015 if ( $highl.length ) { 11016 highl = $highl[0].outerHTML; 11017 } else { 11018 highl = ''; 11019 } 11020 11021 if ( w > 0 ) { 11022 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 11023 } 11024 var charachters = word[w].split(''); 11025 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 11026 if ( ! SiteParameters.uncode_has_ligatures ) { 11027 for (var c = 0; c < charachters.length; c++) { 11028 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 11029 } 11030 } else { 11031 worsSpan += word[w]; 11032 } 11033 worsSpan += '</span>' + highl + '</span></span>'; 11034 } 11035 11036 if ( $wrap.length && $wrap_inner.length ) { 11037 var words_w = $wrap_inner.outerWidth(); 11038 $wrap.css({ 11039 width: words_w 11040 }); 11041 11042 $highl = $('.heading-text-highlight-inner', $wrap); 11043 $highl.prependTo($wrap); 11044 11045 $wrap_inner.css({ 11046 opacity: 0 11047 }); 11048 11049 $wrap_inner.html(worsSpan); 11050 $('.heading-text-highlight-inner', $wrap_inner).remove(); 11051 words_w = $wrap_inner.innerWidth(); 11052 11053 var duration = 0.45; 11054 11055 $heading.removeClass('auto-width'); 11056 if ( words_w > $col.width() ) { 11057 $heading.addClass('auto-width'); 11058 words_w = 'auto'; 11059 duration = 0; 11060 } 11061 11062 $wrap.css({ 11063 'width': words_w, 11064 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 11065 }); 11066 11067 var $word_inner = $('.split-word-inner', $wrap_inner), 11068 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 11069 11070 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11071 11072 if ( !$target_fx.length ) { 11073 return; 11074 } 11075 11076 gsap.killTweensOf($target_fx); 11077 11078 if ( fx !== 'zoom' ) { 11079 gsap.fromTo( $target_fx, { 11080 y: fx === 'opacity' ? '0%' : '-10%' 11081 },{ 11082 delay: duration, 11083 duration: 0.25, 11084 y: '0%', 11085 ease: Circ.easeOut, 11086 }); 11087 11088 if ( !$wrap_inner.length ) { 11089 return; 11090 } 11091 11092 gsap.fromTo( $wrap_inner, { 11093 opacity: 0, 11094 },{ 11095 delay: duration, 11096 duration: 0.25, 11097 opacity: 1, 11098 ease: Circ.easeOut, 11099 onComplete: function(){ 11100 $('> .heading-text-highlight-inner', $wrap).remove(); 11101 $wrap_inner.html(worsSpan); 11102 removeWraps(); 11103 } 11104 }) 11105 11106 } else { 11107 gsap.fromTo( $target_fx, { 11108 transformOrigin: '50%', 11109 opacity: 0, 11110 scale: 0.875, 11111 },{ 11112 opacity: 1, 11113 delay: duration, 11114 duration: 0.25, 11115 scale: 1, 11116 ease: Circ.easeOut, 11117 onComplete: function(){ 11118 $('> .heading-text-highlight-inner', $wrap).remove(); 11119 $wrap_inner.html(worsSpan); 11120 removeWraps(); 11121 } 11122 }); 11123 } 11124 11125 } else { 11126 11127 if ( !$wrap_inner.length ) { 11128 return; 11129 } 11130 11131 gsap.to( $wrap_inner, { 11132 duration: 0.4, 11133 opacity: 0, 11134 ease: Power1.easeOut, 11135 onComplete: function(){ 11136 $wrap_inner.html(worsSpan); 11137 words_w = $wrap_inner.innerWidth(); 11138 11139 gsap.to( $wrap_inner, { 11140 duration: 0.2, 11141 opacity: 1, 11142 ease: Power1.easeOut, 11143 onComplete: function(){ 11144 $('> .heading-text-highlight-inner', $wrap).remove(); 11145 $wrap_inner.html(worsSpan); 11146 removeWraps(); 11147 } 11148 }) 11149 } 11150 }); 11151 } 11152 11153 if ( loop < arrTxt.length-1 ) { 11154 loop++; 11155 } else { 11156 loop = 0; 11157 } 11158 11159 }; 11160 11161 textFadeOut = function($trgt){ 11162 var $word_inner = $('.split-word-inner', $trgt), 11163 $wrap = $trgt.closest('.uncode-rotating-wrap'), 11164 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 11165 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 11166 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 11167 11168 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 11169 11170 var gsap_param = { 11171 delay: wait, 11172 duration: 0.25, 11173 y: fx === '' ? '10%' : '0%', 11174 opacity: 0, 11175 ease: Circ.easeOut, 11176 onStart: function(){ 11177 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 11178 $highl = $('.heading-text-highlight-inner', $wrap); 11179 $highl.prependTo($wrap); 11180 } 11181 }, 11182 onComplete: textFadeIn, 11183 onCompleteParams: [$trgt] 11184 }; 11185 11186 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 11187 11188 if ( fx === '' ) { 11189 gsap_param.y = '10%'; 11190 } else if ( fx === 'zoom' ) { 11191 gsap_param.scale = '1.045'; 11192 } 11193 11194 if ( !$target_fx.length ) { 11195 return; 11196 } 11197 11198 if ( $heading.data('waypoint') !== true ) { 11199 var textInView = new Waypoint.Inview({ 11200 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 11201 element: $heading[0], 11202 enter: function(direction) { 11203 $heading.data('waypoint',true); 11204 gsap.fromTo( $target_fx, { 11205 transformOrigin: '50%' 11206 }, gsap_param ); 11207 } 11208 }); 11209 } else { 11210 gsap.fromTo( $target_fx, { 11211 transformOrigin: '50%' 11212 }, gsap_param ); 11213 } 11214 }; 11215 11216 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 11217 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 11218 var $el = model.view.$el, 11219 shortcode = model.attributes.shortcode; 11220 11221 UNCODE.rotatingTxt($el); 11222 }); 11223 } else { 11224 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 11225 $heading.on('already-animated', function(){ 11226 removeWraps(); 11227 window.addEventListener('removeOldLines', function(){ 11228 clearRequestTimeout(setCTA); 11229 setCTA = requestTimeout( removeWraps, 150 ); 11230 }); 11231 }); 11232 } else { 11233 $(window).on('load', function(){ 11234 removeWraps(); 11235 window.addEventListener('removeOldLines', function(){ 11236 clearRequestTimeout(setCTA); 11237 setCTA = requestTimeout( removeWraps, 150 ); 11238 }); 11239 }); 11240 } 11241 } 11242 }); 11243 11244}; 11245 11246UNCODE.verticalText = function() { 11247 $(window).on('menuCanvasOpen', function(){ 11248 $('.vertical-text--fixed').fadeOut(500); 11249 $('.horizontal-text--fixed').fadeOut(500); 11250 }).on('menuCanvasClose', function(){ 11251 $('.vertical-text--fixed').fadeIn(500); 11252 $('.horizontal-text--fixed').fadeIn(500); 11253 }); 11254 11255 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 11256 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 11257 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 11258 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 11259 11260 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 11261 window.addEventListener('scroll', function(e) { 11262 var totalPageHeight = document.body.scrollHeight; 11263 var scrollPoint = window.scrollY + window.innerHeight; 11264 11265 if (window.scrollY > 0) { 11266 showOnTopVerticalTexts.fadeOut(); 11267 showOnTopHorizontalTexts.fadeOut(); 11268 } else { 11269 showOnTopVerticalTexts.fadeIn(); 11270 showOnTopHorizontalTexts.fadeIn(); 11271 } 11272 11273 if (scrollPoint >= totalPageHeight) { 11274 hideOnBottomVerticalTexts.fadeOut(); 11275 hideOnBottomHorizontalTexts.fadeOut(); 11276 } else { 11277 hideOnBottomVerticalTexts.fadeIn(); 11278 hideOnBottomHorizontalTexts.fadeIn(); 11279 } 11280 }, false); 11281 } 11282}; 11283 11284UNCODE.stickyScroll = function( $el ) { 11285 if ( typeof $el === 'undefined' || $el === null ) { 11286 $el = $('body'); 11287 } 11288 var checkVisible = function( el, dir ) { 11289 if (typeof jQuery === "function" && el instanceof jQuery) { 11290 el = el[0]; 11291 } 11292 11293 var off = 50; 11294 dir = typeof dir=='undefined' ? 'right' : dir; 11295 var rect = el.getBoundingClientRect(); 11296 11297 return ( 11298 ( 11299 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11300 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 11301 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 11302 ) && 11303 ( 11304 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 11305 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 11306 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 11307 ( rect.right <= window.innerWidth && rect.left >= 0 ) 11308 ) 11309 ); 11310 }; 11311 11312 var setItemsRelHeight = function(reset) { 11313 var $_el = $el; 11314 if ( $el.is('.index-scroll') ) { 11315 var $_el = $el.closest('.uncont'); 11316 } 11317 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 11318 $.each($('.tmb', item), function(index, val) { 11319 if ( reset === true ) { 11320 $(val).css( 'visibility', 'hidden' ); 11321 } else { 11322 $(val).css( 'visibility', 'visible' ); 11323 } 11324 }); 11325 }); 11326 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 11327 $.each($('.tmb', item), function(index, val) { 11328 if ( reset === true ) { 11329 $(val).css( 'visibility', 'hidden' ); 11330 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 11331 } else { 11332 var $rowParent = $(item).closest('.row-parent'), 11333 rowRatio = $rowParent.attr('data-height-ratio'), 11334 $rowInner = $(item).closest('.row-child'), 11335 rowRatioInner = $rowInner.attr('data-height'), 11336 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11337 $colContainer = $(item).closest('.uncell'), 11338 $uncont = $(item).closest('.uncont'), 11339 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 11340 safe_heigth = $(item).data('safe-height'), 11341 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 11342 offSet = $(item).offset().top - $uncont.offset().top, 11343 multiplier_h, 11344 data_viewport_h, 11345 body_border = $('.body-borders .top-border').outerHeight() * 2, 11346 remove_menu = $(item).data('vp-menu'); 11347 11348 if ( rowRatio === 'full' || rowRatio === '' ) { 11349 rowRatio = 1; 11350 } else { 11351 rowRatio = rowRatio / 100; 11352 } 11353 11354 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 11355 rowRatio = rowRatio; 11356 } else { 11357 rowRatio = rowRatio * rowRatioInner / 100; 11358 } 11359 11360 winHeight = winHeight * rowRatio; 11361 11362 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 11363 multiplier_h = parseInt($(item).attr('data-vp-height')); 11364 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 11365 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 11366 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 11367 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 11368 } 11369 11370 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 11371 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 11372 if ( remove_menu === true ) { 11373 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 11374 } 11375 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 11376 } else { 11377 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 11378 } 11379 11380 } 11381 }); 11382 }); 11383 $('.index-scroll', $_el).each(function(i, item){ 11384 var $uncoltable = $(item).closest('.uncoltable'), 11385 $rowParent = $(item).closest('.row-parent'), 11386 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 11387 body_border = $('.body-borders .top-border').outerHeight() * 2, 11388 $index_row = $('.index-row', item), 11389 safe_heigth = $index_row.data('safe-height'), 11390 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 11391 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 11392 var data_viewport_h = winHeight - ( paddingRow + body_border ); 11393 $uncoltable.css({ 11394 'min-height': data_viewport_h 11395 }); 11396 } else { 11397 $uncoltable.css({ 11398 'min-height': 'auto' 11399 }); 11400 } 11401 }); 11402 11403 } 11404 setItemsRelHeight(); 11405 11406 var $index_scrolls = $('.index-scroll', $el); 11407
11408 $index_scrolls.each(function(key, value){ 11409 var $index = $(this), 11410 $parent_row = $index.closest('.vc_row[data-parent]'), 11411 $index_row = $('.index-row', $index), 11412 dir = $index_row.attr('data-direction'); 11413 dir = typeof dir === 'undefined' ? 'right' : dir; 11414 11415 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 11416 }); 11417 11418 var $horScrolls = $('.unscroll-horizontal', $el); 11419 11420 if ( $horScrolls.length ) { 11421 11422 $('body').addClass('scrolling-trigger'); 11423 11424 $horScrolls.each(function(key, value){ 11425 var $section = $(this), 11426 $index_scroll = $('.index-scroll', $section), 11427 $index_row = $('.index-row', $index_scroll), 11428 dir = $section.attr('data-direction'), 11429 wrap = $index_row.attr('data-wrap'), 11430 $pinWrap, 11431 $pinTrigger; 11432 11433 dir = typeof dir === 'undefined' ? 'right' : dir; 11434 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 11435 $pinWrap = $('<div class="pin-wrap" />'); 11436 if ( SiteParameters.is_frontend_editor ) { 11437 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 11438 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 11439 } else { 11440 if ( wrap === 'column' ) { 11441 $index_scroll.wrapInner( $pinWrap ); 11442 } else { 11443 $('> .row', $section).wrap( $pinWrap ); 11444 } 11445 $section.wrapInner( $pinTrigger ); 11446 } 11447 11448 }); 11449 11450 var $pinWraps = $('.pin-wrap', $el); 11451 11452 var horScrollSizes = function(){ 11453 11454 $pinWraps.each(function(key, val){ 11455 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 11456 $pinTrigger = $pinWrap.closest('.pin-trigger'), 11457 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 11458 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 11459 $boxContainer = $('.box-container'), 11460 box_m = $boxContainer.css('margin-left'), 11461 st_active = true; 11462 11463 var setHorW, 11464 horWidth = function(){ 11465 $index_scroll.each(function(){ 11466 var $this = $(this), 11467 $index_row = $('.index-row', $this), 11468 $rowContainer = $index_row.closest('.vc_row'), 11469 $rowInner = $index_row.closest('.wpb_row'), 11470 $rowParent = $index_row.closest('.row-parent'), 11471 $tmbs = $('.tmb', $index_row), 11472 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 11473 $uncont = $index_row.closest('.uncont'), 11474 $parent_col = $index_row.closest('.wpb_column'), 11475 col_w = $uncont.width(), 11476 data_lg = parseFloat( $index_row.attr('data-lg') ), 11477 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 11478 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 11479 tmb_w; 11480 11481 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 11482 tmb_w = ( col_w + padding_tmb ) / data_lg; 11483 11484 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 11485 tmb_w = ( col_w + padding_tmb ) / data_sm; 11486 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 11487 tmb_w = ( col_w + padding_tmb ) / data_md; 11488 } 11489 11490 if ( !isNaN(tmb_w) ) { 11491 $tmbs.css({ 11492 'width': tmb_w 11493 }); 11494 } 11495 11496 $tmbs.css({ 11497 'visibility': 'visible' 11498 }); 11499 11500 }); 11501 }; 11502 11503 horWidth(); 11504 clearRequestTimeout(setHorW); 11505 setHorW = requestTimeout( function(){ 11506 setItemsRelHeight(); 11507 horWidth(); 11508 }, 100 ); 11509 11510 if ( SiteParameters.is_frontend_editor ) { 11511 return; 11512 } 11513 11514 var $vmenu = $('body.vmenu .vmenu-container'), 11515 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 11516 winWidth = window.innerWidth - vmenuW, 11517 $tmb = $('.tmb', $index_scroll).eq(0), 11518 paddingRight = parseFloat( $tmb.css('padding-right') ), 11519 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 11520 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 11521 scroll_anim; 11522 11523 if ( $('body').hasClass('rtl') ) { 11524 if ( dir === 'left' ) { 11525 scroll_anim = gsap.fromTo( $pinWrap, { 11526 x: stickyScrollLength 11527 },{ 11528 x: 0, 11529 ease: "none" 11530 }); 11531 } else { 11532 scroll_anim = gsap.fromTo( $pinWrap, { 11533 x: 0 11534 },{ 11535 x: stickyScrollLength, 11536 ease: "none" 11537 }); 11538 } 11539 } else { 11540 if ( dir === 'left' ) { 11541 scroll_anim = gsap.fromTo( $pinWrap, { 11542 x: -stickyScrollLength 11543 },{ 11544 x: 0, 11545 ease: "none" 11546 }); 11547 } else { 11548 scroll_anim = gsap.fromTo( $pinWrap, { 11549 x: 0 11550 },{ 11551 x: -stickyScrollLength, 11552 ease: "none" 11553 }); 11554 } 11555 } 11556 11557 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 11558 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 11559 } 11560 11561 var animationIncrease; 11562 11563 var checkForAnimations = function(){ 11564 animationIncrease = 0 11565 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11566 var _this = this; 11567 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 11568 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11569 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11570 requestTimeout(function() { 11571 $(_this).addClass('start_animation'); 11572 }, delayAttr + animationIncrease); 11573 animationIncrease += 150; 11574 } 11575 }); 11576 11577 var batchTime = 0; 11578 11579 var resetBatch = function(){ 11580 batchTime = 0; 11581 } 11582 11583 if (ScrollTrigger.isScrolling()) { 11584 resetBatch(); 11585 } 11586 11587 $('.tmb-mask-reveal', $pinTrigger).each(function(){ 11588 var _this = this, 11589 $this = $(_this), 11590 $inside = $('.t-inside', $this),
11591 delay = parseFloat( $inside.attr('data-delay') ), 11592 speed = parseFloat( $inside.attr('data-speed') ), 11593 easing = $inside.attr('data-easing'), 11594 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 11595 11596 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 11597 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 11598 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 11599 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 11600 11601 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.1, true) && !$this.hasClass('tmb-mask-init') ) { 11602 $this.addClass('tmb-mask-init'); 11603 if ( $this.hasClass('tmb-has-hex') && bgDelay !== '' ) { 11604 gsap.to($('.t-entry-visual-tc', $this), speed, { 11605 clipPath: 'inset(0% 0% 0% 0%)', 11606 delay: delay + batchTime, 11607 ease: easing, 11608 }); 11609 gsap.to($('.t-entry-visual-cont', $this), speed, { 11610 clipPath: 'inset(0% 0% 0% 0%)', 11611 scale: 1, 11612 delay: delay + batchTime + (speed*bgDelay), 11613 ease: easing, 11614 onComplete: resetBatch, 11615 }); 11616 } else { 11617 gsap.to($('.t-entry-visual-cont', $this), speed, { 11618 clipPath: 'inset(0% 0% 0% 0%)', 11619 scale: 1, 11620 delay: delay + batchTime, 11621 ease: easing, 11622 onComplete: resetBatch, 11623 }); 11624 } 11625 batchTime += 0.1; 11626 } 11627 }); 11628 11629 }; 11630 checkForAnimations(); 11631 11632 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 11633 var start = 0; 11634 11635 var horST = ScrollTrigger.create({ 11636 id: "stickySectionScrolling" + key, 11637 scrub: true, 11638 trigger: $pinTrigger[0], 11639 pin: true, 11640 anticipatePin: 1, 11641 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 11642 end: function() { return "+="+stickyScrollLength; }, 11643 animation: scroll_anim, 11644 ease: Sine.easeOut, 11645 onUpdate: checkForAnimations, 11646 invalidateOnRefresh: true, 11647 onEnter: function(){ 11648 $pinTrigger.addClass('enter-st'); 11649 }, 11650 onEnterBack: function(){ 11651 $pinTrigger.addClass('enter-st'); 11652 }, 11653 onLeave: function(){ 11654 $pinTrigger.removeClass('enter-st'); 11655 }, 11656 onLeaveBack: function(){ 11657 $pinTrigger.removeClass('enter-st'); 11658 } 11659 }); 11660 11661 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 11662 window.dispatchEvent(new CustomEvent('boxResized')); 11663 11664 var testSecondTrigger = function(){ 11665 animationIncrease = 0 11666 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 11667 var _this = this; 11668 if ( checkVisible(_this) ) { 11669 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 11670 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 11671 requestTimeout(function() { 11672 $(_this).addClass('start_animation'); 11673 }, delayAttr + animationIncrease); 11674 animationIncrease += 150; 11675 } 11676 }); 11677 11678 }; 11679 11680 var verST = ScrollTrigger.create({ 11681 id: "verticalSectionScrolling" + key, 11682 trigger: $pinTrigger[0], 11683 start: "top center", 11684 end: function() { return "+="+UNCODE.wheight; }, 11685 onUpdate: testSecondTrigger, 11686 invalidateOnRefresh: true 11687 }); 11688 11689 var setCTA, 11690 11691 dis_enable_ST = function(){ 11692 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 11693 horST.kill(); 11694 verST.kill(); 11695 $pinTrigger.addClass('disabled'); 11696 st_active = false; 11697 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 11698 horST.kill(); 11699 verST.kill(); 11700 $pinTrigger.addClass('disabled'); 11701 st_active = false; 11702 } 11703 }; 11704 11705 $(window).on('resize load', function() { 11706 clearRequestTimeout(setCTA); 11707 setCTA = requestTimeout(function() { 11708 dis_enable_ST(); 11709 checkForAnimations(); 11710 }, 500); 11711 }); 11712 11713 }); 11714 }; 11715 11716 $(window).on( 'load', function(){ 11717 horScrollSizes(); 11718 }); 11719 var setResize, 11720 setReLayout, 11721 doubleResize = true; 11722 $(window).on( 'load', function(){ 11723 if ( $('.body-borders .top-border').outerHeight() > 0 ) { 11724 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11725 Array.prototype.forEach.call($row_inners, function(el) { 11726 el.style.height = ''; 11727 el.style.marginBottom = ''; 11728 }); 11729 setItemsRelHeight(); 11730 horScrollSizes(); 11731 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11732 $(document).trigger('uncode-scrolltrigger-refresh'); 11733 } 11734 } 11735 var carousel = document.querySelector(".owl-carousel"), 11736 grid = document.querySelector(".isotope-container"), 11737 stickyAll = document.querySelectorAll(".index-scroll"); 11738 11739 if ( stickyAll.length ) { 11740 var sticky = stickyAll[(stickyAll.length-1)]; 11741 } 11742 11743 if ( typeof sticky !== "undefined" ) { 11744 11745 if ( typeof carousel !== "undefined" && carousel !== null ) { 11746 var carousel_position = sticky.compareDocumentPosition(carousel); 11747 } 11748 if ( typeof grid !== "undefined" && grid !== null ) { 11749 var grid_position = sticky.compareDocumentPosition(grid); 11750 } 11751 11752 if ( carousel_position === 2 || grid_position === 2 ) { 11753 setTimeout(function(){ 11754 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11755 $(document).trigger('uncode-scrolltrigger-refresh'); 11756 } 11757 }, 500); 11758 } 11759 11760 } 11761 11762 }); 11763 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11764 android = /Android/.test(navigator.userAgent) && !window.MSStream; 11765 $(window).on( 'resize orientationchange', function(e){ 11766 if ( e.type === 'resize' && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11767 return; 11768 } 11769 setItemsRelHeight(true); 11770 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 11771 Array.prototype.forEach.call($row_inners, function(el) { 11772 el.style.height = ''; 11773 el.style.marginBottom = ''; 11774 }); 11775 clearRequestTimeout(setResize); 11776 setResize = requestTimeout( function(){ 11777 setItemsRelHeight(); 11778 horScrollSizes(); 11779 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11780 $(document).trigger('uncode-scrolltrigger-refresh'); 11781 } 11782 if ( doubleResize === true ) { 11783 window.dispatchEvent(new Event('resize')); 11784 doubleResize = false;
11785 } else { 11786 doubleResize = true; 11787 } 11788 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 11789 }, 100 ); 11790 }); 11791 11792 var show_pins = function(){ 11793 $('.index-scroll').css({'opacity':'1'}); 11794 }; 11795 ScrollTrigger.addEventListener("refresh", show_pins); 11796 $(window).on( 'uncode.re-layout', function(){ 11797 //$('.index-scroll').css({'opacity':'0'}); 11798 $('.pin-spacer').each(function(){ 11799 var space_h = $(this).outerHeight(), 11800 $row = $(this).closest('.row-container'); 11801 $row.css({ 11802 'height': space_h, 11803 'overflow': 'hidden' 11804 }); 11805 }); 11806 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 11807 ScrollTrigger.refresh(true); 11808 } 11809 clearRequestTimeout(setReLayout); 11810 setReLayout = requestTimeout( function(){ 11811 $('.row-container').each(function(){ 11812 $(this).css({ 11813 'height': '', 11814 'overflow': '' 11815 }); 11816 }); 11817 }, 1000); 11818 }); 11819 } 11820 11821}; 11822 11823UNCODE.stickyTrigger = function( $el ) { 11824 if ( SiteParameters.is_frontend_editor ) { 11825 return false; 11826 } 11827 11828 var stickyTrigger = function(){ 11829 var stickyTrick = $('.sticky-trigger').each(function(){ 11830 var $sticky = $(this), 11831 $inside = $('> div', $sticky), 11832 insideH = $inside.outerHeight(), 11833 $row = $sticky.closest('.vc_row'), 11834 $uncont = $sticky.closest('.uncont'), 11835 rowBottom, 11836 uncontBottom, 11837 diffBottom; 11838 11839 ScrollTrigger.create({ 11840 trigger: $sticky, 11841 start: function(){ return "top center-=" + insideH/2; }, 11842 endTrigger: $row, 11843 end: function(){ 11844 rowBottom = $row.offset().top + $row.outerHeight(); 11845 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 11846 diffBottom = rowBottom - uncontBottom; 11847 return "bottom center+=" + ( insideH/2 + diffBottom ); 11848 }, 11849 anticipatePin: true, 11850 pin: true, 11851 pinSpacing: false, 11852 scrub: true, 11853 invalidateOnRefresh: true, 11854 }); 11855 11856 }); 11857 }, 11858 setResizeSticky; 11859 11860 $(window).on( 'load', function(){ 11861 stickyTrigger(); 11862 var carousel = document.querySelector(".owl-carousel"), 11863 grid = document.querySelector(".isotope-container"), 11864 stickyAll = document.querySelectorAll(".sticky-trigger"); 11865 11866 if ( stickyAll.length ) { 11867 var sticky = stickyAll[(stickyAll.length-1)]; 11868 } 11869 11870 if ( typeof sticky !== "undefined" ) { 11871 11872 if ( typeof carousel !== "undefined" && carousel !== null ) { 11873 var carousel_position = sticky.compareDocumentPosition(carousel); 11874 } 11875 if ( typeof grid !== "undefined" && grid !== null ) { 11876 var grid_position = sticky.compareDocumentPosition(grid); 11877 } 11878 11879 if ( carousel_position === 2 || grid_position === 2 ) { 11880 setTimeout(function(){ 11881 $(document).trigger('uncode-scrolltrigger-refresh'); 11882 }, 500); 11883 } 11884 11885 } 11886 }); 11887 11888 var oldW = UNCODE.wwidth; 11889 $(window).on( 'resize uncode.re-layout', function(e){ 11890 clearRequestTimeout(setResizeSticky); 11891 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 11892 return; 11893 } else { 11894 oldW = UNCODE.wwidth; 11895 } 11896 setResizeSticky = requestTimeout( function(){ 11897 stickyTrigger(); 11898 $(document).trigger('uncode-scrolltrigger-refresh'); 11899 }, 1000 ); 11900 }); 11901 11902 11903}; 11904 11905UNCODE.areaTextReveal = function() { 11906 if ( ! $('.text-reveal, .scroll-trigger-el').length ) { 11907 return; 11908 } 11909 if ( ! SiteParameters.is_frontend_editor ) { 11910 var iPhone = /iPhone/.test(navigator.userAgent) && !window.MSStream, 11911 android = /Android/.test(navigator.userAgent) && !window.MSStream, 11912 prevW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11913 prevH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11914 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11915 firstObs = true, 11916 isMobileUsing = false;
11917 11918 var observer = new ResizeObserver(function(){ 11919 var newW = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ), 11920 newH = Math.max( document.body.scrollHeight, document.body.offsetHeight, 11921 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), 11922 set = false; 11923 if ( prevW !== newW && ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) ) { 11924 set = true; 11925 prevW = newW; 11926 } else if ( prevH !== newH && !iPhone && !(android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11927 set = true; 11928 prevH = newH; 11929 } 11930 if ( set || firstObs ) { 11931 window.dispatchEvent(new CustomEvent('uncode-sticky-trigger-observe')); 11932 firstObs = false; 11933 } 11934 }).observe(document.body); 11935 11936 if ( iPhone || (android && Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) < 750) ) { 11937 window.scrollTo = function() { 11938 return; 11939 }; 11940 isMobileUsing = true; 11941 11942 $('html, body').css({ 11943 'overscroll-behavior': 'none' 11944 }); 11945 } 11946 11947 var setTriggerObserve; 11948 11949 ScrollTrigger.observe({ 11950 trigger: 'body', 11951 type: "touch,pointer", // comma-delimited list of what to listen for ("wheel,touch,scroll,pointer")
11952 onUp: function() { ScrollTrigger.update(); }, 11953 }); 11954 } 11955 11956 var textReveal = function(){ 11957 11958 if ( SiteParameters.is_frontend_editor ) { 11959 return; 11960 } 11961 11962 var setTxtReveal, 11963 txtTrggrStart = false; 11964 11965 function headingReveal($sel){ 11966 txtTrggrStart = true; 11967 $('.text-reveal', $sel).each(function(val, key){ 11968 var $txtReveal = $(this).attr('data-init-reveal', true), 11969 $trigger = $txtReveal, 11970 $rowParent = $txtReveal.closest('.row-container[data-parent]'), 11971 hReveal = $txtReveal.outerHeight(), 11972 $pin = $txtReveal.closest('.scroll-trigger-el[data-anim-sticky="yes"], .scroll-trigger-el[data-sticky-trigger="inner-rows"]'), 11973 $sticky = $txtReveal.closest('.sticky-element'), 11974 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 11975 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 11976 dataTop = parseFloat($('[data-reveal-top]', $txtReveal).attr('data-reveal-top')), 11977 $lines = $('.heading-line-wrap', $txtReveal), 11978 $words = $('.split-word-inner', $txtReveal), 11979 $chars = $('.split-char', $txtReveal), 11980 $elToReveal = $words; 11981 11982 if ( $pin.length ) { 11983 return; 11984 } else if ( $sticky.length ) { 11985 hReveal = $sticky.parent().outerHeight() - (window.innerHeight - window.innerHeight/100*dataTop); 11986 $trigger = $sticky.parent(); 11987 } 11988 11989 if ( dataReveal === 'chars' ) { 11990 $elToReveal = $chars; 11991 } else if ( dataReveal === 'lines' ) { 11992 $elToReveal = $lines; 11993 } 11994 11995 var tl = gsap.timeline({ 11996 scrollTrigger: { 11997 trigger: $trigger, 11998 start: "top +=" + (window.innerHeight/100*dataTop) + "px", 11999 end: "+=" + hReveal + "px", 12000 id: "txt_reveal_" + key, 12001 scrub: true, 12002 } 12003 }); 12004 gsap.set( 12005 $elToReveal, { 12006 opacity: dataRevealOpacity, 12007 } 12008 ) 12009 tl.fromTo($elToReveal, { 12010 opacity: dataRevealOpacity, 12011 duration: 1, 12012 }, { 12013 opacity: 1, 12014 stagger: 0.05, 12015 duration: 1, 12016 12017 }); 12018 $(window).on('uncode.tl-refresh', function(){ 12019 if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) { 12020 tl.scrollTrigger.refresh(); 12021 } 12022 }); 12023 12024 $rowParent.one( 'uncodeWordLines', function(){ 12025 clearRequestTimeout(setTxtReveal); 12026 setTxtReveal = requestTimeout( function(){ 12027 gsap.set($elToReveal, {clearProps: true}); 12028 tl.kill(true); 12029 if ( typeof ScrollTrigger.getById('txt_reveal_' + key) !== 'undefined' ) { 12030 ScrollTrigger.getById("txt_reveal_" + key).kill(true); 12031 } 12032 headingReveal($sel) 12033 }, 100); 12034 }); 12035 12036 }); 12037 }; 12038 12039 window.addEventListener("load", function (e) { 12040 if (!txtTrggrStart) { 12041 headingReveal($("body")); 12042 $(window).trigger("resize"); 12043 } 12044 }); 12045 12046 $('.row-container[data-parent]').each(function(){ 12047 if (!txtTrggrStart) { 12048 var $this = $(this); 12049 $this.on('uncodeWordLines', function(){ 12050 headingReveal($this); 12051 }); 12052 } 12053 }); 12054 12055 $(window).on('uncode-sticky-trigger-observe', function(e){ 12056 clearRequestTimeout(setTriggerObserve); 12057 setTriggerObserve = requestTimeout( function(){ 12058 $(window).trigger('uncode.tl-refresh'); 12059 }, 2000 ); 12060 }); 12061 12062 }; 12063 textReveal(); 12064 12065 var areaReveal = function(){ 12066 if ( SiteParameters.is_frontend_editor ) { 12067 return; 12068 } 12069
12070 $('.scroll-trigger-el').each(function(){ 12071 var $scrollTrgrEl = $(this), 12072 $row = $('> .row', $scrollTrgrEl), 12073 $row_in = $('> .row-inner', $row), 12074 cardL = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).length, 12075 stickyCards = cardL && $scrollTrgrEl.attr('data-sticky-trigger') === 'inner-rows', 12076 animLast = $scrollTrgrEl.attr('data-no-anim-last') !== 'yes', 12077 stickyOpts = stickyCards ? $scrollTrgrEl.attr('data-anim-inner-rows-options') : false, 12078 $animateTrgrEl = $scrollTrgrEl, 12079 noMobile = $scrollTrgrEl.attr('data-sticky-no-mobile') === 'yes', 12080 noTablet = $scrollTrgrEl.attr('data-sticky-no-tablet'), 12081 els = $scrollTrgrEl.attr('data-anim-els'), 12082 sticky = $scrollTrgrEl.attr('data-anim-sticky'), 12083 noSpace = $scrollTrgrEl.attr('data-anim-no-space'), 12084 state = $scrollTrgrEl.attr('data-anim-state'), 12085 target = $scrollTrgrEl.attr('data-anim-target'), 12086 origin = $scrollTrgrEl.attr('data-anim-origin'), 12087 mask = $scrollTrgrEl.attr('data-anim-mask'), 12088 _scale = $scrollTrgrEl.attr('data-anim-scale'), 12089 stepScale = stickyCards && $scrollTrgrEl.attr('data-anim-scale-step') === 'yes', 12090 opacity = $scrollTrgrEl.attr('data-anim-opacity'), 12091 radius = $scrollTrgrEl.attr('data-anim-radius'), 12092 radius_unit = $scrollTrgrEl.attr('data-anim-radius-unit'), 12093 clip_path = $scrollTrgrEl.attr('data-clip-path'), 12094 animation_x = $scrollTrgrEl.attr('data-anim-x'), 12095 animation_x_alt = $scrollTrgrEl.attr('data-anim-x-alt'), 12096 animation_y = $scrollTrgrEl.attr('data-anim-y'), 12097 blur = $scrollTrgrEl.attr('data-anim-blur'), 12098 perspective = $scrollTrgrEl.attr('data-anim-perspective'), 12099 rotate = $scrollTrgrEl.attr('data-anim-rotate'), 12100 rotate_alt = $scrollTrgrEl.attr('data-anim-rotate-alt'), 12101 topBottom = $scrollTrgrEl.attr('data-anim-start'), 12102 offTop = $scrollTrgrEl.attr('data-anim-top'), 12103 offBottom = $scrollTrgrEl.attr('data-anim-bottom'), 12104 safe = $scrollTrgrEl.attr('data-anim-safe') === 'yes' ? (window.innerHeight/100*(100-offTop)) : 0, 12105 animation_rows_start = $scrollTrgrEl.attr('data-anim-start-point'), 12106 easeOut = $scrollTrgrEl.attr('data-anim-ease'), 12107 offSetCard = $scrollTrgrEl.attr('data-anim-rows-offset'), 12108 stickyLast = $scrollTrgrEl.attr('data-anim-sticky-last') === 'yes' && stickyCards, 12109 $lastEl = $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).last(), 12110 setTxtReveal, 12111 txtTrggrStart = false, 12112 alreadyareaAnimateScrollTl = false; 12113 12114 _scale = _scale === '' ? 0 : parseFloat( _scale ); 12115 perspective = perspective === '' ? 0.001 : parseFloat(perspective) + 0.001; 12116 offTop = offTop === '' ? 0 : parseFloat( offTop ); 12117 offBottom = offBottom === '' ? 0 : parseFloat( offBottom ); 12118 offSetCard = offSetCard === '' ? 0 : parseFloat( offSetCard ); 12119 12120 function areaAnimateScrollTl($el, id, last) { 12121 alreadyareaAnimateScrollTl = true; 12122 12123 var pTop = parseFloat( $row.css('padding-top') ), 12124 innerGap = pTop + offSetCard * id, 12125 scale = _scale; 12126 12127 if ( isMobileUsing ) { 12128 innerGap = 0; 12129 } 12130 12131 if ( stepScale ) { 12132 if ( _scale < 100 ) { 12133 scale = _scale + ( ( 100 - _scale ) / (cardL) * (id) ); 12134 } 12135 } 12136 12137 if ( els === 'content' ) { 12138 $animateTrgrEl = $('> .row', $scrollTrgrEl); 12139 } else if ( els === 'bg' ) { 12140 $animateTrgrEl = $('> .row-background, > .uncode-multi-bgs', $scrollTrgrEl); 12141 } else { 12142 $animateTrgrEl = $el; 12143 } 12144 12145 if ( rotate_alt === 'yes') { 12146 rotate *= -1; 12147 perspective *= -1; 12148 } 12149 12150 if ( animation_x_alt === 'yes') { 12151 animation_x *= -1; 12152 } 12153 12154 var $parentDiv = $el.closest('div[data-sticky]'); 12155 12156 var start_topBottom = topBottom === 'bottom' ? "bottom bottom-=" + (window.innerHeight/100*offTop) + "px" : "top top+=" + (window.innerHeight/100*offTop) + "px"; 12157 12158 var scrllTrggr = { 12159 trigger: $parentDiv, 12160 end: function(){ 12161 return ("+=" + (offBottom === 0 ? $scrollTrgrEl.outerHeight() - safe : (window.innerHeight/100*offBottom))) 12162 }, 12163 start: stickyCards ? "top top+=" + (innerGap) : start_topBottom,
12164 pin: sticky === 'yes' || stickyCards ? true : false, 12165 pinSpacing: ((noSpace !== "yes" && !stickyCards) || (state !== 'end' && last)) && !(stickyCards && state !== 'end' && !animLast && id === 0), 12166 scrub: true, 12167 id: 'sticky_' + id, 12168 anticipatePin: 1, 12169 invalidateOnRefresh: true, 12170 // markers: { 12171 // indent: 150 * id 12172 // }, 12173 onToggle: function(){ 12174 $scrollTrgrEl.attr('data-revealed', true); 12175 }, 12176 }; 12177 12178 if ( !stickyLast && state === 'end' ) { 12179 last = false; 12180 } 12181 12182 if ( stickyCards ) { 12183 if ( state !== 'end' ) { 12184 if ( animation_rows_start === 'center' ) { 12185 scrllTrggr.start = "center center"; 12186 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight); 12187 } else if ( animation_rows_start === 'bottom' ) { 12188 if ( stickyOpts !== 'no' ) { 12189 scrllTrggr.start = "bottom bottom"; 12190 scrllTrggr.end = "bottom bottom"; 12191 } 12192 } else { 12193 scrllTrggr.end = "bottom bottom-=" + (window.innerHeight/2); 12194 } 12195 if ( stickyOpts === 'no' ) { 12196 scrllTrggr.endTrigger = $el; 12197 scrllTrggr.end = "+=100%"; 12198 } else { 12199 scrllTrggr.endTrigger = $row; 12200 } 12201 } else { 12202 if ( animation_rows_start === 'center' ) { 12203 scrllTrggr.start = "center center"; 12204 } else if ( animation_rows_start === 'bottom' ) { 12205 scrllTrggr.start = "bottom bottom"; 12206 } 12207 if ( stickyOpts !== 'no' ) { 12208 scrllTrggr.end = "top top+=" + (pTop + offSetCard * (cardL-1)); 12209 scrllTrggr.endTrigger = $lastEl; 12210 } else { 12211 scrllTrggr.end = "bottom bottom"; 12212 } 12213 } 12214 } 12215 12216 var tl = gsap.timeline({ 12217 scrollTrigger: scrllTrggr 12218 }); 12219 12220 // var mark = last ? { 12221 // startColor:"blue", 12222 // endColor:"orange", 12223 // } : false; 12224 12225 if ( !stickyCards ) { 12226 var tlConds = tl; 12227 } else { 12228 var scrllTrggrConds = { 12229 trigger: $parentDiv, 12230 end: function(){ 12231 return ("+=" + (offBottom === 0 || stickyCards ? window.innerHeight - safe : (window.innerHeight/100*offBottom))) 12232 }, 12233 pin: (state === 'end' && last), 12234 pinSpacing: false, 12235 scrub: true, 12236 id: 'card_' + id, 12237 invalidateOnRefresh: true, 12238 // markers: true, 12239 }; 12240 if ( stickyCards ) { 12241 if ( state !== 'end' ) { 12242 if ( stickyOpts === '' ) { 12243 scrllTrggrConds.end = "bottom bottom-=100%"; 12244 scrllTrggrConds.endTrigger = $row_in; 12245 } 12246 12247 if ( animation_rows_start === 'bottom' ) { 12248 if ( stickyOpts !== 'no') { 12249 scrllTrggrConds.start = "top top+=" + window.innerHeight; 12250 scrllTrggrConds.end = "bottom bottom"; 12251 } 12252 } else if ( animation_rows_start === 'center' ) { 12253 scrllTrggrConds.start = "center center"; 12254 } else { 12255 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12256 } 12257 12258 } else { 12259 if ( stickyOpts === '' ) { 12260 if ( animLast ) { 12261 scrllTrggrConds.end = "bottom bottom-=100%"; 12262 } else { 12263 scrllTrggrConds.end = "bottom bottom"; 12264 } 12265 scrllTrggrConds.endTrigger = $lastEl; 12266 } 12267 12268 if ( animation_rows_start === 'bottom' && stickyOpts !== 'no' ) { 12269 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12270 scrllTrggrConds.start = "bottom bottom"; 12271 } else { 12272 scrllTrggrConds.start = "top top+=" + $el.outerHeight(); 12273 } 12274 } else if ( animation_rows_start === 'center' ) { 12275 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12276 scrllTrggrConds.start = "center center"; 12277 } else { 12278 scrllTrggrConds.start = "top+=" + ($el.outerHeight()/2) + " top+="
12278+ window.innerHeight/2; 12279 } 12280 } else { 12281 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 12282 scrllTrggrConds.start = "top top"; 12283 } else { 12284 scrllTrggrConds.start = "top top+=" + (innerGap + 1); 12285 } 12286 } 12287 12288 } 12289 12290 } else { 12291 scrllTrggrConds.start = start_topBottom; 12292 } 12293 12294 var tlConds = gsap.timeline({ 12295 scrollTrigger: scrllTrggrConds 12296 }); 12297 } 12298 12299 if ( !(stickyCards && state !== 'end' && !animLast && id === 0) ) { 12300 if ( target === 'mask' ) { 12301 if ( state !== 'end' ) { 12302 if ( mask === 'auto' ) { 12303 gsap.set( 12304 $animateTrgrEl, { 12305 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12306 opacity: parseFloat(opacity)/100, 12307 filter: 'blur(' + blur + 'px)', 12308 visibility: 'visible', 12309 } 12310 ) 12311 tlConds.fromTo($animateTrgrEl, { 12312 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12313 opacity: parseFloat(opacity)/100, 12314 filter: 'blur(' + blur + 'px)', 12315 duration: 1, 12316 }, { 12317 opacity: 1, 12318 clipPath: 'inset(0% 0px round 0' + radiu
12318s_unit + ')', 12319 filter: 'blur(0px)', 12320 duration: 1, 12321 ease: easeOut, 12322 //delay: 0.1 12323 }); 12324 } else { 12325 tlConds.fromTo($animateTrgrEl, { 12326 opacity: parseFloat(opacity)/100, 12327 clipPath: clip_path, 12328 filter: 'blur(' + blur + 'px)', 12329 duration: 1, 12330 }, { 12331 opacity: 1, 12332 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12333 filter: 'blur(0px)', 12334 duration: 1, 12335 ease: easeOut, 12336 //delay: 0.1 12337 }); 12338 } 12339 } else { 12340 if ( mask === 'auto' ) { 12341 tlConds.fromTo($animateTrgrEl, { 12342 opacity: 1, 12343 clipPath: 'inset(0% 0px round 0' + radiu
12343s_unit + ')', 12344 filter: 'blur(0px)', 12345 duration: 1, 12346 },{ 12347 opacity: parseFloat(opacity)/100, 12348 clipPath: 'inset(0% ' + (( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) )/2) + 'px round ' + radius + radius_unit + ')', 12349 filter: 'blur(' + blur + 'px)', 12350 ease: easeOut, 12351 duration: 1, 12352 //delay: 0.1 12353 }); 12354 } else { 12355 tlConds.fromTo($animateTrgrEl, { 12356 opacity: 1, 12357 clipPath: 'inset(0% 0% 0% 0% round 0' + radius_unit + ')', 12358 filter: 'blur(0px)', 12359 duration: 1, 12360 },{ 12361 opacity: parseFloat(opacity)/100, 12362 clipPath: clip_path, 12363 filter: 'blur(' + blur + 'px)', 12364 duration: 1, 12365 ease: easeOut, 12366 //delay: 0.1 12367 }); 12368 } 12369 } 12370 } else { 12371 if ( state !== 'end' ) { 12372 if ( scale === 'auto' ) { 12373 if ( radius ) { 12374 gsap.set( 12375 $animateTrgrEl, { 12376 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12377 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12378 x: animation_x + 'vw', 12379 y: animation_y + 'vh', 12380 filter: 'blur(' + blur + 'px)', 12381 rotation: rotate, 12382 rotationX: rotate == 0 ? perspective : 0, 12383 transformPerspective: '100vw', 12384 opacity: parseFloat(opacity)/100, 12385 transformOrigin: origin, 12386 borderRadius: radius + radius_unit, 12387 visibility: 'visible', 12388 } 12389 ) 12390 tlConds.fromTo($animateTrgrEl, { 12391 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12392 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12393 x: animation_x + 'vw', 12394 y: animation_y + 'vh', 12395 filter: 'blur(' + blur + 'px)', 12396 rotation: rotate, 12397 rotationX: rotate == 0 ? perspective : 0, 12398 transformPerspective: '100vw', 12399 opacity: parseFloat(opacity)/100, 12400 borderRadius: radius + radius_unit, 12401 transformOrigin: origin, 12402 duration: 1, 12403 }, { 12404 scaleX: 1, 12405 scaleY: 1, 12406 x: 0, 12407 y: 0, 12408 filter: 'blur(0px)', 12409 rotation: 0, 12410 rotationX: 0, 12411 opacity: 1, 12412 borderRadius: 0 + radius_unit, 12413 transformOrigin: origin, 12414 duration: 1, 12415 ease: easeOut, 12416 //delay: 0.1 12417 }); 12418 } else { 12419 gsap.set( 12420 $animateTrgrEl, { 12421 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12422 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12423 x: animation_x + 'vw', 12424 y: animation_y + 'vh', 12425 filter: 'blur(' + blur + 'px)', 12426 rotation: rotate, 12427 rotationX: rotate == 0 ? perspective : 0, 12428 transformPerspective: '100vw', 12429 opacity: parseFloat(opacity)/100, 12430 transformOrigin: origin, 12431 visibility: 'visible', 12432 } 12433 ) 12434 tlConds.fromTo($animateTrgrEl, { 12435 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12436 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12437 x: animation_x + 'vw', 12438 y: animation_y + 'vh', 12439 filter: 'blur(' + blur + 'px)', 12440 rotation: rotate, 12441 rotationX: rotate == 0 ? perspective : 0, 12442 transformPerspective: '100vw', 12443 opacity: parseFloat(opacity)/100, 12444 transformOrigin: origin, 12445 duration: 1, 12446 }, { 12447 scaleX: 1, 12448 scaleY: 1, 12449 x: 0, 12450 y: 0, 12451 filter: 'blur(0px)', 12452 rotation: 0, 12453 rotationX: 0, 12454 opacity: 1, 12455 transformOrigin: origin, 12456 duration: 1, 12457 ease: easeOut, 12458 //delay: 0.1 12459 }); 12460 } 12461 } else {
12462 if ( radius ) { 12463 gsap.set( 12464 $animateTrgrEl, { 12465 scaleX: parseFloat( scale ) / 100, 12466 scaleY: parseFloat( scale ) / 100, 12467 opacity: parseFloat(opacity)/100, 12468 x: animation_x + 'vw', 12469 y: animation_y + 'vh', 12470 filter: 'blur(' + blur + 'px)', 12471 rotation: rotate, 12472 rotationX: rotate == 0 ? perspective : 0, 12473 transformPerspective: '100vw', 12474 transformOrigin: origin, 12475 borderRadius: radius + radius_unit, 12476 visibility: 'visible', 12477 } 12478 ) 12479 tlConds.fromTo($animateTrgrEl, { 12480 scaleX: parseFloat( scale ) / 100, 12481 scaleY: parseFloat( scale ) / 100, 12482 opacity: parseFloat(opacity)/100, 12483 x: animation_x + 'vw', 12484 y: animation_y + 'vh', 12485 filter: 'blur(' + blur + 'px)', 12486 rotation: rotate, 12487 rotationX: rotate == 0 ? perspective : 0, 12488 transformPerspective: '100vw', 12489 borderRadius: radius + radius_unit, 12490 transformOrigin: origin, 12491 duration: 1, 12492 }, { 12493 scaleX: 1, 12494 scaleY: 1, 12495 opacity: 1, 12496 x: 0, 12497 y: 0, 12498 filter: 'blur(0px)', 12499 rotation: 0, 12500 rotationX: 0, 12501 transformOrigin: origin, 12502 ease: easeOut, 12503 duration: 1, 12504 borderRadius: 0 + radius_unit, 12505 //delay: 0.1 12506 }); 12507 } else { 12508 gsap.set( 12509 $animateTrgrEl, { 12510 scaleX: parseFloat( scale ) / 100, 12511 scaleY: parseFloat( scale ) / 100, 12512 opacity: parseFloat(opacity)/100, 12513 x: animation_x + 'vw', 12514 y: animation_y + 'vh', 12515 filter: 'blur(' + blur + 'px)', 12516 rotation: rotate, 12517 rotationX: rotate == 0 ? perspective : 0, 12518 transformPerspective: '100vw', 12519 transformOrigin: origin, 12520 visibility: 'visible', 12521 } 12522 ) 12523 tlConds.fromTo($animateTrgrEl, { 12524 scaleX: parseFloat( scale ) / 100, 12525 scaleY: parseFloat( scale ) / 100, 12526 opacity: parseFloat(opacity)/100, 12527 x: animation_x + 'vw', 12528 y: animation_y + 'vh', 12529 filter: 'blur(' + blur + 'px)', 12530 rotation: rotate, 12531 rotationX: rotate == 0 ? perspective : 0, 12532 transformPerspective: '100vw', 12533 transformOrigin: origin, 12534 duration: 1, 12535 }, { 12536 scaleX: 1, 12537 scaleY: 1, 12538 opacity: 1, 12539 x: 0, 12540 y: 0, 12541 filter: 'blur(0px)', 12542 rotation: 0, 12543 rotationX: 0, 12544 transformOrigin: origin, 12545 duration: 1, 12546 ease: easeOut, 12547 //delay: 0.1 12548 }); 12549 } 12550 } 12551 } else { 12552 if ( scale === 'auto' ) { 12553 tlConds.fromTo($animateTrgrEl, { 12554 scaleX: 1, 12555 scaleY: 1, 12556 opacity: 1, 12557 x: 0, 12558 y: 0, 12559 filter: 'blur(0px)', 12560 rotation: 0, 12561 rotationX: 0, 12562 transformOrigin: origin, 12563 duration: 1, 12564 }, { 12565 scaleX: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12566 scaleY: 1 - ( ( UNCODE.wwidth - parseFloat(SiteParameters.uncode_limit_width) ) /UNCODE.wwidth ), 12567 opacity: parseFloat(opacity)/100, 12568 x: animation_x + 'vw', 12569 y: animation_y + 'vh', 12570 filter: 'blur(' + blur + 'px)', 12571 rotation: rotate, 12572 rotationX: rotate == 0 ? perspective : 0, 12573 transformPerspective: '100vw', 12574 transformOrigin: origin, 12575 duration: 1, 12576 ease: easeOut, 12577 //delay: 0.1 12578 }) 12579 } else { 12580 tlConds.fromTo($animateTrgrEl, { 12581 scaleX: 1, 12582 scaleY: 1, 12583 opacity: 1, 12584 x: 0, 12585 y: 0, 12586 filter: 'blur(0px)', 12587 rotation: 0, 12588 rotationX: 0, 12589 transformPerspective: '100vw', 12590 transformOrigin: origin, 12591 borderRadius: 0 + radius_unit, 12592 duration: 1, 12593 }, { 12594 scaleX: parseFloat( scale ) / 100, 12595 scaleY: parseFloat( scale ) / 100, 12596 opacity: parseFloat(opacity)/100, 12597 x: animation_x + 'vw', 12598 y: animation_y + 'vh', 12599 filter: 'blur(' + blur + 'px)', 12600 rotation: rotate, 12601 rotationX: rotate == 0 ? perspective : 0, 12602 transformPerspective: '100vw', 12603 transformOrigin: origin, 12604 borderRadius: radius + radius_unit, 12605 duration: 1, 12606 ease: easeOut, 12607 //delay: 0.1 12608 }) 12609 } 12610 } 12611 } 12612 } 12613 12614 function headingReveal($el){ 12615 txtTrggrStart = true; 12616 $('.text-reveal', $el).each(function(_key, _val){ 12617 var $txtReveal = $(_val), 12618 dataReveal = $('[data-reveal]', $txtReveal).attr('data-reveal'), 12619 dataRevealOpacity = $('[data-reveal]', $txtReveal).attr('data-reveal-opacity'), 12620 $lines = $('.heading-line-wrap', $txtReveal), 12621 $words = $('.split-word-inner', $txtReveal), 12622 $chars = $('.split-char', $txtReveal), 12623 _setTxtReveal, 12624 $elToReveal = $words; 12625 12626 if ( !(sticky === 'yes' || stickyCards) ) { 12627 return; 12628 } 12629 12630 easeOut = easeOut !== 'none' ? easeOut + '.out' : easeOut; 12631 12632 if ( dataReveal === 'chars' ) { 12633 $elToReveal = $chars; 12634 } else if ( dataReveal === 'lines' ) { 12635 $elToReveal = $lines; 12636 } 12637 12638 var scrllTrggrTxt = typeof scrllTrggrConds !== 'undefined' || scrllTrggr; 12639 scrllTrggrTxt.id = "txt_reveal_" + _key;
12640 scrllTrggrTxt.pin = false; 12641 12642 gsap.set($elToReveal, {opacity: dataRevealOpacity}); 12643 var _tl = gsap.timeline({ 12644 scrollTrigger: scrllTrggrTxt 12645 }); 12646 _tl.fromTo($elToReveal, { 12647 opacity: dataRevealOpacity, 12648 }, { 12649 opacity: 1, 12650 stagger: 0.05 12651 }); 12652 12653 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12654 clearRequestTimeout(_setTxtReveal); 12655 _setTxtReveal = requestTimeout( function(){ 12656 gsap.set($elToReveal, {clearProps: true}); 12657 _tl.kill(true); 12658 if ( typeof ScrollTrigger.getById('txt_reveal_' + _key) !== 'undefined' ) { 12659 ScrollTrigger.getById("txt_reveal_" + _key).kill(true); 12660 } 12661 headingReveal($el) 12662 }, 100); 12663 }); 12664 12665 }); 12666 }; 12667 12668 if (!txtTrggrStart) { 12669 headingReveal($el); 12670 } 12671 12672 $scrollTrgrEl.one( 'uncodeWordLines', function(){ 12673 if (!txtTrggrStart) { 12674 headingReveal($el); 12675 } 12676 }); 12677 12678 var _height = Math.max( document.body.scrollHeight, document.body.offsetHeight, 12679 document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12680 var _width = Math.max( document.body.scrollWidth, document.body.offsetWidth, 12681 document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12682 12683 $(window).on('uncode-sticky-trigger-observe', function(e){ 12684 var __height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12685 var __width = Math.max( document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth ); 12686 $('.pin-spacer, [data-sticky]', $scrollTrgrEl).css({height: false, maxHeight: false}); 12687 //$('.tmb, .row-inner[style*=height]', $scrollTrgrEl).removeAttr('style'); 12688 if ( stickyCards ) { 12689 $('.tmb', $scrollTrgrEl).removeAttr('style'); 12690 } 12691 var scrollnow = document.body.scrollTop || document.documentElement.scrollTop; 12692 clearRequestTimeout(setTxtReveal); 12693 setTxtReveal = requestTimeout( function(){ 12694 $(document).trigger('uncode-scrolltrigger-refresh'); 12695 if ( isMobileUsing ) { 12696 if ( typeof tl !== 'undefined' ) { 12697 tl.scrollTrigger.refresh(); 12698 } 12699 if ( typeof tlConds !== 'undefined' ) { 12700 tlConds.scrollTrigger.refresh(); 12701 } 12702 $(window).trigger('scroll'); 12703 _width = __width; 12704 } else if ( _width !== __width && ( isMobileUsing ) ) { 12705 window.dispatchEvent(new CustomEvent('vc-resize')); 12706 if ( typeof window.lenis !== 'undefined' && window.lenis !== null ) { 12707 window.lenis.scrollTo(0, {duration: 0.01, onComplete: function(){ 12708 if ( typeof tl !== 'undefined' ) { 12709 tl.scrollTrigger.refresh(); 12710 } 12711 if ( typeof tlConds !== 'undefined' ) { 12712 tlConds.scrollTrigger.refresh(); 12713 } 12714 window.lenis.scrollTo(scrollnow, {duration: 0.01}); 12715 }}); 12716 } else { 12717 if ( typeof tl !== 'undefined' ) { 12718 tl.scrollTrigger.refresh(); 12719 } 12720 if ( typeof tlConds !== 'undefined' ) { 12721 tlConds.scrollTrigger.refresh(); 12722 } 12723 $(window).trigger('scroll'); 12724 } 12725 _height = __height; 12726 } 12727 }, 500); 12728 }); 12729 12730 12731 $(window).on('load ', function(e){ 12732 var ___height = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); 12733 if ( _height !== ___height ) { 12734 $scrollTrgrEl.attr('data-toggled', true); 12735 $(window).trigger('resize'); 12736 if ( typeof tl !== 'undefined' ) { 12737 tl.scrollTrigger.refresh(); 12738 } 12739 if ( typeof tlConds !== 'undefined' ) { 12740 tlConds.scrollTrigger.refresh(); 12741 } 12742 _height = ___height; 12743 } 12744 12745 12746 12747 $(document).trigger('uncode-scrolltrigger-refresh'); 12748 12749 }); 12750 12751 }; 12752 12753 var callAreaAnimateScrollTl = function() { 12754 if ( stickyCards ) { 12755 $('.vc_row.row-internal:not(.row-no-card)', $scrollTrgrEl).each(function(key, val){ 12756 if ( key+1 < cardL || animLast || state !== 'end' ) { 12757 var $this = $(val), 12758 last = key+1===cardL; 12759 areaAnimateScrollTl($this, key, last); 12760 } 12761 }); 12762 } else {
12763 areaAnimateScrollTl($scrollTrgrEl, 0, false); 12764 } 12765 }; 12766 12767 $(window).on('wwResize', function(){ 12768 if ( !alreadyareaAnimateScrollTl ) { 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 if ( noMobile ) { 12782 if ( noTablet && UNCODE.wwidth <= UNCODE.mediaQuery ) { 12783 return; 12784 } else if ( UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12785 return; 12786 } 12787 } 12788 12789 callAreaAnimateScrollTl(); 12790 12791 }); 12792 12793 }; 12794 12795 areaReveal(); 12796 12797}; 12798 12799UNCODE.thumbsReveal = function() { 12800 var recalc = false, 12801 revealThumbs = function( $el ){ 12802 if ( typeof $el === 'undefined' || $el === null || !$el.length ) { 12803 $el = $('body'); 12804 } 12805 $('.grid-wrapper, .custom-grid-container, .single-wrapper, .owl-carousel-wrapper, .linear-wrapper', $el).has('.tmb-mask').each(function(){ 12806 var $container = $(this), 12807 $stickys = $('.tmb-mask:not(.tmb-mask-init)', $container), 12808 isContainer = false; 12809 12810 if ( !$('body').hasClass('compose-mode') || typeof window.parent.vc === 'undefined' ) { 12811 $stickys.each(function(){ 12812 var $sticky = $(this).addClass('tmb-mask-init'), 12813 $rellax = $sticky.closest('.parallax-el'), 12814 $inside = $('.t-inside', $sticky), 12815 $media = $('img, video, .fluid-object', $sticky).attr('loading', ''), 12816 val = parseFloat( $inside.attr('data-scroll-val') ); 12817 12818 if ( $rellax.length ) { 12819 recalc = true; 12820 } 12821 12822 val = (isNaN(val) || val == null || val == 0 || typeof val === 'undefined') ? 5 : val; 12823 12824 if ( $sticky.hasClass('tmb-mask-scroll') ) { 12825 12826 var zoom = ($sticky.hasClass('tmb-mask-scroll-zoom') || $sticky.hasClass('tmb-mask-scroll-both')) 12827 ? val*0.05 : 0; 12828 var parax = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) 12829 ? val*4 : 0; 12830 var extra = ($sticky.hasClass('tmb-mask-scroll-parallax') || $sticky.hasClass('tmb-mask-scroll-both')) ? parax*0.01 : 0; 12831 12832 var tl = gsap.timeline({ 12833 scrollTrigger: { 12834 trigger: $sticky, 12835 scrub: true, 12836 } 12837 }); 12838 12839 tl.fromTo($media, { 12840 yPercent: -(parax), 12841 scale: 1 + zoom + extra, 12842 }, { 12843 yPercent: parax, 12844 scale: 1 + extra, 12845 ease: "none", 12846 }); 12847 12848 if ( recalc ) { 12849 $(window).on('uncode-thumbsreveal-refresh', function(){ 12850 if ( tl !== null && tl !== 'undefined' && tl.scrollTrigger !== null ) { 12851 tl.scrollTrigger.refresh(); 12852 } 12853 }); 12854 } 12855 } 12856 }); 12857 } 12858 12859 if ( $container.has('.tmb-mask-reveal') ) { 12860 var $markTrigger = ".tmb-mask-reveal .t-entry-visual", 12861 staggerTime = 0.1; 12862 12863 $('.t-inside', $container).each(function(){ 12864 var checkEasing = $(this).attr('data-easing'); 12865 if (checkEasing === '' || checkEasing == null || typeof checkEasing === 'undefined') { 12866 gsap.registerPlugin(CustomEase); 12867 return false;
12868 } 12869 }); 12870 12871 if ( $container.hasClass('cssgrid-system') && !$container.hasClass('cssgrid-animate-sequential') ) { 12872 $markTrigger = $container; 12873 isContainer = true; 12874 staggerTime = 0; 12875 } 12876 12877 ScrollTrigger.batch( $markTrigger, { 12878 start: function( el ){ 12879 /*if ( el.trigger.offsetHeight < (window.innerHeight/2) ) { 12880 return "bottom bottom"; 12881 } else {*/ 12882 return "top 96%"; 12883 //} 12884 }, 12885 onEnter: function(batch){ 12886 var $inside = $(batch).closest('.t-inside'); 12887 12888 if ( isContainer ) { 12889 var $inside = $(batch).find('.t-inside').first(); 12890 } 12891 12892 var delay = parseFloat( $inside.attr('data-delay') ), 12893 speed = parseFloat( $inside.attr('data-speed') ), 12894 easing = $inside.attr('data-easing'), 12895 bgDelay = parseFloat( $inside.attr('data-bg-delay') ); 12896 12897 delay = (isNaN(delay) || delay == null || typeof delay === 'undefined') ? 0 : delay/1000; 12898 speed = (isNaN(speed) || speed == null || typeof speed === 'undefined') ? 0.4 : speed/1000; 12899 easing = (easing === '' || easing == null || typeof easing === 'undefined') ? CustomEase.create("custom", "0.76, 0, 0.24, 1") : easing; 12900 bgDelay = (isNaN(bgDelay) || bgDelay == null || typeof bgDelay === 'undefined') ? '' : bgDelay; 12901 12902 if ( $(batch).closest('.tmb-has-hex').length && bgDelay !== '' ) { 12903 gsap.to($('.t-entry-visual-tc', batch), speed, { 12904 clipPath: 'inset(0% 0% 0% 0%)', 12905 stagger: staggerTime, 12906 delay: delay, 12907 ease: easing, 12908 }); 12909 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12910 clipPath: 'inset(0% 0% 0% 0%)', 12911 stagger: staggerTime, 12912 scale: 1, 12913 delay: delay + (speed*bgDelay), 12914 ease: easing, 12915 }); 12916 } else { 12917 gsap.to($('.t-entry-visual-cont, .uncode-single-media-wrapper', batch), speed, { 12918 clipPath: 'inset(0% 0% 0% 0%)', 12919 stagger: staggerTime, 12920 scale: 1, 12921 delay: delay, 12922 ease: easing, 12923 }); 12924 } 12925 12926 } 12927 }); 12928 } 12929 12930 }); 12931 12932 function raf(time) { 12933 requestAnimationFrame(raf) 12934 $(window).trigger('uncode-thumbsreveal-refresh'); 12935 } 12936 12937 if ( recalc ) { 12938 requestAnimationFrame(raf) 12939 } 12940 12941 }; 12942 $(window).on( 'load more-items-loaded', function(){ 12943 revealThumbs(); 12944 }); 12945 12946 $(document).on('uncode-ajax-filtered', function(){ 12947 revealThumbs(); 12948 }); 12949 12950 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 12951 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 12952 var $el = model.view.$el, 12953 shortcode = model.attributes.shortcode; 12954 12955 if ( $el.is('.custom-grid-container') ) { 12956 $el = $el.parent(); 12957 } 12958 12959 if (shortcode === 'uncode_index' || shortcode === 'vc_gallery' || shortcode === 'vc_single_image') { 12960 revealThumbs($el); 12961 } 12962 }); 12963 } 12964 12965}; 12966 12967UNCODE.revslider = function() { 12968 var revSlider6In = function(){ 12969 $('rs-module').each(function(){ 12970 var $slider = $(this); 12971 12972 $slider.on('revolution.slide.onloaded', function(e, data){ 12973 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12974 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 12975 scrolltop = $(document).scrollTop(); 12976 if ( style != undefined ) { 12977 UNCODE.switchColorsMenu(scrolltop, style); 12978 } 12979 } 12980 }); 12981 12982 $slider.on('revolution.slide.onchange', function(e, data){ 12983 if ( $(e.currentTarget).closest(".header-revslider").length ) { 12984 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 12985 scrolltop = $(document).scrollTop(); 12986 if ( style != undefined ) { 12987 UNCODE.switchColorsMenu(scrolltop, style); 12988 } 12989 } 12990 }); 12991 12992 }); 12993 12994 }; 12995 revSlider6In(); 12996 $(window).on("load", revSlider6In ); 12997 12998 document.addEventListener("sr.module.ready", function(e) { 12999 var $slider = $('#'+e.id), 13000 settings = SR7.JSON[e.id]; 13001 13002 if ( typeof settings !== 'undefined' && settings !== null ) { 13003 if ( $slider.closest(".header-revslider").length ) { 13004 var style = settings.slides[1].slide.attr.data, 13005 scrolltop = $(document).scrollTop(); 13006 style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/); 13007 style = style[1]; 13008 if ( style[1] != undefined ) { 13009 UNCODE.switchColorsMenu(scrolltop, style); 13010 } 13011 } 13012 } 13013 }); 13014 13015 document.addEventListener("sr.slide.afterChange", function(e) { 13016 var $slider = $('#'+e.id), 13017 settings = SR7.JSON[e.id]; 13018 13019 if ( typeof settings !== 'undefined' && settings !== null ) { 13020 if ( $slider.closest(".header-revslider").length ) { 13021 var style = settings.slides[e.current.id].slide.attr.data, 13022 scrolltop = $(document).scrollTop(); 13023 style = style.match(/data-skin=[\'|\"](.*)[\'|\"]/); 13024 style = style[1]; 13025 if ( style != undefined ) { 13026 UNCODE.switchColorsMenu(scrolltop, style); 13027 } 13028 } 13029 } 13030 }); 13031 13032}; 13033UNCODE.layerslider = function() { 13034 $(window).on("load", function() { 13035 13036 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 13037 13038 var slideData = slider.slides.current.data, 13039 scrolltop = $(document).scrollTop(); 13040 if( slideData && slideData.skin ) { 13041 13042 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 13043 13044 } 13045 }); 13046 13047 }); 13048}; 13049 13050UNCODE.ajax_filters = function () { 13051 var isAjaxing = false;
13052 13053/************************* 13054 * 13055 * Filters Menu and Widgets Area 13056 * 13057 ************************/ 13058 13059 var clear_clicked = false; 13060 13061 var init_ajax_grid = function(){ 13062 13063 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 13064 $grids.each(function(index, val){ 13065 var $body = $('body'), 13066 $grid = $(val).addClass('init-ajax-grid'), 13067 starting_point = $grid.attr('data-toggle'), 13068 $trigger = $('.uncode-toggle-ajax-filters', $grid), 13069 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 13070 $isotope_wrapper = $('.isotope-wrapper', $grid), 13071 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 13072 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 13073 $footprint = $('.ajax-filter-footprint', $grid), 13074 sidebar_w, 13075 data_w = parseFloat( $sidebar.attr('data-max-width') ), 13076 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 13077 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 13078 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 13079 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 13080 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 13081 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 13082 sidew, 13083 $inside_row = $('> .row-parent', $vc_row), 13084 bg_row, 13085 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 13086 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 13087 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer), 13088 sidebar_overlay = false, 13089 sidebar_hover = false, 13090 switchMobile = false, 13091 scrollTop; 13092 13093 if ( $vc_row.attr('class') ) { 13094 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 13095 } 13096 13097 if ( bg_row != null ) { 13098 $side_header.add($side_footer).addClass(bg_row[0]); 13099 } 13100 13101 $trigger.add($apply_filters).on('click', function(e){ 13102 e.preventDefault(); 13103 e.stopPropagation(); 13104 $grid = $('.ajax-grid-system').eq(0); 13105 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 13106 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 13107 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13108 sidebar_w = $sidebar_wrapper.width(); 13109 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13110 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 13111 $(this).trigger('uncode-ajax-clear-filters'); 13112 } 13113 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 13114 $grid.toggleClass('ajax-hide-filters-blanks'); 13115 $sidebar.slideToggle({ 13116 duration: 400, 13117 easing: 'easeOutQuad', 13118 }); 13119 } else { 13120 $grid.removeClass('ajax-hide-filters-blanks'); 13121 $grid.toggleClass('ajax-hide-filters'); 13122 if ( $grid.hasClass('ajax-hide-filters') ) { 13123 $body.addClass('ajax-hide-filters'); 13124 } else { 13125 scrollTop = $('html, body').scrollTop(); 13126 $body.removeClass('ajax-hide-filters'); 13127 } 13128 } 13129 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 13130 $('html, body').scrollTop(scrollTop); 13131 } 13132 return false; 13133 }); 13134 13135 $close_btn.on('click', function(e){ 13136 e.preventDefault(); 13137 $grid = $('.ajax-grid-system').eq(0); 13138 $grid.addClass('ajax-hide-filters'); 13139 if ( $grid.hasClass('ajax-hide-filters') ) { 13140 $body.addClass('ajax-hide-filters'); 13141 } else { 13142 scrollTop = $('html, body').scrollTop(); 13143 $body.removeClass('ajax-hide-filters'); 13144 } 13145 $('html, body').scrollTop(scrollTop); 13146 }); 13147 13148 $sidebar_wrapper.on('mouseover',function(){ 13149 sidebar_hover = true; 13150 }).on('mouseout', function(){ 13151 sidebar_hover = false; 13152 }); 13153 13154 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 13155 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 13156 return; 13157 } 13158 if (undefined !== from && from === 'select_active_attributes') { 13159 return; 13160 } 13161 if ($(e.target).closest('.select2-container--open').length ) { 13162 return; 13163 } 13164 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 13165 $grid.add($body).addClass('ajax-hide-filters'); 13166 } 13167 }); 13168 13169 $sorting_trgr.on('click', function(e) { 13170 e.preventDefault(); 13171 }); 13172 13173 var inside_width = function(){ 13174 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13175 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13176 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13177 $inside_row = $('> .row-parent', $vc_row); 13178 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 13179 sidew = $sidebar.width(); 13180 $inside_row.css({ 13181 width: sidew 13182 }); 13183 } else { 13184 $inside_row.css({ 13185 width: '' 13186 }); 13187 } 13188 }; 13189 inside_width(); 13190 13191 var ajax_sidebar_position = function(e, f_editor){ 13192 $grid = $('.ajax-grid-system').eq(0); 13193 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 13194 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 13195 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 13196 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 13197 $inside_row = $('> .row-parent', $vc_row); 13198 scrollTop = $('html, body').scrollTop(); 13199 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 13200 $grid.add($body).addClass('ajax-hide-filters'); 13201 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 13202 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
13203 sidebar_overlay = true; 13204 $body.addClass('ajax-filter-sidebar-overlay'); 13205 $sidebar_wrapper.addClass(skin); 13206 var sideHeadH = $side_header.outerHeight(), 13207 sideFooterH = $side_footer.outerHeight(); 13208 if ( data_w !== '' && data_w > 0 ) { 13209 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 13210 $sidebar.css({ 13211 'max-width': data_w 13212 }); 13213 } else { 13214 $sidebar.css({ 13215 'max-width':'none' 13216 }); 13217 } 13218 } 13219 $vc_row.css({ 13220 'padding-top':sideHeadH, 13221 'padding-bottom':sideFooterH 13222 }); 13223 var sidew = $sidebar.width(); 13224 $inside_row.css({ 13225 width: sidew 13226 }); 13227 switchMobile = true; 13228 } else { 13229 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 13230 scrollTop = $('html, body').scrollTop(); 13231 $grid.add($body).removeClass('ajax-hide-filters'); 13232 } 13233 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 13234 $grid.addClass('ajax-hide-filters-blanks'); 13235 $sidebar.hide(); 13236 } 13237 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 13238 $('.ajax-sidebar-placeholder', $grid).remove(); 13239 sidebar_overlay = false; 13240 $body.removeClass('ajax-filter-sidebar-overlay'); 13241 $sidebar_wrapper.removeClass(skin); 13242 if ( data_w !== '' && data_w > 0 ) { 13243 $sidebar.css({ 13244 'max-width':'none' 13245 }); 13246 } 13247 $vc_row.css({ 13248 'padding-top':0, 13249 'padding-bottom':0, 13250 }); 13251 13252 $inside_row.css({ 13253 width: '' 13254 }); 13255 13256 if ( f_editor === true ) { 13257 UNCODE.ajax_filters(); 13258 } 13259 13260 switchMobile = false; 13261 } 13262 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 13263 $('html, body').scrollTop(scrollTop); 13264 } 13265 }; 13266 13267 var sidebar_width = function(){ 13268 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 13269 sidebar_w = $footprint.width(); 13270 $sidebar.css({ width: sidebar_w }); 13271 } else { 13272 $sidebar.css({ width: '' }); 13273 } 13274 }; 13275 sidebar_width(); 13276 13277 if ( SiteParameters.is_frontend_editor ) { 13278 ajax_sidebar_position(); 13279 } 13280 13281 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 13282 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 13283 ajax_sidebar_position(e); 13284 } 13285 sidebar_width(); 13286 }); 13287 13288 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 13289 ajax_sidebar_position(e, true); 13290 }); 13291 13292 $isotope_wrapper.on('transitionend', function(e){ 13293 if ( $(e.target).hasClass('isotope-wrapper') ) { 13294 window.dispatchEvent(new CustomEvent('boxResized')); 13295 } 13296 return false; 13297 }); 13298 13299 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 13300 var $grid = $('.ajax-grid-system').eq(0); 13301 $grid.addClass('ajax-hide-filters'); 13302 } 13303 13304 }); 13305 }; 13306 13307 init_ajax_grid(); 13308 $(document).on('uncode-ajax-filtered', init_ajax_grid); 13309 13310/************************* 13311 * 13312 * Hover hack 13313 * 13314 ************************/ 13315 var widget_hover_hack = function() { 13316 $('.widget, .uncode_widget').each(function(){ 13317 var $widget = $(this), 13318 class_w = $widget.attr('class'), 13319 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 13320 $footer = $widget.closest('#colophon'); 13321 13322 if ( class_w.indexOf('widget_yith') > 0 ) { 13323 return true; 13324 } 13325 13326 $lis.each(function(){ 13327 var $li = $(this), 13328 $a = $('a', $li), 13329 $label = $a.closest('label'); 13330 13331 if ( !$footer.length ) { 13332 $li.addClass('no-evts'); 13333 } 13334 13335 if ( ! $('span', $a).length ) { 13336 $li.addClass( 'li-hover' ); 13337 } 13338 13339 $('li', $li).hover(function(e){ 13340 $(e.target).parents('li').each(function(){ 13341 $(this).addClass( 'parent-li-hover' ); 13342 }); 13343 }, function (e) { 13344 $(e.target).parents('li').each(function(key, val){ 13345 if ( key === 0) { 13346 $(val).removeClass( 'parent-li-hover' ); 13347 } 13348 }); 13349 }); 13350 13351 $li.off('mouseup').on('mouseup', function (e) { 13352 if (e.which !== 3) { 13353 e.stopPropagation(); 13354 var $a = $('a', this).first(); 13355 $a[0].click(); 13356 } 13357 }); 13358 }); 13359 }); 13360 } 13361 if (SiteParameters.disable_hover_hack !== '1') { 13362 widget_hover_hack(); 13363 $(document).on('uncode-ajax-filtered', widget_hover_hack); 13364 } 13365 13366/************************* 13367 * 13368 * Init Filters 13369 * 13370 ************************/ 13371 13372 function init_filters() { 13373 $(document).on('click', '.term-filter-link', function(e) { 13374 var _this = $(this); 13375 var widget = _this.closest('.uncode_widget'); 13376 var container = get_filters_container(); 13377 13378 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13379 return true; 13380 } 13381 13382 e.preventDefault(); 13383 13384 if (widget.hasClass('widget-ajax-filters--checkbox')) { 13385 _this.parent().find('input[type="checkbox"]').trigger('click'); 13386 } else { 13387 if (_this.hasClass('term-filter-link--active')) { 13388 _this.removeClass('term-filter-link--active'); 13389 } else { 13390 _this.addClass('term-filter-link--active'); 13391 13392 if (widget.hasClass('widget-ajax-filters--single')) { 13393 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 13394 } 13395 } 13396 13397 var url = _this.attr('href'); 13398 13399 reload_items(container, url, true); 13400 } 13401 }); 13402 13403 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 13404 var _this = $(this); 13405 var widget = _this.closest('.uncode_widget'); 13406 var link = _this.closest('.term-filter').find('.term-filter-link'); 13407 var url = link.attr('href'); 13408 var container = get_filters_container(); 13409 13410 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13411 window.location = url; 13412 return; 13413 } 13414 13415 if (widget.hasClass('widget-ajax-filters--single')) { 13416 widget.find('input[type="checkbox"]').each(function() { 13417 if (_this.attr('id') !== $(this).attr('id')) { 13418 $(this).prop('checked', false); 13419 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 13420 } 13421 }); 13422 } 13423 13424 if (_this.prop('checked')) { 13425 link.addClass('term-filter-link--active'); 13426 } else { 13427 link.removeClass('term-filter-link--active'); 13428 } 13429 13430 reload_items(container, url, true); 13431 }); 13432 13433 $(document).on('change', 'select.select--term-filters', function(e) { 13434 var _this = $(this); 13435 var selected = _this.find('option:selected'); 13436 var option = $(selected); 13437 var url = option.attr('data-term-filter-url'); 13438 var container = get_filters_container(); 13439 var widget = _this.closest('.uncode_widget'); 13440 13441 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 13442 window.location = url; 13443 } else { 13444 reload_items(container, url, true); 13445 } 13446 }); 13447 13448 $(document).on('click', '.filter-list__link', function(e) { 13449 if (SiteParameters.is_frontend_editor) { 13450 return false;
13451 } 13452 13453 e.preventDefault(); 13454 13455 var _this = $(this); 13456 var container = get_filters_container(); 13457 var url = _this.attr('href'); 13458 reload_items(container, url, true); 13459 }); 13460 13461 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 13462 var _this = $(this); 13463 var container = get_filters_container(); 13464 var url = _this.attr('href'); 13465 reload_items(container, url, true); 13466 }); 13467 13468 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 13469 13470 var _this = $(this); 13471 var container = get_filters_container(); 13472 var url = _this.attr('href'); 13473 13474 if ( container.length ) { 13475 e.preventDefault(); 13476 reload_items(container, url, true); 13477 } 13478 }); 13479 13480 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 13481 var _this = $(this); 13482 var container = get_filters_container(); 13483 13484 if (container.length > 0) { 13485 e.preventDefault(); 13486 13487 var min_price = $('#min_price').val(); 13488 var max_price = $('#max_price').val(); 13489 var location = window.location; 13490 var url = location.href; 13491 var page_uri = location.origin + location.pathname; 13492 var is_filtered = page_uri !== url; 13493 13494 if (is_filtered) { 13495 url = remove_parameter_from_url(url, 'min_price'); 13496 url = remove_parameter_from_url(url, 'max_price'); 13497 } 13498 13499 var concat = page_uri === url ? '?' : '&'; 13500 var params = {'min_price': min_price, 'max_price': max_price}; 13501 13502 url = url + concat + $.param(params); 13503 13504 reload_items(container, url, true); 13505 } 13506 }); 13507 13508 var search_timer; 13509 13510 $(document).on('keyup', '.term-filters-search-input', function(e) { 13511 var _this = $(this); 13512 var container = get_filters_container(); 13513 var value = _this.val(); 13514 13515 if (search_timer) { 13516 clearTimeout(search_timer); 13517 } 13518 13519 search_timer = setTimeout(function() { 13520 update_search_url(container, value); 13521 }, 500); 13522 }); 13523 } 13524 13525 function update_search_url(container, search_value) { 13526 var location = window.location; 13527 var url = location.href; 13528 var page_uri = location.origin + location.pathname; 13529 var is_filtered = page_uri !== url; 13530 var key_search = SiteParameters.ajax_filter_key_search; 13531 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 13532 13533 if (is_filtered) { 13534 url = remove_parameter_from_url(url, key_search); 13535 url = remove_parameter_from_url(url, key_unfilter); 13536 } 13537 13538 if (search_value) { 13539 var concat = page_uri === url ? '?' : '&'; 13540 var params = {}; 13541 13542 params[key_search] = search_value; 13543 params[key_unfilter] = 1; 13544 url = url + concat + $.param(params); 13545 } else { 13546 url = remove_parameter_from_url(url, key_search); 13547 } 13548 13549 reload_items(container, url, true); 13550 } 13551 13552 function remove_parameter_from_url(url, parameter) { 13553 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 13554 } 13555 13556 function get_filters_container() { 13557 var container = $('.ajax-grid-system'); 13558 13559 if (container.length == 0) { 13560 container = $('.ajax-filters'); 13561 } 13562 13563 return container; 13564 } 13565 13566 function update_widgets_state(widgets_states, container) { 13567 for (var i = widgets_states.length - 1; i >= 0; i--) { 13568 var state = widgets_states[i]; 13569 13570 if (!state.collapse) { 13571 continue; 13572 } 13573 13574 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 13575 13576 if (state.open) { 13577 new_widget.find('.widget-title').addClass('open'); 13578 if (state.css) { 13579 new_widget.find('.widget-collapse-content').attr('style', state.css); 13580 } 13581 } else { 13582 new_widget.find('.widget-title').removeClass('open'); 13583 if (state.css) { 13584 new_widget.find('.widget-collapse-content').attr('style', state.css); 13585 } 13586 } 13587 } 13588 } 13589 13590 // Reload items via AJAX 13591 function reload_items(container, url, push) { 13592 if (isAjaxing) { 13593 return 13594 }; 13595 13596 isAjaxing = true; 13597 13598 container.addClass('grid-filtering'); 13599 13600 $.ajax({ 13601 url : url, 13602 success : function(response) { 13603 if (!response) { 13604 return; 13605 } 13606 13607 $(document).trigger('uncode-ajax-pre-filtered'); 13608 13609 var container_id = container.attr('id'); 13610 var pagination = $('.row-navigation'); 13611 13612 if (container_id) { 13613 var container_to_append = $(response).find('#' + container_id); 13614 var pagination_to_append = $(response).find('.row-navigation'); 13615 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13616 13617 // Remember open/closed widgets 13618 var widgets = $('.uncode_widget'); 13619 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 13620 var widgets_states = []; 13621 13622 widgets.each(function() { 13623 var widget = $(this); 13624 var id = widget.attr('data-id'); 13625 var state = { 13626 'id': id, 13627 'collapse': false, 13628 'open': false, 13629 'css': false, 13630 }; 13631 13632 var collapse_wrapper = widget.find('.widget-collapse-content'); 13633 13634 if (collapse_wrapper.length > 0) { 13635 state.collapse = true; 13636 13637 var collapse_wrapper_css = collapse_wrapper.attr('style'); 13638 var title = widget.find('.widget-title'); 13639 13640 state.css = collapse_wrapper_css; 13641 13642 if (title.hasClass('open')) { 13643 state.open = true; 13644 } else { 13645 state.open = false;
13646 } 13647 } 13648 13649 widgets_states.push(state); 13650 }); 13651 13652 // Update widgets state 13653 if (offcanvas_sidebar_wrapper.length === 0) { 13654 update_widgets_state(widgets_states, container_to_append); 13655 } 13656 13657 // Update default sidebar state 13658 if (!container.hasClass('ajax-hide-filters')) { 13659 container_to_append.removeClass('ajax-hide-filters'); 13660 } 13661 13662 // Update horizontal sidebar 13663 if (!container.hasClass('ajax-hide-filters-blanks')) { 13664 container_to_append.removeClass('ajax-hide-filters-blanks'); 13665 } 13666 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 13667 if (horizontal_sidebar_wrapper.length > 0) { 13668 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 13669 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 13670 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 13671 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 13672 13673 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 13674 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 13675 } 13676 13677 // Append container 13678 container.replaceWith(container_to_append); 13679 13680 // Hide first thumbnail until the new srcset is loaded 13681 if (SiteParameters.dynamic_srcset_active === '1') { 13682 container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations'); 13683 } 13684 13685 // Remove loading attribute to images 13686 container_to_append.find('img').attr('loading', ''); 13687 13688 // Append pagination 13689 if (pagination.length > 0) { 13690 if (pagination_to_append.length > 0) { 13691 pagination.html(pagination_to_append.html()); 13692 } else { 13693 pagination.html(''); 13694 } 13695 } else { 13696 if (pagination_to_append.length > 0) { 13697 $('.post-wrapper').append(pagination_to_append); 13698 } 13699 } 13700 13701 // Update off canvas sidebar (mobile and overlay) 13702 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13703 13704 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 13705 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 13706 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 13707 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 13708 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 13709 13710 // Update widgets state 13711 update_widgets_state(widgets_states, sidebar_to_append); 13712 13713 // Update sidebar 13714 sidebar_container.html(sidebar_to_append.html()); 13715 } 13716 13717 if (push) { 13718 UNCODE.lastURL = url; 13719 window.history.pushState( 13720 { pageTitle: document.title }, 13721 '', 13722 url 13723 ); 13724 } 13725 13726 if (typeof UNCODE.isotopeLayout !== 'undefined') { 13727 UNCODE.isotopeLayout(); 13728 } 13729 if (typeof UNCODE.justifiedGallery !== 'undefined') { 13730 UNCODE.justifiedGallery(); 13731 } 13732 if (typeof UNCODE.cssGrid !== 'undefined') { 13733 UNCODE.cssGrid(); 13734 } 13735 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 13736 UNCODE.lightbox(); 13737 } 13738 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 13739 UNCODE.lightgallery(); 13740 } 13741 if (typeof UNCODE.carousel !== 'undefined') { 13742 UNCODE.carousel($('body')); 13743 } 13744 UNCODE.animations(); 13745 if (typeof UNCODE.filters !== 'undefined') { 13746 UNCODE.filters(); 13747 } 13748 if (typeof UNCODE.widgets !== 'undefined') { 13749 UNCODE.widgets(); 13750 } 13751 13752 if (SiteParameters.dynamic_srcset_active === '1') { 13753 UNCODE.refresh_dynamic_srcset_size(); 13754 } 13755 13756 if (typeof UNCODE.menuSmartInit !== 'undefined') { 13757 UNCODE.menuSmartInit(); 13758 } 13759 13760 if (typeof UNCODE.parallax !== 'undefined') { 13761 UNCODE.parallax(); 13762 } 13763 13764 maybe_scroll_to_top(); 13765 13766 var woo_select2_cats = $('.dropdown_product_cat'); 13767 13768 if (woo_select2_cats.length > 0) { 13769 woo_select2_cats.on( 'change', function() { 13770 if ( $(this).val() != '' ) { 13771 var this_page = ''; 13772 var home_url = UncodeWCParameters.uncode_wc_widget_product_categories_home_url; 13773 if ( home_url.indexOf( '?' ) > 0 ) { 13774 this_page = home_url + '&product_cat=' + $(this).val(); 13775 } else { 13776 this_page = home_url + '?product_cat=' + $(this).val(); 13777 } 13778 location.href = this_page; 13779 } else { 13780 location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url; 13781 } 13782 }); 13783 13784 if ( $().selectWoo ) { 13785 var wc_product_cat_select = function() { 13786 woo_select2_cats.selectWoo( { 13787 placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder, 13788 minimumResultsForSearch: 5, 13789 width: '100%', 13790 allowClear: true, 13791 language: { 13792 noResults: function() { 13793 return UncodeWCParameters.uncode_wc_widget_product_categories_no_results; 13794 } 13795 } 13796 } ); 13797 }; 13798 wc_product_cat_select(); 13799 } 13800 } 13801 13802 $(document).trigger('uncode-ajax-filtered'); 13803 $(document.body).trigger('init_price_filter'); 13804 window.dispatchEvent(new CustomEvent('uncode-ajax-filtered')); 13805 window.document.dispatchEvent(new Event("DOMContentLoaded", { 13806 bubbles: true, 13807 cancelable: true 13808 })); 13809 13810 isAjaxing = false;
13811 } 13812 }, 13813 error: function() { 13814 container.removeClass('grid-filtering'); 13815 13816 isAjaxing = false; 13817 13818 if (SiteParameters.enable_debug == true) { 13819 // This console log is disabled by default 13820 // So nothing is printed in a typical installation 13821 // 13822 // It can be enabled for debugging purposes setting 13823 // the 'uncode_enable_debug_on_js_scripts' filter to true 13824 console.log('There was an error retrieving the products'); 13825 } 13826 } 13827 }); 13828 } 13829 13830 // Scroll to top after filtering 13831 function maybe_scroll_to_top() { 13832 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 13833 13834 if (offcanvas_sidebar_wrapper.length > 0) { 13835 return; 13836 } 13837 13838 var container = get_filters_container(); 13839 var bound = container[0].getBoundingClientRect(); 13840 13841 if (bound.y < 0) { 13842 $(window).scrollTop(container.offset().top); 13843 } 13844 } 13845 13846 // Back/forward browser buttons 13847 $(window).on("popstate.ajaxfilters", function(e) { 13848 var location = window.location; 13849 var url = location.href; 13850 var params = UNCODE.getURLParams(window.location); 13851 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 13852 13853 UNCODE.lastURL = url; 13854 13855 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params)) || params.form !== undefined) { 13856 return; 13857 } 13858 13859 var container = get_filters_container(); 13860 13861 reload_items(container, url, false); 13862 }); 13863 13864 // Destroy load more before to init a new one 13865 $(window).on('uncode-ajax-pre-filtered', function() { 13866 if ($.fn.infinitescroll) { 13867 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 13868 } 13869 }); 13870 13871 init_filters(); 13872}; 13873 13874UNCODE.videoThumbs = function() { 13875 var checkResize, 13876 newW = UNCODE.wwidth; 13877 var checkForVideos = function(){ 13878 13879 $(window).on('okevents.y.change', function(e, y){ 13880 var $video = $(y.target.g), 13881 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13882 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13883 restart = !$video_wrap.hasClass('play-pause'), 13884 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13885 setTime; 13886 if ( newW >= UNCODE.mediaQuery ) { 13887 13888 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 13889 $video_wrap.data('hovered', true); 13890 $video_wrap.addClass('played-on'); 13891 y.target.pauseVideo(); 13892 $tmb.on('mouseenter', function(){ 13893 if ( restart ) { 13894 y.target.seekTo(0); 13895 } 13896 y.target.playVideo(); 13897 }).on('mouseleave', function(){ 13898 clearTimeout(setTime); 13899 setTime = setTimeout(function(){ 13900 y.target.pauseVideo(); 13901 }, 300); 13902 }); 13903 } 13904 13905 } else { 13906 if( $mobile_video_wrap.length ) { 13907 $video_wrap.addClass('played-on'); 13908 y.target.playVideo(); 13909 } 13910 } 13911 13912 }); 13913 13914 $(window).on('okevents.v.loaded', function(e, playerV){ 13915 var $video = $(playerV.element), 13916 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13917 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13918 restart = !$video_wrap.hasClass('play-pause'), 13919 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 13920 setTime; 13921 13922 if ( newW >= UNCODE.mediaQuery ) { 13923 13924 if( $video_wrap.length ) { 13925 13926 var playPromise = playerV.play(); 13927 if (playPromise !== undefined) { 13928 playPromise.then(function( value ) { 13929 playerV.pause(); 13930 }); 13931 } 13932 $video_wrap.addClass('played-on'); 13933 $tmb.on('mouseenter', function(){ 13934 if ( restart ) { 13935 playerV.setCurrentTime(0) 13936 } 13937 playerV.play(); 13938 }).on('mouseleave', function(){ 13939 clearTimeout(setTime); 13940 setTime = setTimeout(function(){ 13941 playerV.pause(); 13942 }, 300); 13943 }); 13944 } 13945 13946 } else { 13947 13948 if( $mobile_video_wrap.length ) { 13949 var playPromise = playerV.play(); 13950 if (playPromise !== undefined) { 13951 playPromise.then(function( value ) { 13952 playerV.play(); 13953 }); 13954 } 13955 $video_wrap.addClass('played-on'); 13956 } 13957 } 13958 }); 13959 13960 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 13961 var $video = $(video), 13962 $noscript = $('noscript', $video), 13963 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 13964 restart = !$video_wrap.hasClass('play-pause'), 13965 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 13966 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
13966: $video.closest('.t-entry-visual, .un-inline-image'), 13967 setTime, 13968 manageVideo = function(){ 13969 video.currentTime = 0; 13970 video.pause(); 13971 if ( newW >= UNCODE.mediaQuery ) { 13972 if ( $video_wrap.length ) { 13973 $video_wrap.addClass('played-on'); 13974 $tmb.on('mouseenter', function(){ 13975 if ( restart ) { 13976 video.currentTime = 0; 13977 } 13978 video.play(); 13979 }).on('mouseleave', function(){ 13980 clearTimeout(setTime); 13981 setTime = setTimeout(function(){ 13982 video.pause(); 13983 }, 300); 13984 }); 13985 } else { 13986 video.play(); 13987 } 13988 } else { 13989 if ( $mobile_video_wrap.length ) { 13990 $mobile_video_wrap.addClass('played-on'); 13991 video.play(); 13992 } 13993 } 13994 13995 }; 13996 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 13997 $noscript.each(function(key, val){ 13998 $noscript.after(val.textContent || val.innerText || val.innerHTML); 13999 $noscript.remove(); 14000 }); 14001 } 14002 14003 if (typeof MediaElement === "function") { 14004 $video.has('source[src]').mediaelementplayer({ 14005 pauseOtherPlayers: false, 14006 }); 14007 } 14008 if (video.readyState > 0) { 14009 manageVideo(); 14010 } else { 14011 $video.on("loadedmetadata", function(_event) { 14012 manageVideo(); 14013 }); 14014 }; 14015 }); 14016 14017 }; 14018 14019 checkForVideos(); 14020 14021 var checkVideoResize = function(){ 14022 clearRequestTimeout(checkResize); 14023 checkResize = requestTimeout(function(){ 14024 if ( newW !== UNCODE.wwidth ) { 14025 checkForVideos(); 14026 newW = UNCODE.wwidth; 14027 } 14028 }, 1000); 14029 }; 14030 14031 $(window).off('resize.videos', checkVideoResize) 14032 .on( 'resize.videos', checkVideoResize); 14033 14034 $(window).off('more-items-loaded.videos', checkForVideos) 14035 .on('more-items-loaded.videos', checkForVideos); 14036 14037 $(document).off('uncode-ajax-filtered.videos', checkForVideos) 14038 .on('uncode-ajax-filtered.videos', checkForVideos); 14039 14040}; 14041UNCODE.inlineImgs = function() { 14042 var linkInlineImgs = function(){ 14043 $('.un-inline-image').each(function(){ 14044 var $img = $(this), 14045 href = $(this).attr('data-link-href'), 14046 dataImg = $img.data(); 14047 if ( dataImg != '' && href != null && href !== '' ) { 14048 var class_stra_a = 'unline-image-link'; 14049 if ( $(this).hasClass('un-inline-space-over') ) { 14050 class_stra_a += ' un-inline-space-over'; 14051 } else if ( $(this).hasClass('un-inline-space-gutter') ) { 14052 class_stra_a += ' un-inline-space-gutter'; 14053 } 14054 var str_a = '<a class="' + class_stra_a + '" '; 14055 for (var key in dataImg) { 14056 if (dataImg.hasOwnProperty(key) && key.startsWith("link")) { 14057 str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\""; 14058 } 14059 } 14060 str_a += ' />'; 14061 $img.wrap(str_a); 14062 } 14063 }); 14064 }; 14065 $(window).on('load', linkInlineImgs ); 14066}; 14067UNCODE.lottie = function() { 14068 if ( SiteParameters.is_frontend_editor ) { 14069 var $lottie_wraps = $('div.uncode-lottie-wrap'); 14070 $lottie_wraps.each(function(){ 14071 var $lottie_wrap = $(this), 14072 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 14073 $player_clone = $div_player.clone(), 14074 player_id = $div_player.attr('data-id'), 14075 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 14076 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 14077 if ( $('#'+player_id).length ) { 14078 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 14079 } 14080 $player_clone.attr('id', player_id); 14081 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 14082 $div_player.after($player_clone); 14083 $div_player.attr('data-init',true); 14084 } 14085 }); 14086 } 14087 var $players = $('.uncode-lottie-wrap lottie-player'); 14088 $players.each(function(){ 14089 var player = this, 14090 this_id = $(player).attr('id'), 14091 _player = document.getElementById(this_id), 14092 trigger = $(player).attr('data-trigger'), 14093 pFrames = $(player).attr('data-frames').split(','), 14094 srcPlayer = $(player).attr('src'); 14095 14096 _player.load(srcPlayer); 14097 14098 _player.addEventListener("ready", function() { 14099 14100 var $_shadow = _player.shadowRoot; 14101 $($_shadow).find('.error').remove(); 14102 14103 var tFrames = _player.getLottie().totalFrames / 100, 14104 pFrame_from = Math.round(tFrames * pFrames[0]), 14105 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 14106 loop = $(player).attr('loop'), 14107 mode, 14108 actions; 14109 14110 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 14111 if ( trigger === 'scroll' ) { 14112 mode = 'scroll'; 14113 actions = [ 14114 { 14115 visibility:[0, 1.0], 14116 type: "seek",
14117 frames: [pFrame_from, pFrame_to], 14118 } 14119 ]; 14120 } else if ( trigger === 'viewport') { 14121 mode = 'scroll'; 14122 actions = [ 14123 { 14124 visibility: [0.20, 1.0], 14125 frames: [pFrame_from, pFrame_to], 14126 type: loop ? "loop" : "play" 14127 } 14128 ]; 14129 } else if ( trigger === 'hover') { 14130 $(player).on('mouseenter', function(){ 14131 _player.play(); 14132 }).on('mouseleave', function(){ 14133 _player.pause(); 14134 }); 14135 if ( pFrame_from > 0 && pFrame_from < 99 ) { 14136 _player.seek(pFrame_from); 14137 _player.addEventListener("frame", function(){ 14138 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14139 _player.seek(pFrame_from); 14140 } 14141 }); 14142 } 14143 } 14144 LottieInteractivity.create({
14145 player: '#' + this_id, 14146 mode: mode, 14147 actions: actions 14148 }); 14149 } else { 14150 if ( pFrame_from > 0 && pFrame_from < 99 ) { 14151 _player.seek(pFrame_from); 14152 _player.addEventListener("frame", function(){ 14153 if ( _player.getLottie().currentFrame >= pFrame_to ) { 14154 _player.seek(pFrame_from); 14155 } 14156 }); 14157 } 14158 } 14159 }); 14160 14161 $(window).on('unlottie-destroy', function(){ 14162 _player.destroy(); 14163 }); 14164 }); 14165}; 14166 14167UNCODE.animatedBgGradient = function( _el ) { 14168 14169 var ev; 14170 14171 if ( typeof _el === 'undefined' || _el === null ) { 14172 _el = document; 14173 ev = false; 14174 } else { 14175 _el = _el[0]; 14176 ev = 'shortcode:update'; 14177 } 14178 14179 var simplex = new SimplexNoise(); 14180 14181 var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) { 14182 this.block = blockOverlay; 14183 this.wrap = canvasWrap; 14184 this.config(); 14185 this.checker(); 14186 this.loopRAF(); 14187 this.animLoader(); 14188 }; 14189 14190 var AnimGradient = Uncode_BG_Animated_Gradient.prototype; 14191 14192 AnimGradient.config = function() { 14193 this.canvas = document.createElement('canvas'); 14194 this.wrap.appendChild(this.canvas); 14195 this.ctx = this.canvas.getContext('2d'); 14196 this.count = 0; 14197 this.isOrientationChanged = false; 14198 this.res = UNCODE.isMobile ? 90 : 110; 14199 this.resPercent = 100/this.res; 14200 this.resAround = this.resPercent/100; 14201 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; 14202 14203 this.canvas.classList.add('uncode-bg-animated-gradient'); 14204 this.canvas.setAttribute('height', this.res); 14205 this.canvas.setAttribute('width', this.res); 14206 this.canvas.style = 'height: 100%; position: relative; width:100%;'; 14207 14208 this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); 14209 14210 this.cx = this.canvas.width/2; 14211 this.cy = this.canvas.height/2; 14212 this.data = this.imgdata.data; 14213 14214 this.opts = { 14215 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, 14216 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, 14217 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 14218 }; 14219 14220 this.lavaTime = 1; 14221 this.bg_colors = []; 14222 14223 if ( this.opts.col_1st === false && this.opts.col_2nd === false ) { 14224 return; 14225 } 14226 14227 if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) { 14228 this.singleColor = true; 14229 } 14230 14231 if( this.opts.col_1st ) { 14232 14233 var rgbColor1 = this.hexToRGB(this.opts.col_1st); 14234 14235 this.bg_colors.push({ 14236 r: rgbColor1.r, 14237 g: rgbColor1.g, 14238 b: rgbColor1.b 14239 }); 14240 } 14241 14242 if( this.opts.col_2nd ) { 14243 14244 var rgbColor2 = this.hexToRGB(this.opts.col_2nd); 14245 14246 this.bg_colors.push({ 14247 r: rgbColor2.r, 14248 g: rgbColor2.g, 14249 b: rgbColor2.b 14250 }); 14251 } 14252 14253 }; 14254 14255 AnimGradient.checker = function() { 14256 var scope = this; 14257 this.checkInViewPort(); 14258 14259 window.addEventListener('resize', function() { 14260 if(UNCODE.isMobile && !scope.isOrientationChanged) { 14261 return; 14262 } 14263 scope.ratioCalc(); 14264 }); 14265 14266 window.addEventListener("orientationchange", function() { 14267 scope.isOrientationChanged = true; 14268 }); 14269 14270 this.ratioCalc(); 14271 }; 14272 14273 AnimGradient.ratioCalc = function() { 14274 14275 var blockW = this.block.clientWidth, 14276 blockH = this.block.clientHeight; 14277 14278 var blockRatio = blockH/blockW; 14279 14280 if(blockRatio < 1) { 14281 this.ratioParam = { 14282 x: 1.4, 14283 y: blockRatio*1.4 14284 } 14285 } else { 14286 this.ratioParam = { 14287 x: blockRatio/3, 14288 y: 1 14289 } 14290 } 14291 14292 }; 14293 14294 AnimGradient.checkInViewPort = function() { 14295 if( 'IntersectionObserver' in window ) { 14296 var scope = this, 14297 observer = new IntersectionObserver(function(entries) { 14298
14299 entries.forEach(function(entry){ 14300 if ( entry.isIntersecting ) { 14301 scope.isInViewport = true; 14302 } else { 14303 scope.isInViewport = false; 14304 } 14305 }); 14306 14307 }, { 14308 root: document, 14309 }); 14310 14311 observer.observe(this.block); 14312 } 14313 }; 14314 14315 AnimGradient.hexToRGB = function(hexval) { 14316 var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval); 14317 if (!hexecuted) { 14318 return false; 14319 } 14320 return { 14321 r: parseInt(hexecuted[1], 16), 14322 g: parseInt(hexecuted[2], 16), 14323 b: parseInt(hexecuted[3], 16) 14324 } 14325 }; 14326 14327 AnimGradient.factor = function(val_1, val_2, lava) { 14328 return val_1 * (1 - lava) + val_2 * lava; 14329 }; 14330 14331 AnimGradient.factorNoise = function(wave_l, x, y, noise) { 14332 if (this.singleColor) { 14333 return this.bg_colors[0][wave_l]; 14334 } 14335 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 ); 14336 // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) ); 14337 }; 14338 14339 AnimGradient.lava = function(x, y, grade) { 14340 var radians = (Math.PI / 180) * grade, 14341 cos = Math.cos(radians), 14342 sin = Math.sin(radians), 14343 nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx; 14344 return nx; 14345 }; 14346 14347 AnimGradient.loopRAF = function() { 14348 14349 var scope = this; 14350 14351 if( this.isInViewport ) { 14352 for (var x = 0; x < this.res; x++) { 14353 for (var y = 0; y < this.res; y++) { 14354 14355 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 14356 14357 this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise); 14358 this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise); 14359 this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise); 14360 this.data[(x + y * this.res) * 4 + 3] = noise*265; 14361 14362 } 14363 } 14364 14365 this.count++; 14366 14367 this.ctx.putImageData(this.imgdata, 0, 0); 14368 14369 } 14370 14371 requestAnimationFrame(function() { 14372 scope.loopRAF(); 14373 }); 14374 }; 14375 14376 AnimGradient.animLoader = function() { 14377 this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded'); 14378 }; 14379 14380 var anim_init = function() { 14381 var bgs = _el.querySelectorAll('.block-bg-overlay'); 14382 14383 bgs.forEach(function(blockOverlay) { 14384 var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap'); 14385 if( !blockOverlay || !canvasWrap ) { 14386 return; 14387 } 14388 new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap); 14389 }); 14390 } 14391 14392 $(window).on('load', function(){ 14393 anim_init(); 14394 }); 14395 14396 if ( ev === 'shortcode:update' ) { 14397 anim_init(); 14398 } 14399 14400}; 14401UNCODE.multibg = function(){ 14402 var $bgsWraps = $('.uncode-multi-bgs'), 14403 $body = $('body'); 14404 $bgsWraps.each(function(){ 14405 var $bgWrap = $(this), 14406 transition = $bgWrap.attr('data-transition'), 14407 transitionTime = $bgWrap.attr('data-transition-time'), 14408 dataPace = $bgWrap.attr('data-transition-pace'), 14409 dataThreshold = $bgWrap.attr('data-transition-threshold'), 14410 dataTime = $bgWrap.attr('data-carousel-time'), 14411 dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'), 14412 random = $bgWrap.attr('data-multi-random'), 14413 _bgWrap = $bgWrap[0], 14414 $multiBgs = $('.multi-background', $bgWrap), 14415 imgFirst, 14416 bgAmount = $multiBgs.length, 14417 isInViewport = false, 14418 lastScrollTop = 0, 14419 counter = 0, 14420 totMove = 0, 14421 autoScroll = typeof dataPace === 'undefined' && transition === 'scroll', 14422 pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ), 14423 threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0, 14424 offX, offY, 14425 wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250, 14426 carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000, 14427 requestCarousel, 14428 is_header = $bgWrap.closest('#page-header').length, 14429 startTime = new Date(); 14430 14431 transition = typeof transition === 'undefined' ? '' : transition; 14432 14433 if ( random === 'true' ) { 14434 UNCODE.shuffle($multiBgs); 14435 } 14436 14437 imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, ""); 14438 14439 var loadFirst = function(){
14440 $multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({ 14441 opacity: 1 14442 }, 250, 'easeInQuad').css({ 14443 zIndex: 1 14444 }); 14445 } 14446 14447 var loadError = function(){ 14448 console.log('Multi BG loading error'); 14449 } 14450 14451 UNCODE.checkImgLoad( imgFirst, loadFirst, loadError ); 14452 14453 var loadSlides = function( $thisBg ){ 14454 $thisBg.attr('data-load', 'loaded'); 14455 } 14456 14457 $multiBgs.not('[data-load="loaded"]').each(function(ind, val){ 14458 var $thisBg = $(val); 14459 14460 if ( typeof $thisBg !== 'undefined' && $thisBg.length ) { 14461 14462 var _imgBg = $(val).find('.background-inner').css('background-image'); 14463 14464 if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) { 14465 $thisBg.attr('data-load', 'loaded'); 14466 } else { 14467 _imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, ""); 14468 if ( typeof _imgBg !== 'undefined' ) { 14469 UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg ); 14470 } 14471 } 14472 } 14473 }); 14474 14475 var multiCarousel = function(e) { 14476 14477 clearRequestTimeout(requestCarousel); 14478 14479 var checkTime = new Date(); 14480 if ( checkTime - startTime >= carouselTime && isInViewport ) { 14481 var $checkEl = $multiBgs.eq((counter+1)%bgAmount); 14482 14483 if ( $checkEl.attr('data-load') !== 'loaded' ) { 14484 requestTimeout(function(){
14485 multiCarousel(); 14486 }, 100); 14487 return; 14488 } 14489 14490 counter++; 14491 14492 $multiBgs.each(function(ind, val){ 14493 if ( ind === counter%bgAmount ) { 14494 $(val).stop(true,false).animate({ 14495 opacity: 1 14496 }, wait, 'easeInQuad').css({ 14497 zIndex: 1 14498 }); 14499 } else { 14500 $(val).stop(true,false).animate({ 14501 opacity: 0 14502 }, wait, 'easeInQuad').css({ 14503 zIndex: 0 14504 }); 14505 } 14506 }); 14507 14508 } 14509 14510 if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 14511 requestCarousel = requestTimeout(multiCarousel, carouselTime); 14512 } 14513 14514 }; 14515 14516 var multiMove = function(e) { 14517 if ( $body.hasClass('navbar-hover') ) { 14518 return; 14519 } 14520 var checkTime = new Date(), 14521 bound = $bgWrap[0].getBoundingClientRect(), 14522 windowTop = (window.clientYOffset || document.documentElement.scrollTop); 14523 if (offX) { 14524 totMove += Math.sqrt( 14525 Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2) 14526 ); 14527 } 14528 if ( 14529 totMove >= pace && 14530 checkTime - startTime >= wait && 14531 e.clientX <= (bound.left + bound.width) && 14532 e.clientX >= bound.left && 14533 e.clientY <= (bound.top + bound.height) && 14534 e.clientY >= bound.top 14535 ) { 14536 counter++; 14537 startTime = checkTime; 14538 $multiBgs.each(function(ind, val){ 14539 if ( ind === counter%bgAmount ) { 14540 $(val).stop(true,false).animate({ 14541 opacity: 1 14542 }, wait, 'easeInQuad').css({ 14543 zIndex: 1 14544 }); 14545 } else { 14546 $(val).stop(true,false).animate({ 14547 opacity: 0 14548 }, wait, 'easeInQuad').css({ 14549 zIndex: 0 14550 }); 14551 } 14552 }); 14553 14554 totMove = 0; 14555 } 14556 14557 offX = e.clientX; 14558 offY = e.clientY; 14559 14560 }; 14561 14562 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14563 document.addEventListener("mousemove", multiMove); 14564 } 14565 14566 window.addEventListener('resize', function() { 14567 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 14568 document.removeEventListener("mousemove", multiMove); 14569 document.addEventListener("mousemove", multiMove); 14570 } 14571 }); 14572 14573 var lightLoopRAF = function() { 14574 14575 var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), 14576 checkTime = new Date(), 14577 bound = $bgWrap[0].getBoundingClientRect(), 14578 thresholdHeader = is_header ? 100 : threshold, 14579 rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace); 14580 if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) { 14581 counter++; 14582 lastScrollTop = scrollTop; 14583 startTime = checkTime; 14584 14585 $multiBgs.each(function(ind, val){ 14586 if ( ind === counter%bgAmount ) { 14587 $(val).stop(true,false).animate({ 14588 opacity: 1 14589 }, wait, 'easeInQuad').css({ 14590 zIndex: 1 14591 }); 14592 } else { 14593 $(val).stop(true,false).animate({ 14594 opacity: 0 14595 }, wait, 'easeInQuad').css({ 14596 zIndex: 0 14597 }); 14598 } 14599 }); 14600 14601 } 14602 14603 requestAnimationFrame(function() { 14604 if ( isInViewport ) { 14605 lightLoopRAF(); 14606 } 14607 }); 14608 }; 14609 14610 var currentInd = 0; 14611 14612 var loopRAF = function() { 14613 14614 var multiBgRotate = function(slideInd){ 14615 currentInd = slideInd; 14616 $multiBgs.each(function(ind, val){ 14617 if ( ind === slideInd ) { 14618 $(val).stop(true,false).animate({ 14619 opacity: 1 14620 }, wait, 'easeInQuad').css({ 14621 zIndex: 1 14622 }); 14623 } else { 14624 $(val).stop(true,false).animate({ 14625 opacity: 0 14626 }, wait, 'easeInQuad').css({ 14627 zIndex: 0 14628 }); 14629 } 14630 }); 14631 }; 14632 var bound = $bgWrap[0].getBoundingClientRect(), 14633 thresholdPX = UNCODE.wheight * threshold / 100, 14634 totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))), 14635 movePX = totMove / bgAmount, 14636 moving = UNCODE.wheight - (bound.top + thresholdPX), 14637 slideInd = 0; 14638 14639 if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) { 14640 multiBgRotate(0); 14641 } else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) { 14642 multiBgRotate(bgAmount-1); 14643 } else { 14644 slideInd = Math.ceil(moving/movePX) - 1; 14645 if ( slideInd < 0 ) { 14646 slideInd = 0; 14647 } else if ( slideInd >= bgAmount ) { 14648 slideInd = bgAmount-1; 14649 } 14650 if ( slideInd !== currentInd ) { 14651 multiBgRotate(slideInd); 14652 } 14653 } 14654 14655 requestAnimationFrame(function() { 14656 if ( isInViewport ) { 14657 loopRAF(); 14658 } 14659 }); 14660 }; 14661 14662 if( 'IntersectionObserver' in window ) { 14663 var observer = new IntersectionObserver(function(entries) { 14664
14665 entries.forEach(function(entry){ 14666 if ( entry.isIntersecting ) { 14667 isInViewport = true; 14668 if ( transition === 'scroll' ) { 14669 if ( autoScroll ) { 14670 loopRAF(); 14671 } else { 14672 lightLoopRAF(); 14673 } 14674 } else { 14675 multiCarousel(); 14676 } 14677 } else { 14678 isInViewport = false; 14679 } 14680 }); 14681 14682 }, { 14683 root: document, 14684 rootMargin: is_header ? '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px' 14685 }); 14686 14687 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14688 observer.observe(_bgWrap); 14689 } 14690 14691 window.addEventListener('resize', function() { 14692 observer.unobserve(_bgWrap); 14693 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 14694 observer.observe(_bgWrap); 14695 } 14696 }); 14697 14698 } 14699 14700 }); 14701} 14702 14703UNCODE.owlNav = function(target, ev) { 14704 target = target.replace(/#\S+/g, ''); 14705 var $carousel = $('#'+target), 14706 $slider = $carousel.closest('.uncode-slider'), 14707 $checkNavs = $('.uncode-owl-nav'); 14708 if ( !$checkNavs.length ) { 14709 return; 14710 } 14711 14712 if ( $slider.length ){ 14713 target = $slider.attr('id'); 14714 } 14715 14716 var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'), 14717 $row; 14718 14719 if ( ! $navs.length ) { 14720 $row = $carousel.closest('.vc_row.row-container'); 14721 $navs = $('.uncode-owl-nav:not([data-target])', $row); 14722 } 14723 14724 if ( ! $navs.length ) { 14725 return; 14726 } 14727 14728 $navs.each(function(){ 14729 var $nav = $(this), 14730 $outer = $nav.closest('.uncode-owl-nav-out'), 14731 $inner = $nav.find('.uncode-owl-nav-in'), 14732 $navDots = $('.uncode-nav-dots', $nav), 14733 $navCounter = $('.uncode-nav-counter', $nav), 14734 $counterIndex = $('.uncode-nav-counter-index', $navCounter), 14735 $counterTotal = $('.uncode-nav-counter-total', $navCounter), 14736 skinInherit = $nav.hasClass('skin-inherit'), 14737 digit = parseFloat($nav.attr('data-digit')), 14738 counterDigit = parseFloat($nav.attr('data-counter-digit')), 14739 navSpeed = parseFloat($carousel.attr('data-navspeed')); 14740 navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400; 14741 14742 if ( $nav.hasClass('pos-abs') ){ 14743 if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) { 14744 $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />'); 14745 } 14746 $carousel.closest('.owl-carousel-wrapper-nav').append($outer); 14747 } 14748 14749 $carousel.on('refreshed.owl.carousel', counter); 14750 $carousel.on('resized.owl.carousel', counter); 14751 $carousel.on('changed.owl.carousel', counter); 14752 14753 var totalSlides = 0; 14754 14755 function counter(event) { 14756 if (!event.namespace) { 14757 return; 14758 } 14759 var slides = event.relatedTarget, 14760 current = slides._current, 14761 loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop, 14762 item = event.item, 14763 page = event.page, 14764 countPages = Math.ceil(item.count / page.size), 14765 $currentSlide = $carousel.find('.owl-item').eq(current), 14766 itemIndex = Math.floor($currentSlide.attr('data-index')) , 14767 activeSlide = Math.ceil(itemIndex / page.size), 14768 $prev = $nav.find('.uncode-nav-prev'), 14769 $next = $nav.find('.uncode-nav-next'), 14770 $col = $currentSlide.find('.uncol').first(); 14771 14772 if ( totalSlides != countPages ) { 14773 totalSlides = countPages; 14774 $navDots.html(''); 14775 var nav_html = ''; 14776 for (var sl_ind = 0; sl_ind < countPages; sl_ind++) { 14777 var padN = sl_ind+1; 14778 if ( digit && digit > 1 ) { 14779 padN = String(padN).padStart(digit, '0'); 14780 } 14781 nav_html += '<button class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '" tabindex="0"><span>' + padN + '</span></button>'; 14782 } 14783 $navDots.html(nav_html); 14784 14785 var totalSlidesDigit = totalSlides; 14786 14787 if ( counterDigit && counterDigit > 1 ) { 14788 totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0'); 14789 } 14790 $counterTotal.html(totalSlidesDigit); 14791 } 14792 14793 if ( loop !== true ) { 14794 $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled'); 14795 if ( itemIndex === 1 ) { 14796 $prev.addClass('uncode-nav-disabled'); 14797 } else if ( ( itemIndex - 1 + page.size ) >= item.count ) { 14798 $next.addClass('uncode-nav-disabled');
14799 activeSlide = Math.ceil(item.count / page.size); 14800 } 14801 } 14802 14803 $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index'); 14804 var activeSlideDigit = activeSlide; 14805 14806 if ( counterDigit && counterDigit > 1 ) { 14807 activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0'); 14808 } 14809 $counterIndex.html(activeSlideDigit); 14810 14811 if ( skinInherit ) { 14812 if ( $col.hasClass('style-light') ){ 14813 $nav.removeClass('style-dark').addClass('style-light'); 14814 } else if ( $col.hasClass('style-dark') ) { 14815 $nav.removeClass('style-light').addClass('style-dark'); 14816 } 14817 } 14818 14819 $inner.removeClass('uncode-owl-nav-waiting'); 14820 14821 if ( $nav.hasClass('outer-width') ) { 14822 var navW = $nav.outerWidth(), 14823 nexW = $next.outerWidth(), 14824 prevW = $prev.outerWidth(), 14825 margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) ); 14826 14827 if ( $nav.hasClass('h-align-justify') ) { 14828 $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'}); 14829 if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) { 14830 $inner.css({'margin': 'auto'}); 14831 } else { 14832 $inner.css({'margin': ''}); 14833 } 14834 } else { 14835 $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'}); 14836 if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) { 14837 $inner.css({'margin': 'auto'}); 14838 } else { 14839 $inner.css({'margin': ''}); 14840 } 14841 } 14842 } 14843 } 14844 14845 $nav.on('click', '.uncode-nav-index', function(){ 14846 var $bullet = $(this), 14847 slide_index = parseFloat( $bullet.attr('data-key') ); 14848 $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]); 14849 }); 14850 $nav.on('click', '.uncode-nav-prev', function(){ 14851 $carousel.trigger('prev.owl.carousel', [navSpeed]); 14852 }); 14853 $nav.on('click', '.uncode-nav-next', function(){ 14854 $carousel.trigger('next.owl.carousel', [navSpeed]); 14855 }); 14856 14857 if ( $nav.hasClass('animated-arrows') ) { 14858 $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){ 14859 $(this).addClass("hover"); 14860 }).on('animationend', function(){ 14861 $(this).removeClass("hover"); 14862 }); 14863 } 14864 14865 var positionNav = function(){ 14866 if ( $nav.hasClass('window-width') ) { 14867 var navOff = parseFloat( $nav.offset().left ) * -1; 14868 if ( navOff > 0 ) { 14869 $inner.css({ transform: 'translateX(' + navOff + 'px)' }); 14870 } else { 14871 $inner.css({ transform: 'none' }); 14872 } 14873 } 14874 } 14875 positionNav(); 14876 $(window).on('resize', positionNav); 14877 }); 14878 14879 $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended'); 14880}; 14881 14882 UNCODE.init = function() { 14883 var wfl_check = false, wfl_request, waypoint_request; 14884 UNCODE.preventDoubleTransition(); 14885 UNCODE.betterResize(); 14886 UNCODE.utils(); 14887 UNCODE.magnetic(); 14888 if (typeof UNCODE.accessibility !== 'undefined') { 14889 UNCODE.accessibility(); 14890 } 14891 if (typeof UNCODE.rowParallax !== 'undefined') { 14892 UNCODE.rowParallax(); 14893 } 14894 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 14895 UNCODE.changeSkinOnScroll(); 14896 } 14897 if (typeof UNCODE.share !== 'undefined') { 14898 UNCODE.share(); 14899 } 14900 if (typeof UNCODE.tooltip !== 'undefined') { 14901 UNCODE.tooltip(); 14902 } 14903 if (typeof UNCODE.counters !== 'undefined') { 14904 UNCODE.counters(); 14905 } 14906 if (typeof UNCODE.countdowns !== 'undefined') { 14907 UNCODE.countdowns(); 14908 } 14909 if (typeof UNCODE.tabs !== 'undefined') { 14910 UNCODE.tabs(); 14911 } 14912 if (typeof UNCODE.collapse !== 'undefined') { 14913 UNCODE.collapse(); 14914 } 14915 if (typeof UNCODE.bigText !== 'undefined') { 14916 UNCODE.bigText(); 14917 } 14918 UNCODE.menuSystem(); 14919 if (typeof UNCODE.bgChanger !== 'undefined') { 14920 UNCODE.bgChanger(); 14921 } 14922 if (typeof UNCODE.magicCursor !== 'undefined') { 14923 UNCODE.magicCursor(); 14924 } 14925 if (typeof UNCODE.magneticCursor !== 'undefined') { 14926 UNCODE.magneticCursor(); 14927 } 14928 if (typeof UNCODE.dropImage !== 'undefined') { 14929 UNCODE.dropImage(); 14930 } 14931 if (typeof UNCODE.postTable !== 'undefined') { 14932 UNCODE.postTable(); 14933 } 14934 if (typeof UNCODE.rotatingTxt !== 'undefined') { 14935 UNCODE.rotatingTxt(); 14936 } 14937 if (typeof UNCODE.okvideo !== 'undefined') { 14938 UNCODE.okvideo(); 14939 window.addEventListener( "uncode-more-items-loaded", function() { 14940 UNCODE.okvideo("uncode-more-items-loaded"); 14941 }); 14942 } 14943 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 14944 UNCODE.backgroundSelfVideos(); 14945 } 14946 UNCODE.tapHover(); 14947 if (typeof UNCODE.isotopeLayout !== 'undefined') { 14948 UNCODE.isotopeLayout(); 14949 } 14950 if (typeof UNCODE.justifiedGallery !== 'undefined') { 14951 UNCODE.justifiedGallery(); 14952 } 14953 if (typeof UNCODE.cssGrid !== 'undefined') { 14954 UNCODE.cssGrid(); 14955 } 14956 if (typeof UNCODE.linearGrid !== 'undefined') { 14957 UNCODE.linearGrid(); 14958 } 14959 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 14960 UNCODE.lightbox(); 14961 } 14962 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 14963 $(window).on('load more-items-loaded',function(){ 14964 UNCODE.lightgallery(); 14965 }); 14966 } 14967 if (typeof UNCODE.carousel !== 'undefined') { 14968 UNCODE.carousel($('body')); 14969 } 14970 if (typeof UNCODE.lettering !== 'undefined') { 14971 UNCODE.lettering(); 14972 } 14973 UNCODE.animations(); 14974 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 14975 UNCODE.stickyElements(); 14976 } 14977 if (typeof UNCODE.twentytwenty !== 'undefined') { 14978 UNCODE.twentytwenty(); 14979 } 14980 UNCODE.disableHoverScroll(); 14981 UNCODE.printScreen(); 14982 if (typeof UNCODE.particles !== 'undefined') { 14983 UNCODE.particles(); 14984 } 14985 if (typeof UNCODE.filters !== 'undefined') { 14986 UNCODE.filters(); 14987 } 14988 if (typeof UNCODE.ajax_filters !== 'undefined') { 14989 UNCODE.ajax_filters(); 14990 } 14991 if (typeof UNCODE.widgets !== 'undefined') { 14992 UNCODE.widgets(); 14993 } 14994 if (typeof UNCODE.unmodal !== 'undefined') { 14995 UNCODE.unmodal(); 14996 } 14997 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 14998 if ( !UNCODE.isFullPage ) { 14999 UNCODE.checkScrollForTabs(); 15000 } 15001 } 15002 if (typeof UNCODE.onePage !== 'undefined') { 15003 UNCODE.onePage(UNCODE.isMobile); 15004 } 15005 if (typeof UNCODE.fullPage !== 'undefined') { 15006 $(document).ready(function(){ 15007 UNCODE.fullPage(); 15008 }); 15009 } 15010 if (typeof UNCODE.skewIt !== 'undefined') { 15011 UNCODE.skewIt(); 15012 } 15013 if (typeof UNCODE.rotateIt !== 'undefined') { 15014 UNCODE.rotateIt(); 15015 } 15016 if (typeof UNCODE.textMarquee !== 'undefined') { 15017 UNCODE.textMarquee(); 15018 } 15019 if (typeof UNCODE.stickyScroll !== 'undefined') { 15020 UNCODE.stickyScroll(); 15021 } 15022 if (typeof UNCODE.stickyTrigger !== 'undefined') { 15023 UNCODE.stickyTrigger(); 15024 } 15025 if (typeof UNCODE.areaTextReveal !== 'undefined') { 15026 UNCODE.areaTextReveal(); 15027 }
15028 if (typeof UNCODE.thumbsReveal !== 'undefined') { 15029 UNCODE.thumbsReveal(); 15030 } 15031 if (typeof UNCODE.verticalText !== 'undefined') { 15032 UNCODE.verticalText(); 15033 } 15034 if (typeof UNCODE.videoThumbs !== 'undefined') { 15035 UNCODE.videoThumbs(); 15036 } 15037 if (typeof UNCODE.revslider !== 'undefined') { 15038 UNCODE.revslider(); 15039 } 15040 if (typeof UNCODE.layerslider !== 'undefined') { 15041 UNCODE.layerslider(); 15042 } 15043 if (typeof UNCODE.lottie !== 'undefined') { 15044 UNCODE.lottie(); 15045 } 15046 if (typeof UNCODE.inlineImgs !== 'undefined') { 15047 UNCODE.inlineImgs(); 15048 } 15049 if (typeof UNCODE.animatedBgGradient !== 'undefined') { 15050 UNCODE.animatedBgGradient(); 15051 } 15052 if (typeof UNCODE.readMoreCol !== 'undefined') { 15053 UNCODE.readMoreCol(); 15054 } 15055 if (typeof UNCODE.multibg !== 'undefined') { 15056 UNCODE.multibg(); 15057 } 15058 if (typeof UNCODE.flexEqual !== 'undefined') { 15059 UNCODE.flexEqual(); 15060 } 15061 $(window).on('load',function(){ 15062 clearRequestTimeout(waypoint_request); 15063 waypoint_request = requestTimeout( function(){ 15064 Waypoint.refreshAll(); 15065 }, 1000); 15066 }); 15067 $(window).one('load',function(){ 15068 if (typeof UNCODE.parallax !== 'undefined') { 15069 UNCODE.parallax(); 15070 } 15071 }); 15072 } 15073 15074 if ( ! SiteParameters.is_frontend_editor ) { 15075 UNCODE.init(); 15076 } 15077 15078 15079})(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.