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 55UNCODE.betterResize = function() { 56 var setResize, 57 doubleResize = true, 58 oldW = UNCODE.wwidth; 59 $(window).on( 'resize orientationchange', function(){ 60 if ( oldW === UNCODE.wwidth ) { 61 return; 62 } else { 63 oldW = UNCODE.wwidth; 64 $(window).trigger('wwResize'); 65 } 66 }); 67}; 68 69Number.isInteger = Number.isInteger || function(value) { 70 return typeof value === "number" && 71 isFinite(value) && 72 Math.floor(value) === value; 73}; 74 75UNCODE.utils = function() { 76 $(document).on('mouseover', 'a', function() { 77 $(this).attr('data-title', $(this).attr('title')); 78 $(this).removeAttr('title'); 79 }); 80 $(document).on('mouseout', 'a', function() { 81 $(this).attr('title', $(this).attr('data-title')); 82 $(this).removeAttr('data-title'); 83 }); 84 85 this.get_scroll_offset = function(e) { 86 87 var scroll_offset = 0, 88 target, 89 trigger; 90 91 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 92 target = e.target; 93 trigger = e.currentTarget; 94 } 95 96 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 97 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 98 UNCODE.hideMenu(100); 99 } 100 } 101 102 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { 103 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 104 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 105 if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) { 106 if ( !$('.menu-hided').length ) { 107 scroll_offset += $('.logo-container:visible').outerHeight(); 108 } 109 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 110 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 111 scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink ); 112 } else { 113 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 114 scroll_offset += UNCODE.menuMobileHeight; 115 } else { 116 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 ) { 117 //scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 118 } else { 119 if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 120 scroll_offset += UNCODE.menuMobileHeight; 121 } 122 } 123 } 124 } 125 } 126 127 } 128 129 scroll_offset += UNCODE.bodyBorder; 130 131 return scroll_offset; 132 } 133 134 if ( !UNCODE.isFullPage ) { 135 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) { 136 137 var hash = (e.currentTarget).hash, 138 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 139 anchor = ''; 140 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 141 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 142 e.preventDefault(); 143 if (!$('#tab-reviews').is(':visible')) { 144 $('a[href="#tab-reviews"]').trigger('click'); 145 } 146 var calc_scroll = $('.wootabs .tab-content').offset().top; 147 calc_scroll -= UNCODE.get_scroll_offset(e); 148
149 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 150 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 151 152 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 153 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 154 } 155 } 156 157 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 158 delta = bodyTop - calc_scroll, 159 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 160 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 161 162 requestTimeout(function(){ 163 if (scrollSpeed == 0) { 164 $('html, body').scrollTop(calc_scroll); 165 UNCODE.scrolling = false; 166 } else { 167 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 168 $(this).stop(); 169 }).animate({ 170 scrollTop: calc_scroll 171 }, scrollSpeed, 'easeInOutCubic', function() { 172 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 173 UNCODE.scrolling = false; 174 } 175 ); 176 } 177 }, 200); 178 return; 179 } 180 if (hash != undefined) { 181 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 182 var anchor = this.hash.slice(1); 183 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 184 if ( !specialFormat.test(hash) ) { 185 if ( $(hash).length ) 186 anchor = $(hash); 187 } 188 } 189 } 190 191 if (is_scrolltop || anchor != '') { 192 if (is_scrolltop) { 193 e.preventDefault(); 194 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 195 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 196 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 197 198 if (scrollSpeed == 0) { 199 $('html, body').scrollTop(0); 200 UNCODE.scrolling = false; 201 } else { 202 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 203 $(this).stop(); 204 }).animate({ 205 scrollTop: 0 206 }, scrollSpeed, 'easeInOutCubic', function() { 207 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 208 UNCODE.scrolling = false; 209 }); 210 } 211 } else { 212 var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor; 213 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 214 var get_href = $(val).attr('href'); 215 if (get_href != undefined) { 216 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 217 else $(val).parent().removeClass('active'); 218 } 219 }); 220 if (scrollSection.length) { 221 if ( $('body').hasClass('uncode-scroll-no-history') ) { 222 e.preventDefault(); 223 } 224 225 if (UNCODE.menuOpened) { 226 if (UNCODE.wwidth < UNCODE.mediaQuery) { 227 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 228 } else { 229 $('.mmb-container-overlay .overlay-close').trigger('click'); 230 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 231 } 232 } 233 234 var calc_scroll = scrollSection.offset().top, 235 getOffset = UNCODE.get_scroll_offset(e), 236 $logo = $('.logo-container:visible'), 237 logoH, 238 $menu = $('#masthead .menu-container'), 239 menuH; 240 241 calc_scroll -= isNaN(getOffset) ? 0 : getOffset; 242 243 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 244 delta = bodyTop - calc_scroll, 245 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 246 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 247
248 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 249 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) { 250 logoH = $logo.outerHeight(), 251 menuH = $menu.outerHeight(); 252 if ( calc_scroll < ( logoH + menuH ) ) { 253 calc_scroll = 0; 254 } 255 } 256 } 257 258 if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) { 259 calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() ); 260 } 261 262 if (scrollSpeed == 0) { 263 $('html, body').scrollTop(calc_scroll); 264 UNCODE.scrolling = false; 265 } else { 266 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 267 $(this).stop(); 268 }).animate({ 269 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 270 }, scrollSpeed, 'easeInOutCubic', function() { 271 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 272 UNCODE.scrolling = false; 273 if ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 274 || 275 $('.menu-hided').length ) { 276 calc_scroll = scrollSection.offset().top; 277 getOffset = UNCODE.get_scroll_offset(e); 278 calc_scroll -= getOffset; 279 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 280 $(this).stop(); 281 }).animate({ 282 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 283 }, scrollSpeed, 'easeInOutCubic', function() { 284 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 285 UNCODE.scrolling = false; 286 } 287 ); 288 } 289 }); 290 } 291 } 292 } 293 } 294 }); 295 $('.header-scrolldown').on('click', function(event) { 296 297 event.preventDefault(); 298 299 var pageHeader = $(event.target).closest('#page-header'), 300 pageHeaderTop = pageHeader.offset().top, 301 pageHeaderHeight = pageHeader.outerHeight(), 302 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 303 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 304 305 var calc_scroll = pageHeaderTop + pageHeaderHeight, 306 getOffset = UNCODE.get_scroll_offset(event); 307 calc_scroll -= getOffset; 308 309 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 310 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 311 312 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 313 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 314 } 315 } 316 317 if (scrollSpeed == 0) { 318 $('html, body').scrollTop(calc_scroll); 319 UNCODE.scrolling = false; 320 } else { 321 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 322 $(this).stop(); 323 }).animate({ 324 scrollTop: calc_scroll 325 }, scrollSpeed, 'easeInOutCubic', function() { 326 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 327 UNCODE.scrolling = false; 328 if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) { 329 calc_scroll = pageHeaderTop + pageHeaderHeight; 330 getOffset = UNCODE.get_scroll_offset(event); 331 calc_scroll -= getOffset; 332 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 333 $(this).stop(); 334 }).animate({ 335 scrollTop: calc_scroll 336 }, scrollSpeed, 'easeInOutCubic', function() { 337 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 338 UNCODE.scrolling = false;
339 } 340 ); 341 } 342 } 343 ); 344 } 345 }); 346 } 347 348 // Colomun hover effect 349 // ================= 350 $(document).on('mouseenter', '.col-link', function(e) { 351 var uncol = $(e.target).prev('.uncol'), 352 el = uncol.find('.column-background'); 353 if (el) { 354 $('.btn-container .btn', uncol).toggleClass('active'); 355 var elOverlay = $(el[0]).find('.block-bg-overlay'); 356 if (elOverlay.length) { 357 var getOpacity = $(elOverlay).css('opacity'); 358 if (getOpacity != 1) { 359 getOpacity = Math.round(getOpacity * 100) / 100; 360 var newOpacity = getOpacity + .1; 361 $(elOverlay).data('data-opacity', getOpacity); 362 $(elOverlay).css('opacity', newOpacity); 363 } 364 } 365 } 366 }).on('mouseleave', '.col-link', function(e) { 367 var uncol = $(e.target).prev('.uncol'), 368 el = uncol.find('.column-background'); 369 $('.btn-container .btn', uncol).toggleClass('active'); 370 if (el) { 371 var elOverlay = $(el[0]).find('.block-bg-overlay'); 372 if (elOverlay.length) { 373 var getOpacity = $(elOverlay).data('data-opacity'); 374 $(elOverlay).css('opacity', getOpacity); 375 } 376 } 377 }); 378 379 // Admin bar 380 // ============ 381 var fixAdminBar = function() { 382 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 383 var getAdminBar = $('#wpadminbar'); 384 if (getAdminBar.length) { 385 if (getAdminBar.css('position') !== 'hidden') { 386 var getAdminBarHeight = getAdminBar.height(); 387 if (getAdminBar.css('position') === 'fixed') { 388 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 389 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 390 } else { 391 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 392 $('.body-borders .top-border').css({'margin-top':'0px'}); 393 } 394 } 395 } 396 } 397 }; 398 window.addEventListener('load', fixAdminBar); 399 window.addEventListener('resize', fixAdminBar); 400 // Print 401 // =========== 402 var beforePrint = function() { 403 window.dispatchEvent(new CustomEvent('resize')); 404 window.dispatchEvent(UNCODE.boxEvent); 405 }; 406 407 if (window.matchMedia) { 408 var mediaQueryList = window.matchMedia('print'); 409 mediaQueryList.addListener(function(mql) { 410 if (mql.matches) { 411 beforePrint(); 412 } 413 }); 414 } 415 416 window.onbeforeprint = beforePrint; 417 418 // Safari srcset 419 var safariSrcSet = function(){ 420 if ( !SiteParameters.is_frontend_editor ) { 421 $('html.safari img[sizes]').each(function(){ 422 var $img = $(this), 423 sizeImg = parseInt($img.attr('sizes')); 424 if ( typeof(sizeImg) === 'number' ) { 425 $img.attr('sizes', (sizeImg) + 'px'); 426 } 427 }); 428 } 429 }; 430 window.addEventListener('load', safariSrcSet); 431} 432 433UNCODE.lettering = function() { 434 435 var setCTA; 436 var highlightStill = function(){ 437 438 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 439 440 $.each($heading_texts, function(key, el) { 441 var $heading = $(el); 442 443 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 444 return; 445 } 446 447 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 448 return; 449 } 450 451 var waypoint = new Waypoint({ 452 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 453 element: el, 454 handler: function() { 455 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 456 anims_l = $anims.length; 457 $anims.each(function(_key_, _el_){ 458 var $anim = $(_el_); 459 460 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 461 $anim.addClass('heading-text-highlight-animated'); 462 463 if ( $heading.data('animate') === true ) { 464 $anim.css({ 465 '-webkit-transition-duration': '0ms', 466 '-moz-transition-duration': '0ms', 467 '-o-transition-duration': '0ms', 468 'transition-duration': '0ms', 469 }); 470 } else { 471 $anim.css({ 472 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 473 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 474 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 475 'transition-delay': ((_key_ + 2) * 200) + 'ms', 476 }); 477 } 478 } 479 480 }); 481 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 482 $heading.data('animate', true); 483 }); 484 $anims.removeAttr('data-animated'); 485 }, 486 offset: '100%' 487 }); 488 489 }); 490 491 Waypoint.refreshAll(); 492 $( document.body ).trigger('uncode_waypoints'); 493 494 } 495 496 requestTimeout(function(){ 497 highlightStill(); 498 $(window).on( 'resize', function(){ 499 clearRequestTimeout(setCTA); 500 setCTA = requestTimeout( highlightStill, 100 ); 501 }); 502 }, 400); 503 504}; 505 506UNCODE.isUnmodalOpen = false;
507 508var manageVideoSize = function(){ 509 510 var setVideoFit; 511 $('.wp-block-embed').each(function(){ 512 513 var $this = $(this); 514 515 if ( $('iframe', $this).length ) { 516 517 var $iframe = $('> iframe, > a > iframe', $this), 518 w = parseFloat($iframe.attr('width')), 519 h = parseFloat($iframe.attr('height')), 520 url = $iframe.attr('src'), 521 ratio, frW; 522 523 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 524 525 ratio = h / w; 526 var setResizeiFto, 527 resizeiFrame = function(){ 528 frW = $iframe.width(); 529 $iframe.css({ 530 height: frW * ratio 531 }); 532 }; 533 resizeiFrame(); 534 $(window).on( 'resize load', function(){ 535 clearRequestTimeout(setResizeiFto); 536 setResizeiFto = requestTimeout( function() { 537 resizeiFrame(); 538 }, 10 ); 539 }); 540 541 } 542 543 } 544 545 }); 546 547}; 548 549manageVideoSize(); 550 551UNCODE.vivus = function(icon, time, delay, file) { 552 if (typeof Vivus !== 'undefined') { 553 var icon_options = { 554 type: 'delayed', 555 pathTimingFunction: Vivus.EASE_OUT, 556 animTimingFunction: Vivus.LINEAR, 557 duration: time, 558 } 559 560 if (delay) { 561 icon_options.delayStart = delay; 562 } 563 564 if (file) { 565 icon_options.file = file; 566 } 567 568 new Vivus(icon, icon_options); 569 } 570}; 571 572UNCODE.lastURL = ''; 573 574UNCODE.getURLParams = function(current_location, is_string) { 575 var params = {}; 576 if (is_string) { 577 var url = current_location.split('?')[1]; 578 } else { 579 var url = current_location.search; 580 url = url.substring(1); 581 } 582 if (url) { 583 var parts = url.split('&'); 584 for (var i = 0; i < parts.length; i++) { 585 var nv = parts[i].split('='); 586 if (!nv[0]) { 587 continue; 588 } 589 params[nv[0]] = nv[1] || true; 590 } 591 } 592 return params; 593} 594 595UNCODE.hasEqualURLParams = function(obj1, obj2) { 596 for (var i in obj1) { 597 if (obj1.hasOwnProperty(i)) { 598 if (!obj2.hasOwnProperty(i)) { 599 return false; 600 } 601 if (obj1[i] != obj2[i]) { 602 return false; 603 } 604 } 605 } 606 for (var i in obj2) { 607 if (obj2.hasOwnProperty(i)) { 608 if (!obj1.hasOwnProperty(i)) { 609 return false; 610 } 611 if (obj1[i] != obj2[i]) { 612 return false; 613 } 614 } 615 } 616 return true; 617} 618 619UNCODE.changeSkinOnScroll = function(){ 620 if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { 621 return; 622 } 623 var $masthead = $('#masthead'), 624 transDesktop, 625 transMobile, 626 changeSkin, 627 628 checkTransparencyAndChange = function( $col ){ 629 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 630 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 631 changeSkin = $masthead.hasClass('menu-change-skin'); 632 633 if ( ! transDesktop && ! transMobile ) { 634 return false; 635 } 636 637 if ( ! changeSkin ) { 638 return false; 639 } 640 641 if ( $col.hasClass('style-light') ){ 642 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 643 return false; 644 } else if ( $col.hasClass('style-dark') ) { 645 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 646 return false; 647 } 648 }; 649 650 var prev_row = 'normal', 651 odd = true, 652 $rows = $('.vc_row[data-parent]:visible'); 653 $.each($rows, function(index, row){ 654 var $row = $(row), 655 $col = $('.uncol', $row).first(), 656 $slider = $('.uncode-slider', $row); 657 658 var wayDown = new Waypoint({ 659 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 660 element: row, 661 handler: function(direction) { 662 if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 663 if ( $slider.length ) { 664 $col = $('.owl-item.index-active .uncol', $slider).first(); 665 } 666 checkTransparencyAndChange($col); 667 } 668 if ( odd === false ) { 669 if ( row.hasAttribute('data-bg-changer') ) { 670 prev_row = 'bg-changer'; 671 } else { 672 prev_row = 'normal'; 673 } 674 odd = true; 675 } else { 676 odd = false; 677 } 678 }, 679 offset: function() { 680 return UNCODE.menuHeight / 2 681 } 682 }); 683 var wayUp = new Waypoint({ 684 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 685 element: row, 686 handler: function(direction) { 687 if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 688 if ( $slider.length ) { 689 $col = $('.owl-item.index-active .uncol', $slider).first(); 690 } 691 checkTransparencyAndChange($col); 692 } 693 if ( odd === false ) { 694 if ( row.hasAttribute('data-bg-changer') ) { 695 prev_row = 'bg-changer'; 696 } else { 697 prev_row = 'normal'; 698 } 699 odd = true; 700 } else { 701 odd = false;
702 } 703 }, 704 offset: function() { 705 return -row.clientHeight + ( UNCODE.menuHeight / 2 ) 706 } 707 }); 708 }); 709 710}; 711 712UNCODE.share = function() { 713 if (typeof Share !== 'undefined') { 714 var share_button_element = $('.share-button'); 715 var share_button_url = share_button_element.data('url'); 716 717 var share_button_config = { 718 ui: { 719 flyout: "top center", 720 button_font: false, 721 button_text: '', 722 icon_font: false 723 } 724 }; 725 726 if (share_button_url) { 727 share_button_config.url = share_button_url.replace("&", "%26"); 728 } 729 730 var share_button_top = new Share('.share-button', share_button_config); 731 } 732}; 733 734UNCODE.tooltip = function() { 735 if (typeof jQuery.fn.tooltip !== 'undefined') { 736 $('.btn-tooltip').tooltip(); 737 } 738}; 739 740UNCODE.counters = function() { 741 var $counters = $('.uncode-counter:not(.counter-init)'); 742 $counters.each(function(){ 743 var $counter = $(this).addClass('counter-init'); 744 if ( $counter.closest( '.owl-carousel' ).length ) { 745 return; 746 } 747 $counter.addClass('started').counterUp({ 748 delay: 10, 749 time: 1500 750 }); 751 }); 752}; 753 754UNCODE.countdowns = function() { 755 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 756 $countdowns.each(function() { 757 var $this = $(this).addClass('counter-init'), 758 finalDate = $(this).data('uncode-countdown'); 759 $this.countdown(finalDate, function(event) { 760 $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>')); 761 }); 762 }); 763}; 764 765UNCODE.tabs = function() { 766 767 var tabSwitcher = function($el){ 768 $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){ 769 var $navs = $(value), 770 $active = $('li.active', $navs), 771 $active_a = $('> a', $active), 772 $active_span = $('> span', $active_a), 773 vertical = $navs.closest('.vertical-tab-menu').length; 774 775 if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { 776 $navs.append('<span class="switcher-cursor" />'); 777 } 778 779 var $cursor = $('.switcher-cursor', $navs), 780 active_w = $('a', $active).outerWidth(), 781 span_w = $active_span.outerWidth(), 782 active_pos = $active.position(), 783 active_a_pos = $active_a.position(), 784 span_pos = $active_span.position(), 785 cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
786 cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; 787 788 cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); 789 790 if ( ! vertical ) { 791 $cursor.css({ 792 left: cursor_left, 793 width: cursor_w 794 }); 795 } 796 797 $navs.addClass('switch-init'); 798 }); 799 }; 800 801 var $body = $('body'); 802 tabSwitcher($body); 803 804 var tabHoverIntent = function(){ 805 var setHover; 806 $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') 807 .on('mouseover', function(e){ 808 var $this = $(e.target); 809 setHover = requestTimeout(function() { 810 $this.trigger('hover-int'); 811 }, 50); 812 }) 813 .on('mouseout', function(){ 814 clearRequestTimeout(setHover); 815 }); 816 }; 817 tabHoverIntent(); 818 819 var tabInit = function(){ 820 $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { 821 e.preventDefault() 822 var $el = $(this); 823 $el.tab('show'); 824 var $container = $el.closest('.uncode-tabs'); 825 tabSwitcher($container); 826 requestTimeout(function() { 827 window.dispatchEvent(UNCODE.boxEvent); 828 var $tabs = $(e.currentTarget).closest('.uncode-tabs'); 829 830 if ( $tabs.hasClass('tabs-trigger-box-resized') ) { 831 window.dispatchEvent(new CustomEvent('boxResized')); 832 } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { 833 window.dispatchEvent(new Event('resize')); 834 $(window).trigger('uncode.re-layout'); 835 } 836 837 var $active_panel = $('.tab-pane.active', $tabs); 838 839 $.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) { 840 var element = $(val), 841 delayAttr = element.attr('data-delay'); 842 if (delayAttr == undefined) delayAttr = 0; 843 requestTimeout(function() { 844 element.addClass('start_animation'); 845 }, delayAttr); 846 }); 847 848 }, 300); 849 850 var $li = $el.closest('li'), 851 mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 852 $('li', $container).not($li).find('.tab-pane').slideUp(250) 853 $('.tab-pane', $li).slideDown(250); 854 var completeSlideDown = requestTimeout(function(){ 855 if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { 856 var pos = $el.offset(), 857 rect = $el[0].getBoundingClientRect(), 858 $masthead = $('#masthead > .menu-container'), 859 considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; 860 861 if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { 862 $('html, body').animate({ 863 scrollTop: ( pos.top ) - considerMenu 864 },{ 865 easing: 'easeInOutQuad', 866 duration: 250 867 }); 868 } 869 } 870 }, 260); 871 }); 872 } 873 tabInit(); 874 875 var tabResponsive = function(){ 876 if ( SiteParameters.is_frontend_editor ) { 877 return true; 878 } 879 var $tabContainers = $('.tab-container.tabs-breakpoint'); 880 $tabContainers.each(function(){ 881 var $tabContainer = $(this), 882 $tabContent = $('.tab-content', $tabContainer), 883 $nav = $('.nav-tabs', $tabContainer), 884 mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 885 886 $('> li', $nav).each(function(){ 887 var $li = $(this), 888 dataID = $li.attr('data-tab-id'); 889 890 if ( UNCODE.wwidth <= mQuery ) { 891 if ( ! $('.tab-pane', $li ).length ) { 892 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); 893 $li.append($append_pane); 894 } 895 896 if ( $li.hasClass('active') ) { 897 $('> a', $li).click(); 898 } 899 } else { 900 if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { 901 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); 902 $tabContent.prepend($append_pane.removeAttr('style')); 903 } 904 } 905 }); 906 }); 907 908 } 909 tabResponsive(); 910 911 $(window).on('wwResize', function(){ 912 tabHoverIntent(); 913 tabSwitcher($body); 914 }); 915 916 var setCTA; 917 $(window).on( 'resize', function(){ 918 clearRequestTimeout(setCTA); 919 setCTA = requestTimeout( tabResponsive, 100 ); 920 }); 921 922 $('.nav-tabs').each(function(){ 923 var $nav = $(this), 924 $lis = $('> li:not(.active)', $nav), 925 $links = $('.tab-excerpt-link', $nav); 926 $('.tab-excerpt', $lis).slideUp(400, function(){ 927 $(this).addClass('init'); 928 }); 929 930 $links.each(function(){ 931 var $link = $(this), 932 $par_a = $link.closest('a'), 933 href = $link.attr('data-href'), 934 target = $link.attr('data-target'); 935 $par_a.addClass('inner-link'); 936 $link.on('click', function(){ 937 var _link = document.createElement('a'); 938 _link.href = href; 939 _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; 940 _link.click(); 941 }); 942 }); 943 $nav.addClass('tab-init'); 944 }); 945 946 $('.uncode-tabs.tabs-no-lazy').each(function(){ 947 var $tabs = $(this), 948 $panes = $('.tab-pane:not(.active)', $tabs); 949 $panes.each(function(){ 950 var $pane = $(this), 951 $imgs = $('img[loading="lazy"]', $pane); 952 $imgs.removeAttr('loading'); 953 $imgs.removeAttr('decoding'); 954 }); 955 }); 956 957}; 958UNCODE.collapse = function() { 959 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 960 var $this = $(this), 961 href 962 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 963 var $target = $(target) 964 var parent = $this.attr('data-parent') 965 var $parent = parent && $(parent) 966 var $title = $(this).parent() 967 var $accordion = $(e.target).closest('.uncode-accordion') 968 var $group = $this.closest('.group') 969 var $panel_group = $this.closest('.panel-group') 970 if ($parent) { 971 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 972 if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { 973 $title.removeClass('active'); 974 $group.removeClass('active-group'); 975 } else { 976 if ( $panel_group.attr('data-no-toggle') != true ) { 977 $parent.find('.panel-title').removeClass('active') 978 $parent.find('.group').removeClass('active-group') 979 } 980 $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') 981 $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') 982 } 983 } 984 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 985 requestTimeout(function() { 986 var $accordion = $(e.target).closest('.uncode-accordion'); 987 if ( $accordion.hasClass('tabs-trigger-box-resized') ) { 988 window.dispatchEvent(new CustomEvent('boxResized')); 989 } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { 990 window.dispatchEvent(new Event('resize')); 991 $(window).trigger('uncode.re-layout'); 992 } 993 994 var $active_panel = $('.panel.active-group', $parent); 995 996 $.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) { 997 var element = $(val), 998 delayAttr = element.attr('data-delay'); 999 if (delayAttr == undefined) delayAttr = 0; 1000 requestTimeout(function() { 1001 element.addClass('start_animation'); 1002 }, delayAttr); 1003 }); 1004 1005 }, 500); 1006 }); 1007 1008 $('.uncode-accordion.tabs-no-lazy').each(function(){ 1009 var $accordion = $(this), 1010 $panes = $('.panel:not(.active-group)', $accordion); 1011 $panes.each(function(){ 1012 var $pane = $(this), 1013 $imgs = $('img[loading="lazy"]', $pane); 1014 $imgs.removeAttr('loading'); 1015 $imgs.removeAttr('decoding'); 1016 }); 1017 }); 1018}; 1019 1020UNCODE.bigText = function(el) { 1021 if (el == undefined) { 1022 el = $('body'); 1023 } 1024 $.each($('.bigtext', el), function(index, val) { 1025 $(val).bigtext({ 1026 minfontsize: 24 1027 }); 1028 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 1029 opacity: 1 1030 }); 1031 requestTimeout(function() { 1032 if ($(val).find('.animate_when_almost_visible').length != 0) { 1033 $(val).css({opacity: 1}); 1034 } 1035 }, 400); 1036 }); 1037}; 1038 1039UNCODE.process_shortpixel_image = function(image) { 1040 var data = { 1041 action: 'shortpixel_manual_optimization', 1042 image_id: image,
1043 cleanup: true 1044 }; 1045 1046 $.get(SiteParameters.ajax_url, data); 1047}; 1048 1049UNCODE.menuSystem = function() { 1050 1051 function menuMobile() { 1052 var $body = $('body'), 1053 scrolltop, 1054 $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), 1055 $masthead = $('#masthead'), 1056 $box, 1057 $el, 1058 $el_transp, 1059 elHeight, 1060 offCanvasAnim, 1061 check, 1062 animating = false, 1063 stickyMobile = false, 1064 menuClose = new CustomEvent('menuMobileClose'), 1065 menuOpen = new CustomEvent('menuMobileOpen'); 1066 UNCODE.menuOpened = false; 1067 $mobileToggleButton.on('click', function(event) { 1068 event.stopPropagation(); 1069 var btn = this; 1070 if ($(btn).hasClass('overlay-close')) return; 1071 event.preventDefault(); 1072 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 1073 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 1074 $box = $(this).closest('.box-container').find('.main-menu-container'); 1075 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 1076 $el_transp = $('.menu-absolute.menu-transparent'); 1077 if (UNCODE.isMobile) { 1078 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 ) { 1079 stickyMobile = true; 1080 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 1081 } else { 1082 elHeight = 0; 1083 $.each($box.find('> div'), function(index, val) { 1084 elHeight += $(val).outerHeight(); 1085 }); 1086 } 1087 } else { 1088 elHeight = 0; 1089 $.each($el, function(index, val) { 1090 elHeight += $(val).outerHeight(); 1091 }); 1092 } 1093 var open = function() { 1094 clearTimeout(offCanvasAnim); 1095 if (!animating) { 1096 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 1097 scrolltop = $(window).scrollTop(); 1098 window.dispatchEvent(menuOpen); 1099 animating = true; 1100 UNCODE.menuOpened = true; 1101 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 1102 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 1103 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1104 } 1105 if ($('body.menu-offcanvas').length) { 1106 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1107 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1108 } else { 1109 if ( $('.menu-hide, .menu-sticky').length ) { 1110 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 1111 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1112 } 1113 } 1114 } 1115 } 1116 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { 1117 //$("#masthead")[0].scrollIntoView(); 1118 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1119 } 1120 $box.addClass('open-items'); 1121 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 1122 $el_transp.addClass('is_mobile_open'); 1123 } 1124 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1125 btn.classList.add('close'); 1126 $box.animate({ 1127 height: elHeight 1128 }, 600, "easeInOutCirc", function() { 1129 animating = false; 1130 if (!stickyMobile) $box.css('height', 'auto'); 1131 }); 1132 } else { 1133 animating = false; 1134 } 1135 } 1136 }; 1137 1138 var close = function() { 1139 clearTimeout(offCanvasAnim); 1140 if (!animating) { 1141 window.dispatchEvent(menuClose); 1142 animating = true; 1143 UNCODE.menuOpened = false;
1144 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1145 btn.classList.remove('close'); 1146 btn.classList.add('closing'); 1147 } 1148 $box.addClass('close'); 1149 requestTimeout(function() { 1150 $box.removeClass('close'); 1151 $box.removeClass('open-items'); 1152 btn.classList.remove('closing'); 1153 if ($el_transp.length) { 1154 $el_transp.removeClass('is_mobile_open'); 1155 } 1156 }, 500); 1157 $body.removeClass('opening-overlay-menu'); 1158 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1159 $box.animate({ 1160 height: 0 1161 }, { 1162 duration: 600, 1163 easing: "easeInOutCirc", 1164 complete: function(elements) { 1165 $(elements).css('height', ''); 1166 animating = false; 1167 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 1168 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 1169 } 1170 $body.removeClass('open-overlay-menu'); 1171 } 1172 }); 1173 } else { 1174 animating = false; 1175 offCanvasAnim = setTimeout(function(){ 1176 $body.removeClass('open-overlay-menu'); 1177 }, 1000); 1178 } 1179 } 1180 }; 1181 check = (!UNCODE.menuOpened) ? open() : close(); 1182 } 1183 }); 1184 1185 $('html').on('click', function(event){ 1186 if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { 1187 $('.uncode-close-offcanvas-mobile').trigger('click'); 1188 } 1189 }); 1190 1191 window.addEventListener('menuMobileTrigged', function(e) { 1192 $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); 1193 }); 1194 window.addEventListener('orientationchange', function(e) { 1195 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 1196 }); 1197 window.addEventListener("resize", function() { 1198 if ($(window).width() < UNCODE.mediaQuery) { 1199 if (UNCODE.isMobile) { 1200 var $box = $('.box-container .main-menu-container'), 1201 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 1202 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 1203 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 1204 elHeight = 0; 1205 $.each($el, function(index, val) { 1206 elHeight += $(val).outerHeight(); 1207 }); 1208 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; 1209 $($box).css('height', elHeight + 'px'); 1210 } 1211 } 1212 } 1213 } else { 1214 $('.menu-hide-vertical').removeAttr('style'); 1215 $('.menu-container-mobile').removeAttr('style'); 1216 $('.vmenu-container.menu-container').removeAttr('style'); 1217 } 1218 }); 1219 1220 $(window).on('scroll', function(){ 1221 if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { 1222 $(window).scrollTop(scrolltop); 1223 return false; 1224 } 1225 }); 1226 1227 }; 1228 1229 function menuOffCanvas() { 1230 var menuClose = new CustomEvent('menuCanvasClose'), 1231 menuOpen = new CustomEvent('menuCanvasOpen'); 1232 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { 1233 if ($(window).width() > UNCODE.mediaQuery) { 1234 if ( $('body.vmenu-offcanvas-overlay').length ) { 1235 if ($(event.currentTarget).hasClass('off-close')) { 1236 $(event.currentTarget).removeClass('off-close'); 1237 requestTimeout(function() { 1238 window.dispatchEvent(menuClose); 1239 }, 500); 1240 1241 } else { 1242 $(event.currentTarget).addClass('off-close'); 1243 window.dispatchEvent(menuOpen); 1244 } 1245 } else { 1246 if ($(event.currentTarget).hasClass('close')) { 1247 $(event.currentTarget).removeClass('close'); 1248 $(event.currentTarget).addClass('closing'); 1249 requestTimeout(function() { 1250 $(event.currentTarget).removeClass('closing'); 1251 window.dispatchEvent(menuClose); 1252 }, 500); 1253 1254 } else { 1255 $(event.currentTarget).addClass('close'); 1256 window.dispatchEvent(menuOpen); 1257 } 1258 } 1259 } 1260 1261 $('body').toggleClass('off-opened'); 1262 }); 1263 1264 $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ 1265 if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { 1266 var $vMenuCont = $('#masthead .vmenu-container'), 1267 $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), 1268 1269 vmenu_h = parseFloat( $vMenuCont.outerHeight() ), 1270 vmenu_w = parseFloat( $vMenuCont.outerWidth() ), 1271 vmenu_off = $vMenuCont.offset(), 1272 vmenu_l = parseFloat(vmenu_off.left), 1273 vmenu_t = parseFloat(vmenu_off.top), 1274 vmenu_r = vmenu_l + vmenu_w, 1275 vmenu_b = vmenu_t + vmenu_h, 1276 1277 close_h = parseFloat( $close_menu.outerHeight() ), 1278 close_w = parseFloat( $close_menu.outerWidth() ), 1279 close_off = $close_menu.offset(), 1280 close_l = parseFloat(close_off.left), 1281 close_t = parseFloat(close_off.top), 1282 close_r = close_l + close_w, 1283 close_b = close_t + close_h; 1284 if ( 1285 !( 1286 e.clientX > vmenu_l && 1287 e.clientX < vmenu_r && 1288 e.clientY > vmenu_t && 1289 e.clientY < vmenu_b 1290 ) 1291 || 1292 ( 1293 e.clientX > close_l && 1294 e.clientX < close_r && 1295 e.clientY > close_t && 1296 e.clientY < close_b 1297 ) 1298 ) { 1299 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); 1300 } 1301 } 1302 }); 1303 }; 1304 1305 function menuOverlay() { 1306 if ( $('.overlay').length ) { 1307 $('.overlay').removeClass('hidden'); 1308 } 1309 if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { 1310 $('.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) { 1311 var transDelay = (index / 20) + 0.1; 1312 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1313 transDelay = transDelay + 0.3; 1314 $(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'); 1315 }); 1316 } 1317 1318 }; 1319 var $secondary_parent; 1320 function menuAppend() { 1321 var $body = $('body'), 1322 $menuCont = $('.menu-container:not(.vmenu-container)'), 1323 $vMenuCont = $('.menu-container.vmenu-container'), 1324 $cta = $('.navbar-cta'), 1325 $socials = $('.navbar-social:not(.appended-navbar)'), 1326 $ul = $('.navbar-main ul.menu-primary-inner'), 1327 $ulCta, 1328 $ulSocials, 1329 $navLast, 1330 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1331 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1332 $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), 1333 $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), 1334 $ulFirst = $('> ul', $firstNav), 1335 $ulSecond = $('> ul', $secondNav), 1336 setCTA, 1337 appendCTA = function(){ 1338 return true; 1339 }, 1340 appendSocials = function(){ 1341 return true; 1342 }, 1343 appendSplit = function(){ 1344 return true; 1345 }; 1346 1347 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1348 $ulCta = $('> ul', $cta); 1349 $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); 1350 1351 appendCTA = function(){ 1352 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1353 1354 $ul.after($ulCta); 1355 } else { 1356 $cta.append($ulCta); 1357 } 1358 } 1359 } 1360 1361 if ( ! $body.hasClass('cta-not-appended') ) { 1362 appendCTA(); 1363 } 1364 1365 var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); 1366 $smartSocial.each(function(){ 1367 var $_smartSocial = $(this); 1368 $('> li', $_smartSocial).each(function(){ 1369 var $li = $(this); 1370 if ( $li.hasClass('mobile-hidden') ) { 1371 $_smartSocial.addClass('mobile-hidden'); 1372 } else { 1373 $_smartSocial.removeClass('mobile-hidden'); 1374 return false;
1375 } 1376 }); 1377 1378 $('> li', $_smartSocial).each(function(){ 1379 var $li = $(this); 1380 if ( $li.hasClass('tablet-hidden') ) { 1381 $_smartSocial.addClass('tablet-hidden'); 1382 } else { 1383 $_smartSocial.removeClass('tablet-hidden'); 1384 return false; 1385 } 1386 }); 1387 }); 1388 1389 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { 1390 $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); 1391 if ( $body.hasClass('hmenu-center-split') ) { 1392 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1393 } else { 1394 $navLast = $('.navbar-nav-last', $vMenuCont); 1395 } 1396 1397 if ( ! $navLast.length ) { 1398 var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />'); 1399 if ( $body.hasClass('hmenu-center-split') ) { 1400 $('.menu-horizontal-inner', $menuCont).append(_navLast); 1401 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1402 } else { 1403 $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); 1404 $navLast = $('.navbar-nav-last', $vMenuCont); 1405 } 1406 } 1407 1408 appendSocials = function(){ 1409 if ( !$body.hasClass('menu-overlay-center') ) { 1410 // if ( !$navLast.find('ul.menu-smart-social').length ) { 1411 // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); 1412 // $navLast.append('<ul class="menu-smart menu-smart-social" />'); 1413 // $ulSocials.each(function(){ 1414 // var $li_social = $(this); 1415 // $navLast.find('ul.menu-smart-social').append($li_social); 1416 // }); 1417 // } 1418 // } else { 1419 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1420 $socials.addClass('mobile-hidden').addClass('tablet-hidden') 1421 if ( ! $('> ul.menu-smart-social li', $socials).length ) { 1422 $('> ul.menu-smart-social li', $socials).remove(); 1423 } 1424 $navLast.append($ulSocials); 1425 } else { 1426 if ( ! $('> ul.menu-smart-social li', $navLast).length ) { 1427 $('> ul.menu-smart-social li', $navLast).remove(); 1428 } 1429 $socials.append($ulSocials); 1430 } 1431 } 1432 } 1433 appendSocials(); 1434 } 1435 1436 if ( $vMenuCont.length ) { 1437 var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); 1438 } else { 1439 var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); 1440 } 1441 if ( $accordion_secondary.length ) { 1442 var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); 1443 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1444 if ( !$accordion_secondary_ph.length ) { 1445 $accordion_secondary.after('<span class="accordion-secondary-ph" />'); 1446 } 1447 if ( $vMenuCont.length ) { 1448 $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); 1449 } else { 1450 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1451 $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); 1452 } else { 1453 $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); 1454 } 1455 } 1456 } else { 1457 if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { 1458 $accordion_secondary_ph.before($accordion_secondary); 1459 } 1460 } 1461 } 1462 1463 if ( $vMenuCont.length ) { 1464 var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); 1465 } else { 1466 var $extra_icons = $('.navbar-extra-icons', $menuCont); 1467 } 1468 1469 if ( $extra_icons.length ) { 1470 if ( $vMenuCont.length ) { 1471 if ( $('li:not(.social-icon)', $extra_icons).length ) { 1472 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1473 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1474 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1475 $not_social.each(function(){ 1476 if ( ! $primary_after.length ) { 1477 $('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />'); 1478 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1479 $primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />'); 1480 } 1481 var $extra_li = $(this); 1482 $primary_after.find('> ul').append($extra_li); 1483 }); 1484 } else { 1485 var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), 1486 $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1487 $not_social.each(function(){ 1488 var $extra_li = $(this); 1489 $extra_icons.find('> ul').append($extra_li); 1490 }); 1491 } 1492 } /*else { 1493 var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); 1494 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1495 if ( !$extra_icons_ph.length ) { 1496 $extra_icons.after('<span class="extra-icons-ph" />'); 1497 } 1498 if ( $('.navbar-accordion-cta', $vMenuCont).length ) { 1499 $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); 1500 } else { 1501 $('.menu-accordion-primary', $vMenuCont).after($extra_icons); 1502 } 1503 } else { 1504 if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { 1505 $extra_icons_ph.before($extra_icons); 1506 } 1507 } 1508 }*/ 1509 } else { 1510 if ( ! $body.hasClass('hmenu-center-double') ) { 1511 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1512 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1513 $primary_after = $('.nav.navbar-main-after', $menuCont); 1514 1515 if ( ! $primary_after.length && $not_social.length ) { 1516 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1517 $('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />'); 1518 } else { 1519 $('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />'); 1520 } 1521 $primary_after = $('.nav.navbar-main-after', $menuCont); 1522 $primary_after.append('<ul class="menu-smart sm menu-smart-social" />'); 1523 } 1524 var tablet_hidden = true, 1525 mobile_hidden = true; 1526 $not_social.each(function(){ 1527 var $extra_li = $(this); 1528 $primary_after.find('> ul').append($extra_li); 1529 if ( ! $extra_li.hasClass('tablet-hidden') ) { 1530 tablet_hidden = false;
1531 } 1532 if ( ! $extra_li.hasClass('mobile-hidden') ) { 1533 mobile_hidden = false; 1534 } 1535 }); 1536 if ( tablet_hidden === true && $not_social.length ) { 1537 $primary_after.addClass('tablet-hidden'); 1538 } 1539 if ( mobile_hidden === true && $not_social.length ) { 1540 $primary_after.addClass('mobile-hidden'); 1541 } 1542 } else { 1543 var $primary_after = $('.nav.navbar-main-after', $menuCont); 1544 1545 if ( $primary_after.length ) { 1546 var $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1547 $not_social.each(function(){ 1548 var $extra_li = $(this); 1549 $extra_icons.find('> ul').append($extra_li); 1550 }); 1551 $primary_after.remove(); 1552 } 1553 } 1554 } 1555 } 1556 } 1557 1558 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1559 appendSplit = function(){ 1560 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1561 if ( $extra_icons.length ) { 1562 if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { 1563 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1564 $append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />'); 1565 $not_social.each(function(){ 1566 var $extra_li = $(this); 1567 $append_ul.append($extra_li); 1568 }); 1569 if ( $secondNav.length ) { 1570 $secondNav.append($append_ul); 1571 } else { 1572 $('.menu-horizontal-inner', $menuCont).prepend($append_ul); 1573 } 1574 } 1575 } 1576 if ( $secondNav.length ) { 1577 $secondNav.prepend($ulFirst); 1578 } else { 1579 $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); 1580 } 1581 $firstMenu.hide(); 1582 } else { 1583 $firstNav.append($ulFirst); 1584 var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); 1585 if ( $append_ul.length ) { 1586 var $not_social = $('> li:not(.social-icon)', $append_ul); 1587 $not_social.each(function(){ 1588 var $extra_li = $(this); 1589 $extra_icons.find('> ul').append($extra_li); 1590 }); 1591 } 1592 $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); 1593 $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); 1594 $firstMenu.css({ 1595 'display': 'table-cell' 1596 }); 1597 } 1598 } 1599 } 1600 appendSplit(); 1601 1602 $(window).on( 'resize', function(){ 1603 clearRequestTimeout(setCTA); 1604 setCTA = requestTimeout( function() { 1605 appendCTA(); 1606 appendSocials(); 1607 appendSplit(); 1608 }, 10 ); 1609 }); 1610 } 1611 //menuMobileButton(); 1612 menuMobile(); 1613 menuOffCanvas(); 1614 menuAppend(); 1615 menuOverlay(); 1616 1617 var stickyDropdownSearch = function(){ 1618 var $masthead = $('#masthead'), 1619 $ddSearch = $('.overlay.overlay-search', $masthead), 1620 $styles = $('#stickyDropdownSearch').remove(); 1621 if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { 1622 var $menuWrapper = $('.menu-wrapper'), 1623 $navbar = $('.menu-container-mobile', $menuWrapper), 1624 navbarH = $navbar.outerHeight(), 1625 //$topbar = $('.top-menu', $menuWrapper), 1626 //topbarH = $topbar.outerHeight(), 1627 _css; 1628 1629 _css = '<style type="text/css" id="stickyDropdownSearch">'; 1630 _css += '@media (max-width: 959px) {'; 1631 _css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {'; 1632 _css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;'; 1633 _css += '}'; 1634 _css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {'; 1635 _css += 'position: fixed;'; 1636 _css += 'top: 0;'; 1637 _css += '}'; 1638 _css += '</style>'; 1639 1640 $(_css).appendTo($('head')); 1641 } 1642 } 1643 stickyDropdownSearch(); 1644 1645 var setMenuOverlay; 1646 $(window).on( 'resize', function(){ 1647 if ( $('.overlay').length && $(window).width() > 1024 ) { 1648 $('.overlay').addClass('hidden'); 1649 } 1650 clearRequestTimeout(setMenuOverlay); 1651 setMenuOverlay = requestTimeout( function(){ 1652 menuOverlay(); 1653 menuAppend(); 1654 stickyDropdownSearch(); 1655 }, 150 ); 1656 }); 1657 UNCODE.menuSmartInit(); 1658}; 1659 1660UNCODE.menuSmartInit = function() { 1661 var $menusmart = $('[class*="menu-smart"]'), 1662 $masthead = $('#masthead'), 1663 $hMenu = $('.menu-horizontal-inner', $masthead), 1664 $focus = $('.overlay-menu-focus'), 1665 showTimeout = 50, 1666 hideTimeout = 50, 1667 showTimeoutFunc, hideTimeoutFunc; 1668 1669 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1670 $(this).data('hover', true); 1671 }, function(){ 1672 $(this).data('hover', false); 1673 }); 1674 1675 $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ 1676 e.preventDefault(); 1677 }); 1678 1679 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1680 var $notLis = $('> .nav > ul > li a', $hMenu), 1681 $menuA = $('a', $masthead).not($notLis), 1682 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1683 showFuncCond = function() { return true }; 1684 1685 if ( $('body').hasClass('focus-megamenu') ) { 1686 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1687 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1688 } else if ( $('body').hasClass('focus-links') ) { 1689 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1690 } 1691 1692 $hoverSelector.hover(function(){ 1693 clearRequestTimeout(hideTimeoutFunc);
1694 showTimeoutFunc = requestTimeout(function(){ 1695 $('body').addClass('navbar-hover'); 1696 }, showTimeout*2); 1697 }, function(){ 1698 hideTimeoutFunc = requestTimeout(function(){ 1699 if ( ! $('.overlay-search.open', $masthead).length ) { 1700 $('body').removeClass('navbar-hover'); 1701 } 1702 }, hideTimeout*2); 1703 }); 1704 } else { 1705 showFuncCond = function() { return false }; 1706 } 1707 1708 if ($menusmart.length > 0) { 1709 $menusmart.smartmenus({ 1710 subIndicators: false, 1711 subIndicatorsPos: 'append', 1712 //subMenusMinWidth: '13em', 1713 subIndicatorsText: '', 1714 showTimeout: showTimeout, 1715 hideTimeout: hideTimeout, 1716 showFunction: function($ul, complete) { 1717 clearRequestTimeout(showTimeoutFunc); 1718 $ul.fadeIn(0, 'linear', function(){ 1719 complete(); 1720 if ( $ul.hasClass('vc_row') ) { 1721 $ul.css({ 1722 'display': 'table' 1723 }); 1724 } 1725 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1726 $('body').addClass('open-megamenu'); 1727 } 1728 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1729 $('body').addClass('navbar-hover'); 1730 } 1731 }).addClass('open-animated'); 1732 }, 1733 hideFunction: function($ul, complete) { 1734 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 1735 $('body').removeClass('open-megamenu'); 1736 } 1737 var fixIE = $('html.ie').length; 1738 if (fixIE) { 1739 var $rowParent = $($ul).closest('.main-menu-container'); 1740 $rowParent.height('auto'); 1741 } 1742 $ul.fadeOut(0, 'linear', function(){ 1743 complete(); 1744 $ul.removeClass('open-animated'); 1745 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 1746 $('body').removeClass('open-submenu'); 1747 } 1748 }); 1749 }, 1750 collapsibleShowFunction: function($ul, complete) { 1751 $ul.slideDown(400, 'easeInOutCirc', complete); 1752 }, 1753 collapsibleHideFunction: function($ul, complete) { 1754 $ul.slideUp(200, 'easeInOutCirc', complete); 1755 }, 1756 hideOnClick: true 1757 }); 1758 1759 if ( $('body').hasClass('menu-accordion-active') ) { 1760 requestTimeout(function(){ 1761 $menusmart.addClass('menu-smart-init'); 1762 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 1763 }, 1000); 1764 } 1765 1766 $(document).on( 'uncode.smartmenu-appended', function(){ 1767 requestTimeout(function(){ 1768 $menusmart.smartmenus( 'refresh' ); 1769 }, 1000); 1770 }); 1771 } 1772 1773 $('.main-menu-container').each(function(){ 1774 var $main_cont = $(this), 1775 $uls = $('ul', $main_cont); 1776 1777 $uls.each(function(){ 1778 var $ul = $(this), 1779 mobile_hidden = true, 1780 tablet_hidden = true; 1781 $('> li:not(.hidden)', $ul).each(function(){ 1782 if ( !$(this).hasClass('mobile-hidden') ) { 1783 mobile_hidden = false; 1784 return false; 1785 } 1786 }); 1787 $('> li:not(.hidden)', $ul).each(function(){ 1788 if ( !$(this).hasClass('tablet-hidden') ) { 1789 tablet_hidden = false; 1790 return false; 1791 } 1792 }); 1793 if ( mobile_hidden ) { 1794 $ul.addClass('mobile-hidden'); 1795 } 1796 if ( tablet_hidden ) { 1797 $ul.addClass('tablet-hidden'); 1798 } 1799 }); 1800 1801 var $divUlsMB = $('div:has(>ul.mobile-hidden)'); 1802 1803 $divUlsMB.each(function(){ 1804 var $divUlMB = $(this), 1805 div_mobile_hidden = true, 1806 div_tablet_hidden = true; 1807 1808 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1809 if ( !$(this).hasClass('mobile-hidden') ) { 1810 div_mobile_hidden = false; 1811 return false; 1812 } 1813 }); 1814 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1815 if ( !$(this).hasClass('tablet-hidden') ) { 1816 div_tablet_hidden = false; 1817 return false; 1818 } 1819 }); 1820 if ( div_mobile_hidden ) { 1821 $divUlMB.addClass('mobile-hidden'); 1822 } 1823 if ( div_tablet_hidden ) { 1824 $divUlMB.addClass('tablet-hidden'); 1825 } 1826 }); 1827 }); 1828 1829 var overlaySearchButton = function(){ 1830 var $search_wrap = $('.overlay.overlay-search, .widget_search'); 1831 1832 $search_wrap.each(function(){ 1833 var $form = $('form', this), 1834 $icon = $('i', $form); 1835 1836 $icon.on('click', function(){ 1837 $form.submit(); 1838 }); 1839 }); 1840 }; 1841 overlaySearchButton(); 1842} 1843 1844UNCODE.okvideo = function() { 1845 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1846 $.okvideo = function(options) { 1847 // if the option var was just a string, turn it into an object 1848 if (typeof options !== 'object') options = { 1849 'video': options 1850 }; 1851 var base = this; 1852 // kick things off 1853 base.init = function() { 1854 base.options = $.extend({}, $.okvideo.options, options); 1855 // support older versions of okvideo 1856 if (base.options.video === null) base.options.video = base.options.source; 1857 base.setOptions(); 1858 var target = base.options.target || $('body'); 1859 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1860 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1861 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1862 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>'; 1863 if (OKEvents.utils.isMobile()) { 1864 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>'); 1865 } else { 1866 if (base.options.controls === 3) { 1867 target.append(mask) 1868 } 1869 if (base.options.adproof === 1) { 1870 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>'); 1871 } else { 1872 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>'); 1873 } 1874 } 1875 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1876 if (base.options.playlist.list === null) { 1877 if (base.options.video.provider === 'youtube') { 1878 base.loadYouTubeAPI(); 1879 } else if (base.options.video.provider === 'vimeo') { 1880 base.options.volume /= 100; 1881 base.loadVimeoAPI(); 1882 } 1883 } else { 1884 base.loadYouTubeAPI(); 1885 } 1886 } 1887 }; 1888 // clean the options 1889 base.setOptions = function() { 1890 // exchange 'true' for '1' and 'false' for 3 1891 for (var key in this.options) { 1892 if (this.options[key] === true) this.options[key] = 1; 1893 if (this.options[key] === false) this.options[key] = 3; 1894 } 1895 if (base.options.playlist.list === null) { 1896 base.options.video = base.determineProvider(); 1897 } 1898 // pass options to the window 1899 $(window).data('okoptions-' + base.options.id, base.options); 1900 };
1901 // insert js into the head and exectue a callback function 1902 base.insertJS = function(src, callback){ 1903 var tag; 1904 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1905 tag = UNCODE.insertedSripts[src]; 1906 if (callback){ 1907 if (tag.readyState){ //IE 1908 tag.onreadystatechange = function(){ 1909 if (tag.readyState === "loaded" || 1910 tag.readyState === "complete"){ 1911 tag.onreadystatechange = null; 1912 callback(); 1913 } 1914 }; 1915 } else { 1916 $(tag).on('load', callback); 1917 } 1918 } 1919 return; 1920 } 1921 tag = document.createElement('script'); 1922 if (callback){ 1923 if (tag.readyState){ //IE 1924 tag.onreadystatechange = function(){ 1925 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1926 tag.onreadystatechange = null; 1927 callback(); 1928 } 1929 }; 1930 } else { 1931 tag.onload = function() { 1932 callback(); 1933 }; 1934 } 1935 } 1936 tag.src = src; 1937 var firstScriptTag = document.getElementsByTagName('script')[0]; 1938 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1939 if ( ! UNCODE.insertedSripts ) { 1940 UNCODE.insertedSripts = []; 1941 } 1942 UNCODE.insertedSripts[src] = tag; 1943 }; 1944 // load the youtube api 1945 base.loadYouTubeAPI = function(callback) { 1946 base.insertJS('https://www.youtube.com/player_api'); 1947 }; 1948 base.loadYouTubePlaylist = function() { 1949 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1950 }; 1951 // load the vimeo api by replacing the div with an iframe and loading js 1952 base.loadVimeoAPI = function() { 1953 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', 1954 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >'); 1955 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1956 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1957 base.insertJS('//player.vimeo.com/api/player.js', function() { 1958 vimeoPlayerReady(base.options.id); 1959 }); 1960 }; 1961 // is it from youtube or vimeo? 1962 base.determineProvider = function() { 1963 var a = document.createElement('a'); 1964 a.href = base.options.video; 1965 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1966 var videoid = a.href.split('/')[3].toString(); 1967 var query = videoid.substring(videoid.indexOf('?') + 1); 1968 if (query != '') { 1969 var vars = query.split('&'); 1970 for (var i = 0; i < vars.length; i++) { 1971 var pair = vars[i].split('='); 1972 if (pair[0] == 'v') { 1973 videoid = pair[1]; 1974 } 1975 } 1976 } 1977 return { 1978 "provider": "youtube", 1979 "id": videoid 1980 }; 1981 } else if (/vimeo.com/.test(base.options.video)) { 1982 return { 1983 "provider": "vimeo", 1984 "id": (a.href.split('/')[3].toString()).split('#')[0], 1985 }; 1986 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1987 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1988 if (id.length == 11) { 1989 return { 1990 "provider": "youtube", 1991 "id": id.toString() 1992 }; 1993 } else { 1994 for (var i = 0; i < base.options.video.length; i++) { 1995 if (typeof parseInt(base.options.video[i]) !== "number") { 1996 throw 'not vimeo but thought it was for a sec'; 1997 } 1998 } 1999 return { 2000 "provider": "vimeo", 2001 "id": base.options.video 2002 }; 2003 } 2004 } else { 2005 throw "OKVideo: Invalid video source"; 2006 } 2007 }; 2008 base.init(); 2009 }; 2010 2011 var checkResize, 2012 newW = UNCODE.wwidth; 2013 2014 $.okvideo.options = { 2015 id: null, 2016 source: null, // Deprecate dis l8r 2017 video: null, 2018 playlist: { // eat ur heart out @brokyo 2019 list: null, 2020 index: 0, 2021 startSeconds: 0, 2022 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 2023 }, 2024 disableKeyControl: 1, 2025 captions: 0, 2026 loop: 1, 2027 hd: 1, 2028 volume: 0, 2029 adproof: false, 2030 unstarted: null, 2031 onFinished: null, 2032 onReady: null, 2033 onPlay: null, 2034 onPause: null, 2035 buffering: null, 2036 controls: false, 2037 autoplay: true, 2038 annotations: true, 2039 cued: null 2040 }; 2041 $.fn.okvideo = function(options) { 2042 options.target = this; 2043 return this.each(function() { 2044 (new $.okvideo(options)); 2045 }); 2046 }; 2047 2048 var checkForVideos = function(){ 2049 $(".uncode-video-container.video").each(function(index, el) { 2050 var $this = $(this), 2051 mobile_ready = $this.hasClass('no-control-mobile-autoplay'), 2052 url = $this.attr('data-video'), 2053 id = $this.attr('data-id'), 2054 cloned = $this.closest('.owl-item'); 2055 2056 if ( mobile_ready || newW >= UNCODE.mediaQuery ) { 2057 if (!cloned.hasClass('cloned') || cloned.length == 0) { 2058 $this.okvideo({ 2059 id: id, 2060 source: url.split('#')[0], 2061 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 2062 autoplay: 1, 2063 controls: 0, 2064 volume: 0, 2065 adproof: 0, 2066 caller: $this, 2067 hd: 1, 2068 onReady: function(player) { 2069 var getPlayer = player.c || player.h || player, 2070 $iframe, 2071 getContainer = $(getPlayer).closest('.background-element'); 2072 if (getContainer.length) { 2073 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 2074 } 2075 2076 if ( $this.hasClass('drop-move') ) { 2077 2078 var $iframe = $(getPlayer), 2079 w = parseFloat($iframe.attr('width')), 2080 h = parseFloat($iframe.attr('height')), 2081 ratio = h / w, 2082 setResizeiFto, 2083 resizeiFrame = function(){ 2084 var dataW = $this.attr('data-w'), 2085 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2086 newH = newW * ratio; 2087 $iframe.css({ 2088 width: newW, 2089 height: newH 2090 }); 2091 }; 2092 resizeiFrame(); 2093 $(window).on( 'load', resizeiFrame ); 2094 $(window).on( 'resize', function(){ 2095 clearRequestTimeout(setResizeiFto); 2096 setResizeiFto = requestTimeout( function() { 2097 resizeiFrame(); 2098 }, 10 ); 2099 }); 2100 2101 } 2102 2103 } 2104 }); 2105 } 2106 } 2107 }); 2108 }; 2109 2110 checkForVideos(); 2111 2112 $(window).on('load', function(){ 2113 $('.mejs-fullscreen-button button').on('click', function(){ 2114 var $button = $(this), 2115 $stuck = $button.closest('.is_stucked'); 2116 2117 if ( $stuck.length ) { 2118 $stuck = $(this).trigger("sticky_kit:detach"); 2119 window.scrollTo(0, 0); 2120 } 2121 }); 2122 }); 2123 2124 var checkVideoResize = function(){ 2125 clearRequestTimeout(checkResize); 2126 checkResize = requestTimeout(function(){ 2127 if ( newW !== UNCODE.wwidth ) { 2128 newW = UNCODE.wwidth; 2129 checkForVideos(); 2130 } 2131 }, 1000); 2132 }; 2133 2134 $(window).off('resize', checkVideoResize) 2135 .on( 'resize', checkVideoResize); 2136 2137}; 2138 2139UNCODE.backgroundSelfVideos = function( $ctx ) { 2140 2141 var backgroundSelfVideosInit = function( $ctx ) { 2142 if ( SiteParameters.block_mobile_videos === true ) { 2143 return false;
2144 } 2145 if (typeof MediaElement === "function") { 2146 if ( typeof $ctx === 'undefined' ) { 2147 $ctx = document; 2148 } 2149 2150 $(".background-video-shortcode", $ctx).each(function(index, el) { 2151 if ( $(this).closest('mediaelementwrapper').length ) { 2152 return true; 2153 } 2154 var $video_el = $(this), 2155 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 2156 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 2157 video_id = $video_el.attr('id'); 2158 2159 if ( SiteParameters.is_frontend_editor ) { 2160 video_id = video_id + '_' + index; 2161 $video_el.attr('id', video_id); 2162 } 2163 2164 var media = new MediaElement(video_id, { 2165 startVolume: 0, 2166 loop: true, 2167 success: function(mediaElement, domObject) { 2168 domObject.volume = 0; 2169 $(mediaElement).data('started', false); 2170 mediaElement.addEventListener('timeupdate', function(e) { 2171 if (!$(e.target).data('started')) { 2172 $(mediaElement).data('started', true); 2173 } 2174 }); 2175 mediaElement.addEventListener('loadedmetadata', function(e) { 2176 $('body').removeClass('video-not-supported'); 2177 mediaElement.play(); 2178 }); 2179 if (!UNCODE.isMobile) { 2180 requestTimeout(function() { 2181 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 2182 }, 100); 2183 } 2184 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 2185 mediaElement.play(); 2186 } 2187 2188 if ( $parent_drop_move.length ) { 2189 var setResizeMEto, 2190 resizeMediaElement = function(){ 2191 var dataW = $parent_drop_move.attr('data-w'), 2192 videoW = domObject.width, 2193 videoH = domObject.height, 2194 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2195 newH = newW / ( videoW / videoH ); 2196 2197 $(domObject).css({ 2198 'height': newH, 2199 'width': newW 2200 }); 2201 }; 2202 $(window).on( 'resize load', function(){ 2203 clearRequestTimeout(setResizeMEto); 2204 setResizeMEto = requestTimeout( function() { 2205 resizeMediaElement(); 2206 }, 10 ); 2207 }); 2208 } 2209 2210 mediaElement.addEventListener('play', function() { 2211 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2212 $(mediaElement).closest('#page-header').addClass('video-started'); 2213 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2214 }, true); 2215 2216 }, 2217 // fires when a problem is detected 2218 error: function() {} 2219 }); 2220 }); 2221 } else { 2222 2223 if ( typeof $ctx === 'undefined' ) { 2224 $ctx = document; 2225 } 2226 2227 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 2228 Array.from(videos).forEach(function(video_el) { 2229 video_el.addEventListener('loadedmetadata', function(e) { 2230 $('body').removeClass('video-not-supported'); 2231 video_el.play(); 2232 }); 2233 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 2234 video_el.muted = true; 2235 video_el.loop = true; 2236 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2237 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 2238 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2239 $('body').removeClass('video-not-supported'); 2240 video_el.play(); 2241 } else { 2242 requestTimeout(function(){ 2243 backgroundSelfVideosInit( $ctx ); 2244 }, 1000); 2245 } 2246 }); 2247 } 2248 }; 2249 2250 backgroundSelfVideosInit( $ctx ); 2251 2252 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2253 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 2254 var $el = model.view.$el, 2255 shortcode = model.attributes.shortcode; 2256 2257 if (typeof MediaElement === "function") { 2258 backgroundSelfVideosInit( $el ); 2259 } else { 2260 backgroundSelfVideosInit( $el[0] ); 2261 } 2262 }); 2263 } 2264}; 2265 2266UNCODE.is_scrolling = false; 2267 2268UNCODE.disableHoverScroll = function() { 2269 2270 if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) { 2271 var body = document.body, 2272 timer; 2273 2274 window.addEventListener('scroll', function() {
2275 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 2276 clearRequestTimeout(timer); 2277 if ( body.classList && !body.classList.contains('disable-hover') ) { 2278 body.classList.add('disable-hover'); 2279 window.dispatchEvent(new CustomEvent('disable-hover')); 2280 } 2281 UNCODE.is_scrolling = true; 2282 2283 timer = requestTimeout(function() { 2284 if ( body.classList ) { 2285 body.classList.remove('disable-hover'); 2286 window.dispatchEvent(new CustomEvent('enable-hover')); 2287 } 2288 UNCODE.is_scrolling = false; 2289 }, delay); 2290 }, false); 2291 } 2292}; 2293 2294UNCODE.isotopeLayout = function() { 2295 if ($('.isotope-layout').length > 0) { 2296 var isotopeContainersArray = [], 2297 typeGridArray = [], 2298 layoutGridArray = [], 2299 screenLgArray = [], 2300 screenMdArray = [], 2301 screenSmArray = [], 2302 transitionDuration = [], 2303 $filterItems = [], 2304 $filters = $('.isotope-system .isotope-filters'), 2305 $itemSelector = '.tmb-iso', 2306 $items, 2307 itemMargin, 2308 correctionFactor = 0, 2309 firstLoad = true, 2310 isOriginLeft = $('body').hasClass('rtl') ? false : true; 2311 $('[class*="isotope-container"]').each(function(index) { 2312 var _this = $(this); 2313 var isoData = _this.data(), 2314 $data_lg, 2315 $data_md, 2316 $data_sm; 2317 _this.children('.tmb').addClass('tmb-iso'); 2318 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 2319 else $data_lg = '1000'; 2320 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 2321 else $data_md = '600'; 2322 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 2323 else $data_sm = '480'; 2324 screenLgArray.push($data_lg); 2325 screenMdArray.push($data_md); 2326 screenSmArray.push($data_sm); 2327 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 2328 if (isoData.type == 'metro') typeGridArray.push(true); 2329 else typeGridArray.push(false); 2330 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 2331 else layoutGridArray.push('masonry'); 2332 isotopeContainersArray.push(_this); 2333 _this.attr('data-iso-index', index); 2334 }); 2335 var colWidth = function(index) { 2336 $(isotopeContainersArray[index]).width(''); 2337 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 2338 widthAvailable = $(isotopeContainersArray[index]).width(), 2339 columnNum = 12, 2340 columnWidth = 0, 2341 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 2342 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 2343 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 2344 $rowContainer, 2345 paddingRow, 2346 $colContainer, 2347 paddingCol; 2348 2349 if ( consider_menu ) 2350 winHeight = winHeight - UNCODE.menuHeight; 2351 2352 if ( data_vp_height === '1' ) { 2353 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 2354 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2355 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 2356 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 2357 winHeight = winHeight - ( paddingRow + paddingCol ); 2358 } 2359 2360 if (isPx) { 2361 columnWidth = Math.ceil(widthAvailable / columnNum); 2362 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 2363 } else { 2364 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 2365 } 2366 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 2367 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 2368 for (var i = 0, len = $items.length; i < len; i++) { 2369 var $item = $($items[i]), 2370 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 2371 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 2372 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 2373 2374 2375 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 2376 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 2377 } 2378 2379 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 2380 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 2381 } 2382 2383 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 2384 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2385 switch (parseInt(multiplier_w[1])) { 2386 case (5): 2387 case (4): 2388 case (3): 2389 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2390 multiplier_w[1] = 6; 2391 break; 2392 case (2): 2393 case (1): 2394 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 2395 multiplier_w[1] = 3; 2396 break; 2397 default: 2398 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2399 multiplier_w[1] = 12; 2400 break; 2401 } 2402 2403 if (multiplier_w[1] == 2.4) { // 5 columns 2404 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2405 multiplier_w[1] = 6; 2406 } 2407 } 2408 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 2409 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2410 switch (parseInt(multiplier_w[1])) { 2411 case (5): 2412 case (4): 2413 case (3): 2414 case (2): 2415 case (1): 2416 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2417 multiplier_w[1] = 6; 2418 break; 2419 default: 2420 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2421 multiplier_w[1] = 12; 2422 break; 2423 } 2424 2425 if (multiplier_w[1] == 2.4) { // 5 columns 2426 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2427 multiplier_w[1] = 6; 2428 } 2429 } 2430 } else if (widthAvailable < screenSmArray[index]) { 2431 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2432 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2433 multiplier_w[1] = 12; 2434 if (typeGridArray[index]) multiplier_h[1] = 12; 2435 } 2436 } 2437 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 2438 height; 2439 2440 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 2441 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 2442 if ( widthAvailable < screenSmArray[index] ) { 2443 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 2444 } 2445 } else { 2446 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 2447 } 2448 2449 if (width >= widthAvailable) { 2450 $item.css({ 2451 width: widthAvailable 2452 }); 2453 if (typeGridArray[index]) { 2454 $item.children().add($item.find('.backimg')).css({ 2455 height: height 2456 }); 2457 } 2458 } else { 2459 $item.css({ 2460 width: width 2461 }); 2462 if (typeGridArray[index]) { 2463 $item.children().add($item.find('.backimg')).css({ 2464 height: height 2465 }); 2466 } 2467 } 2468 } 2469 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 2470 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 2471 } else { 2472 return columnWidth; 2473 } 2474 }, 2475 init_isotope = function() { 2476 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 2477 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 2478 isotopeId = isotopeSystem.attr('id'), 2479 $layoutMode = layoutGridArray[i], 2480 setIsotopeFirstRowTimeOut, 2481 setIsotopeFirstRow = function(items){ 2482 var firstRow = true; 2483 $(items).each(function(index, val){ 2484 var el = items[index].element, 2485 el_top = items[index].position.y, 2486 $el = $(el); 2487 if ( index > 0 && el_top > 0 && firstRow ) { 2488 firstRow = false;
2489 } else if ( index == 0 && el_top == 0 ) { 2490 firstRow = true; 2491 } 2492 if ( firstRow ) { 2493 $el.removeClass('tmb-isotope-further-row'); 2494 } else { 2495 $el.addClass('tmb-isotope-further-row'); 2496 } 2497 }); 2498 }; 2499 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 2500 //resizable: true, 2501 itemSelector: $itemSelector, 2502 layoutMode: $layoutMode, 2503 transitionDuration: transitionDuration[i], 2504 masonry: { 2505 columnWidth: colWidth(i) 2506 }, 2507 vertical: { 2508 horizontalAlignment: 0.5, 2509 }, 2510 sortBy: 'original-order', 2511 isOriginLeft: isOriginLeft 2512 }) 2513 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 2514 .on('layoutComplete', function( event, items ){ 2515 if ( typeof items[0] !== 'undefined' ) { 2516 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2517 setIsotopeFirstRow(items); 2518 } 2519 } 2520 }) 2521 .on('arrangeComplete', function( event, items ){ 2522 if ( typeof items[0] !== 'undefined' ) { 2523 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2524 clearRequestTimeout(setIsotopeFirstRowTimeOut); 2525 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 2526 setIsotopeFirstRow(items); 2527 }, 100); 2528 } 2529 } 2530 }); 2531 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 2532 $(isotopeContainersArray[i]).infinitescroll({ 2533 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 2534 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 2535 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve 2536 animate: false, 2537 behavior: 'local', 2538 debug: false, 2539 loading: { 2540 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 2541 speed: 0, 2542 finished: undefined, 2543 msg: $('#' + isotopeId + ' .loadmore-button'), 2544 }, 2545 errorCallback: function() { 2546 var isotope_system = $(this).closest('.isotope-system'); 2547 $('.loading-button', isotope_system).hide(); 2548 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 2549 } 2550 }, 2551 // append the new items to isotope on the infinitescroll callback function. 2552 function(newElements, opts) { 2553 var $isotope = $(this), 2554 isotopeId = $isotope.closest('.isotope-system').attr('id'), 2555 filters = new Array(), 2556 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 2557 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 2558 $numPages = $('a', $infinite_button).data('pages'), 2559 delay = 300; 2560 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 2561 $infinite_button.show(); 2562 $loading_button.hide(); 2563 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 2564 $('> li', $isotope).remove(); 2565 $.each($(newElements), function(index, val) { 2566 $(val).addClass('tmb-iso'); 2567 if ($(val).is("li")) { 2568 filters.push($(val)[0]); 2569 } 2570 }); 2571 newElements = newElements.filter(function(x) { 2572 return filters.indexOf(x) < 0 2573 }); 2574 $.each($(filters), function(index, val) { 2575 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 2576 }); 2577 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 2578 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2579 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 2580 if (typeof getLightbox === 'object') { 2581 getLightbox.refresh(); 2582 } else { 2583 UNCODE.lightbox(); 2584 } 2585 } 2586 if ( typeof twttr !== 'undefined' ) 2587 twttr.widgets.load(isotopeContainersArray[i]); 2588 2589 requestTimeout(function() { 2590 Waypoint.refreshAll(); 2591 $isotope.trigger('more-items-loaded'); 2592 }, 1000); 2593 2594 }); 2595 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 2596 var $infinite_isotope = $(isotopeContainersArray[i]), 2597 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 2598 $infinite_isotope.infinitescroll('pause'); 2599 $infinite_button.on('click', function(event) { 2600 event.preventDefault(); 2601 var $infinite_system = $(event.target).closest('.isotope-system'), 2602 $infinite_isotope = $infinite_system.find('.isotope-container'), 2603 isotopeId = $infinite_system.attr('id'); 2604 $(event.currentTarget).html(SiteParameters.loading); 2605 $infinite_isotope.infinitescroll('resume'); 2606 $infinite_isotope.infinitescroll('retrieve'); 2607 $infinite_isotope.infinitescroll('pause'); 2608 }); 2609 } 2610 } 2611 } 2612 }, 2613 onLayout = function(isotopeObj, startIndex, needsReload) { 2614 var needsReload = needsReload ? true : false;
2615 2616 if (typeof UNCODE.bigText !== 'undefined') { 2617 UNCODE.bigText(); 2618 } 2619 isotopeObj.css('opacity', 1); 2620 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 2621 2622 requestTimeout(function() { 2623 if (startIndex > 0) { 2624 reloadIsotope(isotopeObj); 2625 if (SiteParameters.dynamic_srcset_active === '1') { 2626 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2627 UNCODE.adaptive_srcset(isotopeObj); 2628 } 2629 // window.dispatchEvent(UNCODE.boxEvent); 2630 } else if (needsReload) { 2631 reloadIsotope(isotopeObj); 2632 } 2633 2634 UNCODE.adaptive(); 2635 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 2636 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2637 } 2638 if (typeof MediaElement === "function") { 2639 $(isotopeObj).find('audio,video').each(function() { 2640 $(this).mediaelementplayer({ 2641 pauseOtherPlayers: false, 2642 }); 2643 }); 2644 } 2645 if ($(isotopeObj).find('.nested-carousel').length) { 2646 if (typeof UNCODE.carousel !== 'undefined') { 2647 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 2648 } 2649 requestTimeout(function() { 2650 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2651 }, 200); 2652 } else { 2653 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2654 } 2655 isotopeObj.trigger('isotope-layout-complete'); 2656 2657 }, 100); 2658 2659 }, 2660 boxAnimation = function(items, startIndex, sequential, container) { 2661 var $allItems = items.length - startIndex, 2662 showed = 0, 2663 index = 0; 2664 if (container.closest('.owl-item').length == 1) return false; 2665 $.each(items, function(index, val) { 2666 var $this = $(val), 2667 elInner = $('> .t-inside', val); 2668 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2669 return; 2670 } 2671 if (val[0]) val = val[0]; 2672 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 2673 new Waypoint({ 2674 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2675 element: val, 2676 handler: function() { 2677 var element = $('> .t-inside', this.element), 2678 parent = $(this.element), 2679 currentIndex = parent.index(); 2680 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 2681 delayAttr = parseInt(element.attr('data-delay')); 2682 if (isNaN(delayAttr)) delayAttr = 100; 2683 delay -= showed; 2684 var objTimeout = requestTimeout(function() { 2685 element.removeClass('zoom-reverse').addClass('start_animation'); 2686 showed = parent.index(); 2687 if ( container.data('isotope') ) { 2688 container.isotope('layout'); 2689 } 2690 }, delay * delayAttr) 2691 parent.data('objTimeout', objTimeout); 2692 if (!UNCODE.isUnmodalOpen) { 2693 this.destroy(); 2694 } 2695 }, 2696 offset: '100%' 2697 }) 2698 } else { 2699 if (elInner.hasClass('force-anim')) { 2700 elInner.addClass('start_animation'); 2701 } else { 2702 elInner.css('opacity', 1); 2703 } 2704 container.isotope('layout'); 2705 } 2706 2707 index++; 2708 }); 2709 }, 2710 reloadIsotope = function(isotopeObj) { 2711 var isoIndex = $(isotopeObj).attr('data-iso-index'); 2712 var $layoutMode = ($(isotopeObj).data('layout')); 2713 if ($layoutMode === undefined) { 2714 $layoutMode = 'masonry'; 2715 } 2716 if (isotopeObj.data('isotope')) { 2717 isotopeObj.isotope({ 2718 itemSelector: $itemSelector, 2719 layoutMode: $layoutMode, 2720 transitionDuration: transitionDuration[isoIndex], 2721 masonry: { 2722 columnWidth: colWidth(isoIndex) 2723 }, 2724 vertical: { 2725 horizontalAlignment: 0.5, 2726 }, 2727 sortBy: 'original-order', 2728 isOriginLeft: isOriginLeft 2729 }); 2730 } 2731 } 2732 ; 2733 if ($('.isotope-pagination').length > 0) { 2734 $('.isotope-system').on('click', '.pagination a', function(evt) { 2735 evt.preventDefault(); 2736 2737 if (SiteParameters.index_pagination_disable_scroll !== '1') { 2738 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 2739 container = $(this).closest('.isotope-system'), 2740 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2741 calc_scroll -= UNCODE.get_scroll_offset(); 2742 2743 var menu_container = $('.menu-sticky'); 2744 var menu = menu_container.find('.menu-container'); 2745 2746 if (menu_container.length > 0 && menu.length > 0) { 2747 calc_scroll = calc_scroll - menu.outerHeight(); 2748 } 2749 2750 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2751 delta = bodyTop - calc_scroll, 2752 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 2753 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2754 2755 if (!UNCODE.isFullPage) { 2756 if (scrollSpeed == 0) { 2757 $('html, body').scrollTop(calc_scroll); 2758 } else { 2759 $('html, body').animate({ 2760 scrollTop: calc_scroll 2761 }, {
2762 easing: 'easeInOutQuad', 2763 duration: scrollSpeed, 2764 complete: function () { 2765 UNCODE.scrolling = false; 2766 } 2767 }); 2768 } 2769 } 2770 } 2771 2772 loadIsotope($(this), true); 2773 }); 2774 } 2775 $filters.on('click', 'a.isotope-nav-link', function(evt) { 2776 if ($(this).hasClass('no-isotope-filter')) { 2777 return; 2778 } 2779 var $filter = $(this), 2780 filterContainer = $filter.closest('.isotope-filters'), 2781 filterValue = $filter.attr('data-filter'), 2782 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 2783 transitionDuration = container.data().isotope.options.transitionDuration, 2784 delay = 300, 2785 filterItems = []; 2786 2787 var filter_items = function(){ 2788 if (filterValue !== undefined) { 2789 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2790 var parent = $(val).parent(), 2791 objTimeout = parent.data('objTimeout'); 2792 if (objTimeout) { 2793 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2794 clearRequestTimeout(objTimeout); 2795 } 2796 if (transitionDuration == 0) { 2797 if ($(val).hasClass('animate_when_almost_visible')) { 2798 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2799 } else { 2800 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2801 } 2802 } 2803 }); 2804 requestTimeout(function(){ 2805 if ( filterValue == '*' ) { 2806 container.removeClass('isotope-filtered'); 2807 } else { 2808 container.addClass('isotope-filtered'); 2809 } 2810 container.isotope({ 2811 filter: function() { 2812 var block = $(this), 2813 filterable = (filterValue == '*') || block.hasClass(filterValue), 2814 lightboxElements = $('[data-lbox^=ilightbox]', block); 2815 if (filterable) { 2816 if (lightboxElements.length) { 2817 lightboxElements.removeClass('lb-disabled'); 2818 container.data('lbox', $(lightboxElements[0]).data('lbox')); 2819 } 2820 filterItems.push(block); 2821 } else { 2822 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 2823 } 2824 container.trigger('more-items-loaded'); 2825 return filterable; 2826 } 2827 }); 2828 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 2829 2830 }, delay); 2831 2832 /** once filtered - start **/ 2833 container.isotope('once', 'arrangeComplete', function() { 2834 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2835 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 2836 if (typeof getLightbox === 'object') { 2837 getLightbox.refresh(); 2838 } else { 2839 UNCODE.lightbox(); 2840 } 2841 } 2842 if (transitionDuration == 0) { 2843 requestTimeout(function() { 2844 boxAnimation(filterItems, 0, false, container); 2845 }, 100); 2846 } 2847 requestTimeout(function() { 2848 Waypoint.refreshAll(); 2849 }, 2000); 2850 }); 2851 /** once filtered - end **/ 2852 } else { 2853 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2854 $.each(UNCODE.lightboxArray, function(index, val) { 2855 UNCODE.lightboxArray[index].destroy(); 2856 }); 2857 } 2858 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2859 var parent = $(val).parent(), 2860 objTimeout = parent.data('objTimeout'); 2861 if (objTimeout) { 2862 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2863 clearRequestTimeout(objTimeout); 2864 } 2865 if (transitionDuration == 0) { 2866 if ($(val).hasClass('animate_when_almost_visible')) { 2867 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2868 } else { 2869 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2870 } 2871 } 2872 }); 2873 container.parent().addClass('grid-loading'); 2874 loadIsotope($filter); 2875 } 2876 }; 2877 2878 if (!$filter.hasClass('active')) { 2879 /** Scroll top with filtering */ 2880 if (filterContainer.hasClass('filter-scroll')) { 2881 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2882 calc_scroll -= UNCODE.get_scroll_offset(); 2883 2884 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2885 delta = bodyTop - calc_scroll, 2886 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 2887 filterTolerance = false, 2888 filter_timeout; 2889 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2890 2891 if ( !UNCODE.isFullPage ) { 2892 if (scrollSpeed == 0) { 2893 $('html, body').scrollTop(calc_scroll); 2894 UNCODE.scrolling = false;
2895 filter_items(); 2896 } else { 2897 2898 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 2899 filter_items(); 2900 filterTolerance = true; 2901 } 2902 2903 $('html, body').animate({ 2904 scrollTop: calc_scroll 2905 },{ 2906 easing: 'easeInOutQuad', 2907 duration: scrollSpeed, 2908 complete: function(){ 2909 UNCODE.scrolling = false; 2910 if ( !filterTolerance ) { 2911 filter_timeout = setTimeout(function(){ 2912 clearTimeout(filter_timeout); 2913 filter_items(); 2914 }, 200); 2915 } 2916 } 2917 }); 2918 } 2919 } 2920 } else { 2921 filter_items(); 2922 } 2923 } 2924 evt.preventDefault(); 2925 }); 2926 2927 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 2928 var params = UNCODE.getURLParams(window.location); 2929 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 2930 2931 UNCODE.lastURL = window.location.href; 2932 2933 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 2934 return; 2935 } 2936 2937 if (params.id === undefined) { 2938 $.each($('.isotope-system'), function(index, val) { 2939 loadIsotope($(val)); 2940 }); 2941 } else { 2942 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 2943 loadIsotope($('#' + params.id)); 2944 } 2945 } 2946 }); 2947 2948 var loadIsotope = function($href, $paginating) { 2949 var is_paginating = false; 2950 2951 if (undefined !== $paginating && $paginating) { 2952 var is_paginating = $paginating; 2953 } 2954 2955 var href = ($href.is("a") ? $href.attr('href') : location), 2956 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 2957 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 2958 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 2959 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 2960 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 2961 isotopeId = isotopeSystem.attr('id'); 2962 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 2963 UNCODE.lastURL = href; 2964 history.pushState({ 2965 myIsotope: true 2966 }, document.title, href); 2967 } 2968 if (is_paginating) { 2969 isotopeWrapper.addClass('grid-filtering'); 2970 } 2971 $.ajax({ 2972 url: href 2973 }).done(function(data) { 2974 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 2975 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 2976 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 2977 isotopeWrapper.addClass('isotope-reloaded'); 2978 requestTimeout(function() { 2979 isotopeWrapper.removeClass('grid-loading'); 2980 isotopeWrapper.removeClass('isotope-reloaded'); 2981 isotopeWrapper.removeClass('grid-filtering'); 2982 }, 500); 2983 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 2984 var parent = $(val).parent(), 2985 objTimeout = parent.data('objTimeout'); 2986 if (objTimeout) { 2987 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2988 clearRequestTimeout(objTimeout); 2989 } 2990 if ($(val).hasClass('animate_when_almost_visible')) { 2991 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2992 } else { 2993 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 2994 } 2995 }); 2996 requestTimeout(function() { 2997 if (isotopeContainer.data('isotope')) { 2998 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 2999 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 3000 UNCODE.adaptive(); 3001 if (SiteParameters.dynamic_srcset_active === '1') { 3002 UNCODE.adaptive_srcset(isotopeContainer); 3003 } 3004 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3005 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 3006 if (typeof getLightbox === 'object') { 3007 getLightbox.refresh(); 3008 } else { 3009 UNCODE.lightbox(); 3010 } 3011 } 3012 } 3013 isotopeContainer.trigger('more-items-loaded'); 3014 }, 300); 3015 $('.pagination', isotopeFooter).remove(); 3016 isotopeFooter.append($resultPagination); 3017 3018 if (isotopeResultCount.length > 0) { 3019 $('.woocommerce-result-count', isotopeResultCount).remove(); 3020 isotopeResultCount.append($resultCount); 3021 } 3022 }); 3023 }; 3024 $filters.each(function(i, buttonGroup) { 3025 var $buttonGroup = $(buttonGroup); 3026 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 3027 $buttonGroup.find('.active').removeClass('active'); 3028 $(this).addClass('active'); 3029 3030 }); 3031 3032 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 3033 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 3034 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 3035 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 3036 e.preventDefault(); 3037 $cats_filters.slideToggle(400, 'easeInOutCirc'); 3038 }); 3039 3040 }); 3041 window.addEventListener('boxResized', function(e) { 3042 if (UNCODE.printDialogOpen !== false) { 3043 return false;
3044 } 3045 $.each($('.isotope-layout'), function(index, val) { 3046 var $layoutMode = ($(this).data('layout')); 3047 if ($layoutMode === undefined) $layoutMode = 'masonry'; 3048 if ($(this).data('isotope')) { 3049 $(this).isotope({ 3050 itemSelector: $itemSelector, 3051 layoutMode: $layoutMode, 3052 transitionDuration: transitionDuration[index], 3053 masonry: { 3054 columnWidth: colWidth(index) 3055 }, 3056 vertical: { 3057 horizontalAlignment: 0.5, 3058 }, 3059 sortBy: 'original-order', 3060 isOriginLeft: isOriginLeft 3061 }); 3062 $(this).isotope('unbindResize'); 3063 if (SiteParameters.dynamic_srcset_active === '1') { 3064 UNCODE.refresh_dynamic_srcset_size($(this)); 3065 } 3066 } 3067 $(this).find('.mejs-video,.mejs-audio').each(function() { 3068 $(this).trigger('resize'); 3069 }); 3070 }); 3071 }, false); 3072 3073 init_isotope(); 3074 }; 3075} 3076 3077UNCODE.lightbox = function() { 3078 if ( SiteParameters.lbox_enhanced ) { 3079 return true; 3080 } 3081 UNCODE.lightboxArray = {}; 3082 requestTimeout(function() { 3083 var groupsArr = {}; 3084 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 3085 var group = this.getAttribute("data-lbox"), 3086 values = $(this).data(); 3087 $(this).attr('data-lbox-init','true') 3088 groupsArr[group] = values; 3089 }); 3090 for (var i in groupsArr) { 3091 var skin = groupsArr[i].skin || 'black', 3092 path = groupsArr[i].dir || 'horizontal', 3093 thumbs = !groupsArr[i].notmb || false, 3094 arrows = !groupsArr[i].noarr || false, 3095 social = groupsArr[i].social || false, 3096 deeplink = groupsArr[i].deep || false, 3097 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 3098 counter = $els.length, 3099 dataAlbum = $els.attr('data-album'); 3100 if (social) social = { 3101 facebook: true, 3102 twitter: true, 3103 reddit: true, 3104 digg: true 3105 }; 3106 UNCODE.lightboxArray[i] = $els.iLightBox({ 3107 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 3108 skin: skin, 3109 path: path, 3110 linkId: deeplink, 3111 infinite: false, 3112 //fullViewPort: 'fit', 3113 smartRecognition: false, 3114 fullAlone: true, 3115 maxScale: 1, 3116 minScale: .02, 3117 //fullStretchTypes: 'flash, video', 3118 overlay: { 3119 opacity: .94 3120 }, 3121 controls: { 3122 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 3123 fullscreen: true, 3124 thumbnail: thumbs, 3125 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 3126 }, 3127 show: { 3128 speed: 200 3129 }, 3130 hide: { 3131 speed: 200 3132 }, 3133 social: { 3134 start: false, 3135 buttons: social 3136 }, 3137 caption: { 3138 start: false 3139 }, 3140 styles: { 3141 nextOpacity: 1, 3142 nextScale: 1, 3143 prevOpacity: 1, 3144 prevScale: 1 3145 }, 3146 effects: { 3147 switchSpeed: 400 3148 }, 3149 slideshow: { 3150 pauseTime: 5000 3151 }, 3152 thumbnails: { 3153 maxWidth: 60, 3154 maxHeight: 60, 3155 activeOpacity: .2 3156 }, 3157 html5video: { 3158 preload: true 3159 }, 3160 callback: { 3161 onOpen: function(){ 3162 $(window).trigger('uncode-custom-cursor'); 3163 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3164 iNoBounce.enable(); 3165 } 3166 }, 3167 onHide: function(){ 3168 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3169 iNoBounce.disable() 3170 } 3171 }, 3172 } 3173 }); 3174 3175 $(document).on('infinite-loaded', function(){ 3176 UNCODE.lightboxArray[i].refresh(); 3177 }); 3178 3179 $(window).on('gdprOpen', function(){ 3180 UNCODE.lightboxArray[i].close(); 3181 }); 3182 }; 3183 }, 100); 3184 3185 $(document).on('click', '.lb-disabled', function(e){ 3186 e.preventDefault(); 3187 }); 3188}; 3189 3190UNCODE.lightgallery = function( $el ) { 3191 var createSelectors = function(){ 3192 $('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){ 3193 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3194 $(this).addClass('lbox-trigger-item'); 3195 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3196 $(this).addClass('lbox-nested-item'); 3197 } else { 3198 $(this).removeClass('lbox-trigger-item'); 3199 $(this).removeClass('lbox-nested-item'); 3200 } 3201 }); 3202 }; 3203 3204 createSelectors(); 3205 3206 var galleries = [], 3207 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3208 return !$(this).closest('.nested-carousel').length; 3209 }), 3210 $_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]), .btn-container').has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *'), 3211 $galleries = $_galleries.filter(function( index ) { 3212 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3213 }), 3214 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 3215 3216 if ( typeof $el === 'undefined' ) { 3217 $el = $galleries.add( $nested ); 3218 } 3219 3220 var $disabled = $('a.lb-disabled'); 3221 $disabled.on('click', function(e){ 3222 e.preventDefault(); 3223 }); 3224 3225 var beforeSlide = function(event) { 3226 var detail = event.detail, 3227 info = detail.info, 3228 item = detail.item, 3229 $slide = $(detail.currentSlide.selector), 3230 $video = $('video', $slide), 3231 $previous = $(detail.previousSlide.selector), 3232 $prevVideo = $('video', $previous), 3233 isAudio = false;
3234 3235 if ( typeof info.src !== 'undefined' ) { 3236 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 3237 } 3238 3239 if ( ! $video.length && ( info.video || isAudio ) ) { 3240 if ( info.video ) { 3241 if ( typeof info.video === 'object' ) { 3242 var infoJson = info.video; 3243 } else { 3244 var infoJson = JSON.parse(info.video); 3245 } 3246 var src = infoJson.source[0].src, 3247 autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes', 3248 muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes', 3249 loop = $(item).attr('data-loop'); 3250 3251 } else if ( isAudio ) { 3252 var src = info.src, 3253 autoplay = true, 3254 loop = false; 3255 } 3256 if ( typeof src !== 'undefined' ) { 3257 $slide.addClass('has-html5'); 3258 var video = document.createElement('video'); 3259 video.src = src; 3260 video.preload = 'auto'; 3261 video.controls = 'controls'; 3262 video.controlsList = 'nodownload'; 3263 if ( autoplay ) { 3264 video.autoplay = 'autoplay'; 3265 } 3266 if ( muted ) { 3267 video.muted = 'muted'; 3268 } 3269 if ( loop ) { 3270 video.loop = 'loop'; 3271 } 3272 $(video).appendTo($slide); 3273 } 3274 } else { 3275 var $video = $('video', $slide); 3276 if ( $video.length ) { 3277 $video[0].currentTime = 0; 3278 if ( $video[0].autoplay ) { 3279 $video[0].play(); 3280 } 3281 } 3282 } 3283 if ( $prevVideo.length ) { 3284 $prevVideo[0].currentTime = 0; 3285 $prevVideo[0].pause(); 3286 } 3287 }; 3288 3289 var beforeOpen = function(event) { 3290 var detail = event.detail, 3291 items = detail.items, 3292 galleryItems = detail.galleryItems, 3293 outer = detail.outer.selector, 3294 i, ii; 3295 for ( i = 0; i < galleryItems.length; i++ ) { 3296 var item = galleryItems[i]; 3297 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 3298 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 3299 } 3300 } 3301 for ( ii = 0; ii < items.length; ii++ ) { 3302 var item = items[ii]; 3303 if ( $(item).attr('data-icon') === 'video' ) { 3304 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 3305 } 3306 } 3307 3308 }; 3309 3310 //caption builder 3311 $el.each( function( index, val ) { 3312 var $gallery = $(this).attr('data-lbox-init','true'), 3313 $_a = '.lbox-trigger-item', 3314 $_nested_a = '.lbox-nested-item'; 3315 3316 $gallery.find($_a, $_nested_a).each(function(){ 3317 var $a = $(this), 3318 $img = $('img', $a).first(), 3319 imgw = $img.attr('data-width'), 3320 imgh = $img.attr('data-height'), 3321 caption = $a.attr('data-caption'), 3322 title = $a.attr('data-title'); 3323 3324 if ( $img.length && $img.attr('data-crop') != true ) { 3325 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 3326 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 3327 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 3328 $a.attr('data-external-thumb-image', $img[0].src); 3329 } 3330 } 3331 3332 if ( typeof title !== 'undefined' && title !== '' ) { 3333 title = '<h6>' + title + '</h6>'; 3334 } else { 3335 title = ''; 3336 } 3337 3338 if ( typeof caption !== 'undefined' && caption !== '' ) { 3339 caption = '<p>' + caption + '</p>'; 3340 title += caption; 3341 } 3342 3343 if ( title !== '' ) { 3344 $a.attr( 'title', title ); 3345 } 3346 3347 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') ) ) { 3348 $a.attr('data-lg-size', imgw + '-' + imgh); 3349 } 3350 }); 3351 }); 3352 3353 //regular galleries 3354 $el.each( function( index, val ) { 3355 var $gallery = $(this), 3356 $_a = '.lbox-trigger-item', 3357 $_nested_a = '.lbox-nested-item', 3358 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 3359 galleryID = $_first.attr('data-lbox'), 3360 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 3361 tmb = $_first.attr('data-notmb'), 3362 social = $_first.attr('data-social'), 3363 deep = $_first.attr('data-deep'), 3364 zoom = $_first.attr('data-zoom-origin'), 3365 actual = $_first.attr('data-actual-size'), 3366 download = $_first.attr('data-download'), 3367 controls = $_first.attr('data-arrows') !== 'no', 3368 fullScreen = $_first.attr('data-full'),
3369 counter = $_first.attr('data-counter'), 3370 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 3371 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3372 connect = $_first.attr('data-connect'), 3373 lgPlugins = [lgVideo], 3374 itemsLoadedTimeOut; 3375 3376 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3377 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3378 3379 if ( typeof tmb == 'undefined' || !tmb ) { 3380 lgPlugins.push(lgThumbnail); 3381 } 3382 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 3383 lgPlugins.push(lgZoom); 3384 } 3385 if ( typeof deep != 'undefined' && deep != '' ) { 3386 lgPlugins.push(lgHash); 3387 } 3388 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3389 lgPlugins.push(lgFullscreen); 3390 } 3391 if ( social ) { 3392 lgPlugins.push(lgShare); 3393 } 3394 3395 if ( galleries.indexOf( galleryID ) !== -1 ) { 3396 return true; 3397 } 3398 3399 galleries.push( galleryID ); 3400 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 3401 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 3402 var gallery = lightGallery( $triggerGal[0], { 3403 addClass: containerClass, 3404 plugins: lgPlugins, 3405 mode: transition, 3406 selector: $selector, 3407 galleryId: galleryID, 3408 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3409 iframeWidth: '848px', 3410 iframeMaxWidth: '90%', 3411 iframeMaxHeight: '90%', 3412 exThumbImage: 'data-external-thumb-image', 3413 loadYouTubeThumbnail: false, 3414 autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ), 3415 // autoplayFirstVideo: false, 3416 pager: false, 3417 startClass: 'lg-start-opacity', 3418 zoomFromOrigin: zoom, 3419 controls: controls, 3420 download: ( typeof download != 'undefined' && download != '' ), 3421 thumbWidth: 50, 3422 thumbHeight: '50px', 3423 counter: $triggerGal.find($selector).length > 1 ? counter : false, 3424 loadYouTubePoster: false, 3425 enableDrag: $triggerGal.find($selector).length > 1, 3426 mobileSettings: { 3427 showCloseIcon: $('body').hasClass('lightgallery-show-close') ? true : false, 3428 }, 3429 }); 3430 3431 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 3432 e.preventDefault(); 3433 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 3434 gallery.openGallery(index-1); 3435 }); 3436 3437 $triggerGal.on('more-items-loaded', function(e, items) { 3438 clearRequestTimeout(itemsLoadedTimeOut); 3439 itemsLoadedTimeOut = requestTimeout(function(){ 3440 createSelectors(); 3441 gallery.refresh(); 3442 }, 100); 3443 }); 3444 3445 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3446 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3447 $el = model.view.$el; 3448 if ( $el.find($triggerGal).length ) { 3449 gallery.destroy(); 3450 } 3451 }); 3452 } 3453 3454 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 3455 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 3456 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 3457 $(window).trigger('uncode-custom-cursor'); 3458 }); 3459 3460 }); 3461 3462 if ( typeof $el !== 'undefined' ) { 3463 3464 //album galleries 3465 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 3466 var album = val, 3467 galleryID = index, 3468 $album = $(album), 3469 params = $album.attr('data-album'), 3470 tmb = $(val).attr('data-notmb'), 3471 social = $(val).attr('data-social'), 3472 deep = $(val).attr('data-deep'), 3473 actual = $(val).attr('data-actual-size'), 3474 download = $(val).attr('data-download'), 3475 controls = $(val).attr('data-arrows') !== 'no', 3476 fullScreen = $(val).attr('data-full'), 3477 counter = $(val).attr('data-counter'), 3478 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 3479 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3480 lgPlugins = [lgVideo]; 3481 3482 $(val).attr('data-lbox-init','true'); 3483 3484 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3485 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3486 3487 if ( typeof tmb == 'undefined' || !tmb ) { 3488 lgPlugins.push(lgThumbnail); 3489 } 3490 if ( typeof actual != 'undefined' && actual != '' ) { 3491 lgPlugins.push(lgZoom); 3492 } 3493 if ( typeof deep != 'undefined' && deep != '' ) { 3494 lgPlugins.push(lgHash); 3495 } 3496 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3497 lgPlugins.push(lgFullscreen); 3498 } 3499 if ( social ) { 3500 lgPlugins.push(lgShare); 3501 } 3502 3503 var gallery = window.lightGallery(album, { 3504 dynamic: true, 3505 plugins: lgPlugins, 3506 dynamicEl: JSON.parse(params), 3507 galleryId: galleryID, 3508 addClass: containerClass, 3509 mode: transition, 3510 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3511 iframeWidth: '848px', 3512 iframeMaxWidth: '90%', 3513 iframeMaxHeight: '90%', 3514 loadYouTubeThumbnail: false, 3515 autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ), 3516 // autoplayFirstVideo: false, 3517 pager: false, 3518 startClass: 'lg-start-opacity', 3519 zoomFromOrigin: false, 3520 controls: controls, 3521 download: ( typeof download != 'undefined' && download != '' ), 3522 thumbWidth: 50, 3523 thumbHeight: '50px', 3524 loadYouTubePoster: false, 3525 counter: counter 3526 }); 3527 3528 $album.on('click', function(){ 3529 gallery.openGallery(0); 3530 }); 3531 3532 album.addEventListener('lgBeforeSlide', beforeSlide); 3533 album.addEventListener('lgBeforeOpen', beforeOpen); 3534 album.addEventListener('lgAfterOpen', function(){ 3535 $(window).trigger('uncode-custom-cursor'); 3536 }); 3537 3538 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3539 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3540 $el = model.view.$el; 3541 if ( $el.find($album).length ) { 3542 gallery.destroy(); 3543 } 3544 }); 3545 } 3546 3547 }); 3548 3549 //single images 3550 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 3551 var gallery = lightGallery( $('.page-wrapper')[0], { 3552 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 3553 iframeWidth: '848px', 3554 iframeMaxWidth: '90%', 3555 iframeMaxHeight: '90%', 3556 loadYouTubeThumbnail: false, 3557 // autoplayFirstVideo: false, 3558 startClass: 'lg-start-opacity', 3559 thumbWidth: 50, 3560 thumbHeight: '50px', 3561 download: false, 3562 loadYouTubePoster: false, 3563 counter: false 3564 }); 3565 3566 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 3567 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 3568 }); 3569 } 3570}; 3571 3572UNCODE.carousel = function(container) { 3573 var $owlContainers = $('.owl-carousel-container', container); 3574 $owlContainers.each(function() { 3575 var $owlContainer = $(this), 3576 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 3577 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 3578 values = {}, 3579 tempTimeStamp, 3580 newWidth = UNCODE.wwidth, 3581 $owlInsideEqual = []; 3582 $owlSelector.each(function() { 3583 var itemID = $(this).attr('id'), 3584 $elSelector = $(('#' + itemID).toString()); 3585 values['id'] = itemID; 3586 values['items'] = 1;
3587 values['columns'] = 3; 3588 values['fade'] = false; 3589 values['nav'] = false; 3590 values['navmobile'] = false; 3591 values['navskin'] = 'light'; 3592 values['navspeed'] = 400; 3593 values['dots'] = false; 3594 values['dotsmobile'] = false; 3595 values['loop'] = false; 3596 values['autoplay'] = false; 3597 values['timeout'] = 3000; 3598 values['autoheight'] = false; 3599 values['stagepadding'] = 0; 3600 values['margin'] = 0; 3601 values['lg'] = 1; 3602 values['md'] = 1; 3603 values['sm'] = 1; 3604 $.each($(this).data(), function(i, v) { 3605 values[i] = v; 3606 }); 3607 3608 if ($(this).closest('.uncode-slider').length) { 3609 values['navskin'] = ''; 3610 values['navmobile'] = false; 3611 //values['dotsmobile'] = true; 3612 } else { 3613 values['navskin'] = ' style-'+values['navskin']+' style-override'; 3614 } 3615 3616 var setIndexActive = function(event, init){ 3617 var init = typeof init === 'undefined' ? false : init, 3618 thiis = $(event.currentTarget); 3619 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 3620 var scrolltop = $(document).scrollTop(), 3621 size = event.page.size, 3622 i; 3623 var setIndex = requestTimeout(function() { 3624 for ( i = 0; i < size; i++ ) { 3625 var itemCont = event.item.index != null ? (event.item.index + i) : i; 3626 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 3627 if (thiis.closest('.row-slider').length) { 3628 if (currentItem == undefined) { 3629 currentItem = thiis.children()[i]; 3630 } 3631 if ($(currentItem).closest('#page-header').length) { 3632 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3633 UNCODE.switchColorsMenu(scrolltop, 'dark'); 3634 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3635 UNCODE.switchColorsMenu(scrolltop, 'light'); 3636 } 3637 } 3638 } 3639 var itendIndex = $(currentItem).attr('data-index'); 3640 if ( isNaN(itendIndex) ) { 3641 itendIndex = 1; 3642 } 3643 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 3644 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 3645 if ($.fn.counterUp) { 3646 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 3647 var $counter = $(this); 3648 $counter.addClass('started').counterUp({ 3649 delay: 10, 3650 time: 1500 3651 }); 3652 }); 3653 } 3654 } 3655 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 3656 }, 200); 3657 } 3658 tempTimeStamp = event.timeStamp; 3659 } 3660 3661 /** Initialized */ 3662 $elSelector.on('initialized.owl.carousel', function(event) { 3663 3664 if ( $('.isotope-container', event.currentTarget).length ) { 3665 window.dispatchEvent(UNCODE.boxEvent); 3666 } 3667 3668 $('.owl-dot.active', $elSelector).on('click', function(){ 3669 return false; 3670 }); 3671 3672 var thiis = $(event.currentTarget), 3673 // get the time from the data method 3674 time = thiis.data("timer-id"), 3675 rowParent = thiis.closest('.row-parent'); 3676 3677 if ( typeof rowParent[0] !== 'undefined' ) { 3678 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 3679 } 3680 3681 if (time) { 3682 clearRequestTimeout(time); 3683 } 3684 3685 thiis.addClass('showControls'); 3686 var new_time = requestTimeout(function() { 3687 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 3688 if (thiis.hasClass('owl-height-viewport')) 3689 setItemsRelHeight(thiis); 3690 if (thiis.hasClass('owl-height-equal')) 3691 setItemsHeight(thiis); 3692 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 3693 if (thiis.closest('.unequal, .unexpand').length) { 3694 UNCODE.setRowHeight(rowParent[0], true); 3695 } 3696 if (SiteParameters.dynamic_srcset_active === '1') { 3697 UNCODE.refresh_dynamic_srcset_size(thiis); 3698 } 3699 }, 350); 3700 // save the new time 3701 thiis.data("timer-id", new_time); 3702 3703 var scrolltop = $(document).scrollTop(); 3704 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 3705 3706 //if (!UNCODE.isMobile) { 3707 /** fix autoplay when visible **/ 3708 $(window).on('load', function(){ 3709 if (thiis.data('autoplay')) { 3710 if ( !thiis.closest('.sticky-element').length ) { 3711 thiis.trigger('stop.autoplay.owl'); 3712 } else { 3713 thiis.trigger('play.owl.autoplay'); 3714 } 3715 } 3716 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 3717 return; 3718 } 3719 if ( ! thiis.closest('.sticky-element').length ) { 3720 var carouselInView = new Waypoint.Inview({ 3721 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3722 element: thiis[0], 3723 exited: function() { 3724 var el = $(this.element); 3725 if (el.data('autoplay') ) { 3726 el.trigger('stop.owl.autoplay'); 3727 el.data('stopped','true'); 3728 } 3729 }, 3730 enter: function(direction) { 3731 var el = $(this.element); 3732 requestTimeout(function() { 3733 if (el.data('autoplay')) { 3734 el.trigger('play.owl.autoplay'); 3735 el.data('stopped','false'); 3736 } 3737 }, 100); 3738 } 3739 }); 3740 } 3741 }); 3742 //} 3743 3744 // $(window).on('frontend:carousel_updated', function(){ 3745 // Waypoint.refreshAll(); 3746 // }); 3747 3748 if (!thiis.closest('.isotope-system').length) { 3749 requestTimeout(function() { 3750 animate_thumb($('.t-inside', el), event); 3751 }, 400); 3752 } else { 3753 requestTimeout(function() { 3754 thiis.closest('.isotope-container').isotope('layout'); 3755 }, 400); 3756 } 3757 3758 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3759 currentIndex = $(currentItem).attr('data-index'); 3760 3761 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3762 if ($(val).closest('.uncode-slider').length) { 3763 $(val).removeClass('start_animation'); 3764 } 3765 }); 3766 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3767 if ($(val).closest('.uncode-slider').length) { 3768 $(val).removeClass('already-animated'); 3769 } 3770 }); 3771 3772 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3773 if ($(val).closest('.uncode-slider').length) { 3774 $(val).removeAttr('data-animated'); 3775 } 3776 }); 3777 3778 $.each($('.owl-item.cloned', thiis), function(index, val) {
3779 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 3780 }); 3781 3782 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3783 if ($(val).attr('data-index') != currentIndex) { 3784 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3785 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3786 } 3787 if ($(val).attr('data-index') != currentIndex) { 3788 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 3789 } 3790 if ($(val).attr('data-index') == currentIndex) { 3791 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3792 } 3793 }); 3794 3795 if (thiis.closest('.uncode-slider').length) { 3796 var el = thiis.closest('.row-parent')[0]; 3797 if ($(el).data('imgready')) { 3798 firstLoaded(el, event); 3799 } else { 3800 el.addEventListener("imgLoaded", function(el) { 3801 firstLoaded(el.target, event); 3802 }, false); 3803 } 3804 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 3805 if (transHeight != null) { 3806 requestTimeout(function() { 3807 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 3808 }, 100); 3809 } 3810 } else { 3811 var el = thiis; 3812 el.closest('.uncode-slider').addClass('slider-loaded'); 3813 } 3814 3815 requestTimeout(function() { 3816 if (typeof UNCODE.bigText !== 'undefined') { 3817 UNCODE.bigText(thiis); 3818 } 3819 if (thiis.closest('.uncode-slider').length) { 3820 if (thiis.data('autoplay')) pauseOnHover(thiis); 3821 } 3822 }, 500); 3823 3824 if (thiis.closest('.unequal').length) { 3825 $owlInsideEqual.push(thiis.closest('.row-parent')); 3826 } 3827 3828 var containerClasses = '', 3829 containerStyle = ''; 3830 if ( $('.owl-dots-classes', $owlContainer).length ) { 3831 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 3832 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 3833 $('.owl-dots-classes', $owlContainer).remove(); 3834 } 3835 3836 if ( containerClasses !== '' ) { 3837 requestTimeout(function() { 3838 if ( containerClasses !== '' ) 3839 $('.owl-dots', $owlContainer).attr('style', containerStyle); 3840 if ( containerStyle !== '' ) 3841 $('.owl-dots', $owlContainer).addClass(containerClasses); 3842 }, 100); 3843 } 3844 3845 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 3846 $(val).closest('.row-inner').css({ 3847 'margin-top': '-1px' 3848 }); 3849 }); 3850 3851 if ($.fn.isotope) { 3852 if ( thiis.closest('.isotope-container').length ) { 3853 if (thiis.closest('.isotope-container').data('isotope')) { 3854 requestTimeout(function(){ 3855 thiis.closest('.isotope-container').isotope('layout'); 3856 }, 300); 3857 } 3858 $(window).on('load', function(){ 3859 if (thiis.closest('.isotope-container').data('isotope')) { 3860 thiis.closest('.isotope-container').isotope('layout'); 3861 } 3862 }); 3863 } 3864 } 3865 3866 if (thiis.data('autoplay')) { 3867 $(window).on('menuOpen', function(){ 3868 thiis.trigger('stop.owl.autoplay'); 3869 thiis.data('stopped','true'); 3870 }).on('menuClose', function(){ 3871 3872 }); 3873 } 3874 $(window).on('menuClose', function(){ 3875 if (thiis.data('autoplay')) { 3876 thiis.trigger('play.owl.autoplay'); 3877 thiis.data('stopped','false'); 3878 } 3879 }); 3880 3881 setIndexActive(event, true); 3882 3883 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3884 return !$(this).closest('.nested-carousel').length; 3885 }), 3886 $_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), 3887 $galleries = $_galleries.filter(function( index ) { 3888 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3889 }); 3890 3891 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 3892 UNCODE.lightgallery( $galleries ); 3893 } 3894 3895 3896 }); 3897 3898 $elSelector.on('resized.owl.carousel', function(event) { 3899 var thiis = $(event.currentTarget); 3900 // if ($(this).closest('.nested-carousel').length) { 3901 // requestTimeout(function() { 3902 // window.dispatchEvent(UNCODE.boxEvent); 3903 // }, 200); 3904 // } 3905 if ( thiis.hasClass('owl-height-equal') ) 3906 setItemsHeight(thiis); 3907 3908 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 3909 newWidth = UNCODE.wwidth; 3910 setItemsRelHeight($elSelector); 3911 } 3912 3913 setIndexActive(event); 3914
3915 if (SiteParameters.dynamic_srcset_active === '1') { 3916 UNCODE.refresh_dynamic_srcset_size(thiis); 3917 } 3918 3919 if ($.fn.isotope) { 3920 $(window).on('load', function(){ 3921 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 3922 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 3923 } 3924 }); 3925 } 3926 }); 3927 3928 /** detect resize window for fluid height layout */ 3929 var setFluidResize; 3930 function manageFluidCarouseHeight() { 3931 clearRequestTimeout(setFluidResize); 3932 setFluidResize = requestTimeout(function(){ 3933 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 3934 newWidth = UNCODE.wwidth; 3935 setItemsRelHeight($elSelector); 3936 } 3937 }, 100); 3938 } 3939 window.addEventListener('resize', manageFluidCarouseHeight); 3940 3941 /** Change */ 3942 $elSelector.on('change.owl.carousel', function(event) { 3943 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 3944 }); 3945 3946 /** Changed */ 3947 $elSelector.on('changed.owl.carousel', function(event) { 3948 var $row = $elSelector.parents('.row')[0]; 3949 if ( typeof $row !== 'undefined' ) { 3950 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 3951 } 3952 setIndexActive(event); 3953 }); 3954 3955 var checkDrag = function(e) { 3956 $elSelector.addClass('owl-dragging'); 3957 }; 3958 $elSelector.on('drag.owl.carousel', function(event) { 3959 document.addEventListener("mousemove", checkDrag); 3960 }); 3961 3962 $elSelector.on('dragged.owl.carousel', function(event) { 3963 $elSelector.removeClass('owl-dragging'); 3964 document.removeEventListener("mousemove", checkDrag); 3965 }); 3966 3967 $elSelector.on('translate.owl.carousel', function(event) { 3968 if (UNCODE.isMobile) { 3969 $(event.currentTarget).addClass('owl-translating'); 3970 } 3971 }); 3972 3973 /** Translated */ 3974 $elSelector.on('translated.owl.carousel', function(event) { 3975 3976 var thiis = $(event.currentTarget), 3977 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3978 currentIndex = $(currentItem).attr('data-index'), 3979 stagePadding = thiis.data('stagepadding'); 3980 3981 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3982 3983 if (!UNCODE.isMobile) { 3984 UNCODE.owlPlayVideo(thiis); 3985 } 3986 3987 requestTimeout(function(){ 3988 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 3989 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 3990 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 3991 if (lastDelayElems == undefined) lastDelayElems = 0; 3992 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3993 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3994 thiis.trigger('stop.owl.autoplay'); 3995 requestTimeout(function() { 3996 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 3997 }, maxDelay); 3998 } 3999 }, 200); 4000 4001 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4002 if ($(val).closest('.uncode-slider').length) { 4003 $(val).removeClass('start_animation'); 4004 } 4005 }); 4006 4007 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4008 if ($(val).closest('.uncode-slider').length) { 4009 $(val).removeClass('already-animated'); 4010 } 4011 }); 4012 4013 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4014 if ($(val).closest('.uncode-slider').length) { 4015 $(val).removeAttr('data-animated'); 4016 } 4017 }); 4018 4019 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4020 if ($(val).attr('data-index') != currentIndex) { 4021 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4022 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4023 } 4024 if ($(val).attr('data-index') != currentIndex) { 4025 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4026 } 4027 if ($(val).attr('data-index') == currentIndex) { 4028 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4029 } 4030 }); 4031 4032 if (UNCODE.isMobile) { 4033 thiis.removeClass('owl-translating'); 4034 } 4035 4036 setIndexActive(event); 4037 }); 4038 4039 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4040 4041 /** Init carousel */ 4042 $elSelector.not('.showControls').owlCarousel({ 4043 items: values['items'], 4044 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4045 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4046 nav: values['nav'], 4047 dots: values['dots'], 4048 loop: values['loop'], 4049 stagePadding: values['stagepadding'], 4050 margin: 0, 4051 video: true, 4052 autoWidth: false, 4053 autoplay: false, 4054 autoplayTimeout: values['timeout'], 4055 autoplaySpeed: values['navspeed'], 4056 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4057 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4058 rtl: $('body').hasClass('rtl') ? true : false, 4059 fluidSpeed: true, 4060 navSpeed: values['navspeed'], 4061 dotsSpeed: values['navspeed'] / values['items'], 4062 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4063 navText: ['<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-left"></i></div>', '<div class="owl-nav-container btn-default btn-hover-nobg"><i class="fa fa-fw fa-angle-right"></i></div>'], 4064 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4065 responsiveClass: true, 4066 responsiveBaseElement: '.box-container', 4067 responsive: { 4068 0: { 4069 items: values['sm'], 4070 nav: values['navmobile'], 4071 dots: values['dotsmobile'], 4072 dotsSpeed: values['navspeed'] / values['sm'], 4073 }, 4074 480: { 4075 items: values['sm'], 4076 nav: values['navmobile'], 4077 dots: values['dotsmobile'], 4078 dotsSpeed: values['navspeed'] / values['sm'], 4079 }, 4080 570: { 4081 items: values['md'], 4082 nav: values['navmobile'], 4083 dots: values['dotsmobile'], 4084 dotsSpeed: values['navspeed'] / values['md'], 4085 }, 4086 960: { 4087 items: values['lg'], 4088 dotsSpeed: values['navspeed'] / values['lg'], 4089 } 4090 } 4091 }); 4092 4093 var transDuration = parseFloat(values['navspeed']) * 0.3; 4094 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4095 4096 $('.owl-item .tmb', $elSelector).css({ 4097 '-webkit-transition-delay': transDuration + 'ms', 4098 '-moz-transition-delay': transDuration + 'ms', 4099 '-o-transition-delay': transDuration + 'ms', 4100 'transition-delay': transDuration + 'ms', 4101 '-webkit-transition-duration': transDuration2 + 'ms', 4102 '-moz-transition-duration': transDuration2 + 'ms', 4103 '-o-transition-duration': transDuration2 + 'ms', 4104 'transition-duration': transDuration2 + 'ms', 4105 }); 4106 4107 requestTimeout(function() { 4108 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4109 UNCODE.setRowHeight($owlInsideEqual[i]); 4110 }; 4111 }, 300); 4112 4113 $(window).on('load', function(){ 4114 var $elCarousel = $elSelector.data('owl.carousel'); 4115 if ( typeof $elCarousel !== 'undefined' ) { 4116 $elCarousel.trigger('refreshed'); 4117 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4118 UNCODE.setRowHeight($owlInsideEqual[i]); 4119 }; 4120 } 4121 }); 4122 4123 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4124 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4125 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4126 $('#' + carousel_id).find('.owl-item').each( function() { 4127 var $item = $(this), 4128 index = ( $item.index() + 1 ); 4129 $item.attr('data-index', index); 4130 }); 4131 } 4132 }); 4133 4134 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4135 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4136 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4137 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4138 $('#' + carousel_id).find('.owl-item').each( function() { 4139 var $item = $(this), 4140 index = ( $item.index() + 1 ); 4141 $item.attr('data-index', index); 4142 }); 4143 } 4144 }); 4145 } 4146 4147 }); 4148 4149 function firstLoaded(el, event) { 4150 var el = $(el), 4151 uncode_slider = el.find('.uncode-slider'); 4152 el.find('.owl-carousel').css('opacity', 1); 4153 uncode_slider.addClass('slider-loaded'); 4154 if (typeof UNCODE.bigText !== 'undefined') { 4155 UNCODE.bigText(el.find('.owl-item.active')); 4156 } 4157 //if (!UNCODE.isMobile) { 4158 requestTimeout(function() { 4159 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4160 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4161 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4162 if (lastDelayElems == undefined) lastDelayElems = 0; 4163 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4164 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4165 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4166 requestTimeout(function() { 4167 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4168 }, maxDelay); 4169 } 4170 }, 500); 4171 4172 //} 4173 } 4174 4175 function navHover(el) { 4176 var $owlCont = el, 4177 $owlPrev = $owlCont.find('.owl-prev'), 4178 $owlNext = $owlCont.find('.owl-next'), 4179 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4180 $owlPagination = $owlCont.next(), 4181 owlPrevW = $owlPrev.outerWidth(), 4182 owlNextW = $owlNext.outerWidth(), 4183 owlDotsH = $owlDots.innerHeight(), 4184 owlTime = 400, 4185 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4186 if ( $('body').hasClass('rtl') ) { 4187 $owlPrev.css("margin-right", -owlPrevW); 4188 $owlNext.css("margin-left", -owlNextW); 4189 } else { 4190 $owlPrev.css("margin-left", -owlPrevW); 4191 $owlNext.css("margin-right", -owlNextW); 4192 } 4193 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4194 $owlCont.mouseenter(function() { 4195 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4196 $owlPrev.add($owlNext).css({ 4197 marginLeft: 0, 4198 marginRight: 0 4199 }); 4200 if (!owlNested) { 4201 $owlDots.css({ 4202 opacity: 1, 4203 bottom: 0 4204 }); 4205 } 4206 }).mouseleave(function() { 4207 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4208 if ( $('body').hasClass('rtl') ) { 4209 $owlPrev.css("margin-right", -owlPrevW); 4210 $owlNext.css("margin-left", -owlNextW); 4211 } else { 4212 $owlPrev.css("margin-left", -owlPrevW); 4213 $owlNext.css("margin-right", -owlNextW); 4214 } 4215 if (!owlNested) { 4216 $owlDots.css({ 4217 opacity: 1, 4218 bottom: -owlDotsH 4219 }); 4220 } 4221 }); 4222 }; 4223 4224 function animate_elems($this) { 4225 var lastDelay; 4226 $.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) { 4227 var element = $(val), 4228 delayAttr = element.attr('data-delay'), 4229 $first_item = element.closest('.owl-item[data-index="1"]'); 4230 4231 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4232 return false;
4233 } 4234 4235 if (delayAttr == undefined) delayAttr = 0; 4236 requestTimeout(function() { 4237 element.addClass('start_animation'); 4238 }, delayAttr); 4239 lastDelay = delayAttr; 4240 }); 4241 return lastDelay; 4242 } 4243 4244 function animate_thumb(items, event) { 4245 var lastDelay, 4246 itemIndex, 4247 thiis = $(event.currentTarget), 4248 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4249 numActives = $('.owl-item.active', thiis).length, 4250 stagePadding = thiis.data('stagepadding'); 4251 4252 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4253 4254 thiis.data('tempIndex', event.item.index); 4255 $.each(items, function(index, val) { 4256 var parent = $(val).closest('.owl-item'); 4257 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4258 return; 4259 } 4260 if (!$(val).hasClass('start_animation')) { 4261 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4262 var thumbInView = new Waypoint.Inview({ 4263 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4264 element: val, 4265 enter: function(direction) { 4266 var element = $(this.element), 4267 delayAttr = parseInt(element.attr('data-delay')), 4268 itemIndex = element.closest('.owl-item').index() + 1, 4269 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4270 if (itemIndex > tempIndex) { 4271 thiis.data('tempIndex', itemIndex); 4272 } 4273 if (isNaN(delayAttr)) delayAttr = 100; 4274 if (stagePadding) { 4275 var objTimeout = requestTimeout(function() { 4276 element.addClass('start_animation'); 4277 }, index * delayAttr); 4278 lastDelay = index * delayAttr; 4279 } else { 4280 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4281 var objTimeout = requestTimeout(function() { 4282 element.addClass('start_animation'); 4283 }, diffItem * delayAttr); 4284 lastDelay = diffItem * delayAttr; 4285 } 4286 parent.data('objTimeout', objTimeout); 4287 if (!UNCODE.isUnmodalOpen) { 4288 this.destroy(); 4289 } 4290 } 4291 }); 4292 } 4293 } 4294 }); 4295 return lastDelay; 4296 } 4297 4298 function setItemsHeight(item) { 4299 $.each($('.owl-item', item), function(index, val) { 4300 var availableThumbHeight = $('.t-inside', $(val)).height(), 4301 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4302 difference = availableThumbHeight - innerThumbHeight; 4303 if ($('.tmb-content-under', val).length) { 4304 var visualPart = $('.t-entry-visual', val); 4305 if (visualPart.length) { 4306 difference -= $('.t-entry-visual', val).height(); 4307 } 4308 } 4309 if (! $('.tmb-content-lateral', val).length) 4310 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4311 }); 4312 } 4313 4314 function setItemsRelHeight(item) { 4315 $.each($('.owl-item', item), function(index, val) { 4316 var $rowContainer = $(item).parents('.row-parent').eq(0), 4317 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4318 $colContainer = $(item).parents('.uncell').eq(0), 4319 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4320 winHeight = UNCODE.wheight, 4321 multiplier_h = parseInt($(item).attr('data-vp-height')), 4322 data_viewport_h, 4323 consider_menu = $(item).data('vp-menu'); 4324 4325 if ( consider_menu ) { 4326 winHeight = winHeight - UNCODE.menuHeight; 4327 } 4328 4329 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4330 $('.t-inside', val).css( 'height', data_viewport_h ); 4331 }); 4332 } 4333 4334 function pauseOnHover(slider) { 4335 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 4336 mouseenter: function () { 4337 $(slider).addClass('owl-mouseenter'); 4338 $(slider).trigger('stop.owl.autoplay'); 4339 }, 4340 mouseleave: function () { 4341 $(slider).removeClass('owl-mouseenter'); 4342 $(slider).trigger('play.owl.autoplay'); 4343 } 4344 }); 4345 } 4346 }); 4347}; 4348 4349UNCODE.owlPlayVideo = function(carousel) { 4350 var player, iframe; 4351 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4352 var content = $(val).html(); 4353 if (content == '') { 4354 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4355 $(val).append(getCloned); 4356 } 4357 if ($(this).attr('data-provider') == 'vimeo') { 4358 iframe = $(this).find('iframe'); 4359 player = new Vimeo.Player(iframe[0]); 4360 player.play(); 4361 } else if ($(this).attr('data-provider') == 'youtube') { 4362 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4363 } else { 4364 var player = $(this).find('video'); 4365 if (player.length) { 4366 $(this).find('video')[0].volume = 0; 4367 $(this).find('video')[0].play(); 4368 $(val).css('opacity', 1); 4369 } 4370 } 4371 }); 4372}; 4373 4374UNCODE.owlStopVideo = function(carousel) { 4375 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4376 var player, iframe; 4377 if ($(this).attr('data-provider') == 'vimeo') { 4378 iframe = $(this).find('iframe'); 4379 player = new Vimeo.Player(iframe[0]); 4380 player.pause(); 4381 } else if ($(this).attr('data-provider') == 'youtube') { 4382 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4383 } else { 4384 var player = $(this).find('video'); 4385 if (player.length) { 4386 $(this).find('video')[0].volume = 0; 4387 $(this).find('video')[0].play(); 4388 } 4389 } 4390 }); 4391}; 4392 4393UNCODE.animations = function() { 4394 4395 var runWaypoints_TO, 4396 runWaypoints_carousel_TO, 4397 runWaypoints_delay = 0, 4398 highlightComplexFunc = function($wrap, ev){ 4399 4400 var $lines = $('.heading-line-wrap', $wrap), 4401 not_animate = false;
4402 4403 if ( $wrap.data('animate') === true ) { 4404 not_animate = true; 4405 } 4406 4407 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4408 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4409 return; 4410 } 4411 4412 $lines.each(function(_key, _value){ 4413 var $line = $(_value), 4414 $inners = $('.split-word-inner', $line), 4415 $highlights = $('.heading-text-highlight-inner', $line); 4416 4417 var highlitInnerFunc = function(ev){ 4418 var delay = 0; 4419 $highlights.each(function(h_key, high){ 4420 var $highlight = $(high), 4421 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4422 $nextSplit = $split.nextUntil(), 4423 $next = $('.heading-text-highlight-inner', $nextSplit), 4424 countCh = $split.text().length; 4425 4426 $highlight.css({ 4427 '-webkit-transition-duration': (30 * countCh) + 'ms', 4428 '-moz-transition-duration': (30 * countCh) + 'ms', 4429 '-o-transition-duration': (30 * countCh) + 'ms', 4430 'transition-duration': (30 * countCh) + 'ms', 4431 }); 4432 4433 delay += (30 * countCh); 4434 4435 $next.css({ 4436 '-webkit-transition-delay': delay + 'ms', 4437 '-moz-transition-delay': delay + 'ms', 4438 '-o-transition-delay': delay + 'ms', 4439 'transition-delay': delay + 'ms', 4440 }); 4441 }); 4442 $highlights.removeAttr('data-animated'); 4443 if ( _key+1 === $lines.length ) { 4444 $wrap.data('animate', true); 4445 } 4446 }; 4447 4448 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4449 if ( not_animate ) { 4450 $highlights.each(function(h_key, high){ 4451 var $highlight = $(high); 4452 $highlight.css({ 4453 '-webkit-transition-duration': '0ms', 4454 '-moz-transition-duration': '0ms', 4455 '-o-transition-duration': '0ms', 4456 'transition-duration': '0ms', 4457 }); 4458 }); 4459 $highlights.removeAttr('data-animated'); 4460 } else { 4461 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4462 highlitInnerFunc(); 4463 } else { 4464 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4465 } 4466 } 4467 } 4468 }); 4469 }; 4470 4471 $.each($('.header-content-inner'), function(index, val) { 4472 var element = $(val), 4473 transition = ''; 4474 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4475 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4476 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4477 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4478 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4479 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4480 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4481 if (transition != '') { 4482 $(val).removeClass(transition); 4483 var container = element, 4484 containerDelay = container.attr('data-delay'), 4485 containerSpeed = container.attr('data-speed'), 4486 items = $('.header-title > *, .post-info', container); 4487 $.each(items, function(index, val) { 4488 var element = $(val), 4489 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4490 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4491 if (!element.hasClass('animate_when_almost_visible')) { 4492 delayAttr = Number(delayAttr) + (400 * index); 4493 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4494 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4495 } 4496 }); 4497 container.css('opacity', 1); 4498 } 4499 }); 4500 4501 function animate_css_grids_on_load() { 4502 $('.cssgrid-system').each(function() { 4503 var grid = $(this); 4504 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4505 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4506 }); 4507 } 4508 4509 window.waypoint_animation = function(ev) { 4510 $.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)'), function(index, val) { 4511 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 ) ) { 4512 return true; 4513 } 4514 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4515 return; 4516 } 4517 var run = true, 4518 $carousel = $(val).closest('.owl-carousel'); 4519 if ( $carousel.length ) { 4520 run = false;
4521 } 4522 if (run) { 4523 new Waypoint({ 4524 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4525 element: val, 4526 handler: function() { 4527 var element = $(this.element), 4528 index = element.index(), 4529 delayAttr = element.attr('data-delay'); 4530 if (delayAttr == undefined) delayAttr = 0; 4531 requestTimeout(function() { 4532 element.addClass('start_animation'); 4533 }, delayAttr); 4534 if (!UNCODE.isUnmodalOpen) { 4535 this.destroy(); 4536 } 4537 }, 4538 offset: UNCODE.isFullPage ? '100%' : '90%' 4539 }); 4540 } 4541 }); 4542 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4543 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4544 return; 4545 } 4546 var run = true, 4547 $carousel = $(val).closest('.owl-carousel'); 4548 if ( $carousel.length ) { 4549 run = false; 4550 } 4551 if (run) { 4552 new Waypoint({ 4553 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4554 element: val, 4555 handler: function() { 4556 var $element = $(this.element), 4557 $childs = $('.animate_when_parent_almost_visible', $element); 4558 $childs.each(function(key,el){ 4559 var $child = $(el), 4560 delaySpeed = $child.attr('data-speed'), 4561 delayAttr = $child.attr('data-delay'), 4562 intervalAttr = $child.attr('data-interval'); 4563 if (delayAttr == undefined) { 4564 delayAttr = 50*key; 4565 } 4566 requestTimeout(function() { 4567 $child.addClass('start_animation'); 4568 if ( $child.hasClass('anim-line-checker') ) { 4569 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4570 var $line = $child.closest('.heading-line-wrap'); 4571 }); 4572 } 4573 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4574 highlightComplexFunc($wrapText, ev); 4575 if ( $child.hasClass('anim-tot-checker') ) { 4576 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4577 if ( $child.hasClass('anim-tot-checker') ) { 4578 $wrapText.addClass('already-animated'); 4579 $element.trigger('already-animated'); 4580 } 4581 }); 4582 } 4583 }, delayAttr ); 4584 }); 4585 $element.addClass('start_animation'); 4586 if (!UNCODE.isUnmodalOpen) { 4587 this.destroy(); 4588 } 4589 }, 4590 offset: UNCODE.isFullPage ? '100%' : '90%' 4591 }); 4592 } 4593 }); 4594 } 4595 window.waypoint_carousel_animation = function(ev) { 4596 $.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) { 4597 if ( $(val).hasClass('el-text-split') ) { 4598 return true; 4599 } 4600 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4601 return; 4602 } 4603 var run = true, 4604 $carousel = $(val).closest('.owl-carousel'), 4605 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4606 $all_first = $('.owl-item[data-index="1"]', $carousel); 4607 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4608 run = false; 4609 } 4610 if (run) { 4611 new Waypoint({ 4612 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4613 element: val, 4614 handler: function() { 4615 var element = $(this.element), 4616 index = element.index(), 4617 delayAttr = element.attr('data-delay'); 4618 if (delayAttr == undefined) delayAttr = 0; 4619 requestTimeout(function() { 4620 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4621 $all_first.attr('data-already-reached', 'true'); 4622 } 4623 element.addClass('start_animation'); 4624 }, delayAttr); 4625 if (!UNCODE.isUnmodalOpen) { 4626 this.destroy(); 4627 } 4628 }, 4629 offset: UNCODE.isFullPage ? '100%' : '90%' 4630 }); 4631 } 4632 }); 4633 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 4634 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4635 return; 4636 } 4637 var run = true, 4638 $carousel = $(val).closest('.owl-carousel'), 4639 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4640 $all_first = $('.owl-item[data-index="1"]', $carousel); 4641 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4642 run = false;
4643 } 4644 if (run) { 4645 new Waypoint({ 4646 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4647 element: val, 4648 handler: function() { 4649 var $element = $(this.element), 4650 $childs = $('.animate_when_parent_almost_visible', $element); 4651 $childs.each(function(key,el){ 4652 var $child = $(el), 4653 delaySpeed = $child.attr('data-speed'), 4654 delayAttr = $child.attr('data-delay'), 4655 intervalAttr = $child.attr('data-interval'); 4656 if (delayAttr == undefined) { 4657 delayAttr = 50*key; 4658 } 4659 requestTimeout(function() { 4660 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4661 $all_first.attr('data-already-reached', 'true'); 4662 } 4663 $child.addClass('start_animation'); 4664 if ( $child.hasClass('anim-line-checker') ) { 4665 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4666 var $line = $child.closest('.heading-line-wrap'); 4667 }); 4668 } 4669 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4670 highlightComplexFunc($wrapText, ev); 4671 if ( $child.hasClass('anim-tot-checker') ) { 4672 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4673 if ( $child.hasClass('anim-tot-checker') ) { 4674 $wrapText.addClass('already-animated'); 4675 } 4676 }); 4677 } 4678 }, delayAttr ); 4679 }); 4680 $element.addClass('start_animation'); 4681 if (!UNCODE.isUnmodalOpen) { 4682 this.destroy(); 4683 } 4684 }, 4685 offset: UNCODE.isFullPage ? '100%' : '90%' 4686 }); 4687 } 4688 }); 4689 } 4690 4691 var runWaypoints = function(ev){ 4692 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 4693 runWaypoints_delay = 400; 4694 } 4695 clearRequestTimeout(runWaypoints_TO); 4696 runWaypoints_TO = requestTimeout(function() { 4697 window.waypoint_animation(ev); 4698 }, runWaypoints_delay); 4699 4700 clearRequestTimeout(runWaypoints_carousel_TO); 4701 runWaypoints_carousel_TO = requestTimeout(function() { 4702 window.waypoint_carousel_animation(ev); 4703 }, 400); 4704 }; 4705 runWaypoints(); 4706 animate_css_grids_on_load(); 4707 4708 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 4709 runWaypoints(ev); 4710 }); 4711 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4712 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 4713 } 4714}; 4715 4716UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 4717 var $allItems = elements.length - startIndex, 4718 showed = 0, 4719 index = 0, 4720 use_index = false 4721 ; 4722 4723 if (filtering) { 4724 if (sequential) { 4725 use_index = true; 4726 } 4727 sequential = false; 4728 } 4729 4730 $.each(elements, function(index, val) { 4731 var $this = $(val), 4732 elInner = $('> .t-inside', val); 4733 4734 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4735 return; 4736 } 4737 if (val[0]) val = val[0]; 4738 4739 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4740 new Waypoint({ 4741 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4742 element: val, 4743 handler: function() { 4744 var element = $('> .t-inside', this.element), 4745 parent = $(this.element); 4746 var _index = use_index? index : 0; 4747 4748 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 4749 delayAttr = parseInt(element.attr('data-delay')); 4750 if (isNaN(delayAttr)) delayAttr = 100; 4751 if (sequential || use_index) { 4752 delay -= showed; 4753 } 4754 var objTimeout = requestTimeout(function() { 4755 element.removeClass('zoom-reverse').addClass('start_animation'); 4756 showed = index; 4757 }, delay * delayAttr); 4758 parent.data('objTimeout', objTimeout); 4759 if (!UNCODE.isUnmodalOpen) { 4760 this.destroy(); 4761 } 4762 }, 4763 offset: UNCODE.isFullPage ? '100%' : '90%' 4764 }); 4765 } 4766 4767 index++; 4768 }); 4769}; 4770 4771UNCODE.tapHover = function() { 4772 4773 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 4774 elClass = "hover"; 4775 4776 $(window).on('click', function() { 4777 $el.removeClass(elClass); 4778 }); 4779 4780 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 4781 e.stopPropagation(); 4782 var link = $(this); 4783 if ( ! link.hasClass(elClass)) { 4784 e.preventDefault(); 4785 link.addClass("hover"); 4786 $el.not(this).removeClass(elClass); 4787 return false;
4788 } 4789 }); 4790}; 4791 4792UNCODE.onePage = function(isMobile) { 4793 var current = 0, 4794 last = 0, 4795 lastScrollTop = 0, 4796 forceScroll = false, 4797 lastScrolled = 0, 4798 isSectionscroller = ($('.main-onepage').length) ? true : false, 4799 isOnePage = false, 4800 getOffset = function () { 4801 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); 4802 return calculateOffset; 4803 } 4804 4805 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 4806 // return false; 4807 4808 function init_onepage() { 4809 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 4810 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4811 } 4812 last = $('.onepage-pagination li').last().find('a').data('index'); 4813 $.each($('div[data-parent="true"]'), function(index, val) { 4814 $(this).attr('data-section', index); 4815 if (isMobile) return; 4816 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4817 return; 4818 } 4819 var sectionDown = new Waypoint({ 4820 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4821 element: val, 4822 handler: function(direction) { 4823 if (direction == 'down') { 4824 changeMenuActive(this.element, index); 4825 } 4826 }, 4827 offset: function() { 4828 return 5 + getOffset() 4829 } 4830 }); 4831 var sectionUp = new Waypoint({ 4832 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4833 element: val, 4834 handler: function(direction) { 4835 if (direction == 'up') { 4836 changeMenuActive(this.element, index); 4837 } 4838 }, 4839 offset: function() { 4840 return -5 - getOffset() 4841 } 4842 }); 4843 4844 if (isSectionscroller) { 4845 var label; 4846 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 4847 else label = ''; 4848 var getName = $(this).attr('data-name'); 4849 if (getName == undefined) getName = index; 4850 if (label != '') { 4851 isOnePage = true; 4852 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 4853 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 4854 } 4855 } 4856 }); 4857 4858 if (isSectionscroller) { 4859 $.each($('ul.onepage-pagination li'), function(index, val) { 4860 var $this = $(val), 4861 $a = ('a', $this); 4862 $a.on('click', function(evt) { 4863 if ( $('.is-selected', $this).length ) { 4864 return false; 4865 } 4866 if ( $('body').hasClass('uncode-scroll-no-history') ) { 4867 evt.preventDefault(); 4868 } 4869 Waypoint.refreshAll(); 4870 var el = $('a', evt.currentTarget); 4871 current = lastScrolled = parseInt(el.attr('data-index')); 4872 lastScrolled += 1; 4873 scrollBody(current); 4874 }); 4875 }); 4876 } 4877 4878 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 4879 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 4880 goToSection = String(window.location.hash).replace(/^#/, ""); 4881 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 4882 } 4883 4884 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 4885 current = lastScrolled = goToSection; 4886 $(window).on('load', function(){ 4887 if ( $('.owl-carousel').length ) { 4888 requestTimeout(function(){ 4889 scrollBody(goToSection); 4890 }, 400); 4891 } else { 4892 scrollBody(goToSection); 4893 } 4894 }); 4895 } 4896 4897 } 4898 4899 function changeMenuActive(section, index) { 4900 current = lastScrolled = parseInt($(section).attr('data-section')); 4901 if (isOnePage) { 4902 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 4903 if (newSection.length) { 4904 $('ul.onepage-pagination li a').removeClass('is-selected'); 4905 newSection.addClass('is-selected'); 4906 } 4907 var getName = $('[data-section="' + index + '"]').attr('data-name'); 4908 if (getName != undefined && getName !== '') { 4909 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 4910 var get_href = $(val).attr('href'); 4911 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4912 $(val).closest('.menu-smart').find('.active').removeClass('active'); 4913 $(val).parent().addClass('active'); 4914 } 4915 }); 4916 } 4917 } 4918 } 4919 4920 if (isOnePage) { 4921 $(window).on('scroll', function() { 4922 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 4923 if (bodyTop == 0) { 4924 $('ul.onepage-pagination li a').removeClass('is-selected'); 4925 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 4926 var getName = $('[data-section=0]').attr('data-name'); 4927 if (getName != undefined && getName !== '') { 4928 $.each($('.menu-container .menu-item > a'), function(i, val) { 4929 var get_href = $(val).attr('href'); 4930 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4931 $(val).closest('ul').find('.active').removeClass('active'); 4932 $(val).parent().addClass('active'); 4933 } 4934 }); 4935 } 4936 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 4937 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 4938 if (lastSection.length) { 4939 $('ul.onepage-pagination li a').removeClass('is-selected'); 4940 lastSection.addClass('is-selected'); 4941 } 4942 } 4943 }); 4944 } 4945 4946 var scrollBody = function(index) { 4947 $('ul.onepage-pagination li a').removeClass('is-selected'); 4948 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 4949 4950 var getSection = $('[data-section=' + index + ']'), 4951 scrollTo; 4952 4953 if (getSection == undefined) return; 4954 4955 var body = $("html, body"), 4956 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4957 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 4958 getOffset = UNCODE.get_scroll_offset(index); 4959 if ( typeof getSection.offset() === 'undefined' ) 4960 return; 4961 scrollTo = getSection.offset().top; 4962
4963 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 4964 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 4965 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 4966 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 4967 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 4968 } 4969 4970 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 4971 if ( index === 0 ) { 4972 scrollTo = 0; 4973 } else { 4974 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 4975 } 4976 } else { 4977 scrollTo -= getOffset; 4978 } 4979 } 4980 4981 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4982 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4983 4984 if (index != 0) { 4985 UNCODE.scrolling = true; 4986 } 4987 4988 if (scrollSpeed == 0) { 4989 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4990 UNCODE.scrolling = false; 4991 } else { 4992 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4993 $(this).stop(); 4994 }).animate({ 4995 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4996 }, scrollSpeed, 'easeInOutCubic', function() { 4997 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4998 UNCODE.scrolling = false; 4999 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 5000 || 5001 $('.menu-hided').length ) { 5002 scrollTo = getSection.offset().top; 5003 getOffset = UNCODE.get_scroll_offset(index); 5004 scrollTo -= getOffset; 5005 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5006 $(this).stop(); 5007 }).animate({ 5008 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5009 }, scrollSpeed, 'easeInOutCubic', function() { 5010 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5011 UNCODE.scrolling = false; 5012 } 5013 ); 5014 } 5015 }); 5016 } 5017 5018 }; 5019 5020 init_onepage(); 5021}; 5022 5023UNCODE.stickyElements = function() { 5024 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5025 if (!isMobile_wide) { 5026 5027 var $pageHeader = $('#page-header'), 5028 $headerRow = $('.vc_row', $pageHeader), 5029 startSticky = false; 5030 5031 if ( $headerRow.hasClass('sticky-element') ) { 5032 $headerRow.removeClass('sticky-element'); 5033 $pageHeader.addClass('sticky-element'); 5034 startSticky = true; 5035 } 5036 5037 var calculateOffset = function(el) { 5038 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5039 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5040 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0, 5041 elTop = window.pageYOffset + el.getBoundingClientRect().top; 5042 5043 sideOffset += UNCODE.bodyBorder; 5044 5045 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5046 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) { 5047 if ($('.menu-shrink').length) { 5048 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5049 } else { 5050 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5051 } 5052 } 5053 5054 return sideOffset; 5055 5056 }, 5057 5058 initStickyElement = function() { 5059 $.each($('.sticky-element'), function(index, element) { 5060 if ($(element).closest('.tab-pane').length) { 5061 var $paneParent = $(element).closest('.tab-pane'); 5062 if ( !$paneParent.hasClass('active') ) { 5063 return true; 5064 } 5065 } 5066 $(element).stick_in_parent({ 5067 sticky_class: 'is_stucked', 5068 offset_top: calculateOffset(element), 5069 bottoming: true, 5070 inner_scrolling: SiteParameters.sticky_elements === 'on' 5071 }); 5072 }); 5073 }; 5074 5075 requestTimeout(function() { 5076 if ($('.sticky-element').length) { 5077 5078 if ($(window).width() > UNCODE.mediaQuery) { 5079 initStickyElement(); 5080
5081 if ( startSticky === true ) { 5082 $('#page-header').trigger('sticky_kit:recalc'); 5083 } 5084 } 5085 5086 $(window).on('resize lateral_resize', function(event) { 5087 $(".sticky-element").trigger("sticky_kit:detach"); 5088 if ($(window).width() > UNCODE.mediaQuery) { 5089 initStickyElement(); 5090 } 5091 }); 5092 } 5093 }, 1000); 5094 5095 if ($('.sticky-element').length) { 5096 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5097 requestTimeout(function() { 5098 $(document.body).trigger("sticky_kit:recalc"); 5099 }, 100); 5100 }); 5101 } 5102 5103 var $panels = $('.panel-collapse'); 5104 if ( $panels.length ) { 5105 $panels.each(function(){ 5106 var $panel = $(this); 5107 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5108 $(document.body).trigger("sticky_kit:recalc"); 5109 }); 5110 }); 5111 } 5112 5113 $('.nav-tabs a').on('shown.bs.tab', function(e){ 5114 var $tabs = $(e.target).closest('.tab-container'), 5115 $panel = $('.tab-pane.active', $tabs); 5116 5117 $(".sticky-element").trigger("sticky_kit:detach"); 5118 initStickyElement(); 5119 }); 5120 } 5121}; 5122 5123UNCODE.twentytwenty = function() { 5124 5125 if (!$('.twentytwenty-container').length) return; 5126 5127// DOM.event.move 5128// 5129// 2.0.0 5130// 5131// Stephen Band 5132// 5133// Triggers 'movestart', 'move' and 'moveend' events after 5134// mousemoves following a mousedown cross a distance threshold, 5135// similar to the native 'dragstart', 'drag' and 'dragend' events. 5136// Move events are throttled to animation frames. Move event objects 5137// have the properties: 5138// 5139// pageX: 5140// pageY: Page coordinates of pointer. 5141// startX: 5142// startY: Page coordinates of pointer at movestart. 5143// distX: 5144// distY: Distance the pointer has moved since movestart. 5145// deltaX: 5146// deltaY: Distance the finger has moved since last event. 5147// velocityX: 5148// velocityY: Average velocity over last few events. 5149 5150 5151(function(fn) { 5152 if (typeof define === 'function' && define.amd) { 5153 define([], fn); 5154 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5155 module.exports = fn; 5156 } else { 5157 fn(); 5158 } 5159})(function(){ 5160 var assign = Object.assign || window.jQuery && jQuery.extend; 5161 5162 // Number of pixels a pressed pointer travels before movestart 5163 // event is fired. 5164 var threshold = 8; 5165 5166 // Shim for requestAnimationFrame, falling back to timer. See: 5167 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5168 var requestFrame = (function(){ 5169 return ( 5170 window.requestAnimationFrame || 5171 window.webkitRequestAnimationFrame || 5172 window.mozRequestAnimationFrame || 5173 window.oRequestAnimationFrame || 5174 window.msRequestAnimationFrame || 5175 function(fn, element){ 5176 return window.setTimeout(function(){ 5177 fn(); 5178 }, 25); 5179 } 5180 ); 5181 })(); 5182 5183 // Shim for customEvent 5184 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5185 (function () { 5186 if ( typeof window.CustomEvent === "function" ) return false; 5187 function CustomEvent ( event, params ) { 5188 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5189 var evt = document.createEvent( 'CustomEvent' ); 5190 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5191 return evt; 5192 } 5193 5194 CustomEvent.prototype = window.Event.prototype; 5195 window.CustomEvent = CustomEvent; 5196 })(); 5197 5198 var ignoreTags = { 5199 textarea: true, 5200 input: true, 5201 select: true, 5202 button: true 5203 }; 5204 5205 var mouseevents = { 5206 move: 'mousemove', 5207 cancel: 'mouseup dragstart', 5208 end: 'mouseup' 5209 }; 5210 5211 var touchevents = { 5212 move: 'touchmove', 5213 cancel: 'touchend', 5214 end: 'touchend' 5215 }; 5216 5217 var rspaces = /\s+/; 5218 5219 5220 // DOM Events 5221 5222 var eventOptions = { bubbles: true, cancelable: true }; 5223 5224 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5225 5226 function createEvent(type) { 5227 return new CustomEvent(type, eventOptions); 5228 } 5229 5230 function getEvents(node) { 5231 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5232 } 5233 5234 function on(node, types, fn, data, selector) { 5235 types = types.split(rspaces); 5236 5237 var events = getEvents(node); 5238 var i = types.length; 5239 var handlers, type; 5240 5241 function handler(e) { fn(e, data); } 5242 5243 while (i--) { 5244 type = types[i]; 5245 handlers = events[type] || (events[type] = []); 5246 handlers.push([fn, handler]); 5247 node.addEventListener(type, handler); 5248 } 5249 } 5250 5251 function off(node, types, fn, selector) {
5252 types = types.split(rspaces); 5253 5254 var events = getEvents(node); 5255 var i = types.length; 5256 var type, handlers, k; 5257 5258 if (!events) { return; } 5259 5260 while (i--) { 5261 type = types[i]; 5262 handlers = events[type]; 5263 if (!handlers) { continue; } 5264 k = handlers.length; 5265 while (k--) { 5266 if (handlers[k][0] === fn) { 5267 node.removeEventListener(type, handlers[k][1]); 5268 handlers.splice(k, 1); 5269 } 5270 } 5271 } 5272 } 5273 5274 function trigger(node, type, properties) { 5275 // Don't cache events. It prevents you from triggering an event of a 5276 // given type from inside the handler of another event of that type. 5277 var event = createEvent(type); 5278 if (properties) { assign(event, properties); } 5279 node.dispatchEvent(event); 5280 } 5281 5282 5283 // Constructors 5284 5285 function Timer(fn){ 5286 var callback = fn, 5287 active = false, 5288 running = false; 5289 5290 function trigger(time) { 5291 if (active){ 5292 callback(); 5293 requestFrame(trigger); 5294 running = true; 5295 active = false; 5296 } 5297 else { 5298 running = false; 5299 } 5300 } 5301 5302 this.kick = function(fn) { 5303 active = true; 5304 if (!running) { trigger(); } 5305 }; 5306 5307 this.end = function(fn) { 5308 var cb = callback; 5309 5310 if (!fn) { return; } 5311 5312 // If the timer is not running, simply call the end callback. 5313 if (!running) { 5314 fn(); 5315 } 5316 // If the timer is running, and has been kicked lately, then 5317 // queue up the current callback and the end callback, otherwise 5318 // just the end callback. 5319 else { 5320 callback = active ? 5321 function(){ cb(); fn(); } : 5322 fn ; 5323 5324 active = true; 5325 } 5326 }; 5327 } 5328 5329 5330 // Functions 5331 5332 function noop() {} 5333 5334 function preventDefault(e) { 5335 e.preventDefault(); 5336 } 5337 5338 function isIgnoreTag(e) { 5339 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5340 } 5341 5342 function isPrimaryButton(e) { 5343 // Ignore mousedowns on any button other than the left (or primary) 5344 // mouse button, or when a modifier key is pressed. 5345 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5346 } 5347 5348 function identifiedTouch(touchList, id) { 5349 var i, l; 5350 5351 if (touchList.identifiedTouch) { 5352 return touchList.identifiedTouch(id); 5353 } 5354 5355 // touchList.identifiedTouch() does not exist in 5356 // webkit yet… we must do the search ourselves... 5357 5358 i = -1; 5359 l = touchList.length; 5360 5361 while (++i < l) { 5362 if (touchList[i].identifier === id) { 5363 return touchList[i]; 5364 } 5365 } 5366 } 5367 5368 function changedTouch(e, data) { 5369 var touch = identifiedTouch(e.changedTouches, data.identifier); 5370 5371 // This isn't the touch you're looking for. 5372 if (!touch) { return; } 5373 5374 // Chrome Android (at least) includes touches that have not 5375 // changed in e.changedTouches. That's a bit annoying. Check 5376 // that this touch has changed. 5377 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5378 5379 return touch; 5380 } 5381 5382 5383 // Handlers that decide when the first movestart is triggered 5384 5385 function mousedown(e){ 5386 // Ignore non-primary buttons 5387 if (!isPrimaryButton(e)) { return; } 5388 5389 // Ignore form and interactive elements 5390 if (isIgnoreTag(e)) { return; } 5391 5392 on(document, mouseevents.move, mousemove, e); 5393 on(document, mouseevents.cancel, mouseend, e); 5394 } 5395 5396 function mousemove(e, data){ 5397 checkThreshold(e, data, e, removeMouse); 5398 } 5399 5400 function mouseend(e, data) { 5401 removeMouse(); 5402 } 5403 5404 function removeMouse() { 5405 off(document, mouseevents.move, mousemove); 5406 off(document, mouseevents.cancel, mouseend); 5407 } 5408 5409 function touchstart(e) { 5410 // Don't get in the way of interaction with form elements 5411 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5412 5413 var touch = e.changedTouches[0]; 5414 5415 // iOS live updates the touch objects whereas Android gives us copies. 5416 // That means we can't trust the touchstart object to stay the same, 5417 // so we must copy the data. This object acts as a template for 5418 // movestart, move and moveend event objects. 5419 var data = { 5420 target: touch.target, 5421 pageX: touch.pageX, 5422 pageY: touch.pageY, 5423 identifier: touch.identifier, 5424 5425 // The only way to make handlers individually unbindable is by 5426 // making them unique. 5427 touchmove: function(e, data) { touchmove(e, data); }, 5428 touchend: function(e, data) { touchend(e, data); } 5429 }; 5430 5431 on(document, touchevents.move, data.touchmove, data); 5432 on(document, touchevents.cancel, data.touchend, data); 5433 } 5434 5435 function touchmove(e, data) { 5436 var touch = changedTouch(e, data); 5437 if (!touch) { return; } 5438 checkThreshold(e, data, touch, removeTouch); 5439 } 5440 5441 function touchend(e, data) { 5442 var touch = identifiedTouch(e.changedTouches, data.identifier); 5443 if (!touch) { return; } 5444 removeTouch(data); 5445 } 5446 5447 function removeTouch(data) { 5448 off(document, touchevents.move, data.touchmove); 5449 off(document, touchevents.cancel, data.touchend); 5450 } 5451 5452 function checkThreshold(e, data, touch, fn) { 5453 var distX = touch.pageX - data.pageX; 5454 var distY = touch.pageY - data.pageY; 5455
5456 // Do nothing if the threshold has not been crossed. 5457 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5458 5459 triggerStart(e, data, touch, distX, distY, fn); 5460 } 5461 5462 function triggerStart(e, data, touch, distX, distY, fn) { 5463 var touches = e.targetTouches; 5464 var time = e.timeStamp - data.timeStamp; 5465 5466 // Create a movestart object with some special properties that 5467 // are passed only to the movestart handlers. 5468 var template = { 5469 altKey: e.altKey, 5470 ctrlKey: e.ctrlKey, 5471 shiftKey: e.shiftKey, 5472 startX: data.pageX, 5473 startY: data.pageY, 5474 distX: distX, 5475 distY: distY, 5476 deltaX: distX, 5477 deltaY: distY, 5478 pageX: touch.pageX, 5479 pageY: touch.pageY, 5480 velocityX: distX / time, 5481 velocityY: distY / time, 5482 identifier: data.identifier, 5483 targetTouches: touches, 5484 finger: touches ? touches.length : 1, 5485 enableMove: function() { 5486 this.moveEnabled = true; 5487 this.enableMove = noop; 5488 e.preventDefault(); 5489 } 5490 }; 5491 5492 // Trigger the movestart event. 5493 trigger(data.target, 'movestart', template); 5494 5495 // Unbind handlers that tracked the touch or mouse up till now. 5496 fn(data); 5497 } 5498 5499 5500 // Handlers that control what happens following a movestart 5501 5502 function activeMousemove(e, data) { 5503 var timer = data.timer; 5504 5505 data.touch = e; 5506 data.timeStamp = e.timeStamp; 5507 timer.kick(); 5508 } 5509 5510 function activeMouseend(e, data) { 5511 var target = data.target; 5512 var event = data.event; 5513 var timer = data.timer; 5514 5515 removeActiveMouse(); 5516 5517 endEvent(target, event, timer, function() { 5518 // Unbind the click suppressor, waiting until after mouseup 5519 // has been handled. 5520 setTimeout(function(){ 5521 off(target, 'click', preventDefault); 5522 }, 0); 5523 }); 5524 } 5525 5526 function removeActiveMouse() { 5527 off(document, mouseevents.move, activeMousemove); 5528 off(document, mouseevents.end, activeMouseend); 5529 } 5530 5531 function activeTouchmove(e, data) { 5532 var event = data.event; 5533 var timer = data.timer; 5534 var touch = changedTouch(e, event); 5535 5536 if (!touch) { return; } 5537 5538 // Stop the interface from gesturing 5539 e.preventDefault(); 5540 5541 event.targetTouches = e.targetTouches; 5542 data.touch = touch; 5543 data.timeStamp = e.timeStamp; 5544 5545 timer.kick(); 5546 } 5547 5548 function activeTouchend(e, data) { 5549 var target = data.target; 5550 var event = data.event; 5551 var timer = data.timer; 5552 var touch = identifiedTouch(e.changedTouches, event.identifier); 5553 5554 // This isn't the touch you're looking for. 5555 if (!touch) { return; } 5556 5557 removeActiveTouch(data); 5558 endEvent(target, event, timer); 5559 } 5560 5561 function removeActiveTouch(data) { 5562 off(document, touchevents.move, data.activeTouchmove); 5563 off(document, touchevents.end, data.activeTouchend); 5564 } 5565 5566 5567 // Logic for triggering move and moveend events 5568 5569 function updateEvent(event, touch, timeStamp) { 5570 var time = timeStamp - event.timeStamp; 5571 5572 event.distX = touch.pageX - event.startX; 5573 event.distY = touch.pageY - event.startY; 5574 event.deltaX = touch.pageX - event.pageX; 5575 event.deltaY = touch.pageY - event.pageY; 5576 5577 // Average the velocity of the last few events using a decay 5578 // curve to even out spurious jumps in values. 5579 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 5580 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 5581 event.pageX = touch.pageX; 5582 event.pageY = touch.pageY; 5583 } 5584 5585 function endEvent(target, event, timer, fn) { 5586 timer.end(function(){ 5587 trigger(target, 'moveend', event); 5588 return fn && fn(); 5589 }); 5590 } 5591 5592 5593 // Set up the DOM 5594 5595 function movestart(e) { 5596 if (e.defaultPrevented) { return; } 5597 if (!e.moveEnabled) { return; } 5598 5599 var event = { 5600 startX: e.startX, 5601 startY: e.startY, 5602 pageX: e.pageX, 5603 pageY: e.pageY, 5604 distX: e.distX, 5605 distY: e.distY, 5606 deltaX: e.deltaX, 5607 deltaY: e.deltaY, 5608 velocityX: e.velocityX, 5609 velocityY: e.velocityY, 5610 identifier: e.identifier, 5611 targetTouches: e.targetTouches, 5612 finger: e.finger 5613 }; 5614 5615 var data = { 5616 target: e.target, 5617 event: event, 5618 timer: new Timer(update), 5619 touch: undefined, 5620 timeStamp: e.timeStamp 5621 }; 5622 5623 function update(time) { 5624 updateEvent(event, data.touch, data.timeStamp); 5625 trigger(data.target, 'move', event); 5626 } 5627 5628 if (e.identifier === undefined) { 5629 // We're dealing with a mouse event. 5630 // Stop clicks from propagating during a move 5631 on(e.target, 'click', preventDefault); 5632 on(document, mouseevents.move, activeMousemove, data); 5633 on(document, mouseevents.end, activeMouseend, data); 5634 } 5635 else { 5636 // In order to unbind correct handlers they have to be unique 5637 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 5638 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 5639 5640 // We're dealing with a touch. 5641 on(document, touchevents.move, data.activeTouchmove, data); 5642 on(document, touchevents.end, data.activeTouchend, data); 5643 } 5644 } 5645 5646 on(document, 'mousedown', mousedown); 5647 on(document, 'touchstart', touchstart); 5648 on(document, 'movestart', movestart); 5649 5650 5651 // jQuery special events 5652 // 5653 // jQuery event objects are copies of DOM event objects. They need 5654 // a little help copying the move properties across. 5655 5656 if (!window.jQuery) { return; } 5657 5658 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 5659 5660 function enableMove1(e) { e.enableMove(); } 5661 function enableMove2(e) { e.enableMove(); } 5662 function enableMove3(e) { e.enableMove(); } 5663 5664 function add(handleObj) { 5665 var handler = handleObj.handler; 5666 5667 handleObj.handler = function(e) { 5668 // Copy move properties across from originalEvent 5669 var i = properties.length; 5670 var property; 5671 5672 while(i--) { 5673 property = properties[i]; 5674 e[property] = e.originalEvent[property]; 5675 } 5676 5677 handler.apply(this, arguments); 5678 }; 5679 } 5680 5681 jQuery.event.special.movestart = { 5682 setup: function() { 5683 // Movestart must be enabled to allow other move events 5684 on(this, 'movestart', enableMove1); 5685 5686 // Do listen to DOM events 5687 return false;
5688 }, 5689 5690 teardown: function() { 5691 off(this, 'movestart', enableMove1); 5692 return false; 5693 }, 5694 5695 add: add 5696 }; 5697 5698 jQuery.event.special.move = { 5699 setup: function() { 5700 on(this, 'movestart', enableMove2); 5701 return false; 5702 }, 5703 5704 teardown: function() { 5705 off(this, 'movestart', enableMove2); 5706 return false; 5707 }, 5708 5709 add: add 5710 }; 5711 5712 jQuery.event.special.moveend = { 5713 setup: function() { 5714 on(this, 'movestart', enableMove3); 5715 return false; 5716 }, 5717 5718 teardown: function() { 5719 off(this, 'movestart', enableMove3); 5720 return false; 5721 }, 5722 5723 add: add 5724 }; 5725}); 5726 5727 $.fn.twentytwenty = function(options) { 5728 var options = $.extend({ 5729 default_offset_pct: 0.5, 5730 orientation: 'horizontal', 5731 before_label: 'Before', 5732 after_label: 'After', 5733 no_overlay: false, 5734 move_slider_on_hover: false, 5735 move_with_handle_only: true, 5736 click_to_move: false 5737 }, options); 5738 5739 return this.each(function() { 5740 5741 var sliderPct = options.default_offset_pct; 5742 var container = $(this); 5743 var sliderOrientation = options.orientation; 5744 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 5745 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 5746 5747 5748 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 5749 if(!options.no_overlay) { 5750 container.append("<div class='twentytwenty-overlay'></div>"); 5751 var overlay = container.find(".twentytwenty-overlay"); 5752 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 5753 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 5754 } 5755 var beforeImg = container.find("img:first"); 5756 var afterImg = container.find("img:last"); 5757 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 5758 var slider = container.find(".twentytwenty-handle"); 5759 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 5760 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 5761 container.addClass("twentytwenty-container"); 5762 beforeImg.addClass("twentytwenty-before"); 5763 afterImg.addClass("twentytwenty-after"); 5764 5765 var calcOffset = function(dimensionPct) { 5766 var w = beforeImg.width(); 5767 var h = beforeImg.height(); 5768 return { 5769 w: w+"px", 5770 h: h+"px", 5771 cw: (dimensionPct*w)+"px", 5772 ch: (dimensionPct*h)+"px" 5773 }; 5774 }; 5775 5776 var adjustContainer = function(offset) { 5777 if (sliderOrientation === 'vertical') { 5778 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 5779 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 5780 } 5781 else { 5782 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 5783 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 5784 } 5785 container.css("height", offset.h); 5786 }; 5787 5788 var adjustSlider = function(pct) { 5789 var offset = calcOffset(pct); 5790 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 5791 adjustContainer(offset); 5792 }; 5793 5794 // Return the number specified or the min/max number if it outside the range given. 5795 var minMaxNumber = function(num, min, max) { 5796 return Math.max(min, Math.min(max, num)); 5797 }; 5798 5799 // Calculate the slider percentage based on the position. 5800 var getSliderPercentage = function(positionX, positionY) { 5801 var sliderPercentage = (sliderOrientation === 'vertical') ? 5802 (positionY-offsetY)/imgHeight : 5803 (positionX-offsetX)/imgWidth; 5804 5805 return minMaxNumber(sliderPercentage, 0, 1); 5806 }; 5807 5808 5809 $(window).on("resize.twentytwenty", function(e) { 5810 adjustSlider(sliderPct); 5811 }); 5812 5813 var offsetX = 0; 5814 var offsetY = 0; 5815 var imgWidth = 0; 5816 var imgHeight = 0; 5817 var onMoveStart = function(e) { 5818 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 5819 e.preventDefault(); 5820 } 5821 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 5822 e.preventDefault(); 5823 } 5824 container.addClass("active"); 5825 offsetX = container.offset().left; 5826 offsetY = container.offset().top; 5827 imgWidth = beforeImg.width(); 5828 imgHeight = beforeImg.height(); 5829 }; 5830 var onMove = function(e) { 5831 if (container.hasClass("active")) { 5832 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5833 adjustSlider(sliderPct); 5834 } 5835 }; 5836 var onMoveEnd = function() { 5837 container.removeClass("active"); 5838 }; 5839 5840 var moveTarget = options.move_with_handle_only ? slider : container; 5841 moveTarget.on("movestart",onMoveStart); 5842 moveTarget.on("move",onMove); 5843 moveTarget.on("moveend",onMoveEnd); 5844 5845 if (options.move_slider_on_hover) { 5846 container.on("mouseenter", onMoveStart); 5847 container.on("mousemove", onMove); 5848 container.on("mouseleave", onMoveEnd); 5849 } 5850 5851 slider.on("touchmove", function(e) { 5852 e.preventDefault(); 5853 }); 5854 5855 container.find("img").on("mousedown", function(event) { 5856 event.preventDefault(); 5857 }); 5858 5859 if (options.click_to_move) { 5860 container.on('click', function(e) { 5861 offsetX = container.offset().left; 5862 offsetY = container.offset().top; 5863 imgWidth = beforeImg.width(); 5864 imgHeight = beforeImg.height(); 5865 5866 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5867 adjustSlider(sliderPct); 5868 }); 5869 } 5870 5871 $(window).trigger("resize.twentytwenty"); 5872 }); 5873 }; 5874 5875 5876 $(window).on("load", function(e) { 5877 $('.twentytwenty-container').each(function(){ 5878 var $container = $(this); 5879 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5880 $container.twentytwenty(); 5881 } 5882 $('img', $container).on('async-done', function(){ 5883 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5884 $container.twentytwenty(); 5885 } 5886 }); 5887 }); 5888 }); 5889} 5890 5891UNCODE.justifiedGallery = function() { 5892 5893 var breakPointMe = function( val ) { 5894 val = parseInt( val ); 5895 if ( isNaN(val) ) { 5896 return false;
5897 } 5898 if ( val >= 1500 ) { 5899 return 1; 5900 } else if ( val < 1500 && val >= 960 ) { 5901 return 2; 5902 } else if ( val < 960 && val >= 570 ) { 5903 return 3; 5904 } else if ( val < 570 ) { 5905 return 4; 5906 } 5907 } 5908 5909 var gutterByBreakpoint = function( bp, gutter ) { 5910 var ret; 5911 switch(gutter) { 5912 case 'no-gutter': 5913 ret = 0; 5914 break; 5915 case 'px-gutter': 5916 ret = 1; 5917 break; 5918 case 'half-gutter': 5919 ret = 18; 5920 break; 5921 case 'double-gutter': 5922 switch(bp) { 5923 case 3: 5924 case 4: 5925 ret = 36; 5926 break; 5927 default: 5928 ret = 72; 5929 break; 5930 } 5931 break; 5932 case 'triple-gutter': 5933 switch(bp) { 5934 case 3: 5935 case 4: 5936 ret = 36; 5937 break; 5938 default: 5939 ret = 108; 5940 break; 5941 } 5942 break; 5943 case 'quad-gutter': 5944 switch(bp) { 5945 case 2: 5946 ret = 108; 5947 break; 5948 case 3: 5949 ret = 72; 5950 break; 5951 case 4: 5952 ret = 36; 5953 break; 5954 default: 5955 ret = 144; 5956 break; 5957 } 5958 break; 5959 default: 5960 ret = 36;//single-gutter 5961 } 5962 return ret; 5963 } 5964 5965 if ($('.justified-layout').length > 0) { 5966 var justifiedContainersArray = [], 5967 typeGridArray = [], 5968 layoutGridArray = [], 5969 transitionDuration = [], 5970 $filterItems = [], 5971 $filters = $('.justified-system .isotope-filters'), 5972 $itemSelector = '.tmb', 5973 $items, 5974 itemMargin, 5975 correctionFactor = 0, 5976 firstLoad = true, 5977 isOriginLeft = $('body').hasClass('rtl') ? false : true, 5978 prevW = breakPointMe(UNCODE.wwidth); 5979 $('[class*="justified-container"]').each(function() { 5980 var isoData = $(this).data(); 5981 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5982 if (isoData.type == 'metro') typeGridArray.push(true); 5983 else typeGridArray.push(false); 5984 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 5985 else layoutGridArray.push('justified'); 5986 justifiedContainersArray.push($(this)); 5987 }); 5988 var init_justifiedGallery = function() { 5989 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 5990 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 5991 justifiedId = justifiedSystem.attr('id'), 5992 $layoutMode = layoutGridArray[i], 5993 gutter = $(justifiedContainersArray[i]).data('gutter'), 5994 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 5995 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 5996 lastRow = $(justifiedContainersArray[i]).data('last-row'), 5997 margins; 5998 5999 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 6000 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 6001 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6002 6003 margins = gutterByBreakpoint(prevW, gutter); 6004 6005 $(justifiedContainersArray[i]).justifiedGallery({ 6006 rowHeight: rowHeight, 6007 maxRowHeight: maxRowHeight, 6008 margins: margins, 6009 cssAnimation: true, 6010 lastRow: lastRow, 6011 waitThumbnailsLoad: false 6012 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 6013 6014 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 6015 $(justifiedContainersArray[i]).infinitescroll({ 6016 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 6017 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6018 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 6019 animate: false, 6020 behavior: 'local', 6021 debug: false, 6022 loading: { 6023 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 6024 speed: 0, 6025 finished: undefined, 6026 msg: $('#' + justifiedId + ' .loadmore-button'), 6027 }, 6028 errorCallback: function() { 6029 var justified_system = $(this).closest('.justified-system'); 6030 $('.loading-button', justified_system).hide(); 6031 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6032 } 6033 }, 6034 // append the new items to galleryJustified on the infinitescroll callback function. 6035 function(newElements, opts) { 6036 var $galleryJustified = $(this), 6037 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6038 filters = new Array(), 6039 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6040 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6041 $numPages = $('a', $infinite_button).data('pages'),
6042 delay = 300; 6043 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6044 $infinite_button.show(); 6045 $loading_button.hide(); 6046 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6047 $('> li', $galleryJustified).remove(); 6048 $.each($(newElements), function(index, val) { 6049 $(val).addClass('tmb-iso'); 6050 if ($(val).is("li")) { 6051 filters.push($(val)[0]); 6052 } 6053 }); 6054 newElements = newElements.filter(function(x) { 6055 return filters.indexOf(x) < 0 6056 }); 6057 $.each($(filters), function(index, val) { 6058 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6059 }); 6060 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6061 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6062 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6063 if (typeof getLightbox === 'object') { 6064 getLightbox.refresh(); 6065 } else { 6066 UNCODE.lightbox(); 6067 } 6068 } 6069 if ( typeof twttr !== 'undefined' ) 6070 twttr.widgets.load(justifiedContainersArray[i]); 6071 6072 requestTimeout(function() { 6073 $galleryJustified.trigger('more-items-loaded'); 6074 }, 1000); 6075 }); 6076 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6077 var $infinite_justified = $(justifiedContainersArray[i]), 6078 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6079 $infinite_justified.infinitescroll('pause'); 6080 $infinite_button.on('click', function(event) { 6081 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6082 $.each(UNCODE.lightboxArray, function(index, val) { 6083 UNCODE.lightboxArray[index].destroy(); 6084 }); 6085 } 6086 event.preventDefault(); 6087 var $justified_system = $(event.target).closest('.justified-system'), 6088 $infinite_justified = $justified_system.find('.justified-container'), 6089 justifiedId = $justified_system.attr('id'); 6090 $(event.currentTarget).html(SiteParameters.loading); 6091 $infinite_justified.infinitescroll('resume'); 6092 $infinite_justified.infinitescroll('retrieve'); 6093 $infinite_justified.infinitescroll('pause'); 6094 $infinite_justified.trigger('more-items-loaded'); 6095 }); 6096 } 6097 } 6098 } 6099 }, 6100 onLayout = function(justifiedObj, startIndex) { 6101 justifiedObj.css('opacity', 1); 6102 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6103 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6104 6105 requestTimeout(function() { 6106 // window.dispatchEvent(UNCODE.boxEvent); 6107 UNCODE.adaptive(); 6108 if (SiteParameters.dynamic_srcset_active === '1') { 6109 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6110 } 6111 if (typeof MediaElement === "function") { 6112 $(justifiedObj).find('audio,video').each(function() { 6113 $(this).mediaelementplayer({ 6114 pauseOtherPlayers: false, 6115 }); 6116 }); 6117 } 6118 if ($(justifiedObj).find('.nested-carousel').length) { 6119 if (typeof UNCODE.carousel !== 'undefined') { 6120 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6121 } 6122 requestTimeout(function() { 6123 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6124 justifiedObj.addClass('justified-gallery-finished') 6125 Waypoint.refreshAll(); 6126 }, 200); 6127 } else { 6128 requestTimeout(function() { 6129 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6130 justifiedObj.addClass('justified-gallery-finished') 6131 Waypoint.refreshAll(); 6132 }, 300); 6133 } 6134 }, 100); 6135 6136 }, 6137 boxAnimation = function(items, startIndex, sequential, container) { 6138 var $allItems = items.length - startIndex, 6139 showed = 0, 6140 index = 0; 6141 if (container.closest('.owl-item').length == 1) return false; 6142 $.each(items, function(index, val) { 6143 var elInner = $('> .t-inside', val); 6144 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6145 return; 6146 } 6147 if (val[0]) val = val[0]; 6148 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6149 new Waypoint({ 6150 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6151 element: val, 6152 handler: function() { 6153 var element = $('> .t-inside', this.element), 6154 parent = $(this.element), 6155 currentIndex = parent.index();
6156 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6157 delayAttr = parseInt(element.attr('data-delay')); 6158 if (isNaN(delayAttr)) delayAttr = 100; 6159 delay -= showed; 6160 var objTimeout = requestTimeout(function() { 6161 element.removeClass('zoom-reverse').addClass('start_animation'); 6162 showed = parent.index(); 6163 }, delay * delayAttr); 6164 parent.data('objTimeout', objTimeout); 6165 if (!UNCODE.isUnmodalOpen) { 6166 this.destroy(); 6167 } 6168 }, 6169 offset: '100%' 6170 }) 6171 } else { 6172 elInner.removeClass('animate_when_almost_visible'); 6173 $(val).addClass('no-waypoint-animation'); 6174 /*if (elInner.hasClass('force-anim')) { 6175 elInner.addClass('start_animation'); 6176 } else { 6177 elInner.css('opacity', 1); 6178 }*/ 6179 } 6180 index++; 6181 }); 6182 }; 6183 $filters.on('click', 'a[data-filter]', function(evt) { 6184 var $filter = $(this), 6185 filterContainer = $filter.closest('.isotope-filters'), 6186 filterValue = $filter.attr('data-filter'), 6187 container = $filter.closest('.justified-system').find($('.justified-layout')), 6188 lastRow = container.data('last-row'), 6189 transitionDuration = 0, 6190 delay = 300, 6191 filterItems = []; 6192 6193 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6194 6195 var filter_items = function(){ 6196 if (filterValue !== undefined) { 6197 $.each($('> .tmb > .t-inside', container), function(index, val) { 6198 var parent = $(val).parent(), 6199 objTimeout = parent.data('objTimeout'); 6200 if (objTimeout) { 6201 $(val).removeClass('zoom-reverse'); 6202 clearRequestTimeout(objTimeout); 6203 } 6204 if (transitionDuration == 0) { 6205 if ($(val).hasClass('animate_when_almost_visible')) { 6206 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6207 } else { 6208 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6209 } 6210 } 6211 }); 6212 6213 requestTimeout(function() { 6214 var $block, 6215 selector, 6216 lightboxElements, 6217 $boxes; 6218 6219 if ( filterValue !== '' && filterValue !== '*' ) { 6220 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6221 selector = '.' + filterValue; 6222 $.each($(selector, container), function(index, block) { 6223 lightboxElements = $('[data-lbox^=ilightbox]', block); 6224 if (lightboxElements.length) { 6225 lightboxElements.removeClass('lb-disabled'); 6226 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6227 } 6228 filterItems.push(block); 6229 }); 6230 container.justifiedGallery({ 6231 filter: selector, 6232 lastRow: 'nojustify' 6233 }); 6234 } else { 6235 container.justifiedGallery({ 6236 filter: false, 6237 lastRow: lastRow 6238 }); 6239 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6240 filterItems = $('> .tmb', container); 6241 } 6242 container.trigger('more-items-loaded'); 6243 6244 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6245 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6246 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6247 if (typeof getLightbox === 'object') { 6248 getLightbox.refresh(); 6249 } else { 6250 UNCODE.lightbox(); 6251 } 6252 } 6253 6254 if (transitionDuration == 0) { 6255 requestTimeout(function() { 6256 boxAnimation(filterItems, 0, false, container); 6257 }, 100); 6258 } 6259 requestTimeout(function() { 6260 Waypoint.refreshAll(); 6261 container.trigger('more-items-loaded'); 6262 }, 2000); 6263 6264 }, delay); 6265 } else { 6266 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6267 $.each(UNCODE.lightboxArray, function(index, val) { 6268 UNCODE.lightboxArray[index].destroy(); 6269 }); 6270 } 6271 $.each($('> .tmb > .t-inside', container), function(index, val) { 6272 var parent = $(val).parent(), 6273 objTimeout = parent.data('objTimeout'); 6274 if (objTimeout) { 6275 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6276 clearRequestTimeout(objTimeout); 6277 } 6278 if (transitionDuration == 0) { 6279 if ($(val).hasClass('animate_when_almost_visible')) { 6280 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6281 } else { 6282 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6283 } 6284 } 6285 }); 6286 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6287 UNCODE.lightbox(); 6288 } 6289 container.parent().addClass('justified-loading'); 6290 container.trigger('more-items-loaded'); 6291 } 6292 }; 6293 6294 if (!$filter.hasClass('active')) { 6295 /** Scroll top with filtering */ 6296 if (filterContainer.hasClass('filter-scroll')) { 6297 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6298 calc_scroll -= UNCODE.get_scroll_offset(); 6299 6300 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6301 delta = bodyTop - calc_scroll, 6302 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6303 filterTolerance = false, 6304 filter_timeout; 6305 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6306 6307 if ( !UNCODE.isFullPage ) { 6308 if (scrollSpeed == 0) { 6309 $('html, body').scrollTop(calc_scroll); 6310 UNCODE.scrolling = false;
6311 filter_items(); 6312 } else { 6313 6314 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6315 filter_items(); 6316 filterTolerance = true; 6317 } 6318 6319 $('html, body').animate({ 6320 scrollTop: calc_scroll 6321 },{ 6322 easing: 'easeInOutQuad', 6323 duration: scrollSpeed, 6324 complete: function(){ 6325 UNCODE.scrolling = false; 6326 if ( !filterTolerance ) { 6327 filter_timeout = setTimeout(function(){ 6328 clearTimeout(filter_timeout); 6329 filter_items(); 6330 }, 200); 6331 } 6332 } 6333 }); 6334 } 6335 } 6336 } else { 6337 filter_items(); 6338 } 6339 } 6340 evt.preventDefault(); 6341 }); 6342 6343 $filters.each(function(i, buttonGroup) { 6344 var $buttonGroup = $(buttonGroup); 6345 $buttonGroup.on('click', 'a', function() { 6346 $buttonGroup.find('.active').removeClass('active'); 6347 $(this).addClass('active'); 6348 }); 6349 6350 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6351 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6352 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6353 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6354 e.preventDefault(); 6355 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6356 }); 6357 }); 6358 window.addEventListener('boxResized', function(e) { 6359 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6360 prevW = breakPointMe(UNCODE.wwidth); 6361 $.each($('.justified-layout'), function(index, val) { 6362 var gutter = $(this).data('gutter'), 6363 margins = gutterByBreakpoint( prevW, gutter); 6364 $(this).justifiedGallery({ 6365 margins: margins 6366 }); 6367 $(this).find('.mejs-video,.mejs-audio').each(function() { 6368 $(this).trigger('resize'); 6369 }); 6370 }); 6371 } 6372 }, false); 6373 6374 init_justifiedGallery(); 6375 }; 6376}; 6377 6378UNCODE.cssGrid = function() { 6379 if ($('.cssgrid-layout').length > 0) { 6380 var cssGridContainersArray = []; 6381 var transitionDuration = []; 6382 var $filters = $('.cssgrid-system .cssgrid-filters'); 6383 6384 $('[class*="cssgrid-container"]').each(function() { 6385 cssGridContainersArray.push($(this)); 6386 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6387 }); 6388 6389 var init_cssGridAjax = function() { 6390 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6391 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6392 cssGridId = cssGridSystem.attr('id'); 6393 6394 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6395 6396 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6397 $(cssGridContainersArray[i]).infinitescroll({ 6398 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6399 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6400 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve 6401 animate: false, 6402 behavior: 'local', 6403 debug: false, 6404 loading: { 6405 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6406 speed: 0, 6407 finished: undefined, 6408 msg: $('#' + cssGridId + ' .loadmore-button'), 6409 }, 6410 errorCallback: function() { 6411 var cssgrid_system = $(this).closest('.cssgrid-system'); 6412 $('.loading-button', cssgrid_system).hide(); 6413 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6414 } 6415 }, 6416 // append the new items to cssGrid on the infinitescroll callback function. 6417 function(newElements, opts) { 6418 var $cssGrid = $(this), 6419 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6420 cssGridId = cssGridSystemCont.attr('id'), 6421 filters = new Array(), 6422 $loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'), 6423 $infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'), 6424 $numPages = $('a', $infinite_button).data('pages'),
6425 delay = 300; 6426 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6427 $infinite_button.show(); 6428 $loading_button.hide(); 6429 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6430 $('> li', $cssGrid).remove(); 6431 $.each($(newElements), function(index, val) { 6432 $(val).addClass('tmb-grid'); 6433 if ($(val).is("li")) { 6434 filters.push($(val)[0]); 6435 } 6436 }); 6437 newElements = newElements.filter(function(x) { 6438 return filters.indexOf(x) < 0 6439 }); 6440 $.each($(filters), function(index, val) { 6441 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6442 }); 6443 6444 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter'); 6445 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6446 if (filterValue !== undefined && filterValue != '*') { 6447 $(newElements).hide(); 6448 var els_to_show = $(); 6449 $(newElements).each(function() { 6450 var el = $(this); 6451 if (el.hasClass(filterValue)) { 6452 els_to_show = els_to_show.add(el); 6453 el.show(); 6454 } 6455 }); 6456 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6457 } else { 6458 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6459 } 6460 6461 UNCODE.adaptive(); 6462 if (SiteParameters.dynamic_srcset_active === '1') { 6463 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6464 } 6465 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6466 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6467 if (typeof getLightbox === 'object') { 6468 getLightbox.refresh(); 6469 } else { 6470 UNCODE.lightbox(); 6471 } 6472 } 6473 if ( typeof twttr !== 'undefined' ) { 6474 twttr.widgets.load(cssGridContainersArray[i]); 6475 } 6476 6477 UNCODE.carousel($(newElements)); 6478 requestTimeout(function() { 6479 $cssGrid.trigger('more-items-loaded'); 6480 }, 1000); 6481 6482 }); 6483 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6484 var $cssgrid_el = $(cssGridContainersArray[i]), 6485 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6486 $cssgrid_el.infinitescroll('pause'); 6487 $infinite_button.on('click', function(event) { 6488 event.preventDefault(); 6489 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6490 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6491 cssGridId = $cssgrid_system.attr('id'); 6492 $(event.currentTarget).html(SiteParameters.loading); 6493 $cssgrid_el.infinitescroll('resume'); 6494 $cssgrid_el.infinitescroll('retrieve'); 6495 $cssgrid_el.infinitescroll('pause'); 6496 }); 6497 } 6498 } 6499 } 6500 }; 6501 6502 init_cssGridAjax(); 6503 6504 if ($('.cssgrid-pagination').length > 0) { 6505 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 6506 evt.preventDefault(); 6507 6508 if (SiteParameters.index_pagination_disable_scroll !== '1') { 6509 var container = $(this).closest('.cssgrid-system'), 6510 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6511 6512 calc_scroll -= UNCODE.get_scroll_offset(); 6513 6514 var menu_container = $('.menu-sticky'); 6515 var menu = menu_container.find('.menu-container'); 6516 6517 if (menu_container.length > 0 && menu.length > 0) { 6518 calc_scroll = calc_scroll - menu.outerHeight(); 6519 } 6520 6521 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6522 delta = bodyTop - calc_scroll, 6523 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6524 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6525 6526 if ( !UNCODE.isFullPage ) { 6527 if (scrollSpeed == 0) { 6528 $('html, body').scrollTop(calc_scroll); 6529 } else { 6530 $('html, body').animate({ 6531 scrollTop: calc_scroll 6532 },{ 6533 easing: 'easeInOutQuad', 6534 duration: scrollSpeed, 6535 complete: function(){ 6536 UNCODE.scrolling = false;
6537 } 6538 }); 6539 } 6540 } 6541 } 6542 6543 loadCssGrid($(this), true); 6544 }); 6545 } 6546 6547 $filters.on('click', 'a.grid-nav-link', function(evt) { 6548 if ($(this).hasClass('no-grid-filter')) { 6549 return; 6550 } 6551 var $filter = $(this), 6552 filterContainer = $filter.closest('.cssgrid-filters'), 6553 filterValue = $filter.attr('data-filter'), 6554 containerSystem = $filter.closest('.cssgrid-system'), 6555 container = containerSystem.find($('.cssgrid-layout')), 6556 transitionDuration = containerSystem.data('transitionDuration'), 6557 delay = 300, 6558 filterItems = [], 6559 all_thumbs = container.find('.tmb-grid'); 6560 6561 var filter_items = function(){ 6562 if (filterValue !== undefined) { 6563 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6564 var parent = $(val).parent(), 6565 objTimeout = parent.data('objTimeout'); 6566 if (objTimeout) { 6567 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6568 clearRequestTimeout(objTimeout); 6569 } 6570 if (transitionDuration == 0) { 6571 if ($(val).hasClass('animate_when_almost_visible')) { 6572 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6573 } else { 6574 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6575 } 6576 } 6577 }); 6578 requestTimeout(function(){ 6579 if ( filterValue == '*' ) { 6580 all_thumbs.show(); 6581 all_thumbs.each(function(index, val) { 6582 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6583 filterItems.push($(this)); 6584 }); 6585 } else { 6586 all_thumbs.each(function() { 6587 var _tmb = $(this); 6588 if (_tmb.hasClass(filterValue)) { 6589 _tmb.show(); 6590 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6591 filterItems.push(_tmb); 6592 } else { 6593 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 6594 _tmb.hide(); 6595 } 6596 }); 6597 } 6598 6599 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6600 6601 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6602 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 6603 var lightboxElements = $('[data-lbox^=ilightbox]', container); 6604 if (lightboxElements.length) { 6605 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6606 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6607 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 6608 if (typeof getLightbox === 'object') { 6609 getLightbox.refresh(); 6610 } else { 6611 UNCODE.lightbox(); 6612 } 6613 } 6614 } 6615 container.trigger('more-items-loaded'); 6616 }, delay); 6617 } else { 6618 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6619 var parent = $(val).parent(), 6620 objTimeout = parent.data('objTimeout'); 6621 if (objTimeout) { 6622 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6623 clearRequestTimeout(objTimeout); 6624 } 6625 if (transitionDuration == 0) { 6626 if ($(val).hasClass('animate_when_almost_visible')) { 6627 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6628 } else { 6629 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6630 } 6631 } 6632 }); 6633 loadCssGrid($filter); 6634 } 6635 }; 6636 6637 if (!$filter.hasClass('active')) { 6638 /** Scroll top with filtering */ 6639 if (filterContainer.hasClass('filter-scroll')) { 6640 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6641 calc_scroll -= UNCODE.get_scroll_offset(); 6642 6643 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6644 delta = bodyTop - calc_scroll, 6645 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6646 filterTolerance = false, 6647 filter_timeout; 6648 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6649 6650 if ( !UNCODE.isFullPage ) { 6651 if (scrollSpeed == 0) { 6652 $('html, body').scrollTop(calc_scroll); 6653 UNCODE.scrolling = false;
6654 filter_items(); 6655 } else { 6656 6657 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6658 filter_items(); 6659 filterTolerance = true; 6660 } 6661 6662 $('html, body').animate({ 6663 scrollTop: calc_scroll 6664 },{ 6665 easing: 'easeInOutQuad', 6666 duration: scrollSpeed, 6667 complete: function(){ 6668 UNCODE.scrolling = false; 6669 if ( !filterTolerance ) { 6670 filter_timeout = setTimeout(function(){ 6671 clearTimeout(filter_timeout); 6672 filter_items(); 6673 }, 200); 6674 } 6675 } 6676 }); 6677 } 6678 } 6679 } else { 6680 filter_items(); 6681 } 6682 } 6683 evt.preventDefault(); 6684 }); 6685 6686 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 6687 var params = UNCODE.getURLParams(window.location); 6688 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 6689 6690 UNCODE.lastURL = window.location.href; 6691 6692 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 6693 return; 6694 } 6695 6696 if (params.id === undefined) { 6697 $.each($('.cssgrid-system'), function(index, val) { 6698 loadCssGrid($(val)); 6699 }); 6700 } else { 6701 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 6702 loadCssGrid($('#' + params.id)); 6703 } 6704 } 6705 }); 6706 6707 var loadCssGrid = function($href, $paginating) { 6708 var is_paginating = false; 6709 6710 if (undefined !== $paginating && $paginating) { 6711 var is_paginating = $paginating; 6712 } 6713 6714 var href = ($href.is("a") ? $href.attr('href') : location), 6715 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 6716 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 6717 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 6718 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 6719 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 6720 cssgridId = cssgridSystem.attr('id'); 6721 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 6722 UNCODE.lastURL = href; 6723 history.pushState({ 6724 myCSSgrid: true 6725 }, document.title, href); 6726 } 6727 cssgridWrapper.addClass('cssgrid-loading'); 6728 if (is_paginating) { 6729 cssgridWrapper.addClass('grid-filtering'); 6730 } 6731 $.ajax({ 6732 url: href 6733 }).done(function(data) { 6734 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 6735 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 6736 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 6737 requestTimeout(function() { 6738 cssgridContainer.html($resultItems); 6739 cssgridWrapper.removeClass('cssgrid-loading'); 6740 cssgridWrapper.removeClass('grid-filtering'); 6741 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6742 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 6743 UNCODE.adaptive(); 6744 if (SiteParameters.dynamic_srcset_active === '1') { 6745 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 6746 } 6747 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6748 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 6749 if (typeof getLightbox === 'object') { 6750 getLightbox.refresh(); 6751 } else { 6752 UNCODE.lightbox(); 6753 } 6754 } 6755 cssgridContainer.trigger('more-items-loaded'); 6756 }, 300); 6757 6758 $('.pagination', cssgridFooter).remove(); 6759 cssgridFooter.append($resultPagination); 6760 6761 if (cssgridResultCount.length > 0) { 6762 $('.woocommerce-result-count', cssgridResultCount).remove(); 6763 cssgridResultCount.append($resultCount); 6764 } 6765 }); 6766 }; 6767 6768 $filters.each(function(i, buttonGroup) { 6769 var $buttonGroup = $(buttonGroup); 6770 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 6771 $buttonGroup.find('.active').removeClass('active'); 6772 $(this).addClass('active'); 6773 6774 }); 6775 6776 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6777 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6778 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6779 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6780 e.preventDefault(); 6781 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6782 }); 6783 6784 }); 6785 }; 6786}; 6787 6788UNCODE.preventDoubleTransition = function() { 6789 $('.sticky-element .animate_when_almost_visible').each(function(){ 6790 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 6791 $el.addClass('do_not_reanimate'); 6792 }); 6793 }); 6794}; 6795 6796UNCODE.checkScrollForTabs = function(){ 6797 var goToSection = window.location.hash.replace('#', ''), 6798 $index; 6799 6800 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 6801 goToSection = encodeURIComponent(goToSection); 6802 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 6803 6804 $index.attr('data-parent', 'parent-' + goToSection); 6805 6806 if (window.location.hash != undefined && window.location.hash != '') { 6807 requestTimeout(function() { 6808 scrollBody('parent-' + goToSection); 6809 }, 500); 6810 } 6811 6812 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 6813 var hash = (e.currentTarget).hash, 6814 index = (e.currentTarget).closest('.uncode-tabs'); 6815 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 6816 $('a[href="' + hash + '"][data-tab-history]').click(); 6817 scrollBody(index); 6818 } 6819 }); 6820 6821 var scrollBody = function(index) { 6822 6823 var getSection = $('a[href="' + index + '"][data-tab-history]'), 6824 scrollTo, 6825 safeGap = 27; 6826 6827 if ( ! getSection.length ) { 6828 getSection = $('div[data-parent="' + index + '"]'); 6829 6830 if ( getSection.attr('data-target') == 'row' ) { 6831 getSection = getSection.closest('.vc_row'); 6832 safeGap = 0; 6833 } 6834 } 6835 6836 if (typeof getSection === 'undefined' || ! getSection.length ) { 6837 return; 6838 } 6839 6840 var body = $("html, body"), 6841 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6842 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 6843 getOffset = UNCODE.get_scroll_offset(); 6844 if ( typeof getSection.offset() === 'undefined' ) 6845 return; 6846 scrollTo = getSection.offset().top - safeGap; 6847 scrollTo -= getOffset; 6848 6849 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6850 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6851 6852 if (index != 0) { 6853 UNCODE.scrolling = true; 6854 } 6855 6856 if (scrollSpeed == 0) { 6857 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 6858 UNCODE.scrolling = false;
6859 } else { 6860 body.animate({ 6861 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 6862 }, scrollSpeed, 'easeInOutQuad', function() { 6863 requestTimeout(function() { 6864 UNCODE.scrolling = false; 6865 if (getOffset != UNCODE.get_scroll_offset()) { 6866 scrollBody(index); 6867 } 6868 }, 100); 6869 }); 6870 } 6871 6872 }; 6873}; 6874 6875UNCODE.printScreen = function() { 6876 var inlineMediaStyle = null, 6877 setResize; 6878 6879 function changeMediaStyle() { 6880 clearRequestTimeout(setResize); 6881 setResize = requestTimeout(function(){ 6882 var $head = document.getElementsByTagName('head')[0], 6883 $newStyle = document.createElement('style'), 6884 winW = window.innerWidth, 6885 printH = window.innerHeight; 6886 6887 $newStyle.setAttribute('type', 'text/css'); 6888 $newStyle.setAttribute('media', 'print'); 6889 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 6890 6891 if (inlineMediaStyle != null) { 6892 $head.replaceChild($newStyle, inlineMediaStyle) 6893 } else { 6894 $head.appendChild($newStyle); 6895 } 6896 inlineMediaStyle = $newStyle; 6897 }, 1000); 6898 } 6899 6900 changeMediaStyle(); 6901 window.addEventListener('resize', changeMediaStyle); 6902}; 6903 6904UNCODE.fullPage = function() { 6905 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 6906 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 6907 return false; 6908 } else { 6909 requestTimeout(function() { 6910 window.scrollTo(0, 0); 6911 }, 10); 6912 } 6913 6914 var $masthead = $('#masthead'), 6915 $logo = $('#logo-container-mobile'), 6916 $logolink = $('[data-minheight]', $logo), 6917 logoMinScale = $logolink.data('minheight'), 6918 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 6919 $container = $('.main-container .post-content'), 6920 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 6921 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 6922 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 6923 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 6924 headerWithOpacity = $('.header-scroll-opacity', $header).length, 6925 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 6926 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 6927 scrollBar = true, 6928 effect, 6929 animationEndTimeOut, 6930 fp_anim_time = 900, 6931 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 6932 is_scrolling = false, 6933 dataNames = [], 6934 is_first = true, 6935 no_history = $('body').hasClass('uncode-scroll-no-history'), 6936 theres_footer = true; 6937 6938 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 6939 $('> div', $footer).each(function(index, el){ 6940 if ( $(el).outerHeight() < 2 ) 6941 theres_footer = false; 6942 else 6943 theres_footer = true; 6944 }); 6945 } 6946 6947 if ( !$footer.length ) 6948 theres_footer = false; 6949 6950 if ( !UNCODE.isFullPageSnap ) { 6951 6952 if ( $('body').hasClass('uncode-fullpage-zoom') ) 6953 effect = 'scaleDown'; 6954 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 6955 effect = 'moveparallax'; 6956 else 6957 effect = 'movecurtain'; 6958 } 6959 6960 if ( $('body').hasClass('uncode-fullpage-trid') ) 6961 fp_anim_time = fp_anim_time*2; 6962 6963 if ( $header.length ) { 6964 if ( headerName !== '' ) 6965 $header.attr('data-name', headerName); 6966 if ( headerLabel !== '' ) 6967 $header.attr('data-label', headerLabel); 6968 $container.prepend($header); 6969 } 6970 if ( theres_footer ) { 6971 $container.append($footer); 6972 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 6973 $('aside.widget ul', $footer).addClass('no-list'); 6974 } 6975 6976 var $all = $rows.add($header); 6977 6978 if ( theres_footer ) 6979 $all = $all.add($footer); 6980 6981 $all.each(function(index, row) { 6982 if( index === 0 ) 6983 $(row).addClass('uncode-scroll-active'); 6984 }); 6985 6986 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 6987 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 6988 6989 $all.each(function(index, val) { 6990 var getName = $(val).data('name'), 6991 label; 6992 6993 if (typeof getName == 'undefined' || getName == 'undefined') 6994 getName = SiteParameters.slide_name + '-' + index; 6995 6996 //if ( dataNames.includes(getName) ) { 6997 if ( dataNames.indexOf(getName) > 0 ) { 6998 getName += '_' + index; 6999 $(val).data('name', getName); 7000 } 7001 7002 dataNames.push(getName); 7003 7004 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 7005 7006 if (typeof $(val).attr('data-label') !== 'undefined') 7007 label = $(val).attr('data-label'); 7008 else label = ''; 7009 7010 if ( $(val).is($footer) ) 7011 return; 7012 7013 if (label != '' ) { 7014 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 7015 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span>"+label+"</a></li>"); 7016 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 7017 $('ul.onepage-pagination').append("<li><a class='one-dot-link' data-index='" + (index) + "' href='#" + (getName) + "'><span class='cd-dot-cont'><span class='cd-dot'></span></span></a></li>"); 7018 } 7019 }); 7020 7021 var checkVisible = function( el, off ) { 7022 if (typeof jQuery === "function" && el instanceof jQuery) { 7023 el = el[0]; 7024 } 7025 7026 off = typeof off=='undefined' ? 50 : off; 7027 7028 var rect = el.getBoundingClientRect(); 7029 7030 return ( 7031 ( 7032 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7033 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7034 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7035 ) 7036 ); 7037 }; 7038 7039 var animationEndAction = function( index, nextIndex ) { 7040 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7041 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7042 player, iframe; 7043 7044 if ( !$nextSlide.is($footer) ) { 7045 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7046 } 7047 7048 if ( !UNCODE.isFullPageSnap ) { 7049 activateKBurns( nextIndex ); 7050 } 7051 7052 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7053 if ($(this).attr('data-provider') == 'vimeo') { 7054 iframe = $(this).find('iframe'); 7055 player = new Vimeo.Player(iframe[0]); 7056 player.pause(); 7057 } else if ($(this).attr('data-provider') == 'youtube') { 7058 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7059 } else { 7060 if ($(this).is('video')) { 7061 $(this)[0].volume = 0; 7062 $(this)[0].pause(); 7063 } 7064 } 7065 }); 7066 7067 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7068 if ( $nextSlide.is($header) ) 7069 $header.removeClass('header-scrolled'); 7070 } 7071 7072 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 7073 $otherEl.each(function(){ 7074 var $otherThis = $(this), 7075 $bgwrapperOther = $('.background-inner', $otherThis); 7076 if ( !checkVisible($otherThis) ) 7077 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 7078 7079 }); 7080 7081 if ( !checkVisible($currentSlide) ) { 7082 $currentSlide.removeClass('uncode-scroll-visible'); 7083 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 7084 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7085 currentScroll.scrollTo(0, 0, 0); 7086 } 7087 7088 clearRequestTimeout(animationEndTimeOut); 7089 animationEndTimeOut = requestTimeout(function(){ 7090 Waypoint.refreshAll(); 7091 $( document.body ).trigger('uncode_waypoints'); 7092 var eventFP = new CustomEvent('fp-slide-changed'); 7093 window.dispatchEvent(eventFP); 7094 is_scrolling = false; 7095 7096 if ( is_first ) { 7097 $('ul.onepage-pagination a').removeClass('is-selected'); 7098 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7099 is_first = false; 7100 } 7101 7102 }, 500); 7103 }; 7104 7105 var postLeaveActions = function( nextIndex ){ 7106 if ( menuHidden && ! UNCODE.isMobile ) 7107 return false; 7108 7109 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7110 $cols = $('.uncol', $el), 7111 anchor = $el.data('anchor'); 7112 7113 if ( ! UNCODE.isFullPageSnap ) { 7114 $.each($cols, function(index, val){ 7115 if ( $(val).hasClass('style-light') ){ 7116 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7117 return false; 7118 } else if ( $(val).hasClass('style-dark') ) { 7119 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7120 return false; 7121 } 7122 }); 7123 } 7124 7125 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 7126 $('.menu-item' ).removeClass('active'); 7127 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7128 } 7129 7130 if ( !UNCODE.isFullPageSnap ) { 7131 activateBackWash( nextIndex ); 7132 } 7133 }; 7134 7135 var activateBackWash = function( nextIndex ){ 7136 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7137 $bgwrapper; 7138 7139 if ( $el.length ) { 7140 if ( $el.hasClass('with-zoomout') ) { 7141 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7142 } else if ( $('.with-zoomout', $el).length ) { 7143 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 7144 } else { 7145 return false; 7146 } 7147 } else { 7148 return false; 7149 } 7150 7151 $bgwrapper.addClass('uncode-zoomout'); 7152 7153 }; 7154 7155 var activateKBurns = function( nextIndex ){ 7156 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7157 $bgwrapper; 7158 7159 if ( $el.length ) { 7160 if ( $el.hasClass('with-kburns') ) { 7161 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7162 } else if ( $('.with-kburns', $el).length ) { 7163 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 7164 } else { 7165 return false; 7166 } 7167 } else { 7168 return false; 7169 } 7170 7171 $bgwrapper.addClass('uncode-kburns'); 7172 7173 }; 7174 7175 var activateParallax = function( nextIndex, direction ){ 7176 7177 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7178 $cell = $('.fp-tableCell', $el), 7179 animationEnd = 'webkitAnimationEnd animationend', 7180 cellAnim; 7181 7182 switch( direction ) { 7183 case 'up': 7184 cellAnim = 'moveFromTopInner'; 7185 break; 7186 default: 7187 cellAnim = 'moveFromBottomInner'; 7188 } 7189 7190 $cell.css({ 7191 'animation-name': cellAnim, 7192 'animation-duration': fp_anim_time + 'ms', 7193 'animation-delay': '', 7194 'animation-timing-function': fp_easing, 7195 'animation-fill-mode': 'both', 7196 }).off(animationEnd) 7197 .on(animationEnd, function(event) { 7198 if ( event.originalEvent.animationName === cellAnim ) { 7199 $cell 7200 .css({ 7201 'animation-name': '', 7202 'animation-duration': '', 7203 'animation-delay': '', 7204 'animation-timing-function': '', 7205 'animation-fill-mode': '', 7206 }); 7207 } 7208 }); 7209 }; 7210 7211 var scrollHashes = function(){ 7212 var hash = window.location.hash.replace('#', '').split('/'), 7213 hashInd; 7214 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 7215 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 7216 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 7217 $.fn.fullpage.moveTo(hashInd+1); 7218 } 7219 } else if( hash[0] === '' ) { 7220 $.fn.fullpage.moveTo(1); 7221 } 7222 }; 7223 7224 var hideMenu = function( index, nextIndex ){ 7225 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 7226 return false; 7227 7228 var hMenu = UNCODE.menuHeight, 7229 transTime = hMenu * 2; 7230 7231 if ( index === 1 && nextIndex > 1 ) { 7232 hMenu = hMenu * -1; 7233 } else if ( index !== 1 && nextIndex === 1 ) { 7234 hMenu = 0; 7235 } else { 7236 return false;
7237 } 7238 7239 $masthead.css({ 7240 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7241 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7242 '-webkit-transition': 'transform 0.5s ease-in-out', 7243 'transition': 'transform 0.5s ease-in-out' 7244 }); 7245 }; 7246 7247 var shrinkMenu = function( index, nextIndex ){ 7248 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 7249 return false; 7250 7251 if ( index === 1 && nextIndex > 1 ) { 7252 $logo.addClass('shrinked'); 7253 $('div', $logo).each(function(index, val){ 7254 $(val).css({ 7255 'height': logoMinScale, 7256 'line-height': logoMinScale 7257 }); 7258 if ($(val).hasClass('text-logo')) { 7259 $(val).css({ 7260 'font-size': logoMinScale + 'px' 7261 }); 7262 } 7263 }); 7264 requestTimeout(function() { 7265 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7266 }, 300); 7267 } else if ( index !== 1 && nextIndex === 1 ) { 7268 $logo.removeClass('shrinked'); 7269 $('div', $logo).each(function(index, val){ 7270 $(val).css({ 7271 'height': logoMaxScale, 7272 'line-height': logoMaxScale 7273 }); 7274 if ($(val).hasClass('text-logo')) { 7275 $(val).css({ 7276 'font-size': logoMaxScale + 'px' 7277 }); 7278 } 7279 }); 7280 requestTimeout(function() { 7281 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7282 }, 300); 7283 } else { 7284 return false; 7285 } 7286 7287 }; 7288 7289 var anchorLink = function(){ 7290 7291 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 7292 var $this = $(e.currentTarget), 7293 hash = e.currentTarget.href.split('#'), 7294 current = window.location.href.split('#'), 7295 ind, 7296 currentMenuOpened = UNCODE.menuOpened, 7297 go = false; 7298 7299 var hash_url = hash[0].replace(/\/?$/, '/'), 7300 current_url = current[0].replace(/\/?$/, '/'); 7301 7302 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 7303 hash = '#'+hash[1]; 7304 e.preventDefault(); 7305 go = true; 7306 } 7307 7308 if ( go ) { 7309 7310 if ( $(hash).length ) { 7311 ind = $(hash).closest('.fp-section').index(); 7312 } else { 7313 hash = hash.slice(1); 7314 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 7315 } 7316 7317 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 7318 ind = $this.closest('.fp-section').index(); 7319 7320 UNCODE.menuOpened = false; 7321 7322 $.fn.fullpage.moveTo(ind+1); 7323 7324 UNCODE.menuOpened = currentMenuOpened; 7325 if (UNCODE.menuOpened) { 7326 if (UNCODE.wwidth < UNCODE.mediaQuery) { 7327 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 7328 } else { 7329 $('.mmb-container-overlay .overlay-close').trigger('click'); 7330 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 7331 } 7332 } 7333 7334 } 7335 7336 }); 7337 7338 $('.header-scrolldown').on('click', function(event) { 7339 event.preventDefault(); 7340 var scrollDown = $(this), 7341 ind = scrollDown.closest('.fp-section').index(); 7342 7343 $.fn.fullpage.moveTo(ind+2); 7344 }); 7345 7346 var anchor = $('.fp-section.active').data('anchor'); 7347 7348 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 7349 $('.menu-item').removeClass('active'); 7350 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7351 } 7352 7353 }; 7354 7355 var slideLeave = function( index, nextIndex, direction ) { 7356 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7357 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7358 animationEnd = 'webkitAnimationEnd animationend', 7359 transitionEnd = 'webkitTransitionEnd transitionend', 7360 animOut = effect != 'scaleDown' ? effect + direction : effect, 7361 animIn, 7362 isFooter = false, 7363 isFooterNext = false, 7364 footerH = $footer.outerHeight(), 7365 timeout, 7366 player, iframe, 7367 footerCoeff; 7368 switch( direction ) { 7369 case 'up': 7370 animIn = 'moveFromTop'; 7371 break; 7372 default: 7373 animIn = 'moveFromBottom'; 7374 } 7375 7376 if ( $('body').hasClass('uncode-fullpage-trid') ) { 7377 animOut = animIn + 'trid'; 7378 animIn = animOut + 'In'; 7379 } else if ( UNCODE.isFullPageSnap ) { 7380 animIn = animOut = 'none'; 7381 } 7382 7383 hideMenu(index, nextIndex); 7384 shrinkMenu(index, nextIndex); 7385 7386 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7387 if ($(this).attr('data-provider') == 'vimeo') { 7388 iframe = $(this).find('iframe'); 7389 player = new Vimeo.Player(iframe[0]); 7390 player.pause(); 7391 } else if ($(this).attr('data-provider') == 'youtube') { 7392 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7393 } else { 7394 if ($(this).is('video')) { 7395 $(this)[0].volume = 0; 7396 $(this)[0].pause(); 7397 } 7398 } 7399 }); 7400 7401 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 7402 if ($(this).attr('data-provider') == 'vimeo') { 7403 iframe = $(this).find('iframe'); 7404 iframe.on('load', function(){ 7405 player = new Vimeo.Player(iframe); 7406 player.setVolume(0); 7407 player.play(); 7408 }); 7409 player = new Vimeo.Player(iframe); 7410 player.setVolume(0); 7411 player.play(); 7412 } else if ($(this).attr('data-provider') == 'youtube') { 7413 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 7414 } else { 7415 if ($(this).is('video')) { 7416 $(this)[0].volume = 0; 7417 $(this)[0].play(); 7418 } 7419 } 7420 }); 7421 7422 if ( $currentSlide.is($footer) ) 7423 isFooter = true; 7424 7425 if ( $nextSlide.is($footer) ) 7426 isFooterNext = true; 7427 7428 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7429 if ( $currentSlide.is($header) ) 7430 $header.addClass('header-scrolled'); 7431 } 7432 7433 footerCoeff = footerH; 7434 7435 if ( UNCODE.isFullPageSnap ) { 7436 postLeaveActions( nextIndex ); 7437 activateBackWash( nextIndex ); 7438 activateKBurns( nextIndex ); 7439 requestTimeout(function(){ 7440 animationEndAction( index, nextIndex ); 7441 }, fp_anim_time+150); 7442 } else { 7443 if ( isFooterNext ) { 7444 7445 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 7446 $iscrollWrapper.addClass('no-scrolloverflow'); 7447 7448 $nextSlide 7449 .add($currentSlide) 7450 .addClass('uncode-scroll-front') 7451 .addClass('uncode-scroll-active') 7452 .addClass('uncode-scroll-visible'); 7453 $container.css({ 7454 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7455 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7456 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7457 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7458 }).off(transitionEnd) 7459 .one(transitionEnd, function(){ 7460 animationEndAction( index, nextIndex ); 7461 }); 7462 7463 } else if ( isFooter ) { 7464 7465 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 7466 .add($currentSlide) 7467 .addClass('uncode-scroll-front') 7468 .addClass('uncode-scroll-active') 7469 .addClass('uncode-scroll-visible'); 7470 $container.css({ 7471 '-webkit-transform': 'translate3d(0, 0, 0)', 7472 'transform': 'translate3d(0, 0, 0)', 7473 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7474 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7475 }) 7476 .one(transitionEnd, function(){ 7477 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 7478 clearRequestTimeout(timeout); 7479 timeout = requestTimeout(function(){ 7480 $.fn.fullpage.moveTo(nextIndex); 7481 slideLeave( index-1, nextIndex, 'up' ); 7482 $container.off(transitionEnd); 7483 }, 50); 7484 } 7485 animationEndAction( index, nextIndex ); 7486 }); 7487 7488 } else { 7489 7490 postLeaveActions( nextIndex ); 7491 7492 if ( !$('body').hasClass('uncode-fullpage-trid') ) 7493 activateParallax( nextIndex, direction ); 7494 7495 var $outBg = $('.background-wrapper', $currentSlide); 7496 7497 $nextSlide 7498 .addClass('uncode-scroll-front') 7499 .addClass('uncode-scroll-active') 7500 .addClass('uncode-scroll-visible') 7501 .addClass('uncode-scroll-animating-in') 7502 .css({ 7503 'z-index':4, 7504 'animation-name': animIn, 7505 'animation-duration': fp_anim_time + 'ms', 7506 'animation-delay': '', 7507 'animation-timing-function': fp_easing, 7508 'animation-fill-mode': 'both', 7509 'transition': 'initial', 7510 }).off(animationEnd) 7511 .on(animationEnd, function(event) { 7512 if ( event.originalEvent.animationName === animIn ) { 7513 $(this) 7514 .addClass('uncode-scroll-already') 7515 .removeClass('uncode-scroll-front') 7516 .removeClass('uncode-scroll-animating-in') 7517 .css({ 7518 'animation-name': '', 7519 'animation-duration': '', 7520 'animation-delay': '', 7521 'animation-timing-function': '', 7522 'animation-fill-mode': '', 7523 'transition': 'initial', 7524 }); 7525 7526 $currentSlide 7527 .removeClass('uncode-scroll-active') 7528 .add($outBg) 7529 .css({ 7530 'animation-name': '', 7531 'animation-duration': '', 7532 'animation-delay': '', 7533 'animation-timing-function': '', 7534 'animation-fill-mode': '', 7535 'transition': 'initial', 7536 }); 7537 7538 animationEndAction( index, nextIndex ); 7539 7540 } 7541 7542 if ( nextIndex > 1 ) 7543 $('body').addClass('window-scrolled'); 7544 else 7545 $('body').removeClass('window-scrolled'); 7546 }); 7547 7548 $currentSlide 7549 .addClass('uncode-scroll-animating-out') 7550 .removeClass('uncode-scroll-front') 7551 .css({ 7552 'z-index':'1', 7553 'animation-name': animOut, 7554 'animation-duration': fp_anim_time + 'ms', 7555 'animation-delay': '', 7556 'animation-timing-function': fp_easing, 7557 'animation-fill-mode': 'both', 7558 'transition': 'initial', 7559 'will-change': 'auto' 7560 }).off(animationEnd) 7561 .on(animationEnd, function(event) { 7562 if ( event.originalEvent.animationName === animOut ) { 7563 $currentSlide.removeClass('uncode-scroll-animating-out'); 7564 } 7565 }); 7566 7567 if ( $('body').hasClass('uncode-fp-opacity') ) { 7568 $currentSlide.find('> div').css({ 7569 'animation-name': 'opacityout', 7570 'animation-duration': fp_anim_time + 'ms', 7571 'animation-delay': '', 7572 'animation-timing-function': fp_easing, 7573 'animation-fill-mode': 'both', 7574 'transition': 'initial', 7575 }).off(animationEnd) 7576 .on(animationEnd, function(event) { 7577 if ( event.originalEvent.animationName === 'opacityout' ) { 7578 $(event.currentTarget).css({ 7579 'animation-name': '', 7580 'animation-duration': '', 7581 'animation-delay': '', 7582 'animation-timing-function': '', 7583 'animation-fill-mode': '', 7584 'transition': '', 7585 }); 7586 } 7587 }); 7588 } 7589 } 7590 } 7591 7592 $('.scroll-top').on('click', function(e){ 7593 $.fn.fullpage.moveTo(1); 7594 return false;
7595 }); 7596 7597 }; 7598 7599 var init_fullPage = function(mode){ 7600 7601 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 7602 // scrollBar = false; 7603 // } 7604 7605 var checkFPeffects; 7606 7607 $container.fullpage({ 7608 sectionSelector: '.uncode-scroll-lock', 7609 scrollOverflow: true, 7610 scrollOverflowOptions: { 7611 click: false, 7612 preventDefaultException: { tagName:/.*/ } 7613 }, 7614 navigation: false, 7615 scrollBar: scrollBar, 7616 scrollingSpeed: fp_anim_time, 7617 verticalCentered: true, 7618 anchors: no_history ? false : dataNames, 7619 recordHistory: !no_history, 7620 afterRender: function(){ 7621 $('body').removeClass('fp-waiting'); 7622 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 7623 var $invisible = $(this).addClass('hidden-scroll');//, 7624 }); 7625 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 7626 var $visible = $(this).addClass('uncode-scroll-visible'), 7627 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 7628 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 7629 }); 7630 7631 $('ul.onepage-pagination a').on('click', function(e){ 7632 e.preventDefault(); 7633 var $a = $(this), 7634 toIndex = $a.data('index'); 7635 7636 $.fn.fullpage.moveTo(toIndex+1); 7637 }); 7638 7639 requestTimeout(function(){ 7640 scrollHashes(); 7641 }, 1000); 7642 7643 $(window).on('hashchange', function(e){ 7644 requestTimeout(function(){ 7645 scrollHashes(); 7646 }, 500); 7647 }); 7648 7649 anchorLink(); 7650 7651 if ( $('body').hasClass('uncode-fp-opacity') ) { 7652 $all.each(function(index, row) { 7653 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 7654 classBg; 7655 7656 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 7657 classBg = testmatch[0]; 7658 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 7659 } 7660 }); 7661 } 7662 7663 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 7664 $(window).on('menuOpen gdprOpen', function(){ 7665 $.fn.fullpage.setAutoScrolling(false); 7666 }).on('menuClose gdprClose', function(){ 7667 $.fn.fullpage.setAutoScrolling(true); 7668 }); 7669 } 7670 7671 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 7672 requestTimeout(function(){ 7673 $.fn.fullpage.setAutoScrolling(false); 7674 }, 1000); 7675 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 7676 $.fn.fullpage.setAutoScrolling(true); 7677 }); 7678 7679 if ( !UNCODE.isFullPageSnap ) { 7680 clearRequestTimeout(checkFPeffects); 7681 checkFPeffects = requestTimeout(function(){ 7682 activateBackWash( 1 ); 7683 activateKBurns( 1 ); 7684 }, 100); 7685 } 7686 7687 }, 7688 onLeave: function( index, nextIndex, direction ){ 7689 7690 if ( UNCODE.menuOpened || is_scrolling ) 7691 return false; 7692 7693 is_scrolling = true; 7694 7695 var event = new CustomEvent('fp-slide-leave'); 7696 window.dispatchEvent(event); 7697 7698 slideLeave( index, nextIndex, direction ); 7699 7700 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 7701 if ( direction === 'up' ) { 7702 $.fn.fullpage.moveTo(nextIndex-1); 7703 } else { 7704 $.fn.fullpage.moveTo(nextIndex+1); 7705 } 7706 return false; 7707 } 7708 7709 $('ul.onepage-pagination a').removeClass('is-selected'); 7710 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7711 7712 } 7713 }); 7714 }; 7715 7716 init_fullPage(); 7717 $(window).on('load', function(){ 7718 requestTimeout(function(){ 7719 $.fn.fullpage.reBuild(); 7720 }, 3000); 7721 }); 7722 7723 var addScrollingClass, 7724 removeScrollingClass; 7725 7726 window.addEventListener("fp-slide-scroll", function(){ 7727 addScrollingClass = requestTimeout( function(){ 7728 $('body').addClass('fp-slide-scrolling'); 7729 }, 10 ); 7730 7731 clearRequestTimeout(removeScrollingClass); 7732 removeScrollingClass = requestTimeout( function(){ 7733 $('body').removeClass('fp-slide-scrolling'); 7734 }, 150 ); 7735 7736 Waypoint.refreshAll(); 7737 }, false); 7738 7739 var setFPheight = function(){ 7740 var $body = document.body, 7741 $footer = document.getElementById('colophon'), 7742 $maincontainer = document.querySelector('.main-wrapper'), 7743 $boxcontainer = document.querySelector('.box-container'), 7744 $sections = document.querySelectorAll('.fp-section'), 7745 rect = $maincontainer.getBoundingClientRect(), 7746 rect2 = $boxcontainer.getBoundingClientRect(), 7747 $masthead = document.getElementById('masthead'), 7748 _hideMenu = false, 7749 menuHeight = UNCODE.menuHeight; 7750 $body.style.height = UNCODE.wheight + 'px'; 7751 7752 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 7753 _hideMenu = true; 7754 } 7755 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 7756 menuHeight = 0 7757 } 7758 7759 7760 if ( theres_footer ) 7761 $footer.style.top = (rect.height || rect2.height) + 'px'; 7762 7763 for (var i = 0; i < $sections.length; i++) { 7764 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 7765 } 7766 }; 7767 7768 setFPheight(); 7769 7770 window.addEventListener('resize', setFPheight, false); 7771 window.addEventListener('orientationchange', setFPheight, false); 7772 7773}; 7774 7775UNCODE.particles = function() { 7776 $(".vc-particles-background").each(function() { 7777 var $particle = $(this); 7778 var $parent = $particle.closest('[data-parent]'); 7779
7780 $parent.prepend($particle); 7781 // $(window).trigger('resize'); 7782 }) 7783}; 7784 7785 7786UNCODE.filters = function() { 7787 var $systems = $('.isotope-system, .cssgrid-system'); 7788 7789 $systems.each(function(index, val){ 7790 var $system = $(this), 7791 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 7792 $widgets = $('.widgetized-cb-wrapper', $system), 7793 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 7794 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 7795 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 7796 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 7797 7798 if ($system.hasClass('isotope-processed')) { 7799 return; 7800 } 7801 7802 $cats_trigger.on('click', function(e) { 7803 if ( ! $('html').hasClass('screen-sm') ) { 7804 // $widgets.add($sorting_dd).slideUp(400); 7805 e.preventDefault(); 7806 $widgets.slideUp(400, 'easeInOutCirc'); 7807 } 7808 }); 7809 7810 $('.filters-toggle-trigger', $system).on('click', function(e) { 7811 e.preventDefault(); 7812 var $filters = $('.isotope-filters .menu-horizontal', $system); 7813 $filters.slideToggle(400, 'easeInOutCirc'); 7814 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7815 }); 7816 7817 $widget_trgr.on('click', function(e) { 7818 e.preventDefault(); 7819 $widgets.slideToggle(400, 'easeInOutCirc'); 7820 if (!$('html').hasClass('screen-sm')) { 7821 $cats_filters.slideUp(400, 'easeInOutCirc'); 7822 } 7823 window.dispatchEvent(new CustomEvent('boxResized')); 7824 }); 7825 7826 $sorting_trgr.on('click', function(e) { 7827 e.preventDefault(); 7828 if (!$('html').hasClass('screen-sm')) { 7829 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7830 } 7831 }); 7832 7833 $system.addClass('isotope-processed'); 7834 }); 7835 7836}; 7837 7838UNCODE.widgets = function() { 7839 var widget_collapses = $('.widget-collapse'); 7840 7841 widget_collapses.each(function(){ 7842 var widget_collapse = $(this), 7843 widget_title = widget_collapse.find('.widget-title'), 7844 widget = widget_title.closest('.widget'), 7845 content = widget.children().not('.widget-title'), 7846 setCTA; 7847 7848 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 7849 widget_title.toggleClass('open'); 7850 } 7851 7852 widget_title.each(function() { 7853 var _this = $(this); 7854 var content = _this.closest('.widget').find('.widget-collapse-content'); 7855 7856 $(window).on('load resize', function(){ 7857 clearRequestTimeout(setCTA); 7858 setCTA = requestTimeout( function() { 7859 if ( content.is(':visible') ) { 7860 _this.addClass( 'open' ); 7861 } else { 7862 _this.removeClass( 'open' ); 7863 } 7864 }, 10 ); 7865 }) 7866 7867 _this.on( 'click', function(){ 7868 7869 // Get content of :after element (+ icon) to check the visibility 7870 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 7871 7872 if (icon_content === 'none' || !icon_content) { 7873 return false; 7874 } 7875 7876 _this.toggleClass('open'); 7877 var isOpen = _this.hasClass('open'), 7878 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 7879 content.animate({ 7880 height: 'toggle', 7881 padding: 'toggle', 7882 opacity: 'toggle', 7883 top: isOpen ? 0 : hasBorder 7884 }, { 7885 duration: 400, 7886 easing: "easeInOutCirc", 7887 }); 7888 7889 return false; 7890 7891 }); 7892 }); 7893 }); 7894 7895 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 7896}; 7897 7898UNCODE.unmodal = function() { 7899 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 7900 $('.unmodal-overlay').fadeIn(); 7901 $('.unmodal-overlay').addClass('loading'); 7902 $('body').addClass('uncode-unmodal-overlay-visible'); 7903 $(window).trigger('unmodal-open'); 7904 }); 7905 7906 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 7907 $('.unmodal-overlay').fadeOut(); 7908 $('.unmodal').fadeOut(); 7909 $('body').removeClass('uncode-unmodal-overlay-visible'); 7910 $('body').removeClass('uncode-unmodal-open'); 7911 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 7912 $(document).trigger('unmodal-close'); 7913 UNCODE.isUnmodalOpen = false; 7914 }); 7915 7916 $(document).on('uncode-unmodal-show-content', function() { 7917 $('.unmodal-overlay').removeClass('loading'); 7918 $('.unmodal').show(); 7919 $('.unmodal').addClass('show-unmodal-with-animation'); 7920 $('.unmodal-content')[0].scrollTop = 0; 7921 $('body').addClass('uncode-unmodal-open'); 7922 UNCODE.isUnmodalOpen = true; 7923 7924 if ($('body').hasClass('qw-body-scroll-disabled')) { 7925 $('html').addClass('uncode-unmodal-body-disable-scroll'); 7926 } 7927 7928 if ($('.unmodal').hasClass('auto-height')) { 7929 set_modal_height(); 7930 } 7931 }); 7932 7933 var set_modal_height = function() { 7934 var modal = $('.unmodal'); 7935 var window_height = $(window).outerHeight(); 7936 var modal_height = modal.outerHeight(); 7937 7938 modal.css('height', 'auto'); 7939 7940 if (modal_height > window_height) { 7941 modal.outerHeight(window_height); 7942 } 7943 } 7944 7945 if ($('.unmodal').hasClass('auto-height')) { 7946 var setCTA; 7947 7948 $(window).on('resize', function() { 7949 clearRequestTimeout(setCTA); 7950 setCTA = requestTimeout(function() { 7951 set_modal_height(); 7952 }, 100); 7953 }); 7954 } 7955}; 7956 7957UNCODE.bgChanger = function() { 7958 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 7959 $bg_first = $('.vc_row[data-bg-remove]'), 7960 bg_remove = $bg_first.attr('data-bg-remove'), 7961 $first = $bg_changers.first(), 7962 $last = $bg_changers.last(), 7963 $bg_wrapper = $('#changer-back-color'), 7964 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 7965 setCTA, localH = UNCODE.wheight, 7966 isScrolling; 7967 7968 $bg_first.removeClass(bg_remove); 7969 7970 var bgChange = function($col, bgColor, skin, tmbskin){ 7971 $bg_wrapper.attr( 'class', bgColor ); 7972 var menuskin; 7973 if ( typeof skin !== 'undefined' ) { 7974 menuskin = skin.replace('style', 'menu') 7975 } 7976 7977 if ( $col.length ) { 7978 $('.uncol[data-skin-change]').each(function(){ 7979 var $isoFooter = $('.isotope-footer', this); 7980 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 7981 if ( menuskin !== '' ) {
7982 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 7983 } 7984 }); 7985 7986 $('.tmb[data-skin-change]').each(function(){ 7987 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 7988 }); 7989 } 7990 }; 7991 7992 var $masthead = $('#masthead'), 7993 transDesktop, 7994 transMobile, 7995 changeSkin, 7996 7997 checkTransparencyAndChange = function( skin ){ 7998 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 7999 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 8000 changeSkin = $masthead.hasClass('menu-change-skin'); 8001 8002 if ( ! transDesktop && ! transMobile ) { 8003 return false; 8004 } 8005 8006 if ( ! changeSkin ) { 8007 return false; 8008 } 8009 8010 if ( skin === 'style-light' ){ 8011 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 8012 return false; 8013 } else if ( skin === 'style-dark' ) { 8014 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 8015 return false; 8016 } 8017 }; 8018 8019 var bg_waypoints = function(){ 8020 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 8021 8022 $.each($bg_changers, function(index, row) { 8023 8024 var $row = $(row), 8025 $col = $('.uncol[data-skin-change]', $row).eq(0), 8026 skin, 8027 $tmbs, 8028 tmbskin, 8029 bgColor = $row.attr('data-bg-color'); 8030 8031 if ( ! $row.is(':visible') ) { 8032 return false; 8033 } 8034 8035 if ( $col.length ) { 8036 skin = $col.attr('data-skin-change'); 8037 $tmbs = $('.tmb[data-skin-change]', $row); 8038 tmbskin = skin.replace('style', 'tmb'); 8039 } 8040 8041 if ( ! $row.hasClass('unscroll-horizontal') ) { 8042 $row.waypoint(function( dir ) { 8043 if ( dir === 'down' ) { 8044 bgChange($col, bgColor, skin, tmbskin); 8045 checkTransparencyAndChange(skin); 8046 } else { 8047 return; 8048 } 8049 }, {
8050 offset: '50%' 8051 }); 8052 8053 $row.waypoint(function( dir ) { 8054 if ( dir === 'up' ) { 8055 bgChange($col, bgColor, skin, tmbskin); 8056 checkTransparencyAndChange(skin); 8057 } else { 8058 return; 8059 } 8060 }, { 8061 offset: function() { 8062 var clH = this.element.clientHeight, 8063 wH = window.innerHeight, 8064 ret = clH > 200 ? -100 : clH * -0.5; 8065 return ( wH / 2 ) - clH; 8066 } 8067 }); 8068 } 8069 8070 }); 8071 8072 $('body').addClass('bg-changer-init'); 8073 8074 } 8075 }; 8076 8077 var body = document.body, 8078 edges = false; 8079 8080 var throttle = function(fn, wait) { 8081 var time = Date.now(); 8082 return function() { 8083 if ((time + wait - Date.now()) < 0) { 8084 fn(); 8085 time = Date.now(); 8086 } 8087 } 8088 } 8089 8090 var $wrapper = document.querySelector(".main-wrapper"), 8091 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 8092 8093 var $title = document.querySelector('#rotating'); 8094 if ( $title !== null ) { 8095 $title.style.whiteSpace = 'nowrap'; 8096 $title.style.transition = 'transform 200ms linear'; 8097 } 8098 8099 window.addEventListener( 'scroll', throttle( function() { 8100 window.clearRequestTimeout( isScrolling ); 8101 8102 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 8103 8104 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 8105 body = document.body, 8106 html = document.documentElement, 8107 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8108 $row = false, 8109 firstOff, 8110 lastOff; 8111 8112 if ( scrolled < 100 && $first.length ) { 8113 firstOff = $first.offset().top; 8114 if ( firstOff < 100 ) { 8115 var $row = $first; 8116 } 8117 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 8118 lastOff = $last.offset().top + $last.outerHeight(); 8119 if ( lastOff > ( docH - 100 ) ) { 8120 var $row = $last; 8121 } 8122 } 8123 8124 if ( $row.length ) { 8125 var $col = $('.uncol[data-skin-change]', $row).eq(0), 8126 skin, 8127 $tmbs, 8128 tmbskin, 8129 bgColor = $row.attr('data-bg-color'); 8130 8131 if ( $col.length ) { 8132 skin = $col.attr('data-skin-change'); 8133 $tmbs = $('.tmb[data-skin-change]', $row); 8134 tmbskin = skin.replace('style', 'tmb'); 8135 } 8136 8137 bgChange($col, bgColor, skin, tmbskin); 8138 checkTransparencyAndChange(skin); 8139 edges = true; 8140 } 8141 8142 }, 150); 8143 8144 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 8145 bg_waypoints(); 8146 Waypoint.refreshAll(); 8147 edges = false; 8148 } 8149 8150 }, 100), false); 8151 8152 $(window).on('resize', function() { 8153 clearRequestTimeout(setCTA); 8154 setCTA = requestTimeout(function() { 8155 if ( localH != UNCODE.wheight ) { 8156 localH = UNCODE.wheight; 8157 bg_waypoints(); 8158 Waypoint.refreshAll(); 8159 } 8160 }, 100); 8161 }); 8162 8163 bg_waypoints(); 8164 8165}; 8166 8167UNCODE.skewIt = function() { 8168 8169 if ( $('body').hasClass('compose-mode') ) { 8170 return; 8171 } 8172 8173 var justscrolled = false; 8174 8175 var loadSkewIt = function(){ 8176 8177 var $pageHeader = $('#page-header'), 8178 $page_body = $('.page-body'), 8179 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 8180 8181 if ( $header_skew.length ) { 8182 $pageHeader.addClass('uncode-skew').css({ 8183 position: 'relative', 8184 zIndex: 1 8185 }); 8186 $header_skew.removeClass('uncode-skew'); 8187 $page_body.css({ 8188 position: 'relative', 8189 zIndex: 0 8190 }); 8191 } 8192 8193 var $skew = $('.uncode-skew'), 8194 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 8195 horizontal = $horizontal.length, 8196 stopSkewing, 8197 lastOffset = 0, 8198 lastDate = Date.now(); 8199 8200 if ( ! $skew.length ) { 8201 return; 8202 } 8203 8204 var dropSkew = function(){ 8205 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 8206 return; 8207 8208 $skew.each(function(){ 8209 var $this = $(this), 8210 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8211 8212 if ( $drop.length ) { 8213 $this.css({ 8214 'transform': 'skew(0)' 8215 }); 8216 var bound = $this[0].getBoundingClientRect(); 8217 $drop.css({ 8218 left: bound.x * -1, 8219 top: bound.y * -1, 8220 }); 8221 } 8222 }); 8223 }; 8224 dropSkew(); 8225 8226 $(window).on('resize', dropSkew); 8227 8228 window.addEventListener( 'scroll', function() { 8229 8230 if ( justscrolled !== true ) { 8231 justscrolled = true; 8232 return; 8233 } 8234 8235 window.clearRequestTimeout( stopSkewing ); 8236 8237 var now = Date.now(), 8238 delayInMs = now - lastDate, 8239 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8240 newOffset = offset - lastOffset, 8241 speed = Math.pow((newOffset / delayInMs), 3) * -1, 8242 body = document.body, 8243 html = document.documentElement, 8244 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8245 wait = 50, 8246 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 8247 8248 if ((lastDate + wait - now) < 0) { 8249 8250 lastDate = now; 8251 lastOffset = offset; 8252 8253 if ( speed > 6 ) { 8254 speed = 6; 8255 } else if ( speed < -6 ) { 8256 speed = -6; 8257 } 8258 8259 if ( speed > 2 && offset < UNCODE.wheight ) { 8260 speed = 2; 8261 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 8262 speed = -2; 8263 } 8264 8265 var speedY = speed, 8266 speedX = speed * 1.25; 8267 8268 if ( horizontal ) { 8269 speedY = 0; 8270 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 8271 speedX = 0; 8272 return; 8273 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 8274 speedX = 0; 8275 return; 8276 } 8277 } else { 8278 speedX = 0; 8279 } 8280 8281 if ( ! $skew.closest('.enter-st').length ) { 8282 speedX = 0; 8283 } 8284 8285 gsap.killTweensOf($skew); 8286 gsap.to( $skew, { 8287 duration: 0.2, 8288 skewY: (speedY * maxSpeed) + "deg", 8289 skewX: (speedX * maxSpeed) + "deg", 8290 ease: Power0.easeNone, 8291 transformOrigin: 'center', 8292 }); 8293 8294 } 8295 8296 stopSkewing = requestTimeout(function() { 8297 gsap.killTweensOf($skew); 8298 gsap.to( $skew, { 8299 duration: 0.5, 8300 skewY: "0deg", 8301 skewX: "0deg", 8302 transformOrigin: 'center', 8303 ease: Expo.easeOut, 8304 }); 8305 8306 $skew.each(function(){ 8307 var $this = $(this), 8308 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8309 8310 if ( $drop.length ) { 8311 var bound = $this[0].getBoundingClientRect() 8312 $drop.css({ 8313 left: bound.x * -1, 8314 top: bound.y * -1, 8315 }); 8316 } 8317 }); 8318 8319 }, 200); 8320 8321 }, false); 8322 8323 }; 8324 8325 $(window).on('load', loadSkewIt); 8326 8327}; 8328 8329UNCODE.rotateIt = function() { 8330 8331 if ( $('body').hasClass('compose-mode') ) { 8332 return; 8333 } 8334 8335 var loadRotateIt = function(){ 8336 8337 var $toRotate = $('.uncode-rotate'); 8338 8339 $toRotate.each(function(){ 8340 var $rotate = $(this), 8341 deg = 0, 8342 dir = true, 8343 coeff = 1, 8344 lastOffset = 0, 8345 lastDate = Date.now(); 8346 8347 var checkScroll = function($rotate){ 8348 // if ( ! $rotate.length ) { 8349 // return; 8350 // } 8351 8352 var now = Date.now(), 8353 delayInMs = now - lastDate, 8354 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8355 newOffset = offset - lastOffset, 8356 speed = (newOffset / delayInMs) * 5, 8357 body = document.body, 8358 html = document.documentElement, 8359 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 8360 8361 lastDate = now; 8362 lastOffset = offset; 8363 8364 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 8365 deg = 0; 8366 } 8367 8368 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 8369 deg = parseFloat(deg) + parseFloat(speed); 8370 } 8371 8372 if ( $rotate.hasClass('uncode-rotate-hover') ) { 8373 $rotate.hover(function(){ 8374 coeff = 1.75; 8375 }, function(){ 8376 coeff = 1; 8377 }); 8378 } 8379 8380 // if ( speed > 0 ) { 8381 // dir = true 8382 // } else if ( speed < 0 ) { 8383 // dir = false 8384 // } 8385 8386 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 8387 deg = deg+coeff; 8388 // if ( dir ) { 8389 // deg = deg+coeff; 8390 // } else { 8391 // deg = deg-coeff; 8392 // } 8393 } 8394 8395 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 8396 8397 requestAnimationFrame(function() { 8398 checkScroll($rotate); 8399 }); 8400 8401 }; 8402 8403 checkScroll($rotate); 8404 8405 }); 8406 8407 }; 8408 8409 $(window).on('load', loadRotateIt); 8410 8411}; 8412 8413var marqueeAttempts = 0, 8414 marqueeTO; 8415 8416UNCODE.textMarquee = function( $titles ) { 8417 8418 var initTextMarquee = function( $titles ){ 8419 8420 if ( typeof $titles == 'undefined' ) { 8421 $titles = $('.un-text-marquee'); 8422 } 8423 8424 if ( ! $titles.length ) { 8425 return; 8426 } 8427 8428 $titles.each(function(){ 8429 var $title = $(this), 8430 $span = $('> span', $title), 8431 txt, 8432 first = true, 8433 newW = UNCODE.wwidth; 8434 8435 $('.marquee-clone-wrap', $title).remove(); 8436 8437 txt = $title.text(); 8438 8439 if ( ! $('.marquee-original-core', $span).length ) { 8440 $span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 8441 } 8442 8443 var checkResize, 8444 spanW, 8445 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 8446 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 8447 clearSpeed, 8448 speed = 10; 8449 8450 $span.prepend($prepended); 8451 $span.append($appended); 8452 8453 var continuousTextMarquee = function(){ 8454 var bound = $title.css({ 8455 'transform': 'none', 8456 'opacity': 0 8457 }).offset(); 8458 8459 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 8460 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 8461 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 8462 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 8463 8464 var marqueeTL = new TimelineMax({paused:true, reversed:true}); 8465 8466 var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0]; 8467 8468 var inview = new Waypoint.Inview({ 8469 element: inViewElement, 8470 enter: function(direction) { 8471 marqueeTL.play(); 8472 }, 8473 exited: function(direction) { 8474 marqueeTL.pause(); 8475 } 8476 }); 8477 8478 //gsap.killTweensOf($title);
8479 marqueeTL.fromTo( $title, { 8480 opacity: 1, 8481 x: xStrt * direction * -1 8482 }, 8483 { 8484 duration: xSpeed / UNCODE.wwidth * speed, 8485 x: xEnd * direction, 8486 onComplete: function(){ 8487 first = false; 8488 continuousTextMarquee(); 8489 }, 8490 ease: Linear.easeNone 8491 }); 8492 }; 8493 8494 var runTextMarquee = function(){ 8495 var time = Date.now(); 8496 8497 var textMarqueeScroll = function(){ 8498 var $row = $title.closest('.vc_row'), 8499 $bound = $title.closest('.pin-spacer').length ? $row : $title, 8500 bound = $bound[0].getBoundingClientRect(), 8501 wait = 100, 8502 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1; 8503 8504 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 8505 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 8506 marqueeAttempts < 2 ) { 8507 8508 clearRequestTimeout(marqueeTO); 8509 8510 marqueeTO = requestTimeout(function(){ 8511 marqueeAttempts++; 8512 initTextMarquee(); 8513 }, 100); 8514 } 8515 8516 //if ((time + wait - Date.now()) < 0) { 8517 //if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) { 8518 // $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)'; 8519 gsap.killTweensOf($title); 8520 gsap.to( $title, { 8521 duration: 0.24, 8522 x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction, 8523 //ease: Expo.easeOut, 8524 }); 8525 //} 8526 //time = Date.now(); 8527 //} 8528 }; 8529 8530 textMarqueeScroll(); 8531 $(window).on( 'load scroll', function() { 8532 textMarqueeScroll(); 8533 }); 8534 8535 }; 8536 8537 var cloneSpan = function($_title, cntnt){ 8538 8539 if ( $_title.hasClass('un-marquee-infinite') ) { 8540 $('> span.marquee-clone-wrap', $_title).text(''); 8541 } 8542 8543 gsap.to( $_title, { 8544 duration: 0, 8545 x: 0 8546 }); 8547 spanW = $span.outerWidth(); 8548 8549 if ( !spanW ) { 8550 return; 8551 } 8552 8553 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2; 8554 8555 if ( $_title.hasClass('un-marquee-infinite') ) { 8556 8557 for ( var i = 0; i < part; i++ ) { 8558 $prepended[0].textContent += cntnt + "\u00A0"; 8559 $appended[0].textContent += cntnt + "\u00A0"; 8560 } 8561 } 8562 8563 if ( $('body').hasClass('compose-mode') ) { 8564 return; 8565 } 8566 8567 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 8568 continuousTextMarquee(); 8569 } 8570 8571 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 8572 runTextMarquee(); 8573 } 8574 8575 }; 8576 8577 var marqueResize = function(){ 8578 clearRequestTimeout(checkResize); 8579 checkResize = requestTimeout(function(){ 8580 if ( newW !== UNCODE.wwidth ) { 8581 gsap.killTweensOf($title); 8582 initTextMarquee(); 8583 newW = UNCODE.wwidth; 8584 } 8585 }, 1000); 8586 }; 8587 8588 $(window).off('resize', marqueResize) 8589 .on( 'resize', marqueResize); 8590 8591 cloneSpan($title, txt); 8592 8593 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8594 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 8595 // imageHover(); 8596 var $_titles = $('.un-text-marquee',e.view.$el); 8597 initTextMarquee($_titles); 8598 }); 8599 } 8600 }); 8601 }; 8602 8603 $(document).ready(function(){ 8604 initTextMarquee(); 8605 }); 8606 8607}; 8608 8609UNCODE.parallax = function() { 8610 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 8611 if ($('.parallax-el').length > 0) { 8612 var parallax_elements = new Rellax('.parallax-el'); 8613 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 8614 window.addEventListener('boxResized', function(e) { 8615 parallax_elements.refresh(); 8616 }, false); 8617 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 8618 requestTimeout(function() { 8619 parallax_elements.refresh(); 8620 }, 100); 8621 }); 8622 8623 } 8624 } 8625}; 8626 8627UNCODE.magicCursor = function(){ 8628 var $customCursor = $('#uncode-custom-cursor'), 8629 $customPilot = $('#uncode-custom-cursor-pilot'), 8630 $postLists = $('.uncode-post-titles'), 8631 currentCursor = 'auto', 8632 setTime, 8633 isScrolling, 8634 mouseEvent; 8635 8636 function delayChangeCursor(cursorType, delayt_time){ 8637 clearRequestTimeout(setTime); 8638 setTime = requestTimeout(function() { 8639 $customCursor.attr('data-cursor', cursorType); 8640 if ( $customPilot.length ) { 8641 $customPilot.attr('data-cursor', cursorType); 8642 }
8643 currentCursor = cursorType; 8644 }, delayt_time); 8645 } 8646 8647 function changeCursor($wrap){ 8648 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 8649 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 8650 $href = $wrap.find(href), 8651 cursorType, 8652 setTime, set_delay; 8653 8654 $href.hover(function(e) { 8655 var $this = $(this), 8656 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 8657 is_frontend_editor = $this.closest('.vc_controls').length, 8658 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 8659 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 8660 if ( is_frontend_editor ) { 8661 cursorType = 'auto'; 8662 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 8663 cursorType = data_cursor; 8664 } else if ( $parent_cursor.length ) { 8665 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 8666 cursorType = 'icon-light'; 8667 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 8668 cursorType = 'icon-diff'; 8669 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 8670 cursorType = 'icon-accent'; 8671 } else { 8672 cursorType = 'icon-dark'; 8673 } 8674 } else { 8675 cursorType = 'pointer'; 8676 } 8677 delayChangeCursor(cursorType, 0); 8678 }, function(){ 8679 delayChangeCursor('auto', 150); 8680 }); 8681 8682 $(window).on('disable-hover', function(event) { 8683 document.addEventListener("mousemove", function(e) { 8684 mouseEvent = e; 8685 }); 8686 delayChangeCursor('auto', 0); 8687 }); 8688 8689 $(window).on('enable-hover', function(event) { 8690 if ( typeof mouseEvent !== 'undefined' ) { 8691 var x = mouseEvent.clientX, 8692 y = mouseEvent.clientY; 8693 8694 var elements = document.elementsFromPoint(x, y), 8695 $element = $(elements[0]); 8696 8697 $element.closest(href).trigger('mouseenter'); 8698 } 8699 }); 8700 8701 } 8702 8703 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8704 changeCursor(); 8705 }); 8706 8707 $(document).ajaxComplete(function( event, xhr, settings ) { 8708 changeCursor(); 8709 }); 8710 8711 $('.isotope-container').on('isotope-layout-complete', function() { 8712 var $this = $(this); 8713 changeCursor($this); 8714 }); 8715 8716}; 8717 8718UNCODE.magneticCursor = function(){ 8719 function magneticCursor($wrap){ 8720 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 8721 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')); 8722 8723 $magnetics.on('mousemove', function(e){ 8724 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 8725 bound = e.currentTarget.getBoundingClientRect(), 8726 coeff = 30, 8727 hor = (bound.width / 2) - (e.clientX - bound.left), 8728 ver = (bound.height / 2) - (e.clientY - bound.top), 8729 toX = hor / bound.width * coeff, 8730 toY = ver / bound.height * coeff, 8731 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 8732 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 8733 toScale = Math.max(scaleX, scaleY); 8734 8735 gsap.killTweensOf($el); 8736 gsap.to( $el, { 8737 duration: 0.75, 8738 x: toX, 8739 y: toY, 8740 scale: toScale, 8741 ease: Power1.easeOut, 8742 transformPerspective: 900, 8743 transformOrigin: 'center', 8744 force3D: true 8745 }); 8746 }).on('mouseout', function(e){ 8747 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 8748 gsap.killTweensOf($el); 8749 gsap.to( $el, { 8750 duration: 0.6, 8751 y: 0, 8752 x: 0, 8753 scale: 1, 8754 ease: Power1.easeOut, 8755 transformPerspective: 900, 8756 transformOrigin: 'center', 8757 force3D: true 8758 }); 8759 }); 8760 }; 8761 8762 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8763 magneticCursor(); 8764 }); 8765 8766 $(document).ajaxComplete(function( event, xhr, settings ) { 8767 magneticCursor(); 8768 }); 8769 8770 $('.isotope-container').on('isotope-layout-complete', function() { 8771 var $this = $(this); 8772 magneticCursor($this); 8773 }); 8774 8775}; 8776 8777UNCODE.dropImage = function() { 8778 8779 /**************************** 8780 * Image hover * 8781 ****************************/ 8782 function imageHover(){ 8783 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8784 return; 8785 } 8786 8787 var $postLists = $('.uncode-post-titles'); 8788 $postLists.each(function(){ 8789 var $list = $(this), 8790 timing = parseFloat( $list.attr('data-timing') ), 8791 default_image = $list.hasClass('uncode-post-titles-default-image'), 8792 default_title = $list.hasClass('uncode-post-titles-default-title'), 8793 $tmbs = $('.tmb', $list), 8794 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 8795 clientX, 8796 clientY, 8797 $row_parent = $list.closest('.vc_row'), 8798 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 8799 $col_parent = $list.closest('.uncell'), 8800 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 8801 setCTA; 8802 8803 timing *= 0.001; 8804 8805 var drop_bgs = function(){ 8806 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 8807 var $drop = $(this), 8808 srcset = $drop.attr('data-bgset'), 8809 setArr = srcset.split(","), 8810 setArrOrder = [], 8811 biggest = 0, 8812 checkBg = false;
8813 8814 if ( SiteParameters.uncode_adaptive == true ) { 8815 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 8816 $drop.css({ 8817 'background-image' : 'url(' + setArr[0] + ')' 8818 }); 8819 } 8820 } else { 8821 for ( var i = 0; i < setArr.length; i++ ) { 8822 var setLoop = setArr[i].trim().split(" "); 8823 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 8824 var parseSet = parseFloat(setLoop[1]); 8825 if ( biggest < parseSet ) { 8826 biggest = parseSet; 8827 } 8828 setArrOrder[parseSet] = setLoop[0]; 8829 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 8830 checkBg = true; 8831 $drop.css({ 8832 'background-image' : 'url(' + setLoop[0] + ')' 8833 }); 8834 } 8835 } 8836 } 8837 8838 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 8839 $drop.css({ 8840 'background-image' : 'url(' + setArrOrder[biggest] + ')' 8841 }); 8842 } 8843 } 8844 8845 }); 8846 }; 8847 8848 drop_bgs(); 8849 8850 var dropMovesSize = function(){ 8851 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 8852 return; 8853 } 8854 $drop_moves.each(function(){ 8855 var $drop_move = $(this), 8856 dataW = $drop_move.attr('data-w'), 8857 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 8858 if ( typeof dataW !== 'undefined' && dataW !== null ) { 8859 dataW = screenInfo.width / 12 * parseFloat( dataW ); 8860 } 8861 $drop_moves.css({ 8862 width: dataW 8863 }); 8864 8865 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8866 $anim_parent.on('animationend', function(){ 8867 var bound = $anim_parent[0].getBoundingClientRect(); 8868 $drop_move.css({ 8869 left: bound.x * -1, 8870 top: bound.y * -1, 8871 }); 8872 }); 8873 } 8874 }); 8875 8876 8877 }; 8878 8879 dropMovesSize(); 8880 8881 $(window).on( 'resize', function(){ 8882 clearRequestTimeout(setCTA); 8883 setCTA = requestTimeout( function() { 8884 drop_bgs(); 8885 dropMovesSize(); 8886 }, 100 ); 8887 }); 8888 8889 if ( $drop_row_parents.length ) { 8890 $row_parent.addClass( 'drop-added' ); 8891 } 8892 8893 $drop_row_parents.each(function(index, val){ 8894 var $drop = $(val); 8895 $row_parent.prepend($drop); 8896 manageVideos($drop, false); 8897 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8898 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8899 } 8900 if ( default_image && index == 0 ) { 8901 manageVideos($drop, true); 8902 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8903 image_ph = new Image(); 8904 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8905 image_ph.onload = function() { 8906 $drop.addClass('active'); 8907 if ( default_title ) { 8908 $list.addClass('drop-hover'); 8909 $tmbs.first().addClass('drop-active'); 8910 } 8911 }; 8912 image_ph.src = bg_img; 8913 } 8914 } 8915 }); 8916 8917 if ( $drop_col_parents.length ) { 8918 $col_parent.addClass( 'drop-added' ); 8919 } 8920 8921 $drop_col_parents.each(function(index, val){ 8922 var $drop = $(this); 8923 $col_parent.prepend($drop); 8924 manageVideos($drop, false); 8925 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8926 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8927 } 8928 if ( default_image && index == 0 ) { 8929 manageVideos($drop, true); 8930 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8931 image_ph = new Image(); 8932 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8933 image_ph.onload = function() { 8934 $drop.addClass('active'); 8935 if ( default_title ) { 8936 $list.addClass('drop-hover'); 8937 $tmbs.first().addClass('drop-active'); 8938 } 8939 }; 8940 image_ph.src = bg_img; 8941 } 8942 } 8943 }); 8944 8945 function manageVideos( $el, start ) { 8946 var videoElem = $('video', $el), 8947 $iframe = $('iframe', $el), 8948 iframeID = $iframe.attr('id'); 8949 if ( videoElem.length ) { 8950 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 8951 if ( start ) { 8952 videoElem[0].setCurrentTime(0); 8953 videoElem[0].play(); 8954 } else { 8955 videoElem[0].pause(); 8956 videoElem[0].setCurrentTime(0); 8957 } 8958 } else { 8959 if ( start ) { 8960 videoElem[0].currentTime = 0; 8961 videoElem[0].play(); 8962 } else { 8963 videoElem[0].pause(); 8964 videoElem[0].currentTime = 0; 8965 } 8966 } 8967 } 8968 8969 $el.data('active', start); 8970 8971 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 8972 var iframeIDv = iframeID.replace('okplayer-', ''), 8973 optionsV = $(window).data('okoptions-' + iframeIDv), 8974 vimeo = $iframe[0], 8975 playerV = new Vimeo.Player(vimeo), 8976 timeV = 0; 8977 8978 if (optionsV.time != null) { 8979 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 8980 for ( var i = 0; i < timeArr.length; i++ ) { 8981 if ( timeArr[i] === 'h' ) { 8982 timeV += parseFloat(timeArr[i-1]) * 3600; 8983 } else if ( timeArr[i] === 'm' ) { 8984 timeV += parseFloat(timeArr[i-1]) * 60; 8985 } else if ( timeArr[i] === 's' ) { 8986 timeV += parseFloat(timeArr[i-1]); 8987 } 8988 } 8989 } 8990 playerV.setCurrentTime(timeV); 8991 if ( start ) { 8992 playerV.setVolume(0); 8993 playerV.play(); 8994 } else { 8995 playerV.pause(); 8996 } 8997 } else if ( $el.attr('data-provider') === 'youtube' ) { 8998 if ( start ) { 8999 $el.trigger('uncode-resume'); 9000 } else { 9001 $el.trigger('uncode-pause'); 9002 } 9003 } 9004 9005 } 9006 9007 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9008 9009 document.addEventListener("mousemove", function(e) { 9010 $drop_moves.each(function(){ 9011 var $drop_move = $(this), 9012 duration = 0.4; 9013 9014 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 9015 duration = 0.8; 9016 } 9017 9018 clientX = e.clientX; 9019 clientY = e.clientY; 9020 9021 gsap.to( $drop_move, { 9022 duration: duration, 9023 x: clientX, 9024 y: clientY, 9025 ease: Power1.easeOut, 9026 }); 9027 }); 9028 }); 9029 9030 } else { 9031 9032 $(window).on("touchend scroll", function(e) { 9033 $list.removeClass('drop-hover'); 9034 $drop_moves.removeClass('active'); 9035 $tmbs.removeClass('drop-active'); 9036 }); 9037 9038 $drop_moves.each(function(){ 9039 var $drop_move = $(this), 9040 $tmb = $drop_move.closest('.tmb'), 9041 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 9042 9043 if ( $anim_parent.hasClass('uncode-skew') ) { 9044 $anim_parent.css({ 9045 'transform': 'skew(0)' 9046 }); 9047 } 9048 9049 $tmb.on('touchend', function(e){ 9050 e.stopPropagation(); 9051 9052 $drop_moves.removeClass('active'); 9053 $tmbs.removeClass('drop-active'); 9054 9055 $list.addClass('drop-hover'); 9056 $tmb.addClass('drop-active'); 9057 $drop_move.addClass('active'); 9058 manageVideos($drop_move, true); 9059 clientX = e.changedTouches[0].clientX; 9060 clientY = e.changedTouches[0].clientY; 9061 9062 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9063 var bound = $anim_parent[0].getBoundingClientRect(); 9064 clientX = clientX - bound.x; 9065 clientY = clientY - bound.y; 9066 } 9067 9068 $drop_move.css({ 9069 left: clientX, 9070 top: clientY 9071 }); 9072 }); 9073 }); 9074 9075 } 9076 9077 $tmbs.each(function(e){ 9078 var $tmb = $(this), 9079 // $trgr = $('a', $tmb), 9080 $trgr = $tmb, 9081 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 9082 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9082(.t-inside), .parallax-el'), 9083 $video = $('video', $tmb), 9084 $iframe = $('iframe', $tmb), 9085 $entryTxt = $('.t-entry-text', $tmb), 9086 stopBounding; 9087 9088 $entryTxt.add($drop_move).css({ 9089 'transition-duration': timing + 's' 9090 }); 9091 9092 if ( $video.length ) { 9093 var vidH = $video[0].videoHeight, 9094 vidW = $video[0].videoWidth; 9095 $video.css({ 9096 'height': vidH, 9097 'width': vidW 9098 }); 9099 } 9100 9101 if ( $iframe.length ) { 9102 var vidH = $drop_move.attr('data-height'), 9103 vidW = $drop_move.attr('data-width'); 9104 $iframe.css({ 9105 'height': vidH, 9106 'width': vidW 9107 }); 9108 } 9109 9110 $iframe.each(function(){ 9111 var $video = $(this), 9112 vidH = $video[0].videoHeight, 9113 vidW = $video[0].videoWidth; 9114 $video.css({ 9115 'height': vidH, 9116 'width': vidW 9117 }); 9118 }); 9119 9120 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9121 $trgr.on('mouseenter',function(e){ 9122 $list.addClass('drop-hover'); 9123 $tmbs.removeClass('drop-active'); 9124 $tmb.addClass('drop-active'); 9125 $drop_move.addClass('active'); 9126 manageVideos($drop_move, true); 9127 9128 var clientX = e.clientX, 9129 clientY = e.clientY; 9130 $drop_move.css({ 9131 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 9132 }); 9133 9134 }) 9135 .on('mouseleave', function(e){ 9136 $list.removeClass('drop-hover'); 9137 $drop_move.css({ 9138 'transition-duration': ( timing*1.25 ) + 's' 9139 }); 9140 $drop_move.removeClass('active'); 9141 $tmb.removeClass('drop-active'); 9142 $drop_move.on('transitionend', function(e){ 9143 $drop_move.off('transitionend'); 9144 $drop_move.css({ 9145 'transition-duration': timing + 's' 9146 }); 9147 manageVideos($drop_move,false); 9148 }); 9149 }); 9150 9151 document.addEventListener('visibilitychange', function(){ 9152 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 9153 $drop_move.css({ 9154 'transition-duration': '0s' 9155 }); 9156 $drop_move.removeClass('active'); 9157 manageVideos($drop_move, false); 9158 } 9159 }); 9160 9161 document.addEventListener('scroll', function(){ 9162 window.clearRequestTimeout( stopBounding ); 9163 9164 if ( $drop_move.hasClass('active') ) { 9165 $list.removeClass('drop-hover'); 9166 $tmbs.removeClass('drop-active'); 9167 $drop_move.removeClass('active'); 9168 $drop_move.on('transitionend', function(e){ 9169 $drop_move.off('transitionend'); 9170 $drop_move.css({ 9171 'transition-duration': timing + 's' 9172 }); 9173 manageVideos($drop_move,false); 9174 }); 9175 } 9176 9177 stopBounding = requestTimeout(function() { 9178 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9179 var bound = $anim_parent[0].getBoundingClientRect(); 9180 $drop_move.css({ 9181 left: bound.x * -1, 9182 top: bound.y * -1, 9183 }); 9184 } 9185 }, 200); 9186 9187 }); 9188 } 9189 9190 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 9191 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 9192 9193 $drop.css({ 9194 'transition-duration': timing + 's' 9195 }); 9196 9197 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 9198 $trgr.on('mouseenter',function(e){ 9199 $row_parent.add($col_parent).addClass('drop-list-loaded'); 9200 $list.addClass('drop-hover'); 9201 9202 if ( !$tmb.hasClass('drop-active') ) { 9203 $tmbs.removeClass('drop-active'); 9204 $tmb.addClass('drop-active'); 9205 if ( default_image && !$drop.hasClass('active') ) { 9206 var $prev = $('[data-drop].active', $row_parent); 9207 $prev.css({ 9208 'transition-duration': (timing*1.5) + 's' 9209 }); 9210 $prev.removeClass('active'); 9211 $prev.on('transitionend', function(e){ 9212 $prev.off('transitionend'); 9213 manageVideos($prev,false); 9214 }); 9215 } 9216 $drop.css({ 9217 'transition-duration': timing + 's' 9218 }); 9219 $drop.off('transitionend'); 9220 $drop.addClass('active'); 9221 manageVideos($drop, true); 9222 } 9223 }) 9224 .on('mouseleave', function(e){ 9225 if ( ( default_image && !default_title ) || !default_image ) { 9226 $list.removeClass('drop-hover'); 9227 $tmb.removeClass('drop-active'); 9228 } 9229 if ( ! default_image ) { 9230 $drop.css({ 9231 'transition-duration': (timing*1.5) + 's' 9232 }); 9233 $drop.removeClass('active'); 9234 9235 $drop.on('transitionend', function(e){ 9236 $drop.off('transitionend'); 9237 manageVideos($drop,false); 9238 }); 9239 } 9240 }); 9241 9242 document.addEventListener('visibilitychange', function(){ 9243 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 9244 $drop.css({ 9245 'transition-duration': '0s' 9246 }); 9247 $drop.removeClass('active'); 9248 manageVideos($drop, false); 9249 } 9250 }); 9251 } 9252 }); 9253 9254 }); 9255 }; 9256 9257 $(window).on('load', function(event) { 9258 imageHover(); 9259 }); 9260 9261 var drop_wp_animation = function() { 9262 var $postLists = $('.uncode-post-titles'); 9263 $postLists.each(function(){ 9264 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 9265 new Waypoint({ 9266 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9267 element: val, 9268 handler: function() { 9269 var element = $(this.element), 9270 parent = element.closest('.tmb'), 9271 currentIndex = parent.index(),
9272 delay = currentIndex, 9273 delayAttr = parseInt(element.attr('data-delay')); 9274 if (isNaN(delayAttr)) delayAttr = 100; 9275 var objTimeout = requestTimeout(function() { 9276 element.addClass('start_animation'); 9277 9278 var nextTimeout = requestTimeout(function() { 9279 $('.drop-image-separator', parent).addClass('start_animation'); 9280 }, 50); 9281 9282 }, delay * delayAttr); 9283 if (!UNCODE.isUnmodalOpen) { 9284 this.destroy(); 9285 } 9286 }, 9287 offset: UNCODE.isFullPage ? '100%' : '90%' 9288 }) 9289 }); 9290 }); 9291 } 9292 9293 var runWaypoints_TO, 9294 runWaypoints_delay = 0; 9295 9296 var runWaypoints = function(){ 9297 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 9298 runWaypoints_delay = 400; 9299 } 9300 clearRequestTimeout(runWaypoints_TO); 9301 runWaypoints_TO = requestTimeout(function() { 9302 drop_wp_animation(); 9303 }, runWaypoints_delay); 9304 }; 9305 runWaypoints(); 9306 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 9307 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9308 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 9309 // imageHover(); 9310 runWaypoints(); 9311 }); 9312 } 9313}; 9314 9315UNCODE.postTable = function() { 9316 9317 var clickRow = function(){ 9318 var $postLists = $('.uncode-post-table'); 9319 9320 $postLists.each(function(){ 9321 var $postList = $(this), 9322 $tmbClicks = $('.tmb.tmb-click-row', $postList); 9323 9324 $tmbClicks.each(function(){ 9325 var $tmb = $(this), 9326 $click = $('.table-click-row', $tmb); 9327 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 9328 e.preventDefault(); 9329 e.stopPropagation(); 9330 $click[0].click(); 9331 return false; 9332 }); 9333 }); 9334 9335 }) 9336 }; 9337 9338 clickRow(); 9339 9340 var hoverRow = function(){ 9341 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 9342 9343 $postLists.on('mouseenter', function(){ 9344 $(this).addClass('post-table-hover'); 9345 }); 9346 $postLists.on('mouseleave', function(){ 9347 $(this).removeClass('post-table-hover'); 9348 }); 9349 } 9350 9351 hoverRow(); 9352 9353 var drop_wp_animation = function() { 9354 var $postLists = $('.uncode-post-table'); 9355 $postLists.each(function(){ 9356 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 9357 new Waypoint({ 9358 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9359 element: val, 9360 handler: function() { 9361 var element = $(this.element), 9362 parent = element.closest('.tmb'), 9363 currentIndex = parent.index(), 9364 delay = currentIndex, 9365 delayAttr = parseInt(element.attr('data-delay')); 9366 if (isNaN(delayAttr)) delayAttr = 100; 9367 var objTimeout = requestTimeout(function() { 9368 element.addClass('start_animation'); 9369 }, delay * delayAttr); 9370 if (!UNCODE.isUnmodalOpen) { 9371 this.destroy(); 9372 } 9373 }, 9374 offset: UNCODE.isFullPage ? '100%' : '90%' 9375 }) 9376 }); 9377 }); 9378 } 9379 9380 var runWaypoints_TO, 9381 runWaypoints_delay = 0; 9382 9383 var runWaypoints = function(){ 9384 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 9385 runWaypoints_delay = 400; 9386 } 9387 clearRequestTimeout(runWaypoints_TO); 9388 runWaypoints_TO = requestTimeout(function() { 9389 drop_wp_animation(); 9390 }, runWaypoints_delay); 9391 }; 9392 runWaypoints(); 9393 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 9394 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9395 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 9396 runWaypoints(); 9397 // clickRow(); 9398 }); 9399 } 9400}; 9401 9402UNCODE.rotatingTxt = function($ctxt) { 9403 9404 if ( $('body').hasClass('compose-mode') ) { 9405 return; 9406 } 9407 9408 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 9409 var setCTA; 9410 9411 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 9412 var $heading = $(this), 9413 // debug = 0, 9414 cycle = 0, 9415 $trgt, 9416 $toMove, 9417 $highl, 9418 $col = $heading.closest('.uncont'), 9419 txt, 9420 arrTxt, 9421 textFadeIn, textFadeOut, 9422 removeWraps; 9423 9424 var defineObjs = function() { 9425 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 9426 var $rtx = $(this), 9427 fx = $rtx.attr('data-fx'), 9428 wait = $rtx.attr('data-wait'), 9429 $prev = $(this).prev().addClass('prev-rotating-start'), 9430 splitToMove = [], 9431 splitArray = [], 9432 lineArray = [], 9433 lineIndex = 0, 9434 lineStart = true, 9435 lineEnd = false, 9436 startSplit = false, 9437 $line_wrap = $rtx.closest('.heading-line-wrap'), 9438 same_line = true, 9439 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 9440 indexRtx = $splits.index($rtx); 9441 9442 fx = typeof fx === 'undefined' ? '' : fx;
9443 wait = typeof wait === 'undefined' ? '' : wait; 9444 9445 $splits.each(function(key, val){ 9446 var $split = $(this), 9447 $new_line_wrap = $split.closest('.heading-line-wrap'); 9448 9449 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 9450 splitArray.push( $split ); 9451 } 9452 9453 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 9454 startSplit = false; 9455 } 9456 9457 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 9458 splitArray.push( $split ); 9459 9460 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 9461 same_line = true; 9462 } else { 9463 same_line = false; 9464 } 9465 } 9466 9467 if ( key == indexRtx ) { 9468 if ( /\S/.test($split.text()) ) { 9469 startSplit = true; 9470 $line_wrap = $split.closest('.heading-line-wrap'); 9471 splitArray.push( $split ); 9472 } else { 9473 indexRtx++; 9474 } 9475 } 9476 9477 $line_wrap = $new_line_wrap; 9478 }); 9479 9480 $toMove = $($.map(splitToMove, function(el){return el.get();})); 9481 $trgt = $($.map(splitArray, function(el){return el.get();})); 9482 9483 if ( same_line ) { 9484 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 9485 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 9486 } 9487 9488 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 9489 $prev.addClass('empty-span-hidden'); 9490 } 9491 9492 $highl = $('.heading-text-highlight-inner', $trgt); 9493 9494 $rtx.attr('data-animated', 'true'); 9495 if ( cycle == 0 ) { 9496 $( document.body ).trigger('defer-highlights'); 9497 cycle++; 9498 defineObjs(); 9499 return; 9500 } 9501 cycle++; 9502 9503 txt = $rtx.attr('data-text'); 9504 arrTxt = txt.split("|"); 9505 9506 textFadeOut($trgt); 9507 9508 }); 9509 }; 9510 9511 removeWraps = function(){ 9512 9513 // if ( debug == 1 ) return; 9514 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 9515 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 9516 9517 9518 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 9519 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 9520 9521 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 9522 9523 $splitFlow.each(function(){ 9524 $(this).append($temp_highl); 9525 }); 9526 9527 var $line_wrap = $wraps[wrap_k]; 9528 var $parent_wrap = $line_wrap.parentNode; 9529 if ( $parent_wrap !== null ) { 9530 while ( $line_wrap.firstChild ) { 9531 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 9532 } 9533 $parent_wrap.removeChild($line_wrap); 9534 } 9535 } 9536 // debug++; 9537 defineObjs(); 9538 }; 9539 9540 var loop = 0; 9541 textFadeIn = function($trgt){ 9542 var word = arrTxt[loop].split(" "), 9543 worsSpan = '', 9544 $wrap = $trgt.closest('.uncode-rotating-wrap'), 9545 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 9546 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 9547 9548 for (var w = 0; w < word.length; w++) { 9549 var highl; 9550 if ( $highl.length ) { 9551 highl = $highl[0].outerHTML; 9552 } else { 9553 highl = ''; 9554 } 9555 9556 if ( w > 0 ) { 9557 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 9558 } 9559 var charachters = word[w].split(''); 9560 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 9561 for (var c = 0; c < charachters.length; c++) { 9562 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 9563 } 9564 worsSpan += '</span>' + highl + '</span></span>'; 9565 } 9566 9567 if ( $wrap.length && $wrap_inner.length ) { 9568 var words_w = $wrap_inner.outerWidth(); 9569 $wrap.css({ 9570 width: words_w 9571 }); 9572 9573 $highl = $('.heading-text-highlight-inner', $wrap); 9574 $highl.prependTo($wrap); 9575 9576 $wrap_inner.css({ 9577 opacity: 0 9578 }); 9579 9580 $wrap_inner.html(worsSpan); 9581 $('.heading-text-highlight-inner', $wrap_inner).remove(); 9582 words_w = $wrap_inner.innerWidth(); 9583 9584 var duration = 0.45; 9585 9586 $heading.removeClass('auto-width'); 9587 if ( words_w > $col.width() ) { 9588 $heading.addClass('auto-width'); 9589 words_w = 'auto'; 9590 duration = 0; 9591 } 9592 9593 $wrap.css({ 9594 'width': words_w, 9595 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 9596 }); 9597 9598 var $word_inner = $('.split-word-inner', $wrap_inner), 9599 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 9600 9601 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 9602 9603 if ( !$target_fx.length ) { 9604 return; 9605 } 9606 9607 gsap.killTweensOf($target_fx); 9608 9609 if ( fx !== 'zoom' ) { 9610 gsap.fromTo( $target_fx, { 9611 y: fx === 'opacity' ? '0%' : '-10%' 9612 },{ 9613 delay: duration, 9614 duration: 0.25, 9615 y: '0%', 9616 ease: Circ.easeOut, 9617 }); 9618 9619 if ( !$wrap_inner.length ) { 9620 return; 9621 } 9622 9623 gsap.fromTo( $wrap_inner, { 9624 opacity: 0, 9625 },{ 9626 delay: duration, 9627 duration: 0.25, 9628 opacity: 1, 9629 ease: Circ.easeOut, 9630 onComplete: function(){ 9631 $('> .heading-text-highlight-inner', $wrap).remove(); 9632 $wrap_inner.html(worsSpan); 9633 removeWraps(); 9634 } 9635 }) 9636 9637 } else { 9638 gsap.fromTo( $target_fx, { 9639 transformOrigin: '50%', 9640 opacity: 0, 9641 scale: 0.875, 9642 },{ 9643 opacity: 1, 9644 delay: duration, 9645 duration: 0.25, 9646 scale: 1, 9647 ease: Circ.easeOut, 9648 onComplete: function(){ 9649 $('> .heading-text-highlight-inner', $wrap).remove(); 9650 $wrap_inner.html(worsSpan); 9651 removeWraps(); 9652 } 9653 }); 9654 } 9655 9656 } else { 9657 9658 if ( !$wrap_inner.length ) { 9659 return; 9660 } 9661 9662 gsap.to( $wrap_inner, { 9663 duration: 0.4, 9664 opacity: 0, 9665 ease: Power1.easeOut, 9666 onComplete: function(){ 9667 $wrap_inner.html(worsSpan); 9668 words_w = $wrap_inner.innerWidth(); 9669 9670 gsap.to( $wrap_inner, { 9671 duration: 0.2, 9672 opacity: 1, 9673 ease: Power1.easeOut, 9674 onComplete: function(){ 9675 $('> .heading-text-highlight-inner', $wrap).remove(); 9676 $wrap_inner.html(worsSpan); 9677 removeWraps(); 9678 } 9679 }) 9680 } 9681 }); 9682 } 9683 9684 if ( loop < arrTxt.length-1 ) { 9685 loop++; 9686 } else { 9687 loop = 0; 9688 } 9689 9690 }; 9691 9692 textFadeOut = function($trgt){ 9693 var $word_inner = $('.split-word-inner', $trgt), 9694 $wrap = $trgt.closest('.uncode-rotating-wrap'), 9695 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 9696 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 9697 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 9698 9699 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 9700 9701 var gsap_param = { 9702 delay: wait, 9703 duration: 0.25, 9704 y: fx === '' ? '10%' : '0%', 9705 opacity: 0, 9706 ease: Circ.easeOut, 9707 onStart: function(){ 9708 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 9709 $highl = $('.heading-text-highlight-inner', $wrap); 9710 $highl.prependTo($wrap); 9711 } 9712 }, 9713 onComplete: textFadeIn, 9714 onCompleteParams: [$trgt] 9715 }; 9716 9717 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 9718 9719 if ( fx === '' ) { 9720 gsap_param.y = '10%'; 9721 } else if ( fx === 'zoom' ) { 9722 gsap_param.scale = '1.045'; 9723 } 9724 9725 if ( !$target_fx.length ) { 9726 return; 9727 } 9728 9729 if ( $heading.data('waypoint') !== true ) { 9730 var textInView = new Waypoint.Inview({ 9731 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9732 element: $heading[0], 9733 enter: function(direction) { 9734 $heading.data('waypoint',true); 9735 gsap.fromTo( $target_fx, { 9736 transformOrigin: '50%' 9737 }, gsap_param ); 9738 } 9739 }); 9740 } else { 9741 gsap.fromTo( $target_fx, { 9742 transformOrigin: '50%' 9743 }, gsap_param ); 9744 } 9745 }; 9746 9747 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9748 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 9749 var $el = model.view.$el, 9750 shortcode = model.attributes.shortcode; 9751 9752 UNCODE.rotatingTxt($el); 9753 }); 9754 } else { 9755 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 9756 $heading.on('already-animated', function(){ 9757 removeWraps(); 9758 window.addEventListener('removeOldLines', function(){ 9759 clearRequestTimeout(setCTA); 9760 setCTA = requestTimeout( removeWraps, 150 ); 9761 }); 9762 }); 9763 } else { 9764 $(window).on('load', function(){ 9765 removeWraps(); 9766 window.addEventListener('removeOldLines', function(){ 9767 clearRequestTimeout(setCTA); 9768 setCTA = requestTimeout( removeWraps, 150 ); 9769 }); 9770 }); 9771 } 9772 } 9773 }); 9774 9775}; 9776 9777UNCODE.verticalText = function() { 9778 $(window).on('menuCanvasOpen', function(){ 9779 $('.vertical-text--fixed').fadeOut(500); 9780 $('.horizontal-text--fixed').fadeOut(500); 9781 }).on('menuCanvasClose', function(){ 9782 $('.vertical-text--fixed').fadeIn(500); 9783 $('.horizontal-text--fixed').fadeIn(500); 9784 }); 9785 9786 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 9787 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 9788 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 9789 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 9790 9791 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 9792 window.addEventListener('scroll', function(e) { 9793 var totalPageHeight = document.body.scrollHeight; 9794 var scrollPoint = window.scrollY + window.innerHeight; 9795 9796 if (window.scrollY > 0) { 9797 showOnTopVerticalTexts.fadeOut(); 9798 showOnTopHorizontalTexts.fadeOut(); 9799 } else { 9800 showOnTopVerticalTexts.fadeIn(); 9801 showOnTopHorizontalTexts.fadeIn(); 9802 } 9803 9804 if (scrollPoint >= totalPageHeight) { 9805 hideOnBottomVerticalTexts.fadeOut(); 9806 hideOnBottomHorizontalTexts.fadeOut(); 9807 } else { 9808 hideOnBottomVerticalTexts.fadeIn(); 9809 hideOnBottomHorizontalTexts.fadeIn(); 9810 } 9811 }, false); 9812 } 9813}; 9814 9815UNCODE.stickyScroll = function( $el ) { 9816 if ( typeof $el === 'undefined' || $el === null ) { 9817 $el = $('body'); 9818 } 9819 var checkVisible = function( el, dir ) { 9820 if (typeof jQuery === "function" && el instanceof jQuery) { 9821 el = el[0]; 9822 } 9823 9824 var off = 50; 9825 dir = typeof dir=='undefined' ? 'right' : dir; 9826 var rect = el.getBoundingClientRect(); 9827 9828 return ( 9829 ( 9830 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9831 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9832 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 9833 ) && 9834 ( 9835 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 9836 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 9837 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 9838 ( rect.right <= window.innerWidth && rect.left >= 0 ) 9839 ) 9840 ); 9841 }; 9842 9843 var setItemsRelHeight = function(reset) { 9844 var $_el = $el; 9845 if ( $el.is('.index-scroll') ) { 9846 var $_el = $el.closest('.uncont'); 9847 } 9848 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 9849 $.each($('.tmb', item), function(index, val) { 9850 if ( reset === true ) { 9851 $(val).css( 'visibility', 'hidden' ); 9852 } else { 9853 $(val).css( 'visibility', 'visible' ); 9854 } 9855 }); 9856 }); 9857 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 9858 $.each($('.tmb', item), function(index, val) { 9859 if ( reset === true ) { 9860 $(val).css( 'visibility', 'hidden' ); 9861 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 9862 } else { 9863 var $rowParent = $(item).closest('.row-parent'), 9864 rowRatio = $rowParent.attr('data-height-ratio'), 9865 $rowInner = $(item).closest('.row-child'), 9866 rowRatioInner = $rowInner.attr('data-height'), 9867 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9868 $colContainer = $(item).closest('.uncell'), 9869 $uncont = $(item).closest('.uncont'), 9870 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 9871 safe_heigth = $(item).data('safe-height'), 9872 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 9873 offSet = $(item).offset().top - $uncont.offset().top, 9874 multiplier_h, 9875 data_viewport_h, 9876 body_border = $('.body-borders .top-border').outerHeight() * 2, 9877 remove_menu = $(item).data('vp-menu'); 9878 9879 if ( rowRatio === 'full' || rowRatio === '' ) { 9880 rowRatio = 1; 9881 } else { 9882 rowRatio = rowRatio / 100; 9883 } 9884 9885 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 9886 rowRatio = rowRatio; 9887 } else { 9888 rowRatio = rowRatio * rowRatioInner / 100; 9889 } 9890 9891 winHeight = winHeight * rowRatio; 9892 9893 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9894 multiplier_h = parseInt($(item).attr('data-vp-height')); 9895 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 9896 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 9897 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 9898 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 9899 } 9900 9901 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 9902 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 9903 if ( remove_menu === true ) { 9904 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 9905 } 9906 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 9907 } else { 9908 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 9909 } 9910 9911 } 9912 }); 9913 }); 9914 $('.index-scroll', $_el).each(function(i, item){ 9915 var $uncoltable = $(item).closest('.uncoltable'), 9916 $rowParent = $(item).closest('.row-parent'), 9917 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9918 body_border = $('.body-borders .top-border').outerHeight() * 2, 9919 $index_row = $('.index-row', item), 9920 safe_heigth = $index_row.data('safe-height'), 9921 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 9922 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 9923 var data_viewport_h = winHeight - ( paddingRow + body_border ); 9924 $uncoltable.css({ 9925 'min-height': data_viewport_h 9926 }); 9927 } else { 9928 $uncoltable.css({ 9929 'min-height': 'auto' 9930 }); 9931 } 9932 }); 9933 9934 } 9935 setItemsRelHeight(); 9936 9937 var $index_scrolls = $('.index-scroll', $el); 9938
9939 $index_scrolls.each(function(key, value){ 9940 var $index = $(this), 9941 $parent_row = $index.closest('.vc_row[data-parent]'), 9942 $index_row = $('.index-row', $index), 9943 dir = $index_row.attr('data-direction'); 9944 dir = typeof dir === 'undefined' ? 'right' : dir; 9945 9946 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 9947 }); 9948 9949 var $horScrolls = $('.unscroll-horizontal', $el); 9950 9951 if ( $horScrolls.length ) { 9952 9953 $('body').addClass('scrolling-trigger'); 9954 9955 $horScrolls.each(function(key, value){ 9956 var $section = $(this), 9957 $index_scroll = $('.index-scroll', $section), 9958 $index_row = $('.index-row', $index_scroll), 9959 dir = $section.attr('data-direction'), 9960 wrap = $index_row.attr('data-wrap'), 9961 $pinWrap, 9962 $pinTrigger; 9963 9964 dir = typeof dir === 'undefined' ? 'right' : dir; 9965 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 9966 $pinWrap = $('<div class="pin-wrap" />'); 9967 if ( SiteParameters.is_frontend_editor ) { 9968 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 9969 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 9970 } else { 9971 if ( wrap === 'column' ) { 9972 $index_scroll.wrapInner( $pinWrap ); 9973 } else { 9974 $('> .row', $section).wrap( $pinWrap ); 9975 } 9976 $section.wrapInner( $pinTrigger ); 9977 } 9978 9979 }); 9980 9981 var $pinWraps = $('.pin-wrap', $el); 9982 9983 var horScrollSizes = function(){ 9984 9985 $pinWraps.each(function(key, val){ 9986 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 9987 $pinTrigger = $pinWrap.closest('.pin-trigger'), 9988 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 9989 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 9990 $boxContainer = $('.box-container'), 9991 box_m = $boxContainer.css('margin-left'), 9992 st_active = true; 9993 9994 var setHorW, 9995 horWidth = function(){ 9996 $index_scroll.each(function(){ 9997 var $this = $(this), 9998 $index_row = $('.index-row', $this), 9999 $rowContainer = $index_row.closest('.vc_row'), 10000 $rowInner = $index_row.closest('.wpb_row'), 10001 $rowParent = $index_row.closest('.row-parent'), 10002 $tmbs = $('.tmb', $index_row), 10003 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 10004 $uncont = $index_row.closest('.uncont'), 10005 $parent_col = $index_row.closest('.wpb_column'), 10006 col_w = $uncont.width(), 10007 data_lg = parseFloat( $index_row.attr('data-lg') ), 10008 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 10009 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 10010 tmb_w; 10011 10012 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 10013 tmb_w = ( col_w + padding_tmb ) / data_lg; 10014 10015 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 10016 tmb_w = ( col_w + padding_tmb ) / data_sm; 10017 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 10018 tmb_w = ( col_w + padding_tmb ) / data_md; 10019 } 10020 10021 if ( !isNaN(tmb_w) ) { 10022 $tmbs.css({ 10023 'width': tmb_w 10024 }); 10025 } 10026 10027 $tmbs.css({ 10028 'visibility': 'visible' 10029 }); 10030 10031 }); 10032 }; 10033 10034 horWidth(); 10035 clearRequestTimeout(setHorW); 10036 setHorW = requestTimeout( function(){ 10037 setItemsRelHeight(); 10038 horWidth(); 10039 }, 100 ); 10040 10041 if ( SiteParameters.is_frontend_editor ) { 10042 return; 10043 } 10044 10045 var $vmenu = $('body.vmenu .vmenu-container'), 10046 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 10047 winWidth = window.innerWidth - vmenuW, 10048 $tmb = $('.tmb', $index_scroll).eq(0), 10049 paddingRight = parseFloat( $tmb.css('padding-right') ), 10050 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 10051 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 10052 scroll_anim; 10053 10054 if ( $('body').hasClass('rtl') ) { 10055 if ( dir === 'left' ) { 10056 scroll_anim = gsap.fromTo( $pinWrap, { 10057 x: stickyScrollLength 10058 },{ 10059 x: 0, 10060 ease: "none" 10061 }); 10062 } else { 10063 scroll_anim = gsap.fromTo( $pinWrap, { 10064 x: 0 10065 },{ 10066 x: stickyScrollLength, 10067 ease: "none" 10068 }); 10069 } 10070 } else { 10071 if ( dir === 'left' ) { 10072 scroll_anim = gsap.fromTo( $pinWrap, { 10073 x: -stickyScrollLength 10074 },{ 10075 x: 0, 10076 ease: "none" 10077 }); 10078 } else { 10079 scroll_anim = gsap.fromTo( $pinWrap, { 10080 x: 0 10081 },{ 10082 x: -stickyScrollLength, 10083 ease: "none" 10084 }); 10085 } 10086 } 10087 10088 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 10089 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 10090 } 10091 10092 var animationIncrease; 10093 10094 var checkForAnimations = function(){ 10095 animationIncrease = 0 10096 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10097 var _this = this, 10098 isScrolling; 10099 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 10100 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10101 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10102 requestTimeout(function() { 10103 $(_this).addClass('start_animation'); 10104 }, delayAttr + animationIncrease); 10105 animationIncrease += 150; 10106 } 10107 }); 10108 }; 10109 checkForAnimations(); 10110
10111 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 10112 var start = 0; 10113 10114 var horST = ScrollTrigger.create({ 10115 id: "stickySectionScrolling" + key, 10116 scrub: true, 10117 trigger: $pinTrigger[0], 10118 pin: true, 10119 anticipatePin: 1, 10120 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 10121 end: function() { return "+="+stickyScrollLength; }, 10122 animation: scroll_anim, 10123 ease: Sine.easeOut, 10124 onUpdate: checkForAnimations, 10125 invalidateOnRefresh: true, 10126 onEnter: function(){ 10127 $pinTrigger.addClass('enter-st'); 10128 }, 10129 onEnterBack: function(){ 10130 $pinTrigger.addClass('enter-st'); 10131 }, 10132 onLeave: function(){ 10133 $pinTrigger.removeClass('enter-st'); 10134 }, 10135 onLeaveBack: function(){ 10136 $pinTrigger.removeClass('enter-st'); 10137 } 10138 }); 10139 10140 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 10141 window.dispatchEvent(new CustomEvent('boxResized')); 10142 10143 var testSecondTrigger = function(){ 10144 animationIncrease = 0 10145 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10146 var _this = this; 10147 if ( checkVisible(_this) ) { 10148 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10149 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10150 requestTimeout(function() { 10151 $(_this).addClass('start_animation'); 10152 }, delayAttr + animationIncrease); 10153 animationIncrease += 150; 10154 } 10155 }); 10156 10157 }; 10158 10159 var verST = ScrollTrigger.create({ 10160 id: "verticalSectionScrolling" + key, 10161 trigger: $pinTrigger[0], 10162 start: "top center", 10163 end: function() { return "+="+UNCODE.wheight; }, 10164 onUpdate: testSecondTrigger, 10165 invalidateOnRefresh: true 10166 }); 10167 10168 var setCTA, 10169 10170 dis_enable_ST = function(){ 10171 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 10172 horST.kill(); 10173 verST.kill(); 10174 $pinTrigger.addClass('disabled'); 10175 st_active = false; 10176 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 10177 horST.kill(); 10178 verST.kill(); 10179 $pinTrigger.addClass('disabled'); 10180 st_active = false; 10181 } 10182 }; 10183 10184 $(window).on('resize load', function() { 10185 clearRequestTimeout(setCTA); 10186 setCTA = requestTimeout(function() { 10187 dis_enable_ST(); 10188 checkForAnimations(); 10189 }, 500); 10190 }); 10191 10192 }); 10193 }; 10194 10195 $(window).on( 'load', function(){ 10196 horScrollSizes(); 10197 }); 10198 var setResize, 10199 setReLayout, 10200 doubleResize = true, 10201 oldW = UNCODE.wwidth; 10202 $(window).on( 'resize orientationchange', function(){ 10203 if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) { 10204 return; 10205 } else { 10206 oldW = UNCODE.wwidth; 10207 } 10208 setItemsRelHeight(true); 10209 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 10210 Array.prototype.forEach.call($row_inners, function(el) { 10211 el.style.height = ''; 10212 el.style.marginBottom = ''; 10213 }); 10214 clearRequestTimeout(setResize); 10215 setResize = requestTimeout( function(){ 10216 setItemsRelHeight(); 10217 horScrollSizes(); 10218 ScrollTrigger.refresh(); 10219 if ( doubleResize === true ) { 10220 window.dispatchEvent(new Event('resize')); 10221 doubleResize = false; 10222 } else { 10223 doubleResize = true; 10224 } 10225 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 10226 }, 100 ); 10227 }); 10228 10229 var show_pins = function(){ 10230 $('.index-scroll').css({'opacity':'1'}); 10231 setResize = requestTimeout( function(){ 10232 }, 10 ); 10233 }; 10234 ScrollTrigger.addEventListener("refresh", show_pins); 10235 $(window).on( 'uncode.re-layout', function(){ 10236 //$('.index-scroll').css({'opacity':'0'}); 10237 $('.pin-spacer').each(function(){ 10238 var space_h = $(this).outerHeight(), 10239 $row = $(this).closest('.row-container'); 10240 $row.css({ 10241 'height': space_h, 10242 'overflow': 'hidden' 10243 }); 10244 }); 10245 ScrollTrigger.refresh(true); 10246 clearRequestTimeout(setReLayout); 10247 setReLayout = requestTimeout( function(){ 10248 $('.row-container').each(function(){ 10249 $(this).css({ 10250 'height': '', 10251 'overflow': '' 10252 }); 10253 }); 10254 }, 1000); 10255 }); 10256 } 10257 10258}; 10259 10260UNCODE.stickyTrigger = function( $el ) { 10261 if ( SiteParameters.is_frontend_editor ) { 10262 return false;
10263 } 10264 10265 var stickyTrigger = function(){ 10266 var stickyTrick = $('.sticky-trigger').each(function(){ 10267 var $sticky = $(this), 10268 $inside = $('> div', $sticky), 10269 insideH = $inside.outerHeight(), 10270 $row = $sticky.closest('.vc_row'), 10271 $uncont = $sticky.closest('.uncont'), 10272 rowBottom, 10273 uncontBottom , 10274 diffBottom; 10275 10276 ScrollTrigger.create({ 10277 trigger: $sticky, 10278 start: function(){ return "top center-=" + insideH/2; }, 10279 endTrigger: $row, 10280 end: function(){ 10281 rowBottom = $row.offset().top + $row.outerHeight(); 10282 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 10283 diffBottom = rowBottom - uncontBottom; 10284 return "bottom center+=" + ( insideH/2 + diffBottom ); 10285 }, 10286 anticipatePin: true, 10287 pin: true, 10288 pinSpacing: false, 10289 scrub: true, 10290 invalidateOnRefresh: true, 10291 }); 10292 10293 }); 10294 }, 10295 setResizeSticky; 10296 10297 $(window).on( 'load', function(){ 10298 stickyTrigger(); 10299 }); 10300 10301 var oldW = UNCODE.wwidth; 10302 $(window).on( 'resize uncode.re-layout', function(e){ 10303 clearRequestTimeout(setResizeSticky); 10304 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 10305 return; 10306 } else { 10307 oldW = UNCODE.wwidth; 10308 } 10309 setResizeSticky = requestTimeout( function(){ 10310 stickyTrigger(); 10311 ScrollTrigger.refresh(); 10312 }, 1000 ); 10313 }); 10314 10315}; 10316 10317UNCODE.revslider = function() { 10318 var revSliderIn = function(){ 10319 $('rs-module').each(function(){ 10320 var $slider = $(this); 10321 10322 $slider.on('revolution.slide.onloaded', function(e, data){ 10323 if ( $(e.currentTarget).closest(".header-revslider").length ) { 10324 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 10325 scrolltop = $(document).scrollTop(); 10326 if ( style != undefined ) { 10327 UNCODE.switchColorsMenu(scrolltop, style); 10328 } 10329 } 10330 }); 10331 10332 $slider.on('revolution.slide.onchange', function(e, data){ 10333 if ( $(e.currentTarget).closest(".header-revslider").length ) { 10334 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 10335 scrolltop = $(document).scrollTop(); 10336 if ( style != undefined ) { 10337 UNCODE.switchColorsMenu(scrolltop, style); 10338 } 10339 } 10340 }); 10341 10342 }); 10343 }; 10344 revSliderIn(); 10345 $(window).on("load", revSliderIn ); 10346}; 10347UNCODE.layerslider = function() { 10348 $(window).on("load", function() { 10349 10350 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 10351 10352 var slideData = slider.slides.current.data, 10353 scrolltop = $(document).scrollTop(); 10354 if( slideData && slideData.skin ) { 10355 10356 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 10357 10358 } 10359 }); 10360 10361 }); 10362}; 10363 10364UNCODE.ajax_filters = function() { 10365 10366/************************* 10367 * 10368 * Filters Menu and Widgets Area 10369 * 10370 ************************/ 10371 10372 var clear_clicked = false; 10373 10374 var init_ajax_grid = function(){ 10375 10376 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 10377 $grids.each(function(index, val){ 10378 var $body = $('body'), 10379 $grid = $(val).addClass('init-ajax-grid'), 10380 starting_point = $grid.attr('data-toggle'), 10381 $trigger = $('.uncode-toggle-ajax-filters', $grid), 10382 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 10383 $isotope_wrapper = $('.isotope-wrapper', $grid), 10384 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 10385 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 10386 $footprint = $('.ajax-filter-footprint', $grid), 10387 sidebar_w, 10388 data_w = parseFloat( $sidebar.attr('data-max-width') ), 10389 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 10390 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 10391 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 10392 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 10393 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 10394 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 10395 sidew, 10396 $inside_row = $('> .row-parent', $vc_row), 10397 bg_row, 10398 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 10399 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 10400 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
10401 sidebar_overlay = false, 10402 sidebar_hover = false, 10403 switchMobile = false, 10404 scrollTop; 10405 10406 if ( $vc_row.attr('class') ) { 10407 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 10408 } 10409 10410 if ( bg_row != null ) { 10411 $side_header.add($side_footer).addClass(bg_row[0]); 10412 } 10413 10414 $trigger.add($apply_filters).on('click', function(e){ 10415 e.preventDefault(); 10416 e.stopPropagation(); 10417 $grid = $('.ajax-grid-system').eq(0); 10418 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 10419 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 10420 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10421 sidebar_w = $sidebar_wrapper.width(); 10422 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10423 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 10424 $(this).trigger('uncode-ajax-clear-filters'); 10425 } 10426 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10427 $grid.toggleClass('ajax-hide-filters-blanks'); 10428 $sidebar.slideToggle({ 10429 duration: 400, 10430 easing: 'easeOutQuad', 10431 }); 10432 } else { 10433 $grid.removeClass('ajax-hide-filters-blanks'); 10434 $grid.toggleClass('ajax-hide-filters'); 10435 if ( $grid.hasClass('ajax-hide-filters') ) { 10436 $body.addClass('ajax-hide-filters'); 10437 } else { 10438 scrollTop = $('html, body').scrollTop(); 10439 $body.removeClass('ajax-hide-filters'); 10440 } 10441 } 10442 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 10443 $('html, body').scrollTop(scrollTop); 10444 } 10445 return false; 10446 }); 10447 10448 $close_btn.on('click', function(e){ 10449 e.preventDefault(); 10450 $grid = $('.ajax-grid-system').eq(0); 10451 $grid.addClass('ajax-hide-filters'); 10452 if ( $grid.hasClass('ajax-hide-filters') ) { 10453 $body.addClass('ajax-hide-filters'); 10454 } else { 10455 scrollTop = $('html, body').scrollTop(); 10456 $body.removeClass('ajax-hide-filters'); 10457 } 10458 $('html, body').scrollTop(scrollTop); 10459 }); 10460 10461 $sidebar_wrapper.on('mouseover',function(){ 10462 sidebar_hover = true; 10463 }).on('mouseout', function(){ 10464 sidebar_hover = false; 10465 }); 10466 10467 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 10468 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 10469 return; 10470 } 10471 if (undefined !== from && from === 'select_active_attributes') { 10472 return; 10473 } 10474 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 10475 $grid.add($body).addClass('ajax-hide-filters'); 10476 } 10477 }); 10478 10479 $sorting_trgr.on('click', function(e) { 10480 e.preventDefault(); 10481 }); 10482 10483 var inside_width = function(){ 10484 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10485 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10486 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 10487 $inside_row = $('> .row-parent', $vc_row); 10488 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 10489 sidew = $sidebar.width(); 10490 $inside_row.css({ 10491 width: sidew 10492 }); 10493 } else { 10494 $inside_row.css({ 10495 width: '' 10496 }); 10497 } 10498 }; 10499 inside_width(); 10500 10501 var ajax_sidebar_position = function(e, f_editor){ 10502 $grid = $('.ajax-grid-system').eq(0); 10503 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10504 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 10505 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10506 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 10507 $inside_row = $('> .row-parent', $vc_row); 10508 scrollTop = $('html, body').scrollTop(); 10509 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 10510 $grid.add($body).addClass('ajax-hide-filters'); 10511 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 10512 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas')); 10513 sidebar_overlay = true; 10514 $body.addClass('ajax-filter-sidebar-overlay'); 10515 $sidebar_wrapper.addClass(skin); 10516 var sideHeadH = $side_header.outerHeight(), 10517 sideFooterH = $side_footer.outerHeight(); 10518 if ( data_w !== '' && data_w > 0 ) { 10519 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10520 $sidebar.css({ 10521 'max-width': data_w 10522 }); 10523 } else { 10524 $sidebar.css({ 10525 'max-width':'none' 10526 }); 10527 } 10528 } 10529 $vc_row.css({ 10530 'padding-top':sideHeadH, 10531 'padding-bottom':sideFooterH 10532 }); 10533 var sidew = $sidebar.width(); 10534 $inside_row.css({ 10535 width: sidew 10536 }); 10537 switchMobile = true; 10538 } else { 10539 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 10540 scrollTop = $('html, body').scrollTop(); 10541 $grid.add($body).removeClass('ajax-hide-filters'); 10542 } 10543 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 10544 $grid.addClass('ajax-hide-filters-blanks'); 10545 $sidebar.hide(); 10546 } 10547 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 10548 $('.ajax-sidebar-placeholder', $grid).remove();
10549 sidebar_overlay = false; 10550 $body.removeClass('ajax-filter-sidebar-overlay'); 10551 $sidebar_wrapper.removeClass(skin); 10552 if ( data_w !== '' && data_w > 0 ) { 10553 $sidebar.css({ 10554 'max-width':'none' 10555 }); 10556 } 10557 $vc_row.css({ 10558 'padding-top':0, 10559 'padding-bottom':0, 10560 }); 10561 10562 $inside_row.css({ 10563 width: '' 10564 }); 10565 10566 if ( f_editor === true ) { 10567 UNCODE.ajax_filters(); 10568 } 10569 10570 switchMobile = false; 10571 } 10572 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 10573 $('html, body').scrollTop(scrollTop); 10574 } 10575 }; 10576 10577 var sidebar_width = function(){ 10578 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10579 sidebar_w = $footprint.width(); 10580 $sidebar.css({ width: sidebar_w }); 10581 } else { 10582 $sidebar.css({ width: '' }); 10583 } 10584 }; 10585 sidebar_width(); 10586 10587 if ( SiteParameters.is_frontend_editor ) { 10588 ajax_sidebar_position(); 10589 } 10590 10591 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 10592 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 10593 ajax_sidebar_position(e); 10594 } 10595 sidebar_width(); 10596 }); 10597 10598 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 10599 ajax_sidebar_position(e, true); 10600 }); 10601 10602 $isotope_wrapper.on('transitionend', function(e){ 10603 if ( $(e.target).hasClass('isotope-wrapper') ) { 10604 window.dispatchEvent(new CustomEvent('boxResized')); 10605 } 10606 return false; 10607 }); 10608 10609 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 10610 var $grid = $('.ajax-grid-system').eq(0); 10611 $grid.addClass('ajax-hide-filters'); 10612 } 10613 10614 }); 10615 }; 10616 10617 init_ajax_grid(); 10618 $(document).on('uncode-ajax-filtered', init_ajax_grid); 10619 10620/************************* 10621 * 10622 * Hover hack 10623 * 10624 ************************/ 10625 var widget_hover_hack = function() { 10626 $('.widget, .uncode_widget').each(function(){ 10627 var $widget = $(this), 10628 class_w = $widget.attr('class'), 10629 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 10630 $footer = $widget.closest('#colophon'); 10631 10632 if ( class_w.indexOf('widget_yith') > 0 ) { 10633 return true; 10634 } 10635 10636 $lis.each(function(){ 10637 var $li = $(this), 10638 $a = $('a', $li), 10639 $label = $a.closest('label'); 10640 10641 if ( !$footer.length ) { 10642 $li.addClass('no-evts'); 10643 } 10644 10645 if ( ! $('span', $a).length ) { 10646 $li.addClass( 'li-hover' ); 10647 } 10648 10649 $('li', $li).hover(function(e){ 10650 $(e.target).parents('li').each(function(){ 10651 $(this).addClass( 'parent-li-hover' ); 10652 }); 10653 }, function (e) { 10654 $(e.target).parents('li').each(function(key, val){ 10655 if ( key === 0) { 10656 $(val).removeClass( 'parent-li-hover' ); 10657 } 10658 }); 10659 }); 10660 10661 $li.off('mouseup').on('mouseup', function (e) { 10662 if (e.which !== 3) { 10663 e.stopPropagation(); 10664 var $a = $('a', this).first(); 10665 $a[0].click(); 10666 } 10667 }); 10668 }); 10669 }); 10670 } 10671 widget_hover_hack(); 10672 $(document).on('uncode-ajax-filtered', widget_hover_hack); 10673 10674/************************* 10675 * 10676 * Init Filters 10677 * 10678 ************************/ 10679 10680 function init_filters() { 10681 $(document).on('click', '.term-filter-link', function(e) { 10682 var _this = $(this); 10683 var widget = _this.closest('.uncode_widget'); 10684 var container = get_filters_container(); 10685 10686 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10687 return true; 10688 } 10689 10690 e.preventDefault(); 10691 10692 if (widget.hasClass('widget-ajax-filters--checkbox')) { 10693 _this.parent().find('input[type="checkbox"]').trigger('click'); 10694 } else { 10695 if (_this.hasClass('term-filter-link--active')) { 10696 _this.removeClass('term-filter-link--active'); 10697 } else { 10698 _this.addClass('term-filter-link--active'); 10699 10700 if (widget.hasClass('widget-ajax-filters--single')) { 10701 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 10702 } 10703 } 10704 10705 var url = _this.attr('href'); 10706 10707 reload_items(container, url, true); 10708 } 10709 }); 10710 10711 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 10712 var _this = $(this); 10713 var widget = _this.closest('.uncode_widget'); 10714 var link = _this.closest('.term-filter').find('.term-filter-link'); 10715 var url = link.attr('href'); 10716 var container = get_filters_container(); 10717 10718 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10719 window.location = url; 10720 return; 10721 } 10722 10723 if (widget.hasClass('widget-ajax-filters--single')) { 10724 widget.find('input[type="checkbox"]').each(function() { 10725 if (_this.attr('id') !== $(this).attr('id')) { 10726 $(this).prop('checked', false); 10727 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 10728 } 10729 }); 10730 } 10731 10732 if (_this.prop('checked')) { 10733 link.addClass('term-filter-link--active'); 10734 } else { 10735 link.removeClass('term-filter-link--active'); 10736 } 10737 10738 reload_items(container, url, true); 10739 }); 10740 10741 $(document).on('change', 'select.select--term-filters', function(e) { 10742 var _this = $(this); 10743 var selected = _this.find('option:selected'); 10744 var option = $(selected); 10745 var url = option.attr('data-term-filter-url'); 10746 var container = get_filters_container(); 10747 var widget = _this.closest('.uncode_widget'); 10748 10749 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10750 window.location = url; 10751 } else { 10752 reload_items(container, url, true); 10753 } 10754 }); 10755 10756 $(document).on('click', '.filter-list__link', function(e) { 10757 if (SiteParameters.is_frontend_editor) { 10758 return false;
10759 } 10760 10761 e.preventDefault(); 10762 10763 var _this = $(this); 10764 var container = get_filters_container(); 10765 var url = _this.attr('href'); 10766 reload_items(container, url, true); 10767 }); 10768 10769 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 10770 var _this = $(this); 10771 var container = get_filters_container(); 10772 var url = _this.attr('href'); 10773 reload_items(container, url, true); 10774 }); 10775 10776 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 10777 10778 var _this = $(this); 10779 var container = get_filters_container(); 10780 var url = _this.attr('href'); 10781 10782 if ( container.length ) { 10783 e.preventDefault(); 10784 reload_items(container, url, true); 10785 } 10786 }); 10787 10788 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 10789 var _this = $(this); 10790 var container = get_filters_container(); 10791 10792 if (container.length > 0) { 10793 e.preventDefault(); 10794 10795 var min_price = $('#min_price').val(); 10796 var max_price = $('#max_price').val(); 10797 var location = window.location; 10798 var url = location.href; 10799 var page_uri = location.origin + location.pathname; 10800 var is_filtered = page_uri !== url; 10801 10802 if (is_filtered) { 10803 url = remove_parameter_from_url(url, 'min_price'); 10804 url = remove_parameter_from_url(url, 'max_price'); 10805 } 10806 10807 var concat = page_uri === url ? '?' : '&'; 10808 var params = {'min_price': min_price, 'max_price': max_price}; 10809 10810 url = url + concat + $.param(params); 10811 10812 reload_items(container, url, true); 10813 } 10814 }); 10815 10816 var search_timer; 10817 10818 $(document).on('keyup', '.term-filters-search-input', function(e) { 10819 var _this = $(this); 10820 var container = get_filters_container(); 10821 var value = _this.val(); 10822 10823 if (search_timer) { 10824 clearTimeout(search_timer); 10825 } 10826 10827 search_timer = setTimeout(function() { 10828 update_search_url(container, value); 10829 }, 500); 10830 }); 10831 } 10832 10833 function update_search_url(container, search_value) { 10834 var location = window.location; 10835 var url = location.href; 10836 var page_uri = location.origin + location.pathname; 10837 var is_filtered = page_uri !== url; 10838 var key_search = SiteParameters.ajax_filter_key_search; 10839 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 10840 10841 if (is_filtered) { 10842 url = remove_parameter_from_url(url, key_search); 10843 url = remove_parameter_from_url(url, key_unfilter); 10844 } 10845 10846 if (search_value) { 10847 var concat = page_uri === url ? '?' : '&'; 10848 var params = {}; 10849 10850 params[key_search] = search_value; 10851 params[key_unfilter] = 1; 10852 url = url + concat + $.param(params); 10853 } else { 10854 url = remove_parameter_from_url(url, key_search); 10855 } 10856 10857 reload_items(container, url, true); 10858 } 10859 10860 function remove_parameter_from_url(url, parameter) { 10861 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 10862 } 10863 10864 function get_filters_container() { 10865 var container = $('.ajax-grid-system'); 10866 10867 if (container.length == 0) { 10868 container = $('.ajax-filters'); 10869 } 10870 10871 return container; 10872 } 10873 10874 function update_widgets_state(widgets_states, container) { 10875 for (var i = widgets_states.length - 1; i >= 0; i--) { 10876 var state = widgets_states[i]; 10877 10878 if (!state.collapse) { 10879 continue; 10880 } 10881 10882 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 10883 10884 if (state.open) { 10885 new_widget.find('.widget-title').addClass('open'); 10886 if (state.css) { 10887 new_widget.find('.widget-collapse-content').attr('style', state.css); 10888 } 10889 } else { 10890 new_widget.find('.widget-title').removeClass('open'); 10891 if (state.css) { 10892 new_widget.find('.widget-collapse-content').attr('style', state.css); 10893 } 10894 } 10895 } 10896 } 10897 10898 // Reload items via AJAX 10899 function reload_items(container, url, push) { 10900 container.addClass('grid-filtering'); 10901 10902 $.ajax({ 10903 url : url, 10904 success : function(response) { 10905 if (!response) { 10906 return; 10907 } 10908 10909 $(document).trigger('uncode-ajax-pre-filtered'); 10910 10911 var container_id = container.attr('id'); 10912 var pagination = $('.row-navigation'); 10913 10914 if (container_id) { 10915 var container_to_append = $(response).find('#' + container_id); 10916 var pagination_to_append = $(response).find('.row-navigation'); 10917 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10918 10919 // Remember open/closed widgets 10920 var widgets = $('.uncode_widget'); 10921 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 10922 var widgets_states = []; 10923 10924 widgets.each(function() { 10925 var widget = $(this); 10926 var id = widget.attr('data-id'); 10927 var state = { 10928 'id': id, 10929 'collapse': false, 10930 'open': false, 10931 'css': false, 10932 }; 10933 10934 var collapse_wrapper = widget.find('.widget-collapse-content'); 10935 10936 if (collapse_wrapper.length > 0) { 10937 state.collapse = true; 10938 10939 var collapse_wrapper_css = collapse_wrapper.attr('style'); 10940 var title = widget.find('.widget-title'); 10941 10942 state.css = collapse_wrapper_css; 10943 10944 if (title.hasClass('open')) { 10945 state.open = true; 10946 } else { 10947 state.open = false;
10948 } 10949 } 10950 10951 widgets_states.push(state); 10952 }); 10953 10954 // Update widgets state 10955 if (offcanvas_sidebar_wrapper.length === 0) { 10956 update_widgets_state(widgets_states, container_to_append); 10957 } 10958 10959 // Update default sidebar state 10960 if (!container.hasClass('ajax-hide-filters')) { 10961 container_to_append.removeClass('ajax-hide-filters'); 10962 } 10963 10964 // Update horizontal sidebar 10965 if (!container.hasClass('ajax-hide-filters-blanks')) { 10966 container_to_append.removeClass('ajax-hide-filters-blanks'); 10967 } 10968 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 10969 if (horizontal_sidebar_wrapper.length > 0) { 10970 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 10971 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 10972 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 10973 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 10974 10975 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 10976 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 10977 } 10978 10979 // Append container 10980 container.replaceWith(container_to_append); 10981 10982 // Hide first thumbnail until the new srcset is loaded 10983 if (SiteParameters.dynamic_srcset_active === '1') { 10984 container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations'); 10985 } 10986 10987 // Remove loading attribute to images 10988 container_to_append.find('img').attr('loading', ''); 10989 10990 // Append pagination 10991 if (pagination.length > 0) { 10992 if (pagination_to_append.length > 0) { 10993 pagination.html(pagination_to_append.html()); 10994 } else { 10995 pagination.html(''); 10996 } 10997 } else { 10998 if (pagination_to_append.length > 0) { 10999 $('.post-wrapper').append(pagination_to_append); 11000 } 11001 } 11002 11003 // Update off canvas sidebar (mobile and overlay) 11004 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11005 11006 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 11007 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 11008 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 11009 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 11010 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 11011 11012 // Update widgets state 11013 update_widgets_state(widgets_states, sidebar_to_append); 11014 11015 // Update sidebar 11016 sidebar_container.html(sidebar_to_append.html()); 11017 } 11018 11019 if (push) { 11020 UNCODE.lastURL = url; 11021 window.history.pushState( 11022 { pageTitle: document.title }, 11023 '', 11024 url 11025 ); 11026 } 11027 11028 if (typeof UNCODE.isotopeLayout !== 'undefined') { 11029 UNCODE.isotopeLayout(); 11030 } 11031 if (typeof UNCODE.justifiedGallery !== 'undefined') { 11032 UNCODE.justifiedGallery(); 11033 } 11034 if (typeof UNCODE.cssGrid !== 'undefined') { 11035 UNCODE.cssGrid(); 11036 } 11037 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 11038 UNCODE.lightbox(); 11039 } 11040 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 11041 UNCODE.lightgallery(); 11042 } 11043 if (typeof UNCODE.carousel !== 'undefined') { 11044 UNCODE.carousel($('body')); 11045 } 11046 UNCODE.animations(); 11047 if (typeof UNCODE.filters !== 'undefined') { 11048 UNCODE.filters(); 11049 } 11050 if (typeof UNCODE.widgets !== 'undefined') { 11051 UNCODE.widgets(); 11052 } 11053 11054 if (SiteParameters.dynamic_srcset_active === '1') { 11055 UNCODE.refresh_dynamic_srcset_size(); 11056 } 11057 11058 if (typeof UNCODE.menuSmartInit !== 'undefined') { 11059 UNCODE.menuSmartInit(); 11060 } 11061 11062 if (typeof UNCODE.parallax !== 'undefined') { 11063 UNCODE.parallax(); 11064 } 11065 11066 maybe_scroll_to_top(); 11067 11068 $(document).trigger('uncode-ajax-filtered'); 11069 $(document.body).trigger('init_price_filter'); 11070 } 11071 }, 11072 error: function() {
11073 container.removeClass('grid-filtering'); 11074 11075 if (SiteParameters.enable_debug == true) { 11076 // This console log is disabled by default 11077 // So nothing is printed in a typical installation 11078 // 11079 // It can be enabled for debugging purposes setting 11080 // the 'uncode_enable_debug_on_js_scripts' filter to true 11081 console.log('There was an error retrieving the products'); 11082 } 11083 } 11084 }); 11085 } 11086 11087 // Scroll to top after filtering 11088 function maybe_scroll_to_top() { 11089 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11090 11091 if (offcanvas_sidebar_wrapper.length > 0) { 11092 return; 11093 } 11094 11095 var container = get_filters_container(); 11096 var bound = container[0].getBoundingClientRect(); 11097 11098 if (bound.y < 0) { 11099 $(window).scrollTop(container.offset().top); 11100 } 11101 } 11102 11103 // Back/forward browser buttons 11104 $(window).on("popstate.ajaxfilters", function(e) { 11105 var location = window.location; 11106 var url = location.href; 11107 var params = UNCODE.getURLParams(window.location); 11108 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 11109 11110 UNCODE.lastURL = url; 11111 11112 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 11113 return; 11114 } 11115 11116 var container = get_filters_container(); 11117 11118 reload_items(container, url, false); 11119 }); 11120 11121 // Destroy load more before to init a new one 11122 $(window).on('uncode-ajax-pre-filtered', function() { 11123 if ($.fn.infinitescroll) { 11124 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 11125 } 11126 }); 11127 11128 init_filters(); 11129}; 11130 11131UNCODE.videoThumbs = function() { 11132 var checkResize, 11133 newW = UNCODE.wwidth; 11134 var checkForVideos = function(){ 11135 11136 $(window).on('okevents.y.change', function(e, y){ 11137 var $video = $(y.target.g), 11138 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11139 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11140 restart = !$video_wrap.hasClass('play-pause'), 11141 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'), 11142 setTime; 11143 if ( newW >= UNCODE.mediaQuery ) { 11144 11145 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 11146 $video_wrap.data('hovered', true); 11147 $video_wrap.addClass('played-on'); 11148 y.target.pauseVideo(); 11149 $tmb.on('mouseenter', function(){ 11150 if ( restart ) { 11151 y.target.seekTo(0); 11152 } 11153 y.target.playVideo(); 11154 }).on('mouseleave', function(){ 11155 clearTimeout(setTime); 11156 setTime = setTimeout(function(){ 11157 y.target.pauseVideo(); 11158 }, 300); 11159 }); 11160 } 11161 11162 } else { 11163 if( $mobile_video_wrap.length ) { 11164 $video_wrap.addClass('played-on'); 11165 y.target.playVideo(); 11166 } 11167 } 11168 11169 }); 11170 11171 $(window).on('okevents.v.loaded', function(e, playerV){ 11172 var $video = $(playerV.element), 11173 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11174 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11175 restart = !$video_wrap.hasClass('play-pause'), 11176 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'), 11177 setTime; 11178 11179 if ( newW >= UNCODE.mediaQuery ) { 11180 11181 if( $video_wrap.length ) { 11182 11183 var playPromise = playerV.play(); 11184 if (playPromise !== undefined) { 11185 playPromise.then(function( value ) { 11186 playerV.pause(); 11187 }); 11188 } 11189 $video_wrap.addClass('played-on'); 11190 $tmb.on('mouseenter', function(){ 11191 if ( restart ) { 11192 playerV.setCurrentTime(0) 11193 } 11194 playerV.play(); 11195 }).on('mouseleave', function(){ 11196 clearTimeout(setTime); 11197 setTime = setTimeout(function(){ 11198 playerV.pause(); 11199 }, 300); 11200 }); 11201 } 11202 11203 } else { 11204 11205 if( $mobile_video_wrap.length ) { 11206 var playPromise = playerV.play(); 11207 if (playPromise !== undefined) { 11208 playPromise.then(function( value ) { 11209 playerV.play(); 11210 }); 11211 } 11212 $video_wrap.addClass('played-on'); 11213 } 11214 } 11215 }); 11216 11217 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 11218 var $video = $(video), 11219 $noscript = $('noscript', $video), 11220 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11221 restart = !$video_wrap.hasClass('play-pause'), 11222 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11223 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
11223: $video.closest('.t-entry-visual'), 11224 setTime, 11225 manageVideo = function(){ 11226 video.currentTime = 0; 11227 video.pause(); 11228 if ( newW >= UNCODE.mediaQuery ) { 11229 if ( $video_wrap.length ) { 11230 $video_wrap.addClass('played-on'); 11231 $tmb.on('mouseenter', function(){ 11232 if ( restart ) { 11233 video.currentTime = 0; 11234 } 11235 video.play(); 11236 }).on('mouseleave', function(){ 11237 clearTimeout(setTime); 11238 setTime = setTimeout(function(){ 11239 video.pause(); 11240 }, 300); 11241 }); 11242 } else { 11243 video.play(); 11244 } 11245 } else { 11246 if ( $mobile_video_wrap.length ) { 11247 $mobile_video_wrap.addClass('played-on'); 11248 video.play(); 11249 } 11250 } 11251 11252 }; 11253 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 11254 $noscript.each(function(key, val){ 11255 $noscript.after(val.textContent || val.innerText); 11256 $noscript.remove(); 11257 }); 11258 } 11259 11260 if (typeof MediaElement === "function") { 11261 $video.has('source[src]').mediaelementplayer({ 11262 pauseOtherPlayers: false, 11263 }); 11264 } 11265 if (video.readyState > 0) { 11266 manageVideo(); 11267 } else { 11268 $video.on("loadedmetadata", function(_event) { 11269 manageVideo(); 11270 }); 11271 }; 11272 }); 11273 11274 }; 11275 11276 checkForVideos(); 11277 11278 var checkVideoResize = function(){ 11279 clearRequestTimeout(checkResize); 11280 checkResize = requestTimeout(function(){ 11281 if ( newW !== UNCODE.wwidth ) { 11282 checkForVideos(); 11283 newW = UNCODE.wwidth; 11284 } 11285 }, 1000); 11286 }; 11287 11288 $(window).off('resize.videos', checkVideoResize) 11289 .on( 'resize.videos', checkVideoResize); 11290 11291}; 11292UNCODE.lottie = function() { 11293 if ( SiteParameters.is_frontend_editor ) { 11294 var $lottie_wraps = $('div.uncode-lottie-wrap'); 11295 $lottie_wraps.each(function(){ 11296 var $lottie_wrap = $(this), 11297 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 11298 $player_clone = $div_player.clone(), 11299 player_id = $div_player.attr('data-id'), 11300 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 11301 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 11302 if ( $('#'+player_id).length ) { 11303 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 11304 } 11305 $player_clone.attr('id', player_id); 11306 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 11307 $div_player.after($player_clone); 11308 $div_player.attr('data-init',true); 11309 } 11310 }); 11311 } 11312 var $players = $('.uncode-lottie-wrap lottie-player'); 11313 $players.each(function(){ 11314 var player = this, 11315 this_id = $(player).attr('id'), 11316 _player = document.getElementById(this_id), 11317 trigger = $(player).attr('data-trigger'), 11318 pFrames = $(player).attr('data-frames').split(','), 11319 srcPlayer = $(player).attr('src'); 11320 11321 _player.load(srcPlayer); 11322 11323 _player.addEventListener("ready", function() { 11324 11325 var $_shadow = _player.shadowRoot; 11326 $($_shadow).find('.error').remove(); 11327 11328 var tFrames = _player.getLottie().totalFrames / 100, 11329 pFrame_from = Math.round(tFrames * pFrames[0]), 11330 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 11331 loop = $(player).attr('loop'), 11332 mode, 11333 actions; 11334 11335 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 11336 if ( trigger === 'scroll' ) { 11337 mode = 'scroll'; 11338 actions = [ 11339 { 11340 visibility:[0, 1.0], 11341 type: "seek", 11342 frames: [pFrame_from, pFrame_to], 11343 } 11344 ]; 11345 } else if ( trigger === 'viewport') { 11346 mode = 'scroll'; 11347 actions = [ 11348 { 11349 visibility: [0.20, 1.0],
11350 frames: [pFrame_from, pFrame_to], 11351 type: loop ? "loop" : "play" 11352 } 11353 ]; 11354 } else if ( trigger === 'hover') { 11355 $(player).on('mouseenter', function(){ 11356 _player.play(); 11357 }).on('mouseleave', function(){ 11358 _player.pause(); 11359 }); 11360 if ( pFrame_from > 0 && pFrame_from < 99 ) { 11361 _player.seek(pFrame_from); 11362 _player.addEventListener("frame", function(){ 11363 if ( _player.getLottie().currentFrame >= pFrame_to ) { 11364 _player.seek(pFrame_from); 11365 } 11366 }); 11367 } 11368 } 11369 LottieInteractivity.create({ 11370 player: '#' + this_id, 11371 mode: mode, 11372 actions: actions 11373 }); 11374 } else { 11375 if ( pFrame_from > 0 && pFrame_from < 99 ) { 11376 _player.seek(pFrame_from); 11377 _player.addEventListener("frame", function(){ 11378 if ( _player.getLottie().currentFrame >= pFrame_to ) { 11379 _player.seek(pFrame_from); 11380 } 11381 }); 11382 } 11383 } 11384 }); 11385 11386 $(window).on('unlottie-destroy', function(){ 11387 _player.destroy(); 11388 }); 11389 }); 11390}; 11391 11392 UNCODE.init = function() { 11393 var wfl_check = false, wfl_request, waypoint_request; 11394 UNCODE.preventDoubleTransition(); 11395 UNCODE.betterResize(); 11396 UNCODE.utils(); 11397 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 11398 UNCODE.changeSkinOnScroll(); 11399 } 11400 if (typeof UNCODE.share !== 'undefined') { 11401 UNCODE.share(); 11402 } 11403 if (typeof UNCODE.tooltip !== 'undefined') { 11404 UNCODE.tooltip(); 11405 } 11406 if (typeof UNCODE.counters !== 'undefined') { 11407 UNCODE.counters(); 11408 } 11409 if (typeof UNCODE.countdowns !== 'undefined') { 11410 UNCODE.countdowns(); 11411 } 11412 if (typeof UNCODE.tabs !== 'undefined') { 11413 UNCODE.tabs(); 11414 } 11415 if (typeof UNCODE.collapse !== 'undefined') { 11416 UNCODE.collapse(); 11417 } 11418 if (typeof UNCODE.bigText !== 'undefined') { 11419 UNCODE.bigText(); 11420 } 11421 UNCODE.menuSystem(); 11422 if (typeof UNCODE.bgChanger !== 'undefined') { 11423 UNCODE.bgChanger(); 11424 } 11425 if (typeof UNCODE.magicCursor !== 'undefined') { 11426 UNCODE.magicCursor(); 11427 } 11428 if (typeof UNCODE.magneticCursor !== 'undefined') { 11429 UNCODE.magneticCursor(); 11430 } 11431 if (typeof UNCODE.dropImage !== 'undefined') { 11432 UNCODE.dropImage(); 11433 } 11434 if (typeof UNCODE.postTable !== 'undefined') { 11435 UNCODE.postTable(); 11436 } 11437 if (typeof UNCODE.rotatingTxt !== 'undefined') { 11438 UNCODE.rotatingTxt(); 11439 } 11440 if (typeof UNCODE.okvideo !== 'undefined') { 11441 UNCODE.okvideo(); 11442 } 11443 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 11444 UNCODE.backgroundSelfVideos(); 11445 } 11446 UNCODE.tapHover(); 11447 if (typeof UNCODE.isotopeLayout !== 'undefined') { 11448 UNCODE.isotopeLayout(); 11449 } 11450 if (typeof UNCODE.justifiedGallery !== 'undefined') { 11451 UNCODE.justifiedGallery(); 11452 } 11453 if (typeof UNCODE.cssGrid !== 'undefined') { 11454 UNCODE.cssGrid(); 11455 } 11456 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 11457 UNCODE.lightbox(); 11458 } 11459 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 11460 $(window).on('load',function(){ 11461 UNCODE.lightgallery(); 11462 }); 11463 } 11464 if (typeof UNCODE.carousel !== 'undefined') { 11465 UNCODE.carousel($('body')); 11466 } 11467 if (typeof UNCODE.lettering !== 'undefined') { 11468 UNCODE.lettering(); 11469 } 11470 UNCODE.animations(); 11471 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 11472 UNCODE.stickyElements(); 11473 } 11474 if (typeof UNCODE.twentytwenty !== 'undefined') { 11475 UNCODE.twentytwenty(); 11476 } 11477 UNCODE.disableHoverScroll(); 11478 UNCODE.printScreen(); 11479 if (typeof UNCODE.particles !== 'undefined') { 11480 UNCODE.particles(); 11481 } 11482 if (typeof UNCODE.filters !== 'undefined') { 11483 UNCODE.filters(); 11484 } 11485 if (typeof UNCODE.ajax_filters !== 'undefined') { 11486 UNCODE.ajax_filters(); 11487 } 11488 if (typeof UNCODE.widgets !== 'undefined') { 11489 UNCODE.widgets(); 11490 } 11491 if (typeof UNCODE.unmodal !== 'undefined') { 11492 UNCODE.unmodal(); 11493 } 11494 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 11495 if ( !UNCODE.isFullPage ) { 11496 UNCODE.checkScrollForTabs(); 11497 } 11498 } 11499 if (typeof UNCODE.onePage !== 'undefined') { 11500 UNCODE.onePage(UNCODE.isMobile); 11501 } 11502 if (typeof UNCODE.fullPage !== 'undefined') { 11503 $(document).ready(function(){ 11504 UNCODE.fullPage(); 11505 }); 11506 } 11507 if (typeof UNCODE.skewIt !== 'undefined') { 11508 UNCODE.skewIt(); 11509 } 11510 if (typeof UNCODE.rotateIt !== 'undefined') { 11511 UNCODE.rotateIt(); 11512 } 11513 if (typeof UNCODE.textMarquee !== 'undefined') { 11514 UNCODE.textMarquee(); 11515 } 11516 if (typeof UNCODE.stickyScroll !== 'undefined') { 11517 UNCODE.stickyScroll(); 11518 } 11519 if (typeof UNCODE.stickyTrigger !== 'undefined') { 11520 UNCODE.stickyTrigger(); 11521 } 11522 if (typeof UNCODE.verticalText !== 'undefined') { 11523 UNCODE.verticalText(); 11524 } 11525 if (typeof UNCODE.videoThumbs !== 'undefined') { 11526 UNCODE.videoThumbs(); 11527 } 11528 if (typeof UNCODE.revslider !== 'undefined') { 11529 UNCODE.revslider(); 11530 } 11531 if (typeof UNCODE.layerslider !== 'undefined') { 11532 UNCODE.layerslider(); 11533 } 11534 if (typeof UNCODE.lottie !== 'undefined') { 11535 UNCODE.lottie(); 11536 } 11537 $(window).on('load',function(){ 11538 clearRequestTimeout(waypoint_request);
11539 waypoint_request = requestTimeout( function(){ 11540 Waypoint.refreshAll(); 11541 }, 1000); 11542 11543 if (typeof UNCODE.parallax !== 'undefined') { 11544 UNCODE.parallax(); 11545 } 11546 }); 11547 } 11548 11549 if ( ! SiteParameters.is_frontend_editor ) { 11550 UNCODE.init(); 11551 } 11552 11553 11554})(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.