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 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { 767 e.preventDefault() 768 $(this).tab('show'); 769 requestTimeout(function() { 770 window.dispatchEvent(UNCODE.boxEvent); 771 $(window).trigger('uncode.re-layout'); 772 }, 300); 773 }); 774}; 775 776UNCODE.collapse = function() { 777 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 778 var $this = $(this), 779 href 780 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 781 var $target = $(target) 782 var data = $target.data('bs.collapse') 783 var option = data ? 'toggle' : $this.data() 784 var parent = $this.attr('data-parent') 785 var $parent = parent && $(parent) 786 var $title = $(this).parent() 787 if ($parent) { 788 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 789 if ($title.hasClass('active')) { 790 $title.removeClass('active'); 791 } else { 792 $parent.find('.panel-title').removeClass('active') 793 $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') 794 } 795 } 796 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 797 requestTimeout(function() { 798 $(window).trigger('uncode.re-layout'); 799 }, 500); 800 }); 801}; 802 803UNCODE.bigText = function(el) { 804 if (el == undefined) { 805 el = $('body'); 806 } 807 $.each($('.bigtext', el), function(index, val) { 808 $(val).bigtext({ 809 minfontsize: 24 810 }); 811 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 812 opacity: 1 813 }); 814 requestTimeout(function() { 815 if ($(val).find('.animate_when_almost_visible').length != 0) { 816 $(val).css({opacity: 1}); 817 } 818 }, 400); 819 }); 820}; 821 822UNCODE.process_shortpixel_image = function(image) { 823 var data = { 824 action: 'shortpixel_manual_optimization', 825 image_id: image, 826 cleanup: true 827 }; 828 829 $.get(SiteParameters.ajax_url, data); 830}; 831 832UNCODE.menuSystem = function() { 833 834 function menuMobile() { 835 var $body = $('body'), 836 $mobileToggleButton = $('.mobile-menu-button'), 837 $masthead = $('#masthead'), 838 $box, 839 $el, 840 $el_transp, 841 elHeight, 842 check, 843 animating = false, 844 stickyMobile = false, 845 menuClose = new CustomEvent('menuMobileClose'), 846 menuOpen = new CustomEvent('menuMobileOpen'); 847 UNCODE.menuOpened = false; 848 $mobileToggleButton.on('click', function(event) { 849 var btn = this; 850 if ($(btn).hasClass('overlay-close')) return; 851 event.preventDefault(); 852 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 853 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 854 $box = $(this).closest('.box-container').find('.main-menu-container'); 855 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 856 $el_transp = $('.menu-absolute.menu-transparent'); 857 if (UNCODE.isMobile) { 858 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 ) { 859 stickyMobile = true; 860 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 861 } else { 862 elHeight = 0; 863 $.each($box.find('> div'), function(index, val) { 864 elHeight += $(val).outerHeight(); 865 }); 866 } 867 } else { 868 elHeight = 0; 869 $.each($el, function(index, val) { 870 elHeight += $(val).outerHeight(); 871 }); 872 } 873 var open = function() { 874 if (!animating) { 875 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 876 window.dispatchEvent(menuOpen); 877 animating = true; 878 UNCODE.menuOpened = true; 879 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 880 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 881 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 882 } 883 if ($('body.menu-offcanvas').length) { 884 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 885 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight +
885UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 886 } else { 887 if ( $('.menu-hide, .menu-sticky').length ) { 888 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 889 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 890 } 891 } 892 } 893 } 894 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-hide, .menu-sticky-mobile').length) )) { 895 $("#masthead")[0].scrollIntoView(); 896 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 897 } 898 btn.classList.add('close'); 899 $box.addClass('open-items'); 900 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 901 $el_transp.addClass('is_mobile_open'); 902 } 903 $box.animate({ 904 height: elHeight 905 }, 600, "easeInOutCirc", function() { 906 animating = false; 907 if (!stickyMobile) $box.css('height', 'auto'); 908 }); 909 } 910 }; 911 912 var close = function() { 913 if (!animating) { 914 window.dispatchEvent(menuClose); 915 animating = true; 916 UNCODE.menuOpened = false; 917 btn.classList.remove('close'); 918 btn.classList.add('closing'); 919 $box.addClass('close'); 920 requestTimeout(function() { 921 $box.removeClass('close'); 922 $box.removeClass('open-items'); 923 btn.classList.remove('closing'); 924 if ($el_transp.length) { 925 $el_transp.removeClass('is_mobile_open'); 926 } 927 }, 500); 928 $body.removeClass('opening-overlay-menu'); 929 $box.animate({ 930 height: 0 931 }, { 932 duration: 600, 933 easing: "easeInOutCirc", 934 complete: function(elements) { 935 $(elements).css('height', ''); 936 animating = false; 937 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 938 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 939 } 940 $body.removeClass('open-overlay-menu'); 941 } 942 }); 943 } 944 }; 945 check = (!UNCODE.menuOpened) ? open() : close(); 946 } 947 }); 948 window.addEventListener('menuMobileTrigged', function(e) { 949 $('.mobile-menu-button.close').trigger('click'); 950 }); 951 window.addEventListener('orientationchange', function(e) { 952 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 953 }); 954 window.addEventListener("resize", function() { 955 if ($(window).width() < UNCODE.mediaQuery) { 956 if (UNCODE.isMobile) { 957 var $box = $('.box-container .main-menu-container'), 958 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 959 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') { 960 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 961 elHeight = 0; 962 $.each($el, function(index, val) { 963 elHeight += $(val).outerHeight(); 964 }); 965 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; 966 $($box).css('height', elHeight + 'px'); 967 } 968 } 969 } 970 } else { 971 $('.menu-hide-vertical').removeAttr('style'); 972 $('.menu-container-mobile').removeAttr('style'); 973 $('.vmenu-container.menu-container').removeAttr('style'); 974 } 975 }); 976 }; 977 978 function menuOffCanvas() { 979 var menuClose = new CustomEvent('menuCanvasClose'), 980 menuOpen = new CustomEvent('menuCanvasOpen'); 981 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').click(function(event) { 982 if ($(window).width() > UNCODE.mediaQuery) { 983 if ($(event.currentTarget).hasClass('close')) { 984 $(event.currentTarget).removeClass('close'); 985 $(event.currentTarget).addClass('closing'); 986 requestTimeout(function() { 987 $(event.currentTarget).removeClass('closing'); 988 window.dispatchEvent(menuClose); 989 }, 500); 990 991 } else { 992 $(event.currentTarget).addClass('close'); 993 window.dispatchEvent(menuOpen); 994 } 995 } 996 997 $('body').toggleClass('off-opened'); 998 }); 999 }; 1000 1001 function menuOverlay() { 1002 if ( $('.overlay').length ) { 1003 $('.overlay').removeClass('hidden'); 1004 } 1005 if ($('.overlay-sequential, .menu-mobile-animated').length > 0) { 1006 $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) { 1007 var transDelay = (index / 20) + 0.1; 1008 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1009 transDelay = transDelay + 0.3; 1010 $(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'); 1011 }); 1012 } 1013 }; 1014 function menuAppend() { 1015 var $body = $('body'), 1016 $menuCont = $('.menu-container'), 1017 $cta = $('.navbar-cta'), 1018 $socials = $('.navbar-social'), 1019 $ul = $('.navbar-main ul.menu-primary-inner'), 1020 $ulCta, 1021 $ulSocials, 1022 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1023 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1024 $firstNav = $('.navbar-nav:first-child', $firstMenu), 1025 $secondNav = $('.navbar-nav:first-child', $secondMenu), 1026 $ulFirst = $('> ul', $firstNav), 1027 $ulSecond = $('> ul', $secondNav), 1028 setCTA, 1029 appendCTA = function(){ 1030 return true; 1031 }, 1032 appendSocials = function(){ 1033 return true; 1034 }, 1035 appendSplit = function(){ 1036 return true; 1037 }; 1038 1039 if ( $body.hasClass('cta-not-appended') ) 1040 return false;
1041 1042 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1043 $ulCta = $('> ul', $cta); 1044 1045 appendCTA = function(){ 1046 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1047 $ul.after($ulCta); 1048 } else { 1049 $cta.append($ulCta); 1050 } 1051 } 1052 } 1053 appendCTA(); 1054 1055 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) { 1056 $ulSocials = $('> ul', $socials); 1057 1058 appendSocials = function(){ 1059 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1060 $ul.after($ulSocials); 1061 } else { 1062 $socials.append($ulSocials); 1063 } 1064 } 1065 } 1066 appendSocials(); 1067 1068 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1069 appendSplit = function(){ 1070 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1071 if ( $secondNav.length ) { 1072 $secondNav.prepend($ulFirst); 1073 } 1074 $firstMenu.hide(); 1075 } else { 1076 $firstNav.append($ulFirst); 1077 $firstMenu.css({ 1078 'display': 'table-cell' 1079 }); 1080 } 1081 } 1082 } 1083 appendSplit(); 1084 1085 $(window).on( 'resize', function(){ 1086 clearRequestTimeout(setCTA); 1087 setCTA = requestTimeout( function() { 1088 appendCTA(); 1089 appendSocials(); 1090 appendSplit(); 1091 }, 10 ); 1092 }); 1093 } 1094 //menuMobileButton(); 1095 menuMobile(); 1096 menuOffCanvas(); 1097 UNCODE.menuSmartInit(); 1098 menuAppend(); 1099 menuOverlay(); 1100 var setMenuOverlay; 1101 $(window).on( 'resize', function(){ 1102 if ( $('.overlay').length && $(window).width() > 1024 ) { 1103 $('.overlay').addClass('hidden'); 1104 } 1105 clearRequestTimeout(setMenuOverlay); 1106 setMenuOverlay = requestTimeout( menuOverlay, 150 ); 1107 }); 1108}; 1109 1110UNCODE.menuSmartInit = function() { 1111 var $menusmart = $('[class*="menu-smart"]'), 1112 $masthead = $('#masthead'), 1113 $hMenu = $('.menu-horizontal-inner', $masthead), 1114 $focus = $('.overlay-menu-focus'), 1115 showTimeout = 50, 1116 hideTimeout = 50, 1117 showTimeoutFunc, hideTimeoutFunc; 1118 1119 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1120 $(this).data('hover', true); 1121 }, function(){ 1122 $(this).data('hover', false); 1123 }); 1124 1125 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1126 var $notLis = $('> .nav > ul > li a', $hMenu), 1127 $menuA = $('a', $masthead).not($notLis), 1128 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1129 showFuncCond = function() { return true }; 1130 1131 if ( $('body').hasClass('focus-megamenu') ) { 1132 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1133 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1134 } else if ( $('body').hasClass('focus-links') ) { 1135 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1136 } 1137 1138 $hoverSelector.hover(function(){ 1139 clearRequestTimeout(hideTimeoutFunc); 1140 showTimeoutFunc = requestTimeout(function(){ 1141 $('body').addClass('navbar-hover'); 1142 }, showTimeout*2); 1143 }, function(){ 1144 hideTimeoutFunc = requestTimeout(function(){ 1145 if ( ! $('.overlay-search.open', $masthead).length ) { 1146 $('body').removeClass('navbar-hover'); 1147 } 1148 }, hideTimeout*2); 1149 }); 1150 } else { 1151 showFuncCond = function() { return false }; 1152 } 1153 1154 if ($menusmart.length > 0) { 1155 $menusmart.smartmenus({ 1156 subIndicators: false, 1157 subIndicatorsPos: 'append', 1158 //subMenusMinWidth: '13em', 1159 subIndicatorsText: '', 1160 showTimeout: showTimeout, 1161 hideTimeout: hideTimeout, 1162 showFunction: function($ul, complete) { 1163 clearRequestTimeout(showTimeoutFunc); 1164 $ul.fadeIn(0, 'linear', function(){ 1165 complete(); 1166 if ( $ul.hasClass('vc_row') ) { 1167 $ul.css({ 1168 'display': 'table' 1169 }); 1170 } 1171 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1172 $('body').addClass('open-megamenu'); 1173 } 1174 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1175 $('body').addClass('navbar-hover'); 1176 } 1177 }).addClass('open-animated'); 1178 }, 1179 hideFunction: function($ul, complete) { 1180 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 1181 $('body').removeClass('open-megamenu'); 1182 } 1183 var fixIE = $('html.ie').length; 1184 if (fixIE) { 1185 var $rowParent = $($ul).closest('.main-menu-container'); 1186 $rowParent.height('auto'); 1187 } 1188 $ul.fadeOut(0, 'linear', function(){ 1189 complete(); 1190 $ul.removeClass('open-animated'); 1191 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 1192 $('body').removeClass('open-submenu'); 1193 } 1194 }); 1195 },
1196 collapsibleShowFunction: function($ul, complete) { 1197 $ul.slideDown(400, 'easeInOutCirc', complete); 1198 }, 1199 collapsibleHideFunction: function($ul, complete) { 1200 $ul.slideUp(200, 'easeInOutCirc', complete); 1201 }, 1202 hideOnClick: true 1203 }); 1204 1205 if ( $('body').hasClass('menu-accordion-active') ) { 1206 requestTimeout(function(){ 1207 $menusmart.addClass('menu-smart-init'); 1208 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 1209 }, 1000); 1210 } 1211 } 1212} 1213 1214UNCODE.okvideo = function() { 1215 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1216 $.okvideo = function(options) { 1217 // if the option var was just a string, turn it into an object 1218 if (typeof options !== 'object') options = { 1219 'video': options 1220 }; 1221 var base = this; 1222 // kick things off 1223 base.init = function() { 1224 base.options = $.extend({}, $.okvideo.options, options); 1225 // support older versions of okvideo 1226 if (base.options.video === null) base.options.video = base.options.source; 1227 base.setOptions(); 1228 var target = base.options.target || $('body'); 1229 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1230 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1231 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1232 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>'; 1233 if (OKEvents.utils.isMobile()) { 1234 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>'); 1235 } else { 1236 if (base.options.controls === 3) { 1237 target.append(mask) 1238 } 1239 if (base.options.adproof === 1) { 1240 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>'); 1241 } else { 1242 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>'); 1243 } 1244 } 1245 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1246 if (base.options.playlist.list === null) { 1247 if (base.options.video.provider === 'youtube') { 1248 base.loadYouTubeAPI(); 1249 } else if (base.options.video.provider === 'vimeo') { 1250 base.options.volume /= 100; 1251 base.loadVimeoAPI(); 1252 } 1253 } else { 1254 base.loadYouTubeAPI(); 1255 } 1256 } 1257 }; 1258 // clean the options 1259 base.setOptions = function() { 1260 // exchange 'true' for '1' and 'false' for 3 1261 for (var key in this.options) { 1262 if (this.options[key] === true) this.options[key] = 1; 1263 if (this.options[key] === false) this.options[key] = 3; 1264 } 1265 if (base.options.playlist.list === null) { 1266 base.options.video = base.determineProvider(); 1267 } 1268 // pass options to the window 1269 $(window).data('okoptions-' + base.options.id, base.options); 1270 }; 1271 // insert js into the head and exectue a callback function 1272 base.insertJS = function(src, callback){ 1273 var tag; 1274 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1275 tag = UNCODE.insertedSripts[src]; 1276 if (callback){ 1277 if (tag.readyState){ //IE 1278 tag.onreadystatechange = function(){ 1279 if (tag.readyState === "loaded" || 1280 tag.readyState === "complete"){ 1281 tag.onreadystatechange = null; 1282 callback(); 1283 } 1284 }; 1285 } else { 1286 $(tag).on('load', callback); 1287 } 1288 } 1289 return; 1290 } 1291 tag = document.createElement('script'); 1292 if (callback){ 1293 if (tag.readyState){ //IE 1294 tag.onreadystatechange = function(){ 1295 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1296 tag.onreadystatechange = null; 1297 callback(); 1298 } 1299 }; 1300 } else { 1301 tag.onload = function() { 1302 callback(); 1303 }; 1304 } 1305 } 1306 tag.src = src; 1307 var firstScriptTag = document.getElementsByTagName('script')[0]; 1308 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1309 if ( ! UNCODE.insertedSripts ) { 1310 UNCODE.insertedSripts = []; 1311 } 1312 UNCODE.insertedSripts[src] = tag; 1313 }; 1314 // load the youtube api 1315 base.loadYouTubeAPI = function(callback) { 1316 base.insertJS('https://www.youtube.com/player_api'); 1317 }; 1318 base.loadYouTubePlaylist = function() { 1319 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1320 }; 1321 // load the vimeo api by replacing the div with an iframe and loading js 1322 base.loadVimeoAPI = function() { 1323 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, 1324 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen>'); 1325 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1326 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1327 base.insertJS('//player.vimeo.com/api/player.js', function() { 1328 vimeoPlayerReady(base.options.id); 1329 }); 1330 }; 1331 // is it from youtube or vimeo? 1332 base.determineProvider = function() { 1333 var a = document.createElement('a'); 1334 a.href = base.options.video; 1335 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1336 var videoid = a.href.split('/')[3].toString(); 1337 var query = videoid.substring(videoid.indexOf('?') + 1); 1338 if (query != '') { 1339 var vars = query.split('&'); 1340 for (var i = 0; i < vars.length; i++) { 1341 var pair = vars[i].split('='); 1342 if (pair[0] == 'v') { 1343 videoid = pair[1]; 1344 } 1345 } 1346 } 1347 return { 1348 "provider": "youtube", 1349 "id": videoid 1350 }; 1351 } else if (/vimeo.com/.test(base.options.video)) { 1352 return { 1353 "provider": "vimeo", 1354 "id": (a.href.split('/')[3].toString()).split('#')[0], 1355 }; 1356 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1357 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1358 if (id.length == 11) { 1359 return { 1360 "provider": "youtube", 1361 "id": id.toString() 1362 }; 1363 } else { 1364 for (var i = 0; i < base.options.video.length; i++) { 1365 if (typeof parseInt(base.options.video[i]) !== "number") { 1366 throw 'not vimeo but thought it was for a sec'; 1367 } 1368 } 1369 return { 1370 "provider": "vimeo", 1371 "id": base.options.video 1372 }; 1373 } 1374 } else { 1375 throw "OKVideo: Invalid video source"; 1376 } 1377 }; 1378 base.init(); 1379 }; 1380 $.okvideo.options = { 1381 id: null, 1382 source: null, // Deprecate dis l8r 1383 video: null, 1384 playlist: { // eat ur heart out @brokyo 1385 list: null, 1386 index: 0, 1387 startSeconds: 0, 1388 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 1389 }, 1390 disableKeyControl: 1, 1391 captions: 0, 1392 loop: 1, 1393 hd: 1, 1394 volume: 0, 1395 adproof: false, 1396 unstarted: null, 1397 onFinished: null, 1398 onReady: null, 1399 onPlay: null, 1400 onPause: null, 1401 buffering: null, 1402 controls: false, 1403 autoplay: true, 1404 annotations: true, 1405 cued: null 1406 }; 1407 $.fn.okvideo = function(options) { 1408 options.target = this; 1409 return this.each(function() { 1410 (new $.okvideo(options)); 1411 }); 1412 }; 1413 1414 $(".no-touch .uncode-video-container.video").each(function(index, el) { 1415 var $this = $(this), 1416 url = $this.attr('data-video'), 1417 id = $this.attr('data-id'), 1418 cloned = $this.closest('.owl-item'); 1419 if (!cloned.hasClass('cloned') || cloned.length == 0) { 1420 $this.okvideo({ 1421 id: id, 1422 source: url.split('#')[0], 1423 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 1424 autoplay: 1, 1425 controls: 0, 1426 volume: 0, 1427 adproof: 0, 1428 caller: $this, 1429 hd: 1, 1430 onReady: function(player) { 1431 var getPlayer = player.g || player, 1432 $iframe = $(getPlayer), 1433 $drop = $iframe.closest('.drop-move'), 1434 getContainer = $iframe.closest('.background-element'); 1435 if (getContainer.length) { 1436 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 1437 } 1438 1439 if ( $drop.length ) { 1440 1441 var w = parseFloat($drop.attr('data-width')), 1442 h = parseFloat($drop.attr('data-height')), 1443 ratio = h / w, 1444 setResizeiFto, 1445 resizeiFrame = function(){ 1446 var dataW = $this.attr('data-w'), 1447 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1448 newH = parseFloat(newW) * parseFloat(ratio); 1449 $iframe.css({ 1450 width: newW, 1451 height: newH 1452 }); 1453 }; 1454 resizeiFrame(); 1455 $(window).on( 'load', resizeiFrame ); 1456 $(window).on( 'resize', function(){ 1457 clearRequestTimeout(setResizeiFto); 1458 setResizeiFto = requestTimeout( function() { 1459 resizeiFrame(); 1460 }, 10 ); 1461 }); 1462 1463 } 1464 1465 } 1466 }); 1467 } 1468 }); 1469 1470 $(window).on('load', function(){ 1471 $('.mejs-fullscreen-button button').on('click', function(){ 1472 var $button = $(this), 1473 $stuck = $button.closest('.is_stucked'); 1474 1475 if ( $stuck.length ) { 1476 $stuck = $(this).trigger("sticky_kit:detach"); 1477 window.scrollTo(0, 0); 1478 } 1479 }); 1480 }); 1481}; 1482 1483UNCODE.backgroundSelfVideos = function( $ctx ) { 1484 1485 if ( typeof $ctx === 'undefined' ) { 1486 $ctx = $('body'); 1487 } 1488 1489 var backgroundSelfVideosInit = function( $ctx ) { 1490 $(".background-video-shortcode", $ctx).each(function(index, el) { 1491 if ( SiteParameters.block_mobile_videos === true ) { 1492 return false;
1493 } 1494 if ( $(this).closest('mediaelementwrapper').length ) { 1495 return true; 1496 } 1497 var $video_el = $(this), 1498 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 1499 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 1500 video_id = $video_el.attr('id'); 1501 1502 if ( SiteParameters.is_frontend_editor ) { 1503 video_id = video_id + '_' + index; 1504 $video_el.attr('id', video_id); 1505 } 1506 1507 if (typeof MediaElement === "function") { 1508 var media = new MediaElement(video_id, { 1509 startVolume: 0, 1510 loop: true, 1511 success: function(mediaElement, domObject) { 1512 domObject.volume = 0; 1513 $(mediaElement).data('started', false); 1514 mediaElement.addEventListener('timeupdate', function(e) { 1515 if (!$(e.target).data('started')) { 1516 $(mediaElement).data('started', true); 1517 } 1518 }); 1519 mediaElement.addEventListener('loadedmetadata', function(e) { 1520 mediaElement.play(); 1521 }); 1522 if (!UNCODE.isMobile) { 1523 requestTimeout(function() { 1524 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 1525 }, 100); 1526 } 1527 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 1528 mediaElement.play(); 1529 } 1530 1531 if ( $parent_drop_move.length ) { 1532 var setResizeMEto, 1533 resizeMediaElement = function(){ 1534 var dataW = $parent_drop_move.attr('data-w'), 1535 videoW = domObject.width, 1536 videoH = domObject.height, 1537 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1538 newH = newW / ( videoW / videoH ); 1539 1540 $(domObject).css({ 1541 'height': newH, 1542 'width': newW 1543 }); 1544 }; 1545 $(window).on( 'resize load', function(){ 1546 clearRequestTimeout(setResizeMEto); 1547 setResizeMEto = requestTimeout( function() { 1548 resizeMediaElement(); 1549 }, 10 ); 1550 }); 1551 } 1552 1553 mediaElement.addEventListener('play', function() { 1554 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 1555 $(mediaElement).closest('#page-header').addClass('video-started'); 1556 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1557 }, true); 1558 1559 }, 1560 // fires when a problem is detected 1561 error: function() {} 1562 }); 1563 1564 } else { 1565 $video_el[0].play(); 1566 $video_el[0].addEventListener('play', function() { 1567 $video_el[0].muted = true; 1568 $video_el[0].loop = true; 1569 $video_el.closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 1570 $video_el.closest('#page-header').addClass('video-started'); 1571 $video_el.closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1572 }, false); 1573 } 1574 }); 1575 }; 1576 1577 backgroundSelfVideosInit( $ctx ); 1578 1579 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 1580 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 1581 var $el = model.view.$el, 1582 shortcode = model.attributes.shortcode; 1583 1584 backgroundSelfVideosInit( $el ); 1585 }); 1586 } 1587}; 1588 1589UNCODE.is_scrolling = false; 1590 1591UNCODE.disableHoverScroll = function() { 1592 1593 if (!UNCODE.isMobile && !UNCODE.isFullPage) { 1594 var body = document.body, 1595 timer; 1596 1597 window.addEventListener('scroll', function() { 1598 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 1599 clearRequestTimeout(timer); 1600 if ( body.classList && !body.classList.contains('disable-hover') ) { 1601 body.classList.add('disable-hover'); 1602 window.dispatchEvent(new CustomEvent('disable-hover')); 1603 } 1604 UNCODE.is_scrolling = true; 1605 1606 timer = requestTimeout(function() { 1607 if ( body.classList ) { 1608 body.classList.remove('disable-hover'); 1609 window.dispatchEvent(new CustomEvent('enable-hover')); 1610 } 1611 UNCODE.is_scrolling = false; 1612 }, delay); 1613 }, false); 1614 } 1615}; 1616 1617UNCODE.isotopeLayout = function() { 1618 if ($('.isotope-layout').length > 0) { 1619 var isotopeContainersArray = [], 1620 typeGridArray = [], 1621 layoutGridArray = [], 1622 screenLgArray = [], 1623 screenMdArray = [], 1624 screenSmArray = [], 1625 transitionDuration = [], 1626 $filterItems = [], 1627 $filters = $('.isotope-system .isotope-filters'), 1628 $itemSelector = '.tmb-iso', 1629 $items, 1630 itemMargin, 1631 correctionFactor = 0, 1632 firstLoad = true, 1633 isOriginLeft = $('body').hasClass('rtl') ? false : true; 1634 $('[class*="isotope-container"]').each(function(index) { 1635 var _this = $(this); 1636 var isoData = _this.data(), 1637 $data_lg, 1638 $data_md, 1639 $data_sm; 1640 _this.children('.tmb').addClass('tmb-iso'); 1641 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 1642 else $data_lg = '1000'; 1643 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 1644 else $data_md = '600'; 1645 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 1646 else $data_sm = '480'; 1647 screenLgArray.push($data_lg); 1648 screenMdArray.push($data_md); 1649 screenSmArray.push($data_sm); 1650 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 1651 if (isoData.type == 'metro') typeGridArray.push(true);
1652 else typeGridArray.push(false); 1653 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 1654 else layoutGridArray.push('masonry'); 1655 isotopeContainersArray.push(_this); 1656 _this.attr('data-iso-index', index); 1657 }); 1658 var colWidth = function(index) { 1659 $(isotopeContainersArray[index]).width(''); 1660 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 1661 widthAvailable = $(isotopeContainersArray[index]).width(), 1662 columnNum = 12, 1663 columnWidth = 0, 1664 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 1665 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 1666 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 1667 $rowContainer, 1668 paddingRow, 1669 $colContainer, 1670 paddingCol; 1671 1672 if ( consider_menu ) 1673 winHeight = winHeight - UNCODE.menuHeight; 1674 1675 if ( data_vp_height === '1' ) { 1676 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 1677 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 1678 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 1679 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 1680 winHeight = winHeight - ( paddingRow + paddingCol ); 1681 } 1682 1683 if (isPx) { 1684 columnWidth = Math.ceil(widthAvailable / columnNum); 1685 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 1686 } else { 1687 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 1688 } 1689 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 1690 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 1691 for (var i = 0, len = $items.length; i < len; i++) { 1692 var $item = $($items[i]), 1693 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 1694 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 1695 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 1696 1697 1698 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 1699 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 1700 } 1701 1702 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 1703 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 1704 } 1705 1706 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 1707 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1708 switch (parseInt(multiplier_w[1])) { 1709 case (5): 1710 case (4): 1711 case (3): 1712 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1713 multiplier_w[1] = 6; 1714 break; 1715 case (2): 1716 case (1): 1717 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 1718 multiplier_w[1] = 3; 1719 break; 1720 default: 1721 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1722 multiplier_w[1] = 12; 1723 break; 1724 } 1725 1726 if (multiplier_w[1] == 2.4) { // 5 columns 1727 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1728 multiplier_w[1] = 6; 1729 } 1730 } 1731 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 1732 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1733 switch (parseInt(multiplier_w[1])) { 1734 case (5): 1735 case (4): 1736 case (3): 1737 case (2): 1738 case (1): 1739 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1740 multiplier_w[1] = 6; 1741 break; 1742 default: 1743 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1744 multiplier_w[1] = 12; 1745 break; 1746 } 1747 1748 if (multiplier_w[1] == 2.4) { // 5 columns 1749 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1750 multiplier_w[1] = 6; 1751 } 1752 } 1753 } else if (widthAvailable < screenSmArray[index]) { 1754 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1755 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1756 multiplier_w[1] = 12; 1757 if (typeGridArray[index]) multiplier_h[1] = 12; 1758 } 1759 } 1760 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 1761 height; 1762 1763 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 1764 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 1765 if ( widthAvailable < screenSmArray[index] ) { 1766 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 1767 } 1768 } else { 1769 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 1770 } 1771 1772 if (width >= widthAvailable) { 1773 $item.css({ 1774 width: widthAvailable 1775 }); 1776 if (typeGridArray[index]) { 1777 $item.children().add($item.find('.backimg')).css({ 1778 height: height 1779 }); 1780 } 1781 } else { 1782 $item.css({ 1783 width: width 1784 }); 1785 if (typeGridArray[index]) { 1786 $item.children().add($item.find('.backimg')).css({ 1787 height: height 1788 }); 1789 } 1790 } 1791 } 1792 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 1793 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 1794 } else { 1795 return columnWidth; 1796 } 1797 }, 1798 init_isotope = function() { 1799 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 1800 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 1801 isotopeId = isotopeSystem.attr('id'), 1802 $layoutMode = layoutGridArray[i], 1803 setIsotopeFirstRowTimeOut, 1804 setIsotopeFirstRow = function(items){ 1805 var firstRow = true; 1806 $(items).each(function(index, val){ 1807 var el = items[index].element, 1808 el_top = items[index].position.y, 1809 $el = $(el); 1810 if ( index > 0 && el_top > 0 && firstRow ) { 1811 firstRow = false;
1812 } else if ( index == 0 && el_top == 0 ) { 1813 firstRow = true; 1814 } 1815 if ( firstRow ) { 1816 $el.removeClass('tmb-isotope-further-row'); 1817 } else { 1818 $el.addClass('tmb-isotope-further-row'); 1819 } 1820 }); 1821 }; 1822 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 1823 //resizable: true, 1824 itemSelector: $itemSelector, 1825 layoutMode: $layoutMode, 1826 transitionDuration: transitionDuration[i], 1827 masonry: { 1828 columnWidth: colWidth(i) 1829 }, 1830 vertical: { 1831 horizontalAlignment: 0.5, 1832 }, 1833 sortBy: 'original-order', 1834 isOriginLeft: isOriginLeft 1835 }) 1836 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 1837 .on('layoutComplete', function( event, items ){ 1838 if ( typeof items[0] !== 'undefined' ) { 1839 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1840 setIsotopeFirstRow(items); 1841 } 1842 } 1843 }) 1844 .on('arrangeComplete', function( event, items ){ 1845 if ( typeof items[0] !== 'undefined' ) { 1846 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1847 clearRequestTimeout(setIsotopeFirstRowTimeOut); 1848 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 1849 setIsotopeFirstRow(items); 1850 }, 100); 1851 } 1852 } 1853 }); 1854 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 1855 $(isotopeContainersArray[i]).infinitescroll({ 1856 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 1857 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 1858 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve 1859 animate: false, 1860 behavior: 'local', 1861 debug: false, 1862 loading: { 1863 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 1864 speed: 0, 1865 finished: undefined, 1866 msg: $('#' + isotopeId + ' .loadmore-button'), 1867 }, 1868 errorCallback: function() { 1869 var isotope_system = $(this).closest('.isotope-system'); 1870 $('.loading-button', isotope_system).hide(); 1871 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 1872 } 1873 }, 1874 // append the new items to isotope on the infinitescroll callback function. 1875 function(newElements, opts) { 1876 var $isotope = $(this), 1877 isotopeId = $isotope.closest('.isotope-system').attr('id'), 1878 filters = new Array(), 1879 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 1880 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 1881 $numPages = $('a', $infinite_button).data('pages'), 1882 delay = 300; 1883 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 1884 $infinite_button.show(); 1885 $loading_button.hide(); 1886 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 1887 $('> li', $isotope).remove(); 1888 $.each($(newElements), function(index, val) { 1889 $(val).addClass('tmb-iso'); 1890 if ($(val).is("li")) { 1891 filters.push($(val)[0]); 1892 } 1893 }); 1894 newElements = newElements.filter(function(x) { 1895 return filters.indexOf(x) < 0 1896 }); 1897 $.each($(filters), function(index, val) { 1898 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 1899 }); 1900 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 1901 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 1902 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 1903 if (typeof getLightbox === 'object') { 1904 getLightbox.refresh(); 1905 } else { 1906 UNCODE.lightbox(); 1907 } 1908 } 1909 if ( typeof twttr !== 'undefined' ) 1910 twttr.widgets.load(isotopeContainersArray[i]); 1911 1912 requestTimeout(function() { 1913 Waypoint.refreshAll(); 1914 $isotope.trigger('more-items-loaded'); 1915 }, 1000); 1916 1917 }); 1918 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 1919 var $infinite_isotope = $(isotopeContainersArray[i]), 1920 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 1921 $infinite_isotope.infinitescroll('pause'); 1922 $infinite_button.on('click', function(event) { 1923 event.preventDefault(); 1924 var $infinite_system = $(event.target).closest('.isotope-system'), 1925 $infinite_isotope = $infinite_system.find('.isotope-container'), 1926 isotopeId = $infinite_system.attr('id'); 1927 $(event.currentTarget).html(SiteParameters.loading); 1928 $infinite_isotope.infinitescroll('resume'); 1929 $infinite_isotope.infinitescroll('retrieve'); 1930 $infinite_isotope.infinitescroll('pause'); 1931 }); 1932 } 1933 } 1934 } 1935 }, 1936 onLayout = function(isotopeObj, startIndex, needsReload) { 1937 var needsReload = needsReload ? true : false;
1938 1939 if (typeof UNCODE.bigText !== 'undefined') { 1940 UNCODE.bigText(); 1941 } 1942 isotopeObj.css('opacity', 1); 1943 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 1944 1945 requestTimeout(function() { 1946 if (startIndex > 0) { 1947 reloadIsotope(isotopeObj); 1948 if (SiteParameters.dynamic_srcset_active === '1') { 1949 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1950 UNCODE.adaptive_srcset(isotopeObj); 1951 } 1952 // window.dispatchEvent(UNCODE.boxEvent); 1953 } else if (needsReload) { 1954 reloadIsotope(isotopeObj); 1955 } 1956 1957 UNCODE.adaptive(); 1958 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 1959 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1960 } 1961 if (typeof MediaElement === "function") { 1962 $(isotopeObj).find('audio,video').each(function() { 1963 $(this).mediaelementplayer({ 1964 pauseOtherPlayers: false, 1965 }); 1966 }); 1967 } 1968 if ($(isotopeObj).find('.nested-carousel').length) { 1969 if (typeof UNCODE.carousel !== 'undefined') { 1970 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 1971 } 1972 requestTimeout(function() { 1973 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1974 }, 200); 1975 } else { 1976 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1977 } 1978 isotopeObj.trigger('isotope-layout-complete'); 1979 1980 }, 100); 1981 1982 }, 1983 boxAnimation = function(items, startIndex, sequential, container) { 1984 var $allItems = items.length - startIndex, 1985 showed = 0, 1986 index = 0; 1987 if (container.closest('.owl-item').length == 1) return false; 1988 $.each(items, function(index, val) { 1989 var $this = $(val), 1990 elInner = $('> .t-inside', val); 1991 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 1992 return; 1993 } 1994 if (val[0]) val = val[0]; 1995 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 1996 new Waypoint({ 1997 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 1998 element: val, 1999 handler: function() { 2000 var element = $('> .t-inside', this.element), 2001 parent = $(this.element), 2002 currentIndex = parent.index(); 2003 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 2004 delayAttr = parseInt(element.attr('data-delay')); 2005 if (isNaN(delayAttr)) delayAttr = 100; 2006 delay -= showed; 2007 var objTimeout = requestTimeout(function() { 2008 element.removeClass('zoom-reverse').addClass('start_animation'); 2009 showed = parent.index(); 2010 if ( container.data('isotope') ) { 2011 container.isotope('layout'); 2012 } 2013 }, delay * delayAttr) 2014 parent.data('objTimeout', objTimeout); 2015 if (!UNCODE.isUnmodalOpen) { 2016 this.destroy(); 2017 } 2018 }, 2019 offset: '100%' 2020 }) 2021 } else { 2022 if (elInner.hasClass('force-anim')) { 2023 elInner.addClass('start_animation'); 2024 } else { 2025 elInner.css('opacity', 1); 2026 } 2027 container.isotope('layout'); 2028 } 2029 2030 index++; 2031 }); 2032 }, 2033 reloadIsotope = function(isotopeObj) { 2034 var isoIndex = $(isotopeObj).attr('data-iso-index'); 2035 var $layoutMode = ($(isotopeObj).data('layout')); 2036 if ($layoutMode === undefined) { 2037 $layoutMode = 'masonry'; 2038 } 2039 if (isotopeObj.data('isotope')) { 2040 isotopeObj.isotope({ 2041 itemSelector: $itemSelector, 2042 layoutMode: $layoutMode, 2043 transitionDuration: transitionDuration[isoIndex], 2044 masonry: { 2045 columnWidth: colWidth(isoIndex) 2046 }, 2047 vertical: { 2048 horizontalAlignment: 0.5, 2049 }, 2050 sortBy: 'original-order', 2051 isOriginLeft: isOriginLeft 2052 }); 2053 } 2054 } 2055 ; 2056 if ($('.isotope-pagination').length > 0) { 2057 $('.isotope-system').on('click', '.pagination a', function(evt) { 2058 evt.preventDefault(); 2059 2060 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 2061 container = $(this).closest('.isotope-system'), 2062 calc_scroll = container.closest('.row-parent').offset().top; 2063 calc_scroll -= UNCODE.get_scroll_offset(); 2064 2065 var menu_container = $('.menu-sticky'); 2066 var menu = menu_container.find('.menu-container'); 2067 2068 if (menu_container.length > 0 && menu.length > 0) { 2069 calc_scroll = calc_scroll - menu.outerHeight(); 2070 } 2071 2072 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2073 delta = bodyTop - calc_scroll, 2074 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 2075 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2076 2077 if ( !UNCODE.isFullPage ) { 2078 if (scrollSpeed == 0) { 2079 $('html, body').scrollTop(calc_scroll); 2080 } else { 2081 $('html, body').animate({ 2082 scrollTop: calc_scroll 2083 },{ 2084 easing: 'easeInOutQuad', 2085 duration: scrollSpeed, 2086 complete: function(){ 2087 UNCODE.scrolling = false;
2088 } 2089 }); 2090 } 2091 } 2092 2093 loadIsotope($(this), true); 2094 evt.preventDefault(); 2095 }); 2096 } 2097 $filters.on('click', 'a.isotope-nav-link', function(evt) { 2098 if ($(this).hasClass('no-isotope-filter')) { 2099 return; 2100 } 2101 var $filter = $(this), 2102 filterContainer = $filter.closest('.isotope-filters'), 2103 filterValue = $filter.attr('data-filter'), 2104 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 2105 transitionDuration = container.data().isotope.options.transitionDuration, 2106 delay = 300, 2107 filterItems = []; 2108 2109 var filter_items = function(){ 2110 if (filterValue !== undefined) { 2111 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2112 var parent = $(val).parent(), 2113 objTimeout = parent.data('objTimeout'); 2114 if (objTimeout) { 2115 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2116 clearRequestTimeout(objTimeout); 2117 } 2118 if (transitionDuration == 0) { 2119 if ($(val).hasClass('animate_when_almost_visible')) { 2120 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2121 } else { 2122 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2123 } 2124 } 2125 }); 2126 requestTimeout(function(){ 2127 if ( filterValue == '*' ) { 2128 container.removeClass('isotope-filtered'); 2129 } else { 2130 container.addClass('isotope-filtered'); 2131 } 2132 container.isotope({ 2133 filter: function() { 2134 var block = $(this), 2135 filterable = (filterValue == '*') || block.hasClass(filterValue), 2136 lightboxElements = $('[data-lbox^=ilightbox]', block); 2137 if (filterable) { 2138 if (lightboxElements.length) { 2139 lightboxElements.removeClass('lb-disabled'); 2140 container.data('lbox', $(lightboxElements[0]).data('lbox')); 2141 } 2142 filterItems.push(block); 2143 } else { 2144 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 2145 } 2146 container.trigger('more-items-loaded'); 2147 return filterable; 2148 } 2149 }); 2150 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 2151 2152 }, delay); 2153 2154 /** once filtered - start **/ 2155 container.isotope('once', 'arrangeComplete', function() { 2156 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2157 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 2158 if (typeof getLightbox === 'object') { 2159 getLightbox.refresh(); 2160 } else { 2161 UNCODE.lightbox(); 2162 } 2163 } 2164 if (transitionDuration == 0) { 2165 requestTimeout(function() { 2166 boxAnimation(filterItems, 0, false, container); 2167 }, 100); 2168 } 2169 requestTimeout(function() { 2170 Waypoint.refreshAll(); 2171 }, 2000); 2172 }); 2173 /** once filtered - end **/ 2174 } else { 2175 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2176 $.each(UNCODE.lightboxArray, function(index, val) { 2177 UNCODE.lightboxArray[index].destroy(); 2178 }); 2179 } 2180 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2181 var parent = $(val).parent(), 2182 objTimeout = parent.data('objTimeout'); 2183 if (objTimeout) { 2184 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2185 clearRequestTimeout(objTimeout); 2186 } 2187 if (transitionDuration == 0) { 2188 if ($(val).hasClass('animate_when_almost_visible')) { 2189 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2190 } else { 2191 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2192 } 2193 } 2194 }); 2195 container.parent().addClass('grid-loading'); 2196 loadIsotope($filter); 2197 } 2198 }; 2199 2200 if (!$filter.hasClass('active')) { 2201 /** Scroll top with filtering */ 2202 if (filterContainer.hasClass('filter-scroll')) { 2203 var calc_scroll = container.closest('.row-parent').offset().top; 2204 calc_scroll -= UNCODE.get_scroll_offset(); 2205 2206 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2207 delta = bodyTop - calc_scroll, 2208 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 2209 filterTolerance = false, 2210 filter_timeout; 2211 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2212 2213 if ( !UNCODE.isFullPage ) { 2214 if (scrollSpeed == 0) { 2215 $('html, body').scrollTop(calc_scroll); 2216 UNCODE.scrolling = false;
2217 filter_items(); 2218 } else { 2219 2220 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 2221 filter_items(); 2222 filterTolerance = true; 2223 } 2224 2225 $('html, body').animate({ 2226 scrollTop: calc_scroll 2227 },{ 2228 easing: 'easeInOutQuad', 2229 duration: scrollSpeed, 2230 complete: function(){ 2231 UNCODE.scrolling = false; 2232 if ( !filterTolerance ) { 2233 filter_timeout = setTimeout(function(){ 2234 clearTimeout(filter_timeout); 2235 filter_items(); 2236 }, 200); 2237 } 2238 } 2239 }); 2240 } 2241 } 2242 } else { 2243 filter_items(); 2244 } 2245 } 2246 evt.preventDefault(); 2247 }); 2248 2249 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 2250 var params = UNCODE.getURLParams(window.location); 2251 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 2252 2253 UNCODE.lastURL = window.location.href; 2254 2255 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 2256 return; 2257 } 2258 2259 if (params.id === undefined) { 2260 $.each($('.isotope-system'), function(index, val) { 2261 loadIsotope($(val)); 2262 }); 2263 } else { 2264 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 2265 loadIsotope($('#' + params.id)); 2266 } 2267 } 2268 }); 2269 2270 var loadIsotope = function($href, $paginating) { 2271 var is_paginating = false; 2272 2273 if (undefined !== $paginating && $paginating) { 2274 var is_paginating = $paginating; 2275 } 2276 2277 var href = ($href.is("a") ? $href.attr('href') : location), 2278 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 2279 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 2280 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 2281 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 2282 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 2283 isotopeId = isotopeSystem.attr('id'); 2284 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 2285 UNCODE.lastURL = href; 2286 history.pushState({ 2287 myIsotope: true 2288 }, document.title, href); 2289 } 2290 if (is_paginating) { 2291 isotopeWrapper.addClass('grid-filtering'); 2292 } 2293 $.ajax({ 2294 url: href 2295 }).done(function(data) { 2296 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 2297 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 2298 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 2299 isotopeWrapper.addClass('isotope-reloaded'); 2300 requestTimeout(function() { 2301 isotopeWrapper.removeClass('grid-loading'); 2302 isotopeWrapper.removeClass('isotope-reloaded'); 2303 isotopeWrapper.removeClass('grid-filtering'); 2304 }, 500); 2305 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 2306 var parent = $(val).parent(), 2307 objTimeout = parent.data('objTimeout'); 2308 if (objTimeout) { 2309 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2310 clearRequestTimeout(objTimeout); 2311 } 2312 if ($(val).hasClass('animate_when_almost_visible')) { 2313 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2314 } else { 2315 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 2316 } 2317 }); 2318 requestTimeout(function() { 2319 if (isotopeContainer.data('isotope')) { 2320 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 2321 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 2322 UNCODE.adaptive(); 2323 if (SiteParameters.dynamic_srcset_active === '1') { 2324 UNCODE.adaptive_srcset(isotopeContainer); 2325 } 2326 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2327 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 2328 if (typeof getLightbox === 'object') { 2329 getLightbox.refresh(); 2330 } else { 2331 UNCODE.lightbox(); 2332 } 2333 } 2334 } 2335 isotopeContainer.trigger('more-items-loaded'); 2336 }, 300); 2337 $('.pagination', isotopeFooter).remove(); 2338 isotopeFooter.append($resultPagination); 2339 2340 if (isotopeResultCount.length > 0) { 2341 $('.woocommerce-result-count', isotopeResultCount).remove(); 2342 isotopeResultCount.append($resultCount); 2343 } 2344 }); 2345 }; 2346 $filters.each(function(i, buttonGroup) { 2347 var $buttonGroup = $(buttonGroup); 2348 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 2349 $buttonGroup.find('.active').removeClass('active'); 2350 $(this).addClass('active'); 2351 2352 }); 2353 2354 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 2355 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 2356 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 2357 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 2358 e.preventDefault(); 2359 $cats_filters.slideToggle(400, 'easeInOutCirc'); 2360 }); 2361 2362 }); 2363 window.addEventListener('boxResized', function(e) { 2364 if (UNCODE.printDialogOpen !== false) { 2365 return false;
2366 } 2367 $.each($('.isotope-layout'), function(index, val) { 2368 var $layoutMode = ($(this).data('layout')); 2369 if ($layoutMode === undefined) $layoutMode = 'masonry'; 2370 if ($(this).data('isotope')) { 2371 $(this).isotope({ 2372 itemSelector: $itemSelector, 2373 layoutMode: $layoutMode, 2374 transitionDuration: transitionDuration[index], 2375 masonry: { 2376 columnWidth: colWidth(index) 2377 }, 2378 vertical: { 2379 horizontalAlignment: 0.5, 2380 }, 2381 sortBy: 'original-order', 2382 isOriginLeft: isOriginLeft 2383 }); 2384 $(this).isotope('unbindResize'); 2385 if (SiteParameters.dynamic_srcset_active === '1') { 2386 UNCODE.refresh_dynamic_srcset_size($(this)); 2387 } 2388 } 2389 $(this).find('.mejs-video,.mejs-audio').each(function() { 2390 $(this).trigger('resize'); 2391 }); 2392 }); 2393 }, false); 2394 2395 init_isotope(); 2396 }; 2397} 2398 2399UNCODE.lightbox = function() { 2400 if ( SiteParameters.lbox_enhanced ) { 2401 return true; 2402 } 2403 UNCODE.lightboxArray = {}; 2404 requestTimeout(function() { 2405 var groupsArr = {}; 2406 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 2407 var group = this.getAttribute("data-lbox"), 2408 values = $(this).data(); 2409 $(this).attr('data-lbox-init','true') 2410 groupsArr[group] = values; 2411 }); 2412 for (var i in groupsArr) { 2413 var skin = groupsArr[i].skin || 'black', 2414 path = groupsArr[i].dir || 'horizontal', 2415 thumbs = !groupsArr[i].notmb || false, 2416 arrows = !groupsArr[i].noarr || false, 2417 social = groupsArr[i].social || false, 2418 deeplink = groupsArr[i].deep || false, 2419 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 2420 counter = $els.length, 2421 dataAlbum = $els.attr('data-album'); 2422 if (social) social = { 2423 facebook: true, 2424 twitter: true, 2425 reddit: true, 2426 digg: true 2427 }; 2428 UNCODE.lightboxArray[i] = $els.iLightBox({ 2429 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 2430 skin: skin, 2431 path: path, 2432 linkId: deeplink, 2433 infinite: false, 2434 //fullViewPort: 'fit', 2435 smartRecognition: false, 2436 fullAlone: true, 2437 maxScale: 1, 2438 minScale: .02, 2439 //fullStretchTypes: 'flash, video', 2440 overlay: { 2441 opacity: .94 2442 }, 2443 controls: { 2444 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 2445 fullscreen: true, 2446 thumbnail: thumbs, 2447 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 2448 }, 2449 show: { 2450 speed: 200 2451 }, 2452 hide: { 2453 speed: 200 2454 }, 2455 social: { 2456 start: false, 2457 buttons: social 2458 }, 2459 caption: { 2460 start: false 2461 }, 2462 styles: { 2463 nextOpacity: 1, 2464 nextScale: 1, 2465 prevOpacity: 1, 2466 prevScale: 1 2467 }, 2468 effects: { 2469 switchSpeed: 400 2470 }, 2471 slideshow: { 2472 pauseTime: 5000 2473 }, 2474 thumbnails: { 2475 maxWidth: 60, 2476 maxHeight: 60, 2477 activeOpacity: .2 2478 }, 2479 html5video: { 2480 preload: true 2481 }, 2482 callback: { 2483 onOpen: function(){ 2484 $(window).trigger('uncode-custom-cursor'); 2485 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2486 iNoBounce.enable(); 2487 } 2488 }, 2489 onHide: function(){ 2490 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2491 iNoBounce.disable() 2492 } 2493 }, 2494 } 2495 }); 2496 2497 $(document).on('infinite-loaded', function(){ 2498 UNCODE.lightboxArray[i].refresh(); 2499 }); 2500 2501 $(window).on('gdprOpen', function(){ 2502 UNCODE.lightboxArray[i].close(); 2503 }); 2504 }; 2505 }, 100); 2506 2507 $(document).on('click', '.lb-disabled', function(e){ 2508 e.preventDefault(); 2509 }); 2510}; 2511 2512UNCODE.lightgallery = function( $el ) { 2513 var createSelectors = function(){ 2514 $('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){ 2515 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 2516 $(this).addClass('lbox-trigger-item'); 2517 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 2518 $(this).addClass('lbox-nested-item'); 2519 } else { 2520 $(this).removeClass('lbox-trigger-item'); 2521 $(this).removeClass('lbox-nested-item'); 2522 } 2523 }); 2524 }; 2525 2526 createSelectors(); 2527 2528 var galleries = [], 2529 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 2530 return !$(this).closest('.nested-carousel').length; 2531 }), 2532 $_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 *'), 2533 $galleries = $_galleries.filter(function( index ) { 2534 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 2535 }), 2536 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 2537 2538 if ( typeof $el === 'undefined' ) { 2539 $el = $galleries.add( $nested ); 2540 } 2541 2542 var $disabled = $('a.lb-disabled'); 2543 $disabled.on('click', function(e){ 2544 e.preventDefault(); 2545 }); 2546 2547 var beforeSlide = function(event) { 2548 var detail = event.detail, 2549 info = detail.info, 2550 item = detail.item, 2551 $slide = $(detail.currentSlide.selector), 2552 $video = $('video', $slide), 2553 $previous = $(detail.previousSlide.selector), 2554 $prevVideo = $('video', $previous), 2555 isAudio = false;
2556 2557 if ( typeof info.src !== 'undefined' ) { 2558 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 2559 } 2560 2561 if ( ! $video.length && ( info.video || isAudio ) ) { 2562 if ( info.video ) { 2563 if ( typeof info.video === 'object' ) { 2564 var infoJson = info.video; 2565 } else { 2566 var infoJson = JSON.parse(info.video); 2567 } 2568 var src = infoJson.source[0].src, 2569 autoplay = $(item).attr('data-autoplay'), 2570 loop = $(item).attr('data-loop'); 2571 2572 } else if ( isAudio ) { 2573 var src = info.src, 2574 autoplay = true, 2575 loop = false; 2576 } 2577 if ( typeof src !== 'undefined' ) { 2578 $slide.addClass('has-html5'); 2579 var video = document.createElement('video'); 2580 video.src = src; 2581 video.preload = 'auto'; 2582 video.controls = 'controls'; 2583 video.controlsList = 'nodownload'; 2584 if ( autoplay ) { 2585 video.autoplay = 'autoplay'; 2586 } 2587 if ( loop ) { 2588 video.loop = 'loop'; 2589 } 2590 $(video).appendTo($slide); 2591 } 2592 } else { 2593 var $video = $('video', $slide); 2594 if ( $video.length ) { 2595 $video[0].currentTime = 0; 2596 if ( $video[0].autoplay ) { 2597 $video[0].play(); 2598 } 2599 } 2600 } 2601 if ( $prevVideo.length ) { 2602 $prevVideo[0].currentTime = 0; 2603 $prevVideo[0].pause(); 2604 } 2605 }; 2606 2607 var beforeOpen = function(event) { 2608 var detail = event.detail, 2609 items = detail.items, 2610 galleryItems = detail.galleryItems, 2611 outer = detail.outer.selector, 2612 i, ii; 2613 for ( i = 0; i < galleryItems.length; i++ ) { 2614 var item = galleryItems[i]; 2615 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 2616 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 2617 } 2618 } 2619 for ( ii = 0; ii < items.length; ii++ ) { 2620 var item = items[ii]; 2621 if ( $(item).attr('data-icon') === 'video' ) { 2622 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 2623 } 2624 } 2625 2626 }; 2627 2628 //caption builder 2629 $el.each( function( index, val ) { 2630 var $gallery = $(this).attr('data-lbox-init','true'), 2631 $_a = '.lbox-trigger-item', 2632 $_nested_a = '.lbox-nested-item'; 2633 2634 $gallery.find($_a, $_nested_a).each(function(){ 2635 var $a = $(this), 2636 $img = $('img', $a).first(), 2637 imgw = $img.attr('data-width'), 2638 imgh = $img.attr('data-height'), 2639 caption = $a.attr('data-caption'), 2640 title = $a.attr('data-title'); 2641 2642 if ( $img.length && $img.attr('data-crop') != true ) { 2643 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 2644 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 2645 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 2646 $a.attr('data-external-thumb-image', $img[0].src); 2647 } 2648 } 2649 2650 if ( typeof title !== 'undefined' && title !== '' ) { 2651 title = '<h6>' + title + '</h6>'; 2652 } else { 2653 title = ''; 2654 } 2655 2656 if ( typeof caption !== 'undefined' && caption !== '' ) { 2657 caption = '<p>' + caption + '</p>'; 2658 title += caption; 2659 } 2660 2661 if ( title !== '' ) { 2662 $a.attr( 'title', title ); 2663 } 2664 2665 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') ) ) { 2666 $a.attr('data-lg-size', imgw + '-' + imgh); 2667 } 2668 }); 2669 }); 2670 2671 //regular galleries 2672 $el.each( function( index, val ) { 2673 var $gallery = $(this), 2674 $_a = '.lbox-trigger-item', 2675 $_nested_a = '.lbox-nested-item', 2676 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 2677 galleryID = $_first.attr('data-lbox'), 2678 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 2679 tmb = $_first.attr('data-notmb'), 2680 social = $_first.attr('data-social'), 2681 deep = $_first.attr('data-deep'), 2682 zoom = $_first.attr('data-zoom-origin'), 2683 actual = $_first.attr('data-actual-size'), 2684 download = $_first.attr('data-download'), 2685 controls = $_first.attr('data-arrows') !== 'no', 2686 fullScreen = $_first.attr('data-full'),
2687 counter = $_first.attr('data-counter'), 2688 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 2689 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 2690 connect = $_first.attr('data-connect'), 2691 $currentVideo = false, 2692 lgPlugins = [lgVideo], 2693 itemsLoadedTimeOut; 2694 2695 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 2696 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 2697 2698 if ( typeof tmb == 'undefined' || !tmb ) { 2699 lgPlugins.push(lgThumbnail); 2700 } 2701 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 2702 lgPlugins.push(lgZoom); 2703 } 2704 if ( typeof deep != 'undefined' && deep != '' ) { 2705 lgPlugins.push(lgHash); 2706 } 2707 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 2708 lgPlugins.push(lgFullscreen); 2709 } 2710 if ( social ) { 2711 lgPlugins.push(lgShare); 2712 } 2713 2714 if ( galleries.indexOf( galleryID ) !== -1 ) { 2715 return true; 2716 } 2717 2718 galleries.push( galleryID ); 2719 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 2720 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 2721 var gallery = lightGallery( $triggerGal[0], { 2722 addClass: containerClass, 2723 plugins: lgPlugins, 2724 mode: transition, 2725 selector: $selector, 2726 galleryId: galleryID, 2727 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 2728 iframeWidth: '848px', 2729 iframeMaxWidth: '90%', 2730 iframeMaxHeight: '90%', 2731 exThumbImage: 'data-external-thumb-image', 2732 loadYouTubeThumbnail: false, 2733 // autoplayFirstVideo: false, 2734 pager: false, 2735 startClass: 'lg-start-opacity', 2736 zoomFromOrigin: zoom, 2737 controls: controls, 2738 download: ( typeof download != 'undefined' && download != '' ), 2739 thumbWidth: 50, 2740 thumbHeight: '50px', 2741 counter: $triggerGal.find($selector).length > 1 ? counter : false, 2742 loadYouTubePoster: false, 2743 enableDrag: $triggerGal.find($selector).length > 1 2744 }); 2745 2746 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 2747 e.preventDefault(); 2748 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 2749 gallery.openGallery(index-1); 2750 }); 2751 2752 $triggerGal.on('more-items-loaded', function(e, items) { 2753 clearRequestTimeout(itemsLoadedTimeOut); 2754 itemsLoadedTimeOut = requestTimeout(function(){ 2755 createSelectors(); 2756 gallery.refresh(); 2757 }, 100); 2758 }); 2759 2760 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2761 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 2762 $el = model.view.$el; 2763 if ( $el.find($triggerGal).length ) { 2764 gallery.destroy(); 2765 } 2766 }); 2767 } 2768 2769 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 2770 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 2771 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 2772 $(window).trigger('uncode-custom-cursor'); 2773 }); 2774 2775 }); 2776 2777 if ( typeof $el !== 'undefined' ) { 2778 2779 //album galleries 2780 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 2781 var album = val, 2782 galleryID = index, 2783 $album = $(album), 2784 params = $album.attr('data-album'), 2785 tmb = $(val).attr('data-notmb'), 2786 social = $(val).attr('data-social'), 2787 deep = $(val).attr('data-deep'), 2788 zoom = $(val).attr('data-zoom-origin'), 2789 actual = $(val).attr('data-actual-size'), 2790 download = $(val).attr('data-download'), 2791 controls = $(val).attr('data-arrows') !== 'no', 2792 fullScreen = $(val).attr('data-full'), 2793 counter = $(val).attr('data-counter'), 2794 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 2795 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 2796 $currentVideo = false, 2797 lgPlugins = [lgVideo]; 2798 2799 $(val).attr('data-lbox-init','true'); 2800 2801 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 2802 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 2803 2804 if ( typeof tmb == 'undefined' || !tmb ) { 2805 lgPlugins.push(lgThumbnail); 2806 } 2807 if ( typeof actual != 'undefined' && actual != '' ) { 2808 lgPlugins.push(lgZoom); 2809 } 2810 if ( typeof deep != 'undefined' && deep != '' ) { 2811 lgPlugins.push(lgHash); 2812 } 2813 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 2814 lgPlugins.push(lgFullscreen); 2815 } 2816 if ( social ) { 2817 lgPlugins.push(lgShare); 2818 } 2819 2820 var gallery = window.lightGallery(album, { 2821 dynamic: true, 2822 plugins: lgPlugins, 2823 dynamicEl: JSON.parse(params), 2824 galleryId: galleryID, 2825 addClass: containerClass, 2826 mode: transition, 2827 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 2828 iframeWidth: '848px', 2829 iframeMaxWidth: '90%', 2830 iframeMaxHeight: '90%',
2831 loadYouTubeThumbnail: false, 2832 // autoplayFirstVideo: false, 2833 pager: false, 2834 startClass: 'lg-start-opacity', 2835 zoomFromOrigin: false, 2836 controls: controls, 2837 download: ( typeof download != 'undefined' && download != '' ), 2838 thumbWidth: 50, 2839 thumbHeight: '50px', 2840 loadYouTubePoster: false, 2841 counter: counter 2842 }); 2843 2844 $album.on('click', function(){ 2845 gallery.openGallery(0); 2846 }); 2847 2848 album.addEventListener('lgBeforeSlide', beforeSlide); 2849 album.addEventListener('lgBeforeOpen', beforeOpen); 2850 album.addEventListener('lgAfterOpen', function(){ 2851 $(window).trigger('uncode-custom-cursor'); 2852 }); 2853 2854 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2855 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 2856 $el = model.view.$el; 2857 if ( $el.find($album).length ) { 2858 gallery.destroy(); 2859 } 2860 }); 2861 } 2862 2863 }); 2864 2865 //single images 2866 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 2867 var gallery = lightGallery( $('.page-wrapper')[0], { 2868 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 2869 iframeWidth: '848px', 2870 iframeMaxWidth: '90%', 2871 iframeMaxHeight: '90%', 2872 loadYouTubeThumbnail: false, 2873 // autoplayFirstVideo: false, 2874 startClass: 'lg-start-opacity', 2875 thumbWidth: 50, 2876 thumbHeight: '50px', 2877 download: false, 2878 loadYouTubePoster: false, 2879 counter: false 2880 }); 2881 2882 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 2883 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 2884 }); 2885 } 2886}; 2887 2888UNCODE.carousel = function(container) { 2889 var $owlContainers = $('.owl-carousel-container', container); 2890 $owlContainers.each(function() { 2891 var $owlContainer = $(this), 2892 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 2893 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 2894 values = {}, 2895 tempTimeStamp, 2896 currentIndex, 2897 $owlInsideEqual = []; 2898 $owlSelector.each(function() { 2899 var itemID = $(this).attr('id'), 2900 $elSelector = $(('#' + itemID).toString()); 2901 values['id'] = itemID; 2902 values['items'] = 1;
2903 values['columns'] = 3; 2904 values['fade'] = false; 2905 values['nav'] = false; 2906 values['navmobile'] = false; 2907 values['navskin'] = 'light'; 2908 values['navspeed'] = 400; 2909 values['dots'] = false; 2910 values['dotsmobile'] = false; 2911 values['loop'] = false; 2912 values['autoplay'] = false; 2913 values['timeout'] = 3000; 2914 values['autoheight'] = false; 2915 values['stagepadding'] = 0; 2916 values['margin'] = 0; 2917 values['lg'] = 1; 2918 values['md'] = 1; 2919 values['sm'] = 1; 2920 $.each($(this).data(), function(i, v) { 2921 values[i] = v; 2922 }); 2923 2924 if ($(this).closest('.uncode-slider').length) { 2925 values['navskin'] = ''; 2926 values['navmobile'] = false; 2927 //values['dotsmobile'] = true; 2928 } else { 2929 values['navskin'] = ' style-'+values['navskin']+' style-override'; 2930 } 2931 2932 var setIndexActive = function(event, init){ 2933 var init = typeof init === 'undefined' ? false : init, 2934 thiis = $(event.currentTarget); 2935 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 2936 var scrolltop = $(document).scrollTop(), 2937 size = event.page.size, 2938 i; 2939 var setIndex = requestTimeout(function() { 2940 for ( i = 0; i < size; i++ ) { 2941 var itemCont = event.item.index != null ? (event.item.index + i) : i; 2942 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 2943 if (thiis.closest('.row-slider').length) { 2944 if (currentItem == undefined) { 2945 currentItem = thiis.children()[i]; 2946 } 2947 if ($(currentItem).closest('#page-header').length) { 2948 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 2949 UNCODE.switchColorsMenu(scrolltop, 'dark'); 2950 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 2951 UNCODE.switchColorsMenu(scrolltop, 'light'); 2952 } 2953 } 2954 } 2955 var itendIndex = $(currentItem).attr('data-index'); 2956 if ( isNaN(itendIndex) ) { 2957 itendIndex = 1; 2958 } 2959 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 2960 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 2961 if ($.fn.counterUp) { 2962 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 2963 var $counter = $(this); 2964 $counter.addClass('started').counterUp({ 2965 delay: 10, 2966 time: 1500 2967 }); 2968 }); 2969 } 2970 } 2971 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 2972 }, 200); 2973 } 2974 tempTimeStamp = event.timeStamp; 2975 } 2976 2977 /** Initialized */ 2978 $elSelector.on('initialized.owl.carousel', function(event) { 2979 2980 if ( $('.isotope-container', event.currentTarget).length ) { 2981 window.dispatchEvent(UNCODE.boxEvent); 2982 } 2983 2984 $('.owl-dot.active', $elSelector).on('click', function(){ 2985 return false; 2986 }); 2987 2988 var thiis = $(event.currentTarget), 2989 // get the time from the data method 2990 time = thiis.data("timer-id"), 2991 rowParent = thiis.closest('.row-parent'); 2992 2993 if ( typeof rowParent[0] !== 'undefined' ) { 2994 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 2995 } 2996 2997 if (time) { 2998 clearRequestTimeout(time); 2999 } 3000 3001 thiis.addClass('showControls'); 3002 var new_time = requestTimeout(function() { 3003 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 3004 if (thiis.hasClass('owl-height-viewport')) 3005 setItemsRelHeight(thiis); 3006 if (thiis.hasClass('owl-height-equal')) 3007 setItemsHeight(thiis); 3008 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 3009 if (thiis.closest('.unequal, .unexpand').length) { 3010 UNCODE.setRowHeight(rowParent[0], true); 3011 } 3012 if (SiteParameters.dynamic_srcset_active === '1') { 3013 UNCODE.refresh_dynamic_srcset_size(thiis); 3014 } 3015 }, 350); 3016 // save the new time 3017 thiis.data("timer-id", new_time); 3018 3019 var scrolltop = $(document).scrollTop(); 3020 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 3021 3022 //if (!UNCODE.isMobile) { 3023 /** fix autoplay when visible **/ 3024 $(window).on('load', function(){ 3025 if (thiis.data('autoplay')) { 3026 if ( !thiis.closest('.sticky-element').length ) { 3027 thiis.trigger('stop.autoplay.owl'); 3028 } else { 3029 thiis.trigger('play.owl.autoplay'); 3030 } 3031 } 3032 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 3033 return; 3034 } 3035 if ( ! thiis.closest('.sticky-element').length ) { 3036 var carouselInView = new Waypoint.Inview({ 3037 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3038 element: thiis[0], 3039 exited: function() { 3040 var el = $(this.element); 3041 if (el.data('autoplay') ) { 3042 el.trigger('stop.owl.autoplay'); 3043 el.data('stopped','true'); 3044 } 3045 }, 3046 enter: function(direction) { 3047 var el = $(this.element); 3048 requestTimeout(function() { 3049 if (el.data('autoplay')) { 3050 el.trigger('play.owl.autoplay'); 3051 el.data('stopped','false'); 3052 } 3053 }, 100); 3054 } 3055 }); 3056 } 3057 }); 3058 //} 3059 3060 // $(window).on('frontend:carousel_updated', function(){ 3061 // Waypoint.refreshAll(); 3062 // }); 3063 3064 if (!thiis.closest('.isotope-system').length) { 3065 requestTimeout(function() { 3066 animate_thumb($('.t-inside', el), event); 3067 }, 400); 3068 } else { 3069 requestTimeout(function() { 3070 thiis.closest('.isotope-container').isotope('layout'); 3071 }, 400); 3072 } 3073 3074 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3075 currentIndex = $(currentItem).attr('data-index'); 3076 3077 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3078 if ($(val).closest('.uncode-slider').length) { 3079 $(val).removeClass('start_animation'); 3080 } 3081 }); 3082 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3083 if ($(val).closest('.uncode-slider').length) { 3084 $(val).removeClass('already-animated'); 3085 } 3086 }); 3087 3088 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3089 if ($(val).closest('.uncode-slider').length) { 3090 $(val).removeAttr('data-animated'); 3091 } 3092 }); 3093 3094 $.each($('.owl-item.cloned', thiis), function(index, val) {
3095 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 3096 }); 3097 3098 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3099 if ($(val).attr('data-index') != currentIndex) { 3100 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3101 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3102 } 3103 if ($(val).attr('data-index') != currentIndex) { 3104 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 3105 } 3106 if ($(val).attr('data-index') == currentIndex) { 3107 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3108 } 3109 }); 3110 3111 if (thiis.closest('.uncode-slider').length) { 3112 var el = thiis.closest('.row-parent')[0]; 3113 if ($(el).data('imgready')) { 3114 firstLoaded(el, event); 3115 } else { 3116 el.addEventListener("imgLoaded", function(el) { 3117 firstLoaded(el.target, event); 3118 }, false); 3119 } 3120 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 3121 if (transHeight != null) { 3122 requestTimeout(function() { 3123 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 3124 }, 100); 3125 } 3126 } else { 3127 var el = thiis; 3128 el.closest('.uncode-slider').addClass('slider-loaded'); 3129 } 3130 3131 requestTimeout(function() { 3132 if (typeof UNCODE.bigText !== 'undefined') { 3133 UNCODE.bigText(thiis); 3134 } 3135 if (thiis.closest('.uncode-slider').length) { 3136 if (thiis.data('autoplay')) pauseOnHover(thiis); 3137 } 3138 }, 500); 3139 3140 if (thiis.closest('.unequal').length) { 3141 $owlInsideEqual.push(thiis.closest('.row-parent')); 3142 } 3143 3144 var containerClasses = '', 3145 containerStyle = ''; 3146 if ( $('.owl-dots-classes', $owlContainer).length ) { 3147 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 3148 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 3149 $('.owl-dots-classes', $owlContainer).remove(); 3150 } 3151 3152 if ( containerClasses !== '' ) { 3153 requestTimeout(function() { 3154 if ( containerClasses !== '' ) 3155 $('.owl-dots', $owlContainer).attr('style', containerStyle); 3156 if ( containerStyle !== '' ) 3157 $('.owl-dots', $owlContainer).addClass(containerClasses); 3158 }, 100); 3159 } 3160 3161 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 3162 $(val).closest('.row-inner').css({ 3163 'margin-top': '-1px' 3164 }); 3165 }); 3166 3167 if ($.fn.isotope) { 3168 if ( thiis.closest('.isotope-container').length ) { 3169 if (thiis.closest('.isotope-container').data('isotope')) { 3170 requestTimeout(function(){ 3171 thiis.closest('.isotope-container').isotope('layout'); 3172 }, 300); 3173 } 3174 $(window).on('load', function(){ 3175 if (thiis.closest('.isotope-container').data('isotope')) { 3176 thiis.closest('.isotope-container').isotope('layout'); 3177 } 3178 }); 3179 } 3180 } 3181 3182 if (thiis.data('autoplay')) { 3183 $(window).on('menuOpen', function(){ 3184 thiis.trigger('stop.owl.autoplay'); 3185 thiis.data('stopped','true'); 3186 }).on('menuClose', function(){ 3187 3188 }); 3189 } 3190 $(window).on('menuClose', function(){ 3191 if (thiis.data('autoplay')) { 3192 thiis.trigger('play.owl.autoplay'); 3193 thiis.data('stopped','false'); 3194 } 3195 }); 3196 3197 setIndexActive(event, true); 3198 3199 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3200 return !$(this).closest('.nested-carousel').length; 3201 }), 3202 $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); 3203 3204 3205 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 3206 UNCODE.lightgallery( $galleries ); 3207 } 3208 3209 3210 }); 3211 3212 $elSelector.on('resized.owl.carousel', function(event) { 3213 var thiis = $(event.currentTarget); 3214 // if ($(this).closest('.nested-carousel').length) { 3215 // requestTimeout(function() { 3216 // window.dispatchEvent(UNCODE.boxEvent); 3217 // }, 200); 3218 // } 3219 if ( thiis.hasClass('owl-height-equal') ) 3220 setItemsHeight(thiis); 3221 3222 setItemsRelHeight($elSelector); 3223 3224 setIndexActive(event); 3225
3226 if (SiteParameters.dynamic_srcset_active === '1') { 3227 UNCODE.refresh_dynamic_srcset_size(thiis); 3228 } 3229 3230 if ($.fn.isotope) { 3231 $(window).on('load', function(){ 3232 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 3233 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 3234 } 3235 }); 3236 } 3237 }); 3238 3239 /** detect resize window for fluid height layout */ 3240 var setFluidResize; 3241 function manageFluidCarouseHeight() { 3242 clearRequestTimeout(setFluidResize); 3243 setFluidResize = requestTimeout(function(){ 3244 setItemsRelHeight($elSelector); 3245 }, 100); 3246 } 3247 window.addEventListener('resize', manageFluidCarouseHeight); 3248 3249 /** Change */ 3250 $elSelector.on('change.owl.carousel', function(event) { 3251 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 3252 }); 3253 3254 /** Changed */ 3255 $elSelector.on('changed.owl.carousel', function(event) { 3256 var $row = $elSelector.parents('.row')[0]; 3257 if ( typeof $row !== 'undefined' ) { 3258 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 3259 } 3260 setIndexActive(event); 3261 }); 3262 3263 var checkDrag = function(e) { 3264 $elSelector.addClass('owl-dragging'); 3265 }; 3266 $elSelector.on('drag.owl.carousel', function(event) { 3267 document.addEventListener("mousemove", checkDrag); 3268 }); 3269 3270 $elSelector.on('dragged.owl.carousel', function(event) { 3271 $elSelector.removeClass('owl-dragging'); 3272 document.removeEventListener("mousemove", checkDrag); 3273 }); 3274 3275 $elSelector.on('translate.owl.carousel', function(event) { 3276 if (UNCODE.isMobile) { 3277 $(event.currentTarget).addClass('owl-translating'); 3278 } 3279 }); 3280 3281 /** Translated */ 3282 $elSelector.on('translated.owl.carousel', function(event) { 3283 3284 var thiis = $(event.currentTarget), 3285 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3286 currentIndex = $(currentItem).attr('data-index'), 3287 stagePadding = thiis.data('stagepadding'); 3288 3289 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3290 3291 if (!UNCODE.isMobile) { 3292 UNCODE.owlPlayVideo(thiis); 3293 } 3294 3295 requestTimeout(function(){ 3296 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 3297 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 3298 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 3299 if (lastDelayElems == undefined) lastDelayElems = 0; 3300 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3301 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3302 thiis.trigger('stop.owl.autoplay'); 3303 requestTimeout(function() { 3304 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 3305 }, maxDelay); 3306 } 3307 }, 200); 3308 3309 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3310 if ($(val).closest('.uncode-slider').length) { 3311 $(val).removeClass('start_animation'); 3312 } 3313 }); 3314 3315 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3316 if ($(val).closest('.uncode-slider').length) { 3317 $(val).removeClass('already-animated'); 3318 } 3319 }); 3320 3321 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3322 if ($(val).closest('.uncode-slider').length) { 3323 $(val).removeAttr('data-animated'); 3324 } 3325 }); 3326 3327 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3328 if ($(val).attr('data-index') != currentIndex) { 3329 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3330 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3331 } 3332 if ($(val).attr('data-index') != currentIndex) { 3333 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 3334 } 3335 if ($(val).attr('data-index') == currentIndex) { 3336 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3337 } 3338 }); 3339 3340 if (UNCODE.isMobile) { 3341 thiis.removeClass('owl-translating'); 3342 } 3343 3344 setIndexActive(event); 3345 }); 3346 3347 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 3348 3349 /** Init carousel */ 3350 $elSelector.not('.showControls').owlCarousel({ 3351 items: values['items'], 3352 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 3353 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 3354 nav: values['nav'], 3355 dots: values['dots'], 3356 loop: values['loop'], 3357 stagePadding: values['stagepadding'], 3358 margin: 0, 3359 video: true, 3360 autoWidth: false, 3361 autoplay: false, 3362 autoplayTimeout: values['timeout'], 3363 autoplaySpeed: values['navspeed'], 3364 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 3365 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 3366 rtl: $('body').hasClass('rtl') ? true : false, 3367 fluidSpeed: true, 3368 navSpeed: values['navspeed'], 3369 dotsSpeed: values['navspeed'] / values['items'], 3370 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 3371 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>'], 3372 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 3373 responsiveClass: true, 3374 responsiveBaseElement: '.box-container', 3375 responsive: { 3376 0: { 3377 items: values['sm'], 3378 nav: values['navmobile'], 3379 dots: values['dotsmobile'], 3380 dotsSpeed: values['navspeed'] / values['sm'], 3381 }, 3382 480: { 3383 items: values['sm'], 3384 nav: values['navmobile'], 3385 dots: values['dotsmobile'], 3386 dotsSpeed: values['navspeed'] / values['sm'], 3387 }, 3388 570: { 3389 items: values['md'], 3390 nav: values['navmobile'], 3391 dots: values['dotsmobile'], 3392 dotsSpeed: values['navspeed'] / values['md'], 3393 }, 3394 960: { 3395 items: values['lg'], 3396 dotsSpeed: values['navspeed'] / values['lg'], 3397 } 3398 } 3399 }); 3400 3401 var transDuration = parseFloat(values['navspeed']) * 0.3; 3402 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 3403 3404 $('.owl-item .tmb', $elSelector).css({ 3405 '-webkit-transition-delay': transDuration + 'ms', 3406 '-moz-transition-delay': transDuration + 'ms', 3407 '-o-transition-delay': transDuration + 'ms', 3408 'transition-delay': transDuration + 'ms', 3409 '-webkit-transition-duration': transDuration2 + 'ms', 3410 '-moz-transition-duration': transDuration2 + 'ms', 3411 '-o-transition-duration': transDuration2 + 'ms', 3412 'transition-duration': transDuration2 + 'ms', 3413 }); 3414 3415 requestTimeout(function() { 3416 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 3417 UNCODE.setRowHeight($owlInsideEqual[i]); 3418 }; 3419 }, 300); 3420 3421 $(window).on('load', function(){ 3422 var $elCarousel = $elSelector.data('owl.carousel'); 3423 if ( typeof $elCarousel !== 'undefined' ) { 3424 $elCarousel.trigger('refreshed'); 3425 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 3426 UNCODE.setRowHeight($owlInsideEqual[i]); 3427 }; 3428 } 3429 }); 3430 3431 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 3432 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 3433 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 3434 $('#' + carousel_id).find('.owl-item').each( function() { 3435 var $item = $(this), 3436 index = ( $item.index() + 1 ); 3437 $item.attr('data-index', index); 3438 }); 3439 } 3440 }); 3441 3442 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3443 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 3444 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 3445 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 3446 $('#' + carousel_id).find('.owl-item').each( function() { 3447 var $item = $(this), 3448 index = ( $item.index() + 1 ); 3449 $item.attr('data-index', index); 3450 }); 3451 } 3452 }); 3453 } 3454 3455 }); 3456 3457 function firstLoaded(el, event) { 3458 var el = $(el), 3459 uncode_slider = el.find('.uncode-slider'); 3460 el.find('.owl-carousel').css('opacity', 1); 3461 uncode_slider.addClass('slider-loaded'); 3462 if (typeof UNCODE.bigText !== 'undefined') { 3463 UNCODE.bigText(el.find('.owl-item.active')); 3464 } 3465 //if (!UNCODE.isMobile) { 3466 requestTimeout(function() { 3467 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 3468 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 3469 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 3470 if (lastDelayElems == undefined) lastDelayElems = 0; 3471 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3472 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3473 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 3474 requestTimeout(function() { 3475 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 3476 }, maxDelay); 3477 } 3478 }, 500); 3479 3480 //} 3481 } 3482 3483 function navHover(el) { 3484 var $owlCont = el, 3485 $owlPrev = $owlCont.find('.owl-prev'), 3486 $owlNext = $owlCont.find('.owl-next'), 3487 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 3488 $owlPagination = $owlCont.next(), 3489 owlPrevW = $owlPrev.outerWidth(), 3490 owlNextW = $owlNext.outerWidth(), 3491 owlDotsH = $owlDots.innerHeight(), 3492 owlTime = 400, 3493 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3494 if ( $('body').hasClass('rtl') ) { 3495 $owlPrev.css("margin-right", -owlPrevW); 3496 $owlNext.css("margin-left", -owlNextW); 3497 } else { 3498 $owlPrev.css("margin-left", -owlPrevW); 3499 $owlNext.css("margin-right", -owlNextW); 3500 } 3501 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 3502 $owlCont.mouseenter(function() { 3503 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3504 $owlPrev.add($owlNext).css({ 3505 marginLeft: 0, 3506 marginRight: 0 3507 }); 3508 if (!owlNested) { 3509 $owlDots.css({ 3510 opacity: 1, 3511 bottom: 0 3512 }); 3513 } 3514 }).mouseleave(function() { 3515 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3516 if ( $('body').hasClass('rtl') ) { 3517 $owlPrev.css("margin-right", -owlPrevW); 3518 $owlNext.css("margin-left", -owlNextW); 3519 } else { 3520 $owlPrev.css("margin-left", -owlPrevW); 3521 $owlNext.css("margin-right", -owlNextW); 3522 } 3523 if (!owlNested) { 3524 $owlDots.css({ 3525 opacity: 1, 3526 bottom: -owlDotsH 3527 }); 3528 } 3529 }); 3530 }; 3531 3532 function animate_elems($this) { 3533 var lastDelay; 3534 $.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) { 3535 var element = $(val), 3536 delayAttr = element.attr('data-delay'), 3537 $first_item = element.closest('.owl-item[data-index="1"]'); 3538 3539 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 3540 return false;
3541 } 3542 3543 if (delayAttr == undefined) delayAttr = 0; 3544 requestTimeout(function() { 3545 element.addClass('start_animation'); 3546 }, delayAttr); 3547 lastDelay = delayAttr; 3548 }); 3549 return lastDelay; 3550 } 3551 3552 function animate_thumb(items, event) { 3553 var lastDelay, 3554 itemIndex, 3555 thiis = $(event.currentTarget), 3556 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 3557 numActives = $('.owl-item.active', thiis).length, 3558 stagePadding = thiis.data('stagepadding'); 3559 3560 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3561 3562 thiis.data('tempIndex', event.item.index); 3563 $.each(items, function(index, val) { 3564 var parent = $(val).closest('.owl-item'); 3565 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3566 return; 3567 } 3568 if (!$(val).hasClass('start_animation')) { 3569 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 3570 var thumbInView = new Waypoint.Inview({ 3571 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3572 element: val, 3573 enter: function(direction) { 3574 var element = $(this.element), 3575 delayAttr = parseInt(element.attr('data-delay')), 3576 itemIndex = element.closest('.owl-item').index() + 1, 3577 diffItem = Math.abs(itemIndex - tempIndex) - 1; 3578 if (itemIndex > tempIndex) { 3579 thiis.data('tempIndex', itemIndex); 3580 } 3581 if (isNaN(delayAttr)) delayAttr = 100; 3582 if (stagePadding) { 3583 var objTimeout = requestTimeout(function() { 3584 element.addClass('start_animation'); 3585 }, index * delayAttr); 3586 lastDelay = index * delayAttr; 3587 } else { 3588 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 3589 var objTimeout = requestTimeout(function() { 3590 element.addClass('start_animation'); 3591 }, diffItem * delayAttr); 3592 lastDelay = diffItem * delayAttr; 3593 } 3594 parent.data('objTimeout', objTimeout); 3595 if (!UNCODE.isUnmodalOpen) { 3596 this.destroy(); 3597 } 3598 } 3599 }); 3600 } 3601 } 3602 }); 3603 return lastDelay; 3604 } 3605 3606 function setItemsHeight(item) { 3607 $.each($('.owl-item', item), function(index, val) { 3608 var availableThumbHeight = $('.t-inside', $(val)).height(), 3609 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 3610 difference = availableThumbHeight - innerThumbHeight; 3611 if ($('.tmb-content-under', val).length) { 3612 var visualPart = $('.t-entry-visual', val); 3613 if (visualPart.length) { 3614 difference -= $('.t-entry-visual', val).height(); 3615 } 3616 } 3617 if (! $('.tmb-content-lateral', val).length) 3618 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 3619 }); 3620 } 3621 3622 function setItemsRelHeight(item) { 3623 $.each($('.owl-item', item), function(index, val) { 3624 var $rowContainer = $(item).parents('.row-parent').eq(0), 3625 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 3626 $colContainer = $(item).parents('.uncell').eq(0), 3627 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 3628 winHeight = UNCODE.wheight, 3629 multiplier_h = parseInt($(item).attr('data-vp-height')), 3630 data_viewport_h, 3631 consider_menu = $(item).data('vp-menu'); 3632 3633 if ( consider_menu ) { 3634 winHeight = winHeight - UNCODE.menuHeight; 3635 } 3636 3637 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 3638 $('.t-inside', val).css( 'height', data_viewport_h ); 3639 }); 3640 } 3641 3642 function pauseOnHover(slider) { 3643 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 3644 mouseenter: function () { 3645 $(slider).addClass('owl-mouseenter'); 3646 $(slider).trigger('stop.owl.autoplay'); 3647 }, 3648 mouseleave: function () { 3649 $(slider).removeClass('owl-mouseenter'); 3650 $(slider).trigger('play.owl.autoplay'); 3651 } 3652 }); 3653 } 3654 }); 3655}; 3656 3657UNCODE.owlPlayVideo = function(carousel) { 3658 var player, iframe; 3659 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 3660 var content = $(val).html(); 3661 if (content == '') { 3662 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 3663 $(val).append(getCloned); 3664 } 3665 if ($(this).attr('data-provider') == 'vimeo') { 3666 iframe = $(this).find('iframe'); 3667 player = new Vimeo.Player(iframe[0]); 3668 player.play(); 3669 } else if ($(this).attr('data-provider') == 'youtube') { 3670 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 3671 } else { 3672 var player = $(this).find('video'); 3673 if (player.length) { 3674 $(this).find('video')[0].volume = 0; 3675 $(this).find('video')[0].play(); 3676 $(val).css('opacity', 1); 3677 } 3678 } 3679 }); 3680}; 3681 3682UNCODE.owlStopVideo = function(carousel) { 3683 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 3684 var player, iframe; 3685 if ($(this).attr('data-provider') == 'vimeo') { 3686 iframe = $(this).find('iframe'); 3687 player = new Vimeo.Player(iframe[0]); 3688 player.pause(); 3689 } else if ($(this).attr('data-provider') == 'youtube') { 3690 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 3691 } else { 3692 var player = $(this).find('video'); 3693 if (player.length) { 3694 $(this).find('video')[0].volume = 0; 3695 $(this).find('video')[0].play(); 3696 } 3697 } 3698 }); 3699}; 3700 3701UNCODE.animations = function() { 3702 3703 var runWaypoints_TO, 3704 runWaypoints_carousel_TO, 3705 runWaypoints_delay = 0, 3706 highlightComplexFunc = function($wrap, ev){ 3707 3708 var $lines = $('.heading-line-wrap', $wrap), 3709 not_animate = false;
3710 3711 if ( $wrap.data('animate') === true ) { 3712 not_animate = true; 3713 } 3714 3715 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 3716 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 3717 return; 3718 } 3719 3720 $lines.each(function(_key, _value){ 3721 var $line = $(_value), 3722 $inners = $('.split-word-inner', $line), 3723 $highlights = $('.heading-text-highlight-inner', $line); 3724 3725 var highlitInnerFunc = function(ev){ 3726 var delay = 0; 3727 $highlights.each(function(h_key, high){ 3728 var $highlight = $(high), 3729 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 3730 $nextSplit = $split.nextUntil(), 3731 $next = $('.heading-text-highlight-inner', $nextSplit), 3732 countCh = $split.text().length; 3733 3734 $highlight.css({ 3735 '-webkit-transition-duration': (30 * countCh) + 'ms', 3736 '-moz-transition-duration': (30 * countCh) + 'ms', 3737 '-o-transition-duration': (30 * countCh) + 'ms', 3738 'transition-duration': (30 * countCh) + 'ms', 3739 }); 3740 3741 delay += (30 * countCh); 3742 3743 $next.css({ 3744 '-webkit-transition-delay': delay + 'ms', 3745 '-moz-transition-delay': delay + 'ms', 3746 '-o-transition-delay': delay + 'ms', 3747 'transition-delay': delay + 'ms', 3748 }); 3749 }); 3750 $highlights.removeAttr('data-animated'); 3751 if ( _key+1 === $lines.length ) { 3752 $wrap.data('animate', true); 3753 } 3754 }; 3755 3756 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 3757 if ( not_animate ) { 3758 $highlights.each(function(h_key, high){ 3759 var $highlight = $(high); 3760 $highlight.css({ 3761 '-webkit-transition-duration': '0ms', 3762 '-moz-transition-duration': '0ms', 3763 '-o-transition-duration': '0ms', 3764 'transition-duration': '0ms', 3765 }); 3766 }); 3767 $highlights.removeAttr('data-animated'); 3768 } else { 3769 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 3770 highlitInnerFunc(); 3771 } else { 3772 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 3773 } 3774 } 3775 } 3776 }); 3777 }; 3778 3779 $.each($('.header-content-inner'), function(index, val) { 3780 var element = $(val), 3781 transition = ''; 3782 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 3783 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 3784 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 3785 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 3786 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 3787 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 3788 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 3789 if (transition != '') { 3790 $(val).removeClass(transition); 3791 var container = element, 3792 containerDelay = container.attr('data-delay'), 3793 containerSpeed = container.attr('data-speed'), 3794 items = $('.header-title > *, .post-info', container); 3795 $.each(items, function(index, val) { 3796 var element = $(val), 3797 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 3798 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 3799 if (!element.hasClass('animate_when_almost_visible')) { 3800 delayAttr = Number(delayAttr) + (400 * index); 3801 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 3802 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 3803 } 3804 }); 3805 container.css('opacity', 1); 3806 } 3807 }); 3808 3809 function animate_css_grids_on_load() { 3810 $('.cssgrid-system').each(function() { 3811 var grid = $(this); 3812 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 3813 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 3814 }); 3815 } 3816 3817 window.waypoint_animation = function(ev) { 3818 $.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) { 3819 if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length ) && !SiteParameters.is_frontend_editor ) ) { 3820 return true; 3821 } 3822 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3823 return; 3824 } 3825 var run = true, 3826 $carousel = $(val).closest('.owl-carousel'); 3827 if ( $carousel.length ) { 3828 run = false;
3829 } 3830 if (run) { 3831 new Waypoint({ 3832 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3833 element: val, 3834 handler: function() { 3835 var element = $(this.element), 3836 index = element.index(), 3837 delayAttr = element.attr('data-delay'); 3838 if (delayAttr == undefined) delayAttr = 0; 3839 requestTimeout(function() { 3840 element.addClass('start_animation'); 3841 }, delayAttr); 3842 if (!UNCODE.isUnmodalOpen) { 3843 this.destroy(); 3844 } 3845 }, 3846 offset: UNCODE.isFullPage ? '100%' : '90%' 3847 }); 3848 } 3849 }); 3850 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 3851 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3852 return; 3853 } 3854 var run = true, 3855 $carousel = $(val).closest('.owl-carousel'); 3856 if ( $carousel.length ) { 3857 run = false; 3858 } 3859 if (run) { 3860 new Waypoint({ 3861 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3862 element: val, 3863 handler: function() { 3864 var $element = $(this.element), 3865 $childs = $('.animate_when_parent_almost_visible', $element); 3866 $childs.each(function(key,el){ 3867 var $child = $(el), 3868 delaySpeed = $child.attr('data-speed'), 3869 delayAttr = $child.attr('data-delay'), 3870 intervalAttr = $child.attr('data-interval'); 3871 if (delayAttr == undefined) { 3872 delayAttr = 50*key; 3873 } 3874 requestTimeout(function() { 3875 $child.addClass('start_animation'); 3876 if ( $child.hasClass('anim-line-checker') ) { 3877 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3878 var $line = $child.closest('.heading-line-wrap'); 3879 }); 3880 } 3881 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3882 highlightComplexFunc($wrapText, ev); 3883 if ( $child.hasClass('anim-tot-checker') ) { 3884 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3885 if ( $child.hasClass('anim-tot-checker') ) { 3886 $wrapText.addClass('already-animated'); 3887 $element.trigger('already-animated'); 3888 } 3889 }); 3890 } 3891 }, delayAttr ); 3892 }); 3893 $element.addClass('start_animation'); 3894 if (!UNCODE.isUnmodalOpen) { 3895 this.destroy(); 3896 } 3897 }, 3898 offset: UNCODE.isFullPage ? '100%' : '90%' 3899 }); 3900 } 3901 }); 3902 } 3903 window.waypoint_carousel_animation = function(ev) { 3904 $.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) { 3905 if ( $(val).hasClass('el-text-split') ) { 3906 return true; 3907 } 3908 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3909 return; 3910 } 3911 var run = true, 3912 $carousel = $(val).closest('.owl-carousel'), 3913 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3914 $all_first = $('.owl-item[data-index="1"]', $carousel); 3915 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3916 run = false; 3917 } 3918 if (run) { 3919 new Waypoint({ 3920 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3921 element: val, 3922 handler: function() { 3923 var element = $(this.element), 3924 index = element.index(), 3925 delayAttr = element.attr('data-delay'); 3926 if (delayAttr == undefined) delayAttr = 0; 3927 requestTimeout(function() { 3928 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3929 $all_first.attr('data-already-reached', 'true'); 3930 } 3931 element.addClass('start_animation'); 3932 }, delayAttr); 3933 if (!UNCODE.isUnmodalOpen) { 3934 this.destroy(); 3935 } 3936 }, 3937 offset: UNCODE.isFullPage ? '100%' : '90%' 3938 }); 3939 } 3940 }); 3941 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 3942 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3943 return; 3944 } 3945 var run = true, 3946 $carousel = $(val).closest('.owl-carousel'), 3947 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3948 $all_first = $('.owl-item[data-index="1"]', $carousel); 3949 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3950 run = false;
3951 } 3952 if (run) { 3953 new Waypoint({ 3954 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3955 element: val, 3956 handler: function() { 3957 var $element = $(this.element), 3958 $childs = $('.animate_when_parent_almost_visible', $element); 3959 $childs.each(function(key,el){ 3960 var $child = $(el), 3961 delaySpeed = $child.attr('data-speed'), 3962 delayAttr = $child.attr('data-delay'), 3963 intervalAttr = $child.attr('data-interval'); 3964 if (delayAttr == undefined) { 3965 delayAttr = 50*key; 3966 } 3967 requestTimeout(function() { 3968 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3969 $all_first.attr('data-already-reached', 'true'); 3970 } 3971 $child.addClass('start_animation'); 3972 if ( $child.hasClass('anim-line-checker') ) { 3973 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3974 var $line = $child.closest('.heading-line-wrap'); 3975 }); 3976 } 3977 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3978 highlightComplexFunc($wrapText, ev); 3979 if ( $child.hasClass('anim-tot-checker') ) { 3980 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3981 if ( $child.hasClass('anim-tot-checker') ) { 3982 $wrapText.addClass('already-animated'); 3983 } 3984 }); 3985 } 3986 }, delayAttr ); 3987 }); 3988 $element.addClass('start_animation'); 3989 if (!UNCODE.isUnmodalOpen) { 3990 this.destroy(); 3991 } 3992 }, 3993 offset: UNCODE.isFullPage ? '100%' : '90%' 3994 }); 3995 } 3996 }); 3997 } 3998 3999 var runWaypoints = function(ev){ 4000 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 4001 runWaypoints_delay = 400; 4002 } 4003 clearRequestTimeout(runWaypoints_TO); 4004 runWaypoints_TO = requestTimeout(function() { 4005 window.waypoint_animation(ev); 4006 }, runWaypoints_delay); 4007 4008 clearRequestTimeout(runWaypoints_carousel_TO); 4009 runWaypoints_carousel_TO = requestTimeout(function() { 4010 window.waypoint_carousel_animation(ev); 4011 }, 400); 4012 }; 4013 runWaypoints(); 4014 animate_css_grids_on_load(); 4015 4016 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 4017 runWaypoints(ev); 4018 }); 4019 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4020 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 4021 } 4022}; 4023 4024UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 4025 var $allItems = elements.length - startIndex, 4026 showed = 0, 4027 index = 0, 4028 use_index = false 4029 ; 4030 4031 if (filtering) { 4032 if (sequential) { 4033 use_index = true; 4034 } 4035 sequential = false; 4036 } 4037 4038 $.each(elements, function(index, val) { 4039 var $this = $(val), 4040 elInner = $('> .t-inside', val); 4041 4042 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4043 return; 4044 } 4045 if (val[0]) val = val[0]; 4046 4047 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4048 new Waypoint({ 4049 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4050 element: val, 4051 handler: function() { 4052 var element = $('> .t-inside', this.element), 4053 parent = $(this.element); 4054 var _index = use_index? index : 0; 4055 4056 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 4057 delayAttr = parseInt(element.attr('data-delay')); 4058 if (isNaN(delayAttr)) delayAttr = 100; 4059 if (sequential || use_index) { 4060 delay -= showed; 4061 } 4062 var objTimeout = requestTimeout(function() { 4063 element.removeClass('zoom-reverse').addClass('start_animation'); 4064 showed = index; 4065 }, delay * delayAttr); 4066 parent.data('objTimeout', objTimeout); 4067 if (!UNCODE.isUnmodalOpen) { 4068 this.destroy(); 4069 } 4070 }, 4071 offset: UNCODE.isFullPage ? '100%' : '90%' 4072 }); 4073 } 4074 4075 index++; 4076 }); 4077}; 4078 4079UNCODE.tapHover = function() { 4080 4081 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 4082 elClass = "hover"; 4083 4084 $(window).on('click', function() { 4085 $el.removeClass(elClass); 4086 }); 4087 4088 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 4089 e.stopPropagation(); 4090 var link = $(this); 4091 if ( ! link.hasClass(elClass)) { 4092 e.preventDefault(); 4093 link.addClass("hover"); 4094 $el.not(this).removeClass(elClass); 4095 return false;
4096 } 4097 }); 4098}; 4099 4100UNCODE.onePage = function(isMobile) { 4101 var current = 0, 4102 last = 0, 4103 lastScrollTop = 0, 4104 forceScroll = false, 4105 lastScrolled = 0, 4106 isSectionscroller = ($('.main-onepage').length) ? true : false, 4107 isOnePage = false, 4108 getOffset = function () { 4109 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); 4110 return calculateOffset; 4111 } 4112 4113 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 4114 // return false; 4115 4116 function init_onepage() { 4117 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 4118 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4119 } 4120 last = $('.onepage-pagination li').last().find('a').data('index'); 4121 $.each($('div[data-parent="true"]'), function(index, val) { 4122 $(this).attr('data-section', index); 4123 if (isMobile) return; 4124 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4125 return; 4126 } 4127 var sectionDown = new Waypoint({ 4128 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4129 element: val, 4130 handler: function(direction) { 4131 if (direction == 'down') { 4132 changeMenuActive(this.element, index); 4133 } 4134 }, 4135 offset: function() { 4136 return 5 + getOffset() 4137 } 4138 }); 4139 var sectionUp = new Waypoint({ 4140 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4141 element: val, 4142 handler: function(direction) { 4143 if (direction == 'up') { 4144 changeMenuActive(this.element, index); 4145 } 4146 }, 4147 offset: function() { 4148 return -5 - getOffset() 4149 } 4150 }); 4151 4152 if (isSectionscroller) { 4153 var label; 4154 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 4155 else label = ''; 4156 var getName = $(this).attr('data-name'); 4157 if (getName == undefined) getName = index; 4158 if (label != '') { 4159 isOnePage = true; 4160 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 4161 $('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>"); 4162 } 4163 } 4164 }); 4165 4166 if (isSectionscroller) { 4167 $.each($('ul.onepage-pagination li'), function(index, val) { 4168 var $this = $(val), 4169 $a = ('a', $this); 4170 $a.on('click', function(evt) { 4171 if ( $('.is-selected', $this).length ) { 4172 return false; 4173 } 4174 if ( $('body').hasClass('uncode-scroll-no-history') ) { 4175 evt.preventDefault(); 4176 } 4177 Waypoint.refreshAll(); 4178 var el = $('a', evt.currentTarget); 4179 current = lastScrolled = parseInt(el.attr('data-index')); 4180 lastScrolled += 1; 4181 scrollBody(current); 4182 }); 4183 }); 4184 } 4185 4186 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 4187 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 4188 goToSection = String(window.location.hash).replace(/^#/, ""); 4189 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 4190 } 4191 4192 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 4193 current = lastScrolled = goToSection; 4194 $(window).on('load', function(){ 4195 if ( $('.owl-carousel').length ) { 4196 requestTimeout(function(){ 4197 scrollBody(goToSection); 4198 }, 400); 4199 } else { 4200 scrollBody(goToSection); 4201 } 4202 }); 4203 } 4204 4205 } 4206 4207 function changeMenuActive(section, index) { 4208 current = lastScrolled = parseInt($(section).attr('data-section')); 4209 if (isOnePage) { 4210 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 4211 if (newSection.length) { 4212 $('ul.onepage-pagination li a').removeClass('is-selected'); 4213 newSection.addClass('is-selected'); 4214 } 4215 var getName = $('[data-section="' + index + '"]').attr('data-name'); 4216 if (getName != undefined && getName !== '') { 4217 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 4218 var get_href = $(val).attr('href'); 4219 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4220 $(val).closest('.menu-smart').find('.active').removeClass('active'); 4221 $(val).parent().addClass('active'); 4222 } 4223 }); 4224 } 4225 } 4226 } 4227 4228 if (isOnePage) { 4229 $(window).on('scroll', function() { 4230 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 4231 if (bodyTop == 0) { 4232 $('ul.onepage-pagination li a').removeClass('is-selected'); 4233 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 4234 var getName = $('[data-section=0]').attr('data-name'); 4235 if (getName != undefined && getName !== '') { 4236 $.each($('.menu-container .menu-item > a'), function(i, val) { 4237 var get_href = $(val).attr('href'); 4238 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4239 $(val).closest('ul').find('.active').removeClass('active'); 4240 $(val).parent().addClass('active'); 4241 } 4242 }); 4243 } 4244 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 4245 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 4246 if (lastSection.length) { 4247 $('ul.onepage-pagination li a').removeClass('is-selected'); 4248 lastSection.addClass('is-selected'); 4249 } 4250 } 4251 }); 4252 } 4253 4254 var scrollBody = function(index) { 4255 $('ul.onepage-pagination li a').removeClass('is-selected'); 4256 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 4257 4258 var getSection = $('[data-section=' + index + ']'), 4259 scrollTo; 4260 4261 if (getSection == undefined) return; 4262 4263 var body = $("html, body"), 4264 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4265 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 4266 getOffset = UNCODE.get_scroll_offset(index); 4267 if ( typeof getSection.offset() === 'undefined' ) 4268 return; 4269 scrollTo = getSection.offset().top; 4270
4271 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 4272 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 4273 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 4274 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 4275 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 4276 } 4277 4278 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 4279 if ( index === 0 ) { 4280 scrollTo = 0; 4281 } else { 4282 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 4283 } 4284 } else { 4285 scrollTo -= getOffset; 4286 } 4287 } 4288 4289 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4290 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4291 4292 if (index != 0) { 4293 UNCODE.scrolling = true; 4294 } 4295 4296 if (scrollSpeed == 0) { 4297 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4298 UNCODE.scrolling = false; 4299 } else { 4300 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4301 $(this).stop(); 4302 }).animate({ 4303 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4304 }, scrollSpeed, 'easeInOutCubic', function() { 4305 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4306 UNCODE.scrolling = false; 4307 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 4308 || 4309 $('.menu-hided').length ) { 4310 scrollTo = getSection.offset().top; 4311 getOffset = UNCODE.get_scroll_offset(index); 4312 scrollTo -= getOffset; 4313 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4314 $(this).stop(); 4315 }).animate({ 4316 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4317 }, scrollSpeed, 'easeInOutCubic', function() { 4318 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4319 UNCODE.scrolling = false; 4320 } 4321 ); 4322 } 4323 }); 4324 } 4325 4326 }; 4327 4328 init_onepage(); 4329}; 4330 4331UNCODE.stickyElements = function() { 4332 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 4333 if (!isMobile_wide) { 4334 4335 var $pageHeader = $('#page-header'), 4336 $headerRow = $('.vc_row', $pageHeader), 4337 startSticky = false; 4338 4339 if ( $headerRow.hasClass('sticky-element') ) { 4340 $headerRow.removeClass('sticky-element'); 4341 $pageHeader.addClass('sticky-element'); 4342 startSticky = true; 4343 } 4344 4345 var calculateOffset = function(el) { 4346 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 4347 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 4348 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0; 4349 4350 sideOffset += UNCODE.bodyBorder; 4351 4352 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 4353 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) { 4354 if ($('.menu-shrink').length) { 4355 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 4356 } else { 4357 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 4358 } 4359 } 4360 4361 return sideOffset; 4362 4363 }, 4364 4365 initStickyElement = function() { 4366 $.each($('.sticky-element'), function(index, element) { 4367 $(element).stick_in_parent({ 4368 sticky_class: 'is_stucked', 4369 offset_top: calculateOffset(element), 4370 bottoming: true, 4371 inner_scrolling: SiteParameters.sticky_elements === 'on' 4372 }); 4373 }); 4374 }; 4375 4376 requestTimeout(function() { 4377 if ($('.sticky-element').length) { 4378 4379 if ($(window).width() > UNCODE.mediaQuery) { 4380 initStickyElement(); 4381
4382 if ( startSticky === true ) { 4383 $('#page-header').trigger('sticky_kit:recalc'); 4384 } 4385 } 4386 4387 $(window).on('resize', function(event) { 4388 if ($(window).width() > UNCODE.mediaQuery) { 4389 initStickyElement(); 4390 } else { 4391 $(".sticky-element").trigger("sticky_kit:detach"); 4392 } 4393 }); 4394 } 4395 }, 1000); 4396 4397 if ($('.sticky-element').length) { 4398 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 4399 requestTimeout(function() { 4400 $(document.body).trigger("sticky_kit:recalc"); 4401 }, 100); 4402 }); 4403 } 4404 4405 var $panels = $('.panel-collapse'); 4406 if ( $panels.length ) { 4407 $panels.each(function(){ 4408 var $panel = $(this); 4409 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 4410 $(document.body).trigger("sticky_kit:recalc"); 4411 }); 4412 }); 4413 } 4414 } 4415}; 4416 4417UNCODE.twentytwenty = function() { 4418 4419 if (!$('.twentytwenty-container').length) return; 4420 4421// DOM.event.move 4422// 4423// 2.0.0 4424// 4425// Stephen Band 4426// 4427// Triggers 'movestart', 'move' and 'moveend' events after 4428// mousemoves following a mousedown cross a distance threshold, 4429// similar to the native 'dragstart', 'drag' and 'dragend' events. 4430// Move events are throttled to animation frames. Move event objects 4431// have the properties: 4432// 4433// pageX: 4434// pageY: Page coordinates of pointer. 4435// startX: 4436// startY: Page coordinates of pointer at movestart. 4437// distX: 4438// distY: Distance the pointer has moved since movestart. 4439// deltaX: 4440// deltaY: Distance the finger has moved since last event. 4441// velocityX: 4442// velocityY: Average velocity over last few events. 4443 4444 4445(function(fn) { 4446 if (typeof define === 'function' && define.amd) { 4447 define([], fn); 4448 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 4449 module.exports = fn; 4450 } else { 4451 fn(); 4452 } 4453})(function(){ 4454 var assign = Object.assign || window.jQuery && jQuery.extend; 4455 4456 // Number of pixels a pressed pointer travels before movestart 4457 // event is fired. 4458 var threshold = 8; 4459 4460 // Shim for requestAnimationFrame, falling back to timer. See: 4461 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 4462 var requestFrame = (function(){ 4463 return ( 4464 window.requestAnimationFrame || 4465 window.webkitRequestAnimationFrame || 4466 window.mozRequestAnimationFrame || 4467 window.oRequestAnimationFrame || 4468 window.msRequestAnimationFrame || 4469 function(fn, element){ 4470 return window.setTimeout(function(){ 4471 fn(); 4472 }, 25); 4473 } 4474 ); 4475 })(); 4476 4477 // Shim for customEvent 4478 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 4479 (function () { 4480 if ( typeof window.CustomEvent === "function" ) return false; 4481 function CustomEvent ( event, params ) { 4482 params = params || { bubbles: false, cancelable: false, detail: undefined }; 4483 var evt = document.createEvent( 'CustomEvent' ); 4484 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 4485 return evt; 4486 } 4487 4488 CustomEvent.prototype = window.Event.prototype; 4489 window.CustomEvent = CustomEvent; 4490 })(); 4491 4492 var ignoreTags = { 4493 textarea: true, 4494 input: true, 4495 select: true, 4496 button: true 4497 }; 4498 4499 var mouseevents = { 4500 move: 'mousemove', 4501 cancel: 'mouseup dragstart', 4502 end: 'mouseup' 4503 }; 4504 4505 var touchevents = { 4506 move: 'touchmove', 4507 cancel: 'touchend', 4508 end: 'touchend' 4509 }; 4510 4511 var rspaces = /\s+/; 4512 4513 4514 // DOM Events 4515 4516 var eventOptions = { bubbles: true, cancelable: true }; 4517 4518 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 4519 4520 function createEvent(type) { 4521 return new CustomEvent(type, eventOptions); 4522 } 4523 4524 function getEvents(node) { 4525 return node[eventsSymbol] || (node[eventsSymbol] = {}); 4526 } 4527 4528 function on(node, types, fn, data, selector) { 4529 types = types.split(rspaces); 4530 4531 var events = getEvents(node); 4532 var i = types.length; 4533 var handlers, type; 4534 4535 function handler(e) { fn(e, data); } 4536 4537 while (i--) { 4538 type = types[i]; 4539 handlers = events[type] || (events[type] = []); 4540 handlers.push([fn, handler]); 4541 node.addEventListener(type, handler); 4542 } 4543 } 4544 4545 function off(node, types, fn, selector) { 4546 types = types.split(rspaces); 4547 4548 var events = getEvents(node); 4549 var i = types.length;
4550 var type, handlers, k; 4551 4552 if (!events) { return; } 4553 4554 while (i--) { 4555 type = types[i]; 4556 handlers = events[type]; 4557 if (!handlers) { continue; } 4558 k = handlers.length; 4559 while (k--) { 4560 if (handlers[k][0] === fn) { 4561 node.removeEventListener(type, handlers[k][1]); 4562 handlers.splice(k, 1); 4563 } 4564 } 4565 } 4566 } 4567 4568 function trigger(node, type, properties) { 4569 // Don't cache events. It prevents you from triggering an event of a 4570 // given type from inside the handler of another event of that type. 4571 var event = createEvent(type); 4572 if (properties) { assign(event, properties); } 4573 node.dispatchEvent(event); 4574 } 4575 4576 4577 // Constructors 4578 4579 function Timer(fn){ 4580 var callback = fn, 4581 active = false, 4582 running = false; 4583 4584 function trigger(time) { 4585 if (active){ 4586 callback(); 4587 requestFrame(trigger); 4588 running = true; 4589 active = false; 4590 } 4591 else { 4592 running = false; 4593 } 4594 } 4595 4596 this.kick = function(fn) { 4597 active = true; 4598 if (!running) { trigger(); } 4599 }; 4600 4601 this.end = function(fn) { 4602 var cb = callback; 4603 4604 if (!fn) { return; } 4605 4606 // If the timer is not running, simply call the end callback. 4607 if (!running) { 4608 fn(); 4609 } 4610 // If the timer is running, and has been kicked lately, then 4611 // queue up the current callback and the end callback, otherwise 4612 // just the end callback. 4613 else { 4614 callback = active ? 4615 function(){ cb(); fn(); } : 4616 fn ; 4617 4618 active = true; 4619 } 4620 }; 4621 } 4622 4623 4624 // Functions 4625 4626 function noop() {} 4627 4628 function preventDefault(e) { 4629 e.preventDefault(); 4630 } 4631 4632 function isIgnoreTag(e) { 4633 return !!ignoreTags[e.target.tagName.toLowerCase()]; 4634 } 4635 4636 function isPrimaryButton(e) { 4637 // Ignore mousedowns on any button other than the left (or primary) 4638 // mouse button, or when a modifier key is pressed. 4639 return (e.which === 1 && !e.ctrlKey && !e.altKey); 4640 } 4641 4642 function identifiedTouch(touchList, id) { 4643 var i, l; 4644 4645 if (touchList.identifiedTouch) { 4646 return touchList.identifiedTouch(id); 4647 } 4648 4649 // touchList.identifiedTouch() does not exist in 4650 // webkit yet… we must do the search ourselves... 4651 4652 i = -1; 4653 l = touchList.length; 4654 4655 while (++i < l) { 4656 if (touchList[i].identifier === id) { 4657 return touchList[i]; 4658 } 4659 } 4660 } 4661 4662 function changedTouch(e, data) { 4663 var touch = identifiedTouch(e.changedTouches, data.identifier); 4664 4665 // This isn't the touch you're looking for. 4666 if (!touch) { return; } 4667 4668 // Chrome Android (at least) includes touches that have not 4669 // changed in e.changedTouches. That's a bit annoying. Check 4670 // that this touch has changed. 4671 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 4672 4673 return touch; 4674 } 4675 4676 4677 // Handlers that decide when the first movestart is triggered 4678 4679 function mousedown(e){ 4680 // Ignore non-primary buttons 4681 if (!isPrimaryButton(e)) { return; } 4682 4683 // Ignore form and interactive elements 4684 if (isIgnoreTag(e)) { return; } 4685 4686 on(document, mouseevents.move, mousemove, e); 4687 on(document, mouseevents.cancel, mouseend, e); 4688 } 4689 4690 function mousemove(e, data){ 4691 checkThreshold(e, data, e, removeMouse); 4692 } 4693 4694 function mouseend(e, data) { 4695 removeMouse(); 4696 } 4697 4698 function removeMouse() { 4699 off(document, mouseevents.move, mousemove); 4700 off(document, mouseevents.cancel, mouseend); 4701 } 4702 4703 function touchstart(e) { 4704 // Don't get in the way of interaction with form elements 4705 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 4706 4707 var touch = e.changedTouches[0]; 4708 4709 // iOS live updates the touch objects whereas Android gives us copies. 4710 // That means we can't trust the touchstart object to stay the same, 4711 // so we must copy the data. This object acts as a template for 4712 // movestart, move and moveend event objects. 4713 var data = { 4714 target: touch.target, 4715 pageX: touch.pageX, 4716 pageY: touch.pageY, 4717 identifier: touch.identifier, 4718 4719 // The only way to make handlers individually unbindable is by 4720 // making them unique. 4721 touchmove: function(e, data) { touchmove(e, data); }, 4722 touchend: function(e, data) { touchend(e, data); } 4723 }; 4724 4725 on(document, touchevents.move, data.touchmove, data); 4726 on(document, touchevents.cancel, data.touchend, data); 4727 } 4728 4729 function touchmove(e, data) { 4730 var touch = changedTouch(e, data); 4731 if (!touch) { return; } 4732 checkThreshold(e, data, touch, removeTouch); 4733 } 4734 4735 function touchend(e, data) { 4736 var touch = identifiedTouch(e.changedTouches, data.identifier); 4737 if (!touch) { return; } 4738 removeTouch(data); 4739 } 4740 4741 function removeTouch(data) { 4742 off(document, touchevents.move, data.touchmove); 4743 off(document, touchevents.cancel, data.touchend); 4744 } 4745 4746 function checkThreshold(e, data, touch, fn) { 4747 var distX = touch.pageX - data.pageX; 4748 var distY = touch.pageY - data.pageY; 4749
4750 // Do nothing if the threshold has not been crossed. 4751 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 4752 4753 triggerStart(e, data, touch, distX, distY, fn); 4754 } 4755 4756 function triggerStart(e, data, touch, distX, distY, fn) { 4757 var touches = e.targetTouches; 4758 var time = e.timeStamp - data.timeStamp; 4759 4760 // Create a movestart object with some special properties that 4761 // are passed only to the movestart handlers. 4762 var template = { 4763 altKey: e.altKey, 4764 ctrlKey: e.ctrlKey, 4765 shiftKey: e.shiftKey, 4766 startX: data.pageX, 4767 startY: data.pageY, 4768 distX: distX, 4769 distY: distY, 4770 deltaX: distX, 4771 deltaY: distY, 4772 pageX: touch.pageX, 4773 pageY: touch.pageY, 4774 velocityX: distX / time, 4775 velocityY: distY / time, 4776 identifier: data.identifier, 4777 targetTouches: touches, 4778 finger: touches ? touches.length : 1, 4779 enableMove: function() { 4780 this.moveEnabled = true; 4781 this.enableMove = noop; 4782 e.preventDefault(); 4783 } 4784 }; 4785 4786 // Trigger the movestart event. 4787 trigger(data.target, 'movestart', template); 4788 4789 // Unbind handlers that tracked the touch or mouse up till now. 4790 fn(data); 4791 } 4792 4793 4794 // Handlers that control what happens following a movestart 4795 4796 function activeMousemove(e, data) { 4797 var timer = data.timer; 4798 4799 data.touch = e; 4800 data.timeStamp = e.timeStamp; 4801 timer.kick(); 4802 } 4803 4804 function activeMouseend(e, data) { 4805 var target = data.target; 4806 var event = data.event; 4807 var timer = data.timer; 4808 4809 removeActiveMouse(); 4810 4811 endEvent(target, event, timer, function() { 4812 // Unbind the click suppressor, waiting until after mouseup 4813 // has been handled. 4814 setTimeout(function(){ 4815 off(target, 'click', preventDefault); 4816 }, 0); 4817 }); 4818 } 4819 4820 function removeActiveMouse() { 4821 off(document, mouseevents.move, activeMousemove); 4822 off(document, mouseevents.end, activeMouseend); 4823 } 4824 4825 function activeTouchmove(e, data) { 4826 var event = data.event; 4827 var timer = data.timer; 4828 var touch = changedTouch(e, event); 4829 4830 if (!touch) { return; } 4831 4832 // Stop the interface from gesturing 4833 e.preventDefault(); 4834 4835 event.targetTouches = e.targetTouches; 4836 data.touch = touch; 4837 data.timeStamp = e.timeStamp; 4838 4839 timer.kick(); 4840 } 4841 4842 function activeTouchend(e, data) { 4843 var target = data.target; 4844 var event = data.event; 4845 var timer = data.timer; 4846 var touch = identifiedTouch(e.changedTouches, event.identifier); 4847 4848 // This isn't the touch you're looking for. 4849 if (!touch) { return; } 4850 4851 removeActiveTouch(data); 4852 endEvent(target, event, timer); 4853 } 4854 4855 function removeActiveTouch(data) { 4856 off(document, touchevents.move, data.activeTouchmove); 4857 off(document, touchevents.end, data.activeTouchend); 4858 } 4859 4860 4861 // Logic for triggering move and moveend events 4862 4863 function updateEvent(event, touch, timeStamp) { 4864 var time = timeStamp - event.timeStamp; 4865 4866 event.distX = touch.pageX - event.startX; 4867 event.distY = touch.pageY - event.startY; 4868 event.deltaX = touch.pageX - event.pageX; 4869 event.deltaY = touch.pageY - event.pageY; 4870 4871 // Average the velocity of the last few events using a decay 4872 // curve to even out spurious jumps in values. 4873 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 4874 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 4875 event.pageX = touch.pageX; 4876 event.pageY = touch.pageY; 4877 } 4878 4879 function endEvent(target, event, timer, fn) { 4880 timer.end(function(){ 4881 trigger(target, 'moveend', event); 4882 return fn && fn(); 4883 }); 4884 } 4885 4886 4887 // Set up the DOM 4888 4889 function movestart(e) { 4890 if (e.defaultPrevented) { return; } 4891 if (!e.moveEnabled) { return; } 4892 4893 var event = { 4894 startX: e.startX, 4895 startY: e.startY, 4896 pageX: e.pageX, 4897 pageY: e.pageY, 4898 distX: e.distX, 4899 distY: e.distY, 4900 deltaX: e.deltaX, 4901 deltaY: e.deltaY, 4902 velocityX: e.velocityX, 4903 velocityY: e.velocityY, 4904 identifier: e.identifier, 4905 targetTouches: e.targetTouches, 4906 finger: e.finger 4907 }; 4908 4909 var data = { 4910 target: e.target, 4911 event: event, 4912 timer: new Timer(update), 4913 touch: undefined, 4914 timeStamp: e.timeStamp 4915 }; 4916 4917 function update(time) { 4918 updateEvent(event, data.touch, data.timeStamp); 4919 trigger(data.target, 'move', event); 4920 } 4921 4922 if (e.identifier === undefined) { 4923 // We're dealing with a mouse event. 4924 // Stop clicks from propagating during a move 4925 on(e.target, 'click', preventDefault); 4926 on(document, mouseevents.move, activeMousemove, data); 4927 on(document, mouseevents.end, activeMouseend, data); 4928 } 4929 else { 4930 // In order to unbind correct handlers they have to be unique 4931 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 4932 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 4933 4934 // We're dealing with a touch. 4935 on(document, touchevents.move, data.activeTouchmove, data); 4936 on(document, touchevents.end, data.activeTouchend, data); 4937 } 4938 } 4939 4940 on(document, 'mousedown', mousedown); 4941 on(document, 'touchstart', touchstart); 4942 on(document, 'movestart', movestart); 4943 4944 4945 // jQuery special events 4946 // 4947 // jQuery event objects are copies of DOM event objects. They need 4948 // a little help copying the move properties across. 4949 4950 if (!window.jQuery) { return; } 4951 4952 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 4953 4954 function enableMove1(e) { e.enableMove(); } 4955 function enableMove2(e) { e.enableMove(); } 4956 function enableMove3(e) { e.enableMove(); } 4957 4958 function add(handleObj) { 4959 var handler = handleObj.handler; 4960 4961 handleObj.handler = function(e) { 4962 // Copy move properties across from originalEvent 4963 var i = properties.length; 4964 var property; 4965 4966 while(i--) { 4967 property = properties[i]; 4968 e[property] = e.originalEvent[property]; 4969 } 4970 4971 handler.apply(this, arguments); 4972 }; 4973 } 4974 4975 jQuery.event.special.movestart = { 4976 setup: function() { 4977 // Movestart must be enabled to allow other move events 4978 on(this, 'movestart', enableMove1); 4979 4980 // Do listen to DOM events 4981 return false;
4982 }, 4983 4984 teardown: function() { 4985 off(this, 'movestart', enableMove1); 4986 return false; 4987 }, 4988 4989 add: add 4990 }; 4991 4992 jQuery.event.special.move = { 4993 setup: function() { 4994 on(this, 'movestart', enableMove2); 4995 return false; 4996 }, 4997 4998 teardown: function() { 4999 off(this, 'movestart', enableMove2); 5000 return false; 5001 }, 5002 5003 add: add 5004 }; 5005 5006 jQuery.event.special.moveend = { 5007 setup: function() { 5008 on(this, 'movestart', enableMove3); 5009 return false; 5010 }, 5011 5012 teardown: function() { 5013 off(this, 'movestart', enableMove3); 5014 return false; 5015 }, 5016 5017 add: add 5018 }; 5019}); 5020 5021 $.fn.twentytwenty = function(options) { 5022 var options = $.extend({ 5023 default_offset_pct: 0.5, 5024 orientation: 'horizontal', 5025 before_label: 'Before', 5026 after_label: 'After', 5027 no_overlay: false, 5028 move_slider_on_hover: false, 5029 move_with_handle_only: true, 5030 click_to_move: false 5031 }, options); 5032 5033 return this.each(function() { 5034 5035 var sliderPct = options.default_offset_pct; 5036 var container = $(this); 5037 var sliderOrientation = options.orientation; 5038 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 5039 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 5040 5041 5042 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 5043 if(!options.no_overlay) { 5044 container.append("<div class='twentytwenty-overlay'></div>"); 5045 var overlay = container.find(".twentytwenty-overlay"); 5046 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 5047 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 5048 } 5049 var beforeImg = container.find("img:first"); 5050 var afterImg = container.find("img:last"); 5051 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 5052 var slider = container.find(".twentytwenty-handle"); 5053 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 5054 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 5055 container.addClass("twentytwenty-container"); 5056 beforeImg.addClass("twentytwenty-before"); 5057 afterImg.addClass("twentytwenty-after"); 5058 5059 var calcOffset = function(dimensionPct) { 5060 var w = beforeImg.width(); 5061 var h = beforeImg.height(); 5062 return { 5063 w: w+"px", 5064 h: h+"px", 5065 cw: (dimensionPct*w)+"px", 5066 ch: (dimensionPct*h)+"px" 5067 }; 5068 }; 5069 5070 var adjustContainer = function(offset) { 5071 if (sliderOrientation === 'vertical') { 5072 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 5073 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 5074 } 5075 else { 5076 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 5077 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 5078 } 5079 container.css("height", offset.h); 5080 }; 5081 5082 var adjustSlider = function(pct) { 5083 var offset = calcOffset(pct); 5084 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 5085 adjustContainer(offset); 5086 }; 5087 5088 // Return the number specified or the min/max number if it outside the range given. 5089 var minMaxNumber = function(num, min, max) { 5090 return Math.max(min, Math.min(max, num)); 5091 }; 5092 5093 // Calculate the slider percentage based on the position. 5094 var getSliderPercentage = function(positionX, positionY) { 5095 var sliderPercentage = (sliderOrientation === 'vertical') ? 5096 (positionY-offsetY)/imgHeight : 5097 (positionX-offsetX)/imgWidth; 5098 5099 return minMaxNumber(sliderPercentage, 0, 1); 5100 }; 5101 5102 5103 $(window).on("resize.twentytwenty", function(e) { 5104 adjustSlider(sliderPct); 5105 }); 5106 5107 var offsetX = 0; 5108 var offsetY = 0; 5109 var imgWidth = 0; 5110 var imgHeight = 0; 5111 var onMoveStart = function(e) { 5112 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 5113 e.preventDefault(); 5114 } 5115 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 5116 e.preventDefault(); 5117 } 5118 container.addClass("active"); 5119 offsetX = container.offset().left; 5120 offsetY = container.offset().top; 5121 imgWidth = beforeImg.width(); 5122 imgHeight = beforeImg.height(); 5123 }; 5124 var onMove = function(e) { 5125 if (container.hasClass("active")) { 5126 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5127 adjustSlider(sliderPct); 5128 } 5129 }; 5130 var onMoveEnd = function() { 5131 container.removeClass("active"); 5132 }; 5133 5134 var moveTarget = options.move_with_handle_only ? slider : container; 5135 moveTarget.on("movestart",onMoveStart); 5136 moveTarget.on("move",onMove); 5137 moveTarget.on("moveend",onMoveEnd); 5138 5139 if (options.move_slider_on_hover) { 5140 container.on("mouseenter", onMoveStart); 5141 container.on("mousemove", onMove); 5142 container.on("mouseleave", onMoveEnd); 5143 } 5144 5145 slider.on("touchmove", function(e) { 5146 e.preventDefault(); 5147 }); 5148 5149 container.find("img").on("mousedown", function(event) { 5150 event.preventDefault(); 5151 }); 5152 5153 if (options.click_to_move) { 5154 container.on('click', function(e) { 5155 offsetX = container.offset().left; 5156 offsetY = container.offset().top; 5157 imgWidth = beforeImg.width(); 5158 imgHeight = beforeImg.height(); 5159 5160 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5161 adjustSlider(sliderPct); 5162 }); 5163 } 5164 5165 $(window).trigger("resize.twentytwenty"); 5166 }); 5167 }; 5168 5169 5170 $(window).on("load", function(e) { 5171 $('.twentytwenty-container').each(function(){ 5172 var $container = $(this); 5173 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5174 $container.twentytwenty(); 5175 } 5176 $('img', $container).on('async-done', function(){ 5177 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5178 $container.twentytwenty(); 5179 } 5180 }); 5181 }); 5182 }); 5183} 5184 5185UNCODE.justifiedGallery = function() { 5186 5187 var breakPointMe = function( val ) { 5188 val = parseInt( val ); 5189 if ( isNaN(val) ) { 5190 return false;
5191 } 5192 if ( val >= 1500 ) { 5193 return 1; 5194 } else if ( val < 1500 && val >= 960 ) { 5195 return 2; 5196 } else if ( val < 960 && val >= 570 ) { 5197 return 3; 5198 } else if ( val < 570 ) { 5199 return 4; 5200 } 5201 } 5202 5203 var gutterByBreakpoint = function( bp, gutter ) { 5204 var ret; 5205 switch(gutter) { 5206 case 'no-gutter': 5207 ret = 0; 5208 break; 5209 case 'px-gutter': 5210 ret = 1; 5211 break; 5212 case 'half-gutter': 5213 ret = 18; 5214 break; 5215 case 'double-gutter': 5216 switch(bp) { 5217 case 3: 5218 case 4: 5219 ret = 36; 5220 break; 5221 default: 5222 ret = 72; 5223 break; 5224 } 5225 break; 5226 case 'triple-gutter': 5227 switch(bp) { 5228 case 3: 5229 case 4: 5230 ret = 36; 5231 break; 5232 default: 5233 ret = 108; 5234 break; 5235 } 5236 break; 5237 case 'quad-gutter': 5238 switch(bp) { 5239 case 2: 5240 ret = 108; 5241 break; 5242 case 3: 5243 ret = 72; 5244 break; 5245 case 4: 5246 ret = 36; 5247 break; 5248 default: 5249 ret = 144; 5250 break; 5251 } 5252 break; 5253 default: 5254 ret = 36;//single-gutter 5255 } 5256 return ret; 5257 } 5258 5259 if ($('.justified-layout').length > 0) { 5260 var justifiedContainersArray = [], 5261 typeGridArray = [], 5262 layoutGridArray = [], 5263 transitionDuration = [], 5264 $filterItems = [], 5265 $filters = $('.justified-system .isotope-filters'), 5266 $itemSelector = '.tmb', 5267 $items, 5268 itemMargin, 5269 correctionFactor = 0, 5270 firstLoad = true, 5271 isOriginLeft = $('body').hasClass('rtl') ? false : true, 5272 prevW = breakPointMe(UNCODE.wwidth); 5273 $('[class*="justified-container"]').each(function() { 5274 var isoData = $(this).data(); 5275 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5276 if (isoData.type == 'metro') typeGridArray.push(true); 5277 else typeGridArray.push(false); 5278 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 5279 else layoutGridArray.push('justified'); 5280 justifiedContainersArray.push($(this)); 5281 }); 5282 var init_justifiedGallery = function() { 5283 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 5284 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 5285 justifiedId = justifiedSystem.attr('id'), 5286 $layoutMode = layoutGridArray[i], 5287 gutter = $(justifiedContainersArray[i]).data('gutter'), 5288 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 5289 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 5290 lastRow = $(justifiedContainersArray[i]).data('last-row'), 5291 margins; 5292 5293 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 5294 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 5295 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 5296 5297 margins = gutterByBreakpoint(prevW, gutter); 5298 5299 $(justifiedContainersArray[i]).justifiedGallery({ 5300 rowHeight: rowHeight, 5301 maxRowHeight: maxRowHeight, 5302 margins: margins, 5303 cssAnimation: true, 5304 lastRow: lastRow, 5305 waitThumbnailsLoad: false 5306 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 5307 5308 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 5309 $(justifiedContainersArray[i]).infinitescroll({ 5310 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 5311 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 5312 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 5313 animate: false, 5314 behavior: 'local', 5315 debug: false, 5316 loading: { 5317 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 5318 speed: 0, 5319 finished: undefined, 5320 msg: $('#' + justifiedId + ' .loadmore-button'), 5321 }, 5322 errorCallback: function() { 5323 var justified_system = $(this).closest('.justified-system'); 5324 $('.loading-button', justified_system).hide(); 5325 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 5326 } 5327 }, 5328 // append the new items to galleryJustified on the infinitescroll callback function. 5329 function(newElements, opts) { 5330 var $galleryJustified = $(this), 5331 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 5332 filters = new Array(), 5333 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 5334 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 5335 $numPages = $('a', $infinite_button).data('pages'),
5336 delay = 300; 5337 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 5338 $infinite_button.show(); 5339 $loading_button.hide(); 5340 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 5341 $('> li', $galleryJustified).remove(); 5342 $.each($(newElements), function(index, val) { 5343 $(val).addClass('tmb-iso'); 5344 if ($(val).is("li")) { 5345 filters.push($(val)[0]); 5346 } 5347 }); 5348 newElements = newElements.filter(function(x) { 5349 return filters.indexOf(x) < 0 5350 }); 5351 $.each($(filters), function(index, val) { 5352 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 5353 }); 5354 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 5355 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5356 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 5357 if (typeof getLightbox === 'object') { 5358 getLightbox.refresh(); 5359 } else { 5360 UNCODE.lightbox(); 5361 } 5362 } 5363 if ( typeof twttr !== 'undefined' ) 5364 twttr.widgets.load(justifiedContainersArray[i]); 5365 5366 requestTimeout(function() { 5367 $galleryJustified.trigger('more-items-loaded'); 5368 }, 1000); 5369 }); 5370 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 5371 var $infinite_justified = $(justifiedContainersArray[i]), 5372 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 5373 $infinite_justified.infinitescroll('pause'); 5374 $infinite_button.on('click', function(event) { 5375 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5376 $.each(UNCODE.lightboxArray, function(index, val) { 5377 UNCODE.lightboxArray[index].destroy(); 5378 }); 5379 } 5380 event.preventDefault(); 5381 var $justified_system = $(event.target).closest('.justified-system'), 5382 $infinite_justified = $justified_system.find('.justified-container'), 5383 justifiedId = $justified_system.attr('id'); 5384 $(event.currentTarget).html(SiteParameters.loading); 5385 $infinite_justified.infinitescroll('resume'); 5386 $infinite_justified.infinitescroll('retrieve'); 5387 $infinite_justified.infinitescroll('pause'); 5388 $infinite_justified.trigger('more-items-loaded'); 5389 }); 5390 } 5391 } 5392 } 5393 }, 5394 onLayout = function(justifiedObj, startIndex) { 5395 justifiedObj.css('opacity', 1); 5396 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 5397 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 5398 5399 requestTimeout(function() { 5400 // window.dispatchEvent(UNCODE.boxEvent); 5401 UNCODE.adaptive(); 5402 if (SiteParameters.dynamic_srcset_active === '1') { 5403 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 5404 } 5405 if (typeof MediaElement === "function") { 5406 $(justifiedObj).find('audio,video').each(function() { 5407 $(this).mediaelementplayer({ 5408 pauseOtherPlayers: false, 5409 }); 5410 }); 5411 } 5412 if ($(justifiedObj).find('.nested-carousel').length) { 5413 if (typeof UNCODE.carousel !== 'undefined') { 5414 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 5415 } 5416 requestTimeout(function() { 5417 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 5418 justifiedObj.addClass('justified-gallery-finished') 5419 Waypoint.refreshAll(); 5420 }, 200); 5421 } else { 5422 requestTimeout(function() { 5423 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 5424 justifiedObj.addClass('justified-gallery-finished') 5425 Waypoint.refreshAll(); 5426 }, 300); 5427 } 5428 }, 100); 5429 5430 }, 5431 boxAnimation = function(items, startIndex, sequential, container) { 5432 var $allItems = items.length - startIndex, 5433 showed = 0, 5434 index = 0; 5435 if (container.closest('.owl-item').length == 1) return false; 5436 $.each(items, function(index, val) { 5437 var elInner = $('> .t-inside', val); 5438 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5439 return; 5440 } 5441 if (val[0]) val = val[0]; 5442 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 5443 new Waypoint({ 5444 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5445 element: val, 5446 handler: function() { 5447 var element = $('> .t-inside', this.element), 5448 parent = $(this.element), 5449 currentIndex = parent.index();
5450 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 5451 delayAttr = parseInt(element.attr('data-delay')); 5452 if (isNaN(delayAttr)) delayAttr = 100; 5453 delay -= showed; 5454 var objTimeout = requestTimeout(function() { 5455 element.removeClass('zoom-reverse').addClass('start_animation'); 5456 showed = parent.index(); 5457 }, delay * delayAttr); 5458 parent.data('objTimeout', objTimeout); 5459 if (!UNCODE.isUnmodalOpen) { 5460 this.destroy(); 5461 } 5462 }, 5463 offset: '100%' 5464 }) 5465 } else { 5466 elInner.removeClass('animate_when_almost_visible'); 5467 $(val).addClass('no-waypoint-animation'); 5468 /*if (elInner.hasClass('force-anim')) { 5469 elInner.addClass('start_animation'); 5470 } else { 5471 elInner.css('opacity', 1); 5472 }*/ 5473 } 5474 index++; 5475 }); 5476 }; 5477 $filters.on('click', 'a[data-filter]', function(evt) { 5478 var $filter = $(this), 5479 filterContainer = $filter.closest('.isotope-filters'), 5480 filterValue = $filter.attr('data-filter'), 5481 container = $filter.closest('.justified-system').find($('.justified-layout')), 5482 lastRow = container.data('last-row'), 5483 transitionDuration = 0, 5484 delay = 300, 5485 filterItems = []; 5486 5487 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 5488 5489 var filter_items = function(){ 5490 if (filterValue !== undefined) { 5491 $.each($('> .tmb > .t-inside', container), function(index, val) { 5492 var parent = $(val).parent(), 5493 objTimeout = parent.data('objTimeout'); 5494 if (objTimeout) { 5495 $(val).removeClass('zoom-reverse'); 5496 clearRequestTimeout(objTimeout); 5497 } 5498 if (transitionDuration == 0) { 5499 if ($(val).hasClass('animate_when_almost_visible')) { 5500 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5501 } else { 5502 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5503 } 5504 } 5505 }); 5506 5507 requestTimeout(function() { 5508 var $block, 5509 selector, 5510 lightboxElements, 5511 $boxes; 5512 5513 if ( filterValue !== '' && filterValue !== '*' ) { 5514 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 5515 selector = '.' + filterValue; 5516 $.each($(selector, container), function(index, block) { 5517 lightboxElements = $('[data-lbox^=ilightbox]', block); 5518 if (lightboxElements.length) { 5519 lightboxElements.removeClass('lb-disabled'); 5520 container.data('lbox', $(lightboxElements[0]).data('lbox')); 5521 } 5522 filterItems.push(block); 5523 }); 5524 container.justifiedGallery({ 5525 filter: selector, 5526 lastRow: 'nojustify' 5527 }); 5528 } else { 5529 container.justifiedGallery({ 5530 filter: false, 5531 lastRow: lastRow 5532 }); 5533 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 5534 filterItems = $('> .tmb', container); 5535 } 5536 container.trigger('more-items-loaded'); 5537 5538 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 5539 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5540 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 5541 if (typeof getLightbox === 'object') { 5542 getLightbox.refresh(); 5543 } else { 5544 UNCODE.lightbox(); 5545 } 5546 } 5547 5548 if (transitionDuration == 0) { 5549 requestTimeout(function() { 5550 boxAnimation(filterItems, 0, false, container); 5551 }, 100); 5552 } 5553 requestTimeout(function() { 5554 Waypoint.refreshAll(); 5555 container.trigger('more-items-loaded'); 5556 }, 2000); 5557 5558 }, delay); 5559 } else { 5560 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5561 $.each(UNCODE.lightboxArray, function(index, val) { 5562 UNCODE.lightboxArray[index].destroy(); 5563 }); 5564 } 5565 $.each($('> .tmb > .t-inside', container), function(index, val) { 5566 var parent = $(val).parent(), 5567 objTimeout = parent.data('objTimeout'); 5568 if (objTimeout) { 5569 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5570 clearRequestTimeout(objTimeout); 5571 } 5572 if (transitionDuration == 0) { 5573 if ($(val).hasClass('animate_when_almost_visible')) { 5574 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5575 } else { 5576 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5577 } 5578 } 5579 }); 5580 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5581 UNCODE.lightbox(); 5582 } 5583 container.parent().addClass('justified-loading'); 5584 container.trigger('more-items-loaded'); 5585 } 5586 }; 5587 5588 if (!$filter.hasClass('active')) { 5589 /** Scroll top with filtering */ 5590 if (filterContainer.hasClass('filter-scroll')) { 5591 var calc_scroll = container.closest('.row-parent').offset().top; 5592 calc_scroll -= UNCODE.get_scroll_offset(); 5593 5594 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5595 delta = bodyTop - calc_scroll, 5596 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 5597 filterTolerance = false, 5598 filter_timeout; 5599 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5600 5601 if ( !UNCODE.isFullPage ) { 5602 if (scrollSpeed == 0) { 5603 $('html, body').scrollTop(calc_scroll); 5604 UNCODE.scrolling = false;
5605 filter_items(); 5606 } else { 5607 5608 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 5609 filter_items(); 5610 filterTolerance = true; 5611 } 5612 5613 $('html, body').animate({ 5614 scrollTop: calc_scroll 5615 },{ 5616 easing: 'easeInOutQuad', 5617 duration: scrollSpeed, 5618 complete: function(){ 5619 UNCODE.scrolling = false; 5620 if ( !filterTolerance ) { 5621 filter_timeout = setTimeout(function(){ 5622 clearTimeout(filter_timeout); 5623 filter_items(); 5624 }, 200); 5625 } 5626 } 5627 }); 5628 } 5629 } 5630 } else { 5631 filter_items(); 5632 } 5633 } 5634 evt.preventDefault(); 5635 }); 5636 5637 $filters.each(function(i, buttonGroup) { 5638 var $buttonGroup = $(buttonGroup); 5639 $buttonGroup.on('click', 'a', function() { 5640 $buttonGroup.find('.active').removeClass('active'); 5641 $(this).addClass('active'); 5642 }); 5643 5644 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 5645 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 5646 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 5647 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 5648 e.preventDefault(); 5649 $cats_filters.slideToggle(400, 'easeInOutCirc'); 5650 }); 5651 }); 5652 window.addEventListener('boxResized', function(e) { 5653 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 5654 prevW = breakPointMe(UNCODE.wwidth); 5655 $.each($('.justified-layout'), function(index, val) { 5656 var gutter = $(this).data('gutter'), 5657 margins = gutterByBreakpoint( prevW, gutter); 5658 $(this).justifiedGallery({ 5659 margins: margins 5660 }); 5661 $(this).find('.mejs-video,.mejs-audio').each(function() { 5662 $(this).trigger('resize'); 5663 }); 5664 }); 5665 } 5666 }, false); 5667 5668 init_justifiedGallery(); 5669 }; 5670}; 5671 5672UNCODE.cssGrid = function() { 5673 if ($('.cssgrid-layout').length > 0) { 5674 var cssGridContainersArray = []; 5675 var transitionDuration = []; 5676 var $filters = $('.cssgrid-system .cssgrid-filters'); 5677 5678 $('[class*="cssgrid-container"]').each(function() { 5679 cssGridContainersArray.push($(this)); 5680 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5681 }); 5682 5683 var init_cssGridAjax = function() { 5684 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 5685 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 5686 cssGridId = cssGridSystem.attr('id'); 5687 5688 cssGridSystem.data('transitionDuration', transitionDuration[i]); 5689 5690 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 5691 $(cssGridContainersArray[i]).infinitescroll({ 5692 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 5693 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 5694 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve 5695 animate: false, 5696 behavior: 'local', 5697 debug: false, 5698 loading: { 5699 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 5700 speed: 0, 5701 finished: undefined, 5702 msg: $('#' + cssGridId + ' .loadmore-button'), 5703 }, 5704 errorCallback: function() { 5705 var cssgrid_system = $(this).closest('.cssgrid-system'); 5706 $('.loading-button', cssgrid_system).hide(); 5707 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 5708 } 5709 }, 5710 // append the new items to cssGrid on the infinitescroll callback function. 5711 function(newElements, opts) { 5712 var $cssGrid = $(this), 5713 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 5714 cssGridId = cssGridSystemCont.attr('id'), 5715 filters = new Array(), 5716 $loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'), 5717 $infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'), 5718 $numPages = $('a', $infinite_button).data('pages'),
5719 delay = 300; 5720 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 5721 $infinite_button.show(); 5722 $loading_button.hide(); 5723 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 5724 $('> li', $cssGrid).remove(); 5725 $.each($(newElements), function(index, val) { 5726 $(val).addClass('tmb-grid'); 5727 if ($(val).is("li")) { 5728 filters.push($(val)[0]); 5729 } 5730 }); 5731 newElements = newElements.filter(function(x) { 5732 return filters.indexOf(x) < 0 5733 }); 5734 $.each($(filters), function(index, val) { 5735 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 5736 }); 5737 5738 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter'); 5739 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 5740 if (filterValue !== undefined && filterValue != '*') { 5741 $(newElements).hide(); 5742 var els_to_show = $(); 5743 $(newElements).each(function() { 5744 var el = $(this); 5745 if (el.hasClass(filterValue)) { 5746 els_to_show = els_to_show.add(el); 5747 el.show(); 5748 } 5749 }); 5750 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 5751 } else { 5752 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 5753 } 5754 5755 UNCODE.adaptive(); 5756 if (SiteParameters.dynamic_srcset_active === '1') { 5757 UNCODE.refresh_dynamic_srcset_size($cssGrid); 5758 } 5759 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5760 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 5761 if (typeof getLightbox === 'object') { 5762 getLightbox.refresh(); 5763 } else { 5764 UNCODE.lightbox(); 5765 } 5766 } 5767 if ( typeof twttr !== 'undefined' ) { 5768 twttr.widgets.load(cssGridContainersArray[i]); 5769 } 5770 5771 UNCODE.carousel($(newElements)); 5772 requestTimeout(function() { 5773 $cssGrid.trigger('more-items-loaded'); 5774 }, 1000); 5775 5776 }); 5777 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 5778 var $cssgrid_el = $(cssGridContainersArray[i]), 5779 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 5780 $cssgrid_el.infinitescroll('pause'); 5781 $infinite_button.on('click', function(event) { 5782 event.preventDefault(); 5783 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 5784 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 5785 cssGridId = $cssgrid_system.attr('id'); 5786 $(event.currentTarget).html(SiteParameters.loading); 5787 $cssgrid_el.infinitescroll('resume'); 5788 $cssgrid_el.infinitescroll('retrieve'); 5789 $cssgrid_el.infinitescroll('pause'); 5790 }); 5791 } 5792 } 5793 } 5794 }; 5795 5796 init_cssGridAjax(); 5797 5798 if ($('.cssgrid-pagination').length > 0) { 5799 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 5800 evt.preventDefault(); 5801 5802 var container = $(this).closest('.cssgrid-system'), 5803 calc_scroll = container.closest('.row-parent').offset().top; 5804 5805 calc_scroll -= UNCODE.get_scroll_offset(); 5806 5807 var menu_container = $('.menu-sticky'); 5808 var menu = menu_container.find('.menu-container'); 5809 5810 if (menu_container.length > 0 && menu.length > 0) { 5811 calc_scroll = calc_scroll - menu.outerHeight(); 5812 } 5813 5814 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5815 delta = bodyTop - calc_scroll, 5816 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5817 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5818 5819 if ( !UNCODE.isFullPage ) { 5820 if (scrollSpeed == 0) { 5821 $('html, body').scrollTop(calc_scroll); 5822 } else { 5823 $('html, body').animate({ 5824 scrollTop: calc_scroll 5825 },{ 5826 easing: 'easeInOutQuad', 5827 duration: scrollSpeed, 5828 complete: function(){ 5829 UNCODE.scrolling = false;
5830 } 5831 }); 5832 } 5833 } 5834 5835 loadCssGrid($(this), true); 5836 evt.preventDefault(); 5837 }); 5838 } 5839 5840 $filters.on('click', 'a.grid-nav-link', function(evt) { 5841 if ($(this).hasClass('no-grid-filter')) { 5842 return; 5843 } 5844 var $filter = $(this), 5845 filterContainer = $filter.closest('.cssgrid-filters'), 5846 filterValue = $filter.attr('data-filter'), 5847 containerSystem = $filter.closest('.cssgrid-system'), 5848 container = containerSystem.find($('.cssgrid-layout')), 5849 transitionDuration = containerSystem.data('transitionDuration'), 5850 delay = 300, 5851 filterItems = [], 5852 all_thumbs = container.find('.tmb-grid'); 5853 5854 var filter_items = function(){ 5855 if (filterValue !== undefined) { 5856 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 5857 var parent = $(val).parent(), 5858 objTimeout = parent.data('objTimeout'); 5859 if (objTimeout) { 5860 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5861 clearRequestTimeout(objTimeout); 5862 } 5863 if (transitionDuration == 0) { 5864 if ($(val).hasClass('animate_when_almost_visible')) { 5865 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5866 } else { 5867 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5868 } 5869 } 5870 }); 5871 requestTimeout(function(){ 5872 if ( filterValue == '*' ) { 5873 all_thumbs.show(); 5874 all_thumbs.each(function(index, val) { 5875 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 5876 filterItems.push($(this)); 5877 }); 5878 } else { 5879 all_thumbs.each(function() { 5880 var _tmb = $(this); 5881 if (_tmb.hasClass(filterValue)) { 5882 _tmb.show(); 5883 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 5884 filterItems.push(_tmb); 5885 } else { 5886 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 5887 _tmb.hide(); 5888 } 5889 }); 5890 } 5891 5892 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 5893 5894 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 5895 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 5896 var lightboxElements = $('[data-lbox^=ilightbox]', container); 5897 if (lightboxElements.length) { 5898 container.data('lbox', $(lightboxElements[0]).data('lbox')); 5899 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5900 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 5901 if (typeof getLightbox === 'object') { 5902 getLightbox.refresh(); 5903 } else { 5904 UNCODE.lightbox(); 5905 } 5906 } 5907 } 5908 container.trigger('more-items-loaded'); 5909 }, delay); 5910 } else { 5911 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 5912 var parent = $(val).parent(), 5913 objTimeout = parent.data('objTimeout'); 5914 if (objTimeout) { 5915 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5916 clearRequestTimeout(objTimeout); 5917 } 5918 if (transitionDuration == 0) { 5919 if ($(val).hasClass('animate_when_almost_visible')) { 5920 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5921 } else { 5922 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5923 } 5924 } 5925 }); 5926 loadCssGrid($filter); 5927 } 5928 }; 5929 5930 if (!$filter.hasClass('active')) { 5931 /** Scroll top with filtering */ 5932 if (filterContainer.hasClass('filter-scroll')) { 5933 var calc_scroll = container.closest('.row-parent').offset().top; 5934 calc_scroll -= UNCODE.get_scroll_offset(); 5935 5936 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5937 delta = bodyTop - calc_scroll, 5938 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 5939 filterTolerance = false, 5940 filter_timeout; 5941 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5942 5943 if ( !UNCODE.isFullPage ) { 5944 if (scrollSpeed == 0) { 5945 $('html, body').scrollTop(calc_scroll); 5946 UNCODE.scrolling = false;
5947 filter_items(); 5948 } else { 5949 5950 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 5951 filter_items(); 5952 filterTolerance = true; 5953 } 5954 5955 $('html, body').animate({ 5956 scrollTop: calc_scroll 5957 },{ 5958 easing: 'easeInOutQuad', 5959 duration: scrollSpeed, 5960 complete: function(){ 5961 UNCODE.scrolling = false; 5962 if ( !filterTolerance ) { 5963 filter_timeout = setTimeout(function(){ 5964 clearTimeout(filter_timeout); 5965 filter_items(); 5966 }, 200); 5967 } 5968 } 5969 }); 5970 } 5971 } 5972 } else { 5973 filter_items(); 5974 } 5975 } 5976 evt.preventDefault(); 5977 }); 5978 5979 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 5980 var params = UNCODE.getURLParams(window.location); 5981 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 5982 5983 UNCODE.lastURL = window.location.href; 5984 5985 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 5986 return; 5987 } 5988 5989 if (params.id === undefined) { 5990 $.each($('.cssgrid-system'), function(index, val) { 5991 loadCssGrid($(val)); 5992 }); 5993 } else { 5994 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 5995 loadCssGrid($('#' + params.id)); 5996 } 5997 } 5998 }); 5999 6000 var loadCssGrid = function($href, $paginating) { 6001 var is_paginating = false; 6002 6003 if (undefined !== $paginating && $paginating) { 6004 var is_paginating = $paginating; 6005 } 6006 6007 var href = ($href.is("a") ? $href.attr('href') : location), 6008 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 6009 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 6010 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 6011 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 6012 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 6013 cssgridId = cssgridSystem.attr('id'); 6014 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 6015 UNCODE.lastURL = href; 6016 history.pushState({ 6017 myCSSgrid: true 6018 }, document.title, href); 6019 } 6020 cssgridWrapper.addClass('cssgrid-loading'); 6021 if (is_paginating) { 6022 cssgridWrapper.addClass('grid-filtering'); 6023 } 6024 $.ajax({ 6025 url: href 6026 }).done(function(data) { 6027 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 6028 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 6029 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 6030 requestTimeout(function() { 6031 cssgridContainer.html($resultItems); 6032 cssgridWrapper.removeClass('cssgrid-loading'); 6033 cssgridWrapper.removeClass('grid-filtering'); 6034 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6035 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 6036 UNCODE.adaptive(); 6037 if (SiteParameters.dynamic_srcset_active === '1') { 6038 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 6039 } 6040 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6041 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 6042 if (typeof getLightbox === 'object') { 6043 getLightbox.refresh(); 6044 } else { 6045 UNCODE.lightbox(); 6046 } 6047 } 6048 cssgridContainer.trigger('more-items-loaded'); 6049 }, 300); 6050 6051 $('.pagination', cssgridFooter).remove(); 6052 cssgridFooter.append($resultPagination); 6053 6054 if (cssgridResultCount.length > 0) { 6055 $('.woocommerce-result-count', cssgridResultCount).remove(); 6056 cssgridResultCount.append($resultCount); 6057 } 6058 }); 6059 }; 6060 6061 $filters.each(function(i, buttonGroup) { 6062 var $buttonGroup = $(buttonGroup); 6063 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 6064 $buttonGroup.find('.active').removeClass('active'); 6065 $(this).addClass('active'); 6066 6067 }); 6068 6069 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6070 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6071 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6072 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6073 e.preventDefault(); 6074 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6075 }); 6076 6077 }); 6078 }; 6079}; 6080 6081UNCODE.preventDoubleTransition = function() { 6082 $('.sticky-element .animate_when_almost_visible').each(function(){ 6083 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 6084 $el.addClass('do_not_reanimate'); 6085 }); 6086 }); 6087}; 6088 6089UNCODE.checkScrollForTabs = function(){ 6090 var goToSection = window.location.hash.replace('#', ''), 6091 $index; 6092 6093 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 6094 goToSection = encodeURIComponent(goToSection); 6095 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 6096 6097 $index.attr('data-parent', 'parent-' + goToSection); 6098 6099 if (window.location.hash != undefined && window.location.hash != '') { 6100 requestTimeout(function() { 6101 scrollBody('parent-' + goToSection); 6102 }, 500); 6103 } 6104 6105 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 6106 var hash = (e.currentTarget).hash, 6107 index = (e.currentTarget).closest('.uncode-tabs'); 6108 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 6109 $('a[href="' + hash + '"][data-tab-history]').click(); 6110 scrollBody(index); 6111 } 6112 }); 6113 6114 var scrollBody = function(index) { 6115 6116 var getSection = $('a[href="' + index + '"][data-tab-history]'), 6117 scrollTo, 6118 safeGap = 27; 6119 6120 if ( ! getSection.length ) { 6121 getSection = $('div[data-parent="' + index + '"]'); 6122 6123 if ( getSection.attr('data-target') == 'row' ) { 6124 getSection = getSection.closest('.vc_row'); 6125 safeGap = 0; 6126 } 6127 } 6128 6129 if (typeof getSection === 'undefined' || ! getSection.length ) { 6130 return; 6131 } 6132 6133 var body = $("html, body"), 6134 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6135 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 6136 getOffset = UNCODE.get_scroll_offset(); 6137 if ( typeof getSection.offset() === 'undefined' ) 6138 return; 6139 scrollTo = getSection.offset().top - safeGap; 6140 scrollTo -= getOffset; 6141 6142 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6143 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6144 6145 if (index != 0) { 6146 UNCODE.scrolling = true; 6147 } 6148 6149 if (scrollSpeed == 0) { 6150 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 6151 UNCODE.scrolling = false;
6152 } else { 6153 body.animate({ 6154 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 6155 }, scrollSpeed, 'easeInOutQuad', function() { 6156 requestTimeout(function() { 6157 UNCODE.scrolling = false; 6158 if (getOffset != UNCODE.get_scroll_offset()) { 6159 scrollBody(index); 6160 } 6161 }, 100); 6162 }); 6163 } 6164 6165 }; 6166}; 6167 6168UNCODE.printScreen = function() { 6169 var inlineMediaStyle = null, 6170 setResize; 6171 6172 function changeMediaStyle() { 6173 clearRequestTimeout(setResize); 6174 setResize = requestTimeout(function(){ 6175 var $head = document.getElementsByTagName('head')[0], 6176 $newStyle = document.createElement('style'), 6177 winW = window.innerWidth, 6178 printH = window.innerHeight; 6179 6180 $newStyle.setAttribute('type', 'text/css'); 6181 $newStyle.setAttribute('media', 'print'); 6182 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 6183 6184 if (inlineMediaStyle != null) { 6185 $head.replaceChild($newStyle, inlineMediaStyle) 6186 } else { 6187 $head.appendChild($newStyle); 6188 } 6189 inlineMediaStyle = $newStyle; 6190 }, 1000); 6191 } 6192 6193 changeMediaStyle(); 6194 window.addEventListener('resize', changeMediaStyle); 6195}; 6196 6197UNCODE.fullPage = function() { 6198 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 6199 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 6200 return false; 6201 } else { 6202 requestTimeout(function() { 6203 window.scrollTo(0, 0); 6204 }, 10); 6205 } 6206 6207 var $masthead = $('#masthead'), 6208 $logo = $('#logo-container-mobile'), 6209 $logolink = $('[data-minheight]', $logo), 6210 logoMinScale = $logolink.data('minheight'), 6211 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 6212 $container = $('.main-container .post-content'), 6213 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 6214 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 6215 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 6216 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 6217 headerWithOpacity = $('.header-scroll-opacity', $header).length, 6218 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 6219 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 6220 scrollBar = true, 6221 effect, 6222 animationEndTimeOut, 6223 fp_anim_time = 900, 6224 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 6225 is_scrolling = false, 6226 dataNames = [], 6227 is_first = true, 6228 no_history = $('body').hasClass('uncode-scroll-no-history'), 6229 theres_footer = true; 6230 6231 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 6232 $('> div', $footer).each(function(index, el){ 6233 if ( $(el).outerHeight() < 2 ) 6234 theres_footer = false; 6235 else 6236 theres_footer = true; 6237 }); 6238 } 6239 6240 if ( !$footer.length ) 6241 theres_footer = false; 6242 6243 if ( !UNCODE.isFullPageSnap ) { 6244 6245 if ( $('body').hasClass('uncode-fullpage-zoom') ) 6246 effect = 'scaleDown'; 6247 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 6248 effect = 'moveparallax'; 6249 else 6250 effect = 'movecurtain'; 6251 } 6252 6253 if ( $('body').hasClass('uncode-fullpage-trid') ) 6254 fp_anim_time = fp_anim_time*2; 6255 6256 if ( $header.length ) { 6257 if ( headerName !== '' ) 6258 $header.attr('data-name', headerName); 6259 if ( headerLabel !== '' ) 6260 $header.attr('data-label', headerLabel); 6261 $container.prepend($header); 6262 } 6263 if ( theres_footer ) { 6264 $container.append($footer); 6265 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 6266 $('aside.widget ul', $footer).addClass('no-list'); 6267 } 6268 6269 var $all = $rows.add($header); 6270 6271 if ( theres_footer ) 6272 $all = $all.add($footer); 6273 6274 $all.each(function(index, row) { 6275 if( index === 0 ) 6276 $(row).addClass('uncode-scroll-active'); 6277 }); 6278 6279 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 6280 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 6281 6282 $all.each(function(index, val) { 6283 var getName = $(val).data('name'), 6284 label; 6285 6286 if (typeof getName == 'undefined' || getName == 'undefined') 6287 getName = SiteParameters.slide_name + '-' + index; 6288 6289 //if ( dataNames.includes(getName) ) { 6290 if ( dataNames.indexOf(getName) > 0 ) { 6291 getName += '_' + index; 6292 $(val).data('name', getName); 6293 } 6294 6295 dataNames.push(getName); 6296 6297 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 6298 6299 if (typeof $(val).attr('data-label') !== 'undefined') 6300 label = $(val).attr('data-label'); 6301 else label = ''; 6302 6303 if ( $(val).is($footer) ) 6304 return; 6305 6306 if (label != '' ) { 6307 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 6308 $('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>"); 6309 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 6310 $('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>"); 6311 } 6312 }); 6313 6314 var checkVisible = function( el, off ) { 6315 if (typeof jQuery === "function" && el instanceof jQuery) { 6316 el = el[0]; 6317 } 6318 6319 off = typeof off=='undefined' ? 50 : off; 6320 6321 var rect = el.getBoundingClientRect(); 6322 6323 return ( 6324 ( 6325 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 6326 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 6327 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 6328 ) 6329 ); 6330 }; 6331 6332 var animationEndAction = function( index, nextIndex ) { 6333 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 6334 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6335 player, iframe; 6336 6337 if ( !$nextSlide.is($footer) ) { 6338 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 6339 } 6340 6341 if ( !UNCODE.isFullPageSnap ) { 6342 activateKBurns( nextIndex ); 6343 } 6344 6345 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 6346 if ($(this).attr('data-provider') == 'vimeo') { 6347 iframe = $(this).find('iframe'); 6348 player = new Vimeo.Player(iframe[0]); 6349 player.pause(); 6350 } else if ($(this).attr('data-provider') == 'youtube') { 6351 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 6352 } else { 6353 if ($(this).is('video')) { 6354 $(this)[0].volume = 0; 6355 $(this)[0].pause(); 6356 } 6357 } 6358 }); 6359 6360 if ( ! UNCODE.isMobile && headerWithOpacity ) { 6361 if ( $nextSlide.is($header) ) 6362 $header.removeClass('header-scrolled'); 6363 } 6364 6365 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 6366 $otherEl.each(function(){ 6367 var $otherThis = $(this), 6368 $bgwrapperOther = $('.background-inner', $otherThis); 6369 if ( !checkVisible($otherThis) ) 6370 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 6371 6372 }); 6373 6374 if ( !checkVisible($currentSlide) ) { 6375 $currentSlide.removeClass('uncode-scroll-visible'); 6376 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 6377 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
6378 currentScroll.scrollTo(0, 0, 0); 6379 } 6380 6381 clearRequestTimeout(animationEndTimeOut); 6382 animationEndTimeOut = requestTimeout(function(){ 6383 Waypoint.refreshAll(); 6384 $( document.body ).trigger('uncode_waypoints'); 6385 var eventFP = new CustomEvent('fp-slide-changed'); 6386 window.dispatchEvent(eventFP); 6387 is_scrolling = false; 6388 6389 if ( is_first ) { 6390 $('ul.onepage-pagination a').removeClass('is-selected'); 6391 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 6392 is_first = false; 6393 } 6394 6395 }, 500); 6396 }; 6397 6398 var postLeaveActions = function( nextIndex ){ 6399 if ( menuHidden && ! UNCODE.isMobile ) 6400 return false; 6401 6402 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6403 $cols = $('.uncol', $el), 6404 anchor = $el.data('anchor'); 6405 6406 if ( ! UNCODE.isFullPageSnap ) { 6407 $.each($cols, function(index, val){ 6408 if ( $(val).hasClass('style-light') ){ 6409 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 6410 return false; 6411 } else if ( $(val).hasClass('style-dark') ) { 6412 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 6413 return false; 6414 } 6415 }); 6416 } 6417 6418 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 6419 $('.menu-item' ).removeClass('active'); 6420 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 6421 } 6422 6423 if ( !UNCODE.isFullPageSnap ) { 6424 activateBackWash( nextIndex ); 6425 } 6426 }; 6427 6428 var activateBackWash = function( nextIndex ){ 6429 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6430 $bgwrapper; 6431 6432 if ( $el.length ) { 6433 if ( $el.hasClass('with-zoomout') ) { 6434 $bgwrapper = $('.background-inner:nth-child(1)', $el); 6435 } else if ( $('.with-zoomout', $el).length ) { 6436 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 6437 } else { 6438 return false; 6439 } 6440 } else { 6441 return false; 6442 } 6443 6444 $bgwrapper.addClass('uncode-zoomout'); 6445 6446 }; 6447 6448 var activateKBurns = function( nextIndex ){ 6449 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6450 $bgwrapper; 6451 6452 if ( $el.length ) { 6453 if ( $el.hasClass('with-kburns') ) { 6454 $bgwrapper = $('.background-inner:nth-child(1)', $el); 6455 } else if ( $('.with-kburns', $el).length ) { 6456 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 6457 } else { 6458 return false; 6459 } 6460 } else { 6461 return false; 6462 } 6463 6464 $bgwrapper.addClass('uncode-kburns'); 6465 6466 }; 6467 6468 var activateParallax = function( nextIndex, direction ){ 6469 6470 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6471 $cell = $('.fp-tableCell', $el), 6472 animationEnd = 'webkitAnimationEnd animationend', 6473 cellAnim; 6474 6475 switch( direction ) { 6476 case 'up': 6477 cellAnim = 'moveFromTopInner'; 6478 break; 6479 default: 6480 cellAnim = 'moveFromBottomInner'; 6481 } 6482 6483 $cell.css({ 6484 'animation-name': cellAnim, 6485 'animation-duration': fp_anim_time + 'ms', 6486 'animation-delay': '', 6487 'animation-timing-function': fp_easing, 6488 'animation-fill-mode': 'both', 6489 }).off(animationEnd) 6490 .on(animationEnd, function(event) { 6491 if ( event.originalEvent.animationName === cellAnim ) { 6492 $cell 6493 .css({ 6494 'animation-name': '', 6495 'animation-duration': '', 6496 'animation-delay': '', 6497 'animation-timing-function': '', 6498 'animation-fill-mode': '', 6499 }); 6500 } 6501 }); 6502 }; 6503 6504 var scrollHashes = function(){ 6505 var hash = window.location.hash.replace('#', '').split('/'), 6506 hashInd; 6507 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 6508 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 6509 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 6510 $.fn.fullpage.moveTo(hashInd+1); 6511 } 6512 } else if( hash[0] === '' ) { 6513 $.fn.fullpage.moveTo(1); 6514 } 6515 }; 6516 6517 var hideMenu = function( index, nextIndex ){ 6518 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 6519 return false; 6520 6521 var hMenu = UNCODE.menuHeight, 6522 transTime = hMenu * 2; 6523 6524 if ( index === 1 && nextIndex > 1 ) { 6525 hMenu = hMenu * -1; 6526 } else if ( index !== 1 && nextIndex === 1 ) { 6527 hMenu = 0; 6528 } else { 6529 return false;
6530 } 6531 6532 $masthead.css({ 6533 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 6534 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 6535 '-webkit-transition': 'transform 0.5s ease-in-out', 6536 'transition': 'transform 0.5s ease-in-out' 6537 }); 6538 }; 6539 6540 var shrinkMenu = function( index, nextIndex ){ 6541 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 6542 return false; 6543 6544 if ( index === 1 && nextIndex > 1 ) { 6545 $logo.addClass('shrinked'); 6546 $('div', $logo).each(function(index, val){ 6547 $(val).css({ 6548 'height': logoMinScale, 6549 'line-height': logoMinScale 6550 }); 6551 if ($(val).hasClass('text-logo')) { 6552 $(val).css({ 6553 'font-size': logoMinScale + 'px' 6554 }); 6555 } 6556 }); 6557 requestTimeout(function() { 6558 UNCODE.menuMobileHeight = $masthead.outerHeight(); 6559 }, 300); 6560 } else if ( index !== 1 && nextIndex === 1 ) { 6561 $logo.removeClass('shrinked'); 6562 $('div', $logo).each(function(index, val){ 6563 $(val).css({ 6564 'height': logoMaxScale, 6565 'line-height': logoMaxScale 6566 }); 6567 if ($(val).hasClass('text-logo')) { 6568 $(val).css({ 6569 'font-size': logoMaxScale + 'px' 6570 }); 6571 } 6572 }); 6573 requestTimeout(function() { 6574 UNCODE.menuMobileHeight = $masthead.outerHeight(); 6575 }, 300); 6576 } else { 6577 return false; 6578 } 6579 6580 }; 6581 6582 var anchorLink = function(){ 6583 6584 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 6585 var $this = $(e.currentTarget), 6586 hash = e.currentTarget.href.split('#'), 6587 current = window.location.href.split('#'), 6588 ind, 6589 currentMenuOpened = UNCODE.menuOpened, 6590 go = false; 6591 6592 var hash_url = hash[0].replace(/\/?$/, '/'), 6593 current_url = current[0].replace(/\/?$/, '/'); 6594 6595 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 6596 hash = '#'+hash[1]; 6597 e.preventDefault(); 6598 go = true; 6599 } 6600 6601 if ( go ) { 6602 6603 if ( $(hash).length ) { 6604 ind = $(hash).closest('.fp-section').index(); 6605 } else { 6606 hash = hash.slice(1); 6607 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 6608 } 6609 6610 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 6611 ind = $this.closest('.fp-section').index(); 6612 6613 UNCODE.menuOpened = false; 6614 6615 $.fn.fullpage.moveTo(ind+1); 6616 6617 UNCODE.menuOpened = currentMenuOpened; 6618 if (UNCODE.menuOpened) { 6619 if (UNCODE.wwidth < UNCODE.mediaQuery) { 6620 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 6621 } else { 6622 $('.mmb-container-overlay .overlay-close').trigger('click'); 6623 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 6624 } 6625 } 6626 6627 } 6628 6629 }); 6630 6631 $('.header-scrolldown').on('click', function(event) { 6632 event.preventDefault(); 6633 var scrollDown = $(this), 6634 ind = scrollDown.closest('.fp-section').index(); 6635 6636 $.fn.fullpage.moveTo(ind+2); 6637 }); 6638 6639 var anchor = $('.fp-section.active').data('anchor'); 6640 6641 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 6642 $('.menu-item').removeClass('active'); 6643 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 6644 } 6645 6646 }; 6647 6648 var slideLeave = function( index, nextIndex, direction ) { 6649 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 6650 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6651 animationEnd = 'webkitAnimationEnd animationend', 6652 transitionEnd = 'webkitTransitionEnd transitionend', 6653 animOut = effect != 'scaleDown' ? effect + direction : effect, 6654 animIn, 6655 isFooter = false, 6656 isFooterNext = false, 6657 footerH = $footer.outerHeight(), 6658 timeout, 6659 player, iframe, 6660 footerCoeff; 6661 switch( direction ) { 6662 case 'up': 6663 animIn = 'moveFromTop'; 6664 break; 6665 default: 6666 animIn = 'moveFromBottom'; 6667 } 6668 6669 if ( $('body').hasClass('uncode-fullpage-trid') ) { 6670 animOut = animIn + 'trid'; 6671 animIn = animOut + 'In'; 6672 } else if ( UNCODE.isFullPageSnap ) { 6673 animIn = animOut = 'none'; 6674 } 6675 6676 hideMenu(index, nextIndex); 6677 shrinkMenu(index, nextIndex); 6678 6679 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 6680 if ($(this).attr('data-provider') == 'vimeo') { 6681 iframe = $(this).find('iframe'); 6682 player = new Vimeo.Player(iframe[0]); 6683 player.pause(); 6684 } else if ($(this).attr('data-provider') == 'youtube') { 6685 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 6686 } else { 6687 if ($(this).is('video')) { 6688 $(this)[0].volume = 0; 6689 $(this)[0].pause(); 6690 } 6691 } 6692 }); 6693 6694 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 6695 if ($(this).attr('data-provider') == 'vimeo') { 6696 iframe = $(this).find('iframe'); 6697 iframe.on('load', function(){ 6698 player = new Vimeo.Player(iframe); 6699 player.setVolume(0); 6700 player.play(); 6701 }); 6702 player = new Vimeo.Player(iframe); 6703 player.setVolume(0); 6704 player.play(); 6705 } else if ($(this).attr('data-provider') == 'youtube') { 6706 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 6707 } else { 6708 if ($(this).is('video')) { 6709 $(this)[0].volume = 0; 6710 $(this)[0].play(); 6711 } 6712 } 6713 }); 6714 6715 if ( $currentSlide.is($footer) ) 6716 isFooter = true; 6717 6718 if ( $nextSlide.is($footer) ) 6719 isFooterNext = true; 6720 6721 if ( ! UNCODE.isMobile && headerWithOpacity ) { 6722 if ( $currentSlide.is($header) ) 6723 $header.addClass('header-scrolled'); 6724 } 6725 6726 footerCoeff = footerH; 6727 6728 if ( UNCODE.isFullPageSnap ) { 6729 postLeaveActions( nextIndex ); 6730 activateBackWash( nextIndex ); 6731 activateKBurns( nextIndex ); 6732 requestTimeout(function(){ 6733 animationEndAction( index, nextIndex ); 6734 }, fp_anim_time+150); 6735 } else { 6736 if ( isFooterNext ) { 6737 6738 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 6739 $iscrollWrapper.addClass('no-scrolloverflow'); 6740 6741 $nextSlide 6742 .add($currentSlide) 6743 .addClass('uncode-scroll-front') 6744 .addClass('uncode-scroll-active') 6745 .addClass('uncode-scroll-visible'); 6746 $container.css({ 6747 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 6748 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 6749 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6750 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6751 }).off(transitionEnd) 6752 .one(transitionEnd, function(){ 6753 animationEndAction( index, nextIndex ); 6754 }); 6755 6756 } else if ( isFooter ) { 6757 6758 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 6759 .add($currentSlide) 6760 .addClass('uncode-scroll-front') 6761 .addClass('uncode-scroll-active') 6762 .addClass('uncode-scroll-visible'); 6763 $container.css({ 6764 '-webkit-transform': 'translate3d(0, 0, 0)', 6765 'transform': 'translate3d(0, 0, 0)', 6766 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6767 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6768 }) 6769 .one(transitionEnd, function(){ 6770 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 6771 clearRequestTimeout(timeout); 6772 timeout = requestTimeout(function(){ 6773 $.fn.fullpage.moveTo(nextIndex); 6774 slideLeave( index-1, nextIndex, 'up' ); 6775 $container.off(transitionEnd); 6776 }, 50); 6777 } 6778 animationEndAction( index, nextIndex ); 6779 }); 6780 6781 } else { 6782 6783 postLeaveActions( nextIndex ); 6784 6785 if ( !$('body').hasClass('uncode-fullpage-trid') ) 6786 activateParallax( nextIndex, direction ); 6787 6788 var $outBg = $('.background-wrapper', $currentSlide); 6789 6790 $nextSlide 6791 .addClass('uncode-scroll-front') 6792 .addClass('uncode-scroll-active') 6793 .addClass('uncode-scroll-visible') 6794 .addClass('uncode-scroll-animating-in') 6795 .css({ 6796 'z-index':4, 6797 'animation-name': animIn, 6798 'animation-duration': fp_anim_time + 'ms', 6799 'animation-delay': '', 6800 'animation-timing-function': fp_easing, 6801 'animation-fill-mode': 'both', 6802 'transition': 'initial', 6803 }).off(animationEnd) 6804 .on(animationEnd, function(event) { 6805 if ( event.originalEvent.animationName === animIn ) { 6806 $(this) 6807 .addClass('uncode-scroll-already') 6808 .removeClass('uncode-scroll-front') 6809 .removeClass('uncode-scroll-animating-in') 6810 .css({ 6811 'animation-name': '', 6812 'animation-duration': '', 6813 'animation-delay': '', 6814 'animation-timing-function': '', 6815 'animation-fill-mode': '', 6816 'transition': 'initial', 6817 }); 6818 6819 $currentSlide 6820 .removeClass('uncode-scroll-active') 6821 .add($outBg) 6822 .css({ 6823 'animation-name': '', 6824 'animation-duration': '', 6825 'animation-delay': '', 6826 'animation-timing-function': '', 6827 'animation-fill-mode': '', 6828 'transition': 'initial', 6829 }); 6830 6831 animationEndAction( index, nextIndex ); 6832 6833 } 6834 6835 if ( nextIndex > 1 ) 6836 $('body').addClass('window-scrolled'); 6837 else 6838 $('body').removeClass('window-scrolled'); 6839 }); 6840 6841 $currentSlide 6842 .addClass('uncode-scroll-animating-out') 6843 .removeClass('uncode-scroll-front') 6844 .css({ 6845 'z-index':'1', 6846 'animation-name': animOut, 6847 'animation-duration': fp_anim_time + 'ms', 6848 'animation-delay': '', 6849 'animation-timing-function': fp_easing, 6850 'animation-fill-mode': 'both', 6851 'transition': 'initial', 6852 'will-change': 'auto' 6853 }).off(animationEnd) 6854 .on(animationEnd, function(event) { 6855 if ( event.originalEvent.animationName === animOut ) { 6856 $currentSlide.removeClass('uncode-scroll-animating-out'); 6857 } 6858 }); 6859 6860 if ( $('body').hasClass('uncode-fp-opacity') ) { 6861 $currentSlide.find('> div').css({ 6862 'animation-name': 'opacityout', 6863 'animation-duration': fp_anim_time + 'ms', 6864 'animation-delay': '', 6865 'animation-timing-function': fp_easing, 6866 'animation-fill-mode': 'both', 6867 'transition': 'initial', 6868 }).off(animationEnd) 6869 .on(animationEnd, function(event) { 6870 if ( event.originalEvent.animationName === 'opacityout' ) { 6871 $(event.currentTarget).css({ 6872 'animation-name': '', 6873 'animation-duration': '', 6874 'animation-delay': '', 6875 'animation-timing-function': '', 6876 'animation-fill-mode': '', 6877 'transition': '', 6878 }); 6879 } 6880 }); 6881 } 6882 } 6883 } 6884 6885 $('.scroll-top').on('click', function(e){ 6886 $.fn.fullpage.moveTo(1); 6887 return false;
6888 }); 6889 6890 }; 6891 6892 var init_fullPage = function(mode){ 6893 6894 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 6895 // scrollBar = false; 6896 // } 6897 6898 var checkFPeffects; 6899 6900 $container.fullpage({ 6901 sectionSelector: '.uncode-scroll-lock', 6902 scrollOverflow: true, 6903 scrollOverflowOptions: { 6904 click: false, 6905 preventDefaultException: { tagName:/.*/ } 6906 }, 6907 navigation: false, 6908 scrollBar: scrollBar, 6909 scrollingSpeed: fp_anim_time, 6910 verticalCentered: true, 6911 anchors: no_history ? false : dataNames, 6912 recordHistory: !no_history, 6913 afterRender: function(){ 6914 $('body').removeClass('fp-waiting'); 6915 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 6916 var $invisible = $(this).addClass('hidden-scroll');//, 6917 }); 6918 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 6919 var $visible = $(this).addClass('uncode-scroll-visible'), 6920 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 6921 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 6922 }); 6923 6924 $('ul.onepage-pagination a').on('click', function(e){ 6925 e.preventDefault(); 6926 var $a = $(this), 6927 toIndex = $a.data('index'); 6928 6929 $.fn.fullpage.moveTo(toIndex+1); 6930 }); 6931 6932 requestTimeout(function(){ 6933 scrollHashes(); 6934 }, 1000); 6935 6936 $(window).on('hashchange', function(e){ 6937 requestTimeout(function(){ 6938 scrollHashes(); 6939 }, 500); 6940 }); 6941 6942 anchorLink(); 6943 6944 if ( $('body').hasClass('uncode-fp-opacity') ) { 6945 $all.each(function(index, row) { 6946 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 6947 classBg; 6948 6949 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 6950 classBg = testmatch[0]; 6951 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 6952 } 6953 }); 6954 } 6955 6956 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 6957 $(window).on('menuOpen gdprOpen', function(){ 6958 $.fn.fullpage.setAutoScrolling(false); 6959 }).on('menuClose gdprClose', function(){ 6960 $.fn.fullpage.setAutoScrolling(true); 6961 }); 6962 } 6963 6964 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 6965 requestTimeout(function(){ 6966 $.fn.fullpage.setAutoScrolling(false); 6967 }, 1000); 6968 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 6969 $.fn.fullpage.setAutoScrolling(true); 6970 }); 6971 6972 if ( !UNCODE.isFullPageSnap ) { 6973 clearRequestTimeout(checkFPeffects); 6974 checkFPeffects = requestTimeout(function(){ 6975 activateBackWash( 1 ); 6976 activateKBurns( 1 ); 6977 }, 100); 6978 } 6979 6980 }, 6981 onLeave: function( index, nextIndex, direction ){ 6982 6983 if ( UNCODE.menuOpened || is_scrolling ) 6984 return false; 6985 6986 is_scrolling = true; 6987 6988 var event = new CustomEvent('fp-slide-leave'); 6989 window.dispatchEvent(event); 6990 6991 slideLeave( index, nextIndex, direction ); 6992 6993 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 6994 if ( direction === 'up' ) { 6995 $.fn.fullpage.moveTo(nextIndex-1); 6996 } else { 6997 $.fn.fullpage.moveTo(nextIndex+1); 6998 } 6999 return false; 7000 } 7001 7002 $('ul.onepage-pagination a').removeClass('is-selected'); 7003 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7004 7005 } 7006 }); 7007 }; 7008 7009 init_fullPage(); 7010 $(window).on('load', function(){ 7011 requestTimeout(function(){ 7012 $.fn.fullpage.reBuild(); 7013 }, 3000); 7014 }); 7015 7016 var addScrollingClass, 7017 removeScrollingClass; 7018 7019 window.addEventListener("fp-slide-scroll", function(){ 7020 addScrollingClass = requestTimeout( function(){ 7021 $('body').addClass('fp-slide-scrolling'); 7022 }, 10 ); 7023 7024 clearRequestTimeout(removeScrollingClass); 7025 removeScrollingClass = requestTimeout( function(){ 7026 $('body').removeClass('fp-slide-scrolling'); 7027 }, 150 ); 7028 7029 Waypoint.refreshAll(); 7030 }, false); 7031 7032 var setFPheight = function(){ 7033 var $body = document.body, 7034 $footer = document.getElementById('colophon'), 7035 $maincontainer = document.querySelector('.main-wrapper'), 7036 $boxcontainer = document.querySelector('.box-container'), 7037 $sections = document.querySelectorAll('.fp-section'), 7038 rect = $maincontainer.getBoundingClientRect(), 7039 rect2 = $boxcontainer.getBoundingClientRect(), 7040 $masthead = document.getElementById('masthead'), 7041 _hideMenu = false, 7042 menuHeight = UNCODE.menuHeight; 7043 $body.style.height = UNCODE.wheight + 'px'; 7044 7045 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 7046 _hideMenu = true; 7047 } 7048 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 7049 menuHeight = 0 7050 } 7051 7052 7053 if ( theres_footer ) 7054 $footer.style.top = (rect.height || rect2.height) + 'px'; 7055 7056 for (var i = 0; i < $sections.length; i++) { 7057 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 7058 } 7059 }; 7060 7061 setFPheight(); 7062 7063 window.addEventListener('resize', setFPheight, false); 7064 window.addEventListener('orientationchange', setFPheight, false); 7065 7066}; 7067 7068UNCODE.particles = function() { 7069 $(".vc-particles-background").each(function() { 7070 var $particle = $(this); 7071 var $parent = $particle.closest('[data-parent]'); 7072
7073 $parent.prepend($particle); 7074 // $(window).trigger('resize'); 7075 }) 7076}; 7077 7078 7079UNCODE.filters = function() { 7080 var $systems = $('.isotope-system, .cssgrid-system'); 7081 7082 $systems.each(function(index, val){ 7083 var $system = $(this), 7084 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 7085 $widgets = $('.widgetized-cb-wrapper', $system), 7086 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 7087 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 7088 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 7089 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 7090 7091 if ($system.hasClass('isotope-processed')) { 7092 return; 7093 } 7094 7095 $cats_trigger.on('click', function(e) { 7096 if ( ! $('html').hasClass('screen-sm') ) { 7097 // $widgets.add($sorting_dd).slideUp(400); 7098 e.preventDefault(); 7099 $widgets.slideUp(400, 'easeInOutCirc'); 7100 } 7101 }); 7102 7103 $('.filters-toggle-trigger', $system).on('click', function(e) { 7104 e.preventDefault(); 7105 var $filters = $('.isotope-filters .menu-horizontal', $system); 7106 $filters.slideToggle(400, 'easeInOutCirc'); 7107 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7108 }); 7109 7110 $widget_trgr.on('click', function(e) { 7111 e.preventDefault(); 7112 $widgets.slideToggle(400, 'easeInOutCirc'); 7113 if (!$('html').hasClass('screen-sm')) { 7114 $cats_filters.slideUp(400, 'easeInOutCirc'); 7115 } 7116 window.dispatchEvent(new CustomEvent('boxResized')); 7117 }); 7118 7119 $sorting_trgr.on('click', function(e) { 7120 e.preventDefault(); 7121 if (!$('html').hasClass('screen-sm')) { 7122 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7123 } 7124 }); 7125 7126 $system.addClass('isotope-processed'); 7127 }); 7128 7129}; 7130 7131UNCODE.widgets = function() { 7132 var widget_collapses = $('.widget-collapse'); 7133 7134 widget_collapses.each(function(){ 7135 var widget_collapse = $(this), 7136 widget_title = widget_collapse.find('.widget-title'), 7137 widget = widget_title.closest('.widget'), 7138 content = widget.children().not('.widget-title'), 7139 setCTA; 7140 7141 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 7142 widget_title.toggleClass('open'); 7143 } 7144 7145 widget_title.each(function() { 7146 var _this = $(this); 7147 var content = _this.closest('.widget').find('.widget-collapse-content'); 7148 7149 $(window).on('load resize', function(){ 7150 clearRequestTimeout(setCTA); 7151 setCTA = requestTimeout( function() { 7152 if ( content.is(':visible') ) { 7153 _this.addClass( 'open' ); 7154 } else { 7155 _this.removeClass( 'open' ); 7156 } 7157 }, 10 ); 7158 }) 7159 7160 _this.on( 'click', function(){ 7161 7162 // Get content of :after element (+ icon) to check the visibility 7163 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 7164 7165 if (icon_content === 'none' || !icon_content) { 7166 return false; 7167 } 7168 7169 _this.toggleClass('open'); 7170 var isOpen = _this.hasClass('open'), 7171 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 7172 content.animate({ 7173 height: 'toggle', 7174 padding: 'toggle', 7175 opacity: 'toggle', 7176 top: isOpen ? 0 : hasBorder 7177 }, { 7178 duration: 400, 7179 easing: "easeInOutCirc", 7180 }); 7181 7182 return false; 7183 7184 }); 7185 }); 7186 }); 7187 7188 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 7189}; 7190 7191UNCODE.unmodal = function() { 7192 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 7193 $('.unmodal-overlay').fadeIn(); 7194 $('.unmodal-overlay').addClass('loading'); 7195 $('body').addClass('uncode-unmodal-overlay-visible'); 7196 $(window).trigger('unmodal-open'); 7197 }); 7198 7199 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 7200 $('.unmodal-overlay').fadeOut(); 7201 $('.unmodal').fadeOut(); 7202 $('body').removeClass('uncode-unmodal-overlay-visible'); 7203 $('body').removeClass('uncode-unmodal-open'); 7204 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 7205 $(document).trigger('unmodal-close'); 7206 UNCODE.isUnmodalOpen = false; 7207 }); 7208 7209 $(document).on('uncode-unmodal-show-content', function() { 7210 $('.unmodal-overlay').removeClass('loading'); 7211 $('.unmodal').show(); 7212 $('.unmodal').addClass('show-unmodal-with-animation'); 7213 $('.unmodal-content')[0].scrollTop = 0; 7214 $('body').addClass('uncode-unmodal-open'); 7215 UNCODE.isUnmodalOpen = true; 7216 7217 if ($('body').hasClass('qw-body-scroll-disabled')) { 7218 $('html').addClass('uncode-unmodal-body-disable-scroll'); 7219 } 7220 7221 if ($('.unmodal').hasClass('auto-height')) { 7222 set_modal_height(); 7223 } 7224 }); 7225 7226 var set_modal_height = function() { 7227 var modal = $('.unmodal'); 7228 var window_height = $(window).outerHeight(); 7229 var modal_height = modal.outerHeight(); 7230 7231 modal.css('height', 'auto'); 7232 7233 if (modal_height > window_height) { 7234 modal.outerHeight(window_height); 7235 } 7236 } 7237 7238 if ($('.unmodal').hasClass('auto-height')) { 7239 var setCTA; 7240 7241 $(window).on('resize', function() { 7242 clearRequestTimeout(setCTA); 7243 setCTA = requestTimeout(function() { 7244 set_modal_height(); 7245 }, 100); 7246 }); 7247 } 7248}; 7249 7250UNCODE.bgChanger = function() { 7251 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 7252 $bg_first = $('.vc_row[data-bg-remove]'), 7253 bg_remove = $bg_first.attr('data-bg-remove'), 7254 $first = $bg_changers.first(), 7255 $last = $bg_changers.last(), 7256 $bg_wrapper = $('#changer-back-color'), 7257 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 7258 setCTA, localH = UNCODE.wheight, 7259 isScrolling; 7260 7261 $bg_first.removeClass(bg_remove); 7262 7263 var bgChange = function($col, bgColor, skin, tmbskin){ 7264 $bg_wrapper.attr( 'class', bgColor ); 7265 var menuskin; 7266 if ( typeof skin !== 'undefined' ) { 7267 menuskin = skin.replace('style', 'menu') 7268 } 7269 7270 if ( $col.length ) { 7271 $('.uncol[data-skin-change]').each(function(){ 7272 var $isoFooter = $('.isotope-footer', this); 7273 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 7274 if ( menuskin !== '' ) {
7275 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 7276 } 7277 }); 7278 7279 $('.tmb[data-skin-change]').each(function(){ 7280 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 7281 }); 7282 } 7283 }; 7284 7285 var $masthead = $('#masthead'), 7286 transDesktop, 7287 transMobile, 7288 changeSkin, 7289 7290 checkTransparencyAndChange = function( skin ){ 7291 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 7292 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 7293 changeSkin = $masthead.hasClass('menu-change-skin'); 7294 7295 if ( ! transDesktop && ! transMobile ) { 7296 return false; 7297 } 7298 7299 if ( ! changeSkin ) { 7300 return false; 7301 } 7302 7303 if ( skin === 'style-light' ){ 7304 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7305 return false; 7306 } else if ( skin === 'style-dark' ) { 7307 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7308 return false; 7309 } 7310 }; 7311 7312 var bg_waypoints = function(){ 7313 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 7314 7315 $.each($bg_changers, function(index, row) { 7316 7317 var $row = $(row), 7318 $col = $('.uncol[data-skin-change]', $row).eq(0), 7319 skin, 7320 $tmbs, 7321 tmbskin, 7322 bgColor = $row.attr('data-bg-color'); 7323 7324 if ( ! $row.is(':visible') ) { 7325 return false; 7326 } 7327 7328 if ( $col.length ) { 7329 skin = $col.attr('data-skin-change'); 7330 $tmbs = $('.tmb[data-skin-change]', $row); 7331 tmbskin = skin.replace('style', 'tmb'); 7332 } 7333 7334 if ( ! $row.hasClass('unscroll-horizontal') ) { 7335 $row.waypoint(function( dir ) { 7336 if ( dir === 'down' ) { 7337 bgChange($col, bgColor, skin, tmbskin); 7338 checkTransparencyAndChange(skin); 7339 } else { 7340 return; 7341 } 7342 }, {
7343 offset: '50%' 7344 }); 7345 7346 $row.waypoint(function( dir ) { 7347 if ( dir === 'up' ) { 7348 bgChange($col, bgColor, skin, tmbskin); 7349 checkTransparencyAndChange(skin); 7350 } else { 7351 return; 7352 } 7353 }, { 7354 offset: function() { 7355 var clH = this.element.clientHeight, 7356 wH = window.innerHeight, 7357 ret = clH > 200 ? -100 : clH * -0.5; 7358 return ( wH / 2 ) - clH; 7359 } 7360 }); 7361 } 7362 7363 }); 7364 7365 $('body').addClass('bg-changer-init'); 7366 7367 } 7368 }; 7369 7370 var body = document.body, 7371 edges = false; 7372 7373 var throttle = function(fn, wait) { 7374 var time = Date.now(); 7375 return function() { 7376 if ((time + wait - Date.now()) < 0) { 7377 fn(); 7378 time = Date.now(); 7379 } 7380 } 7381 } 7382 7383 var $wrapper = document.querySelector(".main-wrapper"), 7384 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 7385 7386 var $title = document.querySelector('#rotating'); 7387 if ( $title !== null ) { 7388 $title.style.whiteSpace = 'nowrap'; 7389 $title.style.transition = 'transform 200ms linear'; 7390 } 7391 7392 window.addEventListener( 'scroll', throttle( function() { 7393 window.clearRequestTimeout( isScrolling ); 7394 7395 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 7396 7397 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 7398 body = document.body, 7399 html = document.documentElement, 7400 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 7401 $row = false, 7402 firstOff, 7403 lastOff; 7404 7405 if ( scrolled < 100 && $first.length ) { 7406 firstOff = $first.offset().top; 7407 if ( firstOff < 100 ) { 7408 var $row = $first; 7409 } 7410 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 7411 lastOff = $last.offset().top + $last.outerHeight(); 7412 if ( lastOff > ( docH - 100 ) ) { 7413 var $row = $last; 7414 } 7415 } 7416 7417 if ( $row.length ) { 7418 var $col = $('.uncol[data-skin-change]', $row).eq(0), 7419 skin, 7420 $tmbs, 7421 tmbskin, 7422 bgColor = $row.attr('data-bg-color'); 7423 7424 if ( $col.length ) { 7425 skin = $col.attr('data-skin-change'); 7426 $tmbs = $('.tmb[data-skin-change]', $row); 7427 tmbskin = skin.replace('style', 'tmb'); 7428 } 7429 7430 bgChange($col, bgColor, skin, tmbskin); 7431 checkTransparencyAndChange(skin); 7432 edges = true; 7433 } 7434 7435 }, 150); 7436 7437 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 7438 bg_waypoints(); 7439 Waypoint.refreshAll(); 7440 edges = false; 7441 } 7442 7443 }, 100), false); 7444 7445 $(window).on('resize', function() { 7446 clearRequestTimeout(setCTA); 7447 setCTA = requestTimeout(function() { 7448 if ( localH != UNCODE.wheight ) { 7449 localH = UNCODE.wheight; 7450 bg_waypoints(); 7451 Waypoint.refreshAll(); 7452 } 7453 }, 100); 7454 }); 7455 7456 bg_waypoints(); 7457 7458}; 7459 7460UNCODE.skewIt = function() { 7461 7462 if ( $('body').hasClass('compose-mode') ) { 7463 return; 7464 } 7465 7466 var justscrolled = false; 7467 7468 var loadSkewIt = function(){ 7469 7470 var $pageHeader = $('#page-header'), 7471 $page_body = $('.page-body'), 7472 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 7473 7474 if ( $header_skew.length ) { 7475 $pageHeader.addClass('uncode-skew').css({ 7476 position: 'relative', 7477 zIndex: 1 7478 }); 7479 $header_skew.removeClass('uncode-skew'); 7480 $page_body.css({ 7481 position: 'relative', 7482 zIndex: 0 7483 }); 7484 } 7485 7486 var $skew = $('.uncode-skew'), 7487 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 7488 horizontal = $horizontal.length, 7489 stopSkewing, 7490 lastOffset = 0, 7491 lastDate = Date.now(); 7492 7493 if ( ! $skew.length ) { 7494 return; 7495 } 7496 7497 var dropSkew = function(){ 7498 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 7499 return; 7500 7501 $skew.each(function(){ 7502 var $this = $(this), 7503 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 7504 7505 if ( $drop.length ) { 7506 $this.css({ 7507 'transform': 'skew(0)' 7508 }); 7509 var bound = $this[0].getBoundingClientRect(); 7510 $drop.css({ 7511 left: bound.x * -1, 7512 top: bound.y * -1, 7513 }); 7514 } 7515 }); 7516 }; 7517 dropSkew(); 7518 7519 $(window).on('resize', dropSkew); 7520 7521 window.addEventListener( 'scroll', function() { 7522 7523 if ( justscrolled !== true ) { 7524 justscrolled = true; 7525 return; 7526 } 7527 7528 window.clearRequestTimeout( stopSkewing ); 7529 7530 var now = Date.now(), 7531 delayInMs = now - lastDate, 7532 offset = window.pageYOffset || window.document.documentElement.scrollTop, 7533 newOffset = offset - lastOffset, 7534 speed = Math.pow((newOffset / delayInMs), 3) * -1, 7535 body = document.body, 7536 html = document.documentElement, 7537 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 7538 wait = 50, 7539 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 7540 7541 if ((lastDate + wait - now) < 0) { 7542 7543 lastDate = now; 7544 lastOffset = offset; 7545 7546 if ( speed > 6 ) { 7547 speed = 6; 7548 } else if ( speed < -6 ) { 7549 speed = -6; 7550 } 7551 7552 if ( speed > 2 && offset < UNCODE.wheight ) { 7553 speed = 2; 7554 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 7555 speed = -2; 7556 } 7557 7558 var speedY = speed, 7559 speedX = speed * 1.25; 7560 7561 if ( horizontal ) { 7562 speedY = 0; 7563 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 7564 speedX = 0; 7565 return; 7566 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 7567 speedX = 0; 7568 return; 7569 } 7570 } else { 7571 speedX = 0; 7572 } 7573 7574 if ( ! $skew.closest('.enter-st').length ) { 7575 speedX = 0; 7576 } 7577 7578 gsap.killTweensOf($skew); 7579 gsap.to( $skew, { 7580 duration: 0.2, 7581 skewY: (speedY * maxSpeed) + "deg", 7582 skewX: (speedX * maxSpeed) + "deg", 7583 ease: Power0.easeNone, 7584 transformOrigin: 'center', 7585 }); 7586 7587 } 7588 7589 stopSkewing = requestTimeout(function() { 7590 gsap.killTweensOf($skew); 7591 gsap.to( $skew, { 7592 duration: 0.5, 7593 skewY: "0deg", 7594 skewX: "0deg", 7595 transformOrigin: 'center', 7596 ease: Expo.easeOut, 7597 }); 7598 7599 $skew.each(function(){ 7600 var $this = $(this), 7601 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 7602 7603 if ( $drop.length ) { 7604 var bound = $this[0].getBoundingClientRect() 7605 $drop.css({ 7606 left: bound.x * -1, 7607 top: bound.y * -1, 7608 }); 7609 } 7610 }); 7611 7612 }, 200); 7613 7614 }, false); 7615 7616 }; 7617 7618 $(window).on('load', loadSkewIt); 7619 7620}; 7621 7622UNCODE.rotateIt = function() { 7623 7624 if ( $('body').hasClass('compose-mode') ) { 7625 return; 7626 } 7627 7628 var loadRotateIt = function(){ 7629 7630 var $toRotate = $('.uncode-rotate'); 7631 7632 $toRotate.each(function(){ 7633 var $rotate = $(this), 7634 deg = 0, 7635 dir = true, 7636 coeff = 1, 7637 lastOffset = 0, 7638 lastDate = Date.now(); 7639 7640 var checkScroll = function($rotate){ 7641 // if ( ! $rotate.length ) { 7642 // return; 7643 // } 7644 7645 var now = Date.now(), 7646 delayInMs = now - lastDate, 7647 offset = window.pageYOffset || window.document.documentElement.scrollTop, 7648 newOffset = offset - lastOffset, 7649 speed = (newOffset / delayInMs) * 5, 7650 body = document.body, 7651 html = document.documentElement, 7652 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 7653 7654 lastDate = now; 7655 lastOffset = offset; 7656 7657 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 7658 deg = 0; 7659 } 7660 7661 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 7662 deg = parseFloat(deg) + parseFloat(speed); 7663 } 7664 7665 if ( $rotate.hasClass('uncode-rotate-hover') ) { 7666 $rotate.hover(function(){ 7667 coeff = 1.75; 7668 }, function(){ 7669 coeff = 1; 7670 }); 7671 } 7672 7673 // if ( speed > 0 ) { 7674 // dir = true 7675 // } else if ( speed < 0 ) { 7676 // dir = false 7677 // } 7678 7679 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 7680 deg = deg+coeff; 7681 // if ( dir ) { 7682 // deg = deg+coeff; 7683 // } else { 7684 // deg = deg-coeff; 7685 // } 7686 } 7687 7688 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 7689 7690 requestAnimationFrame(function() { 7691 checkScroll($rotate); 7692 }); 7693 7694 }; 7695 7696 checkScroll($rotate); 7697 7698 }); 7699 7700 }; 7701 7702 $(window).on('load', loadRotateIt); 7703 7704}; 7705 7706var marqueeAttempts = 0, 7707 marqueeTO; 7708 7709UNCODE.textMarquee = function( $titles ) { 7710 7711 if ( typeof $titles == 'undefined' ) { 7712 $titles = $('.un-text-marquee'); 7713 } 7714 7715 if ( ! $titles.length || SiteParameters.is_frontend_editor ) { 7716 return; 7717 } 7718 7719 $titles.each(function(){ 7720 var $title = $(this), 7721 $span = $('> span', $title), 7722 txt, 7723 first = true, 7724 newW = UNCODE.wwidth; 7725 7726 $('.marquee-clone-wrap', $title).remove(); 7727 7728 txt = $title.text(); 7729 7730 if ( ! $('.marquee-original-core', $span).length ) { 7731 $span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 7732 } 7733 7734 var checkResize, 7735 spanW, 7736 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 7737 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 7738 clearSpeed, 7739 speed = 10; 7740 7741 $span.prepend($prepended); 7742 $span.append($appended); 7743 7744 var continuousTextMarquee = function(){ 7745 var bound = $title.css({ 7746 'transform': 'none', 7747 'opacity': 0 7748 }).offset(); 7749 7750 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 7751 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 7752 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 7753 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 7754 7755 var marqueeTL = new TimelineMax({paused:true, reversed:true}); 7756 7757 var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0]; 7758 7759 var inview = new Waypoint.Inview({ 7760 element: inViewElement, 7761 enter: function(direction) { 7762 marqueeTL.play(); 7763 }, 7764 exited: function(direction) { 7765 marqueeTL.pause(); 7766 } 7767 }); 7768 7769 //gsap.killTweensOf($title);
7770 marqueeTL.fromTo( $title, { 7771 opacity: 1, 7772 x: xStrt 7773 }, 7774 { 7775 duration: xSpeed / UNCODE.wwidth * speed, 7776 x: xEnd * direction, 7777 onComplete: function(){ 7778 first = false; 7779 continuousTextMarquee(); 7780 }, 7781 ease: Linear.easeNone 7782 }); 7783 }; 7784 7785 var runTextMarquee = function(){ 7786 var time = Date.now(); 7787 7788 var textMarqueeScroll = function(){ 7789 var $row = $title.closest('.vc_row'), 7790 $bound = $title.closest('.pin-spacer').length ? $row : $title, 7791 bound = $bound[0].getBoundingClientRect(), 7792 wait = 100, 7793 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1; 7794 7795 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 7796 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 7797 marqueeAttempts < 2 ) { 7798 7799 clearRequestTimeout(marqueeTO); 7800 7801 marqueeTO = requestTimeout(function(){ 7802 marqueeAttempts++; 7803 UNCODE.textMarquee(); 7804 }, 100); 7805 } 7806 7807 //if ((time + wait - Date.now()) < 0) { 7808 //if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) { 7809 // $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)'; 7810 gsap.killTweensOf($title); 7811 gsap.to( $title, { 7812 duration: 0.24, 7813 x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction, 7814 //ease: Expo.easeOut, 7815 }); 7816 //} 7817 //time = Date.now(); 7818 //} 7819 }; 7820 7821 textMarqueeScroll(); 7822 $(window).on( 'load scroll', function() { 7823 textMarqueeScroll(); 7824 }); 7825 7826 }; 7827 7828 var cloneSpan = function($_title, cntnt){ 7829 7830 if ( $_title.hasClass('un-marquee-infinite') ) { 7831 $('> span.marquee-clone-wrap', $_title).text(''); 7832 } 7833 7834 gsap.to( $_title, { 7835 duration: 0, 7836 x: 0 7837 }); 7838 spanW = $span.outerWidth(); 7839 7840 if ( !spanW ) { 7841 return; 7842 } 7843 7844 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2; 7845 7846 if ( $_title.hasClass('un-marquee-infinite') ) { 7847 7848 for ( var i = 0; i < part; i++ ) { 7849 $prepended[0].textContent += cntnt + "\u00A0"; 7850 $appended[0].textContent += cntnt + "\u00A0"; 7851 } 7852 } 7853 7854 if ( $('body').hasClass('compose-mode') ) { 7855 return; 7856 } 7857 7858 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 7859 continuousTextMarquee(); 7860 } 7861 7862 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 7863 runTextMarquee(); 7864 } 7865 7866 }; 7867 7868 var marqueResize = function(){ 7869 clearRequestTimeout(checkResize); 7870 checkResize = requestTimeout(function(){ 7871 if ( newW !== UNCODE.wwidth ) { 7872 gsap.killTweensOf($title); 7873 UNCODE.textMarquee(); 7874 newW = UNCODE.wwidth; 7875 } 7876 }, 1000); 7877 }; 7878 7879 $(window).off('resize', marqueResize) 7880 .on( 'resize', marqueResize); 7881 7882 cloneSpan($title, txt); 7883 7884 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 7885 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 7886 // imageHover(); 7887 var $_titles = $('.un-text-marquee',e.view.$el); 7888 UNCODE.textMarquee($_titles); 7889 }); 7890 } 7891 }); 7892 7893}; 7894 7895UNCODE.parallax = function() { 7896 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 7897 if ($('.parallax-el').length > 0) { 7898 var parallax_elements = new Rellax('.parallax-el'); 7899 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 7900 window.addEventListener('boxResized', function(e) { 7901 parallax_elements.refresh(); 7902 }, false); 7903 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 7904 requestTimeout(function() { 7905 parallax_elements.refresh(); 7906 }, 100); 7907 }); 7908 7909 } 7910 } 7911}; 7912 7913UNCODE.magicCursor = function(){ 7914 var $customCursor = $('#uncode-custom-cursor'), 7915 $customPilot = $('#uncode-custom-cursor-pilot'), 7916 $postLists = $('.uncode-post-titles'), 7917 currentCursor = 'auto', 7918 setTime, 7919 isScrolling, 7920 mouseEvent; 7921 7922 function delayChangeCursor(cursorType, delayt_time){ 7923 clearRequestTimeout(setTime); 7924 setTime = requestTimeout(function() { 7925 $customCursor.attr('data-cursor', cursorType); 7926 if ( $customPilot.length ) { 7927 $customPilot.attr('data-cursor', cursorType); 7928 }
7929 currentCursor = cursorType; 7930 }, delayt_time); 7931 } 7932 7933 function changeCursor($wrap){ 7934 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 7935 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]', 7936 $href = $wrap.find(href), 7937 cursorType, 7938 setTime, set_delay; 7939 7940 $href.hover(function(e) { 7941 var $this = $(this), 7942 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 7943 is_frontend_editor = $this.closest('.vc_controls').length, 7944 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 7945 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 7946 if ( is_frontend_editor ) { 7947 cursorType = 'auto'; 7948 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 7949 cursorType = data_cursor; 7950 } else if ( $parent_cursor.length ) { 7951 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 7952 cursorType = 'icon-light'; 7953 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 7954 cursorType = 'icon-diff'; 7955 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 7956 cursorType = 'icon-accent'; 7957 } else { 7958 cursorType = 'icon-dark'; 7959 } 7960 } else { 7961 cursorType = 'pointer'; 7962 } 7963 delayChangeCursor(cursorType, 0); 7964 }, function(){ 7965 delayChangeCursor('auto', 150); 7966 }); 7967 7968 $(window).on('disable-hover', function(event) { 7969 document.addEventListener("mousemove", function(e) { 7970 mouseEvent = e; 7971 }); 7972 delayChangeCursor('auto', 0); 7973 }); 7974 7975 $(window).on('enable-hover', function(event) { 7976 if ( typeof mouseEvent !== 'undefined' ) { 7977 var x = mouseEvent.clientX, 7978 y = mouseEvent.clientY; 7979 7980 var elements = document.elementsFromPoint(x, y), 7981 $element = $(elements[0]); 7982 7983 $element.closest(href).trigger('mouseenter'); 7984 } 7985 }); 7986 7987 } 7988 7989 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 7990 changeCursor(); 7991 }); 7992 7993 $(document).ajaxComplete(function( event, xhr, settings ) { 7994 changeCursor(); 7995 }); 7996 7997 $('.isotope-container').on('isotope-layout-complete', function() { 7998 var $this = $(this); 7999 changeCursor($this); 8000 }); 8001 8002}; 8003 8004UNCODE.magneticCursor = function(){ 8005 function magneticCursor($wrap){ 8006 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 8007 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')); 8008 8009 $magnetics.on('mousemove', function(e){ 8010 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 8011 bound = e.currentTarget.getBoundingClientRect(), 8012 coeff = 30, 8013 hor = (bound.width / 2) - (e.clientX - bound.left), 8014 ver = (bound.height / 2) - (e.clientY - bound.top), 8015 toX = hor / bound.width * coeff, 8016 toY = ver / bound.height * coeff, 8017 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 8018 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 8019 toScale = Math.max(scaleX, scaleY); 8020 8021 gsap.killTweensOf($el); 8022 gsap.to( $el, { 8023 duration: 0.75, 8024 x: toX, 8025 y: toY, 8026 scale: toScale, 8027 ease: Power1.easeOut, 8028 transformPerspective: 900, 8029 transformOrigin: 'center', 8030 force3D: true 8031 }); 8032 }).on('mouseout', function(e){ 8033 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 8034 gsap.killTweensOf($el); 8035 gsap.to( $el, { 8036 duration: 0.6, 8037 y: 0, 8038 x: 0, 8039 scale: 1, 8040 ease: Power1.easeOut, 8041 transformPerspective: 900, 8042 transformOrigin: 'center', 8043 force3D: true 8044 }); 8045 }); 8046 }; 8047 8048 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8049 magneticCursor(); 8050 }); 8051 8052 $(document).ajaxComplete(function( event, xhr, settings ) { 8053 magneticCursor(); 8054 }); 8055 8056 $('.isotope-container').on('isotope-layout-complete', function() { 8057 var $this = $(this); 8058 magneticCursor($this); 8059 }); 8060 8061}; 8062 8063UNCODE.dropImage = function() { 8064 8065 /**************************** 8066 * Image hover * 8067 ****************************/ 8068 function imageHover(){ 8069 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8070 return; 8071 } 8072 8073 var $postLists = $('.uncode-post-titles'); 8074 $postLists.each(function(){ 8075 var $list = $(this), 8076 timing = parseFloat( $list.attr('data-timing') ), 8077 default_image = $list.hasClass('uncode-post-titles-default-image'), 8078 default_title = $list.hasClass('uncode-post-titles-default-title'), 8079 $tmbs = $('.tmb', $list), 8080 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 8081 clientX, 8082 clientY, 8083 $row_parent = $list.closest('.vc_row'), 8084 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 8085 $col_parent = $list.closest('.uncell'), 8086 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 8087 setCTA; 8088 8089 timing *= 0.001; 8090 8091 var drop_bgs = function(){ 8092 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 8093 var $drop = $(this), 8094 srcset = $drop.attr('data-bgset'), 8095 setArr = srcset.split(","), 8096 setArrOrder = [], 8097 biggest = 0, 8098 checkBg = false;
8099 8100 if ( SiteParameters.uncode_adaptive == true ) { 8101 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 8102 $drop.css({ 8103 'background-image' : 'url(' + setArr[0] + ')' 8104 }); 8105 } 8106 } else { 8107 for ( var i = 0; i < setArr.length; i++ ) { 8108 var setLoop = setArr[i].trim().split(" "); 8109 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 8110 var parseSet = parseFloat(setLoop[1]); 8111 if ( biggest < parseSet ) { 8112 biggest = parseSet; 8113 } 8114 setArrOrder[parseSet] = setLoop[0]; 8115 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 8116 checkBg = true; 8117 $drop.css({ 8118 'background-image' : 'url(' + setLoop[0] + ')' 8119 }); 8120 } 8121 } 8122 } 8123 8124 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 8125 $drop.css({ 8126 'background-image' : 'url(' + setArrOrder[biggest] + ')' 8127 }); 8128 } 8129 } 8130 8131 }); 8132 }; 8133 8134 drop_bgs(); 8135 8136 var dropMovesSize = function(){ 8137 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 8138 return; 8139 } 8140 $drop_moves.each(function(){ 8141 var $drop_move = $(this), 8142 dataW = $drop_move.attr('data-w'), 8143 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 8144 if ( typeof dataW !== 'undefined' && dataW !== null ) { 8145 dataW = screenInfo.width / 12 * parseFloat( dataW ); 8146 } 8147 $drop_moves.css({ 8148 width: dataW 8149 }); 8150 8151 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8152 $anim_parent.on('animationend', function(){ 8153 var bound = $anim_parent[0].getBoundingClientRect(); 8154 $drop_move.css({ 8155 left: bound.x * -1, 8156 top: bound.y * -1, 8157 }); 8158 }); 8159 } 8160 }); 8161 8162 8163 }; 8164 8165 dropMovesSize(); 8166 8167 $(window).on( 'resize', function(){ 8168 clearRequestTimeout(setCTA); 8169 setCTA = requestTimeout( function() { 8170 drop_bgs(); 8171 dropMovesSize(); 8172 }, 100 ); 8173 }); 8174 8175 if ( $drop_row_parents.length ) { 8176 $row_parent.addClass( 'drop-added' ); 8177 } 8178 8179 $drop_row_parents.each(function(index, val){ 8180 var $drop = $(val); 8181 $row_parent.prepend($drop); 8182 manageVideos($drop, false); 8183 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8184 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8185 } 8186 if ( default_image && index == 0 ) { 8187 manageVideos($drop, true); 8188 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8189 image_ph = new Image(); 8190 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8191 image_ph.onload = function() { 8192 $drop.addClass('active'); 8193 if ( default_title ) { 8194 $list.addClass('drop-hover'); 8195 $tmbs.first().addClass('drop-active'); 8196 } 8197 }; 8198 image_ph.src = bg_img; 8199 } 8200 } 8201 }); 8202 8203 if ( $drop_col_parents.length ) { 8204 $col_parent.addClass( 'drop-added' ); 8205 } 8206 8207 $drop_col_parents.each(function(index, val){ 8208 var $drop = $(this); 8209 $col_parent.prepend($drop); 8210 manageVideos($drop, false); 8211 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8212 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8213 } 8214 if ( default_image && index == 0 ) { 8215 manageVideos($drop, true); 8216 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8217 image_ph = new Image(); 8218 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8219 image_ph.onload = function() { 8220 $drop.addClass('active'); 8221 if ( default_title ) { 8222 $list.addClass('drop-hover'); 8223 $tmbs.first().addClass('drop-active'); 8224 } 8225 }; 8226 image_ph.src = bg_img; 8227 } 8228 } 8229 }); 8230 8231 function manageVideos( $el, start ) { 8232 var videoElem = $('video', $el), 8233 $iframe = $('iframe', $el), 8234 iframeID = $iframe.attr('id'); 8235 if ( videoElem.length ) { 8236 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 8237 if ( start ) { 8238 videoElem[0].setCurrentTime(0); 8239 videoElem[0].play(); 8240 } else { 8241 videoElem[0].pause(); 8242 videoElem[0].setCurrentTime(0); 8243 } 8244 } else { 8245 if ( start ) { 8246 videoElem[0].currentTime = 0; 8247 videoElem[0].play(); 8248 } else { 8249 videoElem[0].pause(); 8250 videoElem[0].currentTime = 0; 8251 } 8252 } 8253 } 8254 8255 $el.data('active', start); 8256 8257 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 8258 var iframeIDv = iframeID.replace('okplayer-', ''), 8259 optionsV = $(window).data('okoptions-' + iframeIDv), 8260 vimeo = $iframe[0], 8261 playerV = new Vimeo.Player(vimeo), 8262 timeV = 0; 8263 8264 if (optionsV.time != null) { 8265 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 8266 for ( var i = 0; i < timeArr.length; i++ ) { 8267 if ( timeArr[i] === 'h' ) { 8268 timeV += parseFloat(timeArr[i-1]) * 3600; 8269 } else if ( timeArr[i] === 'm' ) { 8270 timeV += parseFloat(timeArr[i-1]) * 60; 8271 } else if ( timeArr[i] === 's' ) { 8272 timeV += parseFloat(timeArr[i-1]); 8273 } 8274 } 8275 } 8276 playerV.setCurrentTime(timeV); 8277 if ( start ) { 8278 playerV.setVolume(0); 8279 playerV.play(); 8280 } else { 8281 playerV.pause(); 8282 } 8283 } else if ( $el.attr('data-provider') === 'youtube' ) { 8284 if ( start ) { 8285 $el.trigger('uncode-resume'); 8286 } else { 8287 $el.trigger('uncode-pause'); 8288 } 8289 } 8290 8291 } 8292 8293 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 8294 8295 document.addEventListener("mousemove", function(e) { 8296 $drop_moves.each(function(){ 8297 var $drop_move = $(this), 8298 duration = 0.4; 8299 8300 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 8301 duration = 0.8; 8302 } 8303 8304 clientX = e.clientX; 8305 clientY = e.clientY; 8306 8307 gsap.to( $drop_move, { 8308 duration: duration, 8309 x: clientX, 8310 y: clientY, 8311 ease: Power1.easeOut, 8312 }); 8313 }); 8314 }); 8315 8316 } else { 8317 8318 $(window).on("touchend scroll", function(e) { 8319 $list.removeClass('drop-hover'); 8320 $drop_moves.removeClass('active'); 8321 $tmbs.removeClass('drop-active'); 8322 }); 8323 8324 $drop_moves.each(function(){ 8325 var $drop_move = $(this), 8326 $tmb = $drop_move.closest('.tmb'), 8327 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 8328 8329 if ( $anim_parent.hasClass('uncode-skew') ) { 8330 $anim_parent.css({ 8331 'transform': 'skew(0)' 8332 }); 8333 } 8334 8335 $tmb.on('touchend', function(e){ 8336 e.stopPropagation(); 8337 8338 $drop_moves.removeClass('active'); 8339 $tmbs.removeClass('drop-active'); 8340 8341 $list.addClass('drop-hover'); 8342 $tmb.addClass('drop-active'); 8343 $drop_move.addClass('active'); 8344 manageVideos($drop_move, true); 8345 clientX = e.changedTouches[0].clientX; 8346 clientY = e.changedTouches[0].clientY; 8347 8348 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8349 var bound = $anim_parent[0].getBoundingClientRect(); 8350 clientX = clientX - bound.x; 8351 clientY = clientY - bound.y; 8352 } 8353 8354 $drop_move.css({ 8355 left: clientX, 8356 top: clientY 8357 }); 8358 }); 8359 }); 8360 8361 } 8362 8363 $tmbs.each(function(e){ 8364 var $tmb = $(this), 8365 // $trgr = $('a', $tmb), 8366 $trgr = $tmb, 8367 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 8368 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
8368(.t-inside), .parallax-el'), 8369 $video = $('video', $tmb), 8370 $iframe = $('iframe', $tmb), 8371 $entryTxt = $('.t-entry-text', $tmb), 8372 stopBounding; 8373 8374 $entryTxt.add($drop_move).css({ 8375 'transition-duration': timing + 's' 8376 }); 8377 8378 if ( $video.length ) { 8379 var vidH = $video[0].videoHeight, 8380 vidW = $video[0].videoWidth; 8381 $video.css({ 8382 'height': vidH, 8383 'width': vidW 8384 }); 8385 } 8386 8387 if ( $iframe.length ) { 8388 var vidH = $drop_move.attr('data-height'), 8389 vidW = $drop_move.attr('data-width'); 8390 $iframe.css({ 8391 'height': vidH, 8392 'width': vidW 8393 }); 8394 } 8395 8396 $iframe.each(function(){ 8397 var $video = $(this), 8398 vidH = $video[0].videoHeight, 8399 vidW = $video[0].videoWidth; 8400 $video.css({ 8401 'height': vidH, 8402 'width': vidW 8403 }); 8404 }); 8405 8406 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 8407 $trgr.on('mouseenter',function(e){ 8408 $list.addClass('drop-hover'); 8409 $tmbs.removeClass('drop-active'); 8410 $tmb.addClass('drop-active'); 8411 $drop_move.addClass('active'); 8412 manageVideos($drop_move, true); 8413 8414 var clientX = e.clientX, 8415 clientY = e.clientY; 8416 $drop_move.css({ 8417 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 8418 }); 8419 8420 }) 8421 .on('mouseleave', function(e){ 8422 $list.removeClass('drop-hover'); 8423 $drop_move.css({ 8424 'transition-duration': ( timing*1.25 ) + 's' 8425 }); 8426 $drop_move.removeClass('active'); 8427 $tmb.removeClass('drop-active'); 8428 $drop_move.on('transitionend', function(e){ 8429 $drop_move.off('transitionend'); 8430 $drop_move.css({ 8431 'transition-duration': timing + 's' 8432 }); 8433 manageVideos($drop_move,false); 8434 }); 8435 }); 8436 8437 document.addEventListener('visibilitychange', function(){ 8438 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 8439 $drop_move.css({ 8440 'transition-duration': '0s' 8441 }); 8442 $drop_move.removeClass('active'); 8443 manageVideos($drop_move, false); 8444 } 8445 }); 8446 8447 document.addEventListener('scroll', function(){ 8448 window.clearRequestTimeout( stopBounding ); 8449 8450 if ( $drop_move.hasClass('active') ) { 8451 $list.removeClass('drop-hover'); 8452 $tmbs.removeClass('drop-active'); 8453 $drop_move.removeClass('active'); 8454 $drop_move.on('transitionend', function(e){ 8455 $drop_move.off('transitionend'); 8456 $drop_move.css({ 8457 'transition-duration': timing + 's' 8458 }); 8459 manageVideos($drop_move,false); 8460 }); 8461 } 8462 8463 stopBounding = requestTimeout(function() { 8464 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8465 var bound = $anim_parent[0].getBoundingClientRect(); 8466 $drop_move.css({ 8467 left: bound.x * -1, 8468 top: bound.y * -1, 8469 }); 8470 } 8471 }, 200); 8472 8473 }); 8474 } 8475 8476 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 8477 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 8478 8479 $drop.css({ 8480 'transition-duration': timing + 's' 8481 }); 8482 8483 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 8484 $trgr.on('mouseenter',function(e){ 8485 $row_parent.add($col_parent).addClass('drop-list-loaded'); 8486 $list.addClass('drop-hover'); 8487 8488 if ( !$tmb.hasClass('drop-active') ) { 8489 $tmbs.removeClass('drop-active'); 8490 $tmb.addClass('drop-active'); 8491 if ( default_image && !$drop.hasClass('active') ) { 8492 var $prev = $('[data-drop].active', $row_parent); 8493 $prev.css({ 8494 'transition-duration': (timing*1.5) + 's' 8495 }); 8496 $prev.removeClass('active'); 8497 $prev.on('transitionend', function(e){ 8498 $prev.off('transitionend'); 8499 manageVideos($prev,false); 8500 }); 8501 } 8502 $drop.css({ 8503 'transition-duration': timing + 's' 8504 }); 8505 $drop.off('transitionend'); 8506 $drop.addClass('active'); 8507 manageVideos($drop, true); 8508 } 8509 }) 8510 .on('mouseleave', function(e){ 8511 if ( ( default_image && !default_title ) || !default_image ) { 8512 $list.removeClass('drop-hover'); 8513 $tmb.removeClass('drop-active'); 8514 } 8515 if ( ! default_image ) { 8516 $drop.css({ 8517 'transition-duration': (timing*1.5) + 's' 8518 }); 8519 $drop.removeClass('active'); 8520 8521 $drop.on('transitionend', function(e){ 8522 $drop.off('transitionend'); 8523 manageVideos($drop,false); 8524 }); 8525 } 8526 }); 8527 8528 document.addEventListener('visibilitychange', function(){ 8529 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 8530 $drop.css({ 8531 'transition-duration': '0s' 8532 }); 8533 $drop.removeClass('active'); 8534 manageVideos($drop, false); 8535 } 8536 }); 8537 } 8538 }); 8539 8540 }); 8541 }; 8542 8543 $(window).on('load', function(event) { 8544 imageHover(); 8545 }); 8546 8547 var drop_wp_animation = function() { 8548 var $postLists = $('.uncode-post-titles'); 8549 $postLists.each(function(){ 8550 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 8551 new Waypoint({ 8552 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 8553 element: val, 8554 handler: function() { 8555 var element = $(this.element), 8556 parent = element.closest('.tmb'), 8557 currentIndex = parent.index(),
8558 delay = currentIndex, 8559 delayAttr = parseInt(element.attr('data-delay')); 8560 if (isNaN(delayAttr)) delayAttr = 100; 8561 var objTimeout = requestTimeout(function() { 8562 element.addClass('start_animation'); 8563 8564 var nextTimeout = requestTimeout(function() { 8565 $('.drop-image-separator', parent).addClass('start_animation'); 8566 }, 50); 8567 8568 }, delay * delayAttr); 8569 if (!UNCODE.isUnmodalOpen) { 8570 this.destroy(); 8571 } 8572 }, 8573 offset: UNCODE.isFullPage ? '100%' : '90%' 8574 }) 8575 }); 8576 }); 8577 } 8578 8579 var runWaypoints_TO, 8580 runWaypoints_delay = 0; 8581 8582 var runWaypoints = function(){ 8583 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 8584 runWaypoints_delay = 400; 8585 } 8586 clearRequestTimeout(runWaypoints_TO); 8587 runWaypoints_TO = requestTimeout(function() { 8588 drop_wp_animation(); 8589 }, runWaypoints_delay); 8590 }; 8591 runWaypoints(); 8592 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 8593 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8594 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 8595 // imageHover(); 8596 runWaypoints(); 8597 }); 8598 } 8599}; 8600 8601UNCODE.postTable = function() { 8602 8603 var clickRow = function(){ 8604 var $postLists = $('.uncode-post-table'); 8605 8606 $postLists.each(function(){ 8607 var $postList = $(this), 8608 $tmbClicks = $('.tmb.tmb-click-row', $postList); 8609 8610 $tmbClicks.each(function(){ 8611 var $tmb = $(this), 8612 $click = $('.table-click-row', $tmb); 8613 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 8614 e.preventDefault(); 8615 e.stopPropagation(); 8616 $click[0].click(); 8617 return false; 8618 }); 8619 }); 8620 8621 }) 8622 }; 8623 8624 clickRow(); 8625 8626 var hoverRow = function(){ 8627 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 8628 8629 $postLists.on('mouseenter', function(){ 8630 $(this).addClass('post-table-hover'); 8631 }); 8632 $postLists.on('mouseleave', function(){ 8633 $(this).removeClass('post-table-hover'); 8634 }); 8635 } 8636 8637 hoverRow(); 8638 8639 var drop_wp_animation = function() { 8640 var $postLists = $('.uncode-post-table'); 8641 $postLists.each(function(){ 8642 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 8643 new Waypoint({ 8644 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 8645 element: val, 8646 handler: function() { 8647 var element = $(this.element), 8648 parent = element.closest('.tmb'), 8649 currentIndex = parent.index(), 8650 delay = currentIndex, 8651 delayAttr = parseInt(element.attr('data-delay')); 8652 if (isNaN(delayAttr)) delayAttr = 100; 8653 var objTimeout = requestTimeout(function() { 8654 element.addClass('start_animation'); 8655 }, delay * delayAttr); 8656 if (!UNCODE.isUnmodalOpen) { 8657 this.destroy(); 8658 } 8659 }, 8660 offset: UNCODE.isFullPage ? '100%' : '90%' 8661 }) 8662 }); 8663 }); 8664 } 8665 8666 var runWaypoints_TO, 8667 runWaypoints_delay = 0; 8668 8669 var runWaypoints = function(){ 8670 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 8671 runWaypoints_delay = 400; 8672 } 8673 clearRequestTimeout(runWaypoints_TO); 8674 runWaypoints_TO = requestTimeout(function() { 8675 drop_wp_animation(); 8676 }, runWaypoints_delay); 8677 }; 8678 runWaypoints(); 8679 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 8680 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8681 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 8682 runWaypoints(); 8683 // clickRow(); 8684 }); 8685 } 8686}; 8687 8688UNCODE.rotatingTxt = function($ctxt) { 8689 8690 if ( $('body').hasClass('compose-mode') ) { 8691 return; 8692 } 8693 8694 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 8695 var setCTA; 8696 8697 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 8698 var $heading = $(this), 8699 // debug = 0, 8700 cycle = 0, 8701 $trgt, 8702 $toMove, 8703 $highl, 8704 $col = $heading.closest('.uncont'), 8705 txt, 8706 arrTxt, 8707 textFadeIn, textFadeOut, 8708 removeWraps; 8709 8710 var defineObjs = function() { 8711 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 8712 var $rtx = $(this), 8713 fx = $rtx.attr('data-fx'), 8714 wait = $rtx.attr('data-wait'), 8715 $prev = $(this).prev().addClass('prev-rotating-start'), 8716 splitToMove = [], 8717 splitArray = [], 8718 lineArray = [], 8719 lineIndex = 0, 8720 lineStart = true, 8721 lineEnd = false, 8722 startSplit = false, 8723 $line_wrap = $rtx.closest('.heading-line-wrap'), 8724 same_line = true, 8725 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 8726 indexRtx = $splits.index($rtx); 8727 8728 fx = typeof fx === 'undefined' ? '' : fx;
8729 wait = typeof wait === 'undefined' ? '' : wait; 8730 8731 $splits.each(function(key, val){ 8732 var $split = $(this), 8733 $new_line_wrap = $split.closest('.heading-line-wrap'); 8734 8735 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 8736 splitArray.push( $split ); 8737 } 8738 8739 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 8740 startSplit = false; 8741 } 8742 8743 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 8744 splitArray.push( $split ); 8745 8746 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 8747 same_line = true; 8748 } else { 8749 same_line = false; 8750 } 8751 } 8752 8753 if ( key == indexRtx ) { 8754 if ( /\S/.test($split.text()) ) { 8755 startSplit = true; 8756 $line_wrap = $split.closest('.heading-line-wrap'); 8757 splitArray.push( $split ); 8758 } else { 8759 indexRtx++; 8760 } 8761 } 8762 8763 $line_wrap = $new_line_wrap; 8764 }); 8765 8766 $toMove = $($.map(splitToMove, function(el){return el.get();})); 8767 $trgt = $($.map(splitArray, function(el){return el.get();})); 8768 8769 if ( same_line ) { 8770 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 8771 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 8772 } 8773 8774 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 8775 $prev.addClass('empty-span-hidden'); 8776 } 8777 8778 $highl = $('.heading-text-highlight-inner', $trgt); 8779 8780 $rtx.attr('data-animated', 'true'); 8781 if ( cycle == 0 ) { 8782 $( document.body ).trigger('defer-highlights'); 8783 cycle++; 8784 defineObjs(); 8785 return; 8786 } 8787 cycle++; 8788 8789 txt = $rtx.attr('data-text'); 8790 arrTxt = txt.split("|"); 8791 8792 textFadeOut($trgt); 8793 8794 }); 8795 }; 8796 8797 removeWraps = function(){ 8798 8799 // if ( debug == 1 ) return; 8800 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 8801 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 8802 8803 8804 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 8805 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 8806 8807 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 8808 8809 $splitFlow.each(function(){ 8810 $(this).append($temp_highl); 8811 }); 8812 8813 var $line_wrap = $wraps[wrap_k]; 8814 var $parent_wrap = $line_wrap.parentNode; 8815 if ( $parent_wrap !== null ) { 8816 while ( $line_wrap.firstChild ) { 8817 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 8818 } 8819 $parent_wrap.removeChild($line_wrap); 8820 } 8821 } 8822 // debug++; 8823 defineObjs(); 8824 }; 8825 8826 var loop = 0; 8827 textFadeIn = function($trgt){ 8828 var word = arrTxt[loop].split(" "), 8829 worsSpan = '', 8830 $wrap = $trgt.closest('.uncode-rotating-wrap'), 8831 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 8832 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 8833 8834 for (var w = 0; w < word.length; w++) { 8835 var highl; 8836 if ( $highl.length ) { 8837 highl = $highl[0].outerHTML; 8838 } else { 8839 highl = ''; 8840 } 8841 8842 if ( w > 0 ) { 8843 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 8844 } 8845 var charachters = word[w].split(''); 8846 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 8847 for (var c = 0; c < charachters.length; c++) { 8848 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 8849 } 8850 worsSpan += '</span>' + highl + '</span></span>'; 8851 } 8852 8853 if ( $wrap.length && $wrap_inner.length ) { 8854 var words_w = $wrap_inner.outerWidth(); 8855 $wrap.css({ 8856 width: words_w 8857 }); 8858 8859 $highl = $('.heading-text-highlight-inner', $wrap); 8860 $highl.prependTo($wrap); 8861 8862 $wrap_inner.css({ 8863 opacity: 0 8864 }); 8865 8866 $wrap_inner.html(worsSpan); 8867 $('.heading-text-highlight-inner', $wrap_inner).remove(); 8868 words_w = $wrap_inner.innerWidth(); 8869 8870 var duration = 0.45; 8871 8872 $heading.removeClass('auto-width'); 8873 if ( words_w > $col.width() ) { 8874 $heading.addClass('auto-width'); 8875 words_w = 'auto'; 8876 duration = 0; 8877 } 8878 8879 $wrap.css({ 8880 'width': words_w, 8881 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 8882 }); 8883 8884 var $word_inner = $('.split-word-inner', $wrap_inner), 8885 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 8886 8887 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 8888 8889 if ( !$target_fx.length ) { 8890 return; 8891 } 8892 8893 gsap.killTweensOf($target_fx); 8894 8895 if ( fx !== 'zoom' ) { 8896 gsap.fromTo( $target_fx, { 8897 y: fx === 'opacity' ? '0%' : '-10%' 8898 },{ 8899 delay: duration, 8900 duration: 0.25, 8901 y: '0%', 8902 ease: Circ.easeOut, 8903 }); 8904 8905 if ( !$wrap_inner.length ) { 8906 return; 8907 } 8908 8909 gsap.fromTo( $wrap_inner, { 8910 opacity: 0, 8911 },{ 8912 delay: duration, 8913 duration: 0.25, 8914 opacity: 1, 8915 ease: Circ.easeOut, 8916 onComplete: function(){ 8917 $('> .heading-text-highlight-inner', $wrap).remove(); 8918 $wrap_inner.html(worsSpan); 8919 removeWraps(); 8920 } 8921 }) 8922 8923 } else { 8924 gsap.fromTo( $target_fx, { 8925 transformOrigin: '50%', 8926 opacity: 0, 8927 scale: 0.875, 8928 },{ 8929 opacity: 1, 8930 delay: duration, 8931 duration: 0.25, 8932 scale: 1, 8933 ease: Circ.easeOut, 8934 onComplete: function(){ 8935 $('> .heading-text-highlight-inner', $wrap).remove(); 8936 $wrap_inner.html(worsSpan); 8937 removeWraps(); 8938 } 8939 }); 8940 } 8941 8942 } else { 8943 8944 if ( !$wrap_inner.length ) { 8945 return; 8946 } 8947 8948 gsap.to( $wrap_inner, { 8949 duration: 0.4, 8950 opacity: 0, 8951 ease: Power1.easeOut, 8952 onComplete: function(){ 8953 $wrap_inner.html(worsSpan); 8954 words_w = $wrap_inner.innerWidth(); 8955 8956 gsap.to( $wrap_inner, { 8957 duration: 0.2, 8958 opacity: 1, 8959 ease: Power1.easeOut, 8960 onComplete: function(){ 8961 $('> .heading-text-highlight-inner', $wrap).remove(); 8962 $wrap_inner.html(worsSpan); 8963 removeWraps(); 8964 } 8965 }) 8966 } 8967 }); 8968 } 8969 8970 if ( loop < arrTxt.length-1 ) { 8971 loop++; 8972 } else { 8973 loop = 0; 8974 } 8975 8976 }; 8977 8978 textFadeOut = function($trgt){ 8979 var $word_inner = $('.split-word-inner', $trgt), 8980 $wrap = $trgt.closest('.uncode-rotating-wrap'), 8981 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 8982 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 8983 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 8984 8985 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 8986 8987 var gsap_param = { 8988 delay: wait, 8989 duration: 0.25, 8990 y: fx === '' ? '10%' : '0%', 8991 opacity: 0, 8992 ease: Circ.easeOut, 8993 onStart: function(){ 8994 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 8995 $highl = $('.heading-text-highlight-inner', $wrap); 8996 $highl.prependTo($wrap); 8997 } 8998 }, 8999 onComplete: textFadeIn, 9000 onCompleteParams: [$trgt] 9001 }; 9002 9003 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 9004 9005 if ( fx === '' ) { 9006 gsap_param.y = '10%'; 9007 } else if ( fx === 'zoom' ) { 9008 gsap_param.scale = '1.045'; 9009 } 9010 9011 if ( !$target_fx.length ) { 9012 return; 9013 } 9014 9015 if ( $heading.data('waypoint') !== true ) { 9016 var textInView = new Waypoint.Inview({ 9017 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9018 element: $heading[0], 9019 enter: function(direction) { 9020 $heading.data('waypoint',true); 9021 gsap.fromTo( $target_fx, { 9022 transformOrigin: '50%' 9023 }, gsap_param ); 9024 } 9025 }); 9026 } else { 9027 gsap.fromTo( $target_fx, { 9028 transformOrigin: '50%' 9029 }, gsap_param ); 9030 } 9031 }; 9032 9033 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9034 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 9035 var $el = model.view.$el, 9036 shortcode = model.attributes.shortcode; 9037 9038 UNCODE.rotatingTxt($el); 9039 }); 9040 } else { 9041 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 9042 $heading.on('already-animated', function(){ 9043 removeWraps(); 9044 window.addEventListener('removeOldLines', function(){ 9045 clearRequestTimeout(setCTA); 9046 setCTA = requestTimeout( removeWraps, 150 ); 9047 }); 9048 }); 9049 } else { 9050 $(window).on('load', function(){ 9051 removeWraps(); 9052 window.addEventListener('removeOldLines', function(){ 9053 clearRequestTimeout(setCTA); 9054 setCTA = requestTimeout( removeWraps, 150 ); 9055 }); 9056 }); 9057 } 9058 } 9059 }); 9060 9061}; 9062 9063UNCODE.verticalText = function() { 9064 $(window).on('menuCanvasOpen', function(){ 9065 $('.vertical-text--fixed').fadeOut(500); 9066 $('.horizontal-text--fixed').fadeOut(500); 9067 }).on('menuCanvasClose', function(){ 9068 $('.vertical-text--fixed').fadeIn(500); 9069 $('.horizontal-text--fixed').fadeIn(500); 9070 }); 9071 9072 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 9073 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 9074 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 9075 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 9076 9077 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 9078 window.addEventListener('scroll', function(e) { 9079 var totalPageHeight = document.body.scrollHeight; 9080 var scrollPoint = window.scrollY + window.innerHeight; 9081 9082 if (window.scrollY > 0) { 9083 showOnTopVerticalTexts.fadeOut(); 9084 showOnTopHorizontalTexts.fadeOut(); 9085 } else { 9086 showOnTopVerticalTexts.fadeIn(); 9087 showOnTopHorizontalTexts.fadeIn(); 9088 } 9089 9090 if (scrollPoint >= totalPageHeight) { 9091 hideOnBottomVerticalTexts.fadeOut(); 9092 hideOnBottomHorizontalTexts.fadeOut(); 9093 } else { 9094 hideOnBottomVerticalTexts.fadeIn(); 9095 hideOnBottomHorizontalTexts.fadeIn(); 9096 } 9097 }, false); 9098 } 9099}; 9100 9101UNCODE.stickyScroll = function( $el ) { 9102 if ( typeof $el === 'undefined' || $el === null ) { 9103 $el = $('body'); 9104 } 9105 var checkVisible = function( el, dir ) { 9106 if (typeof jQuery === "function" && el instanceof jQuery) { 9107 el = el[0]; 9108 } 9109 9110 var off = 50; 9111 dir = typeof dir=='undefined' ? 'right' : dir; 9112 var rect = el.getBoundingClientRect(); 9113 9114 return ( 9115 ( 9116 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9117 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9118 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 9119 ) && 9120 ( 9121 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 9122 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 9123 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 9124 ( rect.right <= window.innerWidth && rect.left >= 0 ) 9125 ) 9126 ); 9127 }; 9128 9129 var setItemsRelHeight = function(reset) { 9130 var $_el = $el; 9131 if ( $el.is('.index-scroll') ) { 9132 var $_el = $el.closest('.uncont'); 9133 } 9134 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 9135 $.each($('.tmb', item), function(index, val) { 9136 if ( reset === true ) { 9137 $(val).css( 'visibility', 'hidden' ); 9138 } else { 9139 $(val).css( 'visibility', 'visible' ); 9140 } 9141 }); 9142 }); 9143 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 9144 $.each($('.tmb', item), function(index, val) { 9145 if ( reset === true ) { 9146 $(val).css( 'visibility', 'hidden' ); 9147 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 9148 } else { 9149 var $rowParent = $(item).closest('.row-parent'), 9150 rowRatio = $rowParent.attr('data-height-ratio'), 9151 $rowInner = $(item).closest('.row-child'), 9152 rowRatioInner = $rowInner.attr('data-height'), 9153 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9154 $colContainer = $(item).closest('.uncell'), 9155 $uncont = $(item).closest('.uncont'), 9156 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 9157 safe_heigth = $(item).data('safe-height'), 9158 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 9159 offSet = $(item).offset().top - $uncont.offset().top, 9160 multiplier_h, 9161 data_viewport_h, 9162 body_border = $('.body-borders .top-border').outerHeight() * 2, 9163 remove_menu = $(item).data('vp-menu'); 9164 9165 if ( rowRatio === 'full' || rowRatio === '' ) { 9166 rowRatio = 1; 9167 } else { 9168 rowRatio = rowRatio / 100; 9169 } 9170 9171 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 9172 rowRatio = rowRatio; 9173 } else { 9174 rowRatio = rowRatio * rowRatioInner / 100; 9175 } 9176 9177 winHeight = winHeight * rowRatio; 9178 9179 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9180 multiplier_h = parseInt($(item).attr('data-vp-height')); 9181 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 9182 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 9183 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 9184 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 9185 } 9186 9187 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 9188 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 9189 if ( remove_menu === true ) { 9190 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 9191 } 9192 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 9193 } else { 9194 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 9195 } 9196 9197 } 9198 }); 9199 }); 9200 $('.index-scroll', $_el).each(function(i, item){ 9201 var $uncoltable = $(item).closest('.uncoltable'), 9202 $rowParent = $(item).closest('.row-parent'), 9203 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9204 body_border = $('.body-borders .top-border').outerHeight() * 2, 9205 $index_row = $('.index-row', item), 9206 safe_heigth = $index_row.data('safe-height'), 9207 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 9208 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 9209 var data_viewport_h = winHeight - ( paddingRow + body_border ); 9210 $uncoltable.css({ 9211 'min-height': data_viewport_h 9212 }); 9213 } else { 9214 $uncoltable.css({ 9215 'min-height': 'auto' 9216 }); 9217 } 9218 }); 9219 9220 } 9221 setItemsRelHeight(); 9222 9223 var $index_scrolls = $('.index-scroll', $el); 9224
9225 $index_scrolls.each(function(key, value){ 9226 var $index = $(this), 9227 $parent_row = $index.closest('.vc_row[data-parent]'), 9228 $index_row = $('.index-row', $index), 9229 dir = $index_row.attr('data-direction'); 9230 dir = typeof dir === 'undefined' ? 'right' : dir; 9231 9232 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 9233 }); 9234 9235 var $horScrolls = $('.unscroll-horizontal', $el); 9236 9237 if ( $horScrolls.length ) { 9238 9239 $('body').addClass('scrolling-trigger'); 9240 9241 $horScrolls.each(function(key, value){ 9242 var $section = $(this), 9243 $index_scroll = $('.index-scroll', $section), 9244 $index_row = $('.index-row', $index_scroll), 9245 dir = $section.attr('data-direction'), 9246 wrap = $index_row.attr('data-wrap'), 9247 $pinWrap, 9248 $pinTrigger; 9249 9250 dir = typeof dir === 'undefined' ? 'right' : dir; 9251 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 9252 $pinWrap = $('<div class="pin-wrap" />'); 9253 if ( SiteParameters.is_frontend_editor ) { 9254 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 9255 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 9256 } else { 9257 if ( wrap === 'column' ) { 9258 $index_scroll.wrapInner( $pinWrap ); 9259 } else { 9260 $('> .row', $section).wrap( $pinWrap ); 9261 } 9262 $section.wrapInner( $pinTrigger ); 9263 } 9264 9265 }); 9266 9267 var $pinWraps = $('.pin-wrap', $el); 9268 9269 var horScrollSizes = function(){ 9270 9271 $pinWraps.each(function(key, val){ 9272 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 9273 $pinTrigger = $pinWrap.closest('.pin-trigger'), 9274 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 9275 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 9276 $boxContainer = $('.box-container'), 9277 box_m = $boxContainer.css('margin-left'), 9278 st_active = true; 9279 9280 var setHorW, 9281 horWidth = function(){ 9282 $index_scroll.each(function(){ 9283 var $this = $(this), 9284 $index_row = $('.index-row', $this), 9285 $rowContainer = $index_row.closest('.vc_row'), 9286 $rowInner = $index_row.closest('.wpb_row'), 9287 $rowParent = $index_row.closest('.row-parent'), 9288 $tmbs = $('.tmb', $index_row), 9289 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 9290 $uncont = $index_row.closest('.uncont'), 9291 $parent_col = $index_row.closest('.wpb_column'), 9292 col_w = $uncont.width(), 9293 data_lg = parseFloat( $index_row.attr('data-lg') ), 9294 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 9295 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 9296 tmb_w; 9297 9298 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 9299 tmb_w = ( col_w + padding_tmb ) / data_lg; 9300 9301 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 9302 tmb_w = ( col_w + padding_tmb ) / data_sm; 9303 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 9304 tmb_w = ( col_w + padding_tmb ) / data_md; 9305 } 9306 9307 if ( !isNaN(tmb_w) ) { 9308 $tmbs.css({ 9309 'width': tmb_w 9310 }); 9311 } 9312 9313 $tmbs.css({ 9314 'visibility': 'visible' 9315 }); 9316 9317 }); 9318 }; 9319 9320 horWidth(); 9321 clearRequestTimeout(setHorW); 9322 setHorW = requestTimeout( function(){ 9323 setItemsRelHeight(); 9324 horWidth(); 9325 }, 100 ); 9326 9327 if ( SiteParameters.is_frontend_editor ) { 9328 return; 9329 } 9330 9331 var $vmenu = $('body.vmenu .vmenu-container'), 9332 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 9333 winWidth = window.innerWidth - vmenuW, 9334 $tmb = $('.tmb', $index_scroll).eq(0), 9335 paddingRight = parseFloat( $tmb.css('padding-right') ), 9336 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 9337 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 9338 scroll_anim; 9339 9340 if ( $('body').hasClass('rtl') ) { 9341 if ( dir === 'left' ) { 9342 scroll_anim = gsap.fromTo( $pinWrap, { 9343 x: stickyScrollLength 9344 },{ 9345 x: 0, 9346 ease: "none" 9347 }); 9348 } else { 9349 scroll_anim = gsap.fromTo( $pinWrap, { 9350 x: 0 9351 },{ 9352 x: stickyScrollLength, 9353 ease: "none" 9354 }); 9355 } 9356 } else { 9357 if ( dir === 'left' ) { 9358 scroll_anim = gsap.fromTo( $pinWrap, { 9359 x: -stickyScrollLength 9360 },{ 9361 x: 0, 9362 ease: "none" 9363 }); 9364 } else { 9365 scroll_anim = gsap.fromTo( $pinWrap, { 9366 x: 0 9367 },{ 9368 x: -stickyScrollLength, 9369 ease: "none" 9370 }); 9371 } 9372 } 9373 9374 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 9375 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 9376 } 9377 9378 var animationIncrease; 9379 9380 var checkForAnimations = function(){ 9381 animationIncrease = 0 9382 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 9383 var _this = this, 9384 isScrolling; 9385 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 9386 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 9387 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 9388 requestTimeout(function() { 9389 $(_this).addClass('start_animation'); 9390 }, delayAttr + animationIncrease); 9391 animationIncrease += 150; 9392 } 9393 }); 9394 }; 9395 checkForAnimations(); 9396
9397 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 9398 var start = 0; 9399 9400 var horST = ScrollTrigger.create({ 9401 id: "stickySectionScrolling" + key, 9402 scrub: true, 9403 trigger: $pinTrigger[0], 9404 pin: true, 9405 anticipatePin: 1, 9406 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 9407 end: function() { return "+="+stickyScrollLength; }, 9408 animation: scroll_anim, 9409 ease: Sine.easeOut, 9410 onUpdate: checkForAnimations, 9411 invalidateOnRefresh: true, 9412 onEnter: function(){ 9413 $pinTrigger.addClass('enter-st'); 9414 }, 9415 onEnterBack: function(){ 9416 $pinTrigger.addClass('enter-st'); 9417 }, 9418 onLeave: function(){ 9419 $pinTrigger.removeClass('enter-st'); 9420 }, 9421 onLeaveBack: function(){ 9422 $pinTrigger.removeClass('enter-st'); 9423 } 9424 }); 9425 9426 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 9427 window.dispatchEvent(new CustomEvent('boxResized')); 9428 9429 var testSecondTrigger = function(){ 9430 animationIncrease = 0 9431 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 9432 var _this = this; 9433 if ( checkVisible(_this) ) { 9434 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 9435 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 9436 requestTimeout(function() { 9437 $(_this).addClass('start_animation'); 9438 }, delayAttr + animationIncrease); 9439 animationIncrease += 150; 9440 } 9441 }); 9442 9443 }; 9444 9445 var verST = ScrollTrigger.create({ 9446 id: "verticalSectionScrolling" + key, 9447 trigger: $pinTrigger[0], 9448 start: "top center", 9449 end: function() { return "+="+UNCODE.wheight; }, 9450 onUpdate: testSecondTrigger, 9451 invalidateOnRefresh: true 9452 }); 9453 9454 var setCTA, 9455 9456 dis_enable_ST = function(){ 9457 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9458 horST.kill(); 9459 verST.kill(); 9460 $pinTrigger.addClass('disabled'); 9461 st_active = false; 9462 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 9463 horST.kill(); 9464 verST.kill(); 9465 $pinTrigger.addClass('disabled'); 9466 st_active = false; 9467 } 9468 }; 9469 9470 $(window).on('resize load', function() { 9471 clearRequestTimeout(setCTA); 9472 setCTA = requestTimeout(function() { 9473 dis_enable_ST(); 9474 checkForAnimations(); 9475 }, 500); 9476 }); 9477 9478 }); 9479 }; 9480 9481 $(window).on( 'load', function(){ 9482 horScrollSizes(); 9483 }); 9484 var setResize, 9485 doubleResize = true, 9486 oldW = UNCODE.wwidth; 9487 $(window).on( 'resize orientationchange', function(){ 9488 if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) { 9489 return; 9490 } else { 9491 oldW = UNCODE.wwidth; 9492 } 9493 setItemsRelHeight(true); 9494 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 9495 Array.prototype.forEach.call($row_inners, function(el) { 9496 el.style.height = ''; 9497 el.style.marginBottom = ''; 9498 }); 9499 clearRequestTimeout(setResize); 9500 setResize = requestTimeout( function(){ 9501 setItemsRelHeight(); 9502 horScrollSizes(); 9503 ScrollTrigger.refresh(); 9504 if ( doubleResize === true ) { 9505 window.dispatchEvent(new Event('resize')); 9506 doubleResize = false; 9507 } else { 9508 doubleResize = true; 9509 } 9510 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 9511 }, 100 ); 9512 }); 9513 9514 var show_pins = function(){ 9515 $('.index-scroll').css({'opacity':'1'}); 9516 setResize = requestTimeout( function(){ 9517 }, 10 ); 9518 }; 9519 ScrollTrigger.addEventListener("refresh", show_pins); 9520 $(window).on( 'uncode.re-layout', function(){ 9521 $('.index-scroll').css({'opacity':'0'}); 9522 ScrollTrigger.refresh(true); 9523 }); 9524 } 9525 9526}; 9527 9528UNCODE.stickyTrigger = function( $el ) { 9529 if ( SiteParameters.is_frontend_editor ) { 9530 return false; 9531 } 9532 9533 var stickyTrigger = function(){ 9534 var stickyTrick = $('.sticky-trigger').each(function(){ 9535 var $sticky = $(this), 9536 $inside = $('> div', $sticky), 9537 insideH = $inside.outerHeight(), 9538 $row = $sticky.closest('.vc_row'), 9539 $uncont = $sticky.closest('.uncont'), 9540 rowBottom, 9541 uncontBottom , 9542 diffBottom; 9543 9544 ScrollTrigger.create({ 9545 trigger: $sticky, 9546 start: function(){ return "top center-=" + insideH/2; }, 9547 endTrigger: $row, 9548 end: function(){ 9549 rowBottom = $row.offset().top + $row.outerHeight(); 9550 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 9551 diffBottom = rowBottom - uncontBottom; 9552 return "bottom center+=" + ( insideH/2 + diffBottom ); 9553 }, 9554 anticipatePin: true, 9555 pin: true, 9556 pinSpacing: false, 9557 scrub: true, 9558 invalidateOnRefresh: true, 9559 }); 9560 9561 }); 9562 }, 9563 setResizeSticky; 9564 9565 $(window).on( 'load', function(){ 9566 stickyTrigger(); 9567 }); 9568 var oldW = UNCODE.wwidth; 9569 $(window).on( 'resize uncode.re-layout', function(e){ 9570 clearRequestTimeout(setResizeSticky); 9571 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 9572 return; 9573 } else { 9574 oldW = UNCODE.wwidth; 9575 } 9576 setResizeSticky = requestTimeout( function(){ 9577 stickyTrigger(); 9578 ScrollTrigger.refresh(); 9579 }, 1000 ); 9580 }); 9581 9582}; 9583 9584UNCODE.revslider = function() { 9585 var revSliderIn = function(){ 9586 $('rs-module').each(function(){ 9587 var $slider = $(this); 9588 9589 $slider.on('revolution.slide.onloaded', function(e, data){ 9590 if ( $(e.currentTarget).closest(".header-revslider").length ) { 9591 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 9592 scrolltop = $(document).scrollTop(); 9593 if ( style != undefined ) { 9594 UNCODE.switchColorsMenu(scrolltop, style); 9595 } 9596 } 9597 }); 9598 9599 $slider.on('revolution.slide.onchange', function(e, data){ 9600 if ( $(e.currentTarget).closest(".header-revslider").length ) { 9601 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 9602 scrolltop = $(document).scrollTop(); 9603 if ( style != undefined ) { 9604 UNCODE.switchColorsMenu(scrolltop, style); 9605 } 9606 } 9607 }); 9608 9609 }); 9610 }; 9611 revSliderIn(); 9612 $(window).on("load", revSliderIn ); 9613}; 9614UNCODE.layerslider = function() { 9615 $(window).on("load", function() { 9616 9617 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 9618 9619 var slideData = slider.slides.current.data, 9620 scrolltop = $(document).scrollTop(); 9621 if( slideData && slideData.skin ) { 9622 9623 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 9624 9625 } 9626 }); 9627 9628 }); 9629}; 9630 9631UNCODE.ajax_filters = function() { 9632 9633/************************* 9634 *
9635 * Filters Menu and Widgets Area 9636 * 9637 ************************/ 9638 9639 var clear_clicked = false; 9640 9641 var init_ajax_grid = function(){ 9642 9643 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 9644 $grids.each(function(index, val){ 9645 var $body = $('body'), 9646 $grid = $(val).addClass('init-ajax-grid'), 9647 starting_point = $grid.attr('data-toggle'), 9648 $trigger = $('.uncode-toggle-ajax-filters', $grid), 9649 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 9650 $isotope_wrapper = $('.isotope-wrapper', $grid), 9651 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 9652 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 9653 $footprint = $('.ajax-filter-footprint', $grid), 9654 sidebar_w, 9655 data_w = parseFloat( $sidebar.attr('data-max-width') ), 9656 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 9657 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 9658 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 9659 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 9660 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 9661 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 9662 sidew, 9663 $inside_row = $('> .row-parent', $vc_row), 9664 bg_row, 9665 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 9666 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 9667 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer), 9668 sidebar_overlay = false, 9669 sidebar_hover = false, 9670 switchMobile = false, 9671 scrollTop; 9672 9673 if ( $vc_row.attr('class') ) { 9674 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 9675 } 9676 9677 if ( bg_row != null ) { 9678 $side_header.add($side_footer).addClass(bg_row[0]); 9679 } 9680 9681 $trigger.add($apply_filters).on('click', function(e){ 9682 e.preventDefault(); 9683 e.stopPropagation(); 9684 $grid = $('.ajax-grid-system').eq(0); 9685 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 9686 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 9687 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9688 sidebar_w = $sidebar_wrapper.width(); 9689 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9690 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 9691 $(this).trigger('uncode-ajax-clear-filters'); 9692 } 9693 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9694 $grid.toggleClass('ajax-hide-filters-blanks'); 9695 $sidebar.slideToggle({ 9696 duration: 400, 9697 easing: 'easeOutQuad', 9698 }); 9699 } else { 9700 $grid.removeClass('ajax-hide-filters-blanks'); 9701 $grid.toggleClass('ajax-hide-filters'); 9702 if ( $grid.hasClass('ajax-hide-filters') ) { 9703 $body.addClass('ajax-hide-filters'); 9704 } else { 9705 scrollTop = $('html, body').scrollTop(); 9706 $body.removeClass('ajax-hide-filters'); 9707 } 9708 } 9709 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 9710 $('html, body').scrollTop(scrollTop); 9711 } 9712 return false; 9713 }); 9714 9715 $close_btn.on('click', function(e){ 9716 e.preventDefault(); 9717 $grid = $('.ajax-grid-system').eq(0); 9718 $grid.addClass('ajax-hide-filters'); 9719 if ( $grid.hasClass('ajax-hide-filters') ) { 9720 $body.addClass('ajax-hide-filters'); 9721 } else { 9722 scrollTop = $('html, body').scrollTop(); 9723 $body.removeClass('ajax-hide-filters'); 9724 } 9725 $('html, body').scrollTop(scrollTop); 9726 }); 9727 9728 $sidebar_wrapper.on('mouseover',function(){ 9729 sidebar_hover = true; 9730 }).on('mouseout', function(){ 9731 sidebar_hover = false; 9732 }); 9733 9734 $body.off('click').on('click', function( e, from ){ 9735 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 9736 return; 9737 } 9738 if (undefined !== from && from === 'select_active_attributes') { 9739 return; 9740 } 9741 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 9742 $grid.add($body).addClass('ajax-hide-filters'); 9743 } 9744 }); 9745 9746 $sorting_trgr.on('click', function(e) { 9747 e.preventDefault(); 9748 }); 9749 9750 var inside_width = function(){ 9751 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9752 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9753 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 9754 $inside_row = $('> .row-parent', $vc_row); 9755 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 9756 sidew = $sidebar.width(); 9757 $inside_row.css({ 9758 width: sidew 9759 }); 9760 } else { 9761 $inside_row.css({ 9762 width: '' 9763 }); 9764 } 9765 }; 9766 inside_width(); 9767 9768 var ajax_sidebar_position = function(e, f_editor){ 9769 $grid = $('.ajax-grid-system').eq(0); 9770 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9771 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 9772 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9773 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 9774 $inside_row = $('> .row-parent', $vc_row); 9775 scrollTop = $('html, body').scrollTop(); 9776 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 9777 $grid.add($body).addClass('ajax-hide-filters'); 9778 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 9779 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
9780 sidebar_overlay = true; 9781 $body.addClass('ajax-filter-sidebar-overlay'); 9782 $sidebar_wrapper.addClass(skin); 9783 var sideHeadH = $side_header.outerHeight(), 9784 sideFooterH = $side_footer.outerHeight(); 9785 if ( data_w !== '' && data_w > 0 ) { 9786 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9787 $sidebar.css({ 9788 'max-width': data_w 9789 }); 9790 } else { 9791 $sidebar.css({ 9792 'max-width':'none' 9793 }); 9794 } 9795 } 9796 $vc_row.css({ 9797 'padding-top':sideHeadH, 9798 'padding-bottom':sideFooterH 9799 }); 9800 var sidew = $sidebar.width(); 9801 $inside_row.css({ 9802 width: sidew 9803 }); 9804 switchMobile = true; 9805 } else { 9806 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 9807 scrollTop = $('html, body').scrollTop(); 9808 $grid.add($body).removeClass('ajax-hide-filters'); 9809 } 9810 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 9811 $grid.addClass('ajax-hide-filters-blanks'); 9812 $sidebar.hide(); 9813 } 9814 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 9815 $('.ajax-sidebar-placeholder', $grid).remove(); 9816 sidebar_overlay = false; 9817 $body.removeClass('ajax-filter-sidebar-overlay'); 9818 $sidebar_wrapper.removeClass(skin); 9819 if ( data_w !== '' && data_w > 0 ) { 9820 $sidebar.css({ 9821 'max-width':'none' 9822 }); 9823 } 9824 $vc_row.css({ 9825 'padding-top':0, 9826 'padding-bottom':0, 9827 }); 9828 9829 $inside_row.css({ 9830 width: '' 9831 }); 9832 9833 if ( f_editor === true ) { 9834 UNCODE.ajax_filters(); 9835 } 9836 9837 switchMobile = false; 9838 } 9839 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 9840 $('html, body').scrollTop(scrollTop); 9841 } 9842 }; 9843 9844 var sidebar_width = function(){ 9845 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9846 sidebar_w = $footprint.width(); 9847 $sidebar.css({ width: sidebar_w }); 9848 } else { 9849 $sidebar.css({ width: '' }); 9850 } 9851 }; 9852 sidebar_width(); 9853 9854 if ( SiteParameters.is_frontend_editor ) { 9855 ajax_sidebar_position(); 9856 } 9857 9858 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 9859 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 9860 ajax_sidebar_position(e); 9861 } 9862 sidebar_width(); 9863 }); 9864 9865 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 9866 ajax_sidebar_position(e, true); 9867 }); 9868 9869 $isotope_wrapper.on('transitionend', function(e){ 9870 if ( $(e.target).hasClass('isotope-wrapper') ) { 9871 window.dispatchEvent(new CustomEvent('boxResized')); 9872 } 9873 return false; 9874 }); 9875 9876 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 9877 var $grid = $('.ajax-grid-system').eq(0); 9878 $grid.addClass('ajax-hide-filters'); 9879 } 9880 9881 }); 9882 }; 9883 9884 init_ajax_grid(); 9885 $(document).on('uncode-ajax-filtered', init_ajax_grid); 9886 9887/************************* 9888 * 9889 * Hover hack 9890 * 9891 ************************/ 9892 var widget_hover_hack = function() { 9893 $('.widget, .uncode_widget').each(function(){ 9894 var $widget = $(this), 9895 class_w = $widget.attr('class'), 9896 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 9897 $footer = $widget.closest('#colophon'); 9898 9899 if ( class_w.indexOf('widget_yith') > 0 ) { 9900 return true; 9901 } 9902 9903 $lis.each(function(){ 9904 var $li = $(this), 9905 $a = $('a', $li), 9906 $label = $a.closest('label'); 9907 9908 if ( !$footer.length ) { 9909 $li.addClass('no-evts'); 9910 } 9911 9912 if ( ! $('span', $a).length ) { 9913 $li.addClass( 'li-hover' ); 9914 } 9915 9916 $('li', $li).hover(function(e){ 9917 $(e.target).parents('li').each(function(){ 9918 $(this).addClass( 'parent-li-hover' ); 9919 }); 9920 }, function(e){ 9921 $(e.target).parents('li').each(function(key, val){ 9922 if ( key === 0) { 9923 $(val).removeClass( 'parent-li-hover' ); 9924 } 9925 }); 9926 }); 9927 9928 $li.off('mouseup').on('mouseup', function(e){ 9929 e.stopPropagation(); 9930 var $a = $('a', this).first(); 9931 $a[0].click(); 9932 }); 9933 }); 9934 }); 9935 } 9936 widget_hover_hack(); 9937 $(document).on('uncode-ajax-filtered', widget_hover_hack); 9938 9939/************************* 9940 * 9941 * Init Filters 9942 * 9943 ************************/ 9944 9945 function init_filters() { 9946 $(document).on('click', '.term-filter-link', function(e) { 9947 var _this = $(this); 9948 var widget = _this.closest('.uncode_widget'); 9949 var container = get_filters_container(); 9950 9951 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 9952 return true; 9953 } 9954 9955 e.preventDefault(); 9956 9957 if (widget.hasClass('widget-ajax-filters--checkbox')) { 9958 _this.parent().find('input[type="checkbox"]').trigger('click'); 9959 } else { 9960 if (_this.hasClass('term-filter-link--active')) { 9961 _this.removeClass('term-filter-link--active'); 9962 } else { 9963 _this.addClass('term-filter-link--active'); 9964 9965 if (widget.hasClass('widget-ajax-filters--single')) { 9966 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 9967 } 9968 } 9969 9970 var url = _this.attr('href'); 9971 9972 reload_items(container, url, true); 9973 } 9974 }); 9975 9976 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 9977 var _this = $(this); 9978 var widget = _this.closest('.uncode_widget'); 9979 var link = _this.closest('.term-filter').find('.term-filter-link'); 9980 var url = link.attr('href'); 9981 var container = get_filters_container(); 9982 9983 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 9984 window.location = url; 9985 return; 9986 } 9987 9988 if (widget.hasClass('widget-ajax-filters--single')) { 9989 widget.find('input[type="checkbox"]').each(function() { 9990 if (_this.attr('id') !== $(this).attr('id')) { 9991 $(this).prop('checked', false); 9992 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 9993 } 9994 }); 9995 } 9996 9997 if (_this.prop('checked')) { 9998 link.addClass('term-filter-link--active'); 9999 } else { 10000 link.removeClass('term-filter-link--active'); 10001 } 10002 10003 reload_items(container, url, true); 10004 }); 10005 10006 $(document).on('change', 'select.select--term-filters', function(e) { 10007 var _this = $(this); 10008 var selected = _this.find('option:selected'); 10009 var option = $(selected); 10010 var url = option.attr('data-term-filter-url'); 10011 var container = get_filters_container(); 10012 var widget = _this.closest('.uncode_widget'); 10013 10014 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10015 window.location = url; 10016 } else { 10017 reload_items(container, url, true); 10018 } 10019 }); 10020 10021 $(document).on('click', '.filter-list__link', function(e) { 10022 if (SiteParameters.is_frontend_editor) { 10023 return false;
10024 } 10025 10026 e.preventDefault(); 10027 10028 var _this = $(this); 10029 var container = get_filters_container(); 10030 var url = _this.attr('href'); 10031 reload_items(container, url, true); 10032 }); 10033 10034 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 10035 var _this = $(this); 10036 var container = get_filters_container(); 10037 var url = _this.attr('href'); 10038 reload_items(container, url, true); 10039 }); 10040 10041 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 10042 10043 var _this = $(this); 10044 var container = get_filters_container(); 10045 var url = _this.attr('href'); 10046 10047 if ( container.length ) { 10048 e.preventDefault(); 10049 reload_items(container, url, true); 10050 } 10051 }); 10052 10053 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 10054 var _this = $(this); 10055 var container = get_filters_container(); 10056 10057 if (container.length > 0) { 10058 e.preventDefault(); 10059 10060 var min_price = $('#min_price').val(); 10061 var max_price = $('#max_price').val(); 10062 var location = window.location; 10063 var url = location.href; 10064 var page_uri = location.origin + location.pathname; 10065 var is_filtered = page_uri !== url; 10066 10067 if (is_filtered) { 10068 url = remove_parameter_from_url(url, 'min_price'); 10069 url = remove_parameter_from_url(url, 'max_price'); 10070 } 10071 10072 var concat = page_uri === url ? '?' : '&'; 10073 var params = {'min_price': min_price, 'max_price': max_price}; 10074 10075 url = url + concat + $.param(params); 10076 10077 reload_items(container, url, true); 10078 } 10079 }); 10080 10081 var search_timer; 10082 10083 $(document).on('keyup', '.term-filters-search-input', function(e) { 10084 var _this = $(this); 10085 var container = get_filters_container(); 10086 var value = _this.val(); 10087 10088 if (search_timer) { 10089 clearTimeout(search_timer); 10090 } 10091 10092 search_timer = setTimeout(function() { 10093 update_search_url(container, value); 10094 }, 500); 10095 }); 10096 } 10097 10098 function update_search_url(container, search_value) { 10099 var location = window.location; 10100 var url = location.href; 10101 var page_uri = location.origin + location.pathname; 10102 var is_filtered = page_uri !== url; 10103 var key_search = SiteParameters.ajax_filter_key_search; 10104 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 10105 10106 if (is_filtered) { 10107 url = remove_parameter_from_url(url, key_search); 10108 url = remove_parameter_from_url(url, key_unfilter); 10109 } 10110 10111 if (search_value) { 10112 var concat = page_uri === url ? '?' : '&'; 10113 var params = {}; 10114 10115 params[key_search] = search_value; 10116 params[key_unfilter] = 1; 10117 url = url + concat + $.param(params); 10118 } else { 10119 url = remove_parameter_from_url(url, key_search); 10120 } 10121 10122 reload_items(container, url, true); 10123 } 10124 10125 function remove_parameter_from_url(url, parameter) { 10126 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 10127 } 10128 10129 function get_filters_container() { 10130 var container = $('.ajax-grid-system'); 10131 10132 if (container.length == 0) { 10133 container = $('.ajax-filters'); 10134 } 10135 10136 return container; 10137 } 10138 10139 function update_widgets_state(widgets_states, container) { 10140 for (var i = widgets_states.length - 1; i >= 0; i--) { 10141 var state = widgets_states[i]; 10142 10143 if (!state.collapse) { 10144 continue; 10145 } 10146 10147 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 10148 10149 if (state.open) { 10150 new_widget.find('.widget-title').addClass('open'); 10151 if (state.css) { 10152 new_widget.find('.widget-collapse-content').attr('style', state.css); 10153 } 10154 } else { 10155 new_widget.find('.widget-title').removeClass('open'); 10156 if (state.css) { 10157 new_widget.find('.widget-collapse-content').attr('style', state.css); 10158 } 10159 } 10160 } 10161 } 10162 10163 // Reload items via AJAX 10164 function reload_items(container, url, push) { 10165 container.addClass('grid-filtering'); 10166 10167 $.ajax({ 10168 url : url, 10169 success : function(response) { 10170 if (!response) { 10171 return; 10172 } 10173 10174 $(document).trigger('uncode-ajax-pre-filtered'); 10175 10176 var container_id = container.attr('id'); 10177 var pagination = $('.row-navigation'); 10178 10179 if (container_id) { 10180 var container_to_append = $(response).find('#' + container_id); 10181 var pagination_to_append = $(response).find('.row-navigation'); 10182 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10183 10184 // Remember open/closed widgets 10185 var widgets = $('.uncode_widget'); 10186 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 10187 var widgets_states = []; 10188 10189 widgets.each(function() { 10190 var widget = $(this); 10191 var id = widget.attr('data-id'); 10192 var state = { 10193 'id': id, 10194 'collapse': false, 10195 'open': false, 10196 'css': false, 10197 }; 10198 10199 var collapse_wrapper = widget.find('.widget-collapse-content'); 10200 10201 if (collapse_wrapper.length > 0) { 10202 state.collapse = true; 10203 10204 var collapse_wrapper_css = collapse_wrapper.attr('style'); 10205 var title = widget.find('.widget-title'); 10206 10207 state.css = collapse_wrapper_css; 10208 10209 if (title.hasClass('open')) { 10210 state.open = true; 10211 } else { 10212 state.open = false;
10213 } 10214 } 10215 10216 widgets_states.push(state); 10217 }); 10218 10219 // Update widgets state 10220 if (offcanvas_sidebar_wrapper.length === 0) { 10221 update_widgets_state(widgets_states, container_to_append); 10222 } 10223 10224 // Update default sidebar state 10225 if (!container.hasClass('ajax-hide-filters')) { 10226 container_to_append.removeClass('ajax-hide-filters'); 10227 } 10228 10229 // Update horizontal sidebar 10230 if (!container.hasClass('ajax-hide-filters-blanks')) { 10231 container_to_append.removeClass('ajax-hide-filters-blanks'); 10232 } 10233 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 10234 if (horizontal_sidebar_wrapper.length > 0) { 10235 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 10236 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 10237 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 10238 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 10239 10240 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 10241 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 10242 } 10243 10244 // Append container 10245 container.replaceWith(container_to_append); 10246 10247 // Append pagination 10248 if (pagination.length > 0) { 10249 if (pagination_to_append.length > 0) { 10250 pagination.html(pagination_to_append.html()); 10251 } else { 10252 pagination.html(''); 10253 } 10254 } else { 10255 if (pagination_to_append.length > 0) { 10256 $('.post-wrapper').append(pagination_to_append); 10257 } 10258 } 10259 10260 // Update off canvas sidebar (mobile and overlay) 10261 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10262 10263 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 10264 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 10265 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 10266 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 10267 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 10268 10269 // Update widgets state 10270 update_widgets_state(widgets_states, sidebar_to_append); 10271 10272 // Update sidebar 10273 sidebar_container.html(sidebar_to_append.html()); 10274 } 10275 10276 if (push) { 10277 UNCODE.lastURL = url; 10278 window.history.pushState( 10279 { pageTitle: document.title }, 10280 '', 10281 url 10282 ); 10283 } 10284 10285 if (typeof UNCODE.isotopeLayout !== 'undefined') { 10286 UNCODE.isotopeLayout(); 10287 } 10288 if (typeof UNCODE.justifiedGallery !== 'undefined') { 10289 UNCODE.justifiedGallery(); 10290 } 10291 if (typeof UNCODE.cssGrid !== 'undefined') { 10292 UNCODE.cssGrid(); 10293 } 10294 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 10295 UNCODE.lightbox(); 10296 } 10297 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 10298 UNCODE.lightgallery(); 10299 } 10300 if (typeof UNCODE.carousel !== 'undefined') { 10301 UNCODE.carousel($('body')); 10302 } 10303 UNCODE.animations(); 10304 if (typeof UNCODE.filters !== 'undefined') { 10305 UNCODE.filters(); 10306 } 10307 if (typeof UNCODE.widgets !== 'undefined') { 10308 UNCODE.widgets(); 10309 } 10310 10311 if (SiteParameters.dynamic_srcset_active === '1') { 10312 UNCODE.refresh_dynamic_srcset_size(); 10313 } 10314 10315 if (typeof UNCODE.menuSmartInit !== 'undefined') { 10316 UNCODE.menuSmartInit(); 10317 } 10318 10319 maybe_scroll_to_top(); 10320 10321 $(document).trigger('uncode-ajax-filtered'); 10322 $(document.body).trigger('init_price_filter'); 10323 } 10324 }, 10325 error: function() { 10326 container.removeClass('grid-filtering'); 10327 10328 if (SiteParameters.enable_debug == true) { 10329 // This console log is disabled by default 10330 // So nothing is printed in a typical installation 10331 // 10332 // It can be enabled for debugging purposes setting 10333 // the 'uncode_enable_debug_on_js_scripts' filter to true 10334 console.log('There was an error retrieving the products'); 10335 } 10336 } 10337 }); 10338 } 10339 10340 // Scroll to top after filtering 10341 function maybe_scroll_to_top() { 10342 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10343 10344 if (offcanvas_sidebar_wrapper.length > 0) { 10345 return; 10346 } 10347 10348 var container = get_filters_container(); 10349 var bound = container[0].getBoundingClientRect(); 10350 10351 if (bound.y < 0) { 10352 $(window).scrollTop(container.offset().top); 10353 } 10354 } 10355 10356 // Back/forward browser buttons 10357 $(window).on("popstate.ajaxfilters", function(e) { 10358 var location = window.location; 10359 var url = location.href; 10360 var params = UNCODE.getURLParams(window.location); 10361 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 10362 10363 UNCODE.lastURL = url; 10364 10365 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 10366 return; 10367 } 10368 10369 var container = get_filters_container(); 10370 10371 reload_items(container, url, false); 10372 }); 10373 10374 // Destroy load more before to init a new one 10375 $(window).on('uncode-ajax-pre-filtered', function() { 10376 if ($.fn.infinitescroll) { 10377 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 10378 } 10379 }); 10380 10381 init_filters(); 10382}; 10383 10384 UNCODE.init = function() { 10385 var wfl_check = false, wfl_request, waypoint_request; 10386 UNCODE.preventDoubleTransition(); 10387 UNCODE.betterResize(); 10388 UNCODE.utils(); 10389 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 10390 UNCODE.changeSkinOnScroll(); 10391 } 10392 if (typeof UNCODE.share !== 'undefined') { 10393 UNCODE.share(); 10394 } 10395 if (typeof UNCODE.tooltip !== 'undefined') { 10396 UNCODE.tooltip(); 10397 } 10398 if (typeof UNCODE.counters !== 'undefined') { 10399 UNCODE.counters(); 10400 } 10401 if (typeof UNCODE.countdowns !== 'undefined') { 10402 UNCODE.countdowns(); 10403 } 10404 if (typeof UNCODE.tabs !== 'undefined') { 10405 UNCODE.tabs(); 10406 } 10407 if (typeof UNCODE.collapse !== 'undefined') { 10408 UNCODE.collapse(); 10409 } 10410 if (typeof UNCODE.bigText !== 'undefined') { 10411 UNCODE.bigText(); 10412 } 10413 UNCODE.menuSystem(); 10414 if (typeof UNCODE.bgChanger !== 'undefined') { 10415 UNCODE.bgChanger(); 10416 } 10417 if (typeof UNCODE.magicCursor !== 'undefined') { 10418 UNCODE.magicCursor(); 10419 } 10420 if (typeof UNCODE.magneticCursor !== 'undefined') { 10421 UNCODE.magneticCursor(); 10422 } 10423 if (typeof UNCODE.dropImage !== 'undefined') { 10424 UNCODE.dropImage(); 10425 } 10426 if (typeof UNCODE.postTable !== 'undefined') { 10427 UNCODE.postTable(); 10428 } 10429 if (typeof UNCODE.rotatingTxt !== 'undefined') { 10430 UNCODE.rotatingTxt(); 10431 } 10432 if (typeof UNCODE.okvideo !== 'undefined') { 10433 UNCODE.okvideo(); 10434 } 10435 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 10436 UNCODE.backgroundSelfVideos(); 10437 } 10438 UNCODE.tapHover(); 10439 if (typeof UNCODE.isotopeLayout !== 'undefined') { 10440 UNCODE.isotopeLayout(); 10441 } 10442 if (typeof UNCODE.justifiedGallery !== 'undefined') { 10443 UNCODE.justifiedGallery(); 10444 } 10445 if (typeof UNCODE.cssGrid !== 'undefined') { 10446 UNCODE.cssGrid(); 10447 } 10448 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 10449 UNCODE.lightbox(); 10450 } 10451 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 10452 $(window).on('load',function(){ 10453 UNCODE.lightgallery(); 10454 }); 10455 } 10456 if (typeof UNCODE.carousel !== 'undefined') { 10457 UNCODE.carousel($('body')); 10458 } 10459 if (typeof UNCODE.lettering !== 'undefined') { 10460 UNCODE.lettering(); 10461 } 10462 UNCODE.animations(); 10463 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 10464 UNCODE.stickyElements(); 10465 } 10466 if (typeof UNCODE.twentytwenty !== 'undefined') { 10467 UNCODE.twentytwenty(); 10468 } 10469 UNCODE.disableHoverScroll(); 10470 UNCODE.printScreen(); 10471 if (typeof UNCODE.particles !== 'undefined') { 10472 UNCODE.particles(); 10473 } 10474 if (typeof UNCODE.filters !== 'undefined') { 10475 UNCODE.filters(); 10476 } 10477 if (typeof UNCODE.ajax_filters !== 'undefined') { 10478 UNCODE.ajax_filters(); 10479 } 10480 if (typeof UNCODE.widgets !== 'undefined') { 10481 UNCODE.widgets(); 10482 } 10483 if (typeof UNCODE.unmodal !== 'undefined') { 10484 UNCODE.unmodal(); 10485 } 10486 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 10487 if ( !UNCODE.isFullPage ) { 10488 UNCODE.checkScrollForTabs(); 10489 } 10490 } 10491 if (typeof UNCODE.onePage !== 'undefined') { 10492 UNCODE.onePage(UNCODE.isMobile); 10493 } 10494 if (typeof UNCODE.fullPage !== 'undefined') { 10495 $(document).ready(function(){ 10496 UNCODE.fullPage(); 10497 }); 10498 } 10499 if (typeof UNCODE.skewIt !== 'undefined') { 10500 UNCODE.skewIt(); 10501 } 10502 if (typeof UNCODE.rotateIt !== 'undefined') { 10503 UNCODE.rotateIt(); 10504 } 10505 if (typeof UNCODE.textMarquee !== 'undefined') { 10506 UNCODE.textMarquee(); 10507 } 10508 if (typeof UNCODE.stickyScroll !== 'undefined') { 10509 UNCODE.stickyScroll(); 10510 } 10511 if (typeof UNCODE.stickyTrigger !== 'undefined') { 10512 UNCODE.stickyTrigger(); 10513 } 10514 if (typeof UNCODE.verticalText !== 'undefined') { 10515 UNCODE.verticalText(); 10516 } 10517 if (typeof UNCODE.revslider !== 'undefined') { 10518 UNCODE.revslider(); 10519 } 10520 if (typeof UNCODE.layerslider !== 'undefined') { 10521 UNCODE.layerslider(); 10522 } 10523 $(window).on('load',function(){ 10524 clearRequestTimeout(waypoint_request);
10525 waypoint_request = requestTimeout( function(){ 10526 Waypoint.refreshAll(); 10527 }, 1000); 10528 10529 if (typeof UNCODE.parallax !== 'undefined') { 10530 UNCODE.parallax(); 10531 } 10532 }); 10533 } 10534 10535 if ( ! SiteParameters.is_frontend_editor ) { 10536 UNCODE.init(); 10537 } 10538 10539 10540})(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.