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 is_first_link = false, 89 target, 90 trigger; 91 92 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 93 target = e.target; 94 trigger = e.currentTarget; 95 } 96 97 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 98 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 99 UNCODE.hideMenu(100); 100 } 101 } 102 103 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { 104 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 105 if ( $('.menu-sticky').length && !$('.menu-hide').length ) { 106 scroll_offset += $('#logo-container-mobile').outerHeight(); 107 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 108 scroll_offset += $('.menu-sticky .menu-container').outerHeight(); 109 } else { 110 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 111 scroll_offset += UNCODE.menuMobileHeight; 112 } else { 113 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 ) { 114 scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 115 } else { 116 if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 117 scroll_offset += UNCODE.menuMobileHeight; 118 } 119 } 120 } 121 } 122 } 123 } 124 125 scroll_offset += UNCODE.bodyBorder; 126 127 return scroll_offset; 128 } 129 130 if ( !UNCODE.isFullPage ) { 131 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) { 132 133 var hash = (e.currentTarget).hash, 134 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 135 anchor = ''; 136 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 137 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 138 e.preventDefault(); 139 if (!$('#tab-reviews').is(':visible')) { 140 $('a[href="#tab-reviews"]').trigger('click'); 141 } 142 var calc_scroll = $('.wootabs .tab-content').offset().top; 143 calc_scroll -= UNCODE.get_scroll_offset(e); 144
145 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 146 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 147 148 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 149 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 150 } 151 } 152 153 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 154 delta = bodyTop - calc_scroll, 155 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 156 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 157 158 requestTimeout(function(){ 159 if (scrollSpeed == 0) { 160 $('html, body').scrollTop(calc_scroll); 161 UNCODE.scrolling = false; 162 } else { 163 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 164 $(this).stop(); 165 }).animate({ 166 scrollTop: calc_scroll 167 }, scrollSpeed, 'easeInOutCubic', function() { 168 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 169 UNCODE.scrolling = false; 170 } 171 ); 172 } 173 }, 200); 174 return; 175 } 176 if (hash != undefined) { 177 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 178 var anchor = this.hash.slice(1); 179 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 180 if ( !specialFormat.test(hash) ) { 181 if ( $(hash).length ) 182 anchor = $(hash); 183 } 184 } 185 } 186 187 if (is_scrolltop || anchor != '') { 188 if (is_scrolltop) { 189 e.preventDefault(); 190 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 191 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 192 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 193 194 if (scrollSpeed == 0) { 195 $('html, body').scrollTop(0); 196 UNCODE.scrolling = false; 197 } else { 198 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 199 $(this).stop(); 200 }).animate({ 201 scrollTop: 0 202 }, scrollSpeed, 'easeInOutCubic', function() { 203 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 204 UNCODE.scrolling = false; 205 }); 206 } 207 } else { 208 var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor; 209 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 210 var get_href = $(val).attr('href'); 211 if (get_href != undefined) { 212 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 213 else $(val).parent().removeClass('active'); 214 } 215 }); 216 if (scrollSection.length) { 217 if ( $('body').hasClass('uncode-scroll-no-history') ) { 218 e.preventDefault(); 219 } 220 221 if (UNCODE.menuOpened) { 222 if (UNCODE.wwidth < UNCODE.mediaQuery) { 223 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 224 } else { 225 $('.mmb-container-overlay .overlay-close').trigger('click'); 226 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 227 } 228 } 229 230 var calc_scroll = scrollSection.offset().top, 231 getOffset = UNCODE.get_scroll_offset(e), 232 $logo = $('#logo-container-mobile'), 233 logoH, 234 $menu = $('#masthead .menu-container'), 235 menuH; 236 237 calc_scroll -= getOffset; 238 239 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 240 delta = bodyTop - calc_scroll, 241 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 242 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 243
244 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 245 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') ) { 246 logoH = $logo.outerHeight(), 247 menuH = $menu.outerHeight(); 248 if ( calc_scroll < ( logoH + menuH ) ) { 249 calc_scroll = 0; 250 } 251 } 252 } 253 254 if (scrollSpeed == 0) { 255 $('html, body').scrollTop(calc_scroll); 256 UNCODE.scrolling = false; 257 } else { 258 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 259 $(this).stop(); 260 }).animate({ 261 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 262 }, scrollSpeed, 'easeInOutCubic', function() { 263 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 264 UNCODE.scrolling = false; 265 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 266 if (getOffset != UNCODE.get_scroll_offset(e)) { 267 calc_scroll = scrollSection.offset().top; 268 getOffset = UNCODE.get_scroll_offset(e); 269 calc_scroll -= getOffset; 270 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 271 $(this).stop(); 272 }).animate({ 273 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 274 }, scrollSpeed, 'easeInOutCubic', function() { 275 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 276 UNCODE.scrolling = false; 277 } 278 ); 279 } 280 } 281 }); 282 } 283 } 284 } 285 } 286 }); 287 $('.header-scrolldown').on('click', function(event) { 288 289 event.preventDefault(); 290 291 var pageHeader = $(event.target).closest('#page-header'), 292 pageHeaderTop = pageHeader.offset().top, 293 pageHeaderHeight = pageHeader.outerHeight(), 294 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 295 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 296 297 var calc_scroll = pageHeaderTop + pageHeaderHeight, 298 getOffset = UNCODE.get_scroll_offset(event); 299 calc_scroll -= getOffset; 300 301 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 302 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 303 304 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 305 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 306 } 307 } 308 309 if (scrollSpeed == 0) { 310 $('html, body').scrollTop(calc_scroll); 311 UNCODE.scrolling = false; 312 } else { 313 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 314 $(this).stop(); 315 }).animate({ 316 scrollTop: calc_scroll 317 }, scrollSpeed, 'easeInOutCubic', function() { 318 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 319 UNCODE.scrolling = false; 320 if (getOffset != UNCODE.get_scroll_offset(event)) { 321 calc_scroll = pageHeaderTop + pageHeaderHeight; 322 getOffset = UNCODE.get_scroll_offset(event); 323 calc_scroll -= getOffset; 324 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 325 $(this).stop(); 326 }).animate({ 327 scrollTop: calc_scroll 328 }, scrollSpeed, 'easeInOutCubic', function() { 329 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 330 UNCODE.scrolling = false; 331 } 332 ); 333 } 334 } 335 ); 336 } 337 }); 338 } 339 340 // Colomun hover effect 341 // ================= 342 $(document).on('mouseenter', '.col-link', function(e) { 343 var uncol = $(e.target).prev('.uncol'), 344 el = uncol.find('.column-background'); 345 if (el) { 346 $('.btn-container .btn', uncol).toggleClass('active'); 347 var elOverlay = $(el[0]).find('.block-bg-overlay'); 348 if (elOverlay.length) { 349 var getOpacity = $(elOverlay).css('opacity'); 350 if (getOpacity != 1) { 351 getOpacity = Math.round(getOpacity * 100) / 100; 352 var newOpacity = getOpacity + .1; 353 $(elOverlay).data('data-opacity', getOpacity); 354 $(elOverlay).css('opacity', newOpacity); 355 } 356 } 357 } 358 }).on('mouseleave', '.col-link', function(e) { 359 var uncol = $(e.target).prev('.uncol'), 360 el = uncol.find('.column-background'); 361 $('.btn-container .btn', uncol).toggleClass('active'); 362 if (el) { 363 var elOverlay = $(el[0]).find('.block-bg-overlay'); 364 if (elOverlay.length) { 365 var getOpacity = $(elOverlay).data('data-opacity'); 366 $(elOverlay).css('opacity', getOpacity); 367 } 368 } 369 }); 370 371 // Admin bar 372 // ============ 373 var fixAdminBar = function() { 374 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 375 var getAdminBar = $('#wpadminbar'); 376 if (getAdminBar.length) { 377 if (getAdminBar.css('position') !== 'hidden') { 378 var getAdminBarHeight = getAdminBar.height(); 379 if (getAdminBar.css('position') === 'fixed') { 380 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 381 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 382 } else { 383 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 384 $('.body-borders .top-border').css({'margin-top':'0px'}); 385 } 386 } 387 } 388 } 389 }; 390 window.addEventListener('load', fixAdminBar); 391 window.addEventListener('resize', fixAdminBar); 392 // Print 393 // =========== 394 var beforePrint = function() { 395 window.dispatchEvent(new CustomEvent('resize')); 396 window.dispatchEvent(UNCODE.boxEvent); 397 }; 398 399 if (window.matchMedia) { 400 var mediaQueryList = window.matchMedia('print'); 401 mediaQueryList.addListener(function(mql) { 402 if (mql.matches) { 403 beforePrint(); 404 } 405 }); 406 } 407 408 window.onbeforeprint = beforePrint; 409 410 // Safari srcset 411 var safariSrcSet = function(){ 412 if ( !SiteParameters.is_frontend_editor ) { 413 $('html.safari img[sizes]').each(function(){ 414 var $img = $(this), 415 sizeImg = parseInt($img.attr('sizes'));
416 if ( typeof(sizeImg) === 'number' ) { 417 $img.attr('sizes', (sizeImg) + 'px'); 418 } 419 }); 420 } 421 }; 422 window.addEventListener('load', safariSrcSet); 423} 424 425UNCODE.lettering = function() { 426 427 var setCTA; 428 var highlightStill = function(){ 429 430 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 431 432 $.each($heading_texts, function(key, el) { 433 var $heading = $(el); 434 435 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 436 return; 437 } 438 439 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 440 return; 441 } 442 443 var waypoint = new Waypoint({ 444 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 445 element: el, 446 handler: function() { 447 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 448 anims_l = $anims.length; 449 $anims.each(function(_key_, _el_){ 450 var $anim = $(_el_); 451 452 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 453 $anim.addClass('heading-text-highlight-animated'); 454 455 if ( $heading.data('animate') === true ) { 456 $anim.css({ 457 '-webkit-transition-duration': '0ms', 458 '-moz-transition-duration': '0ms', 459 '-o-transition-duration': '0ms', 460 'transition-duration': '0ms', 461 }); 462 } else { 463 $anim.css({ 464 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 465 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 466 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 467 'transition-delay': ((_key_ + 2) * 200) + 'ms', 468 }); 469 } 470 } 471 472 }); 473 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 474 $heading.data('animate', true); 475 }); 476 $anims.removeAttr('data-animated'); 477 }, 478 offset: '100%' 479 }); 480 481 }); 482 483 Waypoint.refreshAll(); 484 $( document.body ).trigger('uncode_waypoints'); 485 486 } 487 488 requestTimeout(function(){ 489 highlightStill(); 490 $(window).on( 'resize', function(){ 491 clearRequestTimeout(setCTA); 492 setCTA = requestTimeout( highlightStill, 100 ); 493 }); 494 }, 400); 495 496}; 497 498UNCODE.isUnmodalOpen = false; 499 500var manageVideoSize = function(){ 501 502 var setVideoFit; 503 $('.wp-block-embed').each(function(){ 504 505 var $this = $(this); 506 507 if ( $('iframe', $this).length ) { 508 509 var $iframe = $('> iframe, > a > iframe', $this), 510 w = parseFloat($iframe.attr('width')), 511 h = parseFloat($iframe.attr('height')), 512 url = $iframe.attr('src'), 513 ratio, frW; 514 515 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 516 517 ratio = h / w; 518 var setResizeiFto, 519 resizeiFrame = function(){ 520 frW = $iframe.width(); 521 $iframe.css({ 522 height: frW * ratio 523 }); 524 }; 525 resizeiFrame(); 526 $(window).on( 'resize load', function(){ 527 clearRequestTimeout(setResizeiFto); 528 setResizeiFto = requestTimeout( function() { 529 resizeiFrame(); 530 }, 10 ); 531 }); 532 533 } 534 535 } 536 537 }); 538 539}; 540 541manageVideoSize(); 542 543UNCODE.vivus = function(icon, time, delay, file) { 544 if (typeof Vivus !== 'undefined') { 545 var icon_options = { 546 type: 'delayed', 547 pathTimingFunction: Vivus.EASE_OUT, 548 animTimingFunction: Vivus.LINEAR, 549 duration: time, 550 } 551 552 if (delay) { 553 icon_options.delayStart = delay; 554 } 555 556 if (file) { 557 icon_options.file = file; 558 } 559 560 new Vivus(icon, icon_options); 561 } 562}; 563 564UNCODE.lastURL = ''; 565 566UNCODE.getURLParams = function(current_location, is_string) { 567 var params = {}; 568 if (is_string) { 569 var url = current_location.split('?')[1]; 570 } else { 571 var url = current_location.search; 572 url = url.substring(1); 573 } 574 if (url) { 575 var parts = url.split('&'); 576 for (var i = 0; i < parts.length; i++) { 577 var nv = parts[i].split('='); 578 if (!nv[0]) { 579 continue; 580 } 581 params[nv[0]] = nv[1] || true; 582 } 583 } 584 return params; 585} 586 587UNCODE.hasEqualURLParams = function(obj1, obj2) { 588 for (var i in obj1) { 589 if (obj1.hasOwnProperty(i)) { 590 if (!obj2.hasOwnProperty(i)) { 591 return false; 592 } 593 if (obj1[i] != obj2[i]) { 594 return false; 595 } 596 } 597 } 598 for (var i in obj2) { 599 if (obj2.hasOwnProperty(i)) { 600 if (!obj1.hasOwnProperty(i)) { 601 return false;
602 } 603 if (obj1[i] != obj2[i]) { 604 return false; 605 } 606 } 607 } 608 return true; 609} 610 611UNCODE.changeSkinOnScroll = function(){ 612 if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { 613 return; 614 } 615 var $masthead = $('#masthead'), 616 transDesktop, 617 transMobile, 618 changeSkin, 619 620 checkTransparencyAndChange = function( $col ){ 621 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 622 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 623 changeSkin = $masthead.hasClass('menu-change-skin'); 624 625 if ( ! transDesktop && ! transMobile ) { 626 return false; 627 } 628 629 if ( ! changeSkin ) { 630 return false; 631 } 632 633 if ( $col.hasClass('style-light') ){ 634 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 635 return false; 636 } else if ( $col.hasClass('style-dark') ) { 637 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 638 return false; 639 } 640 }; 641 642 var prev_row = 'normal', 643 odd = true, 644 $rows = $('.vc_row[data-parent]:visible'); 645 $.each($rows, function(index, row){ 646 var $row = $(row), 647 $col = $('.uncol', $row).first(), 648 $slider = $('.uncode-slider', $row); 649 650 var wayDown = new Waypoint({ 651 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 652 element: row, 653 handler: function(direction) { 654 if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 655 if ( $slider.length ) { 656 $col = $('.owl-item.index-active .uncol', $slider).first(); 657 } 658 checkTransparencyAndChange($col); 659 } 660 if ( odd === false ) { 661 if ( row.hasAttribute('data-bg-changer') ) { 662 prev_row = 'bg-changer'; 663 } else { 664 prev_row = 'normal'; 665 } 666 odd = true; 667 } else { 668 odd = false; 669 } 670 }, 671 offset: function() { 672 return UNCODE.menuHeight / 2 673 } 674 }); 675 var wayUp = new Waypoint({ 676 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 677 element: row, 678 handler: function(direction) { 679 if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 680 if ( $slider.length ) { 681 $col = $('.owl-item.index-active .uncol', $slider).first(); 682 } 683 checkTransparencyAndChange($col); 684 } 685 if ( odd === false ) { 686 if ( row.hasAttribute('data-bg-changer') ) { 687 prev_row = 'bg-changer'; 688 } else { 689 prev_row = 'normal'; 690 } 691 odd = true; 692 } else { 693 odd = false; 694 } 695 }, 696 offset: function() { 697 return -row.clientHeight + ( UNCODE.menuHeight / 2 ) 698 } 699 }); 700 }); 701 702}; 703 704UNCODE.share = function() { 705 if (typeof Share !== 'undefined') { 706 var share_button_element = $('.share-button'); 707 var share_button_url = share_button_element.data('url'); 708 709 var share_button_config = { 710 ui: { 711 flyout: "top center", 712 button_font: false, 713 button_text: '', 714 icon_font: false 715 } 716 }; 717 718 if (share_button_url) { 719 share_button_config.url = share_button_url.replace("&", "%26"); 720 } 721 722 var share_button_top = new Share('.share-button', share_button_config); 723 } 724}; 725 726UNCODE.tooltip = function() { 727 if (typeof jQuery.fn.tooltip !== 'undefined') { 728 $('.btn-tooltip').tooltip(); 729 } 730}; 731 732UNCODE.counters = function() { 733 var $counters = $('.counter:not(.counter-init)'); 734 $counters.each(function(){ 735 var $counter = $(this).addClass('counter-init'); 736 if ( $counter.closest( '.owl-carousel' ).length ) { 737 return; 738 } 739 $counter.addClass('started').counterUp({ 740 delay: 10, 741 time: 1500 742 }); 743 }); 744}; 745 746UNCODE.countdowns = function() { 747 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 748 $countdowns.each(function() { 749 var $this = $(this).addClass('counter-init'), 750 finalDate = $(this).data('uncode-countdown'); 751 $this.countdown(finalDate, function(event) { 752 $this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>')); 753 }); 754 }); 755}; 756 757UNCODE.tabs = function() { 758 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { 759 e.preventDefault() 760 $(this).tab('show'); 761 requestTimeout(function() { 762 window.dispatchEvent(UNCODE.boxEvent); 763 $(window).trigger('uncode.re-layout'); 764 }, 300); 765 }); 766}; 767 768UNCODE.collapse = function() { 769 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 770 var $this = $(this), 771 href 772 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 773 var $target = $(target) 774 var data = $target.data('bs.collapse') 775 var option = data ? 'toggle' : $this.data() 776 var parent = $this.attr('data-parent') 777 var $parent = parent && $(parent) 778 var $title = $(this).parent() 779 if ($parent) { 780 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 781 if ($title.hasClass('active')) { 782 $title.removeClass('active'); 783 } else { 784 $parent.find('.panel-title').removeClass('active') 785 $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') 786 } 787 } 788 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 789 requestTimeout(function() { 790 $(window).trigger('uncode.re-layout'); 791 }, 500); 792 }); 793}; 794 795UNCODE.bigText = function(el) { 796 if (el == undefined) { 797 el = $('body'); 798 } 799 $.each($('.bigtext', el), function(index, val) { 800 $(val).bigtext({ 801 minfontsize: 24 802 }); 803 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 804 opacity: 1 805 }); 806 requestTimeout(function() { 807 if ($(val).find('.animate_when_almost_visible').length != 0) { 808 $(val).css({opacity: 1}); 809 } 810 }, 400); 811 }); 812}; 813 814UNCODE.process_shortpixel_image = function(image) { 815 var data = { 816 action: 'shortpixel_manual_optimization', 817 image_id: image,
818 cleanup: true 819 }; 820 821 $.get(SiteParameters.ajax_url, data); 822}; 823 824UNCODE.menuSystem = function() { 825 826 function menuMobile() { 827 var $body = $('body'), 828 $mobileToggleButton = $('.mobile-menu-button'), 829 $masthead = $('#masthead'), 830 $box, 831 $el, 832 $el_transp, 833 elHeight, 834 check, 835 animating = false, 836 stickyMobile = false, 837 menuClose = new CustomEvent('menuMobileClose'), 838 menuOpen = new CustomEvent('menuMobileOpen'); 839 UNCODE.menuOpened = false; 840 $mobileToggleButton.on('click', function(event) { 841 var btn = this; 842 if ($(btn).hasClass('overlay-close')) return; 843 event.preventDefault(); 844 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 845 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 846 $box = $(this).closest('.box-container').find('.main-menu-container'); 847 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 848 $el_transp = $('.menu-absolute.menu-transparent'); 849 if (UNCODE.isMobile) { 850 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 ) { 851 stickyMobile = true; 852 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 853 } else { 854 elHeight = 0; 855 $.each($box.find('> div'), function(index, val) { 856 elHeight += $(val).outerHeight(); 857 }); 858 } 859 } else { 860 elHeight = 0; 861 $.each($el, function(index, val) { 862 elHeight += $(val).outerHeight(); 863 }); 864 } 865 var open = function() { 866 if (!animating) { 867 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 868 window.dispatchEvent(menuOpen); 869 animating = true; 870 UNCODE.menuOpened = true; 871 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 872 if ( $body.hasClass('menu-sticky-mobile') ) { 873 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 874 } 875 if ($('body.menu-offcanvas').length) { 876 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 877 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 878 } else { 879 if ( $('.menu-hide, .menu-sticky').length ) { 880 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 881 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 882 } 883 } 884 } 885 } 886 if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) { 887 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 888 } 889 btn.classList.add('close'); 890 $box.addClass('open-items'); 891 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 892 $el_transp.addClass('is_mobile_open'); 893 } 894 $box.animate({ 895 height: elHeight 896 }, 600, "easeInOutCirc", function() { 897 animating = false; 898 if (!stickyMobile) $box.css('height', 'auto'); 899 }); 900 } 901 }; 902 903 var close = function() { 904 if (!animating) { 905 window.dispatchEvent(menuClose); 906 animating = true; 907 UNCODE.menuOpened = false; 908 btn.classList.remove('close'); 909 btn.classList.add('closing'); 910 $box.addClass('close'); 911 requestTimeout(function() { 912 $box.removeClass('close'); 913 $box.removeClass('open-items'); 914 btn.classList.remove('closing'); 915 if ($el_transp.length) { 916 $el_transp.removeClass('is_mobile_open'); 917 } 918 }, 500); 919 $body.removeClass('opening-overlay-menu'); 920 $box.animate({ 921 height: 0 922 }, { 923 duration: 600, 924 easing: "easeInOutCirc", 925 complete: function(elements) { 926 $(elements).css('height', ''); 927 animating = false;
928 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 929 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 930 } 931 $body.removeClass('open-overlay-menu'); 932 } 933 }); 934 } 935 }; 936 check = (!UNCODE.menuOpened) ? open() : close(); 937 } 938 }); 939 window.addEventListener('menuMobileTrigged', function(e) { 940 $('.mobile-menu-button.close').trigger('click'); 941 }); 942 window.addEventListener('orientationchange', function(e) { 943 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 944 }); 945 window.addEventListener("resize", function() { 946 if ($(window).width() < UNCODE.mediaQuery) { 947 if (UNCODE.isMobile) { 948 var $box = $('.box-container .main-menu-container'), 949 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 950 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') { 951 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 952 elHeight = 0; 953 $.each($el, function(index, val) { 954 elHeight += $(val).outerHeight(); 955 }); 956 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; 957 $($box).css('height', elHeight + 'px'); 958 } 959 } 960 } 961 } else { 962 $('.menu-hide-vertical').removeAttr('style'); 963 $('.menu-container-mobile').removeAttr('style'); 964 $('.vmenu-container.menu-container').removeAttr('style'); 965 } 966 }); 967 }; 968 969 function menuOffCanvas() { 970 var menuClose = new CustomEvent('menuCanvasClose'), 971 menuOpen = new CustomEvent('menuCanvasOpen'); 972 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').click(function(event) { 973 if ($(window).width() > UNCODE.mediaQuery) { 974 if ($(event.currentTarget).hasClass('close')) { 975 $(event.currentTarget).removeClass('close'); 976 $(event.currentTarget).addClass('closing'); 977 requestTimeout(function() { 978 $(event.currentTarget).removeClass('closing'); 979 window.dispatchEvent(menuClose); 980 }, 500); 981 982 } else { 983 $(event.currentTarget).addClass('close'); 984 window.dispatchEvent(menuOpen); 985 } 986 } 987 988 $('body').toggleClass('off-opened'); 989 }); 990 }; 991 992 function menuOverlay() { 993 if ( $('.overlay').length ) { 994 $('.overlay').removeClass('hidden'); 995 } 996 if ($('.overlay-sequential, .menu-mobile-animated').length > 0) { 997 $('.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) { 998 var transDelay = (index / 20) + 0.1; 999 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1000 transDelay = transDelay + 0.3; 1001 $(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'); 1002 }); 1003 } 1004 }; 1005 function menuAppend() { 1006 var $body = $('body'), 1007 $menuCont = $('.menu-container'), 1008 $cta = $('.navbar-cta'), 1009 $socials = $('.navbar-social'), 1010 $ul = $('.navbar-main ul.menu-primary-inner'), 1011 $ulCta, 1012 $ulSocials, 1013 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1014 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1015 $firstNav = $('.navbar-nav:first-child', $firstMenu), 1016 $secondNav = $('.navbar-nav:first-child', $secondMenu), 1017 $ulFirst = $('> ul', $firstNav), 1018 $ulSecond = $('> ul', $secondNav), 1019 setCTA, 1020 appendCTA = function(){ 1021 return true; 1022 }, 1023 appendSocials = function(){ 1024 return true; 1025 }, 1026 appendSplit = function(){ 1027 return true; 1028 }; 1029 1030 if ( $body.hasClass('cta-not-appended') ) 1031 return false; 1032 1033 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1034 $ulCta = $('> ul', $cta); 1035 1036 appendCTA = function(){ 1037 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1038 $ul.after($ulCta); 1039 } else { 1040 $cta.append($ulCta); 1041 } 1042 } 1043 } 1044 appendCTA(); 1045 1046 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) { 1047 $ulSocials = $('> ul', $socials); 1048 1049 appendSocials = function(){ 1050 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1051 $ul.after($ulSocials); 1052 } else { 1053 $socials.append($ulSocials); 1054 } 1055 } 1056 } 1057 appendSocials(); 1058 1059 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1060 appendSplit = function(){ 1061 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1062 if ( $secondNav.length ) { 1063 $secondNav.prepend($ulFirst); 1064 } 1065 $firstMenu.hide(); 1066 } else { 1067 $firstNav.append($ulFirst); 1068 $firstMenu.css({ 1069 'display': 'table-cell' 1070 }); 1071 } 1072 } 1073 } 1074 appendSplit(); 1075 1076 $(window).on( 'resize', function(){ 1077 clearRequestTimeout(setCTA); 1078 setCTA = requestTimeout( function() { 1079 appendCTA(); 1080 appendSocials(); 1081 appendSplit(); 1082 }, 10 ); 1083 }); 1084 } 1085 //menuMobileButton(); 1086 menuMobile(); 1087 menuOffCanvas(); 1088 UNCODE.menuSmartInit(); 1089 menuAppend(); 1090 menuOverlay(); 1091 var setMenuOverlay; 1092 $(window).on( 'resize', function(){ 1093 if ( $('.overlay').length && $(window).width() > 1024 ) { 1094 $('.overlay').addClass('hidden'); 1095 } 1096 clearRequestTimeout(setMenuOverlay); 1097 setMenuOverlay = requestTimeout( menuOverlay, 150 ); 1098 }); 1099}; 1100 1101UNCODE.menuSmartInit = function() { 1102 var $menusmart = $('[class*="menu-smart"]'), 1103 $masthead = $('#masthead'), 1104 $hMenu = $('.menu-horizontal-inner', $masthead), 1105 $focus = $('.overlay-menu-focus'), 1106 showTimeout = 50, 1107 hideTimeout = 50, 1108 showTimeoutFunc, hideTimeoutFunc; 1109 1110 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1111 $(this).data('hover', true); 1112 }, function(){ 1113 $(this).data('hover', false); 1114 }); 1115 1116 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1117 var $notLis = $('> .nav > ul > li a', $hMenu), 1118 $menuA = $('a', $masthead).not($notLis), 1119 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1120 showFuncCond = function() { return true }; 1121 1122 if ( $('body').hasClass('focus-megamenu') ) { 1123 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1124 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1125 } else if ( $('body').hasClass('focus-links') ) { 1126 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1127 } 1128 1129 $hoverSelector.hover(function(){ 1130 clearRequestTimeout(hideTimeoutFunc);
1131 showTimeoutFunc = requestTimeout(function(){ 1132 $('body').addClass('navbar-hover'); 1133 }, showTimeout*2); 1134 }, function(){ 1135 hideTimeoutFunc = requestTimeout(function(){ 1136 if ( ! $('.overlay-search.open', $masthead).length ) { 1137 $('body').removeClass('navbar-hover'); 1138 } 1139 }, hideTimeout*2); 1140 }); 1141 } else { 1142 showFuncCond = function() { return false }; 1143 } 1144 1145 if ($menusmart.length > 0) { 1146 $menusmart.smartmenus({ 1147 subIndicators: false, 1148 subIndicatorsPos: 'append', 1149 //subMenusMinWidth: '13em', 1150 subIndicatorsText: '', 1151 showTimeout: showTimeout, 1152 hideTimeout: hideTimeout, 1153 showFunction: function($ul, complete) { 1154 clearRequestTimeout(showTimeoutFunc); 1155 $ul.fadeIn(0, 'linear', function(){ 1156 complete(); 1157 if ( $ul.hasClass('vc_row') ) { 1158 $ul.css({ 1159 'display': 'table' 1160 }); 1161 } 1162 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1163 $('body').addClass('open-megamenu'); 1164 } 1165 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1166 $('body').addClass('navbar-hover'); 1167 } 1168 }).addClass('open-animated'); 1169 }, 1170 hideFunction: function($ul, complete) { 1171 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 1172 $('body').removeClass('open-megamenu'); 1173 } 1174 var fixIE = $('html.ie').length; 1175 if (fixIE) { 1176 var $rowParent = $($ul).closest('.main-menu-container'); 1177 $rowParent.height('auto'); 1178 } 1179 $ul.fadeOut(0, 'linear', function(){ 1180 complete(); 1181 $ul.removeClass('open-animated'); 1182 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 1183 $('body').removeClass('open-submenu'); 1184 } 1185 }); 1186 }, 1187 collapsibleShowFunction: function($ul, complete) { 1188 $ul.slideDown(400, 'easeInOutCirc', complete); 1189 }, 1190 collapsibleHideFunction: function($ul, complete) { 1191 $ul.slideUp(200, 'easeInOutCirc', complete); 1192 }, 1193 hideOnClick: true 1194 }); 1195 1196 if ( $('body').hasClass('menu-accordion-active') ) { 1197 requestTimeout(function(){ 1198 $menusmart.addClass('menu-smart-init'); 1199 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 1200 }, 1000); 1201 } 1202 } 1203} 1204 1205UNCODE.okvideo = function() { 1206 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1207 $.okvideo = function(options) { 1208 // if the option var was just a string, turn it into an object 1209 if (typeof options !== 'object') options = { 1210 'video': options 1211 }; 1212 var base = this; 1213 // kick things off 1214 base.init = function() { 1215 base.options = $.extend({}, $.okvideo.options, options); 1216 // support older versions of okvideo 1217 if (base.options.video === null) base.options.video = base.options.source; 1218 base.setOptions(); 1219 var target = base.options.target || $('body'); 1220 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1221 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1222 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1223 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>'; 1224 if (OKEvents.utils.isMobile()) { 1225 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>'); 1226 } else { 1227 if (base.options.controls === 3) { 1228 target.append(mask) 1229 } 1230 if (base.options.adproof === 1) { 1231 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>'); 1232 } else { 1233 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>'); 1234 } 1235 } 1236 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1237 if (base.options.playlist.list === null) { 1238 if (base.options.video.provider === 'youtube') { 1239 base.loadYouTubeAPI(); 1240 } else if (base.options.video.provider === 'vimeo') { 1241 base.options.volume /= 100; 1242 base.loadVimeoAPI(); 1243 } 1244 } else { 1245 base.loadYouTubeAPI(); 1246 } 1247 } 1248 }; 1249 // clean the options 1250 base.setOptions = function() { 1251 // exchange 'true' for '1' and 'false' for 3 1252 for (var key in this.options) { 1253 if (this.options[key] === true) this.options[key] = 1; 1254 if (this.options[key] === false) this.options[key] = 3; 1255 } 1256 if (base.options.playlist.list === null) { 1257 base.options.video = base.determineProvider(); 1258 } 1259 // pass options to the window 1260 $(window).data('okoptions-' + base.options.id, base.options); 1261 };
1262 // insert js into the head and exectue a callback function 1263 base.insertJS = function(src, callback){ 1264 var tag; 1265 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1266 tag = UNCODE.insertedSripts[src]; 1267 if (callback){ 1268 if (tag.readyState){ //IE 1269 tag.onreadystatechange = function(){ 1270 if (tag.readyState === "loaded" || 1271 tag.readyState === "complete"){ 1272 tag.onreadystatechange = null; 1273 callback(); 1274 } 1275 }; 1276 } else { 1277 $(tag).on('load', callback); 1278 } 1279 } 1280 return; 1281 } 1282 tag = document.createElement('script'); 1283 if (callback){ 1284 if (tag.readyState){ //IE 1285 tag.onreadystatechange = function(){ 1286 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1287 tag.onreadystatechange = null; 1288 callback(); 1289 } 1290 }; 1291 } else { 1292 tag.onload = function() { 1293 callback(); 1294 }; 1295 } 1296 } 1297 tag.src = src; 1298 var firstScriptTag = document.getElementsByTagName('script')[0]; 1299 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1300 if ( ! UNCODE.insertedSripts ) { 1301 UNCODE.insertedSripts = []; 1302 } 1303 UNCODE.insertedSripts[src] = tag; 1304 }; 1305 // load the youtube api 1306 base.loadYouTubeAPI = function(callback) { 1307 base.insertJS('https://www.youtube.com/player_api'); 1308 }; 1309 base.loadYouTubePlaylist = function() { 1310 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1311 }; 1312 // load the vimeo api by replacing the div with an iframe and loading js 1313 base.loadVimeoAPI = function() { 1314 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, 1315 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen>'); 1316 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1317 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1318 base.insertJS('//player.vimeo.com/api/player.js', function() { 1319 vimeoPlayerReady(base.options.id); 1320 }); 1321 }; 1322 // is it from youtube or vimeo? 1323 base.determineProvider = function() { 1324 var a = document.createElement('a'); 1325 a.href = base.options.video; 1326 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1327 var videoid = a.href.split('/')[3].toString(); 1328 var query = videoid.substring(videoid.indexOf('?') + 1); 1329 if (query != '') { 1330 var vars = query.split('&'); 1331 for (var i = 0; i < vars.length; i++) { 1332 var pair = vars[i].split('='); 1333 if (pair[0] == 'v') { 1334 videoid = pair[1]; 1335 } 1336 } 1337 } 1338 return { 1339 "provider": "youtube", 1340 "id": videoid 1341 }; 1342 } else if (/vimeo.com/.test(base.options.video)) { 1343 return { 1344 "provider": "vimeo", 1345 "id": (a.href.split('/')[3].toString()).split('#')[0], 1346 }; 1347 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1348 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1349 if (id.length == 11) { 1350 return { 1351 "provider": "youtube", 1352 "id": id.toString() 1353 }; 1354 } else { 1355 for (var i = 0; i < base.options.video.length; i++) { 1356 if (typeof parseInt(base.options.video[i]) !== "number") { 1357 throw 'not vimeo but thought it was for a sec'; 1358 } 1359 } 1360 return { 1361 "provider": "vimeo", 1362 "id": base.options.video 1363 }; 1364 } 1365 } else { 1366 throw "OKVideo: Invalid video source"; 1367 } 1368 }; 1369 base.init(); 1370 }; 1371 $.okvideo.options = { 1372 id: null, 1373 source: null, // Deprecate dis l8r 1374 video: null, 1375 playlist: { // eat ur heart out @brokyo 1376 list: null, 1377 index: 0, 1378 startSeconds: 0, 1379 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 1380 }, 1381 disableKeyControl: 1, 1382 captions: 0, 1383 loop: 1, 1384 hd: 1, 1385 volume: 0, 1386 adproof: false, 1387 unstarted: null, 1388 onFinished: null, 1389 onReady: null, 1390 onPlay: null, 1391 onPause: null, 1392 buffering: null, 1393 controls: false, 1394 autoplay: true, 1395 annotations: true, 1396 cued: null 1397 }; 1398 $.fn.okvideo = function(options) { 1399 options.target = this; 1400 return this.each(function() { 1401 (new $.okvideo(options)); 1402 }); 1403 }; 1404 1405 $(".no-touch .uncode-video-container.video").each(function(index, el) { 1406 var $this = $(this), 1407 url = $this.attr('data-video'), 1408 id = $this.attr('data-id'), 1409 cloned = $this.closest('.owl-item'); 1410 if (!cloned.hasClass('cloned') || cloned.length == 0) { 1411 $this.okvideo({ 1412 id: id, 1413 source: url.split('#')[0], 1414 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 1415 autoplay: 1, 1416 controls: 0, 1417 volume: 0, 1418 adproof: 0, 1419 caller: $this, 1420 hd: 1, 1421 onReady: function(player) { 1422 var getPlayer = player.c || player.h || player, 1423 $iframe, 1424 getContainer = $(getPlayer).closest('.background-element'); 1425 if (getContainer.length) { 1426 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 1427 } 1428 1429 if ( $this.hasClass('drop-move') ) { 1430 1431 var $iframe = $(getPlayer), 1432 w = parseFloat($iframe.attr('width')), 1433 h = parseFloat($iframe.attr('height')), 1434 ratio = h / w, 1435 setResizeiFto, 1436 resizeiFrame = function(){ 1437 var dataW = $this.attr('data-w'), 1438 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1439 newH = newW * ratio; 1440 $iframe.css({ 1441 width: newW, 1442 height: newH 1443 }); 1444 }; 1445 resizeiFrame(); 1446 $(window).on( 'load', resizeiFrame ); 1447 $(window).on( 'resize', function(){ 1448 clearRequestTimeout(setResizeiFto); 1449 setResizeiFto = requestTimeout( function() { 1450 resizeiFrame(); 1451 }, 10 ); 1452 }); 1453 1454 } 1455 1456 } 1457 }); 1458 } 1459 }); 1460 1461 $(window).on('load', function(){ 1462 $('.mejs-fullscreen-button button').on('click', function(){ 1463 var $button = $(this), 1464 $stuck = $button.closest('.is_stucked'); 1465 1466 if ( $stuck.length ) { 1467 $stuck = $(this).trigger("sticky_kit:detach"); 1468 window.scrollTo(0, 0); 1469 } 1470 }); 1471 }); 1472}; 1473 1474UNCODE.backgroundSelfVideos = function( $ctx ) { 1475 1476 if ( typeof $ctx === 'undefined' ) { 1477 $ctx = $('body'); 1478 } 1479 1480 var backgroundSelfVideosInit = function( $ctx ) { 1481 $(".background-video-shortcode", $ctx).each(function(index, el) { 1482 if ( SiteParameters.block_mobile_videos === true ) { 1483 return false;
1484 } 1485 if ( $(this).closest('mediaelementwrapper').length ) { 1486 return true; 1487 } 1488 var $video_el = $(this), 1489 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 1490 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 1491 video_id = $video_el.attr('id'); 1492 1493 if ( SiteParameters.is_frontend_editor ) { 1494 video_id = video_id + '_' + index; 1495 $video_el.attr('id', video_id); 1496 } 1497 1498 if (typeof MediaElement === "function") { 1499 var media = new MediaElement(video_id, { 1500 startVolume: 0, 1501 loop: true, 1502 success: function(mediaElement, domObject) { 1503 domObject.volume = 0; 1504 $(mediaElement).data('started', false); 1505 mediaElement.addEventListener('timeupdate', function(e) { 1506 if (!$(e.target).data('started')) { 1507 $(mediaElement).data('started', true); 1508 } 1509 }); 1510 mediaElement.addEventListener('loadedmetadata', function(e) { 1511 mediaElement.play(); 1512 }); 1513 if (!UNCODE.isMobile) { 1514 requestTimeout(function() { 1515 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 1516 }, 100); 1517 } 1518 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 1519 mediaElement.play(); 1520 } 1521 1522 if ( $parent_drop_move.length ) { 1523 var setResizeMEto, 1524 resizeMediaElement = function(){ 1525 var dataW = $parent_drop_move.attr('data-w'), 1526 videoW = domObject.width, 1527 videoH = domObject.height, 1528 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1529 newH = newW / ( videoW / videoH ); 1530 1531 $(domObject).css({ 1532 'height': newH, 1533 'width': newW 1534 }); 1535 }; 1536 $(window).on( 'resize load', function(){ 1537 clearRequestTimeout(setResizeMEto); 1538 setResizeMEto = requestTimeout( function() { 1539 resizeMediaElement(); 1540 }, 10 ); 1541 }); 1542 } 1543 1544 mediaElement.addEventListener('play', function() { 1545 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 1546 $(mediaElement).closest('#page-header').addClass('video-started'); 1547 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1548 }, true); 1549 1550 }, 1551 // fires when a problem is detected 1552 error: function() {} 1553 }); 1554 1555 } else { 1556 $video_el[0].play(); 1557 $video_el[0].addEventListener('play', function() { 1558 $video_el[0].muted = true; 1559 $video_el[0].loop = true; 1560 $video_el.closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 1561 $video_el.closest('#page-header').addClass('video-started'); 1562 $video_el.closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1563 }, false); 1564 } 1565 }); 1566 }; 1567 1568 backgroundSelfVideosInit( $ctx ); 1569 1570 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 1571 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 1572 var $el = model.view.$el, 1573 shortcode = model.attributes.shortcode; 1574 1575 backgroundSelfVideosInit( $el ); 1576 }); 1577 } 1578}; 1579 1580UNCODE.is_scrolling = false; 1581 1582UNCODE.disableHoverScroll = function() { 1583 1584 if (!UNCODE.isMobile && !UNCODE.isFullPage) { 1585 var body = document.body, 1586 timer; 1587 1588 window.addEventListener('scroll', function() { 1589 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 1590 clearRequestTimeout(timer); 1591 if ( body.classList && !body.classList.contains('disable-hover') ) { 1592 body.classList.add('disable-hover'); 1593 window.dispatchEvent(new CustomEvent('disable-hover')); 1594 } 1595 UNCODE.is_scrolling = true; 1596 1597 timer = requestTimeout(function() { 1598 if ( body.classList ) { 1599 body.classList.remove('disable-hover'); 1600 window.dispatchEvent(new CustomEvent('enable-hover')); 1601 } 1602 UNCODE.is_scrolling = false; 1603 }, delay); 1604 }, false); 1605 } 1606}; 1607 1608UNCODE.isotopeLayout = function() { 1609 if ($('.isotope-layout').length > 0) { 1610 var isotopeContainersArray = [], 1611 typeGridArray = [], 1612 layoutGridArray = [], 1613 screenLgArray = [], 1614 screenMdArray = [], 1615 screenSmArray = [], 1616 transitionDuration = [], 1617 $filterItems = [], 1618 $filters = $('.isotope-system .isotope-filters'), 1619 $itemSelector = '.tmb-iso', 1620 $items, 1621 itemMargin, 1622 correctionFactor = 0, 1623 firstLoad = true, 1624 isOriginLeft = $('body').hasClass('rtl') ? false : true; 1625 $('[class*="isotope-container"]').each(function(index) { 1626 var _this = $(this); 1627 var isoData = _this.data(), 1628 $data_lg, 1629 $data_md, 1630 $data_sm; 1631 _this.children('.tmb').addClass('tmb-iso'); 1632 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 1633 else $data_lg = '1000'; 1634 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 1635 else $data_md = '600'; 1636 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 1637 else $data_sm = '480'; 1638 screenLgArray.push($data_lg); 1639 screenMdArray.push($data_md); 1640 screenSmArray.push($data_sm); 1641 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 1642 if (isoData.type == 'metro') typeGridArray.push(true);
1643 else typeGridArray.push(false); 1644 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 1645 else layoutGridArray.push('masonry'); 1646 isotopeContainersArray.push(_this); 1647 _this.attr('data-iso-index', index); 1648 }); 1649 var colWidth = function(index) { 1650 $(isotopeContainersArray[index]).width(''); 1651 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 1652 widthAvailable = $(isotopeContainersArray[index]).width(), 1653 columnNum = 12, 1654 columnWidth = 0, 1655 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 1656 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 1657 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 1658 $rowContainer, 1659 paddingRow, 1660 $colContainer, 1661 paddingCol; 1662 1663 if ( consider_menu ) 1664 winHeight = winHeight - UNCODE.menuHeight; 1665 1666 if ( data_vp_height === '1' ) { 1667 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 1668 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 1669 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 1670 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 1671 winHeight = winHeight - ( paddingRow + paddingCol ); 1672 } 1673 1674 if (isPx) { 1675 columnWidth = Math.ceil(widthAvailable / columnNum); 1676 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 1677 } else { 1678 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 1679 } 1680 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 1681 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 1682 for (var i = 0, len = $items.length; i < len; i++) { 1683 var $item = $($items[i]), 1684 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 1685 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 1686 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 1687 1688 1689 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 1690 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 1691 } 1692 1693 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 1694 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 1695 } 1696 1697 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 1698 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1699 switch (parseInt(multiplier_w[1])) { 1700 case (5): 1701 case (4): 1702 case (3): 1703 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1704 multiplier_w[1] = 6; 1705 break; 1706 case (2): 1707 case (1): 1708 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 1709 multiplier_w[1] = 3; 1710 break; 1711 default: 1712 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1713 multiplier_w[1] = 12; 1714 break; 1715 } 1716 1717 if (multiplier_w[1] == 2.4) { // 5 columns 1718 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1719 multiplier_w[1] = 6; 1720 } 1721 } 1722 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 1723 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1724 switch (parseInt(multiplier_w[1])) { 1725 case (5): 1726 case (4): 1727 case (3): 1728 case (2): 1729 case (1): 1730 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1731 multiplier_w[1] = 6; 1732 break; 1733 default: 1734 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1735 multiplier_w[1] = 12; 1736 break; 1737 } 1738 1739 if (multiplier_w[1] == 2.4) { // 5 columns 1740 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1741 multiplier_w[1] = 6; 1742 } 1743 } 1744 } else if (widthAvailable < screenSmArray[index]) { 1745 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1746 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1747 multiplier_w[1] = 12; 1748 if (typeGridArray[index]) multiplier_h[1] = 12; 1749 } 1750 } 1751 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 1752 height; 1753 1754 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 1755 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 1756 if ( widthAvailable < screenSmArray[index] ) { 1757 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 1758 } 1759 } else { 1760 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 1761 } 1762 1763 if (width >= widthAvailable) { 1764 $item.css({ 1765 width: widthAvailable 1766 }); 1767 if (typeGridArray[index]) { 1768 $item.children().add($item.find('.backimg')).css({ 1769 height: height 1770 }); 1771 } 1772 } else { 1773 $item.css({ 1774 width: width 1775 }); 1776 if (typeGridArray[index]) { 1777 $item.children().add($item.find('.backimg')).css({ 1778 height: height 1779 }); 1780 } 1781 } 1782 } 1783 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 1784 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 1785 } else { 1786 return columnWidth; 1787 } 1788 }, 1789 init_isotope = function() { 1790 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 1791 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 1792 isotopeId = isotopeSystem.attr('id'), 1793 $layoutMode = layoutGridArray[i], 1794 setIsotopeFirstRowTimeOut, 1795 setIsotopeFirstRow = function(items){ 1796 var firstRow = true; 1797 $(items).each(function(index, val){ 1798 var el = items[index].element, 1799 el_top = items[index].position.y, 1800 $el = $(el); 1801 if ( index > 0 && el_top > 0 && firstRow ) { 1802 firstRow = false;
1803 } else if ( index == 0 && el_top == 0 ) { 1804 firstRow = true; 1805 } 1806 if ( firstRow ) { 1807 $el.removeClass('tmb-isotope-further-row'); 1808 } else { 1809 $el.addClass('tmb-isotope-further-row'); 1810 } 1811 }); 1812 }; 1813 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 1814 //resizable: true, 1815 itemSelector: $itemSelector, 1816 layoutMode: $layoutMode, 1817 transitionDuration: transitionDuration[i], 1818 masonry: { 1819 columnWidth: colWidth(i) 1820 }, 1821 vertical: { 1822 horizontalAlignment: 0.5, 1823 }, 1824 sortBy: 'original-order', 1825 isOriginLeft: isOriginLeft 1826 }) 1827 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 1828 .on('layoutComplete', function( event, items ){ 1829 if ( typeof items[0] !== 'undefined' ) { 1830 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1831 setIsotopeFirstRow(items); 1832 } 1833 } 1834 }) 1835 .on('arrangeComplete', function( event, items ){ 1836 if ( typeof items[0] !== 'undefined' ) { 1837 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1838 clearRequestTimeout(setIsotopeFirstRowTimeOut); 1839 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 1840 setIsotopeFirstRow(items); 1841 }, 100); 1842 } 1843 } 1844 }); 1845 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 1846 $(isotopeContainersArray[i]).infinitescroll({ 1847 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 1848 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 1849 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve 1850 animate: false, 1851 behavior: 'local', 1852 debug: false, 1853 loading: { 1854 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 1855 speed: 0, 1856 finished: undefined, 1857 msg: $('#' + isotopeId + ' .loadmore-button'), 1858 }, 1859 errorCallback: function() { 1860 var isotope_system = $(this).closest('.isotope-system'); 1861 $('.loading-button', isotope_system).hide(); 1862 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 1863 } 1864 }, 1865 // append the new items to isotope on the infinitescroll callback function. 1866 function(newElements, opts) { 1867 var $isotope = $(this), 1868 isotopeId = $isotope.closest('.isotope-system').attr('id'), 1869 filters = new Array(), 1870 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 1871 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 1872 $numPages = $('a', $infinite_button).data('pages'), 1873 delay = 300; 1874 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 1875 $infinite_button.show(); 1876 $loading_button.hide(); 1877 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 1878 $('> li', $isotope).remove(); 1879 $.each($(newElements), function(index, val) { 1880 $(val).addClass('tmb-iso'); 1881 if ($(val).is("li")) { 1882 filters.push($(val)[0]); 1883 } 1884 }); 1885 newElements = newElements.filter(function(x) { 1886 return filters.indexOf(x) < 0 1887 }); 1888 $.each($(filters), function(index, val) { 1889 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 1890 }); 1891 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 1892 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 1893 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 1894 if (typeof getLightbox === 'object') { 1895 getLightbox.refresh(); 1896 } else { 1897 UNCODE.lightbox(); 1898 } 1899 } 1900 if ( typeof twttr !== 'undefined' ) 1901 twttr.widgets.load(isotopeContainersArray[i]); 1902 1903 requestTimeout(function() { 1904 Waypoint.refreshAll(); 1905 $isotope.trigger('more-items-loaded'); 1906 }, 1000); 1907 1908 }); 1909 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 1910 var $infinite_isotope = $(isotopeContainersArray[i]), 1911 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 1912 $infinite_isotope.infinitescroll('pause'); 1913 $infinite_button.on('click', function(event) { 1914 event.preventDefault(); 1915 var $infinite_system = $(event.target).closest('.isotope-system'), 1916 $infinite_isotope = $infinite_system.find('.isotope-container'), 1917 isotopeId = $infinite_system.attr('id'); 1918 $(event.currentTarget).html(SiteParameters.loading); 1919 $infinite_isotope.infinitescroll('resume'); 1920 $infinite_isotope.infinitescroll('retrieve'); 1921 $infinite_isotope.infinitescroll('pause'); 1922 }); 1923 } 1924 } 1925 } 1926 }, 1927 onLayout = function(isotopeObj, startIndex, needsReload) { 1928 var needsReload = needsReload ? true : false;
1929 1930 if (typeof UNCODE.bigText !== 'undefined') { 1931 UNCODE.bigText(); 1932 } 1933 isotopeObj.css('opacity', 1); 1934 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 1935 1936 requestTimeout(function() { 1937 if (startIndex > 0) { 1938 reloadIsotope(isotopeObj); 1939 if (SiteParameters.dynamic_srcset_active === '1') { 1940 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1941 UNCODE.adaptive_srcset(isotopeObj); 1942 } 1943 // window.dispatchEvent(UNCODE.boxEvent); 1944 } else if (needsReload) { 1945 reloadIsotope(isotopeObj); 1946 } 1947 1948 UNCODE.adaptive(); 1949 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 1950 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1951 } 1952 if (typeof MediaElement === "function") { 1953 $(isotopeObj).find('audio,video').each(function() { 1954 $(this).mediaelementplayer({ 1955 pauseOtherPlayers: false, 1956 }); 1957 }); 1958 } 1959 if ($(isotopeObj).find('.nested-carousel').length) { 1960 if (typeof UNCODE.carousel !== 'undefined') { 1961 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 1962 } 1963 requestTimeout(function() { 1964 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1965 }, 200); 1966 } else { 1967 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1968 } 1969 isotopeObj.trigger('isotope-layout-complete'); 1970 1971 }, 100); 1972 1973 }, 1974 boxAnimation = function(items, startIndex, sequential, container) { 1975 var $allItems = items.length - startIndex, 1976 showed = 0, 1977 index = 0; 1978 if (container.closest('.owl-item').length == 1) return false; 1979 $.each(items, function(index, val) { 1980 var $this = $(val), 1981 elInner = $('> .t-inside', val); 1982 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 1983 return; 1984 } 1985 if (val[0]) val = val[0]; 1986 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 1987 new Waypoint({ 1988 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 1989 element: val, 1990 handler: function() { 1991 var element = $('> .t-inside', this.element), 1992 parent = $(this.element), 1993 currentIndex = parent.index(); 1994 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 1995 delayAttr = parseInt(element.attr('data-delay')); 1996 if (isNaN(delayAttr)) delayAttr = 100; 1997 delay -= showed; 1998 var objTimeout = requestTimeout(function() { 1999 element.removeClass('zoom-reverse').addClass('start_animation'); 2000 showed = parent.index(); 2001 if ( container.data('isotope') ) { 2002 container.isotope('layout'); 2003 } 2004 }, delay * delayAttr) 2005 parent.data('objTimeout', objTimeout); 2006 if (!UNCODE.isUnmodalOpen) { 2007 this.destroy(); 2008 } 2009 }, 2010 offset: '100%' 2011 }) 2012 } else { 2013 if (elInner.hasClass('force-anim')) { 2014 elInner.addClass('start_animation'); 2015 } else { 2016 elInner.css('opacity', 1); 2017 } 2018 container.isotope('layout'); 2019 } 2020 2021 index++; 2022 }); 2023 }, 2024 reloadIsotope = function(isotopeObj) { 2025 var isoIndex = $(isotopeObj).attr('data-iso-index'); 2026 var $layoutMode = ($(isotopeObj).data('layout')); 2027 if ($layoutMode === undefined) { 2028 $layoutMode = 'masonry'; 2029 } 2030 if (isotopeObj.data('isotope')) { 2031 isotopeObj.isotope({ 2032 itemSelector: $itemSelector, 2033 layoutMode: $layoutMode, 2034 transitionDuration: transitionDuration[isoIndex], 2035 masonry: { 2036 columnWidth: colWidth(isoIndex) 2037 }, 2038 vertical: { 2039 horizontalAlignment: 0.5, 2040 }, 2041 sortBy: 'original-order', 2042 isOriginLeft: isOriginLeft 2043 }); 2044 } 2045 } 2046 ; 2047 if ($('.isotope-pagination').length > 0) { 2048 $('.isotope-system').on('click', '.pagination a', function(evt) { 2049 evt.preventDefault(); 2050 2051 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 2052 container = $(this).closest('.isotope-system'), 2053 calc_scroll = container.closest('.row-parent').offset().top; 2054 calc_scroll -= UNCODE.get_scroll_offset(); 2055 2056 var menu_container = $('.menu-sticky'); 2057 var menu = menu_container.find('.menu-container'); 2058 2059 if (menu_container.length > 0 && menu.length > 0) { 2060 calc_scroll = calc_scroll - menu.outerHeight(); 2061 } 2062 2063 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2064 delta = bodyTop - calc_scroll, 2065 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 2066 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2067 2068 if ( !UNCODE.isFullPage ) { 2069 if (scrollSpeed == 0) { 2070 $('html, body').scrollTop(calc_scroll); 2071 } else { 2072 $('html, body').animate({ 2073 scrollTop: calc_scroll 2074 },{ 2075 easing: 'easeInOutQuad', 2076 duration: scrollSpeed, 2077 complete: function(){ 2078 UNCODE.scrolling = false;
2079 } 2080 }); 2081 } 2082 } 2083 2084 loadIsotope($(this), true); 2085 evt.preventDefault(); 2086 }); 2087 } 2088 $filters.on('click', 'a.isotope-nav-link', function(evt) { 2089 if ($(this).hasClass('no-isotope-filter')) { 2090 return; 2091 } 2092 var $filter = $(this), 2093 filterContainer = $filter.closest('.isotope-filters'), 2094 filterValue = $filter.attr('data-filter'), 2095 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 2096 transitionDuration = container.data().isotope.options.transitionDuration, 2097 delay = 300, 2098 filterItems = []; 2099 2100 var filter_items = function(){ 2101 if (filterValue !== undefined) { 2102 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2103 var parent = $(val).parent(), 2104 objTimeout = parent.data('objTimeout'); 2105 if (objTimeout) { 2106 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2107 clearRequestTimeout(objTimeout); 2108 } 2109 if (transitionDuration == 0) { 2110 if ($(val).hasClass('animate_when_almost_visible')) { 2111 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2112 } else { 2113 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2114 } 2115 } 2116 }); 2117 requestTimeout(function(){ 2118 if ( filterValue == '*' ) { 2119 container.removeClass('isotope-filtered'); 2120 } else { 2121 container.addClass('isotope-filtered'); 2122 } 2123 container.isotope({ 2124 filter: function() { 2125 var block = $(this), 2126 filterable = (filterValue == '*') || block.hasClass(filterValue), 2127 lightboxElements = $('[data-lbox^=ilightbox]', block); 2128 if (filterable) { 2129 if (lightboxElements.length) { 2130 lightboxElements.removeClass('lb-disabled'); 2131 container.data('lbox', $(lightboxElements[0]).data('lbox')); 2132 } 2133 filterItems.push(block); 2134 } else { 2135 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 2136 } 2137 container.trigger('more-items-loaded'); 2138 return filterable; 2139 } 2140 }); 2141 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 2142 2143 }, delay); 2144 2145 /** once filtered - start **/ 2146 container.isotope('once', 'arrangeComplete', function() { 2147 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2148 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 2149 if (typeof getLightbox === 'object') { 2150 getLightbox.refresh(); 2151 } else { 2152 UNCODE.lightbox(); 2153 } 2154 } 2155 if (transitionDuration == 0) { 2156 requestTimeout(function() { 2157 boxAnimation(filterItems, 0, false, container); 2158 }, 100); 2159 } 2160 requestTimeout(function() { 2161 Waypoint.refreshAll(); 2162 }, 2000); 2163 }); 2164 /** once filtered - end **/ 2165 } else { 2166 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2167 $.each(UNCODE.lightboxArray, function(index, val) { 2168 UNCODE.lightboxArray[index].destroy(); 2169 }); 2170 } 2171 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2172 var parent = $(val).parent(), 2173 objTimeout = parent.data('objTimeout'); 2174 if (objTimeout) { 2175 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2176 clearRequestTimeout(objTimeout); 2177 } 2178 if (transitionDuration == 0) { 2179 if ($(val).hasClass('animate_when_almost_visible')) { 2180 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2181 } else { 2182 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2183 } 2184 } 2185 }); 2186 container.parent().addClass('grid-loading'); 2187 loadIsotope($filter); 2188 } 2189 }; 2190 2191 if (!$filter.hasClass('active')) { 2192 /** Scroll top with filtering */ 2193 if (filterContainer.hasClass('filter-scroll')) { 2194 var calc_scroll = container.closest('.row-parent').offset().top; 2195 calc_scroll -= UNCODE.get_scroll_offset(); 2196 2197 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2198 delta = bodyTop - calc_scroll, 2199 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 2200 filterTolerance = false, 2201 filter_timeout; 2202 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2203 2204 if ( !UNCODE.isFullPage ) { 2205 if (scrollSpeed == 0) { 2206 $('html, body').scrollTop(calc_scroll); 2207 UNCODE.scrolling = false;
2208 filter_items(); 2209 } else { 2210 2211 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 2212 filter_items(); 2213 filterTolerance = true; 2214 } 2215 2216 $('html, body').animate({ 2217 scrollTop: calc_scroll 2218 },{ 2219 easing: 'easeInOutQuad', 2220 duration: scrollSpeed, 2221 complete: function(){ 2222 UNCODE.scrolling = false; 2223 if ( !filterTolerance ) { 2224 filter_timeout = setTimeout(function(){ 2225 clearTimeout(filter_timeout); 2226 filter_items(); 2227 }, 200); 2228 } 2229 } 2230 }); 2231 } 2232 } 2233 } else { 2234 filter_items(); 2235 } 2236 } 2237 evt.preventDefault(); 2238 }); 2239 2240 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 2241 var params = UNCODE.getURLParams(window.location); 2242 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 2243 2244 UNCODE.lastURL = window.location.href; 2245 2246 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 2247 return; 2248 } 2249 2250 if (params.id === undefined) { 2251 $.each($('.isotope-system'), function(index, val) { 2252 loadIsotope($(val)); 2253 }); 2254 } else { 2255 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 2256 loadIsotope($('#' + params.id)); 2257 } 2258 } 2259 }); 2260 2261 var loadIsotope = function($href, $paginating) { 2262 var is_paginating = false; 2263 2264 if (undefined !== $paginating && $paginating) { 2265 var is_paginating = $paginating; 2266 } 2267 2268 var href = ($href.is("a") ? $href.attr('href') : location), 2269 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 2270 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 2271 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 2272 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 2273 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 2274 isotopeId = isotopeSystem.attr('id'); 2275 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 2276 UNCODE.lastURL = href; 2277 history.pushState({ 2278 myIsotope: true 2279 }, document.title, href); 2280 } 2281 if (is_paginating) { 2282 isotopeWrapper.addClass('grid-filtering'); 2283 } 2284 $.ajax({ 2285 url: href 2286 }).done(function(data) { 2287 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 2288 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 2289 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 2290 isotopeWrapper.addClass('isotope-reloaded'); 2291 requestTimeout(function() { 2292 isotopeWrapper.removeClass('grid-loading'); 2293 isotopeWrapper.removeClass('isotope-reloaded'); 2294 isotopeWrapper.removeClass('grid-filtering'); 2295 }, 500); 2296 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 2297 var parent = $(val).parent(), 2298 objTimeout = parent.data('objTimeout'); 2299 if (objTimeout) { 2300 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2301 clearRequestTimeout(objTimeout); 2302 } 2303 if ($(val).hasClass('animate_when_almost_visible')) { 2304 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2305 } else { 2306 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 2307 } 2308 }); 2309 requestTimeout(function() { 2310 if (isotopeContainer.data('isotope')) { 2311 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 2312 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 2313 UNCODE.adaptive(); 2314 if (SiteParameters.dynamic_srcset_active === '1') { 2315 UNCODE.adaptive_srcset(isotopeContainer); 2316 } 2317 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2318 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 2319 if (typeof getLightbox === 'object') { 2320 getLightbox.refresh(); 2321 } else { 2322 UNCODE.lightbox(); 2323 } 2324 } 2325 } 2326 isotopeContainer.trigger('more-items-loaded'); 2327 }, 300); 2328 $('.pagination', isotopeFooter).remove(); 2329 isotopeFooter.append($resultPagination); 2330 2331 if (isotopeResultCount.length > 0) { 2332 $('.woocommerce-result-count', isotopeResultCount).remove(); 2333 isotopeResultCount.append($resultCount); 2334 } 2335 }); 2336 }; 2337 $filters.each(function(i, buttonGroup) { 2338 var $buttonGroup = $(buttonGroup); 2339 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 2340 $buttonGroup.find('.active').removeClass('active'); 2341 $(this).addClass('active'); 2342 2343 }); 2344 2345 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 2346 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 2347 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 2348 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 2349 e.preventDefault(); 2350 $cats_filters.slideToggle(400, 'easeInOutCirc'); 2351 }); 2352 2353 }); 2354 window.addEventListener('boxResized', function(e) { 2355 if (UNCODE.printDialogOpen !== false) { 2356 return false;
2357 } 2358 $.each($('.isotope-layout'), function(index, val) { 2359 var $layoutMode = ($(this).data('layout')); 2360 if ($layoutMode === undefined) $layoutMode = 'masonry'; 2361 if ($(this).data('isotope')) { 2362 $(this).isotope({ 2363 itemSelector: $itemSelector, 2364 layoutMode: $layoutMode, 2365 transitionDuration: transitionDuration[index], 2366 masonry: { 2367 columnWidth: colWidth(index) 2368 }, 2369 vertical: { 2370 horizontalAlignment: 0.5, 2371 }, 2372 sortBy: 'original-order', 2373 isOriginLeft: isOriginLeft 2374 }); 2375 $(this).isotope('unbindResize'); 2376 if (SiteParameters.dynamic_srcset_active === '1') { 2377 UNCODE.refresh_dynamic_srcset_size($(this)); 2378 } 2379 } 2380 $(this).find('.mejs-video,.mejs-audio').each(function() { 2381 $(this).trigger('resize'); 2382 }); 2383 }); 2384 }, false); 2385 2386 init_isotope(); 2387 }; 2388} 2389 2390UNCODE.lightbox = function() { 2391 if ( SiteParameters.lbox_enhanced ) { 2392 return true; 2393 } 2394 UNCODE.lightboxArray = {}; 2395 requestTimeout(function() { 2396 var groupsArr = {}; 2397 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 2398 var group = this.getAttribute("data-lbox"), 2399 values = $(this).data(); 2400 $(this).attr('data-lbox-init','true') 2401 groupsArr[group] = values; 2402 }); 2403 for (var i in groupsArr) { 2404 var skin = groupsArr[i].skin || 'black', 2405 path = groupsArr[i].dir || 'horizontal', 2406 thumbs = !groupsArr[i].notmb || false, 2407 arrows = !groupsArr[i].noarr || false, 2408 social = groupsArr[i].social || false, 2409 deeplink = groupsArr[i].deep || false, 2410 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 2411 counter = $els.length, 2412 dataAlbum = $els.attr('data-album'); 2413 if (social) social = { 2414 facebook: true, 2415 twitter: true, 2416 reddit: true, 2417 digg: true 2418 }; 2419 UNCODE.lightboxArray[i] = $els.iLightBox({ 2420 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 2421 skin: skin, 2422 path: path, 2423 linkId: deeplink, 2424 infinite: false, 2425 //fullViewPort: 'fit', 2426 smartRecognition: false, 2427 fullAlone: true, 2428 maxScale: 1, 2429 minScale: .02, 2430 //fullStretchTypes: 'flash, video', 2431 overlay: { 2432 opacity: .94 2433 }, 2434 controls: { 2435 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 2436 fullscreen: true, 2437 thumbnail: thumbs, 2438 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 2439 }, 2440 show: { 2441 speed: 200 2442 }, 2443 hide: { 2444 speed: 200 2445 }, 2446 social: { 2447 start: false, 2448 buttons: social 2449 }, 2450 caption: { 2451 start: false 2452 }, 2453 styles: { 2454 nextOpacity: 1, 2455 nextScale: 1, 2456 prevOpacity: 1, 2457 prevScale: 1 2458 }, 2459 effects: { 2460 switchSpeed: 400 2461 }, 2462 slideshow: { 2463 pauseTime: 5000 2464 }, 2465 thumbnails: { 2466 maxWidth: 60, 2467 maxHeight: 60, 2468 activeOpacity: .2 2469 }, 2470 html5video: { 2471 preload: true 2472 }, 2473 callback: { 2474 onOpen: function(){ 2475 $(window).trigger('uncode-custom-cursor'); 2476 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2477 iNoBounce.enable(); 2478 } 2479 }, 2480 onHide: function(){ 2481 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2482 iNoBounce.disable() 2483 } 2484 }, 2485 } 2486 }); 2487 2488 $(document).on('infinite-loaded', function(){ 2489 UNCODE.lightboxArray[i].refresh(); 2490 }); 2491 2492 $(window).on('gdprOpen', function(){ 2493 UNCODE.lightboxArray[i].close(); 2494 }); 2495 }; 2496 }, 100); 2497 2498 $(document).on('click', '.lb-disabled', function(e){ 2499 e.preventDefault(); 2500 }); 2501}; 2502 2503UNCODE.lightgallery = function( $el ) { 2504 var createSelectors = function(){ 2505 $('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){ 2506 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 2507 $(this).addClass('lbox-trigger-item'); 2508 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 2509 $(this).addClass('lbox-nested-item'); 2510 } else { 2511 $(this).removeClass('lbox-trigger-item'); 2512 $(this).removeClass('lbox-nested-item'); 2513 } 2514 }); 2515 }; 2516 2517 createSelectors(); 2518 2519 var galleries = [], 2520 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 2521 return !$(this).closest('.nested-carousel').length; 2522 }), 2523 $_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'), 2524 $galleries = $_galleries.filter(function( index ) { 2525 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 2526 }), 2527 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 2528 2529 if ( typeof $el === 'undefined' ) { 2530 $el = $galleries.add( $nested ); 2531 } 2532 2533 var $disabled = $('a.lb-disabled'); 2534 $disabled.on('click', function(e){ 2535 e.preventDefault(); 2536 }); 2537 2538 var beforeSlide = function(event) { 2539 var detail = event.detail, 2540 info = detail.info, 2541 item = detail.item, 2542 $slide = $(detail.currentSlide.selector), 2543 $video = $('video', $slide), 2544 $previous = $(detail.previousSlide.selector), 2545 $prevVideo = $('video', $previous), 2546 isAudio = false;
2547 2548 if ( typeof info.src !== 'undefined' ) { 2549 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 2550 } 2551 2552 if ( ! $video.length && ( info.video || isAudio ) ) { 2553 if ( info.video ) { 2554 if ( typeof info.video === 'object' ) { 2555 var infoJson = info.video; 2556 } else { 2557 var infoJson = JSON.parse(info.video); 2558 } 2559 var src = infoJson.source[0].src, 2560 autoplay = $(item).attr('data-autoplay'), 2561 loop = $(item).attr('data-loop'); 2562 2563 } else if ( isAudio ) { 2564 var src = info.src, 2565 autoplay = true, 2566 loop = false; 2567 } 2568 if ( typeof src !== 'undefined' ) { 2569 $slide.addClass('has-html5'); 2570 var video = document.createElement('video'); 2571 video.src = src; 2572 video.preload = 'auto'; 2573 video.controls = 'controls'; 2574 video.controlsList = 'nodownload'; 2575 if ( autoplay ) { 2576 video.autoplay = 'autoplay'; 2577 } 2578 if ( loop ) { 2579 video.loop = 'loop'; 2580 } 2581 $(video).appendTo($slide); 2582 } 2583 } else { 2584 var $video = $('video', $slide); 2585 if ( $video.length ) { 2586 $video[0].currentTime = 0; 2587 if ( $video[0].autoplay ) { 2588 $video[0].play(); 2589 } 2590 } 2591 } 2592 if ( $prevVideo.length ) { 2593 $prevVideo[0].currentTime = 0; 2594 $prevVideo[0].pause(); 2595 } 2596 }; 2597 2598 var beforeOpen = function(event) { 2599 var detail = event.detail, 2600 items = detail.items, 2601 galleryItems = detail.galleryItems, 2602 outer = detail.outer.selector, 2603 i, ii; 2604 for ( i = 0; i < galleryItems.length; i++ ) { 2605 var item = galleryItems[i]; 2606 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 2607 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 2608 } 2609 } 2610 for ( ii = 0; ii < items.length; ii++ ) { 2611 var item = items[ii]; 2612 if ( $(item).attr('data-icon') === 'video' ) { 2613 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 2614 } 2615 } 2616 2617 }; 2618 2619 //regular galleries 2620 $el.each( function( index, val ) { 2621 var $gallery = $(this).attr('data-lbox-init','true'), 2622 $_a = '.lbox-trigger-item', 2623 $_nested_a = '.lbox-nested-item', 2624 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 2625 galleryID = $_first.attr('data-lbox'), 2626 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 2627 tmb = $_first.attr('data-notmb'), 2628 social = $_first.attr('data-social'), 2629 deep = $_first.attr('data-deep'), 2630 zoom = $_first.attr('data-zoom-origin'), 2631 actual = $_first.attr('data-actual-size'), 2632 download = $_first.attr('data-download'), 2633 controls = $_first.attr('data-arrows') !== 'no', 2634 fullScreen = $_first.attr('data-full'),
2635 counter = $_first.attr('data-counter'), 2636 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 2637 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 2638 connect = $_first.attr('data-connect'), 2639 $currentVideo = false, 2640 lgPlugins = [lgVideo], 2641 itemsLoadedTimeOut; 2642 2643 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 2644 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 2645 2646 if ( typeof tmb == 'undefined' || !tmb ) { 2647 lgPlugins.push(lgThumbnail); 2648 } 2649 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 2650 lgPlugins.push(lgZoom); 2651 } 2652 if ( typeof deep != 'undefined' && deep != '' ) { 2653 lgPlugins.push(lgHash); 2654 } 2655 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 2656 lgPlugins.push(lgFullscreen); 2657 } 2658 if ( social ) { 2659 lgPlugins.push(lgShare); 2660 } 2661 2662 if ( galleries.indexOf( galleryID ) !== -1 ) { 2663 return true; 2664 } 2665 2666 $gallery.find($_a, $_nested_a).each(function(){ 2667 var $a = $(this), 2668 $img = $('img', $a).first(), 2669 imgw = $img.attr('data-width'), 2670 imgh = $img.attr('data-height'), 2671 caption = $a.attr('data-caption'), 2672 title = $a.attr('data-title'); 2673 2674 if ( $img.length && $img.attr('data-crop') != true ) { 2675 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 2676 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 2677 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 2678 $a.attr('data-external-thumb-image', $img[0].src); 2679 } 2680 } 2681 2682 if ( typeof title !== 'undefined' && title !== '' ) { 2683 title = '<h6>' + title + '</h6>'; 2684 } else { 2685 title = ''; 2686 } 2687 2688 if ( typeof caption !== 'undefined' && caption !== '' ) { 2689 caption = '<p>' + caption + '</p>'; 2690 title += caption; 2691 } 2692 2693 if ( title !== '' ) { 2694 $a.attr( 'title', title ); 2695 } 2696 2697 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') ) ) { 2698 $a.attr('data-lg-size', imgw + '-' + imgh); 2699 } 2700 }); 2701 2702 galleries.push( galleryID ); 2703 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 2704 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 2705 var gallery = lightGallery( $triggerGal[0], { 2706 addClass: containerClass, 2707 plugins: lgPlugins, 2708 mode: transition, 2709 selector: $selector, 2710 galleryId: galleryID, 2711 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 2712 iframeWidth: '848px', 2713 iframeMaxWidth: '90%', 2714 iframeMaxHeight: '90%', 2715 exThumbImage: 'data-external-thumb-image', 2716 loadYouTubeThumbnail: false, 2717 // autoplayFirstVideo: false, 2718 pager: false, 2719 startClass: 'lg-start-opacity', 2720 zoomFromOrigin: zoom, 2721 controls: controls, 2722 download: ( typeof download != 'undefined' && download != '' ), 2723 thumbWidth: 50, 2724 thumbHeight: '50px', 2725 counter: $triggerGal.find($selector).length > 1 ? counter : false, 2726 loadYouTubePoster: false, 2727 enableDrag: $triggerGal.find($selector).length > 1 2728 }); 2729 2730 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 2731 e.preventDefault(); 2732 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 2733 gallery.openGallery(index-1); 2734 }); 2735 2736 $triggerGal.on('more-items-loaded', function(e, items) { 2737 clearRequestTimeout(itemsLoadedTimeOut); 2738 itemsLoadedTimeOut = requestTimeout(function(){ 2739 createSelectors(); 2740 gallery.refresh(); 2741 }, 100); 2742 }); 2743 2744 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2745 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 2746 $el = model.view.$el; 2747 if ( $el.find($triggerGal).length ) { 2748 gallery.destroy(); 2749 } 2750 }); 2751 } 2752 2753 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 2754 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 2755 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 2756 $(window).trigger('uncode-custom-cursor'); 2757 }); 2758 2759 }); 2760 2761 if ( typeof $el !== 'undefined' ) { 2762 2763 //album galleries 2764 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 2765 var album = val, 2766 galleryID = index, 2767 $album = $(album), 2768 params = $album.attr('data-album'), 2769 tmb = $(val).attr('data-notmb'), 2770 social = $(val).attr('data-social'), 2771 deep = $(val).attr('data-deep'), 2772 zoom = $(val).attr('data-zoom-origin'), 2773 actual = $(val).attr('data-actual-size'), 2774 download = $(val).attr('data-download'), 2775 controls = $(val).attr('data-arrows') !== 'no', 2776 fullScreen = $(val).attr('data-full'), 2777 counter = $(val).attr('data-counter'), 2778 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 2779 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 2780 $currentVideo = false, 2781 lgPlugins = [lgVideo]; 2782 2783 $(val).attr('data-lbox-init','true'); 2784 2785 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
2786 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 2787 2788 if ( typeof tmb == 'undefined' || !tmb ) { 2789 lgPlugins.push(lgThumbnail); 2790 } 2791 if ( typeof actual != 'undefined' && actual != '' ) { 2792 lgPlugins.push(lgZoom); 2793 } 2794 if ( typeof deep != 'undefined' && deep != '' ) { 2795 lgPlugins.push(lgHash); 2796 } 2797 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 2798 lgPlugins.push(lgFullscreen); 2799 } 2800 if ( social ) { 2801 lgPlugins.push(lgShare); 2802 } 2803 2804 var gallery = window.lightGallery(album, { 2805 dynamic: true, 2806 plugins: lgPlugins, 2807 dynamicEl: JSON.parse(params), 2808 galleryId: galleryID, 2809 addClass: containerClass, 2810 mode: transition, 2811 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 2812 iframeWidth: '848px', 2813 iframeMaxWidth: '90%', 2814 iframeMaxHeight: '90%', 2815 loadYouTubeThumbnail: false, 2816 // autoplayFirstVideo: false, 2817 pager: false, 2818 startClass: 'lg-start-opacity', 2819 zoomFromOrigin: false, 2820 controls: controls, 2821 download: ( typeof download != 'undefined' && download != '' ), 2822 thumbWidth: 50, 2823 thumbHeight: '50px', 2824 loadYouTubePoster: false, 2825 counter: counter 2826 }); 2827 2828 $album.on('click', function(){ 2829 gallery.openGallery(0); 2830 }); 2831 2832 album.addEventListener('lgBeforeSlide', beforeSlide); 2833 album.addEventListener('lgBeforeOpen', beforeOpen); 2834 album.addEventListener('lgAfterOpen', function(){ 2835 $(window).trigger('uncode-custom-cursor'); 2836 }); 2837 2838 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2839 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 2840 $el = model.view.$el; 2841 if ( $el.find($album).length ) { 2842 gallery.destroy(); 2843 } 2844 }); 2845 } 2846 2847 }); 2848 2849 //single images 2850 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 2851 var gallery = lightGallery( $('.page-wrapper')[0], { 2852 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 2853 iframeWidth: '848px', 2854 iframeMaxWidth: '90%', 2855 iframeMaxHeight: '90%', 2856 loadYouTubeThumbnail: false, 2857 // autoplayFirstVideo: false, 2858 startClass: 'lg-start-opacity', 2859 thumbWidth: 50, 2860 thumbHeight: '50px', 2861 download: false, 2862 loadYouTubePoster: false, 2863 counter: false 2864 }); 2865 2866 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 2867 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 2868 }); 2869 } 2870}; 2871 2872UNCODE.carousel = function(container) { 2873 var $owlContainers = $('.owl-carousel-container', container); 2874 $owlContainers.each(function() { 2875 var $owlContainer = $(this), 2876 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 2877 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 2878 values = {}, 2879 tempTimeStamp, 2880 currentIndex, 2881 $owlInsideEqual = []; 2882 $owlSelector.each(function() { 2883 var itemID = $(this).attr('id'), 2884 $elSelector = $(('#' + itemID).toString()); 2885 values['id'] = itemID; 2886 values['items'] = 1;
2887 values['columns'] = 3; 2888 values['fade'] = false; 2889 values['nav'] = false; 2890 values['navmobile'] = false; 2891 values['navskin'] = 'light'; 2892 values['navspeed'] = 400; 2893 values['dots'] = false; 2894 values['dotsmobile'] = false; 2895 values['loop'] = false; 2896 values['autoplay'] = false; 2897 values['timeout'] = 3000; 2898 values['autoheight'] = false; 2899 values['stagepadding'] = 0; 2900 values['margin'] = 0; 2901 values['lg'] = 1; 2902 values['md'] = 1; 2903 values['sm'] = 1; 2904 $.each($(this).data(), function(i, v) { 2905 values[i] = v; 2906 }); 2907 2908 if ($(this).closest('.uncode-slider').length) { 2909 values['navskin'] = ''; 2910 values['navmobile'] = false; 2911 //values['dotsmobile'] = true; 2912 } else { 2913 values['navskin'] = ' style-'+values['navskin']+' style-override'; 2914 } 2915 2916 var setIndexActive = function(event, init){ 2917 var init = typeof init === 'undefined' ? false : init, 2918 thiis = $(event.currentTarget); 2919 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 2920 var scrolltop = $(document).scrollTop(), 2921 size = event.page.size, 2922 i; 2923 var setIndex = requestTimeout(function() { 2924 for ( i = 0; i < size; i++ ) { 2925 var itemCont = event.item.index != null ? (event.item.index + i) : i; 2926 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 2927 if (thiis.closest('.row-slider').length) { 2928 if (currentItem == undefined) { 2929 currentItem = thiis.children()[i]; 2930 } 2931 if ($(currentItem).closest('#page-header').length) { 2932 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 2933 UNCODE.switchColorsMenu(scrolltop, 'dark'); 2934 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 2935 UNCODE.switchColorsMenu(scrolltop, 'light'); 2936 } 2937 } 2938 } 2939 var itendIndex = $(currentItem).attr('data-index'); 2940 if ( isNaN(itendIndex) ) { 2941 itendIndex = 1; 2942 } 2943 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 2944 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 2945 if ($.fn.counterUp) { 2946 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .counter').each(function(){ 2947 var $counter = $(this); 2948 $counter.addClass('started').counterUp({ 2949 delay: 10, 2950 time: 1500 2951 }); 2952 }); 2953 } 2954 } 2955 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 2956 }, 200); 2957 } 2958 tempTimeStamp = event.timeStamp; 2959 } 2960 2961 /** Initialized */ 2962 $elSelector.on('initialized.owl.carousel', function(event) { 2963 2964 if ( $('.isotope-container', event.currentTarget).length ) { 2965 window.dispatchEvent(UNCODE.boxEvent); 2966 } 2967 2968 $('.owl-dot.active', $elSelector).on('click', function(){ 2969 return false; 2970 }); 2971 2972 var thiis = $(event.currentTarget), 2973 // get the time from the data method 2974 time = thiis.data("timer-id"), 2975 rowParent = thiis.closest('.row-parent'); 2976 2977 if ( typeof rowParent[0] !== 'undefined' ) { 2978 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 2979 } 2980 2981 if (time) { 2982 clearRequestTimeout(time); 2983 } 2984 2985 thiis.addClass('showControls'); 2986 var new_time = requestTimeout(function() { 2987 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 2988 if (thiis.hasClass('owl-height-viewport')) 2989 setItemsRelHeight(thiis); 2990 if (thiis.hasClass('owl-height-equal')) 2991 setItemsHeight(thiis); 2992 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 2993 if (thiis.closest('.unequal, .unexpand').length) { 2994 UNCODE.setRowHeight(rowParent[0], true); 2995 } 2996 if (SiteParameters.dynamic_srcset_active === '1') { 2997 UNCODE.refresh_dynamic_srcset_size(thiis); 2998 } 2999 }, 350); 3000 // save the new time 3001 thiis.data("timer-id", new_time); 3002 3003 var scrolltop = $(document).scrollTop(); 3004 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 3005 3006 //if (!UNCODE.isMobile) { 3007 /** fix autoplay when visible **/ 3008 $(window).on('load', function(){ 3009 if (thiis.data('autoplay')) { 3010 if ( !thiis.closest('.sticky-element').length ) { 3011 thiis.trigger('stop.autoplay.owl'); 3012 } else { 3013 thiis.trigger('play.owl.autoplay'); 3014 } 3015 } 3016 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 3017 return; 3018 } 3019 if ( ! thiis.closest('.sticky-element').length ) { 3020 var carouselInView = new Waypoint.Inview({ 3021 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3022 element: thiis[0], 3023 exited: function() { 3024 var el = $(this.element); 3025 if (el.data('autoplay') ) { 3026 el.trigger('stop.owl.autoplay'); 3027 el.data('stopped','true'); 3028 } 3029 }, 3030 enter: function(direction) { 3031 var el = $(this.element); 3032 requestTimeout(function() { 3033 if (el.data('autoplay')) { 3034 el.trigger('play.owl.autoplay'); 3035 el.data('stopped','false'); 3036 } 3037 }, 100); 3038 } 3039 }); 3040 } 3041 }); 3042 //} 3043 3044 // $(window).on('frontend:carousel_updated', function(){ 3045 // Waypoint.refreshAll(); 3046 // }); 3047 3048 if (!thiis.closest('.isotope-system').length) { 3049 requestTimeout(function() { 3050 animate_thumb($('.t-inside', el), event); 3051 }, 400); 3052 } else { 3053 requestTimeout(function() { 3054 thiis.closest('.isotope-container').isotope('layout'); 3055 }, 400); 3056 } 3057 3058 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3059 currentIndex = $(currentItem).attr('data-index'); 3060 3061 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3062 if ($(val).closest('.uncode-slider').length) { 3063 $(val).removeClass('start_animation'); 3064 } 3065 }); 3066 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3067 if ($(val).closest('.uncode-slider').length) { 3068 $(val).removeClass('already-animated'); 3069 } 3070 }); 3071 3072 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3073 if ($(val).closest('.uncode-slider').length) { 3074 $(val).removeAttr('data-animated'); 3075 } 3076 }); 3077 3078 $.each($('.owl-item.cloned', thiis), function(index, val) {
3079 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 3080 }); 3081 3082 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3083 if ($(val).attr('data-index') != currentIndex) { 3084 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3085 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3086 } 3087 if ($(val).attr('data-index') != currentIndex) { 3088 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 3089 } 3090 if ($(val).attr('data-index') == currentIndex) { 3091 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3092 } 3093 }); 3094 3095 if (thiis.closest('.uncode-slider').length) { 3096 var el = thiis.closest('.row-parent')[0]; 3097 if ($(el).data('imgready')) { 3098 firstLoaded(el, event); 3099 } else { 3100 el.addEventListener("imgLoaded", function(el) { 3101 firstLoaded(el.target, event); 3102 }, false); 3103 } 3104 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 3105 if (transHeight != null) { 3106 requestTimeout(function() { 3107 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 3108 }, 100); 3109 } 3110 } else { 3111 var el = thiis; 3112 el.closest('.uncode-slider').addClass('slider-loaded'); 3113 } 3114 3115 requestTimeout(function() { 3116 if (typeof UNCODE.bigText !== 'undefined') { 3117 UNCODE.bigText(thiis); 3118 } 3119 if (thiis.closest('.uncode-slider').length) { 3120 if (thiis.data('autoplay')) pauseOnHover(thiis); 3121 } 3122 }, 500); 3123 3124 if (thiis.closest('.unequal').length) { 3125 $owlInsideEqual.push(thiis.closest('.row-parent')); 3126 } 3127 3128 var containerClasses = '', 3129 containerStyle = ''; 3130 if ( $('.owl-dots-classes', $owlContainer).length ) { 3131 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 3132 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 3133 $('.owl-dots-classes', $owlContainer).remove(); 3134 } 3135 3136 if ( containerClasses !== '' ) { 3137 requestTimeout(function() { 3138 if ( containerClasses !== '' ) 3139 $('.owl-dots', $owlContainer).attr('style', containerStyle); 3140 if ( containerStyle !== '' ) 3141 $('.owl-dots', $owlContainer).addClass(containerClasses); 3142 }, 100); 3143 } 3144 3145 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 3146 $(val).closest('.row-inner').css({ 3147 'margin-top': '-1px' 3148 }); 3149 }); 3150 3151 if ($.fn.isotope) { 3152 if ( thiis.closest('.isotope-container').length ) { 3153 if (thiis.closest('.isotope-container').data('isotope')) { 3154 requestTimeout(function(){ 3155 thiis.closest('.isotope-container').isotope('layout'); 3156 }, 300); 3157 } 3158 $(window).on('load', function(){ 3159 if (thiis.closest('.isotope-container').data('isotope')) { 3160 thiis.closest('.isotope-container').isotope('layout'); 3161 } 3162 }); 3163 } 3164 } 3165 3166 if (thiis.data('autoplay')) { 3167 $(window).on('menuOpen', function(){ 3168 thiis.trigger('stop.owl.autoplay'); 3169 thiis.data('stopped','true'); 3170 }).on('menuClose', function(){ 3171 3172 }); 3173 } 3174 $(window).on('menuClose', function(){ 3175 if (thiis.data('autoplay')) { 3176 thiis.trigger('play.owl.autoplay'); 3177 thiis.data('stopped','false'); 3178 } 3179 }); 3180 3181 setIndexActive(event, true); 3182 3183 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3184 return !$(this).closest('.nested-carousel').length; 3185 }), 3186 $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); 3187 3188 3189 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 3190 UNCODE.lightgallery( $galleries ); 3191 } 3192 3193 3194 }); 3195 3196 $elSelector.on('resized.owl.carousel', function(event) { 3197 var thiis = $(event.currentTarget); 3198 // if ($(this).closest('.nested-carousel').length) { 3199 // requestTimeout(function() { 3200 // window.dispatchEvent(UNCODE.boxEvent); 3201 // }, 200); 3202 // } 3203 if ( thiis.hasClass('owl-height-equal') ) 3204 setItemsHeight(thiis); 3205 3206 setItemsRelHeight($elSelector); 3207 3208 setIndexActive(event); 3209
3210 if (SiteParameters.dynamic_srcset_active === '1') { 3211 UNCODE.refresh_dynamic_srcset_size(thiis); 3212 } 3213 3214 if ($.fn.isotope) { 3215 $(window).on('load', function(){ 3216 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 3217 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 3218 } 3219 }); 3220 } 3221 }); 3222 3223 /** detect resize window for fluid height layout */ 3224 var setFluidResize; 3225 function manageFluidCarouseHeight() { 3226 clearRequestTimeout(setFluidResize); 3227 setFluidResize = requestTimeout(function(){ 3228 setItemsRelHeight($elSelector); 3229 }, 100); 3230 } 3231 window.addEventListener('resize', manageFluidCarouseHeight); 3232 3233 /** Change */ 3234 $elSelector.on('change.owl.carousel', function(event) { 3235 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 3236 }); 3237 3238 /** Changed */ 3239 $elSelector.on('changed.owl.carousel', function(event) { 3240 var $row = $elSelector.parents('.row')[0]; 3241 if ( typeof $row !== 'undefined' ) { 3242 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 3243 } 3244 setIndexActive(event); 3245 }); 3246 3247 var checkDrag = function(e) { 3248 $elSelector.addClass('owl-dragging'); 3249 }; 3250 $elSelector.on('drag.owl.carousel', function(event) { 3251 document.addEventListener("mousemove", checkDrag); 3252 }); 3253 3254 $elSelector.on('dragged.owl.carousel', function(event) { 3255 $elSelector.removeClass('owl-dragging'); 3256 document.removeEventListener("mousemove", checkDrag); 3257 }); 3258 3259 $elSelector.on('translate.owl.carousel', function(event) { 3260 if (UNCODE.isMobile) { 3261 $(event.currentTarget).addClass('owl-translating'); 3262 } 3263 }); 3264 3265 /** Translated */ 3266 $elSelector.on('translated.owl.carousel', function(event) { 3267 3268 var thiis = $(event.currentTarget), 3269 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3270 currentIndex = $(currentItem).attr('data-index'), 3271 stagePadding = thiis.data('stagepadding'); 3272 3273 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3274 3275 if (!UNCODE.isMobile) { 3276 UNCODE.owlPlayVideo(thiis); 3277 } 3278 3279 requestTimeout(function(){ 3280 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 3281 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 3282 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 3283 if (lastDelayElems == undefined) lastDelayElems = 0; 3284 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3285 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3286 thiis.trigger('stop.owl.autoplay'); 3287 requestTimeout(function() { 3288 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 3289 }, maxDelay); 3290 } 3291 }, 200); 3292 3293 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3294 if ($(val).closest('.uncode-slider').length) { 3295 $(val).removeClass('start_animation'); 3296 } 3297 }); 3298 3299 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3300 if ($(val).closest('.uncode-slider').length) { 3301 $(val).removeClass('already-animated'); 3302 } 3303 }); 3304 3305 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3306 if ($(val).closest('.uncode-slider').length) { 3307 $(val).removeAttr('data-animated'); 3308 } 3309 }); 3310 3311 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3312 if ($(val).attr('data-index') != currentIndex) { 3313 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3314 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3315 } 3316 if ($(val).attr('data-index') != currentIndex) { 3317 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 3318 } 3319 if ($(val).attr('data-index') == currentIndex) { 3320 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3321 } 3322 }); 3323 3324 if (UNCODE.isMobile) { 3325 thiis.removeClass('owl-translating'); 3326 } 3327 3328 setIndexActive(event); 3329 }); 3330 3331 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 3332 3333 /** Init carousel */ 3334 $elSelector.not('.showControls').owlCarousel({ 3335 items: values['items'], 3336 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 3337 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 3338 nav: values['nav'], 3339 dots: values['dots'], 3340 loop: values['loop'], 3341 stagePadding: values['stagepadding'], 3342 margin: 0, 3343 video: true, 3344 autoWidth: false, 3345 autoplay: false, 3346 autoplayTimeout: values['timeout'], 3347 autoplaySpeed: values['navspeed'], 3348 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 3349 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 3350 rtl: $('body').hasClass('rtl') ? true : false, 3351 fluidSpeed: true, 3352 navSpeed: values['navspeed'], 3353 dotsSpeed: values['navspeed'] / values['items'], 3354 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 3355 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>'], 3356 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 3357 responsiveClass: true, 3358 responsiveBaseElement: '.box-container', 3359 responsive: { 3360 0: { 3361 items: values['sm'], 3362 nav: values['navmobile'], 3363 dots: values['dotsmobile'], 3364 dotsSpeed: values['navspeed'] / values['sm'], 3365 }, 3366 480: { 3367 items: values['sm'], 3368 nav: values['navmobile'], 3369 dots: values['dotsmobile'], 3370 dotsSpeed: values['navspeed'] / values['sm'], 3371 }, 3372 570: { 3373 items: values['md'], 3374 nav: values['navmobile'], 3375 dots: values['dotsmobile'], 3376 dotsSpeed: values['navspeed'] / values['md'], 3377 }, 3378 960: { 3379 items: values['lg'], 3380 dotsSpeed: values['navspeed'] / values['lg'], 3381 } 3382 } 3383 }); 3384 3385 var transDuration = parseFloat(values['navspeed']) * 0.3; 3386 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 3387 3388 $('.owl-item .tmb', $elSelector).css({ 3389 '-webkit-transition-delay': transDuration + 'ms', 3390 '-moz-transition-delay': transDuration + 'ms', 3391 '-o-transition-delay': transDuration + 'ms', 3392 'transition-delay': transDuration + 'ms', 3393 '-webkit-transition-duration': transDuration2 + 'ms', 3394 '-moz-transition-duration': transDuration2 + 'ms', 3395 '-o-transition-duration': transDuration2 + 'ms', 3396 'transition-duration': transDuration2 + 'ms', 3397 }); 3398 3399 requestTimeout(function() { 3400 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 3401 UNCODE.setRowHeight($owlInsideEqual[i]); 3402 }; 3403 }, 300); 3404 3405 $(window).on('load', function(){ 3406 var $elCarousel = $elSelector.data('owl.carousel'); 3407 if ( typeof $elCarousel !== 'undefined' ) { 3408 $elCarousel.trigger('refreshed'); 3409 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 3410 UNCODE.setRowHeight($owlInsideEqual[i]); 3411 }; 3412 } 3413 }); 3414 3415 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 3416 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 3417 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 3418 $('#' + carousel_id).find('.owl-item').each( function() { 3419 var $item = $(this), 3420 index = ( $item.index() + 1 ); 3421 $item.attr('data-index', index); 3422 }); 3423 } 3424 }); 3425 3426 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3427 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 3428 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 3429 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 3430 $('#' + carousel_id).find('.owl-item').each( function() { 3431 var $item = $(this), 3432 index = ( $item.index() + 1 ); 3433 $item.attr('data-index', index); 3434 }); 3435 } 3436 }); 3437 } 3438 3439 }); 3440 3441 function firstLoaded(el, event) { 3442 var el = $(el), 3443 uncode_slider = el.find('.uncode-slider'); 3444 el.find('.owl-carousel').css('opacity', 1); 3445 uncode_slider.addClass('slider-loaded'); 3446 if (typeof UNCODE.bigText !== 'undefined') { 3447 UNCODE.bigText(el.find('.owl-item.active')); 3448 } 3449 //if (!UNCODE.isMobile) { 3450 requestTimeout(function() { 3451 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 3452 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 3453 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 3454 if (lastDelayElems == undefined) lastDelayElems = 0; 3455 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3456 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3457 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 3458 requestTimeout(function() { 3459 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 3460 }, maxDelay); 3461 } 3462 }, 500); 3463 3464 //} 3465 } 3466 3467 function navHover(el) { 3468 var $owlCont = el, 3469 $owlPrev = $owlCont.find('.owl-prev'), 3470 $owlNext = $owlCont.find('.owl-next'), 3471 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 3472 $owlPagination = $owlCont.next(), 3473 owlPrevW = $owlPrev.outerWidth(), 3474 owlNextW = $owlNext.outerWidth(), 3475 owlDotsH = $owlDots.innerHeight(), 3476 owlTime = 400, 3477 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3478 if ( $('body').hasClass('rtl') ) { 3479 $owlPrev.css("margin-right", -owlPrevW); 3480 $owlNext.css("margin-left", -owlNextW); 3481 } else { 3482 $owlPrev.css("margin-left", -owlPrevW); 3483 $owlNext.css("margin-right", -owlNextW); 3484 } 3485 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 3486 $owlCont.mouseenter(function() { 3487 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3488 $owlPrev.add($owlNext).css({ 3489 marginLeft: 0, 3490 marginRight: 0 3491 }); 3492 if (!owlNested) { 3493 $owlDots.css({ 3494 opacity: 1, 3495 bottom: 0 3496 }); 3497 } 3498 }).mouseleave(function() { 3499 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 3500 if ( $('body').hasClass('rtl') ) { 3501 $owlPrev.css("margin-right", -owlPrevW); 3502 $owlNext.css("margin-left", -owlNextW); 3503 } else { 3504 $owlPrev.css("margin-left", -owlPrevW); 3505 $owlNext.css("margin-right", -owlNextW); 3506 } 3507 if (!owlNested) { 3508 $owlDots.css({ 3509 opacity: 1, 3510 bottom: -owlDotsH 3511 }); 3512 } 3513 }); 3514 }; 3515 3516 function animate_elems($this) { 3517 var lastDelay; 3518 $.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) { 3519 var element = $(val), 3520 delayAttr = element.attr('data-delay'), 3521 $first_item = element.closest('.owl-item[data-index="1"]'); 3522 3523 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 3524 return false;
3525 } 3526 3527 if (delayAttr == undefined) delayAttr = 0; 3528 requestTimeout(function() { 3529 element.addClass('start_animation'); 3530 }, delayAttr); 3531 lastDelay = delayAttr; 3532 }); 3533 return lastDelay; 3534 } 3535 3536 function animate_thumb(items, event) { 3537 var lastDelay, 3538 itemIndex, 3539 thiis = $(event.currentTarget), 3540 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 3541 numActives = $('.owl-item.active', thiis).length, 3542 stagePadding = thiis.data('stagepadding'); 3543 3544 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3545 3546 thiis.data('tempIndex', event.item.index); 3547 $.each(items, function(index, val) { 3548 var parent = $(val).closest('.owl-item'); 3549 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3550 return; 3551 } 3552 if (!$(val).hasClass('start_animation')) { 3553 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 3554 var thumbInView = new Waypoint.Inview({ 3555 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3556 element: val, 3557 enter: function(direction) { 3558 var element = $(this.element), 3559 delayAttr = parseInt(element.attr('data-delay')), 3560 itemIndex = element.closest('.owl-item').index() + 1, 3561 diffItem = Math.abs(itemIndex - tempIndex) - 1; 3562 if (itemIndex > tempIndex) { 3563 thiis.data('tempIndex', itemIndex); 3564 } 3565 if (isNaN(delayAttr)) delayAttr = 100; 3566 if (stagePadding) { 3567 var objTimeout = requestTimeout(function() { 3568 element.addClass('start_animation'); 3569 }, index * delayAttr); 3570 lastDelay = index * delayAttr; 3571 } else { 3572 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 3573 var objTimeout = requestTimeout(function() { 3574 element.addClass('start_animation'); 3575 }, diffItem * delayAttr); 3576 lastDelay = diffItem * delayAttr; 3577 } 3578 parent.data('objTimeout', objTimeout); 3579 if (!UNCODE.isUnmodalOpen) { 3580 this.destroy(); 3581 } 3582 } 3583 }); 3584 } 3585 } 3586 }); 3587 return lastDelay; 3588 } 3589 3590 function setItemsHeight(item) { 3591 $.each($('.owl-item', item), function(index, val) { 3592 var availableThumbHeight = $('.t-inside', $(val)).height(), 3593 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 3594 difference = availableThumbHeight - innerThumbHeight; 3595 if ($('.tmb-content-under', val).length) { 3596 var visualPart = $('.t-entry-visual', val); 3597 if (visualPart.length) { 3598 difference -= $('.t-entry-visual', val).height(); 3599 } 3600 } 3601 if (! $('.tmb-content-lateral', val).length) 3602 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 3603 }); 3604 } 3605 3606 function setItemsRelHeight(item) { 3607 $.each($('.owl-item', item), function(index, val) { 3608 var $rowContainer = $(item).parents('.row-parent').eq(0), 3609 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 3610 $colContainer = $(item).parents('.uncell').eq(0), 3611 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 3612 winHeight = UNCODE.wheight, 3613 multiplier_h = parseInt($(item).attr('data-vp-height')), 3614 data_viewport_h, 3615 consider_menu = $(item).data('vp-menu'); 3616 3617 if ( consider_menu ) { 3618 winHeight = winHeight - UNCODE.menuHeight; 3619 } 3620 3621 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 3622 $('.t-inside', val).css( 'height', data_viewport_h ); 3623 }); 3624 } 3625 3626 function pauseOnHover(slider) { 3627 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 3628 mouseenter: function () { 3629 $(slider).addClass('owl-mouseenter'); 3630 $(slider).trigger('stop.owl.autoplay'); 3631 }, 3632 mouseleave: function () { 3633 $(slider).removeClass('owl-mouseenter'); 3634 $(slider).trigger('play.owl.autoplay'); 3635 } 3636 }); 3637 } 3638 }); 3639}; 3640 3641UNCODE.owlPlayVideo = function(carousel) { 3642 var player, iframe; 3643 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 3644 var content = $(val).html(); 3645 if (content == '') { 3646 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 3647 $(val).append(getCloned); 3648 } 3649 if ($(this).attr('data-provider') == 'vimeo') { 3650 iframe = $(this).find('iframe'); 3651 player = new Vimeo.Player(iframe[0]); 3652 player.play(); 3653 } else if ($(this).attr('data-provider') == 'youtube') { 3654 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 3655 } else { 3656 var player = $(this).find('video'); 3657 if (player.length) { 3658 $(this).find('video')[0].volume = 0; 3659 $(this).find('video')[0].play(); 3660 $(val).css('opacity', 1); 3661 } 3662 } 3663 }); 3664}; 3665 3666UNCODE.owlStopVideo = function(carousel) { 3667 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 3668 var player, iframe; 3669 if ($(this).attr('data-provider') == 'vimeo') { 3670 iframe = $(this).find('iframe'); 3671 player = new Vimeo.Player(iframe[0]); 3672 player.pause(); 3673 } else if ($(this).attr('data-provider') == 'youtube') { 3674 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 3675 } else { 3676 var player = $(this).find('video'); 3677 if (player.length) { 3678 $(this).find('video')[0].volume = 0; 3679 $(this).find('video')[0].play(); 3680 } 3681 } 3682 }); 3683}; 3684 3685UNCODE.animations = function() { 3686 3687 var runWaypoints_TO, 3688 runWaypoints_carousel_TO, 3689 runWaypoints_delay = 0, 3690 highlightComplexFunc = function($wrap, ev){ 3691 3692 var $lines = $('.heading-line-wrap', $wrap), 3693 not_animate = false;
3694 3695 if ( $wrap.data('animate') === true ) { 3696 not_animate = true; 3697 } 3698 3699 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 3700 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 3701 return; 3702 } 3703 3704 $lines.each(function(_key, _value){ 3705 var $line = $(_value), 3706 $inners = $('.split-word-inner', $line), 3707 $highlights = $('.heading-text-highlight-inner', $line); 3708 3709 var highlitInnerFunc = function(ev){ 3710 var delay = 0; 3711 $highlights.each(function(h_key, high){ 3712 var $highlight = $(high), 3713 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 3714 $nextSplit = $split.nextUntil(), 3715 $next = $('.heading-text-highlight-inner', $nextSplit), 3716 countCh = $split.text().length; 3717 3718 $highlight.css({ 3719 '-webkit-transition-duration': (30 * countCh) + 'ms', 3720 '-moz-transition-duration': (30 * countCh) + 'ms', 3721 '-o-transition-duration': (30 * countCh) + 'ms', 3722 'transition-duration': (30 * countCh) + 'ms', 3723 }); 3724 3725 delay += (30 * countCh); 3726 3727 $next.css({ 3728 '-webkit-transition-delay': delay + 'ms', 3729 '-moz-transition-delay': delay + 'ms', 3730 '-o-transition-delay': delay + 'ms', 3731 'transition-delay': delay + 'ms', 3732 }); 3733 }); 3734 $highlights.removeAttr('data-animated'); 3735 if ( _key+1 === $lines.length ) { 3736 $wrap.data('animate', true); 3737 } 3738 }; 3739 3740 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 3741 if ( not_animate ) { 3742 $highlights.each(function(h_key, high){ 3743 var $highlight = $(high); 3744 $highlight.css({ 3745 '-webkit-transition-duration': '0ms', 3746 '-moz-transition-duration': '0ms', 3747 '-o-transition-duration': '0ms', 3748 'transition-duration': '0ms', 3749 }); 3750 }); 3751 $highlights.removeAttr('data-animated'); 3752 } else { 3753 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 3754 highlitInnerFunc(); 3755 } else { 3756 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 3757 } 3758 } 3759 } 3760 }); 3761 }; 3762 3763 $.each($('.header-content-inner'), function(index, val) { 3764 var element = $(val), 3765 transition = ''; 3766 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 3767 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 3768 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 3769 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 3770 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 3771 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 3772 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 3773 if (transition != '') { 3774 $(val).removeClass(transition); 3775 var container = element, 3776 containerDelay = container.attr('data-delay'), 3777 containerSpeed = container.attr('data-speed'), 3778 items = $('.header-title > *, .post-info', container); 3779 $.each(items, function(index, val) { 3780 var element = $(val), 3781 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 3782 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 3783 if (!element.hasClass('animate_when_almost_visible')) { 3784 delayAttr = Number(delayAttr) + (400 * index); 3785 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 3786 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 3787 } 3788 }); 3789 container.css('opacity', 1); 3790 } 3791 }); 3792 3793 function animate_css_grids_on_load() { 3794 $('.cssgrid-system').each(function() { 3795 var grid = $(this); 3796 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 3797 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 3798 }); 3799 } 3800 3801 window.waypoint_animation = function(ev) { 3802 $.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) { 3803 if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length ) && !SiteParameters.is_frontend_editor ) ) { 3804 return true; 3805 } 3806 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3807 return; 3808 } 3809 var run = true, 3810 $carousel = $(val).closest('.owl-carousel'); 3811 if ( $carousel.length ) { 3812 run = false;
3813 } 3814 if (run) { 3815 new Waypoint({ 3816 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3817 element: val, 3818 handler: function() { 3819 var element = $(this.element), 3820 index = element.index(), 3821 delayAttr = element.attr('data-delay'); 3822 if (delayAttr == undefined) delayAttr = 0; 3823 requestTimeout(function() { 3824 element.addClass('start_animation'); 3825 }, delayAttr); 3826 if (!UNCODE.isUnmodalOpen) { 3827 this.destroy(); 3828 } 3829 }, 3830 offset: UNCODE.isFullPage ? '100%' : '90%' 3831 }); 3832 } 3833 }); 3834 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 3835 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3836 return; 3837 } 3838 var run = true, 3839 $carousel = $(val).closest('.owl-carousel'); 3840 if ( $carousel.length ) { 3841 run = false; 3842 } 3843 if (run) { 3844 new Waypoint({ 3845 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3846 element: val, 3847 handler: function() { 3848 var $element = $(this.element), 3849 $childs = $('.animate_when_parent_almost_visible', $element); 3850 $childs.each(function(key,el){ 3851 var $child = $(el), 3852 delaySpeed = $child.attr('data-speed'), 3853 delayAttr = $child.attr('data-delay'), 3854 intervalAttr = $child.attr('data-interval'); 3855 if (delayAttr == undefined) { 3856 delayAttr = 50*key; 3857 } 3858 requestTimeout(function() { 3859 $child.addClass('start_animation'); 3860 if ( $child.hasClass('anim-line-checker') ) { 3861 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3862 var $line = $child.closest('.heading-line-wrap'); 3863 }); 3864 } 3865 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3866 highlightComplexFunc($wrapText, ev); 3867 if ( $child.hasClass('anim-tot-checker') ) { 3868 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3869 if ( $child.hasClass('anim-tot-checker') ) { 3870 $wrapText.addClass('already-animated'); 3871 $element.trigger('already-animated'); 3872 } 3873 }); 3874 } 3875 }, delayAttr ); 3876 }); 3877 $element.addClass('start_animation'); 3878 if (!UNCODE.isUnmodalOpen) { 3879 this.destroy(); 3880 } 3881 }, 3882 offset: UNCODE.isFullPage ? '100%' : '90%' 3883 }); 3884 } 3885 }); 3886 } 3887 window.waypoint_carousel_animation = function(ev) { 3888 $.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) { 3889 if ( $(val).hasClass('el-text-split') ) { 3890 return true; 3891 } 3892 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3893 return; 3894 } 3895 var run = true, 3896 $carousel = $(val).closest('.owl-carousel'), 3897 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3898 $all_first = $('.owl-item[data-index="1"]', $carousel); 3899 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3900 run = false; 3901 } 3902 if (run) { 3903 new Waypoint({ 3904 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3905 element: val, 3906 handler: function() { 3907 var element = $(this.element), 3908 index = element.index(), 3909 delayAttr = element.attr('data-delay'); 3910 if (delayAttr == undefined) delayAttr = 0; 3911 requestTimeout(function() { 3912 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3913 $all_first.attr('data-already-reached', 'true'); 3914 } 3915 element.addClass('start_animation'); 3916 }, delayAttr); 3917 if (!UNCODE.isUnmodalOpen) { 3918 this.destroy(); 3919 } 3920 }, 3921 offset: UNCODE.isFullPage ? '100%' : '90%' 3922 }); 3923 } 3924 }); 3925 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 3926 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3927 return; 3928 } 3929 var run = true, 3930 $carousel = $(val).closest('.owl-carousel'), 3931 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3932 $all_first = $('.owl-item[data-index="1"]', $carousel); 3933 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3934 run = false;
3935 } 3936 if (run) { 3937 new Waypoint({ 3938 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3939 element: val, 3940 handler: function() { 3941 var $element = $(this.element), 3942 $childs = $('.animate_when_parent_almost_visible', $element); 3943 $childs.each(function(key,el){ 3944 var $child = $(el), 3945 delaySpeed = $child.attr('data-speed'), 3946 delayAttr = $child.attr('data-delay'), 3947 intervalAttr = $child.attr('data-interval'); 3948 if (delayAttr == undefined) { 3949 delayAttr = 50*key; 3950 } 3951 requestTimeout(function() { 3952 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3953 $all_first.attr('data-already-reached', 'true'); 3954 } 3955 $child.addClass('start_animation'); 3956 if ( $child.hasClass('anim-line-checker') ) { 3957 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3958 var $line = $child.closest('.heading-line-wrap'); 3959 }); 3960 } 3961 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3962 highlightComplexFunc($wrapText, ev); 3963 if ( $child.hasClass('anim-tot-checker') ) { 3964 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3965 if ( $child.hasClass('anim-tot-checker') ) { 3966 $wrapText.addClass('already-animated'); 3967 } 3968 }); 3969 } 3970 }, delayAttr ); 3971 }); 3972 $element.addClass('start_animation'); 3973 if (!UNCODE.isUnmodalOpen) { 3974 this.destroy(); 3975 } 3976 }, 3977 offset: UNCODE.isFullPage ? '100%' : '90%' 3978 }); 3979 } 3980 }); 3981 } 3982 3983 var runWaypoints = function(ev){ 3984 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 3985 runWaypoints_delay = 400; 3986 } 3987 clearRequestTimeout(runWaypoints_TO); 3988 runWaypoints_TO = requestTimeout(function() { 3989 window.waypoint_animation(ev); 3990 }, runWaypoints_delay); 3991 3992 clearRequestTimeout(runWaypoints_carousel_TO); 3993 runWaypoints_carousel_TO = requestTimeout(function() { 3994 window.waypoint_carousel_animation(ev); 3995 }, 400); 3996 }; 3997 runWaypoints(); 3998 animate_css_grids_on_load(); 3999 4000 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 4001 runWaypoints(ev); 4002 }); 4003 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4004 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 4005 } 4006}; 4007 4008UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 4009 var $allItems = elements.length - startIndex, 4010 showed = 0, 4011 index = 0, 4012 use_index = false 4013 ; 4014 4015 if (filtering) { 4016 if (sequential) { 4017 use_index = true; 4018 } 4019 sequential = false; 4020 } 4021 4022 $.each(elements, function(index, val) { 4023 var $this = $(val), 4024 elInner = $('> .t-inside', val); 4025 4026 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4027 return; 4028 } 4029 if (val[0]) val = val[0]; 4030 4031 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4032 new Waypoint({ 4033 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4034 element: val, 4035 handler: function() { 4036 var element = $('> .t-inside', this.element), 4037 parent = $(this.element); 4038 var _index = use_index? index : 0; 4039 4040 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 4041 delayAttr = parseInt(element.attr('data-delay')); 4042 if (isNaN(delayAttr)) delayAttr = 100; 4043 if (sequential || use_index) { 4044 delay -= showed; 4045 } 4046 var objTimeout = requestTimeout(function() { 4047 element.removeClass('zoom-reverse').addClass('start_animation'); 4048 showed = index; 4049 }, delay * delayAttr); 4050 parent.data('objTimeout', objTimeout); 4051 if (!UNCODE.isUnmodalOpen) { 4052 this.destroy(); 4053 } 4054 }, 4055 offset: UNCODE.isFullPage ? '100%' : '90%' 4056 }); 4057 } 4058 4059 index++; 4060 }); 4061}; 4062 4063UNCODE.tapHover = function() { 4064 4065 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 4066 elClass = "hover"; 4067 4068 $(window).on('click', function() { 4069 $el.removeClass(elClass); 4070 }); 4071 4072 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 4073 e.stopPropagation(); 4074 var link = $(this); 4075 if ( ! link.hasClass(elClass)) { 4076 e.preventDefault(); 4077 link.addClass("hover"); 4078 $el.not(this).removeClass(elClass); 4079 return false;
4080 } 4081 }); 4082}; 4083 4084UNCODE.onePage = function(isMobile) { 4085 var current = 0, 4086 last = 0, 4087 lastScrollTop = 0, 4088 forceScroll = false, 4089 lastScrolled = 0, 4090 isSectionscroller = ($('.main-onepage').length) ? true : false, 4091 isOnePage = false, 4092 getOffset = function () { 4093 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0); 4094 return calculateOffset; 4095 } 4096 4097 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 4098 // return false; 4099 4100 function init_onepage() { 4101 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 4102 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4103 } 4104 last = $('.onepage-pagination li').last().find('a').data('index'); 4105 $.each($('div[data-parent="true"]'), function(index, val) { 4106 $(this).attr('data-section', index); 4107 if (isMobile) return; 4108 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4109 return; 4110 } 4111 var sectionDown = new Waypoint({ 4112 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4113 element: val, 4114 handler: function(direction) { 4115 if (direction == 'down') { 4116 changeMenuActive(this.element, index); 4117 } 4118 }, 4119 offset: function() { 4120 return 5 + getOffset() 4121 } 4122 }); 4123 var sectionUp = new Waypoint({ 4124 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4125 element: val, 4126 handler: function(direction) { 4127 if (direction == 'up') { 4128 changeMenuActive(this.element, index); 4129 } 4130 }, 4131 offset: function() { 4132 return -5 - getOffset() 4133 } 4134 }); 4135 4136 if (isSectionscroller) { 4137 var label; 4138 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 4139 else label = ''; 4140 var getName = $(this).attr('data-name'); 4141 if (getName == undefined) getName = index; 4142 if (label != '') { 4143 isOnePage = true; 4144 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 4145 $('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>"); 4146 } 4147 } 4148 }); 4149 4150 if (isSectionscroller) { 4151 $.each($('ul.onepage-pagination li'), function(index, val) { 4152 var $this = $(val), 4153 $a = ('a', $this); 4154 $a.on('click', function(evt) { 4155 if ( $('.is-selected', $this).length ) { 4156 return false; 4157 } 4158 if ( $('body').hasClass('uncode-scroll-no-history') ) { 4159 evt.preventDefault(); 4160 } 4161 Waypoint.refreshAll(); 4162 var el = $('a', evt.currentTarget); 4163 current = lastScrolled = parseInt(el.attr('data-index')); 4164 lastScrolled += 1; 4165 scrollBody(current); 4166 }); 4167 }); 4168 } 4169 4170 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 4171 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 4172 goToSection = String(window.location.hash).replace(/^#/, ""); 4173 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 4174 } 4175 4176 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 4177 current = lastScrolled = goToSection; 4178 $(window).on('load', function(){ 4179 if ( $('.owl-carousel').length ) { 4180 requestTimeout(function(){ 4181 scrollBody(goToSection); 4182 }, 400); 4183 } else { 4184 scrollBody(goToSection); 4185 } 4186 }); 4187 } 4188 4189 } 4190 4191 function changeMenuActive(section, index) { 4192 current = lastScrolled = parseInt($(section).attr('data-section')); 4193 if (isOnePage) { 4194 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 4195 if (newSection.length) { 4196 $('ul.onepage-pagination li a').removeClass('is-selected'); 4197 newSection.addClass('is-selected'); 4198 } 4199 var getName = $('[data-section="' + index + '"]').attr('data-name'); 4200 if (getName != undefined && getName !== '') { 4201 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 4202 var get_href = $(val).attr('href'); 4203 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4204 $(val).closest('.menu-smart').find('.active').removeClass('active'); 4205 $(val).parent().addClass('active'); 4206 } 4207 }); 4208 } 4209 } 4210 } 4211 4212 if (isOnePage) { 4213 $(window).on('scroll', function() { 4214 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 4215 if (bodyTop == 0) { 4216 $('ul.onepage-pagination li a').removeClass('is-selected'); 4217 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 4218 var getName = $('[data-section=0]').attr('data-name'); 4219 if (getName != undefined && getName !== '') { 4220 $.each($('.menu-container .menu-item > a'), function(i, val) { 4221 var get_href = $(val).attr('href'); 4222 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4223 $(val).closest('ul').find('.active').removeClass('active'); 4224 $(val).parent().addClass('active'); 4225 } 4226 }); 4227 } 4228 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 4229 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 4230 if (lastSection.length) { 4231 $('ul.onepage-pagination li a').removeClass('is-selected'); 4232 lastSection.addClass('is-selected'); 4233 } 4234 } 4235 }); 4236 } 4237 4238 var scrollBody = function(index) { 4239 $('ul.onepage-pagination li a').removeClass('is-selected'); 4240 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 4241 4242 var getSection = $('[data-section=' + index + ']'), 4243 scrollTo; 4244 4245 if (getSection == undefined) return; 4246 4247 var body = $("html, body"), 4248 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4249 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 4250 getOffset = UNCODE.get_scroll_offset(index); 4251 if ( typeof getSection.offset() === 'undefined' ) 4252 return; 4253 scrollTo = getSection.offset().top; 4254
4255 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 4256 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 4257 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 4258 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 4259 } 4260 4261 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 4262 if ( index === 0 ) { 4263 scrollTo = 0; 4264 } else { 4265 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 4266 } 4267 } else { 4268 scrollTo -= getOffset; 4269 } 4270 } 4271 4272 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4273 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4274 4275 if (index != 0) { 4276 UNCODE.scrolling = true; 4277 } 4278 4279 if (scrollSpeed == 0) { 4280 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4281 UNCODE.scrolling = false; 4282 } else { 4283 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4284 $(this).stop(); 4285 }).animate({ 4286 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4287 }, scrollSpeed, 'easeInOutCubic', function() { 4288 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4289 UNCODE.scrolling = false; 4290 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 4291 if (scrollTo != UNCODE.get_scroll_offset(index)) { 4292 scrollTo = getSection.offset().top; 4293 getOffset = UNCODE.get_scroll_offset(index); 4294 scrollTo -= getOffset; 4295 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4296 $(this).stop(); 4297 }).animate({ 4298 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4299 }, scrollSpeed, 'easeInOutCubic', function() { 4300 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4301 UNCODE.scrolling = false; 4302 } 4303 ); 4304 } 4305 } 4306 }); 4307 } 4308 4309 }; 4310 4311 init_onepage(); 4312}; 4313 4314UNCODE.stickyElements = function() { 4315 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 4316 if (!isMobile_wide) { 4317 4318 var $pageHeader = $('#page-header'), 4319 $headerRow = $('.vc_row', $pageHeader), 4320 startSticky = false; 4321 4322 if ( $headerRow.hasClass('sticky-element') ) { 4323 $headerRow.removeClass('sticky-element'); 4324 $pageHeader.addClass('sticky-element'); 4325 startSticky = true; 4326 } 4327 4328 var calculateOffset = function(el) { 4329 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 4330 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 4331 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0; 4332 4333 sideOffset += UNCODE.bodyBorder; 4334 4335 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 4336 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) { 4337 if ($('.menu-shrink').length) { 4338 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 4339 } else { 4340 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 4341 } 4342 } 4343 4344 return sideOffset; 4345 4346 }, 4347 4348 initStickyElement = function() { 4349 $.each($('.sticky-element'), function(index, element) { 4350 $(element).stick_in_parent({ 4351 sticky_class: 'is_stucked', 4352 offset_top: calculateOffset(element), 4353 bottoming: true, 4354 inner_scrolling: SiteParameters.sticky_elements === 'on' 4355 }); 4356 }); 4357 }; 4358 4359 requestTimeout(function() { 4360 if ($('.sticky-element').length) { 4361 4362 if ($(window).width() > UNCODE.mediaQuery) { 4363 initStickyElement(); 4364
4365 if ( startSticky === true ) { 4366 $('#page-header').trigger('sticky_kit:recalc'); 4367 } 4368 } 4369 4370 $(window).on('resize', function(event) { 4371 if ($(window).width() > UNCODE.mediaQuery) { 4372 initStickyElement(); 4373 } else { 4374 $(".sticky-element").trigger("sticky_kit:detach"); 4375 } 4376 }); 4377 } 4378 }, 1000); 4379 4380 if ($('.sticky-element').length) { 4381 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 4382 requestTimeout(function() { 4383 $(document.body).trigger("sticky_kit:recalc"); 4384 }, 100); 4385 }); 4386 } 4387 4388 var $panels = $('.panel-collapse'); 4389 if ( $panels.length ) { 4390 $panels.each(function(){ 4391 var $panel = $(this); 4392 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 4393 $(document.body).trigger("sticky_kit:recalc"); 4394 }); 4395 }); 4396 } 4397 } 4398}; 4399 4400UNCODE.twentytwenty = function() { 4401 4402 if (!$('.twentytwenty-container').length) return; 4403 4404// DOM.event.move 4405// 4406// 2.0.0 4407// 4408// Stephen Band 4409// 4410// Triggers 'movestart', 'move' and 'moveend' events after 4411// mousemoves following a mousedown cross a distance threshold, 4412// similar to the native 'dragstart', 'drag' and 'dragend' events. 4413// Move events are throttled to animation frames. Move event objects 4414// have the properties: 4415// 4416// pageX: 4417// pageY: Page coordinates of pointer. 4418// startX: 4419// startY: Page coordinates of pointer at movestart. 4420// distX: 4421// distY: Distance the pointer has moved since movestart. 4422// deltaX: 4423// deltaY: Distance the finger has moved since last event. 4424// velocityX: 4425// velocityY: Average velocity over last few events. 4426 4427 4428(function(fn) { 4429 if (typeof define === 'function' && define.amd) { 4430 define([], fn); 4431 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 4432 module.exports = fn; 4433 } else { 4434 fn(); 4435 } 4436})(function(){ 4437 var assign = Object.assign || window.jQuery && jQuery.extend; 4438 4439 // Number of pixels a pressed pointer travels before movestart 4440 // event is fired. 4441 var threshold = 8; 4442 4443 // Shim for requestAnimationFrame, falling back to timer. See: 4444 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 4445 var requestFrame = (function(){ 4446 return ( 4447 window.requestAnimationFrame || 4448 window.webkitRequestAnimationFrame || 4449 window.mozRequestAnimationFrame || 4450 window.oRequestAnimationFrame || 4451 window.msRequestAnimationFrame || 4452 function(fn, element){ 4453 return window.setTimeout(function(){ 4454 fn(); 4455 }, 25); 4456 } 4457 ); 4458 })(); 4459 4460 // Shim for customEvent 4461 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 4462 (function () { 4463 if ( typeof window.CustomEvent === "function" ) return false; 4464 function CustomEvent ( event, params ) { 4465 params = params || { bubbles: false, cancelable: false, detail: undefined }; 4466 var evt = document.createEvent( 'CustomEvent' ); 4467 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 4468 return evt; 4469 } 4470 4471 CustomEvent.prototype = window.Event.prototype; 4472 window.CustomEvent = CustomEvent; 4473 })(); 4474 4475 var ignoreTags = { 4476 textarea: true, 4477 input: true, 4478 select: true, 4479 button: true 4480 }; 4481 4482 var mouseevents = { 4483 move: 'mousemove', 4484 cancel: 'mouseup dragstart', 4485 end: 'mouseup' 4486 }; 4487 4488 var touchevents = { 4489 move: 'touchmove', 4490 cancel: 'touchend', 4491 end: 'touchend' 4492 }; 4493 4494 var rspaces = /\s+/; 4495 4496 4497 // DOM Events 4498 4499 var eventOptions = { bubbles: true, cancelable: true }; 4500 4501 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 4502 4503 function createEvent(type) { 4504 return new CustomEvent(type, eventOptions); 4505 } 4506 4507 function getEvents(node) { 4508 return node[eventsSymbol] || (node[eventsSymbol] = {}); 4509 } 4510 4511 function on(node, types, fn, data, selector) { 4512 types = types.split(rspaces); 4513 4514 var events = getEvents(node); 4515 var i = types.length; 4516 var handlers, type; 4517 4518 function handler(e) { fn(e, data); } 4519 4520 while (i--) { 4521 type = types[i]; 4522 handlers = events[type] || (events[type] = []); 4523 handlers.push([fn, handler]); 4524 node.addEventListener(type, handler); 4525 } 4526 } 4527 4528 function off(node, types, fn, selector) { 4529 types = types.split(rspaces); 4530 4531 var events = getEvents(node); 4532 var i = types.length;
4533 var type, handlers, k; 4534 4535 if (!events) { return; } 4536 4537 while (i--) { 4538 type = types[i]; 4539 handlers = events[type]; 4540 if (!handlers) { continue; } 4541 k = handlers.length; 4542 while (k--) { 4543 if (handlers[k][0] === fn) { 4544 node.removeEventListener(type, handlers[k][1]); 4545 handlers.splice(k, 1); 4546 } 4547 } 4548 } 4549 } 4550 4551 function trigger(node, type, properties) { 4552 // Don't cache events. It prevents you from triggering an event of a 4553 // given type from inside the handler of another event of that type. 4554 var event = createEvent(type); 4555 if (properties) { assign(event, properties); } 4556 node.dispatchEvent(event); 4557 } 4558 4559 4560 // Constructors 4561 4562 function Timer(fn){ 4563 var callback = fn, 4564 active = false, 4565 running = false; 4566 4567 function trigger(time) { 4568 if (active){ 4569 callback(); 4570 requestFrame(trigger); 4571 running = true; 4572 active = false; 4573 } 4574 else { 4575 running = false; 4576 } 4577 } 4578 4579 this.kick = function(fn) { 4580 active = true; 4581 if (!running) { trigger(); } 4582 }; 4583 4584 this.end = function(fn) { 4585 var cb = callback; 4586 4587 if (!fn) { return; } 4588 4589 // If the timer is not running, simply call the end callback. 4590 if (!running) { 4591 fn(); 4592 } 4593 // If the timer is running, and has been kicked lately, then 4594 // queue up the current callback and the end callback, otherwise 4595 // just the end callback. 4596 else { 4597 callback = active ? 4598 function(){ cb(); fn(); } : 4599 fn ; 4600 4601 active = true; 4602 } 4603 }; 4604 } 4605 4606 4607 // Functions 4608 4609 function noop() {} 4610 4611 function preventDefault(e) { 4612 e.preventDefault(); 4613 } 4614 4615 function isIgnoreTag(e) { 4616 return !!ignoreTags[e.target.tagName.toLowerCase()]; 4617 } 4618 4619 function isPrimaryButton(e) { 4620 // Ignore mousedowns on any button other than the left (or primary) 4621 // mouse button, or when a modifier key is pressed. 4622 return (e.which === 1 && !e.ctrlKey && !e.altKey); 4623 } 4624 4625 function identifiedTouch(touchList, id) { 4626 var i, l; 4627 4628 if (touchList.identifiedTouch) { 4629 return touchList.identifiedTouch(id); 4630 } 4631 4632 // touchList.identifiedTouch() does not exist in 4633 // webkit yet… we must do the search ourselves... 4634 4635 i = -1; 4636 l = touchList.length; 4637 4638 while (++i < l) { 4639 if (touchList[i].identifier === id) { 4640 return touchList[i]; 4641 } 4642 } 4643 } 4644 4645 function changedTouch(e, data) { 4646 var touch = identifiedTouch(e.changedTouches, data.identifier); 4647 4648 // This isn't the touch you're looking for. 4649 if (!touch) { return; } 4650 4651 // Chrome Android (at least) includes touches that have not 4652 // changed in e.changedTouches. That's a bit annoying. Check 4653 // that this touch has changed. 4654 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 4655 4656 return touch; 4657 } 4658 4659 4660 // Handlers that decide when the first movestart is triggered 4661 4662 function mousedown(e){ 4663 // Ignore non-primary buttons 4664 if (!isPrimaryButton(e)) { return; } 4665 4666 // Ignore form and interactive elements 4667 if (isIgnoreTag(e)) { return; } 4668 4669 on(document, mouseevents.move, mousemove, e); 4670 on(document, mouseevents.cancel, mouseend, e); 4671 } 4672 4673 function mousemove(e, data){ 4674 checkThreshold(e, data, e, removeMouse); 4675 } 4676 4677 function mouseend(e, data) { 4678 removeMouse(); 4679 } 4680 4681 function removeMouse() { 4682 off(document, mouseevents.move, mousemove); 4683 off(document, mouseevents.cancel, mouseend); 4684 } 4685 4686 function touchstart(e) { 4687 // Don't get in the way of interaction with form elements 4688 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 4689 4690 var touch = e.changedTouches[0]; 4691 4692 // iOS live updates the touch objects whereas Android gives us copies. 4693 // That means we can't trust the touchstart object to stay the same, 4694 // so we must copy the data. This object acts as a template for 4695 // movestart, move and moveend event objects. 4696 var data = { 4697 target: touch.target, 4698 pageX: touch.pageX, 4699 pageY: touch.pageY, 4700 identifier: touch.identifier, 4701 4702 // The only way to make handlers individually unbindable is by 4703 // making them unique. 4704 touchmove: function(e, data) { touchmove(e, data); }, 4705 touchend: function(e, data) { touchend(e, data); } 4706 }; 4707 4708 on(document, touchevents.move, data.touchmove, data); 4709 on(document, touchevents.cancel, data.touchend, data); 4710 } 4711 4712 function touchmove(e, data) { 4713 var touch = changedTouch(e, data); 4714 if (!touch) { return; } 4715 checkThreshold(e, data, touch, removeTouch); 4716 } 4717 4718 function touchend(e, data) { 4719 var touch = identifiedTouch(e.changedTouches, data.identifier); 4720 if (!touch) { return; } 4721 removeTouch(data); 4722 } 4723 4724 function removeTouch(data) { 4725 off(document, touchevents.move, data.touchmove); 4726 off(document, touchevents.cancel, data.touchend); 4727 } 4728 4729 function checkThreshold(e, data, touch, fn) { 4730 var distX = touch.pageX - data.pageX; 4731 var distY = touch.pageY - data.pageY; 4732
4733 // Do nothing if the threshold has not been crossed. 4734 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 4735 4736 triggerStart(e, data, touch, distX, distY, fn); 4737 } 4738 4739 function triggerStart(e, data, touch, distX, distY, fn) { 4740 var touches = e.targetTouches; 4741 var time = e.timeStamp - data.timeStamp; 4742 4743 // Create a movestart object with some special properties that 4744 // are passed only to the movestart handlers. 4745 var template = { 4746 altKey: e.altKey, 4747 ctrlKey: e.ctrlKey, 4748 shiftKey: e.shiftKey, 4749 startX: data.pageX, 4750 startY: data.pageY, 4751 distX: distX, 4752 distY: distY, 4753 deltaX: distX, 4754 deltaY: distY, 4755 pageX: touch.pageX, 4756 pageY: touch.pageY, 4757 velocityX: distX / time, 4758 velocityY: distY / time, 4759 identifier: data.identifier, 4760 targetTouches: touches, 4761 finger: touches ? touches.length : 1, 4762 enableMove: function() { 4763 this.moveEnabled = true; 4764 this.enableMove = noop; 4765 e.preventDefault(); 4766 } 4767 }; 4768 4769 // Trigger the movestart event. 4770 trigger(data.target, 'movestart', template); 4771 4772 // Unbind handlers that tracked the touch or mouse up till now. 4773 fn(data); 4774 } 4775 4776 4777 // Handlers that control what happens following a movestart 4778 4779 function activeMousemove(e, data) { 4780 var timer = data.timer; 4781 4782 data.touch = e; 4783 data.timeStamp = e.timeStamp; 4784 timer.kick(); 4785 } 4786 4787 function activeMouseend(e, data) { 4788 var target = data.target; 4789 var event = data.event; 4790 var timer = data.timer; 4791 4792 removeActiveMouse(); 4793 4794 endEvent(target, event, timer, function() { 4795 // Unbind the click suppressor, waiting until after mouseup 4796 // has been handled. 4797 setTimeout(function(){ 4798 off(target, 'click', preventDefault); 4799 }, 0); 4800 }); 4801 } 4802 4803 function removeActiveMouse() { 4804 off(document, mouseevents.move, activeMousemove); 4805 off(document, mouseevents.end, activeMouseend); 4806 } 4807 4808 function activeTouchmove(e, data) { 4809 var event = data.event; 4810 var timer = data.timer; 4811 var touch = changedTouch(e, event); 4812 4813 if (!touch) { return; } 4814 4815 // Stop the interface from gesturing 4816 e.preventDefault(); 4817 4818 event.targetTouches = e.targetTouches; 4819 data.touch = touch; 4820 data.timeStamp = e.timeStamp; 4821 4822 timer.kick(); 4823 } 4824 4825 function activeTouchend(e, data) { 4826 var target = data.target; 4827 var event = data.event; 4828 var timer = data.timer; 4829 var touch = identifiedTouch(e.changedTouches, event.identifier); 4830 4831 // This isn't the touch you're looking for. 4832 if (!touch) { return; } 4833 4834 removeActiveTouch(data); 4835 endEvent(target, event, timer); 4836 } 4837 4838 function removeActiveTouch(data) { 4839 off(document, touchevents.move, data.activeTouchmove); 4840 off(document, touchevents.end, data.activeTouchend); 4841 } 4842 4843 4844 // Logic for triggering move and moveend events 4845 4846 function updateEvent(event, touch, timeStamp) { 4847 var time = timeStamp - event.timeStamp; 4848 4849 event.distX = touch.pageX - event.startX; 4850 event.distY = touch.pageY - event.startY; 4851 event.deltaX = touch.pageX - event.pageX; 4852 event.deltaY = touch.pageY - event.pageY; 4853 4854 // Average the velocity of the last few events using a decay 4855 // curve to even out spurious jumps in values. 4856 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 4857 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 4858 event.pageX = touch.pageX; 4859 event.pageY = touch.pageY; 4860 } 4861 4862 function endEvent(target, event, timer, fn) { 4863 timer.end(function(){ 4864 trigger(target, 'moveend', event); 4865 return fn && fn(); 4866 }); 4867 } 4868 4869 4870 // Set up the DOM 4871 4872 function movestart(e) { 4873 if (e.defaultPrevented) { return; } 4874 if (!e.moveEnabled) { return; } 4875 4876 var event = { 4877 startX: e.startX, 4878 startY: e.startY, 4879 pageX: e.pageX, 4880 pageY: e.pageY, 4881 distX: e.distX, 4882 distY: e.distY, 4883 deltaX: e.deltaX, 4884 deltaY: e.deltaY, 4885 velocityX: e.velocityX, 4886 velocityY: e.velocityY, 4887 identifier: e.identifier, 4888 targetTouches: e.targetTouches, 4889 finger: e.finger 4890 }; 4891 4892 var data = { 4893 target: e.target, 4894 event: event, 4895 timer: new Timer(update), 4896 touch: undefined, 4897 timeStamp: e.timeStamp 4898 }; 4899 4900 function update(time) { 4901 updateEvent(event, data.touch, data.timeStamp); 4902 trigger(data.target, 'move', event); 4903 } 4904 4905 if (e.identifier === undefined) { 4906 // We're dealing with a mouse event. 4907 // Stop clicks from propagating during a move 4908 on(e.target, 'click', preventDefault); 4909 on(document, mouseevents.move, activeMousemove, data); 4910 on(document, mouseevents.end, activeMouseend, data); 4911 } 4912 else { 4913 // In order to unbind correct handlers they have to be unique 4914 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 4915 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 4916 4917 // We're dealing with a touch. 4918 on(document, touchevents.move, data.activeTouchmove, data); 4919 on(document, touchevents.end, data.activeTouchend, data); 4920 } 4921 } 4922 4923 on(document, 'mousedown', mousedown); 4924 on(document, 'touchstart', touchstart); 4925 on(document, 'movestart', movestart); 4926 4927 4928 // jQuery special events 4929 // 4930 // jQuery event objects are copies of DOM event objects. They need 4931 // a little help copying the move properties across. 4932 4933 if (!window.jQuery) { return; } 4934 4935 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 4936 4937 function enableMove1(e) { e.enableMove(); } 4938 function enableMove2(e) { e.enableMove(); } 4939 function enableMove3(e) { e.enableMove(); } 4940 4941 function add(handleObj) { 4942 var handler = handleObj.handler; 4943 4944 handleObj.handler = function(e) { 4945 // Copy move properties across from originalEvent 4946 var i = properties.length; 4947 var property; 4948 4949 while(i--) { 4950 property = properties[i]; 4951 e[property] = e.originalEvent[property]; 4952 } 4953 4954 handler.apply(this, arguments); 4955 }; 4956 } 4957 4958 jQuery.event.special.movestart = { 4959 setup: function() { 4960 // Movestart must be enabled to allow other move events 4961 on(this, 'movestart', enableMove1); 4962 4963 // Do listen to DOM events 4964 return false;
4965 }, 4966 4967 teardown: function() { 4968 off(this, 'movestart', enableMove1); 4969 return false; 4970 }, 4971 4972 add: add 4973 }; 4974 4975 jQuery.event.special.move = { 4976 setup: function() { 4977 on(this, 'movestart', enableMove2); 4978 return false; 4979 }, 4980 4981 teardown: function() { 4982 off(this, 'movestart', enableMove2); 4983 return false; 4984 }, 4985 4986 add: add 4987 }; 4988 4989 jQuery.event.special.moveend = { 4990 setup: function() { 4991 on(this, 'movestart', enableMove3); 4992 return false; 4993 }, 4994 4995 teardown: function() { 4996 off(this, 'movestart', enableMove3); 4997 return false; 4998 }, 4999 5000 add: add 5001 }; 5002}); 5003 5004 $.fn.twentytwenty = function(options) { 5005 var options = $.extend({ 5006 default_offset_pct: 0.5, 5007 orientation: 'horizontal', 5008 before_label: 'Before', 5009 after_label: 'After', 5010 no_overlay: false, 5011 move_slider_on_hover: false, 5012 move_with_handle_only: true, 5013 click_to_move: false 5014 }, options); 5015 5016 return this.each(function() { 5017 5018 var sliderPct = options.default_offset_pct; 5019 var container = $(this); 5020 var sliderOrientation = options.orientation; 5021 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 5022 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 5023 5024 5025 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 5026 if(!options.no_overlay) { 5027 container.append("<div class='twentytwenty-overlay'></div>"); 5028 var overlay = container.find(".twentytwenty-overlay"); 5029 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 5030 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 5031 } 5032 var beforeImg = container.find("img:first"); 5033 var afterImg = container.find("img:last"); 5034 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 5035 var slider = container.find(".twentytwenty-handle"); 5036 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 5037 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 5038 container.addClass("twentytwenty-container"); 5039 beforeImg.addClass("twentytwenty-before"); 5040 afterImg.addClass("twentytwenty-after"); 5041 5042 var calcOffset = function(dimensionPct) { 5043 var w = beforeImg.width(); 5044 var h = beforeImg.height(); 5045 return { 5046 w: w+"px", 5047 h: h+"px", 5048 cw: (dimensionPct*w)+"px", 5049 ch: (dimensionPct*h)+"px" 5050 }; 5051 }; 5052 5053 var adjustContainer = function(offset) { 5054 if (sliderOrientation === 'vertical') { 5055 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 5056 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 5057 } 5058 else { 5059 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 5060 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 5061 } 5062 container.css("height", offset.h); 5063 }; 5064 5065 var adjustSlider = function(pct) { 5066 var offset = calcOffset(pct); 5067 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 5068 adjustContainer(offset); 5069 }; 5070 5071 // Return the number specified or the min/max number if it outside the range given. 5072 var minMaxNumber = function(num, min, max) { 5073 return Math.max(min, Math.min(max, num)); 5074 }; 5075 5076 // Calculate the slider percentage based on the position. 5077 var getSliderPercentage = function(positionX, positionY) { 5078 var sliderPercentage = (sliderOrientation === 'vertical') ? 5079 (positionY-offsetY)/imgHeight : 5080 (positionX-offsetX)/imgWidth; 5081 5082 return minMaxNumber(sliderPercentage, 0, 1); 5083 }; 5084 5085 5086 $(window).on("resize.twentytwenty", function(e) { 5087 adjustSlider(sliderPct); 5088 }); 5089 5090 var offsetX = 0; 5091 var offsetY = 0; 5092 var imgWidth = 0; 5093 var imgHeight = 0; 5094 var onMoveStart = function(e) { 5095 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 5096 e.preventDefault(); 5097 } 5098 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 5099 e.preventDefault(); 5100 } 5101 container.addClass("active"); 5102 offsetX = container.offset().left; 5103 offsetY = container.offset().top; 5104 imgWidth = beforeImg.width(); 5105 imgHeight = beforeImg.height(); 5106 }; 5107 var onMove = function(e) { 5108 if (container.hasClass("active")) { 5109 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5110 adjustSlider(sliderPct); 5111 } 5112 }; 5113 var onMoveEnd = function() { 5114 container.removeClass("active"); 5115 }; 5116 5117 var moveTarget = options.move_with_handle_only ? slider : container; 5118 moveTarget.on("movestart",onMoveStart); 5119 moveTarget.on("move",onMove); 5120 moveTarget.on("moveend",onMoveEnd); 5121 5122 if (options.move_slider_on_hover) { 5123 container.on("mouseenter", onMoveStart); 5124 container.on("mousemove", onMove); 5125 container.on("mouseleave", onMoveEnd); 5126 } 5127 5128 slider.on("touchmove", function(e) { 5129 e.preventDefault(); 5130 }); 5131 5132 container.find("img").on("mousedown", function(event) { 5133 event.preventDefault(); 5134 }); 5135 5136 if (options.click_to_move) { 5137 container.on('click', function(e) { 5138 offsetX = container.offset().left; 5139 offsetY = container.offset().top; 5140 imgWidth = beforeImg.width(); 5141 imgHeight = beforeImg.height(); 5142 5143 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5144 adjustSlider(sliderPct); 5145 }); 5146 } 5147 5148 $(window).trigger("resize.twentytwenty"); 5149 }); 5150 }; 5151 5152 5153 $(window).on("load", function(e) { 5154 $('.twentytwenty-container').each(function(){ 5155 var $container = $(this); 5156 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5157 $container.twentytwenty(); 5158 } 5159 $('img', $container).on('async-done', function(){ 5160 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5161 $container.twentytwenty(); 5162 } 5163 }); 5164 }); 5165 }); 5166} 5167 5168UNCODE.justifiedGallery = function() { 5169 5170 var breakPointMe = function( val ) { 5171 val = parseInt( val ); 5172 if ( isNaN(val) ) { 5173 return false;
5174 } 5175 if ( val >= 1500 ) { 5176 return 1; 5177 } else if ( val < 1500 && val >= 960 ) { 5178 return 2; 5179 } else if ( val < 960 && val >= 570 ) { 5180 return 3; 5181 } else if ( val < 570 ) { 5182 return 4; 5183 } 5184 } 5185 5186 var gutterByBreakpoint = function( bp, gutter ) { 5187 var ret; 5188 switch(gutter) { 5189 case 'no-gutter': 5190 ret = 0; 5191 break; 5192 case 'px-gutter': 5193 ret = 1; 5194 break; 5195 case 'half-gutter': 5196 ret = 18; 5197 break; 5198 case 'double-gutter': 5199 switch(bp) { 5200 case 3: 5201 case 4: 5202 ret = 36; 5203 break; 5204 default: 5205 ret = 72; 5206 break; 5207 } 5208 break; 5209 case 'triple-gutter': 5210 switch(bp) { 5211 case 3: 5212 case 4: 5213 ret = 36; 5214 break; 5215 default: 5216 ret = 108; 5217 break; 5218 } 5219 break; 5220 case 'quad-gutter': 5221 switch(bp) { 5222 case 2: 5223 ret = 108; 5224 break; 5225 case 3: 5226 ret = 72; 5227 break; 5228 case 4: 5229 ret = 36; 5230 break; 5231 default: 5232 ret = 144; 5233 break; 5234 } 5235 break; 5236 default: 5237 ret = 36;//single-gutter 5238 } 5239 return ret; 5240 } 5241 5242 if ($('.justified-layout').length > 0) { 5243 var justifiedContainersArray = [], 5244 typeGridArray = [], 5245 layoutGridArray = [], 5246 transitionDuration = [], 5247 $filterItems = [], 5248 $filters = $('.justified-system .isotope-filters'), 5249 $itemSelector = '.tmb', 5250 $items, 5251 itemMargin, 5252 correctionFactor = 0, 5253 firstLoad = true, 5254 isOriginLeft = $('body').hasClass('rtl') ? false : true, 5255 prevW = breakPointMe(UNCODE.wwidth); 5256 $('[class*="justified-container"]').each(function() { 5257 var isoData = $(this).data(); 5258 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5259 if (isoData.type == 'metro') typeGridArray.push(true); 5260 else typeGridArray.push(false); 5261 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 5262 else layoutGridArray.push('justified'); 5263 justifiedContainersArray.push($(this)); 5264 }); 5265 var init_justifiedGallery = function() { 5266 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 5267 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 5268 justifiedId = justifiedSystem.attr('id'), 5269 $layoutMode = layoutGridArray[i], 5270 gutter = $(justifiedContainersArray[i]).data('gutter'), 5271 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 5272 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 5273 lastRow = $(justifiedContainersArray[i]).data('last-row'), 5274 margins; 5275 5276 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 5277 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 5278 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 5279 5280 margins = gutterByBreakpoint(prevW, gutter); 5281 5282 $(justifiedContainersArray[i]).justifiedGallery({ 5283 rowHeight: rowHeight, 5284 maxRowHeight: maxRowHeight, 5285 margins: margins, 5286 cssAnimation: true, 5287 lastRow: lastRow, 5288 waitThumbnailsLoad: false 5289 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 5290 5291 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 5292 $(justifiedContainersArray[i]).infinitescroll({ 5293 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 5294 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 5295 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 5296 animate: false, 5297 behavior: 'local', 5298 debug: false, 5299 loading: { 5300 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 5301 speed: 0, 5302 finished: undefined, 5303 msg: $('#' + justifiedId + ' .loadmore-button'), 5304 }, 5305 errorCallback: function() { 5306 var justified_system = $(this).closest('.justified-system'); 5307 $('.loading-button', justified_system).hide(); 5308 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 5309 } 5310 }, 5311 // append the new items to galleryJustified on the infinitescroll callback function. 5312 function(newElements, opts) { 5313 var $galleryJustified = $(this), 5314 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 5315 filters = new Array(), 5316 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 5317 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 5318 $numPages = $('a', $infinite_button).data('pages'),
5319 delay = 300; 5320 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 5321 $infinite_button.show(); 5322 $loading_button.hide(); 5323 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 5324 $('> li', $galleryJustified).remove(); 5325 $.each($(newElements), function(index, val) { 5326 $(val).addClass('tmb-iso'); 5327 if ($(val).is("li")) { 5328 filters.push($(val)[0]); 5329 } 5330 }); 5331 newElements = newElements.filter(function(x) { 5332 return filters.indexOf(x) < 0 5333 }); 5334 $.each($(filters), function(index, val) { 5335 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 5336 }); 5337 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 5338 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5339 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 5340 if (typeof getLightbox === 'object') { 5341 getLightbox.refresh(); 5342 } else { 5343 UNCODE.lightbox(); 5344 } 5345 } 5346 if ( typeof twttr !== 'undefined' ) 5347 twttr.widgets.load(justifiedContainersArray[i]); 5348 5349 requestTimeout(function() { 5350 $galleryJustified.trigger('more-items-loaded'); 5351 }, 1000); 5352 }); 5353 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 5354 var $infinite_justified = $(justifiedContainersArray[i]), 5355 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 5356 $infinite_justified.infinitescroll('pause'); 5357 $infinite_button.on('click', function(event) { 5358 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5359 $.each(UNCODE.lightboxArray, function(index, val) { 5360 UNCODE.lightboxArray[index].destroy(); 5361 }); 5362 } 5363 event.preventDefault(); 5364 var $justified_system = $(event.target).closest('.justified-system'), 5365 $infinite_justified = $justified_system.find('.justified-container'), 5366 justifiedId = $justified_system.attr('id'); 5367 $(event.currentTarget).html(SiteParameters.loading); 5368 $infinite_justified.infinitescroll('resume'); 5369 $infinite_justified.infinitescroll('retrieve'); 5370 $infinite_justified.infinitescroll('pause'); 5371 $infinite_justified.trigger('more-items-loaded'); 5372 }); 5373 } 5374 } 5375 } 5376 }, 5377 onLayout = function(justifiedObj, startIndex) { 5378 justifiedObj.css('opacity', 1); 5379 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 5380 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 5381 5382 requestTimeout(function() { 5383 // window.dispatchEvent(UNCODE.boxEvent); 5384 UNCODE.adaptive(); 5385 if (SiteParameters.dynamic_srcset_active === '1') { 5386 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 5387 } 5388 if (typeof MediaElement === "function") { 5389 $(justifiedObj).find('audio,video').each(function() { 5390 $(this).mediaelementplayer({ 5391 pauseOtherPlayers: false, 5392 }); 5393 }); 5394 } 5395 if ($(justifiedObj).find('.nested-carousel').length) { 5396 if (typeof UNCODE.carousel !== 'undefined') { 5397 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 5398 } 5399 requestTimeout(function() { 5400 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 5401 justifiedObj.addClass('justified-gallery-finished') 5402 Waypoint.refreshAll(); 5403 }, 200); 5404 } else { 5405 requestTimeout(function() { 5406 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 5407 justifiedObj.addClass('justified-gallery-finished') 5408 Waypoint.refreshAll(); 5409 }, 300); 5410 } 5411 }, 100); 5412 5413 }, 5414 boxAnimation = function(items, startIndex, sequential, container) { 5415 var $allItems = items.length - startIndex, 5416 showed = 0, 5417 index = 0; 5418 if (container.closest('.owl-item').length == 1) return false; 5419 $.each(items, function(index, val) { 5420 var elInner = $('> .t-inside', val); 5421 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 5422 return; 5423 } 5424 if (val[0]) val = val[0]; 5425 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 5426 new Waypoint({ 5427 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5428 element: val, 5429 handler: function() { 5430 var element = $('> .t-inside', this.element), 5431 parent = $(this.element), 5432 currentIndex = parent.index();
5433 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 5434 delayAttr = parseInt(element.attr('data-delay')); 5435 if (isNaN(delayAttr)) delayAttr = 100; 5436 delay -= showed; 5437 var objTimeout = requestTimeout(function() { 5438 element.removeClass('zoom-reverse').addClass('start_animation'); 5439 showed = parent.index(); 5440 }, delay * delayAttr); 5441 parent.data('objTimeout', objTimeout); 5442 if (!UNCODE.isUnmodalOpen) { 5443 this.destroy(); 5444 } 5445 }, 5446 offset: '100%' 5447 }) 5448 } else { 5449 elInner.removeClass('animate_when_almost_visible'); 5450 $(val).addClass('no-waypoint-animation'); 5451 /*if (elInner.hasClass('force-anim')) { 5452 elInner.addClass('start_animation'); 5453 } else { 5454 elInner.css('opacity', 1); 5455 }*/ 5456 } 5457 index++; 5458 }); 5459 }; 5460 $filters.on('click', 'a[data-filter]', function(evt) { 5461 var $filter = $(this), 5462 filterContainer = $filter.closest('.isotope-filters'), 5463 filterValue = $filter.attr('data-filter'), 5464 container = $filter.closest('.justified-system').find($('.justified-layout')), 5465 lastRow = container.data('last-row'), 5466 transitionDuration = 0, 5467 delay = 300, 5468 filterItems = []; 5469 5470 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 5471 5472 var filter_items = function(){ 5473 if (filterValue !== undefined) { 5474 $.each($('> .tmb > .t-inside', container), function(index, val) { 5475 var parent = $(val).parent(), 5476 objTimeout = parent.data('objTimeout'); 5477 if (objTimeout) { 5478 $(val).removeClass('zoom-reverse'); 5479 clearRequestTimeout(objTimeout); 5480 } 5481 if (transitionDuration == 0) { 5482 if ($(val).hasClass('animate_when_almost_visible')) { 5483 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5484 } else { 5485 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5486 } 5487 } 5488 }); 5489 5490 requestTimeout(function() { 5491 var $block, 5492 selector, 5493 lightboxElements, 5494 $boxes; 5495 5496 if ( filterValue !== '' && filterValue !== '*' ) { 5497 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 5498 selector = '.' + filterValue; 5499 $.each($(selector, container), function(index, block) { 5500 lightboxElements = $('[data-lbox^=ilightbox]', block); 5501 if (lightboxElements.length) { 5502 lightboxElements.removeClass('lb-disabled'); 5503 container.data('lbox', $(lightboxElements[0]).data('lbox')); 5504 } 5505 filterItems.push(block); 5506 }); 5507 container.justifiedGallery({ 5508 filter: selector, 5509 lastRow: 'nojustify' 5510 }); 5511 } else { 5512 container.justifiedGallery({ 5513 filter: false, 5514 lastRow: lastRow 5515 }); 5516 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 5517 filterItems = $('> .tmb', container); 5518 } 5519 container.trigger('more-items-loaded'); 5520 5521 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 5522 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5523 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 5524 if (typeof getLightbox === 'object') { 5525 getLightbox.refresh(); 5526 } else { 5527 UNCODE.lightbox(); 5528 } 5529 } 5530 5531 if (transitionDuration == 0) { 5532 requestTimeout(function() { 5533 boxAnimation(filterItems, 0, false, container); 5534 }, 100); 5535 } 5536 requestTimeout(function() { 5537 Waypoint.refreshAll(); 5538 container.trigger('more-items-loaded'); 5539 }, 2000); 5540 5541 }, delay); 5542 } else { 5543 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5544 $.each(UNCODE.lightboxArray, function(index, val) { 5545 UNCODE.lightboxArray[index].destroy(); 5546 }); 5547 } 5548 $.each($('> .tmb > .t-inside', container), function(index, val) { 5549 var parent = $(val).parent(), 5550 objTimeout = parent.data('objTimeout'); 5551 if (objTimeout) { 5552 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5553 clearRequestTimeout(objTimeout); 5554 } 5555 if (transitionDuration == 0) { 5556 if ($(val).hasClass('animate_when_almost_visible')) { 5557 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5558 } else { 5559 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5560 } 5561 } 5562 }); 5563 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5564 UNCODE.lightbox(); 5565 } 5566 container.parent().addClass('justified-loading'); 5567 container.trigger('more-items-loaded'); 5568 } 5569 }; 5570 5571 if (!$filter.hasClass('active')) { 5572 /** Scroll top with filtering */ 5573 if (filterContainer.hasClass('filter-scroll')) { 5574 var calc_scroll = container.closest('.row-parent').offset().top; 5575 calc_scroll -= UNCODE.get_scroll_offset(); 5576 5577 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5578 delta = bodyTop - calc_scroll, 5579 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 5580 filterTolerance = false, 5581 filter_timeout; 5582 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5583 5584 if ( !UNCODE.isFullPage ) { 5585 if (scrollSpeed == 0) { 5586 $('html, body').scrollTop(calc_scroll); 5587 UNCODE.scrolling = false;
5588 filter_items(); 5589 } else { 5590 5591 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 5592 filter_items(); 5593 filterTolerance = true; 5594 } 5595 5596 $('html, body').animate({ 5597 scrollTop: calc_scroll 5598 },{ 5599 easing: 'easeInOutQuad', 5600 duration: scrollSpeed, 5601 complete: function(){ 5602 UNCODE.scrolling = false; 5603 if ( !filterTolerance ) { 5604 filter_timeout = setTimeout(function(){ 5605 clearTimeout(filter_timeout); 5606 filter_items(); 5607 }, 200); 5608 } 5609 } 5610 }); 5611 } 5612 } 5613 } else { 5614 filter_items(); 5615 } 5616 } 5617 evt.preventDefault(); 5618 }); 5619 5620 $filters.each(function(i, buttonGroup) { 5621 var $buttonGroup = $(buttonGroup); 5622 $buttonGroup.on('click', 'a', function() { 5623 $buttonGroup.find('.active').removeClass('active'); 5624 $(this).addClass('active'); 5625 }); 5626 5627 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 5628 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 5629 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 5630 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 5631 e.preventDefault(); 5632 $cats_filters.slideToggle(400, 'easeInOutCirc'); 5633 }); 5634 }); 5635 window.addEventListener('boxResized', function(e) { 5636 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 5637 prevW = breakPointMe(UNCODE.wwidth); 5638 $.each($('.justified-layout'), function(index, val) { 5639 var gutter = $(this).data('gutter'), 5640 margins = gutterByBreakpoint( prevW, gutter); 5641 $(this).justifiedGallery({ 5642 margins: margins 5643 }); 5644 $(this).find('.mejs-video,.mejs-audio').each(function() { 5645 $(this).trigger('resize'); 5646 }); 5647 }); 5648 } 5649 }, false); 5650 5651 init_justifiedGallery(); 5652 }; 5653}; 5654 5655UNCODE.cssGrid = function() { 5656 if ($('.cssgrid-layout').length > 0) { 5657 var cssGridContainersArray = []; 5658 var transitionDuration = []; 5659 var $filters = $('.cssgrid-system .cssgrid-filters'); 5660 5661 $('[class*="cssgrid-container"]').each(function() { 5662 cssGridContainersArray.push($(this)); 5663 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5664 }); 5665 5666 var init_cssGridAjax = function() { 5667 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 5668 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 5669 cssGridId = cssGridSystem.attr('id'); 5670 5671 cssGridSystem.data('transitionDuration', transitionDuration[i]); 5672 5673 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 5674 $(cssGridContainersArray[i]).infinitescroll({ 5675 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 5676 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 5677 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve 5678 animate: false, 5679 behavior: 'local', 5680 debug: false, 5681 loading: { 5682 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 5683 speed: 0, 5684 finished: undefined, 5685 msg: $('#' + cssGridId + ' .loadmore-button'), 5686 }, 5687 errorCallback: function() { 5688 var cssgrid_system = $(this).closest('.cssgrid-system'); 5689 $('.loading-button', cssgrid_system).hide(); 5690 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 5691 } 5692 }, 5693 // append the new items to cssGrid on the infinitescroll callback function. 5694 function(newElements, opts) { 5695 var $cssGrid = $(this), 5696 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 5697 cssGridId = cssGridSystemCont.attr('id'), 5698 filters = new Array(), 5699 $loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'), 5700 $infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'), 5701 $numPages = $('a', $infinite_button).data('pages'),
5702 delay = 300; 5703 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 5704 $infinite_button.show(); 5705 $loading_button.hide(); 5706 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 5707 $('> li', $cssGrid).remove(); 5708 $.each($(newElements), function(index, val) { 5709 $(val).addClass('tmb-grid'); 5710 if ($(val).is("li")) { 5711 filters.push($(val)[0]); 5712 } 5713 }); 5714 newElements = newElements.filter(function(x) { 5715 return filters.indexOf(x) < 0 5716 }); 5717 $.each($(filters), function(index, val) { 5718 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 5719 }); 5720 5721 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter'); 5722 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 5723 if (filterValue !== undefined && filterValue != '*') { 5724 $(newElements).hide(); 5725 var els_to_show = $(); 5726 $(newElements).each(function() { 5727 var el = $(this); 5728 if (el.hasClass(filterValue)) { 5729 els_to_show = els_to_show.add(el); 5730 el.show(); 5731 } 5732 }); 5733 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 5734 } else { 5735 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 5736 } 5737 5738 UNCODE.adaptive(); 5739 if (SiteParameters.dynamic_srcset_active === '1') { 5740 UNCODE.refresh_dynamic_srcset_size($cssGrid); 5741 } 5742 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5743 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 5744 if (typeof getLightbox === 'object') { 5745 getLightbox.refresh(); 5746 } else { 5747 UNCODE.lightbox(); 5748 } 5749 } 5750 if ( typeof twttr !== 'undefined' ) { 5751 twttr.widgets.load(cssGridContainersArray[i]); 5752 } 5753 5754 requestTimeout(function() { 5755 $cssGrid.trigger('more-items-loaded'); 5756 }, 1000); 5757 5758 }); 5759 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 5760 var $cssgrid_el = $(cssGridContainersArray[i]), 5761 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 5762 $cssgrid_el.infinitescroll('pause'); 5763 $infinite_button.on('click', function(event) { 5764 event.preventDefault(); 5765 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 5766 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 5767 cssGridId = $cssgrid_system.attr('id'); 5768 $(event.currentTarget).html(SiteParameters.loading); 5769 $cssgrid_el.infinitescroll('resume'); 5770 $cssgrid_el.infinitescroll('retrieve'); 5771 $cssgrid_el.infinitescroll('pause'); 5772 }); 5773 } 5774 } 5775 } 5776 }; 5777 5778 init_cssGridAjax(); 5779 5780 if ($('.cssgrid-pagination').length > 0) { 5781 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 5782 evt.preventDefault(); 5783 5784 var container = $(this).closest('.cssgrid-system'), 5785 calc_scroll = container.closest('.row-parent').offset().top; 5786 5787 calc_scroll -= UNCODE.get_scroll_offset(); 5788 5789 var menu_container = $('.menu-sticky'); 5790 var menu = menu_container.find('.menu-container'); 5791 5792 if (menu_container.length > 0 && menu.length > 0) { 5793 calc_scroll = calc_scroll - menu.outerHeight(); 5794 } 5795 5796 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5797 delta = bodyTop - calc_scroll, 5798 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5799 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5800 5801 if ( !UNCODE.isFullPage ) { 5802 if (scrollSpeed == 0) { 5803 $('html, body').scrollTop(calc_scroll); 5804 } else { 5805 $('html, body').animate({ 5806 scrollTop: calc_scroll 5807 },{ 5808 easing: 'easeInOutQuad', 5809 duration: scrollSpeed, 5810 complete: function(){ 5811 UNCODE.scrolling = false;
5812 } 5813 }); 5814 } 5815 } 5816 5817 loadCssGrid($(this), true); 5818 evt.preventDefault(); 5819 }); 5820 } 5821 5822 $filters.on('click', 'a.grid-nav-link', function(evt) { 5823 if ($(this).hasClass('no-grid-filter')) { 5824 return; 5825 } 5826 var $filter = $(this), 5827 filterContainer = $filter.closest('.cssgrid-filters'), 5828 filterValue = $filter.attr('data-filter'), 5829 containerSystem = $filter.closest('.cssgrid-system'), 5830 container = containerSystem.find($('.cssgrid-layout')), 5831 transitionDuration = containerSystem.data('transitionDuration'), 5832 delay = 300, 5833 filterItems = [], 5834 all_thumbs = container.find('.tmb-grid'); 5835 5836 var filter_items = function(){ 5837 if (filterValue !== undefined) { 5838 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 5839 var parent = $(val).parent(), 5840 objTimeout = parent.data('objTimeout'); 5841 if (objTimeout) { 5842 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5843 clearRequestTimeout(objTimeout); 5844 } 5845 if (transitionDuration == 0) { 5846 if ($(val).hasClass('animate_when_almost_visible')) { 5847 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5848 } else { 5849 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5850 } 5851 } 5852 }); 5853 requestTimeout(function(){ 5854 if ( filterValue == '*' ) { 5855 all_thumbs.show(); 5856 all_thumbs.each(function(index, val) { 5857 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 5858 filterItems.push($(this)); 5859 }); 5860 } else { 5861 all_thumbs.each(function() { 5862 var _tmb = $(this); 5863 if (_tmb.hasClass(filterValue)) { 5864 _tmb.show(); 5865 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 5866 filterItems.push(_tmb); 5867 } else { 5868 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 5869 _tmb.hide(); 5870 } 5871 }); 5872 } 5873 5874 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 5875 5876 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 5877 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 5878 var lightboxElements = $('[data-lbox^=ilightbox]', container); 5879 if (lightboxElements.length) { 5880 container.data('lbox', $(lightboxElements[0]).data('lbox')); 5881 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 5882 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 5883 if (typeof getLightbox === 'object') { 5884 getLightbox.refresh(); 5885 } else { 5886 UNCODE.lightbox(); 5887 } 5888 } 5889 } 5890 container.trigger('more-items-loaded'); 5891 }, delay); 5892 } else { 5893 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 5894 var parent = $(val).parent(), 5895 objTimeout = parent.data('objTimeout'); 5896 if (objTimeout) { 5897 $(val).removeClass('zoom-reverse').removeClass('start_animation') 5898 clearRequestTimeout(objTimeout); 5899 } 5900 if (transitionDuration == 0) { 5901 if ($(val).hasClass('animate_when_almost_visible')) { 5902 $(val).addClass('zoom-reverse').removeClass('start_animation'); 5903 } else { 5904 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 5905 } 5906 } 5907 }); 5908 loadCssGrid($filter); 5909 } 5910 }; 5911 5912 if (!$filter.hasClass('active')) { 5913 /** Scroll top with filtering */ 5914 if (filterContainer.hasClass('filter-scroll')) { 5915 var calc_scroll = container.closest('.row-parent').offset().top; 5916 calc_scroll -= UNCODE.get_scroll_offset(); 5917 5918 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5919 delta = bodyTop - calc_scroll, 5920 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 5921 filterTolerance = false, 5922 filter_timeout; 5923 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5924 5925 if ( !UNCODE.isFullPage ) { 5926 if (scrollSpeed == 0) { 5927 $('html, body').scrollTop(calc_scroll); 5928 UNCODE.scrolling = false;
5929 filter_items(); 5930 } else { 5931 5932 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 5933 filter_items(); 5934 filterTolerance = true; 5935 } 5936 5937 $('html, body').animate({ 5938 scrollTop: calc_scroll 5939 },{ 5940 easing: 'easeInOutQuad', 5941 duration: scrollSpeed, 5942 complete: function(){ 5943 UNCODE.scrolling = false; 5944 if ( !filterTolerance ) { 5945 filter_timeout = setTimeout(function(){ 5946 clearTimeout(filter_timeout); 5947 filter_items(); 5948 }, 200); 5949 } 5950 } 5951 }); 5952 } 5953 } 5954 } else { 5955 filter_items(); 5956 } 5957 } 5958 evt.preventDefault(); 5959 }); 5960 5961 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 5962 var params = UNCODE.getURLParams(window.location); 5963 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 5964 5965 UNCODE.lastURL = window.location.href; 5966 5967 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 5968 return; 5969 } 5970 5971 if (params.id === undefined) { 5972 $.each($('.cssgrid-system'), function(index, val) { 5973 loadCssGrid($(val)); 5974 }); 5975 } else { 5976 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 5977 loadCssGrid($('#' + params.id)); 5978 } 5979 } 5980 }); 5981 5982 var loadCssGrid = function($href, $paginating) { 5983 var is_paginating = false; 5984 5985 if (undefined !== $paginating && $paginating) { 5986 var is_paginating = $paginating; 5987 } 5988 5989 var href = ($href.is("a") ? $href.attr('href') : location), 5990 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 5991 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 5992 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 5993 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 5994 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 5995 cssgridId = cssgridSystem.attr('id'); 5996 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 5997 UNCODE.lastURL = href; 5998 history.pushState({ 5999 myCSSgrid: true 6000 }, document.title, href); 6001 } 6002 cssgridWrapper.addClass('cssgrid-loading'); 6003 if (is_paginating) { 6004 cssgridWrapper.addClass('grid-filtering'); 6005 } 6006 $.ajax({ 6007 url: href 6008 }).done(function(data) { 6009 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 6010 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 6011 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 6012 requestTimeout(function() { 6013 cssgridContainer.html($resultItems); 6014 cssgridWrapper.removeClass('cssgrid-loading'); 6015 cssgridWrapper.removeClass('grid-filtering'); 6016 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6017 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 6018 UNCODE.adaptive(); 6019 if (SiteParameters.dynamic_srcset_active === '1') { 6020 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 6021 } 6022 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6023 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 6024 if (typeof getLightbox === 'object') { 6025 getLightbox.refresh(); 6026 } else { 6027 UNCODE.lightbox(); 6028 } 6029 } 6030 cssgridContainer.trigger('more-items-loaded'); 6031 }, 300); 6032 6033 $('.pagination', cssgridFooter).remove(); 6034 cssgridFooter.append($resultPagination); 6035 6036 if (cssgridResultCount.length > 0) { 6037 $('.woocommerce-result-count', cssgridResultCount).remove(); 6038 cssgridResultCount.append($resultCount); 6039 } 6040 }); 6041 }; 6042 6043 $filters.each(function(i, buttonGroup) { 6044 var $buttonGroup = $(buttonGroup); 6045 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 6046 $buttonGroup.find('.active').removeClass('active'); 6047 $(this).addClass('active'); 6048 6049 }); 6050 6051 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6052 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6053 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6054 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6055 e.preventDefault(); 6056 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6057 }); 6058 6059 }); 6060 }; 6061}; 6062 6063UNCODE.preventDoubleTransition = function() { 6064 $('.sticky-element .animate_when_almost_visible').each(function(){ 6065 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 6066 $el.addClass('do_not_reanimate'); 6067 }); 6068 }); 6069}; 6070 6071UNCODE.checkScrollForTabs = function(){ 6072 var goToSection = window.location.hash.replace('#', ''), 6073 $index; 6074 6075 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 6076 goToSection = encodeURIComponent(goToSection); 6077 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 6078 6079 $index.attr('data-parent', 'parent-' + goToSection); 6080 6081 if (window.location.hash != undefined && window.location.hash != '') { 6082 requestTimeout(function() { 6083 scrollBody('parent-' + goToSection); 6084 }, 500); 6085 } 6086 6087 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 6088 var hash = (e.currentTarget).hash, 6089 index = (e.currentTarget).closest('.uncode-tabs'); 6090 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 6091 $('a[href="' + hash + '"][data-tab-history]').click(); 6092 scrollBody(index); 6093 } 6094 }); 6095 6096 var scrollBody = function(index) { 6097 6098 var getSection = $('a[href="' + index + '"][data-tab-history]'), 6099 scrollTo, 6100 safeGap = 27; 6101 6102 if ( ! getSection.length ) { 6103 getSection = $('div[data-parent="' + index + '"]'); 6104 6105 if ( getSection.attr('data-target') == 'row' ) { 6106 getSection = getSection.closest('.vc_row'); 6107 safeGap = 0; 6108 } 6109 } 6110 6111 if (typeof getSection === 'undefined' || ! getSection.length ) { 6112 return; 6113 } 6114 6115 var body = $("html, body"), 6116 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6117 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 6118 getOffset = UNCODE.get_scroll_offset(); 6119 if ( typeof getSection.offset() === 'undefined' ) 6120 return; 6121 scrollTo = getSection.offset().top - safeGap; 6122 scrollTo -= getOffset; 6123 6124 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6125 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6126 6127 if (index != 0) { 6128 UNCODE.scrolling = true; 6129 } 6130 6131 if (scrollSpeed == 0) { 6132 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 6133 UNCODE.scrolling = false;
6134 } else { 6135 body.animate({ 6136 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 6137 }, scrollSpeed, 'easeInOutQuad', function() { 6138 requestTimeout(function() { 6139 UNCODE.scrolling = false; 6140 if (getOffset != UNCODE.get_scroll_offset()) { 6141 scrollBody(index); 6142 } 6143 }, 100); 6144 }); 6145 } 6146 6147 }; 6148}; 6149 6150UNCODE.printScreen = function() { 6151 var inlineMediaStyle = null, 6152 setResize; 6153 6154 function changeMediaStyle() { 6155 clearRequestTimeout(setResize); 6156 setResize = requestTimeout(function(){ 6157 var $head = document.getElementsByTagName('head')[0], 6158 $newStyle = document.createElement('style'), 6159 winW = window.innerWidth, 6160 printH = window.innerHeight; 6161 6162 $newStyle.setAttribute('type', 'text/css'); 6163 $newStyle.setAttribute('media', 'print'); 6164 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 6165 6166 if (inlineMediaStyle != null) { 6167 $head.replaceChild($newStyle, inlineMediaStyle) 6168 } else { 6169 $head.appendChild($newStyle); 6170 } 6171 inlineMediaStyle = $newStyle; 6172 }, 1000); 6173 } 6174 6175 changeMediaStyle(); 6176 window.addEventListener('resize', changeMediaStyle); 6177}; 6178 6179UNCODE.fullPage = function() { 6180 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 6181 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 6182 return false; 6183 } else { 6184 requestTimeout(function() { 6185 window.scrollTo(0, 0); 6186 }, 10); 6187 } 6188 6189 var $masthead = $('#masthead'), 6190 $logo = $('#logo-container-mobile'), 6191 $logolink = $('[data-minheight]', $logo), 6192 logoMinScale = $logolink.data('minheight'), 6193 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 6194 $mainWrapper = $('.main-wrapper')[0], 6195 $container = $('.main-container .post-content'), 6196 $mobileMenuWrapper = $('.menu-wrapper'), 6197 mobMenuPos, 6198 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 6199 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 6200 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 6201 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 6202 headerWithOpacity = $('.header-scroll-opacity', $header).length, 6203 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 6204 menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight, 6205 footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0, 6206 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 6207 $scrollTop = $('.scroll-top'), 6208 scrollBar = true, 6209 effect, 6210 animationEndTimeOut, 6211 fp_anim_time = 900, 6212 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 6213 is_scrolling = false, 6214 dataNames = [], 6215 is_first = true, 6216 no_history = $('body').hasClass('uncode-scroll-no-history'), 6217 theres_footer = true; 6218 6219 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 6220 $('> div', $footer).each(function(index, el){ 6221 if ( $(el).outerHeight() < 2 ) 6222 theres_footer = false; 6223 else 6224 theres_footer = true; 6225 }); 6226 } 6227 6228 if ( !$footer.length ) 6229 theres_footer = false; 6230 6231 if ( !UNCODE.isFullPageSnap ) { 6232 /*if ( theres_footer ) 6233 $footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/ 6234 6235 if ( $('body').hasClass('uncode-fullpage-zoom') ) 6236 effect = 'scaleDown'; 6237 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 6238 effect = 'moveparallax'; 6239 else 6240 effect = 'movecurtain'; 6241 } 6242 6243 if ( $('body').hasClass('uncode-fullpage-trid') ) 6244 fp_anim_time = fp_anim_time*2; 6245 6246 if ( $header.length ) { 6247 if ( headerName !== '' ) 6248 $header.attr('data-name', headerName); 6249 if ( headerLabel !== '' ) 6250 $header.attr('data-label', headerLabel); 6251 $container.prepend($header); 6252 } 6253 if ( theres_footer ) { 6254 $container.append($footer); 6255 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 6256 $('aside.widget ul', $footer).addClass('no-list'); 6257 } 6258 6259 var $all = $rows.add($header); 6260 6261 if ( theres_footer ) 6262 $all = $all.add($footer); 6263 6264 $all.each(function(index, row) { 6265 if( index === 0 ) 6266 $(row).addClass('uncode-scroll-active'); 6267 }); 6268 6269 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 6270 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 6271 6272 $all.each(function(index, val) { 6273 var getName = $(val).data('name'), 6274 label; 6275 6276 if (typeof getName == 'undefined' || getName == 'undefined') 6277 getName = SiteParameters.slide_name + '-' + index; 6278 6279 //if ( dataNames.includes(getName) ) { 6280 if ( dataNames.indexOf(getName) > 0 ) { 6281 getName += '_' + index; 6282 $(val).data('name', getName); 6283 } 6284 6285 dataNames.push(getName); 6286 6287 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 6288 6289 if (typeof $(val).attr('data-label') !== 'undefined') 6290 label = $(val).attr('data-label'); 6291 else label = ''; 6292 6293 if ( $(val).is($footer) ) 6294 return; 6295 6296 if (label != '' ) { 6297 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 6298 $('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>"); 6299 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 6300 $('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>"); 6301 } 6302 }); 6303 6304 var checkVisible = function( el, off ) { 6305 if (typeof jQuery === "function" && el instanceof jQuery) { 6306 el = el[0]; 6307 } 6308 6309 off = typeof off=='undefined' ? 50 : off; 6310 6311 var rect = el.getBoundingClientRect(); 6312 6313 return ( 6314 ( 6315 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 6316 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 6317 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 6318 ) 6319 ); 6320 }; 6321 6322 var animationEndAction = function( index, nextIndex ) { 6323 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 6324 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6325 player, iframe; 6326 6327 if ( !$nextSlide.is($footer) ) { 6328 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 6329 } 6330 6331 if ( !UNCODE.isFullPageSnap ) { 6332 activateKBurns( nextIndex ); 6333 } 6334 6335 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 6336 if ($(this).attr('data-provider') == 'vimeo') { 6337 iframe = $(this).find('iframe'); 6338 player = new Vimeo.Player(iframe[0]); 6339 player.pause(); 6340 } else if ($(this).attr('data-provider') == 'youtube') { 6341 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 6342 } else { 6343 if ($(this).is('video')) { 6344 $(this)[0].volume = 0; 6345 $(this)[0].pause(); 6346 } 6347 } 6348 }); 6349 6350 if ( ! UNCODE.isMobile && headerWithOpacity ) { 6351 if ( $nextSlide.is($header) ) 6352 $header.removeClass('header-scrolled'); 6353 } 6354 6355 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 6356 $otherEl.each(function(){ 6357 var $otherThis = $(this), 6358 $bgwrapperOther = $('.background-inner', $otherThis); 6359 if ( !checkVisible($otherThis) ) 6360 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 6361 6362 }); 6363 6364 if ( !checkVisible($currentSlide) ) { 6365 $currentSlide.removeClass('uncode-scroll-visible'); 6366 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 6367 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
6368 currentScroll.scrollTo(0, 0, 0); 6369 } 6370 6371 clearRequestTimeout(animationEndTimeOut); 6372 animationEndTimeOut = requestTimeout(function(){ 6373 Waypoint.refreshAll(); 6374 $( document.body ).trigger('uncode_waypoints'); 6375 var eventFP = new CustomEvent('fp-slide-changed'); 6376 window.dispatchEvent(eventFP); 6377 is_scrolling = false; 6378 6379 if ( is_first ) { 6380 $('ul.onepage-pagination a').removeClass('is-selected'); 6381 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 6382 is_first = false; 6383 } 6384 6385 }, 500); 6386 }; 6387 6388 var postLeaveActions = function( nextIndex ){ 6389 if ( menuHidden && ! UNCODE.isMobile ) 6390 return false; 6391 6392 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6393 $cols = $('.uncol', $el), 6394 anchor = $el.data('anchor'); 6395 6396 if ( ! UNCODE.isFullPageSnap ) { 6397 $.each($cols, function(index, val){ 6398 if ( $(val).hasClass('style-light') ){ 6399 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 6400 return false; 6401 } else if ( $(val).hasClass('style-dark') ) { 6402 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 6403 return false; 6404 } 6405 }); 6406 } 6407 6408 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 6409 $('.menu-item' ).removeClass('active'); 6410 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 6411 } 6412 6413 if ( !UNCODE.isFullPageSnap ) { 6414 activateBackWash( nextIndex ); 6415 } 6416 }; 6417 6418 var activateBackWash = function( nextIndex ){ 6419 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6420 $bgwrapper; 6421 6422 if ( $el.length ) { 6423 if ( $el.hasClass('with-zoomout') ) { 6424 $bgwrapper = $('.background-inner:nth-child(1)', $el); 6425 } else if ( $('.with-zoomout', $el).length ) { 6426 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 6427 } else { 6428 return false; 6429 } 6430 } else { 6431 return false; 6432 } 6433 6434 $bgwrapper.addClass('uncode-zoomout'); 6435 6436 }; 6437 6438 var activateKBurns = function( nextIndex ){ 6439 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6440 $bgwrapper; 6441 6442 if ( $el.length ) { 6443 if ( $el.hasClass('with-kburns') ) { 6444 $bgwrapper = $('.background-inner:nth-child(1)', $el); 6445 } else if ( $('.with-kburns', $el).length ) { 6446 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 6447 } else { 6448 return false; 6449 } 6450 } else { 6451 return false; 6452 } 6453 6454 $bgwrapper.addClass('uncode-kburns'); 6455 6456 }; 6457 6458 var activateParallax = function( nextIndex, direction ){ 6459 6460 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6461 $cell = $('.fp-tableCell', $el), 6462 animationEnd = 'webkitAnimationEnd animationend', 6463 cellAnim; 6464 6465 switch( direction ) { 6466 case 'up': 6467 cellAnim = 'moveFromTopInner'; 6468 break; 6469 default: 6470 cellAnim = 'moveFromBottomInner'; 6471 } 6472 6473 $cell.css({ 6474 'animation-name': cellAnim, 6475 'animation-duration': fp_anim_time + 'ms', 6476 'animation-delay': '', 6477 'animation-timing-function': fp_easing, 6478 'animation-fill-mode': 'both', 6479 }).off(animationEnd) 6480 .on(animationEnd, function(event) { 6481 if ( event.originalEvent.animationName === cellAnim ) { 6482 $cell 6483 .css({ 6484 'animation-name': '', 6485 'animation-duration': '', 6486 'animation-delay': '', 6487 'animation-timing-function': '', 6488 'animation-fill-mode': '', 6489 }); 6490 } 6491 }); 6492 }; 6493 6494 var scrollHashes = function(){ 6495 var hash = window.location.hash.replace('#', '').split('/'), 6496 hashInd; 6497 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 6498 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 6499 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 6500 $.fn.fullpage.moveTo(hashInd+1); 6501 } 6502 } else if( hash[0] === '' ) { 6503 $.fn.fullpage.moveTo(1); 6504 } 6505 }; 6506 6507 var hideMenu = function( index, nextIndex ){ 6508 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 6509 return false; 6510 6511 var hMenu = UNCODE.menuHeight, 6512 transTime = hMenu * 2; 6513 6514 if ( index === 1 && nextIndex > 1 ) { 6515 hMenu = hMenu * -1; 6516 } else if ( index !== 1 && nextIndex === 1 ) { 6517 hMenu = 0; 6518 } else { 6519 return false;
6520 } 6521 6522 $masthead.css({ 6523 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 6524 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 6525 '-webkit-transition': 'transform 0.5s ease-in-out', 6526 'transition': 'transform 0.5s ease-in-out' 6527 }); 6528 }; 6529 6530 var shrinkMenu = function( index, nextIndex ){ 6531 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 6532 return false; 6533 6534 if ( index === 1 && nextIndex > 1 ) { 6535 $logo.addClass('shrinked'); 6536 $('div', $logo).each(function(index, val){ 6537 $(val).css({ 6538 'height': logoMinScale, 6539 'line-height': logoMinScale 6540 }); 6541 if ($(val).hasClass('text-logo')) { 6542 $(val).css({ 6543 'font-size': logoMinScale + 'px' 6544 }); 6545 } 6546 }); 6547 requestTimeout(function() { 6548 UNCODE.menuMobileHeight = $masthead.outerHeight(); 6549 }, 300); 6550 } else if ( index !== 1 && nextIndex === 1 ) { 6551 $logo.removeClass('shrinked'); 6552 $('div', $logo).each(function(index, val){ 6553 $(val).css({ 6554 'height': logoMaxScale, 6555 'line-height': logoMaxScale 6556 }); 6557 if ($(val).hasClass('text-logo')) { 6558 $(val).css({ 6559 'font-size': logoMaxScale + 'px' 6560 }); 6561 } 6562 }); 6563 requestTimeout(function() { 6564 UNCODE.menuMobileHeight = $masthead.outerHeight(); 6565 }, 300); 6566 } else { 6567 return false; 6568 } 6569 6570 }; 6571 6572 var anchorLink = function(){ 6573 6574 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 6575 var $this = $(e.currentTarget), 6576 hash = e.currentTarget.href.split('#'), 6577 current = window.location.href.split('#'), 6578 ind, 6579 currentMenuOpened = UNCODE.menuOpened, 6580 go = false; 6581 6582 var hash_url = hash[0].replace(/\/?$/, '/'), 6583 current_url = current[0].replace(/\/?$/, '/'); 6584 6585 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 6586 hash = '#'+hash[1]; 6587 e.preventDefault(); 6588 go = true; 6589 } 6590 6591 if ( go ) { 6592 6593 if ( $(hash).length ) { 6594 ind = $(hash).closest('.fp-section').index(); 6595 } else { 6596 hash = hash.slice(1); 6597 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 6598 } 6599 6600 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 6601 ind = $this.closest('.fp-section').index(); 6602 6603 UNCODE.menuOpened = false; 6604 6605 $.fn.fullpage.moveTo(ind+1); 6606 6607 UNCODE.menuOpened = currentMenuOpened; 6608 if (UNCODE.menuOpened) { 6609 if (UNCODE.wwidth < UNCODE.mediaQuery) { 6610 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 6611 } else { 6612 $('.mmb-container-overlay .overlay-close').trigger('click'); 6613 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 6614 } 6615 } 6616 6617 } 6618 6619 }); 6620 6621 $('.header-scrolldown').on('click', function(event) { 6622 event.preventDefault(); 6623 var scrollDown = $(this), 6624 ind = scrollDown.closest('.fp-section').index(); 6625 6626 $.fn.fullpage.moveTo(ind+2); 6627 }); 6628 6629 var anchor = $('.fp-section.active').data('anchor'); 6630 6631 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 6632 $('.menu-item').removeClass('active'); 6633 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 6634 } 6635 6636 }; 6637 6638 var slideLeave = function( index, nextIndex, direction ) { 6639 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 6640 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 6641 animationEnd = 'webkitAnimationEnd animationend', 6642 transitionEnd = 'webkitTransitionEnd transitionend', 6643 animOut = effect != 'scaleDown' ? effect + direction : effect, 6644 animIn, 6645 animInDelay = effect == 'scaleDown' ? 0 : 0, 6646 isFooter = false, 6647 isFooterNext = false, 6648 isHeader = false, 6649 isHeaderNext = false, 6650 containerOff = $container.offset().top, 6651 footerH = $footer.outerHeight(), 6652 timeout, 6653 dataHash = $nextSlide.attr('data-anchor'), 6654 player, iframe, 6655 footerCoeff; 6656 switch( direction ) { 6657 case 'up': 6658 animIn = 'moveFromTop'; 6659 break; 6660 default: 6661 animIn = 'moveFromBottom'; 6662 } 6663 6664 if ( $('body').hasClass('uncode-fullpage-trid') ) { 6665 animOut = animIn + 'trid'; 6666 animIn = animOut + 'In'; 6667 } else if ( UNCODE.isFullPageSnap ) { 6668 animIn = animOut = 'none'; 6669 } 6670 6671 hideMenu(index, nextIndex); 6672 shrinkMenu(index, nextIndex); 6673 6674 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 6675 if ($(this).attr('data-provider') == 'vimeo') { 6676 iframe = $(this).find('iframe'); 6677 player = new Vimeo.Player(iframe[0]); 6678 player.pause(); 6679 } else if ($(this).attr('data-provider') == 'youtube') { 6680 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 6681 } else { 6682 if ($(this).is('video')) { 6683 $(this)[0].volume = 0; 6684 $(this)[0].pause(); 6685 } 6686 } 6687 }); 6688 6689 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 6690 if ($(this).attr('data-provider') == 'vimeo') { 6691 iframe = $(this).find('iframe'); 6692 iframe.on('load', function(){ 6693 player = new Vimeo.Player(iframe); 6694 player.setVolume(0); 6695 player.play(); 6696 }); 6697 player = new Vimeo.Player(iframe); 6698 player.setVolume(0); 6699 player.play(); 6700 } else if ($(this).attr('data-provider') == 'youtube') { 6701 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 6702 } else { 6703 if ($(this).is('video')) { 6704 $(this)[0].volume = 0; 6705 $(this)[0].play(); 6706 } 6707 } 6708 }); 6709 6710 if ( $currentSlide.is($footer) ) 6711 isFooter = true; 6712 6713 if ( $nextSlide.is($footer) ) 6714 isFooterNext = true; 6715 6716 // if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer ) 6717 // window.location.hash = '#' + dataHash; 6718 6719 if ( ! UNCODE.isMobile && headerWithOpacity ) { 6720 if ( $currentSlide.is($header) ) 6721 $header.addClass('header-scrolled'); 6722 } 6723 6724 footerCoeff = footerH; 6725 6726 if ( UNCODE.isFullPageSnap ) { 6727 postLeaveActions( nextIndex ); 6728 activateBackWash( nextIndex ); 6729 activateKBurns( nextIndex ); 6730 requestTimeout(function(){ 6731 animationEndAction( index, nextIndex ); 6732 }, fp_anim_time+150); 6733 } else { 6734 if ( isFooterNext ) { 6735 6736 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 6737 $iscrollWrapper.addClass('no-scrolloverflow'); 6738 6739 $nextSlide 6740 .add($currentSlide) 6741 .addClass('uncode-scroll-front') 6742 .addClass('uncode-scroll-active') 6743 .addClass('uncode-scroll-visible'); 6744 $container.css({ 6745 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 6746 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 6747 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6748 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6749 }).off(transitionEnd) 6750 .one(transitionEnd, function(){ 6751 animationEndAction( index, nextIndex ); 6752 }); 6753 6754 } else if ( isFooter ) { 6755 6756 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 6757 .add($currentSlide) 6758 .addClass('uncode-scroll-front') 6759 .addClass('uncode-scroll-active') 6760 .addClass('uncode-scroll-visible'); 6761 $container.css({ 6762 '-webkit-transform': 'translate3d(0, 0, 0)', 6763 'transform': 'translate3d(0, 0, 0)', 6764 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6765 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 6766 }) 6767 .one(transitionEnd, function(){ 6768 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 6769 clearRequestTimeout(timeout); 6770 timeout = requestTimeout(function(){ 6771 $.fn.fullpage.moveTo(nextIndex); 6772 slideLeave( index-1, nextIndex, 'up' ); 6773 $container.off(transitionEnd); 6774 }, 50); 6775 } 6776 animationEndAction( index, nextIndex ); 6777 }); 6778 6779 } else { 6780 6781 postLeaveActions( nextIndex ); 6782 6783 if ( !$('body').hasClass('uncode-fullpage-trid') ) 6784 activateParallax( nextIndex, direction ); 6785 6786 var $outBg = $('.background-wrapper', $currentSlide); 6787 6788 $nextSlide 6789 .addClass('uncode-scroll-front') 6790 .addClass('uncode-scroll-active') 6791 .addClass('uncode-scroll-visible') 6792 .addClass('uncode-scroll-animating-in') 6793 .css({ 6794 'z-index':4, 6795 'animation-name': animIn, 6796 'animation-duration': fp_anim_time + 'ms', 6797 'animation-delay': '', 6798 'animation-timing-function': fp_easing, 6799 'animation-fill-mode': 'both', 6800 'transition': 'initial', 6801 }).off(animationEnd) 6802 .on(animationEnd, function(event) { 6803 if ( event.originalEvent.animationName === animIn ) { 6804 $(this) 6805 .addClass('uncode-scroll-already') 6806 .removeClass('uncode-scroll-front') 6807 .removeClass('uncode-scroll-animating-in') 6808 .css({ 6809 'animation-name': '', 6810 'animation-duration': '', 6811 'animation-delay': '', 6812 'animation-timing-function': '', 6813 'animation-fill-mode': '', 6814 'transition': 'initial', 6815 }); 6816 6817 $currentSlide 6818 .removeClass('uncode-scroll-active') 6819 .add($outBg) 6820 .css({ 6821 'animation-name': '', 6822 'animation-duration': '', 6823 'animation-delay': '', 6824 'animation-timing-function': '', 6825 'animation-fill-mode': '', 6826 'transition': 'initial', 6827 }); 6828 6829 animationEndAction( index, nextIndex ); 6830 6831 } 6832 6833 if ( nextIndex > 1 ) 6834 $('body').addClass('window-scrolled'); 6835 else 6836 $('body').removeClass('window-scrolled'); 6837 }); 6838 6839 $currentSlide 6840 .addClass('uncode-scroll-animating-out') 6841 .removeClass('uncode-scroll-front') 6842 .css({ 6843 'z-index':'1', 6844 'animation-name': animOut, 6845 'animation-duration': fp_anim_time + 'ms', 6846 'animation-delay': '', 6847 'animation-timing-function': fp_easing, 6848 'animation-fill-mode': 'both', 6849 'transition': 'initial', 6850 'will-change': 'auto' 6851 }).off(animationEnd) 6852 .on(animationEnd, function(event) { 6853 if ( event.originalEvent.animationName === animOut ) { 6854 $currentSlide.removeClass('uncode-scroll-animating-out'); 6855 } 6856 }); 6857 6858 if ( $('body').hasClass('uncode-fp-opacity') ) { 6859 $currentSlide.find('> div').css({ 6860 'animation-name': 'opacityout', 6861 'animation-duration': fp_anim_time + 'ms', 6862 'animation-delay': '', 6863 'animation-timing-function': fp_easing, 6864 'animation-fill-mode': 'both', 6865 'transition': 'initial', 6866 }).off(animationEnd) 6867 .on(animationEnd, function(event) { 6868 if ( event.originalEvent.animationName === 'opacityout' ) { 6869 $(event.currentTarget).css({ 6870 'animation-name': '', 6871 'animation-duration': '', 6872 'animation-delay': '', 6873 'animation-timing-function': '', 6874 'animation-fill-mode': '', 6875 'transition': '', 6876 }); 6877 } 6878 }); 6879 } 6880 } 6881 } 6882 6883 $('.scroll-top').on('click', function(e){ 6884 $.fn.fullpage.moveTo(1); 6885 return false;
6886 }); 6887 6888 }; 6889 6890 var init_fullPage = function(mode){ 6891 6892 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 6893 // scrollBar = false; 6894 // } 6895 6896 var checkFPeffects; 6897 6898 $container.fullpage({ 6899 sectionSelector: '.uncode-scroll-lock', 6900 scrollOverflow: true, 6901 scrollOverflowOptions: { 6902 click: false, 6903 preventDefaultException: { tagName:/.*/ } 6904 }, 6905 navigation: false, 6906 scrollBar: scrollBar, 6907 scrollingSpeed: fp_anim_time, 6908 verticalCentered: true, 6909 anchors: no_history ? false : dataNames, 6910 recordHistory: !no_history, 6911 afterRender: function(){ 6912 $('body').removeClass('fp-waiting'); 6913 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 6914 var $invisible = $(this).addClass('hidden-scroll');//, 6915 }); 6916 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 6917 var $visible = $(this).addClass('uncode-scroll-visible'), 6918 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 6919 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 6920 }); 6921 6922 $('ul.onepage-pagination a').on('click', function(e){ 6923 e.preventDefault(); 6924 var $a = $(this), 6925 toIndex = $a.data('index'); 6926 6927 $.fn.fullpage.moveTo(toIndex+1); 6928 }); 6929 6930 requestTimeout(function(){ 6931 scrollHashes(); 6932 }, 1000); 6933 6934 $(window).on('hashchange', function(e){ 6935 requestTimeout(function(){ 6936 scrollHashes(); 6937 }, 500); 6938 }); 6939 6940 anchorLink(); 6941 6942 if ( $('body').hasClass('uncode-fp-opacity') ) { 6943 $all.each(function(index, row) { 6944 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 6945 classBg; 6946 6947 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 6948 classBg = testmatch[0]; 6949 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 6950 } 6951 }); 6952 } 6953 6954 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 6955 $(window).on('menuOpen gdprOpen', function(){ 6956 $.fn.fullpage.setAutoScrolling(false); 6957 }).on('menuClose gdprClose', function(){ 6958 $.fn.fullpage.setAutoScrolling(true); 6959 }); 6960 } 6961 6962 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 6963 requestTimeout(function(){ 6964 $.fn.fullpage.setAutoScrolling(false); 6965 }, 1000); 6966 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 6967 $.fn.fullpage.setAutoScrolling(true); 6968 }); 6969 6970 if ( !UNCODE.isFullPageSnap ) { 6971 clearRequestTimeout(checkFPeffects); 6972 checkFPeffects = requestTimeout(function(){ 6973 activateBackWash( 1 ); 6974 activateKBurns( 1 ); 6975 }, 100); 6976 } 6977 6978 }, 6979 onLeave: function( index, nextIndex, direction ){ 6980 6981 if ( UNCODE.menuOpened || is_scrolling ) 6982 return false; 6983 6984 is_scrolling = true; 6985 6986 var event = new CustomEvent('fp-slide-leave'); 6987 window.dispatchEvent(event); 6988 6989 slideLeave( index, nextIndex, direction ); 6990 6991 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 6992 if ( direction === 'up' ) { 6993 $.fn.fullpage.moveTo(nextIndex-1); 6994 } else { 6995 $.fn.fullpage.moveTo(nextIndex+1); 6996 } 6997 return false; 6998 } 6999 7000 $('ul.onepage-pagination a').removeClass('is-selected'); 7001 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7002 7003 } 7004 }); 7005 }; 7006 7007 init_fullPage(); 7008 $(window).on('load', function(){ 7009 requestTimeout(function(){ 7010 $.fn.fullpage.reBuild(); 7011 }, 3000); 7012 }); 7013 7014 var addScrollingClass, 7015 removeScrollingClass; 7016 7017 window.addEventListener("fp-slide-scroll", function(){ 7018 addScrollingClass = requestTimeout( function(){ 7019 $('body').addClass('fp-slide-scrolling'); 7020 }, 10 ); 7021 7022 clearRequestTimeout(removeScrollingClass); 7023 removeScrollingClass = requestTimeout( function(){ 7024 $('body').removeClass('fp-slide-scrolling'); 7025 }, 150 ); 7026 7027 Waypoint.refreshAll(); 7028 }, false); 7029 7030 var setFPheight = function(){ 7031 var $body = document.body, 7032 $footer = document.getElementById('colophon'), 7033 $maincontainer = document.querySelector('.main-wrapper'), 7034 $boxcontainer = document.querySelector('.box-container'), 7035 rect = $maincontainer.getBoundingClientRect(), 7036 rect2 = $boxcontainer.getBoundingClientRect(); 7037 $body.style.height = UNCODE.wheight + 'px'; 7038 if ( theres_footer ) 7039 $footer.style.top = (rect.height || rect2.height) + 'px'; 7040 }; 7041 7042 setFPheight(); 7043 7044 window.addEventListener('resize', setFPheight, false); 7045 window.addEventListener('orientationchange', setFPheight, false); 7046 7047}; 7048 7049UNCODE.particles = function() { 7050 $(".vc-particles-background").each(function() { 7051 var $particle = $(this); 7052 var $parent = $particle.closest('[data-parent]'); 7053
7054 $parent.prepend($particle); 7055 // $(window).trigger('resize'); 7056 }) 7057}; 7058 7059 7060UNCODE.filters = function() { 7061 var $systems = $('.isotope-system, .cssgrid-system'); 7062 7063 $systems.each(function(index, val){ 7064 var $system = $(this), 7065 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 7066 $widgets = $('.widgetized-cb-wrapper', $system), 7067 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 7068 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 7069 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 7070 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 7071 7072 if ($system.hasClass('isotope-processed')) { 7073 return; 7074 } 7075 7076 $cats_trigger.on('click', function(e) { 7077 if ( ! $('html').hasClass('screen-sm') ) { 7078 // $widgets.add($sorting_dd).slideUp(400); 7079 e.preventDefault(); 7080 $widgets.slideUp(400, 'easeInOutCirc'); 7081 } 7082 }); 7083 7084 $('.filters-toggle-trigger', $system).on('click', function(e) { 7085 e.preventDefault(); 7086 var $filters = $('.isotope-filters .menu-horizontal', $system); 7087 $filters.slideToggle(400, 'easeInOutCirc'); 7088 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7089 }); 7090 7091 $widget_trgr.on('click', function(e) { 7092 e.preventDefault(); 7093 $widgets.slideToggle(400, 'easeInOutCirc'); 7094 if (!$('html').hasClass('screen-sm')) { 7095 $cats_filters.slideUp(400, 'easeInOutCirc'); 7096 } 7097 window.dispatchEvent(new CustomEvent('boxResized')); 7098 }); 7099 7100 $sorting_trgr.on('click', function(e) { 7101 e.preventDefault(); 7102 if (!$('html').hasClass('screen-sm')) { 7103 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7104 } 7105 }); 7106 7107 $system.addClass('isotope-processed'); 7108 }); 7109 7110}; 7111 7112UNCODE.widgets = function() { 7113 var widget_collapses = $('.widget-collapse'); 7114 7115 widget_collapses.each(function(){ 7116 var widget_collapse = $(this), 7117 widget_title = widget_collapse.find('.widget-title'), 7118 widget = widget_title.closest('.widget'), 7119 content = widget.children().not('.widget-title'), 7120 setCTA; 7121 7122 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 7123 widget_title.toggleClass('open'); 7124 } 7125 7126 widget_title.each(function() { 7127 var _this = $(this); 7128 var content = _this.closest('.widget').find('.widget-collapse-content'); 7129 7130 $(window).on('load resize', function(){ 7131 clearRequestTimeout(setCTA); 7132 setCTA = requestTimeout( function() { 7133 if ( content.is(':visible') ) { 7134 _this.addClass( 'open' ); 7135 } else { 7136 _this.removeClass( 'open' ); 7137 } 7138 }, 10 ); 7139 }) 7140 7141 _this.on( 'click', function(){ 7142 7143 // Get content of :after element (+ icon) to check the visibility 7144 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 7145 7146 if (icon_content === 'none' || !icon_content) { 7147 return false; 7148 } 7149 7150 _this.toggleClass('open'); 7151 var isOpen = _this.hasClass('open'), 7152 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 7153 content.animate({ 7154 height: 'toggle', 7155 padding: 'toggle', 7156 opacity: 'toggle', 7157 top: isOpen ? 0 : hasBorder 7158 }, { 7159 duration: 400, 7160 easing: "easeInOutCirc", 7161 }); 7162 7163 return false; 7164 7165 }); 7166 }); 7167 }); 7168 7169 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 7170}; 7171 7172UNCODE.unmodal = function() { 7173 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 7174 $('.unmodal-overlay').fadeIn(); 7175 $('.unmodal-overlay').addClass('loading'); 7176 $('body').addClass('uncode-unmodal-overlay-visible'); 7177 $(window).trigger('unmodal-open'); 7178 }); 7179 7180 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 7181 $('.unmodal-overlay').fadeOut(); 7182 $('.unmodal').fadeOut(); 7183 $('body').removeClass('uncode-unmodal-overlay-visible'); 7184 $('body').removeClass('uncode-unmodal-open'); 7185 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 7186 $(document).trigger('unmodal-close'); 7187 UNCODE.isUnmodalOpen = false; 7188 }); 7189 7190 $(document).on('uncode-unmodal-show-content', function() { 7191 $('.unmodal-overlay').removeClass('loading'); 7192 $('.unmodal').show(); 7193 $('.unmodal').addClass('show-unmodal-with-animation'); 7194 $('.unmodal-content')[0].scrollTop = 0; 7195 $('body').addClass('uncode-unmodal-open'); 7196 UNCODE.isUnmodalOpen = true; 7197 7198 if ($('body').hasClass('qw-body-scroll-disabled')) { 7199 $('html').addClass('uncode-unmodal-body-disable-scroll'); 7200 } 7201 7202 if ($('.unmodal').hasClass('auto-height')) { 7203 set_modal_height(); 7204 } 7205 }); 7206 7207 var set_modal_height = function() { 7208 var modal = $('.unmodal'); 7209 var window_height = $(window).outerHeight(); 7210 var modal_height = modal.outerHeight(); 7211 7212 modal.css('height', 'auto'); 7213 7214 if (modal_height > window_height) { 7215 modal.outerHeight(window_height); 7216 } 7217 } 7218 7219 if ($('.unmodal').hasClass('auto-height')) { 7220 var setCTA; 7221 7222 $(window).on('resize', function() { 7223 clearRequestTimeout(setCTA); 7224 setCTA = requestTimeout(function() { 7225 set_modal_height(); 7226 }, 100); 7227 }); 7228 } 7229}; 7230 7231UNCODE.bgChanger = function() { 7232 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 7233 $bg_first = $('.vc_row[data-bg-remove]'), 7234 bg_remove = $bg_first.attr('data-bg-remove'), 7235 $first = $bg_changers.first(), 7236 $last = $bg_changers.last(), 7237 $bg_wrapper = $('#changer-back-color'), 7238 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 7239 setCTA, localH = UNCODE.wheight, 7240 isScrolling; 7241 7242 $bg_first.removeClass(bg_remove); 7243 7244 var bgChange = function($col, bgColor, skin, tmbskin){ 7245 $bg_wrapper.attr( 'class', bgColor ); 7246 var menuskin; 7247 if ( typeof skin !== 'undefined' ) { 7248 menuskin = skin.replace('style', 'menu') 7249 } 7250 7251 if ( $col.length ) { 7252 $('.uncol[data-skin-change]').each(function(){ 7253 var $isoFooter = $('.isotope-footer', this); 7254 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 7255 if ( menuskin !== '' ) {
7256 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 7257 } 7258 }); 7259 7260 $('.tmb[data-skin-change]').each(function(){ 7261 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 7262 }); 7263 } 7264 }; 7265 7266 var $masthead = $('#masthead'), 7267 transDesktop, 7268 transMobile, 7269 changeSkin, 7270 7271 checkTransparencyAndChange = function( skin ){ 7272 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 7273 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 7274 changeSkin = $masthead.hasClass('menu-change-skin'); 7275 7276 if ( ! transDesktop && ! transMobile ) { 7277 return false; 7278 } 7279 7280 if ( ! changeSkin ) { 7281 return false; 7282 } 7283 7284 if ( skin === 'style-light' ){ 7285 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7286 return false; 7287 } else if ( skin === 'style-dark' ) { 7288 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7289 return false; 7290 } 7291 }; 7292 7293 var bg_waypoints = function(){ 7294 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 7295 7296 $.each($bg_changers, function(index, row) { 7297 7298 var $row = $(row), 7299 $col = $('.uncol[data-skin-change]', $row).eq(0), 7300 skin, 7301 $tmbs, 7302 tmbskin, 7303 bgColor = $row.attr('data-bg-color'); 7304 7305 if ( ! $row.is(':visible') ) { 7306 return false; 7307 } 7308 7309 if ( $col.length ) { 7310 skin = $col.attr('data-skin-change'); 7311 $tmbs = $('.tmb[data-skin-change]', $row); 7312 tmbskin = skin.replace('style', 'tmb'); 7313 } 7314 7315 if ( ! $row.hasClass('unscroll-horizontal') ) { 7316 $row.waypoint(function( dir ) { 7317 if ( dir === 'down' ) { 7318 bgChange($col, bgColor, skin, tmbskin); 7319 checkTransparencyAndChange(skin); 7320 } else { 7321 return; 7322 } 7323 }, {
7324 offset: '50%' 7325 }); 7326 7327 $row.waypoint(function( dir ) { 7328 if ( dir === 'up' ) { 7329 bgChange($col, bgColor, skin, tmbskin); 7330 checkTransparencyAndChange(skin); 7331 } else { 7332 return; 7333 } 7334 }, { 7335 offset: function() { 7336 var clH = this.element.clientHeight, 7337 wH = window.innerHeight, 7338 ret = clH > 200 ? -100 : clH * -0.5; 7339 return ( wH / 2 ) - clH; 7340 } 7341 }); 7342 } 7343 7344 }); 7345 7346 $('body').addClass('bg-changer-init'); 7347 7348 } 7349 }; 7350 7351 var body = document.body, 7352 edges = false; 7353 7354 var throttle = function(fn, wait) { 7355 var time = Date.now(); 7356 return function() { 7357 if ((time + wait - Date.now()) < 0) { 7358 fn(); 7359 time = Date.now(); 7360 } 7361 } 7362 } 7363 7364 var $wrapper = document.querySelector(".main-wrapper"), 7365 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 7366 7367 var $title = document.querySelector('#rotating'); 7368 if ( $title !== null ) { 7369 $title.style.whiteSpace = 'nowrap'; 7370 $title.style.transition = 'transform 200ms linear'; 7371 } 7372 7373 window.addEventListener( 'scroll', throttle( function() { 7374 window.clearRequestTimeout( isScrolling ); 7375 7376 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 7377 7378 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 7379 body = document.body, 7380 html = document.documentElement, 7381 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 7382 $row = false, 7383 firstOff, 7384 lastOff; 7385 7386 if ( scrolled < 100 && $first.length ) { 7387 firstOff = $first.offset().top; 7388 if ( firstOff < 100 ) { 7389 var $row = $first; 7390 } 7391 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 7392 lastOff = $last.offset().top + $last.outerHeight(); 7393 if ( lastOff > ( docH - 100 ) ) { 7394 var $row = $last; 7395 } 7396 } 7397 7398 if ( $row.length ) { 7399 var $col = $('.uncol[data-skin-change]', $row).eq(0), 7400 skin, 7401 $tmbs, 7402 tmbskin, 7403 bgColor = $row.attr('data-bg-color'); 7404 7405 if ( $col.length ) { 7406 skin = $col.attr('data-skin-change'); 7407 $tmbs = $('.tmb[data-skin-change]', $row); 7408 tmbskin = skin.replace('style', 'tmb'); 7409 } 7410 7411 bgChange($col, bgColor, skin, tmbskin); 7412 checkTransparencyAndChange(skin); 7413 edges = true; 7414 } 7415 7416 }, 150); 7417 7418 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 7419 bg_waypoints(); 7420 Waypoint.refreshAll(); 7421 edges = false; 7422 } 7423 7424 }, 100), false); 7425 7426 $(window).on('resize', function() { 7427 clearRequestTimeout(setCTA); 7428 setCTA = requestTimeout(function() { 7429 if ( localH != UNCODE.wheight ) { 7430 localH = UNCODE.wheight; 7431 bg_waypoints(); 7432 Waypoint.refreshAll(); 7433 } 7434 }, 100); 7435 }); 7436 7437 bg_waypoints(); 7438 7439}; 7440 7441UNCODE.skewIt = function() { 7442 7443 if ( $('body').hasClass('compose-mode') ) { 7444 return; 7445 } 7446 7447 var justscrolled = false; 7448 7449 var loadSkewIt = function(){ 7450 7451 var $pageHeader = $('#page-header'), 7452 $page_body = $('.page-body'), 7453 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 7454 7455 if ( $header_skew.length ) { 7456 $pageHeader.addClass('uncode-skew').css({ 7457 position: 'relative', 7458 zIndex: 1 7459 }); 7460 $header_skew.removeClass('uncode-skew'); 7461 $page_body.css({ 7462 position: 'relative', 7463 zIndex: 0 7464 }); 7465 } 7466 7467 var $skew = $('.uncode-skew'), 7468 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 7469 horizontal = $horizontal.length, 7470 stopSkewing, 7471 lastOffset = 0, 7472 lastDate = Date.now(); 7473 7474 if ( ! $skew.length ) { 7475 return; 7476 } 7477 7478 var dropSkew = function(){ 7479 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 7480 return; 7481 7482 $skew.each(function(){ 7483 var $this = $(this), 7484 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 7485 7486 if ( $drop.length ) { 7487 $this.css({ 7488 'transform': 'skew(0)' 7489 }); 7490 var bound = $this[0].getBoundingClientRect(); 7491 $drop.css({ 7492 left: bound.x * -1, 7493 top: bound.y * -1, 7494 }); 7495 } 7496 }); 7497 }; 7498 dropSkew(); 7499 7500 $(window).on('resize', dropSkew); 7501 7502 window.addEventListener( 'scroll', function() { 7503 7504 if ( justscrolled !== true ) { 7505 justscrolled = true; 7506 return; 7507 } 7508 7509 window.clearRequestTimeout( stopSkewing ); 7510 7511 var now = Date.now(), 7512 delayInMs = now - lastDate, 7513 offset = window.pageYOffset || window.document.documentElement.scrollTop, 7514 newOffset = offset - lastOffset, 7515 speed = Math.pow((newOffset / delayInMs), 3) * -1, 7516 body = document.body, 7517 html = document.documentElement, 7518 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 7519 wait = 50, 7520 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 7521 7522 if ((lastDate + wait - now) < 0) { 7523 7524 lastDate = now; 7525 lastOffset = offset; 7526 7527 if ( speed > 6 ) { 7528 speed = 6; 7529 } else if ( speed < -6 ) { 7530 speed = -6; 7531 } 7532 7533 if ( speed > 2 && offset < UNCODE.wheight ) { 7534 speed = 2; 7535 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 7536 speed = -2; 7537 } 7538 7539 var speedY = speed, 7540 speedX = speed * 1.25; 7541 7542 if ( horizontal ) { 7543 speedY = 0; 7544 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 7545 speedX = 0; 7546 return; 7547 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 7548 speedX = 0; 7549 return; 7550 } 7551 } else { 7552 speedX = 0; 7553 } 7554 7555 if ( ! $skew.closest('.enter-st').length ) { 7556 speedX = 0; 7557 } 7558 7559 gsap.killTweensOf($skew); 7560 gsap.to( $skew, { 7561 duration: 0.2, 7562 skewY: (speedY * maxSpeed) + "deg", 7563 skewX: (speedX * maxSpeed) + "deg", 7564 ease: Power0.easeNone, 7565 transformOrigin: 'center', 7566 }); 7567 7568 } 7569 7570 stopSkewing = requestTimeout(function() { 7571 gsap.killTweensOf($skew); 7572 gsap.to( $skew, { 7573 duration: 0.5, 7574 skewY: "0deg", 7575 skewX: "0deg", 7576 transformOrigin: 'center', 7577 ease: Expo.easeOut, 7578 }); 7579 7580 $skew.each(function(){ 7581 var $this = $(this), 7582 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 7583 7584 if ( $drop.length ) { 7585 var bound = $this[0].getBoundingClientRect() 7586 $drop.css({ 7587 left: bound.x * -1, 7588 top: bound.y * -1, 7589 }); 7590 } 7591 }); 7592 7593 }, 200); 7594 7595 }, false); 7596 7597 }; 7598 7599 $(window).on('load', loadSkewIt); 7600 7601}; 7602 7603UNCODE.rotateIt = function() { 7604 7605 if ( $('body').hasClass('compose-mode') ) { 7606 return; 7607 } 7608 7609 var loadRotateIt = function(){ 7610 7611 var $toRotate = $('.uncode-rotate'); 7612 7613 $toRotate.each(function(){ 7614 var $rotate = $(this), 7615 deg = 0, 7616 dir = true, 7617 coeff = 1, 7618 lastOffset = 0, 7619 lastDate = Date.now(); 7620 7621 var checkScroll = function($rotate){ 7622 // if ( ! $rotate.length ) { 7623 // return; 7624 // } 7625 7626 var now = Date.now(), 7627 delayInMs = now - lastDate, 7628 offset = window.pageYOffset || window.document.documentElement.scrollTop, 7629 newOffset = offset - lastOffset, 7630 speed = (newOffset / delayInMs) * 5, 7631 body = document.body, 7632 html = document.documentElement, 7633 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 7634 7635 lastDate = now; 7636 lastOffset = offset; 7637 7638 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 7639 deg = 0; 7640 } 7641 7642 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 7643 deg = parseFloat(deg) + parseFloat(speed); 7644 } 7645 7646 if ( $rotate.hasClass('uncode-rotate-hover') ) { 7647 $rotate.hover(function(){ 7648 coeff = 1.75; 7649 }, function(){ 7650 coeff = 1; 7651 }); 7652 } 7653 7654 // if ( speed > 0 ) { 7655 // dir = true 7656 // } else if ( speed < 0 ) { 7657 // dir = false 7658 // } 7659 7660 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 7661 deg = deg+coeff; 7662 // if ( dir ) { 7663 // deg = deg+coeff; 7664 // } else { 7665 // deg = deg-coeff; 7666 // } 7667 } 7668 7669 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 7670 7671 requestAnimationFrame(function() { 7672 checkScroll($rotate); 7673 }); 7674 7675 }; 7676 7677 checkScroll($rotate); 7678 7679 }); 7680 7681 }; 7682 7683 $(window).on('load', loadRotateIt); 7684 7685}; 7686 7687var marqueeAttempts = 0, 7688 marqueeTO; 7689 7690UNCODE.textMarquee = function( $titles ) { 7691 7692 if ( typeof $titles == 'undefined' ) { 7693 $titles = $('.un-text-marquee'); 7694 } 7695 7696 if ( ! $titles.length ) { 7697 return; 7698 } 7699 7700 $titles.each(function(){ 7701 var $title = $(this), 7702 $span = $('> span', $title), 7703 txt, 7704 first = true, 7705 newW = UNCODE.wwidth; 7706 7707 $('.marquee-clone-wrap', $title).remove(); 7708 7709 txt = $title.text(); 7710 7711 if ( ! $('.marquee-original-core', $span).length ) { 7712 $span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 7713 } 7714 7715 var checkResize, 7716 spanW, 7717 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 7718 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 7719 clearSpeed, 7720 speed = 10; 7721 7722 $span.prepend($prepended); 7723 $span.append($appended); 7724 7725 var continuousTextMarquee = function(){ 7726 var bound = $title.css({ 7727 'transform': 'none', 7728 'opacity': 0 7729 }).offset(); 7730 7731 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 7732 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 7733 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 7734 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 7735 7736 var marqueeTL = new TimelineMax({paused:true, reversed:true}); 7737 7738 var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0]; 7739 7740 var inview = new Waypoint.Inview({ 7741 element: inViewElement, 7742 enter: function(direction) { 7743 marqueeTL.play(); 7744 }, 7745 exited: function(direction) { 7746 marqueeTL.pause(); 7747 } 7748 }); 7749 7750 //gsap.killTweensOf($title);
7751 marqueeTL.fromTo( $title, { 7752 opacity: 1, 7753 x: xStrt 7754 }, 7755 { 7756 duration: xSpeed / UNCODE.wwidth * speed, 7757 x: xEnd * direction, 7758 onComplete: function(){ 7759 first = false; 7760 continuousTextMarquee(); 7761 }, 7762 ease: Linear.easeNone 7763 }); 7764 }; 7765 7766 var runTextMarquee = function(){ 7767 var time = Date.now(); 7768 7769 var textMarqueeScroll = function(){ 7770 var $row = $title.closest('.vc_row'), 7771 $bound = $title.closest('.pin-spacer').length ? $row : $title, 7772 bound = $bound[0].getBoundingClientRect(), 7773 wait = 100, 7774 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1; 7775 7776 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 7777 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 7778 marqueeAttempts < 2 ) { 7779 7780 clearRequestTimeout(marqueeTO); 7781 7782 marqueeTO = requestTimeout(function(){ 7783 marqueeAttempts++; 7784 UNCODE.textMarquee(); 7785 }, 100); 7786 } 7787 7788 //if ((time + wait - Date.now()) < 0) { 7789 //if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) { 7790 // $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)'; 7791 gsap.killTweensOf($title); 7792 gsap.to( $title, { 7793 duration: 0.24, 7794 x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction, 7795 //ease: Expo.easeOut, 7796 }); 7797 //} 7798 //time = Date.now(); 7799 //} 7800 }; 7801 7802 textMarqueeScroll(); 7803 $(window).on( 'load scroll', function() { 7804 textMarqueeScroll(); 7805 }); 7806 7807 }; 7808 7809 var cloneSpan = function($_title, cntnt){ 7810 7811 if ( $_title.hasClass('un-marquee-infinite') ) { 7812 $('> span.marquee-clone-wrap', $_title).text(''); 7813 } 7814 7815 gsap.to( $_title, { 7816 duration: 0, 7817 x: 0 7818 }); 7819 spanW = $span.outerWidth(); 7820 7821 if ( !spanW ) { 7822 return; 7823 } 7824 7825 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2; 7826 7827 if ( $_title.hasClass('un-marquee-infinite') ) { 7828 7829 for ( var i = 0; i < part; i++ ) { 7830 $prepended[0].textContent += cntnt + "\u00A0"; 7831 $appended[0].textContent += cntnt + "\u00A0"; 7832 } 7833 } 7834 7835 if ( $('body').hasClass('compose-mode') ) { 7836 return; 7837 } 7838 7839 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 7840 continuousTextMarquee(); 7841 } 7842 7843 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 7844 runTextMarquee(); 7845 } 7846 7847 }; 7848 7849 var marqueResize = function(){ 7850 clearRequestTimeout(checkResize); 7851 checkResize = requestTimeout(function(){ 7852 if ( newW !== UNCODE.wwidth ) { 7853 gsap.killTweensOf($title); 7854 UNCODE.textMarquee(); 7855 newW = UNCODE.wwidth; 7856 } 7857 }, 1000); 7858 }; 7859 7860 $(window).off('resize', marqueResize) 7861 .on( 'resize', marqueResize); 7862 7863 cloneSpan($title, txt); 7864 7865 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 7866 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 7867 // imageHover(); 7868 var $_titles = $('.un-text-marquee',e.view.$el); 7869 UNCODE.textMarquee($_titles); 7870 }); 7871 } 7872 }); 7873 7874}; 7875 7876UNCODE.parallax = function() { 7877 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 7878 if ($('.parallax-el').length > 0) { 7879 var parallax_elements = new Rellax('.parallax-el'); 7880 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 7881 window.addEventListener('boxResized', function(e) { 7882 parallax_elements.refresh(); 7883 }, false); 7884 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 7885 requestTimeout(function() { 7886 parallax_elements.refresh(); 7887 }, 100); 7888 }); 7889 7890 } 7891 } 7892}; 7893 7894UNCODE.magicCursor = function(){ 7895 var $customCursor = $('#uncode-custom-cursor'), 7896 $customPilot = $('#uncode-custom-cursor-pilot'), 7897 $postLists = $('.uncode-post-titles'), 7898 currentCursor = 'auto', 7899 setTime, 7900 isScrolling, 7901 mouseEvent; 7902 7903 function delayChangeCursor(cursorType, delayt_time){ 7904 clearRequestTimeout(setTime); 7905 setTime = requestTimeout(function() { 7906 $customCursor.attr('data-cursor', cursorType); 7907 if ( $customPilot.length ) { 7908 $customPilot.attr('data-cursor', cursorType); 7909 }
7910 currentCursor = cursorType; 7911 }, delayt_time); 7912 } 7913 7914 function changeCursor($wrap){ 7915 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 7916 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]', 7917 $href = $wrap.find(href), 7918 cursorType, 7919 setTime, set_delay; 7920 7921 $href.hover(function(e) { 7922 var $this = $(this), 7923 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 7924 is_frontend_editor = $this.closest('.vc_controls').length, 7925 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 7926 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 7927 if ( is_frontend_editor ) { 7928 cursorType = 'auto'; 7929 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 7930 cursorType = data_cursor; 7931 } else if ( $parent_cursor.length ) { 7932 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 7933 cursorType = 'icon-light'; 7934 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 7935 cursorType = 'icon-diff'; 7936 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 7937 cursorType = 'icon-accent'; 7938 } else { 7939 cursorType = 'icon-dark'; 7940 } 7941 } else { 7942 cursorType = 'pointer'; 7943 } 7944 delayChangeCursor(cursorType, 0); 7945 }, function(){ 7946 delayChangeCursor('auto', 150); 7947 }); 7948 7949 $(window).on('disable-hover', function(event) { 7950 document.addEventListener("mousemove", function(e) { 7951 mouseEvent = e; 7952 }); 7953 delayChangeCursor('auto', 0); 7954 }); 7955 7956 $(window).on('enable-hover', function(event) { 7957 if ( typeof mouseEvent !== 'undefined' ) { 7958 var x = mouseEvent.clientX, 7959 y = mouseEvent.clientY; 7960 7961 var elements = document.elementsFromPoint(x, y), 7962 $element = $(elements[0]); 7963 7964 $element.closest(href).trigger('mouseenter'); 7965 } 7966 }); 7967 7968 } 7969 7970 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 7971 changeCursor(); 7972 }); 7973 7974 $(document).ajaxComplete(function( event, xhr, settings ) { 7975 changeCursor(); 7976 }); 7977 7978 $('.isotope-container').on('isotope-layout-complete', function() { 7979 var $this = $(this); 7980 changeCursor($this); 7981 }); 7982 7983}; 7984 7985UNCODE.magneticCursor = function(){ 7986 function magneticCursor($wrap){ 7987 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 7988 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')); 7989 7990 $magnetics.on('mousemove', function(e){ 7991 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 7992 bound = e.currentTarget.getBoundingClientRect(), 7993 coeff = 30, 7994 hor = (bound.width / 2) - (e.clientX - bound.left), 7995 ver = (bound.height / 2) - (e.clientY - bound.top), 7996 toX = hor / bound.width * coeff, 7997 toY = ver / bound.height * coeff, 7998 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 7999 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 8000 toScale = Math.max(scaleX, scaleY); 8001 8002 gsap.killTweensOf($el); 8003 gsap.to( $el, { 8004 duration: 0.75, 8005 x: toX, 8006 y: toY, 8007 scale: toScale, 8008 ease: Power1.easeOut, 8009 transformPerspective: 900, 8010 transformOrigin: 'center', 8011 force3D: true 8012 }); 8013 }).on('mouseout', function(e){ 8014 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 8015 gsap.killTweensOf($el); 8016 gsap.to( $el, { 8017 duration: 0.6, 8018 y: 0, 8019 x: 0, 8020 scale: 1, 8021 ease: Power1.easeOut, 8022 transformPerspective: 900, 8023 transformOrigin: 'center', 8024 force3D: true 8025 }); 8026 }); 8027 }; 8028 8029 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8030 magneticCursor(); 8031 }); 8032 8033 $(document).ajaxComplete(function( event, xhr, settings ) { 8034 magneticCursor(); 8035 }); 8036 8037 $('.isotope-container').on('isotope-layout-complete', function() { 8038 var $this = $(this); 8039 magneticCursor($this); 8040 }); 8041 8042}; 8043 8044UNCODE.dropImage = function() { 8045 8046 /**************************** 8047 * Image hover * 8048 ****************************/ 8049 function imageHover(){ 8050 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8051 return; 8052 } 8053 8054 var $postLists = $('.uncode-post-titles'); 8055 $postLists.each(function(){ 8056 var $list = $(this), 8057 timing = parseFloat( $list.attr('data-timing') ), 8058 default_image = $list.hasClass('uncode-post-titles-default-image'), 8059 default_title = $list.hasClass('uncode-post-titles-default-title'), 8060 $tmbs = $('.tmb', $list), 8061 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 8062 clientX, 8063 clientY, 8064 $row_parent = $list.closest('.vc_row'), 8065 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 8066 $col_parent = $list.closest('.uncell'), 8067 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 8068 setCTA; 8069 8070 timing *= 0.001; 8071 8072 var drop_bgs = function(){ 8073 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 8074 var $drop = $(this), 8075 srcset = $drop.attr('data-bgset'), 8076 setArr = srcset.split(","), 8077 setArrOrder = [], 8078 biggest = 0, 8079 checkBg = false;
8080 8081 if ( SiteParameters.uncode_adaptive == true ) { 8082 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 8083 $drop.css({ 8084 'background-image' : 'url(' + setArr[0] + ')' 8085 }); 8086 } 8087 } else { 8088 for ( var i = 0; i < setArr.length; i++ ) { 8089 var setLoop = setArr[i].trim().split(" "); 8090 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 8091 var parseSet = parseFloat(setLoop[1]); 8092 if ( biggest < parseSet ) { 8093 biggest = parseSet; 8094 } 8095 setArrOrder[parseSet] = setLoop[0]; 8096 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 8097 checkBg = true; 8098 $drop.css({ 8099 'background-image' : 'url(' + setLoop[0] + ')' 8100 }); 8101 } 8102 } 8103 } 8104 8105 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 8106 $drop.css({ 8107 'background-image' : 'url(' + setArrOrder[biggest] + ')' 8108 }); 8109 } 8110 } 8111 8112 }); 8113 }; 8114 8115 drop_bgs(); 8116 8117 var dropMovesSize = function(){ 8118 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 8119 return; 8120 } 8121 $drop_moves.each(function(){ 8122 var $drop_move = $(this), 8123 dataW = $drop_move.attr('data-w'), 8124 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 8125 if ( typeof dataW !== 'undefined' && dataW !== null ) { 8126 dataW = screenInfo.width / 12 * parseFloat( dataW ); 8127 } 8128 $drop_moves.css({ 8129 width: dataW 8130 }); 8131 8132 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8133 $anim_parent.on('animationend', function(){ 8134 var bound = $anim_parent[0].getBoundingClientRect(); 8135 $drop_move.css({ 8136 left: bound.x * -1, 8137 top: bound.y * -1, 8138 }); 8139 }); 8140 } 8141 }); 8142 8143 8144 }; 8145 8146 dropMovesSize(); 8147 8148 $(window).on( 'resize', function(){ 8149 clearRequestTimeout(setCTA); 8150 setCTA = requestTimeout( function() { 8151 drop_bgs(); 8152 dropMovesSize(); 8153 }, 100 ); 8154 }); 8155 8156 if ( $drop_row_parents.length ) { 8157 $row_parent.addClass( 'drop-added' ); 8158 } 8159 8160 $drop_row_parents.each(function(index, val){ 8161 var $drop = $(val); 8162 $row_parent.prepend($drop); 8163 manageVideos($drop, false); 8164 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8165 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8166 } 8167 if ( default_image && index == 0 ) { 8168 manageVideos($drop, true); 8169 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8170 image_ph = new Image(); 8171 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8172 image_ph.onload = function() { 8173 $drop.addClass('active'); 8174 if ( default_title ) { 8175 $list.addClass('drop-hover'); 8176 $tmbs.first().addClass('drop-active'); 8177 } 8178 }; 8179 image_ph.src = bg_img; 8180 } 8181 } 8182 }); 8183 8184 if ( $drop_col_parents.length ) { 8185 $col_parent.addClass( 'drop-added' ); 8186 } 8187 8188 $drop_col_parents.each(function(index, val){ 8189 var $drop = $(this); 8190 $col_parent.prepend($drop); 8191 manageVideos($drop, false); 8192 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8193 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8194 } 8195 if ( default_image && index == 0 ) { 8196 manageVideos($drop, true); 8197 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8198 image_ph = new Image(); 8199 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8200 image_ph.onload = function() { 8201 $drop.addClass('active'); 8202 if ( default_title ) { 8203 $list.addClass('drop-hover'); 8204 $tmbs.first().addClass('drop-active'); 8205 } 8206 }; 8207 image_ph.src = bg_img; 8208 } 8209 } 8210 }); 8211 8212 function manageVideos( $el, start ) { 8213 var videoElem = $('video', $el), 8214 $iframe = $('iframe', $el), 8215 iframeID = $iframe.attr('id'); 8216 if ( videoElem.length ) { 8217 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 8218 if ( start ) { 8219 videoElem[0].setCurrentTime(0); 8220 videoElem[0].play(); 8221 } else { 8222 videoElem[0].pause(); 8223 videoElem[0].setCurrentTime(0); 8224 } 8225 } else { 8226 if ( start ) { 8227 videoElem[0].currentTime = 0; 8228 videoElem[0].play(); 8229 } else { 8230 videoElem[0].pause(); 8231 videoElem[0].currentTime = 0; 8232 } 8233 } 8234 } 8235 8236 $el.data('active', start); 8237 8238 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 8239 var iframeIDv = iframeID.replace('okplayer-', ''), 8240 optionsV = $(window).data('okoptions-' + iframeIDv), 8241 vimeo = $iframe[0], 8242 playerV = new Vimeo.Player(vimeo), 8243 timeV = 0; 8244 8245 if (optionsV.time != null) { 8246 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 8247 for ( var i = 0; i < timeArr.length; i++ ) { 8248 if ( timeArr[i] === 'h' ) { 8249 timeV += parseFloat(timeArr[i-1]) * 3600; 8250 } else if ( timeArr[i] === 'm' ) { 8251 timeV += parseFloat(timeArr[i-1]) * 60; 8252 } else if ( timeArr[i] === 's' ) { 8253 timeV += parseFloat(timeArr[i-1]); 8254 } 8255 } 8256 } 8257 playerV.setCurrentTime(timeV); 8258 if ( start ) { 8259 playerV.setVolume(0); 8260 playerV.play(); 8261 } else { 8262 playerV.pause(); 8263 } 8264 } else if ( $el.attr('data-provider') === 'youtube' ) { 8265 if ( start ) { 8266 $el.trigger('uncode-resume'); 8267 } else { 8268 $el.trigger('uncode-pause'); 8269 } 8270 } 8271 8272 } 8273 8274 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 8275 8276 document.addEventListener("mousemove", function(e) { 8277 $drop_moves.each(function(){ 8278 var $drop_move = $(this), 8279 duration = 0.4; 8280 8281 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 8282 duration = 0.8; 8283 } 8284 8285 clientX = e.clientX; 8286 clientY = e.clientY; 8287 8288 gsap.to( $drop_move, { 8289 duration: duration, 8290 x: clientX, 8291 y: clientY, 8292 ease: Power1.easeOut, 8293 }); 8294 }); 8295 }); 8296 8297 } else { 8298 8299 $(window).on("touchend scroll", function(e) { 8300 $list.removeClass('drop-hover'); 8301 $drop_moves.removeClass('active'); 8302 $tmbs.removeClass('drop-active'); 8303 }); 8304 8305 $drop_moves.each(function(){ 8306 var $drop_move = $(this), 8307 $tmb = $drop_move.closest('.tmb'), 8308 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 8309 8310 if ( $anim_parent.hasClass('uncode-skew') ) { 8311 $anim_parent.css({ 8312 'transform': 'skew(0)' 8313 }); 8314 } 8315 8316 $tmb.on('touchend', function(e){ 8317 e.stopPropagation(); 8318 8319 $drop_moves.removeClass('active'); 8320 $tmbs.removeClass('drop-active'); 8321 8322 $list.addClass('drop-hover'); 8323 $tmb.addClass('drop-active'); 8324 $drop_move.addClass('active'); 8325 manageVideos($drop_move, true); 8326 clientX = e.changedTouches[0].clientX; 8327 clientY = e.changedTouches[0].clientY; 8328 8329 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8330 var bound = $anim_parent[0].getBoundingClientRect(); 8331 clientX = clientX - bound.x; 8332 clientY = clientY - bound.y; 8333 } 8334 8335 $drop_move.css({ 8336 left: clientX, 8337 top: clientY 8338 }); 8339 }); 8340 }); 8341 8342 } 8343 8344 $tmbs.each(function(e){ 8345 var $tmb = $(this), 8346 // $trgr = $('a', $tmb), 8347 $trgr = $tmb, 8348 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 8349 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
8349(.t-inside), .parallax-el'), 8350 $video = $('video', $tmb), 8351 $iframe = $('iframe', $tmb), 8352 $entryTxt = $('.t-entry-text', $tmb), 8353 stopBounding; 8354 8355 $entryTxt.add($drop_move).css({ 8356 'transition-duration': timing + 's' 8357 }); 8358 8359 if ( $video.length ) { 8360 var vidH = $video[0].videoHeight, 8361 vidW = $video[0].videoWidth; 8362 $video.css({ 8363 'height': vidH, 8364 'width': vidW 8365 }); 8366 } 8367 8368 if ( $iframe.length ) { 8369 var vidH = $drop_move.attr('data-height'), 8370 vidW = $drop_move.attr('data-width'); 8371 $iframe.css({ 8372 'height': vidH, 8373 'width': vidW 8374 }); 8375 } 8376 8377 $iframe.each(function(){ 8378 var $video = $(this), 8379 vidH = $video[0].videoHeight, 8380 vidW = $video[0].videoWidth; 8381 $video.css({ 8382 'height': vidH, 8383 'width': vidW 8384 }); 8385 }); 8386 8387 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 8388 $trgr.on('mouseenter',function(e){ 8389 $list.addClass('drop-hover'); 8390 $tmbs.removeClass('drop-active'); 8391 $tmb.addClass('drop-active'); 8392 $drop_move.addClass('active'); 8393 manageVideos($drop_move, true); 8394 8395 var clientX = e.clientX, 8396 clientY = e.clientY; 8397 $drop_move.css({ 8398 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 8399 }); 8400 8401 }) 8402 .on('mouseleave', function(e){ 8403 $list.removeClass('drop-hover'); 8404 $drop_move.css({ 8405 'transition-duration': ( timing*1.25 ) + 's' 8406 }); 8407 $drop_move.removeClass('active'); 8408 $tmb.removeClass('drop-active'); 8409 $drop_move.on('transitionend', function(e){ 8410 $drop_move.off('transitionend'); 8411 $drop_move.css({ 8412 'transition-duration': timing + 's' 8413 }); 8414 manageVideos($drop_move,false); 8415 }); 8416 }); 8417 8418 document.addEventListener('visibilitychange', function(){ 8419 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 8420 $drop_move.css({ 8421 'transition-duration': '0s' 8422 }); 8423 $drop_move.removeClass('active'); 8424 manageVideos($drop_move, false); 8425 } 8426 }); 8427 8428 document.addEventListener('scroll', function(){ 8429 window.clearRequestTimeout( stopBounding ); 8430 8431 if ( $drop_move.hasClass('active') ) { 8432 $list.removeClass('drop-hover'); 8433 $tmbs.removeClass('drop-active'); 8434 $drop_move.removeClass('active'); 8435 $drop_move.on('transitionend', function(e){ 8436 $drop_move.off('transitionend'); 8437 $drop_move.css({ 8438 'transition-duration': timing + 's' 8439 }); 8440 manageVideos($drop_move,false); 8441 }); 8442 } 8443 8444 stopBounding = requestTimeout(function() { 8445 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8446 var bound = $anim_parent[0].getBoundingClientRect(); 8447 $drop_move.css({ 8448 left: bound.x * -1, 8449 top: bound.y * -1, 8450 }); 8451 } 8452 }, 200); 8453 8454 }); 8455 } 8456 8457 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 8458 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 8459 8460 $drop.css({ 8461 'transition-duration': timing + 's' 8462 }); 8463 8464 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 8465 $trgr.on('mouseenter',function(e){ 8466 $row_parent.add($col_parent).addClass('drop-list-loaded'); 8467 $list.addClass('drop-hover'); 8468 8469 if ( !$tmb.hasClass('drop-active') ) { 8470 $tmbs.removeClass('drop-active'); 8471 $tmb.addClass('drop-active'); 8472 if ( default_image && !$drop.hasClass('active') ) { 8473 var $prev = $('[data-drop].active', $row_parent); 8474 $prev.css({ 8475 'transition-duration': (timing*1.5) + 's' 8476 }); 8477 $prev.removeClass('active'); 8478 $prev.on('transitionend', function(e){ 8479 $prev.off('transitionend'); 8480 manageVideos($prev,false); 8481 }); 8482 } 8483 $drop.css({ 8484 'transition-duration': timing + 's' 8485 }); 8486 $drop.off('transitionend'); 8487 $drop.addClass('active'); 8488 manageVideos($drop, true); 8489 } 8490 }) 8491 .on('mouseleave', function(e){ 8492 if ( ( default_image && !default_title ) || !default_image ) { 8493 $list.removeClass('drop-hover'); 8494 $tmb.removeClass('drop-active'); 8495 } 8496 if ( ! default_image ) { 8497 $drop.css({ 8498 'transition-duration': (timing*1.5) + 's' 8499 }); 8500 $drop.removeClass('active'); 8501 8502 $drop.on('transitionend', function(e){ 8503 $drop.off('transitionend'); 8504 manageVideos($drop,false); 8505 }); 8506 } 8507 }); 8508 8509 document.addEventListener('visibilitychange', function(){ 8510 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 8511 $drop.css({ 8512 'transition-duration': '0s' 8513 }); 8514 $drop.removeClass('active'); 8515 manageVideos($drop, false); 8516 } 8517 }); 8518 } 8519 }); 8520 8521 }); 8522 }; 8523 8524 $(window).on('load', function(event) { 8525 imageHover(); 8526 }); 8527 8528 var drop_wp_animation = function() { 8529 var $postLists = $('.uncode-post-titles'); 8530 $postLists.each(function(){ 8531 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 8532 new Waypoint({ 8533 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 8534 element: val, 8535 handler: function() { 8536 var element = $(this.element), 8537 parent = element.closest('.tmb'), 8538 currentIndex = parent.index(),
8539 delay = currentIndex, 8540 delayAttr = parseInt(element.attr('data-delay')); 8541 if (isNaN(delayAttr)) delayAttr = 100; 8542 var objTimeout = requestTimeout(function() { 8543 element.addClass('start_animation'); 8544 8545 var nextTimeout = requestTimeout(function() { 8546 $('.drop-image-separator', parent).addClass('start_animation'); 8547 }, 50); 8548 8549 }, delay * delayAttr); 8550 if (!UNCODE.isUnmodalOpen) { 8551 this.destroy(); 8552 } 8553 }, 8554 offset: UNCODE.isFullPage ? '100%' : '90%' 8555 }) 8556 }); 8557 }); 8558 } 8559 8560 var runWaypoints_TO, 8561 runWaypoints_delay = 0; 8562 8563 var runWaypoints = function(){ 8564 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 8565 runWaypoints_delay = 400; 8566 } 8567 clearRequestTimeout(runWaypoints_TO); 8568 runWaypoints_TO = requestTimeout(function() { 8569 drop_wp_animation(); 8570 }, runWaypoints_delay); 8571 }; 8572 runWaypoints(); 8573 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 8574 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8575 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 8576 // imageHover(); 8577 runWaypoints(); 8578 }); 8579 } 8580}; 8581 8582UNCODE.postTable = function() { 8583 8584 var clickRow = function(){ 8585 var $postLists = $('.uncode-post-table'); 8586 8587 $postLists.each(function(){ 8588 var $postList = $(this), 8589 $tmbClicks = $('.tmb.tmb-click-row', $postList); 8590 8591 $tmbClicks.each(function(){ 8592 var $tmb = $(this), 8593 $click = $('.table-click-row', $tmb); 8594 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 8595 e.preventDefault(); 8596 e.stopPropagation(); 8597 $click[0].click(); 8598 return false; 8599 }); 8600 }); 8601 8602 }) 8603 }; 8604 8605 clickRow(); 8606 8607 var hoverRow = function(){ 8608 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 8609 8610 $postLists.on('mouseenter', function(){ 8611 $(this).addClass('post-table-hover'); 8612 }); 8613 $postLists.on('mouseleave', function(){ 8614 $(this).removeClass('post-table-hover'); 8615 }); 8616 } 8617 8618 hoverRow(); 8619 8620 var drop_wp_animation = function() { 8621 var $postLists = $('.uncode-post-table'); 8622 $postLists.each(function(){ 8623 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 8624 new Waypoint({ 8625 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 8626 element: val, 8627 handler: function() { 8628 var element = $(this.element), 8629 parent = element.closest('.tmb'), 8630 currentIndex = parent.index(), 8631 delay = currentIndex, 8632 delayAttr = parseInt(element.attr('data-delay')); 8633 if (isNaN(delayAttr)) delayAttr = 100; 8634 var objTimeout = requestTimeout(function() { 8635 element.addClass('start_animation'); 8636 }, delay * delayAttr); 8637 if (!UNCODE.isUnmodalOpen) { 8638 this.destroy(); 8639 } 8640 }, 8641 offset: UNCODE.isFullPage ? '100%' : '90%' 8642 }) 8643 }); 8644 }); 8645 } 8646 8647 var runWaypoints_TO, 8648 runWaypoints_delay = 0; 8649 8650 var runWaypoints = function(){ 8651 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 8652 runWaypoints_delay = 400; 8653 } 8654 clearRequestTimeout(runWaypoints_TO); 8655 runWaypoints_TO = requestTimeout(function() { 8656 drop_wp_animation(); 8657 }, runWaypoints_delay); 8658 }; 8659 runWaypoints(); 8660 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 8661 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8662 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 8663 runWaypoints(); 8664 // clickRow(); 8665 }); 8666 } 8667}; 8668 8669UNCODE.rotatingTxt = function($ctxt) { 8670 8671 if ( $('body').hasClass('compose-mode') ) { 8672 return; 8673 } 8674 8675 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 8676 var setCTA; 8677 8678 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 8679 var $heading = $(this), 8680 // debug = 0, 8681 cycle = 0, 8682 $trgt, 8683 $toMove, 8684 $highl, 8685 $col = $heading.closest('.uncont'), 8686 txt, 8687 arrTxt, 8688 textFadeIn, textFadeOut, 8689 removeWraps; 8690 8691 var defineObjs = function() { 8692 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 8693 var $rtx = $(this), 8694 fx = $rtx.attr('data-fx'), 8695 wait = $rtx.attr('data-wait'), 8696 $prev = $(this).prev().addClass('prev-rotating-start'), 8697 splitToMove = [], 8698 splitArray = [], 8699 lineArray = [], 8700 lineIndex = 0, 8701 lineStart = true, 8702 lineEnd = false, 8703 startSplit = false, 8704 $line_wrap = $rtx.closest('.heading-line-wrap'), 8705 same_line = true, 8706 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 8707 indexRtx = $splits.index($rtx); 8708 8709 fx = typeof fx === 'undefined' ? '' : fx;
8710 wait = typeof wait === 'undefined' ? '' : wait; 8711 8712 $splits.each(function(key, val){ 8713 var $split = $(this), 8714 $new_line_wrap = $split.closest('.heading-line-wrap'); 8715 8716 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 8717 splitArray.push( $split ); 8718 } 8719 8720 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 8721 startSplit = false; 8722 } 8723 8724 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 8725 splitArray.push( $split ); 8726 8727 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 8728 same_line = true; 8729 } else { 8730 same_line = false; 8731 } 8732 } 8733 8734 if ( key == indexRtx ) { 8735 if ( /\S/.test($split.text()) ) { 8736 startSplit = true; 8737 $line_wrap = $split.closest('.heading-line-wrap'); 8738 splitArray.push( $split ); 8739 } else { 8740 indexRtx++; 8741 } 8742 } 8743 8744 $line_wrap = $new_line_wrap; 8745 }); 8746 8747 $toMove = $($.map(splitToMove, function(el){return el.get();})); 8748 $trgt = $($.map(splitArray, function(el){return el.get();})); 8749 8750 if ( same_line ) { 8751 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 8752 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 8753 } 8754 8755 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 8756 $prev.addClass('empty-span-hidden'); 8757 } 8758 8759 $highl = $('.heading-text-highlight-inner', $trgt); 8760 8761 $rtx.attr('data-animated', 'true'); 8762 if ( cycle == 0 ) { 8763 $( document.body ).trigger('defer-highlights'); 8764 cycle++; 8765 defineObjs(); 8766 return; 8767 } 8768 cycle++; 8769 8770 txt = $rtx.attr('data-text'); 8771 arrTxt = txt.split("|"); 8772 8773 textFadeOut($trgt); 8774 8775 }); 8776 }; 8777 8778 removeWraps = function(){ 8779 8780 // if ( debug == 1 ) return; 8781 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 8782 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 8783 8784 8785 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 8786 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 8787 8788 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 8789 8790 $splitFlow.each(function(){ 8791 $(this).append($temp_highl); 8792 }); 8793 8794 var $line_wrap = $wraps[wrap_k]; 8795 var $parent_wrap = $line_wrap.parentNode; 8796 if ( $parent_wrap !== null ) { 8797 while ( $line_wrap.firstChild ) { 8798 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 8799 } 8800 $parent_wrap.removeChild($line_wrap); 8801 } 8802 } 8803 // debug++; 8804 defineObjs(); 8805 }; 8806 8807 var loop = 0; 8808 textFadeIn = function($trgt){ 8809 var word = arrTxt[loop].split(" "), 8810 worsSpan = '', 8811 $wrap = $trgt.closest('.uncode-rotating-wrap'), 8812 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 8813 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 8814 8815 for (var w = 0; w < word.length; w++) { 8816 var highl; 8817 if ( $highl.length ) { 8818 highl = $highl[0].outerHTML; 8819 } else { 8820 highl = ''; 8821 } 8822 8823 if ( w > 0 ) { 8824 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 8825 } 8826 var charachters = word[w].split(''); 8827 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 8828 for (var c = 0; c < charachters.length; c++) { 8829 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 8830 } 8831 worsSpan += '</span>' + highl + '</span></span>'; 8832 } 8833 8834 if ( $wrap.length && $wrap_inner.length ) { 8835 var words_w = $wrap_inner.outerWidth(); 8836 $wrap.css({ 8837 width: words_w 8838 }); 8839 8840 $highl = $('.heading-text-highlight-inner', $wrap); 8841 $highl.prependTo($wrap); 8842 8843 $wrap_inner.css({ 8844 opacity: 0 8845 }); 8846 8847 $wrap_inner.html(worsSpan); 8848 $('.heading-text-highlight-inner', $wrap_inner).remove(); 8849 words_w = $wrap_inner.innerWidth(); 8850 8851 var duration = 0.45; 8852 8853 $heading.removeClass('auto-width'); 8854 if ( words_w > $col.width() ) { 8855 $heading.addClass('auto-width'); 8856 words_w = 'auto'; 8857 duration = 0; 8858 } 8859 8860 $wrap.css({ 8861 'width': words_w, 8862 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 8863 }); 8864 8865 var $word_inner = $('.split-word-inner', $wrap_inner), 8866 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 8867 8868 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 8869 8870 if ( !$target_fx.length ) { 8871 return; 8872 } 8873 8874 gsap.killTweensOf($target_fx); 8875 8876 if ( fx !== 'zoom' ) { 8877 gsap.fromTo( $target_fx, { 8878 y: fx === 'opacity' ? '0%' : '-10%' 8879 },{ 8880 delay: duration, 8881 duration: 0.25, 8882 y: '0%', 8883 ease: Circ.easeOut, 8884 }); 8885 8886 if ( !$wrap_inner.length ) { 8887 return; 8888 } 8889 8890 gsap.fromTo( $wrap_inner, { 8891 opacity: 0, 8892 },{ 8893 delay: duration, 8894 duration: 0.25, 8895 opacity: 1, 8896 ease: Circ.easeOut, 8897 onComplete: function(){ 8898 $('> .heading-text-highlight-inner', $wrap).remove(); 8899 $wrap_inner.html(worsSpan); 8900 removeWraps(); 8901 } 8902 }) 8903 8904 } else { 8905 gsap.fromTo( $target_fx, { 8906 transformOrigin: '50%', 8907 opacity: 0, 8908 scale: 0.875, 8909 },{ 8910 opacity: 1, 8911 delay: duration, 8912 duration: 0.25, 8913 scale: 1, 8914 ease: Circ.easeOut, 8915 onComplete: function(){ 8916 $('> .heading-text-highlight-inner', $wrap).remove(); 8917 $wrap_inner.html(worsSpan); 8918 removeWraps(); 8919 } 8920 }); 8921 } 8922 8923 } else { 8924 8925 if ( !$wrap_inner.length ) { 8926 return; 8927 } 8928 8929 gsap.to( $wrap_inner, { 8930 duration: 0.4, 8931 opacity: 0, 8932 ease: Power1.easeOut, 8933 onComplete: function(){ 8934 $wrap_inner.html(worsSpan); 8935 words_w = $wrap_inner.innerWidth(); 8936 8937 gsap.to( $wrap_inner, { 8938 duration: 0.2, 8939 opacity: 1, 8940 ease: Power1.easeOut, 8941 onComplete: function(){ 8942 $('> .heading-text-highlight-inner', $wrap).remove(); 8943 $wrap_inner.html(worsSpan); 8944 removeWraps(); 8945 } 8946 }) 8947 } 8948 }); 8949 } 8950 8951 if ( loop < arrTxt.length-1 ) { 8952 loop++; 8953 } else { 8954 loop = 0; 8955 } 8956 8957 }; 8958 8959 textFadeOut = function($trgt){ 8960 var $word_inner = $('.split-word-inner', $trgt), 8961 $wrap = $trgt.closest('.uncode-rotating-wrap'), 8962 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 8963 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 8964 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 8965 8966 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 8967 8968 var gsap_param = { 8969 delay: wait, 8970 duration: 0.25, 8971 y: fx === '' ? '10%' : '0%', 8972 opacity: 0, 8973 ease: Circ.easeOut, 8974 onStart: function(){ 8975 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 8976 $highl = $('.heading-text-highlight-inner', $wrap); 8977 $highl.prependTo($wrap); 8978 } 8979 }, 8980 onComplete: textFadeIn, 8981 onCompleteParams: [$trgt] 8982 }; 8983 8984 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 8985 8986 if ( fx === '' ) { 8987 gsap_param.y = '10%'; 8988 } else if ( fx === 'zoom' ) { 8989 gsap_param.scale = '1.045'; 8990 } 8991 8992 if ( !$target_fx.length ) { 8993 return; 8994 } 8995 8996 if ( $heading.data('waypoint') !== true ) { 8997 var textInView = new Waypoint.Inview({ 8998 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 8999 element: $heading[0], 9000 enter: function(direction) { 9001 $heading.data('waypoint',true); 9002 gsap.fromTo( $target_fx, { 9003 transformOrigin: '50%' 9004 }, gsap_param ); 9005 } 9006 }); 9007 } else { 9008 gsap.fromTo( $target_fx, { 9009 transformOrigin: '50%' 9010 }, gsap_param ); 9011 } 9012 }; 9013 9014 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9015 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 9016 var $el = model.view.$el, 9017 shortcode = model.attributes.shortcode; 9018 9019 UNCODE.rotatingTxt($el); 9020 }); 9021 } else { 9022 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 9023 $heading.on('already-animated', function(){ 9024 removeWraps(); 9025 window.addEventListener('removeOldLines', function(){ 9026 clearRequestTimeout(setCTA); 9027 setCTA = requestTimeout( removeWraps, 150 ); 9028 }); 9029 }); 9030 } else { 9031 $(window).on('load', function(){ 9032 removeWraps(); 9033 window.addEventListener('removeOldLines', function(){ 9034 clearRequestTimeout(setCTA); 9035 setCTA = requestTimeout( removeWraps, 150 ); 9036 }); 9037 }); 9038 } 9039 } 9040 }); 9041 9042}; 9043 9044UNCODE.verticalText = function() { 9045 $(window).on('menuCanvasOpen', function(){ 9046 $('.vertical-text--fixed').fadeOut(500); 9047 $('.horizontal-text--fixed').fadeOut(500); 9048 }).on('menuCanvasClose', function(){ 9049 $('.vertical-text--fixed').fadeIn(500); 9050 $('.horizontal-text--fixed').fadeIn(500); 9051 }); 9052 9053 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 9054 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 9055 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 9056 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 9057 9058 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 9059 window.addEventListener('scroll', function(e) { 9060 var totalPageHeight = document.body.scrollHeight; 9061 var scrollPoint = window.scrollY + window.innerHeight; 9062 9063 if (window.scrollY > 0) { 9064 showOnTopVerticalTexts.fadeOut(); 9065 showOnTopHorizontalTexts.fadeOut(); 9066 } else { 9067 showOnTopVerticalTexts.fadeIn(); 9068 showOnTopHorizontalTexts.fadeIn(); 9069 } 9070 9071 if (scrollPoint >= totalPageHeight) { 9072 hideOnBottomVerticalTexts.fadeOut(); 9073 hideOnBottomHorizontalTexts.fadeOut(); 9074 } else { 9075 hideOnBottomVerticalTexts.fadeIn(); 9076 hideOnBottomHorizontalTexts.fadeIn(); 9077 } 9078 }, false); 9079 } 9080}; 9081 9082UNCODE.stickyScroll = function( $el ) { 9083 if ( typeof $el === 'undefined' || $el === null ) { 9084 $el = $('body'); 9085 } 9086 var checkVisible = function( el, dir ) { 9087 if (typeof jQuery === "function" && el instanceof jQuery) { 9088 el = el[0]; 9089 } 9090 9091 var off = 50; 9092 dir = typeof dir=='undefined' ? 'right' : dir; 9093 var rect = el.getBoundingClientRect(); 9094 9095 return ( 9096 ( 9097 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9098 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9099 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 9100 ) && 9101 ( 9102 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 9103 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 9104 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 9105 ( rect.right <= window.innerWidth && rect.left >= 0 ) 9106 ) 9107 ); 9108 }; 9109 9110 var setItemsRelHeight = function(reset) { 9111 var $_el = $el; 9112 if ( $el.is('.index-scroll') ) { 9113 var $_el = $el.closest('.uncont'); 9114 } 9115 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 9116 $.each($('.tmb', item), function(index, val) { 9117 if ( reset === true ) { 9118 $(val).css( 'visibility', 'hidden' ); 9119 } else { 9120 $(val).css( 'visibility', 'visible' ); 9121 } 9122 }); 9123 }); 9124 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 9125 $.each($('.tmb', item), function(index, val) { 9126 if ( reset === true ) { 9127 $(val).css( 'visibility', 'hidden' ); 9128 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 9129 } else { 9130 var $rowParent = $(item).closest('.row-parent'), 9131 rowRatio = $rowParent.attr('data-height-ratio'), 9132 $rowInner = $(item).closest('.row-child'), 9133 rowRatioInner = $rowInner.attr('data-height'), 9134 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9135 $colContainer = $(item).closest('.uncell'), 9136 $uncont = $(item).closest('.uncont'), 9137 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 9138 safe_heigth = $(item).data('safe-height'), 9139 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 9140 offSet = $(item).offset().top - $uncont.offset().top, 9141 multiplier_h, 9142 data_viewport_h, 9143 body_border = $('.body-borders .top-border').outerHeight() * 2, 9144 remove_menu = $(item).data('vp-menu'); 9145 9146 if ( rowRatio === 'full' || rowRatio === '' ) { 9147 rowRatio = 1; 9148 } else { 9149 rowRatio = rowRatio / 100; 9150 } 9151 9152 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 9153 rowRatio = rowRatio; 9154 } else { 9155 rowRatio = rowRatio * rowRatioInner / 100; 9156 } 9157 9158 winHeight = winHeight * rowRatio; 9159 9160 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9161 multiplier_h = parseInt($(item).attr('data-vp-height')); 9162 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 9163 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 9164 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 9165 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 9166 } 9167 9168 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 9169 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 9170 if ( remove_menu === true ) { 9171 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 9172 } 9173 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 9174 } else { 9175 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 9176 } 9177 9178 } 9179 }); 9180 }); 9181 $('.index-scroll', $_el).each(function(i, item){ 9182 var $uncoltable = $(item).closest('.uncoltable'), 9183 $rowParent = $(item).closest('.row-parent'), 9184 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9185 body_border = $('.body-borders .top-border').outerHeight() * 2, 9186 $index_row = $('.index-row', item), 9187 safe_heigth = $index_row.data('safe-height'), 9188 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 9189 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 9190 var data_viewport_h = winHeight - ( paddingRow + body_border ); 9191 $uncoltable.css({ 9192 'min-height': data_viewport_h 9193 }); 9194 } else { 9195 $uncoltable.css({ 9196 'min-height': 'auto' 9197 }); 9198 } 9199 }); 9200 9201 } 9202 setItemsRelHeight(); 9203 9204 var $index_scrolls = $('.index-scroll', $el); 9205
9206 $index_scrolls.each(function(key, value){ 9207 var $index = $(this), 9208 $parent_row = $index.closest('.vc_row[data-parent]'), 9209 $index_row = $('.index-row', $index), 9210 dir = $index_row.attr('data-direction'); 9211 dir = typeof dir === 'undefined' ? 'right' : dir; 9212 9213 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 9214 }); 9215 9216 var $horScrolls = $('.unscroll-horizontal', $el); 9217 9218 if ( $horScrolls.length ) { 9219 9220 $('body').addClass('scrolling-trigger'); 9221 9222 $horScrolls.each(function(key, value){ 9223 var $section = $(this), 9224 $index_scroll = $('.index-scroll', $section), 9225 $index_row = $('.index-row', $index_scroll), 9226 dir = $section.attr('data-direction'), 9227 wrap = $index_row.attr('data-wrap'), 9228 $pinWrap, 9229 $pinTrigger; 9230 9231 dir = typeof dir === 'undefined' ? 'right' : dir; 9232 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 9233 $pinWrap = $('<div class="pin-wrap" />'); 9234 if ( SiteParameters.is_frontend_editor ) { 9235 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 9236 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 9237 } else { 9238 if ( wrap === 'column' ) { 9239 $index_scroll.wrapInner( $pinWrap ); 9240 } else { 9241 $('> .row', $section).wrap( $pinWrap ); 9242 } 9243 $section.wrapInner( $pinTrigger ); 9244 } 9245 9246 }); 9247 9248 var $pinWraps = $('.pin-wrap', $el); 9249 9250 var horScrollSizes = function(){ 9251 9252 $pinWraps.each(function(key, val){ 9253 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 9254 $pinTrigger = $pinWrap.closest('.pin-trigger'), 9255 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 9256 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 9257 $boxContainer = $('.box-container'), 9258 box_m = $boxContainer.css('margin-left'), 9259 st_active = true; 9260 9261 var setHorW, 9262 horWidth = function(){ 9263 $index_scroll.each(function(){ 9264 var $this = $(this), 9265 $index_row = $('.index-row', $this), 9266 $rowContainer = $index_row.closest('.vc_row'), 9267 $rowInner = $index_row.closest('.wpb_row'), 9268 $rowParent = $index_row.closest('.row-parent'), 9269 $tmbs = $('.tmb', $index_row), 9270 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 9271 $uncont = $index_row.closest('.uncont'), 9272 $parent_col = $index_row.closest('.wpb_column'), 9273 col_w = $uncont.width(), 9274 data_lg = parseFloat( $index_row.attr('data-lg') ), 9275 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 9276 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 9277 tmb_w; 9278 9279 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 9280 tmb_w = ( col_w + padding_tmb ) / data_lg; 9281 9282 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 9283 tmb_w = ( col_w + padding_tmb ) / data_sm; 9284 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 9285 tmb_w = ( col_w + padding_tmb ) / data_md; 9286 } 9287 9288 if ( !isNaN(tmb_w) ) { 9289 $tmbs.css({ 9290 'width': tmb_w 9291 }); 9292 } 9293 9294 $tmbs.css({ 9295 'visibility': 'visible' 9296 }); 9297 9298 }); 9299 }; 9300 9301 horWidth(); 9302 clearRequestTimeout(setHorW); 9303 setHorW = requestTimeout( function(){ 9304 setItemsRelHeight(); 9305 horWidth(); 9306 }, 100 ); 9307 9308 if ( SiteParameters.is_frontend_editor ) { 9309 return; 9310 } 9311 9312 var $vmenu = $('body.vmenu .vmenu-container'), 9313 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 9314 winWidth = window.innerWidth - vmenuW, 9315 $tmb = $('.tmb', $index_scroll).eq(0), 9316 paddingRight = parseFloat( $tmb.css('padding-right') ), 9317 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 9318 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 9319 scroll_anim; 9320 9321 if ( $('body').hasClass('rtl') ) { 9322 if ( dir === 'left' ) { 9323 scroll_anim = gsap.fromTo( $pinWrap, { 9324 x: stickyScrollLength 9325 },{ 9326 x: 0, 9327 ease: "none" 9328 }); 9329 } else { 9330 scroll_anim = gsap.fromTo( $pinWrap, { 9331 x: 0 9332 },{ 9333 x: stickyScrollLength, 9334 ease: "none" 9335 }); 9336 } 9337 } else { 9338 if ( dir === 'left' ) { 9339 scroll_anim = gsap.fromTo( $pinWrap, { 9340 x: -stickyScrollLength 9341 },{ 9342 x: 0, 9343 ease: "none" 9344 }); 9345 } else { 9346 scroll_anim = gsap.fromTo( $pinWrap, { 9347 x: 0 9348 },{ 9349 x: -stickyScrollLength, 9350 ease: "none" 9351 }); 9352 } 9353 } 9354 9355 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 9356 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 9357 } 9358 9359 var animationIncrease; 9360 9361 var checkForAnimations = function(){ 9362 animationIncrease = 0 9363 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 9364 var _this = this, 9365 isScrolling; 9366 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 9367 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 9368 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 9369 requestTimeout(function() { 9370 $(_this).addClass('start_animation'); 9371 }, delayAttr + animationIncrease); 9372 animationIncrease += 150; 9373 } 9374 }); 9375 }; 9376 checkForAnimations(); 9377
9378 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 9379 var start = 0; 9380 9381 var horST = ScrollTrigger.create({ 9382 id: "stickySectionScrolling" + key, 9383 scrub: true, 9384 trigger: $pinTrigger[0], 9385 pin: true, 9386 anticipatePin: 1, 9387 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 9388 end: function() { return "+="+stickyScrollLength; }, 9389 animation: scroll_anim, 9390 ease: Sine.easeOut, 9391 onUpdate: checkForAnimations, 9392 invalidateOnRefresh: true, 9393 onEnter: function(){ 9394 $pinTrigger.addClass('enter-st'); 9395 }, 9396 onEnterBack: function(){ 9397 $pinTrigger.addClass('enter-st'); 9398 }, 9399 onLeave: function(){ 9400 $pinTrigger.removeClass('enter-st'); 9401 }, 9402 onLeaveBack: function(){ 9403 $pinTrigger.removeClass('enter-st'); 9404 } 9405 }); 9406 9407 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 9408 window.dispatchEvent(new CustomEvent('boxResized')); 9409 9410 var testSecondTrigger = function(){ 9411 animationIncrease = 0 9412 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 9413 var _this = this; 9414 if ( checkVisible(_this) ) { 9415 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 9416 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 9417 requestTimeout(function() { 9418 $(_this).addClass('start_animation'); 9419 }, delayAttr + animationIncrease); 9420 animationIncrease += 150; 9421 } 9422 }); 9423 9424 }; 9425 9426 var verST = ScrollTrigger.create({ 9427 id: "verticalSectionScrolling" + key, 9428 trigger: $pinTrigger[0], 9429 start: "top center", 9430 end: function() { return "+="+UNCODE.wheight; }, 9431 onUpdate: testSecondTrigger, 9432 invalidateOnRefresh: true 9433 }); 9434 9435 var setCTA, 9436 9437 dis_enable_ST = function(){ 9438 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 9439 horST.kill(); 9440 verST.kill(); 9441 $pinTrigger.addClass('disabled'); 9442 st_active = false; 9443 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 9444 horST.kill(); 9445 verST.kill(); 9446 $pinTrigger.addClass('disabled'); 9447 st_active = false; 9448 } 9449 }; 9450 9451 $(window).on('resize load', function() { 9452 clearRequestTimeout(setCTA); 9453 setCTA = requestTimeout(function() { 9454 dis_enable_ST(); 9455 checkForAnimations(); 9456 }, 500); 9457 }); 9458 9459 }); 9460 }; 9461 9462 $(window).on( 'load', function(){ 9463 horScrollSizes(); 9464 }); 9465 var setResize, 9466 doubleResize = true, 9467 oldW = UNCODE.wwidth; 9468 $(window).on( 'resize orientationchange', function(){ 9469 if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) { 9470 return; 9471 } else { 9472 oldW = UNCODE.wwidth; 9473 } 9474 setItemsRelHeight(true); 9475 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 9476 Array.prototype.forEach.call($row_inners, function(el) { 9477 el.style.height = ''; 9478 el.style.marginBottom = ''; 9479 }); 9480 clearRequestTimeout(setResize); 9481 setResize = requestTimeout( function(){ 9482 setItemsRelHeight(); 9483 horScrollSizes(); 9484 ScrollTrigger.refresh(); 9485 if ( doubleResize === true ) { 9486 window.dispatchEvent(new Event('resize')); 9487 doubleResize = false; 9488 } else { 9489 doubleResize = true; 9490 } 9491 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 9492 }, 100 ); 9493 }); 9494 9495 var show_pins = function(){ 9496 $('.index-scroll').css({'opacity':'1'}); 9497 setResize = requestTimeout( function(){ 9498 }, 10 ); 9499 }; 9500 ScrollTrigger.addEventListener("refresh", show_pins); 9501 $(window).on( 'uncode.re-layout', function(){ 9502 $('.index-scroll').css({'opacity':'0'}); 9503 ScrollTrigger.refresh(true); 9504 }); 9505 } 9506 9507}; 9508 9509UNCODE.stickyTrigger = function( $el ) { 9510 if ( SiteParameters.is_frontend_editor ) { 9511 return false; 9512 } 9513 9514 var stickyTrigger = function(){ 9515 var stickyTrick = $('.sticky-trigger').each(function(){ 9516 var $sticky = $(this), 9517 $inside = $('> div', $sticky), 9518 insideH = $inside.outerHeight(), 9519 $row = $sticky.closest('.vc_row'), 9520 $uncont = $sticky.closest('.uncont'), 9521 rowBottom, 9522 uncontBottom , 9523 diffBottom; 9524 9525 ScrollTrigger.create({ 9526 trigger: $sticky, 9527 start: function(){ return "top center-=" + insideH/2; }, 9528 endTrigger: $row, 9529 end: function(){ 9530 rowBottom = $row.offset().top + $row.outerHeight(); 9531 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 9532 diffBottom = rowBottom - uncontBottom; 9533 return "bottom center+=" + ( insideH/2 + diffBottom ); 9534 }, 9535 anticipatePin: true, 9536 pin: true, 9537 pinSpacing: false, 9538 scrub: true, 9539 invalidateOnRefresh: true, 9540 }); 9541 9542 }); 9543 }, 9544 setResizeSticky; 9545 9546 $(window).on( 'load', function(){ 9547 stickyTrigger(); 9548 }); 9549 $(window).on( 'resize', function(){ 9550 clearRequestTimeout(setResizeSticky); 9551 setResizeSticky = requestTimeout( function(){ 9552 stickyTrigger(); 9553 ScrollTrigger.refresh(); 9554 }, 1000 ); 9555 }); 9556 9557}; 9558 9559UNCODE.revslider = function() { 9560 $(window).on("load", function() { 9561 $('rs-module').each(function(){ 9562 var $slider = $(this); 9563 9564 $slider.on('revolution.slide.onloaded', function(e, data){ 9565 if ( $(e.currentTarget).closest(".header-revslider").length ) { 9566 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 9567 scrolltop = $(document).scrollTop(); 9568 if ( style != undefined ) { 9569 UNCODE.switchColorsMenu(scrolltop, style); 9570 } 9571 } 9572 }); 9573 9574 $slider.on('revolution.slide.onchange', function(e, data){ 9575 if ( $(e.currentTarget).closest(".header-revslider").length ) { 9576 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 9577 scrolltop = $(document).scrollTop(); 9578 if ( style != undefined ) { 9579 UNCODE.switchColorsMenu(scrolltop, style); 9580 } 9581 } 9582 }); 9583 9584 }); 9585 }); 9586}; 9587 9588UNCODE.layerslider = function() { 9589 $(window).on("load", function() { 9590 9591 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 9592 9593 var slideData = slider.slides.current.data, 9594 scrolltop = $(document).scrollTop(); 9595 if( slideData && slideData.skin ) { 9596 9597 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 9598 9599 } 9600 }); 9601 9602 }); 9603}; 9604 9605UNCODE.ajax_filters = function() { 9606 9607/************************* 9608 *
9609 * Filters Menu and Widgets Area 9610 * 9611 ************************/ 9612 9613 var clear_clicked = false; 9614 9615 var init_ajax_grid = function(){ 9616 9617 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 9618 $grids.each(function(index, val){ 9619 var $body = $('body'), 9620 $grid = $(val).addClass('init-ajax-grid'), 9621 starting_point = $grid.attr('data-toggle'), 9622 $trigger = $('.uncode-toggle-ajax-filters', $grid), 9623 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 9624 $isotope_wrapper = $('.isotope-wrapper', $grid), 9625 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 9626 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 9627 $footprint = $('.ajax-filter-footprint', $grid), 9628 sidebar_w, 9629 data_w = parseFloat( $sidebar.attr('data-max-width') ), 9630 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 9631 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 9632 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 9633 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 9634 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 9635 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 9636 sidew, 9637 $inside_row = $('> .row-parent', $vc_row), 9638 bg_row, 9639 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 9640 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 9641 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer), 9642 sidebar_overlay = false, 9643 sidebar_hover = false, 9644 switchMobile = false, 9645 scrollTop; 9646 9647 if ( $vc_row.attr('class') ) { 9648 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 9649 } 9650 9651 if ( bg_row != null ) { 9652 $side_header.add($side_footer).addClass(bg_row[0]); 9653 } 9654 9655 $trigger.add($apply_filters).on('click', function(e){ 9656 e.preventDefault(); 9657 e.stopPropagation(); 9658 $grid = $('.ajax-grid-system').eq(0); 9659 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 9660 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 9661 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9662 sidebar_w = $sidebar_wrapper.width(); 9663 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9664 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 9665 $(this).trigger('uncode-ajax-clear-filters'); 9666 } 9667 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9668 $grid.toggleClass('ajax-hide-filters-blanks'); 9669 $sidebar.slideToggle({ 9670 duration: 400, 9671 easing: 'easeOutQuad', 9672 }); 9673 } else { 9674 $grid.removeClass('ajax-hide-filters-blanks'); 9675 $grid.toggleClass('ajax-hide-filters'); 9676 if ( $grid.hasClass('ajax-hide-filters') ) { 9677 $body.addClass('ajax-hide-filters'); 9678 } else { 9679 scrollTop = $('html, body').scrollTop(); 9680 $body.removeClass('ajax-hide-filters'); 9681 } 9682 } 9683 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 9684 $('html, body').scrollTop(scrollTop); 9685 } 9686 return false; 9687 }); 9688 9689 $close_btn.on('click', function(e){ 9690 e.preventDefault(); 9691 $grid = $('.ajax-grid-system').eq(0); 9692 $grid.addClass('ajax-hide-filters'); 9693 if ( $grid.hasClass('ajax-hide-filters') ) { 9694 $body.addClass('ajax-hide-filters'); 9695 } else { 9696 scrollTop = $('html, body').scrollTop(); 9697 $body.removeClass('ajax-hide-filters'); 9698 } 9699 $('html, body').scrollTop(scrollTop); 9700 }); 9701 9702 $sidebar_wrapper.on('mouseover',function(){ 9703 sidebar_hover = true; 9704 }).on('mouseout', function(){ 9705 sidebar_hover = false; 9706 }); 9707 9708 $body.off('click').on('click', function( e, from ){ 9709 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 9710 return; 9711 } 9712 if (undefined !== from && from === 'select_active_attributes') { 9713 return; 9714 } 9715 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 9716 $grid.add($body).addClass('ajax-hide-filters'); 9717 } 9718 }); 9719 9720 $sorting_trgr.on('click', function(e) { 9721 e.preventDefault(); 9722 }); 9723 9724 var inside_width = function(){ 9725 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9726 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9727 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 9728 $inside_row = $('> .row-parent', $vc_row); 9729 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 9730 sidew = $sidebar.width(); 9731 $inside_row.css({ 9732 width: sidew 9733 }); 9734 } else { 9735 $inside_row.css({ 9736 width: '' 9737 }); 9738 } 9739 }; 9740 inside_width(); 9741 9742 var ajax_sidebar_position = function(e, f_editor){ 9743 $grid = $('.ajax-grid-system').eq(0); 9744 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 9745 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 9746 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 9747 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 9748 $inside_row = $('> .row-parent', $vc_row); 9749 scrollTop = $('html, body').scrollTop(); 9750 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 9751 $grid.add($body).addClass('ajax-hide-filters'); 9752 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 9753 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas'));
9754 sidebar_overlay = true; 9755 $body.addClass('ajax-filter-sidebar-overlay'); 9756 $sidebar_wrapper.addClass(skin); 9757 var sideHeadH = $side_header.outerHeight(), 9758 sideFooterH = $side_footer.outerHeight(); 9759 if ( data_w !== '' && data_w > 0 ) { 9760 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9761 $sidebar.css({ 9762 'max-width': data_w 9763 }); 9764 } else { 9765 $sidebar.css({ 9766 'max-width':'none' 9767 }); 9768 } 9769 } 9770 $vc_row.css({ 9771 'padding-top':sideHeadH, 9772 'padding-bottom':sideFooterH 9773 }); 9774 var sidew = $sidebar.width(); 9775 $inside_row.css({ 9776 width: sidew 9777 }); 9778 switchMobile = true; 9779 } else { 9780 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 9781 scrollTop = $('html, body').scrollTop(); 9782 $grid.add($body).removeClass('ajax-hide-filters'); 9783 } 9784 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 9785 $grid.addClass('ajax-hide-filters-blanks'); 9786 $sidebar.hide(); 9787 } 9788 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 9789 $('.ajax-sidebar-placeholder', $grid).remove(); 9790 sidebar_overlay = false; 9791 $body.removeClass('ajax-filter-sidebar-overlay'); 9792 $sidebar_wrapper.removeClass(skin); 9793 if ( data_w !== '' && data_w > 0 ) { 9794 $sidebar.css({ 9795 'max-width':'none' 9796 }); 9797 } 9798 $vc_row.css({ 9799 'padding-top':0, 9800 'padding-bottom':0, 9801 }); 9802 9803 $inside_row.css({ 9804 width: '' 9805 }); 9806 9807 if ( f_editor === true ) { 9808 UNCODE.ajax_filters(); 9809 } 9810 9811 switchMobile = false; 9812 } 9813 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 9814 $('html, body').scrollTop(scrollTop); 9815 } 9816 }; 9817 9818 var sidebar_width = function(){ 9819 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9820 sidebar_w = $footprint.width(); 9821 $sidebar.css({ width: sidebar_w }); 9822 } else { 9823 $sidebar.css({ width: '' }); 9824 } 9825 }; 9826 sidebar_width(); 9827 9828 if ( SiteParameters.is_frontend_editor ) { 9829 ajax_sidebar_position(); 9830 } 9831 9832 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 9833 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 9834 ajax_sidebar_position(e); 9835 } 9836 sidebar_width(); 9837 }); 9838 9839 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 9840 ajax_sidebar_position(e, true); 9841 }); 9842 9843 $isotope_wrapper.on('transitionend', function(e){ 9844 if ( $(e.target).hasClass('isotope-wrapper') ) { 9845 window.dispatchEvent(new CustomEvent('boxResized')); 9846 } 9847 return false; 9848 }); 9849 9850 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 9851 var $grid = $('.ajax-grid-system').eq(0); 9852 $grid.addClass('ajax-hide-filters'); 9853 } 9854 9855 }); 9856 }; 9857 9858 init_ajax_grid(); 9859 $(document).on('uncode-ajax-filtered', init_ajax_grid); 9860 9861/************************* 9862 * 9863 * Hover hack 9864 * 9865 ************************/ 9866 var widget_hover_hack = function() { 9867 $('.widget, .uncode_widget').each(function(){ 9868 var $widget = $(this), 9869 $lis = $('ul > li', $widget).has('a'), 9870 $footer = $widget.closest('#colophon'); 9871 9872 $lis.each(function(){ 9873 var $li = $(this), 9874 $a = $('a', $li), 9875 $label = $a.closest('label'); 9876 9877 if ( !$footer.length ) { 9878 $li.addClass('no-evts'); 9879 } 9880 9881 if ( ! $('span', $a).length ) { 9882 $li.addClass( 'li-hover' ); 9883 } 9884 9885 $('li', $li).hover(function(e){ 9886 $(e.target).parents('li').each(function(){ 9887 $(this).addClass( 'parent-li-hover' ); 9888 }); 9889 }, function(e){ 9890 $(e.target).parents('li').each(function(key, val){ 9891 if ( key === 0) { 9892 $(val).removeClass( 'parent-li-hover' ); 9893 } 9894 }); 9895 }); 9896 9897 $li.off('mouseup').on('mouseup', function(e){ 9898 e.stopPropagation(); 9899 var $a = $('a', this).first(); 9900 $a[0].click(); 9901 }); 9902 }); 9903 }); 9904 } 9905 widget_hover_hack(); 9906 $(document).on('uncode-ajax-filtered', widget_hover_hack); 9907 9908/************************* 9909 * 9910 * Init Filters 9911 * 9912 ************************/ 9913 9914 function init_filters() { 9915 $(document).on('click', '.term-filter-link', function(e) { 9916 var _this = $(this); 9917 var widget = _this.closest('.uncode_widget'); 9918 var container = get_filters_container(); 9919 9920 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 9921 return true; 9922 } 9923 9924 e.preventDefault(); 9925 9926 if (widget.hasClass('widget-ajax-filters--checkbox')) { 9927 _this.parent().find('input[type="checkbox"]').trigger('click'); 9928 } else { 9929 if (_this.hasClass('term-filter-link--active')) { 9930 _this.removeClass('term-filter-link--active'); 9931 } else { 9932 _this.addClass('term-filter-link--active'); 9933 9934 if (widget.hasClass('widget-ajax-filters--single')) { 9935 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 9936 } 9937 } 9938 9939 var url = _this.attr('href'); 9940 9941 reload_items(container, url, true); 9942 } 9943 }); 9944 9945 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 9946 var _this = $(this); 9947 var widget = _this.closest('.uncode_widget'); 9948 var link = _this.closest('.term-filter').find('.term-filter-link'); 9949 var url = link.attr('href'); 9950 var container = get_filters_container(); 9951 9952 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 9953 window.location = url; 9954 return; 9955 } 9956 9957 if (widget.hasClass('widget-ajax-filters--single')) { 9958 widget.find('input[type="checkbox"]').each(function() { 9959 if (_this.attr('id') !== $(this).attr('id')) { 9960 $(this).prop('checked', false); 9961 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 9962 } 9963 }); 9964 } 9965 9966 if (_this.prop('checked')) { 9967 link.addClass('term-filter-link--active'); 9968 } else { 9969 link.removeClass('term-filter-link--active'); 9970 } 9971 9972 reload_items(container, url, true); 9973 }); 9974 9975 $(document).on('change', 'select.select--term-filters', function(e) { 9976 var _this = $(this); 9977 var selected = _this.find('option:selected'); 9978 var option = $(selected); 9979 var url = option.attr('data-term-filter-url'); 9980 var container = get_filters_container(); 9981 var widget = _this.closest('.uncode_widget'); 9982 9983 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 9984 window.location = url; 9985 } else { 9986 reload_items(container, url, true); 9987 } 9988 }); 9989 9990 $(document).on('click', '.filter-list__link', function(e) { 9991 if (SiteParameters.is_frontend_editor) { 9992 return false;
9993 } 9994 9995 e.preventDefault(); 9996 9997 var _this = $(this); 9998 var container = get_filters_container(); 9999 var url = _this.attr('href'); 10000 reload_items(container, url, true); 10001 }); 10002 10003 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 10004 var _this = $(this); 10005 var container = get_filters_container(); 10006 var url = _this.attr('href'); 10007 reload_items(container, url, true); 10008 }); 10009 10010 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 10011 10012 var _this = $(this); 10013 var container = get_filters_container(); 10014 var url = _this.attr('href'); 10015 10016 if ( container.length ) { 10017 e.preventDefault(); 10018 reload_items(container, url, true); 10019 } 10020 }); 10021 10022 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 10023 var _this = $(this); 10024 var container = get_filters_container(); 10025 10026 if (container.length > 0) { 10027 e.preventDefault(); 10028 10029 var min_price = $('#min_price').val(); 10030 var max_price = $('#max_price').val(); 10031 var location = window.location; 10032 var url = location.href; 10033 var page_uri = location.origin + location.pathname; 10034 var is_filtered = page_uri !== url; 10035 10036 if (is_filtered) { 10037 url = remove_parameter_from_url(url, 'min_price'); 10038 url = remove_parameter_from_url(url, 'max_price'); 10039 } 10040 10041 var concat = page_uri === url ? '?' : '&'; 10042 var params = {'min_price': min_price, 'max_price': max_price}; 10043 10044 url = url + concat + $.param(params); 10045 10046 reload_items(container, url, true); 10047 } 10048 }); 10049 10050 var search_timer; 10051 10052 $(document).on('keyup', '.term-filters-search-input', function(e) { 10053 var _this = $(this); 10054 var container = get_filters_container(); 10055 var value = _this.val(); 10056 10057 if (search_timer) { 10058 clearTimeout(search_timer); 10059 } 10060 10061 search_timer = setTimeout(function() { 10062 update_search_url(container, value); 10063 }, 500); 10064 }); 10065 } 10066 10067 function update_search_url(container, search_value) { 10068 var location = window.location; 10069 var url = location.href; 10070 var page_uri = location.origin + location.pathname; 10071 var is_filtered = page_uri !== url; 10072 var key_search = SiteParameters.ajax_filter_key_search; 10073 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 10074 10075 if (is_filtered) { 10076 url = remove_parameter_from_url(url, key_search); 10077 url = remove_parameter_from_url(url, key_unfilter); 10078 } 10079 10080 if (search_value) { 10081 var concat = page_uri === url ? '?' : '&'; 10082 var params = {}; 10083 10084 params[key_search] = search_value; 10085 params[key_unfilter] = 1; 10086 url = url + concat + $.param(params); 10087 } else { 10088 url = remove_parameter_from_url(url, key_search); 10089 } 10090 10091 reload_items(container, url, true); 10092 } 10093 10094 function remove_parameter_from_url(url, parameter) { 10095 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 10096 } 10097 10098 function get_filters_container() { 10099 var container = $('.ajax-grid-system'); 10100 10101 if (container.length == 0) { 10102 container = $('.ajax-filters'); 10103 } 10104 10105 return container; 10106 } 10107 10108 function update_widgets_state(widgets_states, container) { 10109 for (var i = widgets_states.length - 1; i >= 0; i--) { 10110 var state = widgets_states[i]; 10111 10112 if (!state.collapse) { 10113 continue; 10114 } 10115 10116 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 10117 10118 if (state.open) { 10119 new_widget.find('.widget-title').addClass('open'); 10120 if (state.css) { 10121 new_widget.find('.widget-collapse-content').attr('style', state.css); 10122 } 10123 } else { 10124 new_widget.find('.widget-title').removeClass('open'); 10125 if (state.css) { 10126 new_widget.find('.widget-collapse-content').attr('style', state.css); 10127 } 10128 } 10129 } 10130 } 10131 10132 // Reload items via AJAX 10133 function reload_items(container, url, push) { 10134 container.addClass('grid-filtering'); 10135 10136 $.ajax({ 10137 url : url, 10138 success : function(response) { 10139 if (!response) { 10140 return; 10141 } 10142 10143 $(document).trigger('uncode-ajax-pre-filtered'); 10144 10145 var container_id = container.attr('id'); 10146 var pagination = $('.row-navigation'); 10147 10148 if (container_id) { 10149 var container_to_append = $(response).find('#' + container_id); 10150 var pagination_to_append = $(response).find('.row-navigation'); 10151 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10152 10153 // Remember open/closed widgets 10154 var widgets = $('.uncode_widget'); 10155 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 10156 var widgets_states = []; 10157 10158 widgets.each(function() { 10159 var widget = $(this); 10160 var id = widget.attr('data-id'); 10161 var state = { 10162 'id': id, 10163 'collapse': false, 10164 'open': false, 10165 'css': false, 10166 }; 10167 10168 var collapse_wrapper = widget.find('.widget-collapse-content'); 10169 10170 if (collapse_wrapper.length > 0) { 10171 state.collapse = true; 10172 10173 var collapse_wrapper_css = collapse_wrapper.attr('style'); 10174 var title = widget.find('.widget-title'); 10175 10176 state.css = collapse_wrapper_css; 10177 10178 if (title.hasClass('open')) { 10179 state.open = true; 10180 } else { 10181 state.open = false;
10182 } 10183 } 10184 10185 widgets_states.push(state); 10186 }); 10187 10188 // Update widgets state 10189 if (offcanvas_sidebar_wrapper.length === 0) { 10190 update_widgets_state(widgets_states, container_to_append); 10191 } 10192 10193 // Update default sidebar state 10194 if (!container.hasClass('ajax-hide-filters')) { 10195 container_to_append.removeClass('ajax-hide-filters'); 10196 } 10197 10198 // Update horizontal sidebar 10199 if (!container.hasClass('ajax-hide-filters-blanks')) { 10200 container_to_append.removeClass('ajax-hide-filters-blanks'); 10201 } 10202 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 10203 if (horizontal_sidebar_wrapper.length > 0) { 10204 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 10205 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 10206 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 10207 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 10208 10209 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 10210 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 10211 } 10212 10213 // Append container 10214 container.replaceWith(container_to_append); 10215 10216 // Append pagination 10217 if (pagination.length > 0) { 10218 if (pagination_to_append.length > 0) { 10219 pagination.html(pagination_to_append.html()); 10220 } else { 10221 pagination.html(''); 10222 } 10223 } else { 10224 if (pagination_to_append.length > 0) { 10225 $('.post-wrapper').append(pagination_to_append); 10226 } 10227 } 10228 10229 // Update off canvas sidebar (mobile and overlay) 10230 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10231 10232 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 10233 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 10234 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 10235 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 10236 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 10237 10238 // Update widgets state 10239 update_widgets_state(widgets_states, sidebar_to_append); 10240 10241 // Update sidebar 10242 sidebar_container.html(sidebar_to_append.html()); 10243 } 10244 10245 if (push) { 10246 UNCODE.lastURL = url; 10247 window.history.pushState( 10248 { pageTitle: document.title }, 10249 '', 10250 url 10251 ); 10252 } 10253 10254 if (typeof UNCODE.isotopeLayout !== 'undefined') { 10255 UNCODE.isotopeLayout(); 10256 } 10257 if (typeof UNCODE.justifiedGallery !== 'undefined') { 10258 UNCODE.justifiedGallery(); 10259 } 10260 if (typeof UNCODE.cssGrid !== 'undefined') { 10261 UNCODE.cssGrid(); 10262 } 10263 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 10264 UNCODE.lightbox(); 10265 } 10266 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 10267 UNCODE.lightgallery(); 10268 } 10269 if (typeof UNCODE.carousel !== 'undefined') { 10270 UNCODE.carousel($('body')); 10271 } 10272 UNCODE.animations(); 10273 if (typeof UNCODE.filters !== 'undefined') { 10274 UNCODE.filters(); 10275 } 10276 if (typeof UNCODE.widgets !== 'undefined') { 10277 UNCODE.widgets(); 10278 } 10279 10280 if (SiteParameters.dynamic_srcset_active === '1') { 10281 UNCODE.refresh_dynamic_srcset_size(); 10282 } 10283 10284 if (typeof UNCODE.menuSmartInit !== 'undefined') { 10285 UNCODE.menuSmartInit(); 10286 } 10287 10288 maybe_scroll_to_top(); 10289 10290 $(document).trigger('uncode-ajax-filtered'); 10291 $(document.body).trigger('init_price_filter'); 10292 } 10293 }, 10294 error: function() { 10295 container.removeClass('grid-filtering'); 10296 10297 if (SiteParameters.enable_debug == true) { 10298 // This console log is disabled by default 10299 // So nothing is printed in a typical installation 10300 // 10301 // It can be enabled for debugging purposes setting 10302 // the 'uncode_enable_debug_on_js_scripts' filter to true 10303 console.log('There was an error retrieving the products'); 10304 } 10305 } 10306 }); 10307 } 10308 10309 // Scroll to top after filtering 10310 function maybe_scroll_to_top() { 10311 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10312 10313 if (offcanvas_sidebar_wrapper.length > 0) { 10314 return; 10315 } 10316 10317 var container = get_filters_container(); 10318 var bound = container[0].getBoundingClientRect(); 10319 10320 if (bound.y < 0) { 10321 $(window).scrollTop(container.offset().top); 10322 } 10323 } 10324 10325 // Back/forward browser buttons 10326 $(window).on("popstate.ajaxfilters", function(e) { 10327 var location = window.location; 10328 var url = location.href; 10329 var params = UNCODE.getURLParams(window.location); 10330 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 10331 10332 UNCODE.lastURL = url; 10333 10334 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 10335 return; 10336 } 10337 10338 var container = get_filters_container(); 10339 10340 reload_items(container, url, false); 10341 }); 10342 10343 // Destroy load more before to init a new one 10344 $(window).on('uncode-ajax-pre-filtered', function() { 10345 if ($.fn.infinitescroll) { 10346 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 10347 } 10348 }); 10349 10350 init_filters(); 10351}; 10352 10353 UNCODE.init = function() { 10354 var wfl_check = false, wfl_request, waypoint_request; 10355 UNCODE.preventDoubleTransition(); 10356 UNCODE.betterResize(); 10357 UNCODE.utils(); 10358 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 10359 UNCODE.changeSkinOnScroll(); 10360 } 10361 if (typeof UNCODE.share !== 'undefined') { 10362 UNCODE.share(); 10363 } 10364 if (typeof UNCODE.tooltip !== 'undefined') { 10365 UNCODE.tooltip(); 10366 } 10367 if (typeof UNCODE.counters !== 'undefined') { 10368 UNCODE.counters(); 10369 } 10370 if (typeof UNCODE.countdowns !== 'undefined') { 10371 UNCODE.countdowns(); 10372 } 10373 if (typeof UNCODE.tabs !== 'undefined') { 10374 UNCODE.tabs(); 10375 } 10376 if (typeof UNCODE.collapse !== 'undefined') { 10377 UNCODE.collapse(); 10378 } 10379 if (typeof UNCODE.bigText !== 'undefined') { 10380 UNCODE.bigText(); 10381 } 10382 UNCODE.menuSystem(); 10383 if (typeof UNCODE.bgChanger !== 'undefined') { 10384 UNCODE.bgChanger(); 10385 } 10386 if (typeof UNCODE.magicCursor !== 'undefined') { 10387 UNCODE.magicCursor(); 10388 } 10389 if (typeof UNCODE.magneticCursor !== 'undefined') { 10390 UNCODE.magneticCursor(); 10391 } 10392 if (typeof UNCODE.dropImage !== 'undefined') { 10393 UNCODE.dropImage(); 10394 } 10395 if (typeof UNCODE.postTable !== 'undefined') { 10396 UNCODE.postTable(); 10397 } 10398 if (typeof UNCODE.rotatingTxt !== 'undefined') { 10399 UNCODE.rotatingTxt(); 10400 } 10401 if (typeof UNCODE.okvideo !== 'undefined') { 10402 UNCODE.okvideo(); 10403 } 10404 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 10405 UNCODE.backgroundSelfVideos(); 10406 } 10407 UNCODE.tapHover(); 10408 if (typeof UNCODE.isotopeLayout !== 'undefined') { 10409 UNCODE.isotopeLayout(); 10410 } 10411 if (typeof UNCODE.justifiedGallery !== 'undefined') { 10412 UNCODE.justifiedGallery(); 10413 } 10414 if (typeof UNCODE.cssGrid !== 'undefined') { 10415 UNCODE.cssGrid(); 10416 } 10417 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 10418 UNCODE.lightbox(); 10419 } 10420 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 10421 $(window).on('load',function(){ 10422 UNCODE.lightgallery(); 10423 }); 10424 } 10425 if (typeof UNCODE.carousel !== 'undefined') { 10426 UNCODE.carousel($('body')); 10427 } 10428 if (typeof UNCODE.lettering !== 'undefined') { 10429 UNCODE.lettering(); 10430 } 10431 UNCODE.animations(); 10432 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 10433 UNCODE.stickyElements(); 10434 } 10435 if (typeof UNCODE.twentytwenty !== 'undefined') { 10436 UNCODE.twentytwenty(); 10437 } 10438 UNCODE.disableHoverScroll(); 10439 UNCODE.printScreen(); 10440 if (typeof UNCODE.particles !== 'undefined') { 10441 UNCODE.particles(); 10442 } 10443 if (typeof UNCODE.filters !== 'undefined') { 10444 UNCODE.filters(); 10445 } 10446 if (typeof UNCODE.ajax_filters !== 'undefined') { 10447 UNCODE.ajax_filters(); 10448 } 10449 if (typeof UNCODE.widgets !== 'undefined') { 10450 UNCODE.widgets(); 10451 } 10452 if (typeof UNCODE.unmodal !== 'undefined') { 10453 UNCODE.unmodal(); 10454 } 10455 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 10456 if ( !UNCODE.isFullPage ) { 10457 UNCODE.checkScrollForTabs(); 10458 } 10459 } 10460 if (typeof UNCODE.onePage !== 'undefined') { 10461 UNCODE.onePage(UNCODE.isMobile); 10462 } 10463 if (typeof UNCODE.fullPage !== 'undefined') { 10464 $(document).ready(function(){ 10465 UNCODE.fullPage(); 10466 }); 10467 } 10468 if (typeof UNCODE.skewIt !== 'undefined') { 10469 UNCODE.skewIt(); 10470 } 10471 if (typeof UNCODE.rotateIt !== 'undefined') { 10472 UNCODE.rotateIt(); 10473 } 10474 if (typeof UNCODE.textMarquee !== 'undefined') { 10475 UNCODE.textMarquee(); 10476 } 10477 if (typeof UNCODE.stickyScroll !== 'undefined') { 10478 UNCODE.stickyScroll(); 10479 } 10480 if (typeof UNCODE.stickyTrigger !== 'undefined') { 10481 UNCODE.stickyTrigger(); 10482 } 10483 if (typeof UNCODE.verticalText !== 'undefined') { 10484 UNCODE.verticalText(); 10485 } 10486 if (typeof UNCODE.revslider !== 'undefined') { 10487 UNCODE.revslider(); 10488 } 10489 if (typeof UNCODE.layerslider !== 'undefined') { 10490 UNCODE.layerslider(); 10491 } 10492 $(window).on('load',function(){ 10493 clearRequestTimeout(waypoint_request);
10494 waypoint_request = requestTimeout( function(){ 10495 Waypoint.refreshAll(); 10496 }, 1000); 10497 10498 if (typeof UNCODE.parallax !== 'undefined') { 10499 UNCODE.parallax(); 10500 } 10501 }); 10502 } 10503 10504 if ( ! SiteParameters.is_frontend_editor ) { 10505 UNCODE.init(); 10506 } 10507 10508 10509})(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.