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.checkImgLoad = function( src, cb, err, el ) { 56 var img = new Image(); 57 img.onload = function () { 58 var result = (img.width > 0) && (img.height > 0); 59 cb(el); 60 }; 61 img.onerror = function () { 62 err(); 63 }; 64 img.src = src 65}; 66 67UNCODE.betterResize = function() { 68 var setResize, 69 doubleResize = true, 70 oldW = UNCODE.wwidth; 71 $(window).on( 'resize orientationchange', function(){ 72 if ( oldW === UNCODE.wwidth ) { 73 return; 74 } else { 75 oldW = UNCODE.wwidth; 76 $(window).trigger('wwResize'); 77 } 78 }); 79}; 80 81UNCODE.shuffle = function(array) { 82 var currentIndex = array.length, 83 randomIndex; 84 85 while (currentIndex > 0) { 86 randomIndex = Math.floor(Math.random() * currentIndex); 87 currentIndex--; 88 [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; 89 } 90 91 return array; 92}; 93 94Number.isInteger = Number.isInteger || function(value) { 95 return typeof value === "number" && 96 isFinite(value) && 97 Math.floor(value) === value; 98}; 99 100UNCODE.utils = function() { 101 $(document).on('mouseover', 'a', function () { 102 if (!$(this).hasClass('star')) { 103 $(this).attr('data-title', $(this).attr('title')); 104 $(this).removeAttr('title'); 105 } 106 }); 107 $(document).on('mouseout', 'a', function () { 108 if (!$(this).hasClass('star')) { 109 $(this).attr('title', $(this).attr('data-title')); 110 $(this).removeAttr('data-title'); 111 } 112 }); 113 114 this.get_scroll_offset = function(e) { 115 116 var scroll_offset = 0, 117 target, 118 trigger; 119 120 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 121 target = e.target; 122 trigger = e.currentTarget; 123 } 124 125 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 126 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 127 UNCODE.hideMenu(100); 128 } 129 } 130 131 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { 132 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 133 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 134 if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) { 135 if ( !$('.menu-hided').length ) { 136 scroll_offset += $('.logo-container:visible').outerHeight(); 137 } 138 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 139 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 140 scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink ); 141 } else { 142 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 143 scroll_offset += UNCODE.menuMobileHeight; 144 } else { 145 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 ) { 146 //scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 147 } else { 148 if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 149 scroll_offset += UNCODE.menuMobileHeight; 150 } 151 } 152 } 153 } 154 } 155 156 } 157 158 scroll_offset += UNCODE.bodyBorder; 159 160 return scroll_offset; 161 } 162 163 if ( !UNCODE.isFullPage ) { 164 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) { 165 166 var hash = (e.currentTarget).hash, 167 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 168 anchor = ''; 169 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 170 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 171 e.preventDefault(); 172 if (!$('#tab-reviews').is(':visible')) { 173 $('a[href="#tab-reviews"]').trigger('click'); 174 } 175 var calc_scroll = $('.wootabs .tab-content').offset().top; 176 calc_scroll -= UNCODE.get_scroll_offset(e); 177
178 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 179 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 180 181 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 182 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 183 } 184 } 185 186 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 187 delta = bodyTop - calc_scroll, 188 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 189 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 190 191 requestTimeout(function(){ 192 if (scrollSpeed == 0) { 193 $('html, body').scrollTop(calc_scroll); 194 UNCODE.scrolling = false; 195 } else { 196 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 197 $(this).stop(); 198 }).animate({ 199 scrollTop: calc_scroll 200 }, scrollSpeed, 'easeInOutCubic', function() { 201 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 202 UNCODE.scrolling = false; 203 } 204 ); 205 } 206 }, 200); 207 return; 208 } 209 if (hash != undefined) { 210 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 211 var anchor = this.hash.slice(1); 212 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 213 if ( !specialFormat.test(hash) ) { 214 if ( $(hash).length ) 215 anchor = $(hash); 216 } 217 } 218 } 219 220 if (is_scrolltop || anchor != '') { 221 if (is_scrolltop) { 222 e.preventDefault(); 223 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 224 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 225 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 226 227 if (scrollSpeed == 0) { 228 $('html, body').scrollTop(0); 229 UNCODE.scrolling = false; 230 } else { 231 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 232 $(this).stop(); 233 }).animate({ 234 scrollTop: 0 235 }, scrollSpeed, 'easeInOutCubic', function() { 236 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 237 UNCODE.scrolling = false; 238 }); 239 } 240 } else { 241 var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor; 242 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 243 var get_href = $(val).attr('href'); 244 if (get_href != undefined) { 245 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 246 else $(val).parent().removeClass('active'); 247 } 248 }); 249 if (scrollSection.length) { 250 if ( $('body').hasClass('uncode-scroll-no-history') ) { 251 e.preventDefault(); 252 } 253 254 if (UNCODE.menuOpened) { 255 if (UNCODE.wwidth < UNCODE.mediaQuery) { 256 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 257 } else { 258 $('.mmb-container-overlay .overlay-close').trigger('click'); 259 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 260 } 261 } 262 263 var calc_scroll = scrollSection.offset().top, 264 getOffset = UNCODE.get_scroll_offset(e), 265 $logo = $('.logo-container:visible'), 266 logoH, 267 $menu = $('#masthead .menu-container'), 268 menuH; 269 270 calc_scroll -= isNaN(getOffset) ? 0 : getOffset; 271 272 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 273 delta = bodyTop - calc_scroll, 274 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 275 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 276
277 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 278 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) { 279 logoH = $logo.outerHeight(), 280 menuH = $menu.outerHeight(); 281 if ( calc_scroll < ( logoH + menuH ) ) { 282 calc_scroll = 0; 283 } 284 } 285 } 286 287 if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) { 288 calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() ); 289 } 290 291 if (scrollSpeed == 0) { 292 $('html, body').scrollTop(calc_scroll); 293 UNCODE.scrolling = false; 294 } else { 295 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 296 $(this).stop(); 297 }).animate({ 298 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 299 }, scrollSpeed, 'easeInOutCubic', function() { 300 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 301 UNCODE.scrolling = false; 302 if ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 303 || 304 $('.menu-hided').length ) { 305 calc_scroll = scrollSection.offset().top; 306 getOffset = UNCODE.get_scroll_offset(e); 307 calc_scroll -= getOffset; 308 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 309 $(this).stop(); 310 }).animate({ 311 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 312 }, scrollSpeed, 'easeInOutCubic', function() { 313 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 314 UNCODE.scrolling = false; 315 } 316 ); 317 } 318 }); 319 } 320 } 321 } 322 } 323 }); 324 $('.header-scrolldown').on('click', function(event) { 325 326 event.preventDefault(); 327 328 var pageHeader = $(event.target).closest('#page-header'), 329 pageHeaderTop = pageHeader.offset().top, 330 pageHeaderHeight = pageHeader.outerHeight(), 331 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 332 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 333 334 var calc_scroll = pageHeaderTop + pageHeaderHeight, 335 getOffset = UNCODE.get_scroll_offset(event); 336 calc_scroll -= getOffset; 337 338 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 339 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 340 341 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 342 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 343 } 344 } 345 346 if (scrollSpeed == 0) { 347 $('html, body').scrollTop(calc_scroll); 348 UNCODE.scrolling = false; 349 } else { 350 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 351 $(this).stop(); 352 }).animate({ 353 scrollTop: calc_scroll 354 }, scrollSpeed, 'easeInOutCubic', function() { 355 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 356 UNCODE.scrolling = false; 357 if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) { 358 calc_scroll = pageHeaderTop + pageHeaderHeight; 359 getOffset = UNCODE.get_scroll_offset(event); 360 calc_scroll -= getOffset; 361 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 362 $(this).stop(); 363 }).animate({ 364 scrollTop: calc_scroll 365 }, scrollSpeed, 'easeInOutCubic', function() { 366 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 367 UNCODE.scrolling = false;
368 } 369 ); 370 } 371 } 372 ); 373 } 374 }); 375 } 376 377 // Colomun hover effect 378 // ================= 379 $(document).on('mouseenter', '.col-link', function(e) { 380 var uncol = $(e.target).prev('.uncol'), 381 el = uncol.find('.column-background'); 382 if (el) { 383 $('.btn-container .btn', uncol).toggleClass('active'); 384 var elOverlay = $(el[0]).find('.block-bg-overlay'); 385 if (elOverlay.length) { 386 var getOpacity = $(elOverlay).css('opacity'); 387 if (getOpacity != 1) { 388 getOpacity = Math.round(getOpacity * 100) / 100; 389 var newOpacity = getOpacity + .1; 390 $(elOverlay).data('data-opacity', getOpacity); 391 $(elOverlay).css('opacity', newOpacity); 392 } 393 } 394 } 395 }).on('mouseleave', '.col-link', function(e) { 396 var uncol = $(e.target).prev('.uncol'), 397 el = uncol.find('.column-background'); 398 $('.btn-container .btn', uncol).toggleClass('active'); 399 if (el) { 400 var elOverlay = $(el[0]).find('.block-bg-overlay'); 401 if (elOverlay.length) { 402 var getOpacity = $(elOverlay).data('data-opacity'); 403 $(elOverlay).css('opacity', getOpacity); 404 } 405 } 406 }); 407 408 // Admin bar 409 // ============ 410 var fixAdminBar = function() { 411 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 412 var getAdminBar = $('#wpadminbar'); 413 if (getAdminBar.length) { 414 if (getAdminBar.css('position') !== 'hidden') { 415 var getAdminBarHeight = getAdminBar.height(); 416 if (getAdminBar.css('position') === 'fixed') { 417 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 418 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 419 } else { 420 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 421 $('.body-borders .top-border').css({'margin-top':'0px'}); 422 } 423 } 424 } 425 } 426 }; 427 window.addEventListener('load', fixAdminBar); 428 window.addEventListener('resize', fixAdminBar); 429 // Print 430 // =========== 431 var beforePrint = function() { 432 window.dispatchEvent(new CustomEvent('resize')); 433 window.dispatchEvent(UNCODE.boxEvent); 434 }; 435 436 if (window.matchMedia) { 437 var mediaQueryList = window.matchMedia('print'); 438 mediaQueryList.addListener(function(mql) { 439 if (mql.matches) { 440 beforePrint(); 441 } 442 }); 443 } 444 445 window.onbeforeprint = beforePrint; 446 447 // Safari srcset 448 var safariSrcSet = function(){ 449 if ( !SiteParameters.is_frontend_editor ) { 450 $('html.safari img[sizes]').each(function(){ 451 var $img = $(this), 452 sizeImg = parseInt($img.attr('sizes')); 453 if ( typeof(sizeImg) === 'number' ) { 454 $img.attr('sizes', (sizeImg) + 'px'); 455 } 456 }); 457 } 458 }; 459 window.addEventListener('load', safariSrcSet); 460} 461 462UNCODE.lettering = function() { 463 464 var setCTA; 465 var highlightStill = function(){ 466 467 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 468 469 $.each($heading_texts, function(key, el) { 470 var $heading = $(el); 471 472 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 473 return; 474 } 475 476 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 477 return; 478 } 479 480 var waypoint = new Waypoint({ 481 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 482 element: el, 483 handler: function() { 484 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 485 anims_l = $anims.length; 486 $anims.each(function(_key_, _el_){ 487 var $anim = $(_el_); 488 489 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 490 $anim.addClass('heading-text-highlight-animated'); 491 492 if ( $heading.data('animate') === true ) { 493 $anim.css({ 494 '-webkit-transition-duration': '0ms', 495 '-moz-transition-duration': '0ms', 496 '-o-transition-duration': '0ms', 497 'transition-duration': '0ms', 498 }); 499 } else { 500 $anim.css({ 501 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 502 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 503 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 504 'transition-delay': ((_key_ + 2) * 200) + 'ms', 505 }); 506 } 507 } 508 509 }); 510 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 511 $heading.data('animate', true); 512 }); 513 $anims.removeAttr('data-animated'); 514 }, 515 offset: '100%' 516 }); 517 518 }); 519 520 Waypoint.refreshAll(); 521 $( document.body ).trigger('uncode_waypoints'); 522 523 } 524 525 requestTimeout(function(){ 526 highlightStill(); 527 $(window).on( 'resize', function(){ 528 clearRequestTimeout(setCTA); 529 setCTA = requestTimeout( highlightStill, 100 ); 530 }); 531 }, 400); 532 533}; 534 535UNCODE.isUnmodalOpen = false;
536 537var manageVideoSize = function(){ 538 539 var setVideoFit; 540 $('.wp-block-embed').each(function(){ 541 542 var $this = $(this); 543 544 if ( $('iframe', $this).length ) { 545 546 var $iframe = $('> iframe, > a > iframe', $this), 547 w = parseFloat($iframe.attr('width')), 548 h = parseFloat($iframe.attr('height')), 549 url = $iframe.attr('src'), 550 ratio, frW; 551 552 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 553 554 ratio = h / w; 555 var setResizeiFto, 556 resizeiFrame = function(){ 557 frW = $iframe.width(); 558 $iframe.css({ 559 height: frW * ratio 560 }); 561 }; 562 resizeiFrame(); 563 $(window).on( 'resize load', function(){ 564 clearRequestTimeout(setResizeiFto); 565 setResizeiFto = requestTimeout( function() { 566 resizeiFrame(); 567 }, 10 ); 568 }); 569 570 } 571 572 } 573 574 }); 575 576}; 577 578manageVideoSize(); 579 580UNCODE.vivus = function(icon, time, delay, file) { 581 if (typeof Vivus !== 'undefined') { 582 var icon_options = { 583 type: 'delayed', 584 pathTimingFunction: Vivus.EASE_OUT, 585 animTimingFunction: Vivus.LINEAR, 586 duration: time, 587 } 588 589 if (delay) { 590 icon_options.delayStart = delay; 591 } 592 593 if (file) { 594 icon_options.file = file; 595 } 596 597 new Vivus(icon, icon_options); 598 } 599}; 600 601UNCODE.lastURL = ''; 602 603UNCODE.getURLParams = function(current_location, is_string) { 604 var params = {}; 605 if (is_string) { 606 var url = current_location.split('?')[1]; 607 } else { 608 var url = current_location.search; 609 url = url.substring(1); 610 } 611 if (url) { 612 var parts = url.split('&'); 613 for (var i = 0; i < parts.length; i++) { 614 var nv = parts[i].split('='); 615 if (!nv[0]) { 616 continue; 617 } 618 params[nv[0]] = nv[1] || true; 619 } 620 } 621 return params; 622} 623 624UNCODE.hasEqualURLParams = function(obj1, obj2) { 625 for (var i in obj1) { 626 if (obj1.hasOwnProperty(i)) { 627 if (!obj2.hasOwnProperty(i)) { 628 return false; 629 } 630 if (obj1[i] != obj2[i]) { 631 return false; 632 } 633 } 634 } 635 for (var i in obj2) { 636 if (obj2.hasOwnProperty(i)) { 637 if (!obj1.hasOwnProperty(i)) { 638 return false; 639 } 640 if (obj1[i] != obj2[i]) { 641 return false; 642 } 643 } 644 } 645 return true; 646} 647 648UNCODE.magnetic = function(){ 649 650 $(document).on('mousemove', '.un-magnetic-zone', function(e){ 651 652 var $zone = $(this), 653 zoneOff = $zone.offset(), 654 $mgntcEl = $('.un-magnetic-el', this), 655 elBound = this.getBoundingClientRect(), 656 maxSize = Math.max($zone.outerWidth(), $zone.outerHeight()); 657 658 var Xvalue = e.pageX - (zoneOff.left + maxSize / 2), 659 Yvalue = e.pageY - (zoneOff.top + maxSize / 2); 660 661 $mgntcEl.each(function(key, val){ 662 var magneticValue = $(val).attr('data-mgntc') || 0.5; 663 664 val.animate({ 665 transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)', 666 },{ 667 duration: 500, 668 fill: 'forwards', 669 }) 670 }); 671 }) 672 673 $(document).on('mouseleave', '.un-magnetic-zone', function(e){ 674 var $mgntcEl = $('.un-magnetic-el', this); 675 676 $mgntcEl.each(function(key, val){ 677 val.animate({ 678 transform: 'translate(0)', 679 },{ 680 duration: 500, 681 fill: 'forwards', 682 }) 683 }); 684 }) 685}; 686UNCODE.changeSkinOnScroll = function(){ 687 if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { 688 return; 689 } 690 var $masthead = $('#masthead'), 691 transDesktop, 692 transMobile, 693 changeSkin, 694 695 checkTransparencyAndChange = function( $col ){ 696 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 697 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 698 changeSkin = $masthead.hasClass('menu-change-skin'); 699 700 if ( ! transDesktop && ! transMobile ) { 701 return false; 702 } 703 704 if ( ! changeSkin ) { 705 return false; 706 } 707 708 if ( $col.hasClass('style-light') ){ 709 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 710 return false; 711 } else if ( $col.hasClass('style-dark') ) { 712 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 713 return false; 714 } 715 }; 716 717 var prev_row = 'normal', 718 odd = true, 719 $rows = $('.vc_row[data-parent]:visible'); 720 $.each($rows, function(index, row){ 721 var $row = $(row), 722 $col = $('.uncol', $row).first(), 723 $slider = $('.uncode-slider', $row); 724 725 var wayDown = new Waypoint({ 726 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 727 element: row, 728 handler: function(direction) { 729 if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 730 if ( $slider.length ) { 731 $col = $('.owl-item.index-active .uncol', $slider).first(); 732 } 733 checkTransparencyAndChange($col); 734 } 735 if ( odd === false ) { 736 if ( row.hasAttribute('data-bg-changer') ) { 737 prev_row = 'bg-changer'; 738 } else { 739 prev_row = 'normal'; 740 } 741 odd = true; 742 } else { 743 odd = false;
744 } 745 }, 746 offset: function() { 747 return UNCODE.menuHeight / 2 748 } 749 }); 750 var wayUp = new Waypoint({ 751 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 752 element: row, 753 handler: function(direction) { 754 if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 755 if ( $slider.length ) { 756 $col = $('.owl-item.index-active .uncol', $slider).first(); 757 } 758 checkTransparencyAndChange($col); 759 } 760 if ( odd === false ) { 761 if ( row.hasAttribute('data-bg-changer') ) { 762 prev_row = 'bg-changer'; 763 } else { 764 prev_row = 'normal'; 765 } 766 odd = true; 767 } else { 768 odd = false; 769 } 770 }, 771 offset: function() { 772 return -row.clientHeight + ( UNCODE.menuHeight / 2 ) 773 } 774 }); 775 }); 776 777}; 778 779UNCODE.share = function() { 780 if (typeof Share !== 'undefined') { 781 var share_button_element = $('.share-button'); 782 var share_button_url = share_button_element.data('url'); 783 784 var share_button_config = { 785 ui: { 786 flyout: "top center", 787 button_font: false, 788 button_text: '', 789 icon_font: false 790 } 791 }; 792 793 if (share_button_url) { 794 share_button_config.url = share_button_url.replace("&", "%26"); 795 } 796 797 var share_button_top = new Share('.share-button', share_button_config); 798 } 799}; 800 801UNCODE.tooltip = function() { 802 if (typeof jQuery.fn.tooltip !== 'undefined') { 803 $('.btn-tooltip').tooltip(); 804 } 805}; 806 807UNCODE.counters = function() { 808 var $counters = $('.uncode-counter:not(.counter-init)'); 809 $counters.each(function(){ 810 var $counter = $(this).addClass('counter-init'); 811 if ( SiteParameters.is_frontend_editor ) { 812 $counter.addClass('started'); 813 } 814 if ( $counter.closest( '.owl-carousel' ).length ) { 815 return; 816 } 817 $counter.addClass('started').counterUp({ 818 delay: 10, 819 time: 1500 820 }); 821 }); 822}; 823 824UNCODE.countdowns = function() { 825 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 826 $countdowns.each(function() { 827 var $this = $(this).addClass('counter-init'), 828 finalDate = $(this).data('uncode-countdown'); 829 $this.countdown(finalDate, function(event) { 830 $this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>')); 831 }); 832 }); 833}; 834 835UNCODE.tabs = function() { 836 837 var tabSwitcher = function($el){ 838 $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){ 839 var $navs = $(value), 840 $active = $('li.active', $navs), 841 $active_a = $('> a', $active), 842 $active_span = $('> span', $active_a), 843 vertical = $navs.closest('.vertical-tab-menu').length; 844 845 if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { 846 $navs.append('<span class="switcher-cursor" />'); 847 } 848 849 var $cursor = $('.switcher-cursor', $navs), 850 active_w = $('a', $active).outerWidth(), 851 span_w = $active_span.outerWidth(), 852 active_pos = $active.position(), 853 active_a_pos = $active_a.position(), 854 span_pos = $active_span.position(), 855 cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
856 cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; 857 858 cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); 859 860 if ( ! vertical ) { 861 $cursor.css({ 862 left: cursor_left, 863 width: cursor_w 864 }); 865 } 866 867 $navs.addClass('switch-init'); 868 }); 869 }; 870 871 var $body = $('body'); 872 tabSwitcher($body); 873 874 var tabHoverIntent = function(){ 875 var setHover; 876 $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') 877 .on('mouseover', function(e){ 878 var $this = $(e.target); 879 setHover = requestTimeout(function() { 880 $this.trigger('hover-int'); 881 }, 50); 882 }) 883 .on('mouseout', function(){ 884 clearRequestTimeout(setHover); 885 }); 886 }; 887 tabHoverIntent(); 888 889 var tabInit = function(){ 890 $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { 891 e.preventDefault() 892 var $el = $(this); 893 $el.tab('show'); 894 var $container = $el.closest('.uncode-tabs'); 895 tabSwitcher($container); 896 requestTimeout(function() { 897 window.dispatchEvent(UNCODE.boxEvent); 898 var $tabs = $(e.currentTarget).closest('.uncode-tabs'); 899 900 if ( $tabs.hasClass('tabs-trigger-box-resized') ) { 901 window.dispatchEvent(new CustomEvent('boxResized')); 902 } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { 903 window.dispatchEvent(new Event('resize')); 904 $(window).trigger('uncode.re-layout'); 905 } 906 907 var $active_panel = $('.tab-pane.active', $tabs); 908 909 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 910 var element = $(val), 911 delayAttr = element.attr('data-delay'); 912 if (delayAttr == undefined) delayAttr = 0; 913 requestTimeout(function() { 914 element.addClass('start_animation'); 915 }, delayAttr); 916 }); 917 918 }, 300); 919 920 var $li = $el.closest('li'), 921 mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 922 $('li', $container).not($li).find('.tab-pane').slideUp(250) 923 $('.tab-pane', $li).slideDown(250); 924 var completeSlideDown = requestTimeout(function(){ 925 if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { 926 var pos = $el.offset(), 927 rect = $el[0].getBoundingClientRect(), 928 $masthead = $('#masthead > .menu-container'), 929 considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; 930 931 if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { 932 $('html, body').animate({ 933 scrollTop: ( pos.top ) - considerMenu 934 },{ 935 easing: 'easeInOutQuad', 936 duration: 250 937 }); 938 } 939 } 940 }, 260); 941 }); 942 } 943 tabInit(); 944 945 var tabResponsive = function(){ 946 if ( SiteParameters.is_frontend_editor ) { 947 return true; 948 } 949 var $tabContainers = $('.tab-container.tabs-breakpoint'); 950 $tabContainers.each(function(){ 951 var $tabContainer = $(this), 952 $tabContent = $('.tab-content', $tabContainer), 953 $nav = $('.nav-tabs', $tabContainer), 954 mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 955 956 $('> li', $nav).each(function(){ 957 var $li = $(this), 958 dataID = $li.attr('data-tab-id'); 959 960 if ( UNCODE.wwidth <= mQuery ) { 961 if ( ! $('.tab-pane', $li ).length ) { 962 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); 963 $tabContainer.addClass('tabs-appended'); 964 $li.append($append_pane); 965 } 966 967 if ( $li.hasClass('active') ) { 968 $('> a', $li).click(); 969 } 970 } else { 971 if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { 972 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); 973 $tabContainer.removeClass('tabs-appended');
974 $tabContent.prepend($append_pane.removeAttr('style')); 975 } 976 } 977 }); 978 }); 979 980 } 981 tabResponsive(); 982 983 $(window).on('wwResize', function(){ 984 tabHoverIntent(); 985 tabSwitcher($body); 986 }); 987 988 var setCTA; 989 $(window).on( 'resize', function(){ 990 clearRequestTimeout(setCTA); 991 setCTA = requestTimeout( tabResponsive, 100 ); 992 }); 993 994 $('.nav-tabs').each(function(){ 995 var $nav = $(this), 996 $lis = $('> li:not(.active)', $nav), 997 $links = $('.tab-excerpt-link', $nav); 998 $('.tab-excerpt', $lis).slideUp(400, function(){ 999 $(this).addClass('init'); 1000 }); 1001 1002 $links.each(function(){ 1003 var $link = $(this), 1004 $par_a = $link.closest('a'), 1005 href = $link.attr('data-href'), 1006 target = $link.attr('data-target'); 1007 $par_a.addClass('inner-link'); 1008 $link.on('click', function(){ 1009 var _link = document.createElement('a'); 1010 _link.href = href; 1011 _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; 1012 _link.click(); 1013 }); 1014 }); 1015 $nav.addClass('tab-init'); 1016 }); 1017 1018 $('.uncode-tabs.tabs-no-lazy').each(function(){ 1019 var $tabs = $(this), 1020 $panes = $('.tab-pane:not(.active)', $tabs); 1021 $panes.each(function(){ 1022 var $pane = $(this), 1023 $imgs = $('img[loading="lazy"]', $pane); 1024 $imgs.removeAttr('loading'); 1025 $imgs.removeAttr('decoding'); 1026 }); 1027 }); 1028 1029}; 1030UNCODE.collapse = function() { 1031 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 1032 var $this = $(this), 1033 href 1034 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 1035 var $target = $(target) 1036 var parent = $this.attr('data-parent') 1037 var $parent = parent && $(parent) 1038 var $title = $(this).parent() 1039 var $accordion = $(e.target).closest('.uncode-accordion') 1040 var $group = $this.closest('.group') 1041 var $panel_group = $this.closest('.panel-group') 1042 if ($parent) { 1043 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 1044 if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { 1045 $title.removeClass('active'); 1046 $group.removeClass('active-group'); 1047 } else { 1048 if ( $panel_group.attr('data-no-toggle') != true ) { 1049 $parent.find('.panel-title').removeClass('active') 1050 $parent.find('.group').removeClass('active-group') 1051 } 1052 $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') 1053 $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') 1054 } 1055 } 1056 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 1057 requestTimeout(function() { 1058 var $accordion = $(e.target).closest('.uncode-accordion'); 1059 if ( $accordion.hasClass('tabs-trigger-box-resized') ) { 1060 window.dispatchEvent(new CustomEvent('boxResized')); 1061 } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { 1062 window.dispatchEvent(new Event('resize')); 1063 $(window).trigger('uncode.re-layout'); 1064 } 1065 1066 var $active_panel = $('.panel.active-group', $parent); 1067 1068 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 1069 var element = $(val), 1070 delayAttr = element.attr('data-delay'); 1071 if (delayAttr == undefined) delayAttr = 0; 1072 requestTimeout(function() { 1073 element.addClass('start_animation'); 1074 }, delayAttr); 1075 }); 1076 1077 }, 500); 1078 }); 1079 1080 $('.uncode-accordion.tabs-no-lazy').each(function(){ 1081 var $accordion = $(this), 1082 $panes = $('.panel:not(.active-group)', $accordion); 1083 $panes.each(function(){ 1084 var $pane = $(this), 1085 $imgs = $('img[loading="lazy"]', $pane); 1086 $imgs.removeAttr('loading'); 1087 $imgs.removeAttr('decoding'); 1088 }); 1089 }); 1090}; 1091 1092UNCODE.bigText = function(el) { 1093 var bigTextLaunch = function(){ 1094 if (el == undefined) { 1095 el = $('body'); 1096 } 1097 $.each($('.bigtext', el), function(index, val) { 1098 $(val).bigtext({ 1099 minfontsize: 24 1100 }); 1101 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 1102 opacity: 1 1103 }); 1104 requestTimeout(function() { 1105 if ($(val).find('.animate_when_almost_visible').length != 0) { 1106 $(val).css({opacity: 1}); 1107 } 1108 }, 400); 1109 }); 1110 }; 1111 1112 if ( UNCODE.wwidth > UNCODE.mediaQuery ) { 1113 bigTextLaunch(); 1114 } else { 1115 $(window).on( 'load', bigTextLaunch ); 1116 } 1117}; 1118 1119UNCODE.process_shortpixel_image = function(image) { 1120 var data = { 1121 action: 'shortpixel_manual_optimization', 1122 image_id: image,
1123 cleanup: true 1124 }; 1125 1126 $.get(SiteParameters.ajax_url, data); 1127}; 1128 1129UNCODE.menuSystem = function() { 1130 1131 function menuMobile() { 1132 var $body = $('body'), 1133 scrolltop, 1134 $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), 1135 $masthead = $('#masthead'), 1136 $box, 1137 $el, 1138 $el_transp, 1139 elHeight, 1140 offCanvasAnim, 1141 check, 1142 animating = false, 1143 stickyMobile = false, 1144 menuClose = new CustomEvent('menuMobileClose'), 1145 menuOpen = new CustomEvent('menuMobileOpen'); 1146 UNCODE.menuOpened = false; 1147 $mobileToggleButton.on('click', function(event) { 1148 event.stopPropagation(); 1149 var btn = this; 1150 if ($(btn).hasClass('overlay-close')) return; 1151 event.preventDefault(); 1152 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 1153 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 1154 $box = $(this).closest('.box-container').find('.main-menu-container'); 1155 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 1156 $el_transp = $('.menu-absolute.menu-transparent'); 1157 if (UNCODE.isMobile) { 1158 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 ) { 1159 stickyMobile = true; 1160 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 1161 } else { 1162 elHeight = 0; 1163 $.each($box.find('> div'), function(index, val) { 1164 elHeight += $(val).outerHeight(); 1165 }); 1166 } 1167 } else { 1168 elHeight = 0; 1169 $.each($el, function(index, val) { 1170 elHeight += $(val).outerHeight(); 1171 }); 1172 } 1173 var open = function() { 1174 clearTimeout(offCanvasAnim); 1175 if (!animating) { 1176 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 1177 scrolltop = $(window).scrollTop(); 1178 window.dispatchEvent(menuOpen); 1179 animating = true; 1180 UNCODE.menuOpened = true; 1181 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 1182 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 1183 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1184 } 1185 if ($('body.menu-offcanvas').length) { 1186 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1187 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1188 } else { 1189 if ( $('.menu-hide, .menu-sticky').length ) { 1190 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 1191 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1192 } 1193 } 1194 } 1195 } 1196 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { 1197 //$("#masthead")[0].scrollIntoView(); 1198 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1199 } 1200 $box.addClass('open-items'); 1201 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 1202 $el_transp.addClass('is_mobile_open'); 1203 } 1204 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1205 btn.classList.add('close'); 1206 $box.animate({ 1207 height: elHeight 1208 }, 600, "easeInOutCirc", function() { 1209 animating = false; 1210 if (!stickyMobile) $box.css('height', 'auto'); 1211 }); 1212 } else { 1213 animating = false; 1214 } 1215 } 1216 }; 1217 1218 var close = function() { 1219 clearTimeout(offCanvasAnim); 1220 if (!animating) { 1221 window.dispatchEvent(menuClose); 1222 animating = true; 1223 UNCODE.menuOpened = false;
1224 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1225 btn.classList.remove('close'); 1226 btn.classList.add('closing'); 1227 } 1228 $box.addClass('close'); 1229 requestTimeout(function() { 1230 $box.removeClass('close'); 1231 $box.removeClass('open-items'); 1232 btn.classList.remove('closing'); 1233 if ($el_transp.length) { 1234 $el_transp.removeClass('is_mobile_open'); 1235 } 1236 }, 500); 1237 $body.removeClass('opening-overlay-menu'); 1238 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1239 $box.animate({ 1240 height: 0 1241 }, { 1242 duration: 600, 1243 easing: "easeInOutCirc", 1244 complete: function(elements) { 1245 $(elements).css('height', ''); 1246 animating = false; 1247 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 1248 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 1249 } 1250 $body.removeClass('open-overlay-menu'); 1251 } 1252 }); 1253 } else { 1254 animating = false; 1255 offCanvasAnim = setTimeout(function(){ 1256 $body.removeClass('open-overlay-menu'); 1257 }, 1000); 1258 } 1259 } 1260 }; 1261 check = (!UNCODE.menuOpened) ? open() : close(); 1262 } 1263 }); 1264 1265 $('html').on('click', function(event){ 1266 if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { 1267 $('.uncode-close-offcanvas-mobile').trigger('click'); 1268 } 1269 }); 1270 1271 window.addEventListener('menuMobileTrigged', function(e) { 1272 $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); 1273 }); 1274 window.addEventListener('orientationchange', function(e) { 1275 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 1276 }); 1277 window.addEventListener("resize", function() { 1278 if ($(window).width() < UNCODE.mediaQuery) { 1279 if (UNCODE.isMobile) { 1280 var $box = $('.box-container .main-menu-container'), 1281 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 1282 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 1283 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 1284 elHeight = 0; 1285 $.each($el, function(index, val) { 1286 elHeight += $(val).outerHeight(); 1287 }); 1288 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; 1289 $($box).css('height', elHeight + 'px'); 1290 } 1291 } 1292 } 1293 } else { 1294 $('.menu-hide-vertical').removeAttr('style'); 1295 $('.menu-container-mobile').removeAttr('style'); 1296 $('.vmenu-container.menu-container').removeAttr('style'); 1297 } 1298 }); 1299 1300 $(window).on('scroll', function(){ 1301 if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { 1302 $(window).scrollTop(scrolltop); 1303 return false; 1304 } 1305 }); 1306 1307 }; 1308 1309 function menuOffCanvas() { 1310 var menuClose = new CustomEvent('menuCanvasClose'), 1311 menuOpen = new CustomEvent('menuCanvasOpen'); 1312 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { 1313 if ($(window).width() > UNCODE.mediaQuery) { 1314 if ( $('body.vmenu-offcanvas-overlay').length ) { 1315 if ($(event.currentTarget).hasClass('off-close')) { 1316 $(event.currentTarget).removeClass('off-close'); 1317 requestTimeout(function() { 1318 window.dispatchEvent(menuClose); 1319 }, 500); 1320 1321 } else { 1322 $(event.currentTarget).addClass('off-close'); 1323 window.dispatchEvent(menuOpen); 1324 } 1325 } else { 1326 if ($(event.currentTarget).hasClass('close')) { 1327 $(event.currentTarget).removeClass('close'); 1328 $(event.currentTarget).addClass('closing'); 1329 requestTimeout(function() { 1330 $(event.currentTarget).removeClass('closing'); 1331 window.dispatchEvent(menuClose); 1332 }, 500); 1333 1334 } else { 1335 $(event.currentTarget).addClass('close'); 1336 window.dispatchEvent(menuOpen); 1337 } 1338 } 1339 } 1340 1341 $('body').toggleClass('off-opened'); 1342 }); 1343 1344 $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ 1345 if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { 1346 var $vMenuCont = $('#masthead .vmenu-container'), 1347 $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), 1348 1349 vmenu_h = parseFloat( $vMenuCont.outerHeight() ), 1350 vmenu_w = parseFloat( $vMenuCont.outerWidth() ), 1351 vmenu_off = $vMenuCont.offset(), 1352 vmenu_l = parseFloat(vmenu_off.left), 1353 vmenu_t = parseFloat(vmenu_off.top), 1354 vmenu_r = vmenu_l + vmenu_w, 1355 vmenu_b = vmenu_t + vmenu_h, 1356 1357 close_h = parseFloat( $close_menu.outerHeight() ), 1358 close_w = parseFloat( $close_menu.outerWidth() ), 1359 close_off = $close_menu.offset(), 1360 close_l = parseFloat(close_off.left), 1361 close_t = parseFloat(close_off.top), 1362 close_r = close_l + close_w, 1363 close_b = close_t + close_h; 1364 if ( 1365 !( 1366 e.clientX > vmenu_l && 1367 e.clientX < vmenu_r && 1368 e.clientY > vmenu_t && 1369 e.clientY < vmenu_b 1370 ) 1371 || 1372 ( 1373 e.clientX > close_l && 1374 e.clientX < close_r && 1375 e.clientY > close_t && 1376 e.clientY < close_b 1377 ) 1378 ) { 1379 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); 1380 } 1381 } 1382 }); 1383 }; 1384 1385 function menuOverlay() { 1386 if ( $('.overlay').length ) { 1387 $('.overlay').removeClass('hidden'); 1388 } 1389 if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { 1390 $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) { 1391 var transDelay = (index / 20) + 0.1; 1392 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1393 transDelay = transDelay + 0.3; 1394 $(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'); 1395 }); 1396 } 1397 1398 }; 1399 var $secondary_parent; 1400 function menuAppend() { 1401 var $body = $('body'), 1402 $menuCont = $('.menu-container:not(.vmenu-container)'), 1403 $vMenuCont = $('.menu-container.vmenu-container'), 1404 $cta = $('.navbar-cta'), 1405 $socials = $('.navbar-social:not(.appended-navbar)'), 1406 $ul = $('.navbar-main ul.menu-primary-inner'), 1407 $ulCta, 1408 $ulSocials, 1409 $navLast, 1410 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1411 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1412 $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), 1413 $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), 1414 $ulFirst = $('> ul', $firstNav), 1415 $ulSecond = $('> ul', $secondNav), 1416 setCTA, 1417 appendCTA = function(){ 1418 return true; 1419 }, 1420 appendSocials = function(){ 1421 return true; 1422 }, 1423 appendSplit = function(){ 1424 return true; 1425 }; 1426 1427 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1428 $ulCta = $('> ul', $cta); 1429 $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); 1430 1431 appendCTA = function(){ 1432 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1433 1434 $ul.after($ulCta); 1435 } else { 1436 $cta.append($ulCta); 1437 } 1438 } 1439 } 1440 1441 if ( ! $body.hasClass('cta-not-appended') ) { 1442 appendCTA(); 1443 } 1444 1445 var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); 1446 $smartSocial.each(function(){ 1447 var $_smartSocial = $(this); 1448 $('> li', $_smartSocial).each(function(){ 1449 var $li = $(this); 1450 if ( $li.hasClass('mobile-hidden') ) { 1451 $_smartSocial.addClass('mobile-hidden'); 1452 } else { 1453 $_smartSocial.removeClass('mobile-hidden'); 1454 return false;
1455 } 1456 }); 1457 1458 $('> li', $_smartSocial).each(function(){ 1459 var $li = $(this); 1460 if ( $li.hasClass('tablet-hidden') ) { 1461 $_smartSocial.addClass('tablet-hidden'); 1462 } else { 1463 $_smartSocial.removeClass('tablet-hidden'); 1464 return false; 1465 } 1466 }); 1467 }); 1468 1469 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { 1470 $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); 1471 if ( $body.hasClass('hmenu-center-split') ) { 1472 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1473 } else { 1474 $navLast = $('.navbar-nav-last', $vMenuCont); 1475 } 1476 1477 if ( ! $navLast.length ) { 1478 var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />'); 1479 if ( $body.hasClass('hmenu-center-split') ) { 1480 $('.menu-horizontal-inner', $menuCont).append(_navLast); 1481 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1482 } else { 1483 $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); 1484 $navLast = $('.navbar-nav-last', $vMenuCont); 1485 } 1486 } 1487 1488 appendSocials = function(){ 1489 if ( !$body.hasClass('menu-overlay-center') ) { 1490 // if ( !$navLast.find('ul.menu-smart-social').length ) { 1491 // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); 1492 // $navLast.append('<ul class="menu-smart menu-smart-social" />'); 1493 // $ulSocials.each(function(){ 1494 // var $li_social = $(this); 1495 // $navLast.find('ul.menu-smart-social').append($li_social); 1496 // }); 1497 // } 1498 // } else { 1499 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1500 $socials.addClass('mobile-hidden').addClass('tablet-hidden') 1501 if ( ! $('> ul.menu-smart-social li', $socials).length ) { 1502 $('> ul.menu-smart-social li', $socials).remove(); 1503 } 1504 $navLast.append($ulSocials); 1505 } else { 1506 if ( ! $('> ul.menu-smart-social li', $navLast).length ) { 1507 $('> ul.menu-smart-social li', $navLast).remove(); 1508 } 1509 $socials.append($ulSocials); 1510 } 1511 } 1512 } 1513 appendSocials(); 1514 } 1515 1516 if ( $vMenuCont.length ) { 1517 var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); 1518 } else { 1519 var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); 1520 } 1521 if ( $accordion_secondary.length ) { 1522 var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); 1523 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1524 if ( !$accordion_secondary_ph.length ) { 1525 $accordion_secondary.after('<span class="accordion-secondary-ph" />'); 1526 } 1527 if ( $vMenuCont.length ) { 1528 $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); 1529 } else { 1530 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1531 $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); 1532 } else { 1533 $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); 1534 } 1535 } 1536 } else { 1537 if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { 1538 $accordion_secondary_ph.before($accordion_secondary); 1539 } 1540 } 1541 } 1542 1543 if ( $vMenuCont.length ) { 1544 var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); 1545 } else { 1546 var $extra_icons = $('.navbar-extra-icons', $menuCont); 1547 } 1548 1549 if ( $extra_icons.length ) { 1550 if ( $vMenuCont.length ) { 1551 if ( $('li:not(.social-icon)', $extra_icons).length ) { 1552 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1553 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1554 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1555 $not_social.each(function(){ 1556 if ( ! $primary_after.length ) { 1557 $('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />'); 1558 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1559 $primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />'); 1560 } 1561 var $extra_li = $(this); 1562 $primary_after.find('> ul').append($extra_li); 1563 }); 1564 } else { 1565 var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), 1566 $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1567 $not_social.each(function(){ 1568 var $extra_li = $(this); 1569 $extra_icons.find('> ul').append($extra_li); 1570 }); 1571 } 1572 } /*else { 1573 var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); 1574 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1575 if ( !$extra_icons_ph.length ) { 1576 $extra_icons.after('<span class="extra-icons-ph" />'); 1577 } 1578 if ( $('.navbar-accordion-cta', $vMenuCont).length ) { 1579 $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); 1580 } else { 1581 $('.menu-accordion-primary', $vMenuCont).after($extra_icons); 1582 } 1583 } else { 1584 if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { 1585 $extra_icons_ph.before($extra_icons); 1586 } 1587 } 1588 }*/ 1589 } else { 1590 if ( ! $body.hasClass('hmenu-center-double') ) { 1591 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1592 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1593 $primary_after = $('.nav.navbar-main-after', $menuCont); 1594 1595 if ( ! $primary_after.length && $not_social.length ) { 1596 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1597 $('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />'); 1598 } else { 1599 $('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />'); 1600 } 1601 $primary_after = $('.nav.navbar-main-after', $menuCont); 1602 $primary_after.append('<ul class="menu-smart sm menu-smart-social" />'); 1603 } 1604 var tablet_hidden = true, 1605 mobile_hidden = true; 1606 $not_social.each(function(){ 1607 var $extra_li = $(this); 1608 $primary_after.find('> ul').append($extra_li); 1609 if ( ! $extra_li.hasClass('tablet-hidden') ) { 1610 tablet_hidden = false;
1611 } 1612 if ( ! $extra_li.hasClass('mobile-hidden') ) { 1613 mobile_hidden = false; 1614 } 1615 }); 1616 if ( tablet_hidden === true && $not_social.length ) { 1617 $primary_after.addClass('tablet-hidden'); 1618 } 1619 if ( mobile_hidden === true && $not_social.length ) { 1620 $primary_after.addClass('mobile-hidden'); 1621 } 1622 } else { 1623 var $primary_after = $('.nav.navbar-main-after', $menuCont); 1624 1625 if ( $primary_after.length ) { 1626 var $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1627 $not_social.each(function(){ 1628 var $extra_li = $(this); 1629 $extra_icons.find('> ul').append($extra_li); 1630 }); 1631 $primary_after.remove(); 1632 } 1633 } 1634 } 1635 } 1636 } 1637 1638 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1639 appendSplit = function(){ 1640 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1641 if ( $extra_icons.length ) { 1642 if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { 1643 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1644 $append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />'); 1645 $not_social.each(function(){ 1646 var $extra_li = $(this); 1647 $append_ul.append($extra_li); 1648 }); 1649 if ( $secondNav.length ) { 1650 $secondNav.append($append_ul); 1651 } else { 1652 $('.menu-horizontal-inner', $menuCont).prepend($append_ul); 1653 } 1654 } 1655 } 1656 if ( $secondNav.length ) { 1657 $secondNav.prepend($ulFirst); 1658 } else { 1659 $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); 1660 } 1661 $firstMenu.hide(); 1662 } else { 1663 $firstNav.append($ulFirst); 1664 var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); 1665 if ( $append_ul.length ) { 1666 var $not_social = $('> li:not(.social-icon)', $append_ul); 1667 $not_social.each(function(){ 1668 var $extra_li = $(this); 1669 $extra_icons.find('> ul').append($extra_li); 1670 }); 1671 } 1672 $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); 1673 $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); 1674 $firstMenu.css({ 1675 'display': 'table-cell' 1676 }); 1677 } 1678 } 1679 } 1680 appendSplit(); 1681 1682 $(window).on( 'resize', function(){ 1683 clearRequestTimeout(setCTA); 1684 setCTA = requestTimeout( function() { 1685 appendCTA(); 1686 appendSocials(); 1687 appendSplit(); 1688 }, 10 ); 1689 }); 1690 } 1691 //menuMobileButton(); 1692 menuMobile(); 1693 menuOffCanvas(); 1694 menuAppend(); 1695 menuOverlay(); 1696 1697 var stickyDropdownSearch = function(){ 1698 var $masthead = $('#masthead'), 1699 $ddSearch = $('.overlay.overlay-search', $masthead), 1700 $styles = $('#stickyDropdownSearch').remove(); 1701 if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { 1702 var $menuWrapper = $('.menu-wrapper'), 1703 $navbar = $('.menu-container-mobile', $menuWrapper), 1704 navbarH = $navbar.outerHeight(), 1705 //$topbar = $('.top-menu', $menuWrapper), 1706 //topbarH = $topbar.outerHeight(), 1707 _css; 1708 1709 _css = '<style id="stickyDropdownSearch">'; 1710 _css += '@media (max-width: 959px) {'; 1711 _css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {'; 1712 _css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;'; 1713 _css += '}'; 1714 _css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {'; 1715 _css += 'position: fixed;'; 1716 _css += 'top: 0;'; 1717 _css += '}'; 1718 _css += '</style>'; 1719 1720 $(_css).appendTo($('head')); 1721 } 1722 } 1723 stickyDropdownSearch(); 1724 1725 var setMenuOverlay; 1726 $(window).on( 'resize', function(){ 1727 if ( $('.overlay').length && $(window).width() > 1024 ) { 1728 $('.overlay').addClass('hidden'); 1729 } 1730 clearRequestTimeout(setMenuOverlay); 1731 setMenuOverlay = requestTimeout( function(){ 1732 menuOverlay(); 1733 menuAppend(); 1734 stickyDropdownSearch(); 1735 }, 150 ); 1736 }); 1737 UNCODE.menuSmartInit(); 1738}; 1739 1740UNCODE.menuSmartInit = function() { 1741 var $menusmart = $('[class*="menu-smart"]'), 1742 $masthead = $('#masthead'), 1743 $hMenu = $('.menu-horizontal-inner', $masthead), 1744 $focus = $('.overlay-menu-focus'), 1745 showTimeout = 50, 1746 hideTimeout = 50, 1747 showTimeoutFunc, hideTimeoutFunc; 1748 1749 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1750 $(this).data('hover', true); 1751 }, function(){ 1752 $(this).data('hover', false); 1753 }); 1754 1755 $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ 1756 e.preventDefault(); 1757 }); 1758 1759 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1760 var $notLis = $('> .nav > ul > li a', $hMenu), 1761 $menuA = $('a', $masthead).not($notLis), 1762 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1763 showFuncCond = function() { return true }; 1764 1765 if ( $('body').hasClass('focus-megamenu') ) { 1766 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1767 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1768 } else if ( $('body').hasClass('focus-links') ) { 1769 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1770 } 1771 1772 $hoverSelector.hover(function(){ 1773 clearRequestTimeout(hideTimeoutFunc);
1774 showTimeoutFunc = requestTimeout(function(){ 1775 $('body').addClass('navbar-hover'); 1776 }, showTimeout*2); 1777 }, function(){ 1778 hideTimeoutFunc = requestTimeout(function(){ 1779 if ( ! $('.overlay-search.open', $masthead).length ) { 1780 $('body').removeClass('navbar-hover'); 1781 } 1782 }, hideTimeout*2); 1783 }); 1784 } else { 1785 showFuncCond = function() { return false }; 1786 } 1787 1788 if ($menusmart.length > 0) { 1789 $menusmart.smartmenus({ 1790 subIndicators: false, 1791 subIndicatorsPos: 'append', 1792 //subMenusMinWidth: '13em', 1793 subIndicatorsText: '', 1794 showTimeout: showTimeout, 1795 hideTimeout: hideTimeout, 1796 scrollStep: 8, 1797 showFunction: function($ul, complete) { 1798 clearRequestTimeout(showTimeoutFunc); 1799 $ul.fadeIn(0, 'linear', function(){ 1800 complete(); 1801 if ( $ul.hasClass('vc_row') ) { 1802 $ul.css({ 1803 'display': 'table' 1804 }); 1805 } 1806 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1807 $('body').addClass('open-megamenu'); 1808 } 1809 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1810 $('body').addClass('navbar-hover'); 1811 } 1812 }).addClass('open-animated'); 1813 }, 1814 hideFunction: function($ul, complete) { 1815 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 1816 $('body').removeClass('open-megamenu'); 1817 } 1818 var fixIE = $('html.ie').length; 1819 if (fixIE) { 1820 var $rowParent = $($ul).closest('.main-menu-container'); 1821 $rowParent.height('auto'); 1822 } 1823 $ul.fadeOut(0, 'linear', function(){ 1824 complete(); 1825 $ul.removeClass('open-animated'); 1826 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 1827 $('body').removeClass('open-submenu'); 1828 } 1829 }); 1830 }, 1831 collapsibleShowFunction: function($ul, complete) { 1832 $ul.slideDown(400, 'easeInOutCirc', complete); 1833 }, 1834 collapsibleHideFunction: function($ul, complete) { 1835 $ul.slideUp(200, 'easeInOutCirc', complete); 1836 }, 1837 hideOnClick: SiteParameters.menuHideOnClick, 1838 }); 1839 1840 if ( $('body').hasClass('menu-accordion-active') ) { 1841 requestTimeout(function(){ 1842 $menusmart.addClass('menu-smart-init'); 1843 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 1844 }, 1000); 1845 } 1846 1847 $(document).on( 'uncode.smartmenu-appended', function(){ 1848 requestTimeout(function(){ 1849 $menusmart.smartmenus( 'refresh' ); 1850 }, 1000); 1851 }); 1852 } 1853 1854 $('.main-menu-container').each(function(){ 1855 var $main_cont = $(this), 1856 $uls = $('ul', $main_cont); 1857 1858 $uls.each(function(){ 1859 var $ul = $(this), 1860 mobile_hidden = true, 1861 tablet_hidden = true; 1862 $('> li:not(.hidden)', $ul).each(function(){ 1863 if ( !$(this).hasClass('mobile-hidden') ) { 1864 mobile_hidden = false; 1865 return false; 1866 } 1867 }); 1868 $('> li:not(.hidden)', $ul).each(function(){ 1869 if ( !$(this).hasClass('tablet-hidden') ) { 1870 tablet_hidden = false; 1871 return false; 1872 } 1873 }); 1874 if ( mobile_hidden ) { 1875 $ul.addClass('mobile-hidden'); 1876 } 1877 if ( tablet_hidden ) { 1878 $ul.addClass('tablet-hidden'); 1879 } 1880 }); 1881 1882 var $divUlsMB = $('div:has(>ul.mobile-hidden)'); 1883 1884 $divUlsMB.each(function(){ 1885 var $divUlMB = $(this), 1886 div_mobile_hidden = true, 1887 div_tablet_hidden = true; 1888 1889 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1890 if ( !$(this).hasClass('mobile-hidden') ) { 1891 div_mobile_hidden = false; 1892 return false; 1893 } 1894 }); 1895 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1896 if ( !$(this).hasClass('tablet-hidden') ) { 1897 div_tablet_hidden = false; 1898 return false; 1899 } 1900 }); 1901 if ( div_mobile_hidden ) { 1902 $divUlMB.addClass('mobile-hidden'); 1903 } 1904 if ( div_tablet_hidden ) { 1905 $divUlMB.addClass('tablet-hidden'); 1906 } 1907 }); 1908 }); 1909 1910 var overlaySearchButton = function(){ 1911 var $search_wrap = $('.overlay.overlay-search, .widget_search'); 1912 1913 $search_wrap.each(function(){ 1914 var $form = $('form', this), 1915 $icon = $('i', $form); 1916 1917 $icon.on('click', function(){ 1918 $form.submit(); 1919 }); 1920 }); 1921 }; 1922 overlaySearchButton(); 1923} 1924 1925UNCODE.okvideo = function() { 1926 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1927 $.okvideo = function(options) { 1928 // if the option var was just a string, turn it into an object 1929 if (typeof options !== 'object') options = { 1930 'video': options 1931 }; 1932 var base = this; 1933 // kick things off 1934 base.init = function() { 1935 base.options = $.extend({}, $.okvideo.options, options); 1936 // support older versions of okvideo 1937 if (base.options.video === null) base.options.video = base.options.source; 1938 base.setOptions(); 1939 var target = base.options.target || $('body'); 1940 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1941 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1942 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1943 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>'; 1944 if (OKEvents.utils.isMobile()) { 1945 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>'); 1946 } else { 1947 if (base.options.controls === 3) { 1948 target.append(mask) 1949 } 1950 if (base.options.adproof === 1) { 1951 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>'); 1952 } else { 1953 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>'); 1954 } 1955 } 1956 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1957 if (base.options.playlist.list === null) { 1958 if (base.options.video.provider === 'youtube') { 1959 base.loadYouTubeAPI(); 1960 } else if (base.options.video.provider === 'vimeo') { 1961 base.options.volume /= 100; 1962 base.loadVimeoAPI(); 1963 } 1964 } else { 1965 base.loadYouTubeAPI(); 1966 } 1967 } 1968 }; 1969 // clean the options 1970 base.setOptions = function() { 1971 // exchange 'true' for '1' and 'false' for 3 1972 for (var key in this.options) { 1973 if (this.options[key] === true) this.options[key] = 1; 1974 if (this.options[key] === false) this.options[key] = 3; 1975 } 1976 if (base.options.playlist.list === null) { 1977 base.options.video = base.determineProvider(); 1978 } 1979 // pass options to the window 1980 $(window).data('okoptions-' + base.options.id, base.options); 1981 };
1982 // insert js into the head and exectue a callback function 1983 base.insertJS = function(src, callback){ 1984 var tag; 1985 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1986 tag = UNCODE.insertedSripts[src]; 1987 if (callback){ 1988 if (tag.readyState){ //IE 1989 tag.onreadystatechange = function(){ 1990 if (tag.readyState === "loaded" || 1991 tag.readyState === "complete"){ 1992 tag.onreadystatechange = null; 1993 callback(); 1994 } 1995 }; 1996 } else { 1997 $(tag).on('load', callback); 1998 } 1999 } 2000 return; 2001 } 2002 tag = document.createElement('script'); 2003 if (callback){ 2004 if (tag.readyState){ //IE 2005 tag.onreadystatechange = function(){ 2006 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 2007 tag.onreadystatechange = null; 2008 callback(); 2009 } 2010 }; 2011 } else { 2012 tag.onload = function() { 2013 callback(); 2014 }; 2015 } 2016 } 2017 tag.src = src; 2018 var firstScriptTag = document.getElementsByTagName('script')[0]; 2019 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2020 if ( ! UNCODE.insertedSripts ) { 2021 UNCODE.insertedSripts = []; 2022 } 2023 UNCODE.insertedSripts[src] = tag; 2024 }; 2025 // load the youtube api 2026 base.loadYouTubeAPI = function(callback) { 2027 base.insertJS('https://www.youtube.com/player_api'); 2028 }; 2029 base.loadYouTubePlaylist = function() { 2030 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 2031 }; 2032 // load the vimeo api by replacing the div with an iframe and loading js 2033 base.loadVimeoAPI = function() { 2034 var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0', 2035 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >'); 2036 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 2037 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 2038 base.insertJS('//player.vimeo.com/api/player.js', function() { 2039 vimeoPlayerReady(base.options.id); 2040 }); 2041 }; 2042 // is it from youtube or vimeo? 2043 base.determineProvider = function() { 2044 var a = document.createElement('a'); 2045 a.href = base.options.video; 2046 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 2047 var videoid = a.href.split('/')[3].toString(); 2048 var query = videoid.substring(videoid.indexOf('?') + 1); 2049 if (query != '') { 2050 var vars = query.split('&'); 2051 for (var i = 0; i < vars.length; i++) { 2052 var pair = vars[i].split('='); 2053 if (pair[0] == 'v') { 2054 videoid = pair[1]; 2055 } 2056 } 2057 } 2058 return { 2059 "provider": "youtube", 2060 "id": videoid 2061 }; 2062 } else if (/vimeo.com/.test(base.options.video)) { 2063 return { 2064 "provider": "vimeo", 2065 "id": (a.href.split('/')[3].toString()).split('#')[0], 2066 }; 2067 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 2068 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 2069 if (id.length == 11) { 2070 return { 2071 "provider": "youtube", 2072 "id": id.toString() 2073 }; 2074 } else { 2075 for (var i = 0; i < base.options.video.length; i++) { 2076 if (typeof parseInt(base.options.video[i]) !== "number") { 2077 throw 'not vimeo but thought it was for a sec'; 2078 } 2079 } 2080 return { 2081 "provider": "vimeo", 2082 "id": base.options.video 2083 }; 2084 } 2085 } else { 2086 throw "OKVideo: Invalid video source"; 2087 } 2088 }; 2089 base.init(); 2090 }; 2091 2092 var checkResize, 2093 newW = UNCODE.wwidth; 2094 2095 $.okvideo.options = { 2096 id: null, 2097 source: null, // Deprecate dis l8r 2098 video: null, 2099 playlist: { // eat ur heart out @brokyo 2100 list: null, 2101 index: 0, 2102 startSeconds: 0, 2103 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 2104 }, 2105 disableKeyControl: 1, 2106 captions: 0, 2107 loop: 1, 2108 hd: 1, 2109 volume: 0, 2110 adproof: false, 2111 unstarted: null, 2112 onFinished: null, 2113 onReady: null, 2114 onPlay: null, 2115 onPause: null, 2116 buffering: null, 2117 controls: false, 2118 autoplay: true, 2119 annotations: true, 2120 cued: null 2121 }; 2122 $.fn.okvideo = function(options) { 2123 options.target = this; 2124 return this.each(function() { 2125 (new $.okvideo(options)); 2126 }); 2127 }; 2128 2129 var checkForVideos = function(){ 2130 $(".uncode-video-container.video").each(function(index, el) { 2131 var $this = $(this), 2132 mobile_ready = $this.hasClass('no-control-mobile-autoplay'), 2133 url = $this.attr('data-video'), 2134 id = $this.attr('data-id'), 2135 cloned = $this.closest('.owl-item'); 2136 2137 if ( mobile_ready || newW >= UNCODE.mediaQuery ) { 2138 if (!cloned.hasClass('cloned') || cloned.length == 0) { 2139 $this.okvideo({ 2140 id: id, 2141 source: url.split('#')[0], 2142 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 2143 autoplay: 1, 2144 controls: 0, 2145 volume: 0, 2146 adproof: 0, 2147 caller: $this, 2148 hd: 1, 2149 onReady: function(player) { 2150 var getPlayer = player.c || player.h || player, 2151 $iframe, 2152 getContainer = $(getPlayer).closest('.background-element'); 2153 if (getContainer.length) { 2154 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 2155 } 2156 2157 if ( $this.hasClass('drop-move') ) { 2158 2159 var $iframe = $(getPlayer), 2160 w = parseFloat($iframe.attr('width')), 2161 h = parseFloat($iframe.attr('height')), 2162 ratio = h / w, 2163 setResizeiFto, 2164 resizeiFrame = function(){ 2165 var dataW = $this.attr('data-w'), 2166 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2167 newH = newW * ratio; 2168 $iframe.css({ 2169 width: newW, 2170 height: newH 2171 }); 2172 }; 2173 resizeiFrame(); 2174 $(window).on( 'load', resizeiFrame ); 2175 $(window).on( 'resize', function(){ 2176 clearRequestTimeout(setResizeiFto); 2177 setResizeiFto = requestTimeout( function() { 2178 resizeiFrame(); 2179 }, 10 ); 2180 }); 2181 2182 } 2183 2184 } 2185 }); 2186 } 2187 } 2188 }); 2189 }; 2190 2191 checkForVideos(); 2192 2193 $(window).on('load', function(){ 2194 $('.mejs-fullscreen-button button').on('click', function(){ 2195 var $button = $(this), 2196 $stuck = $button.closest('.is_stucked'); 2197 2198 if ( $stuck.length ) { 2199 $stuck = $(this).trigger("sticky_kit:detach"); 2200 window.scrollTo(0, 0); 2201 } 2202 }); 2203 }); 2204 2205 var checkVideoResize = function(){ 2206 clearRequestTimeout(checkResize); 2207 checkResize = requestTimeout(function(){ 2208 if ( newW !== UNCODE.wwidth ) { 2209 newW = UNCODE.wwidth; 2210 checkForVideos(); 2211 } 2212 }, 1000); 2213 }; 2214 2215 $(window).off('resize', checkVideoResize) 2216 .on( 'resize', checkVideoResize); 2217 2218}; 2219 2220UNCODE.backgroundSelfVideos = function( $ctx ) { 2221 2222 var backgroundSelfVideosInit = function( $ctx ) { 2223 if ( SiteParameters.block_mobile_videos === true ) { 2224 return false;
2225 } 2226 if (typeof MediaElement === "function") { 2227 if ( typeof $ctx === 'undefined' ) { 2228 $ctx = document; 2229 } 2230 2231 $(".background-video-shortcode", $ctx).each(function(index, el) { 2232 if ( $(this).closest('mediaelementwrapper').length ) { 2233 return true; 2234 } 2235 var $video_el = $(this), 2236 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 2237 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 2238 video_id = $video_el.attr('id'); 2239 2240 if ( SiteParameters.is_frontend_editor ) { 2241 video_id = video_id + '_' + index; 2242 $video_el.attr('id', video_id); 2243 } 2244 2245 var media = new MediaElement(video_id, { 2246 startVolume: 0, 2247 loop: true, 2248 success: function(mediaElement, domObject) { 2249 domObject.volume = 0; 2250 $(mediaElement).data('started', false); 2251 mediaElement.addEventListener('timeupdate', function(e) { 2252 if (!$(e.target).data('started')) { 2253 $(mediaElement).data('started', true); 2254 } 2255 }); 2256 mediaElement.addEventListener('loadedmetadata', function(e) { 2257 $('body').removeClass('video-not-supported'); 2258 mediaElement.play(); 2259 }); 2260 if (!UNCODE.isMobile) { 2261 requestTimeout(function() { 2262 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 2263 }, 100); 2264 } 2265 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 2266 mediaElement.play(); 2267 } 2268 2269 if ( $parent_drop_move.length ) { 2270 var setResizeMEto, 2271 resizeMediaElement = function(){ 2272 var dataW = $parent_drop_move.attr('data-w'), 2273 videoW = domObject.width, 2274 videoH = domObject.height, 2275 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2276 newH = newW / ( videoW / videoH ); 2277 2278 $(domObject).css({ 2279 'height': newH, 2280 'width': newW 2281 }); 2282 }; 2283 $(window).on( 'resize load', function(){ 2284 clearRequestTimeout(setResizeMEto); 2285 setResizeMEto = requestTimeout( function() { 2286 resizeMediaElement(); 2287 }, 10 ); 2288 }); 2289 } 2290 2291 mediaElement.addEventListener('play', function() { 2292 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2293 $(mediaElement).closest('#page-header').addClass('video-started'); 2294 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2295 }, true); 2296 2297 }, 2298 // fires when a problem is detected 2299 error: function() {} 2300 }); 2301 }); 2302 } else { 2303 2304 if ( typeof $ctx === 'undefined' ) { 2305 $ctx = document; 2306 } 2307 2308 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 2309 Array.from(videos).forEach(function(video_el) { 2310 video_el.addEventListener('loadedmetadata', function(e) { 2311 $('body').removeClass('video-not-supported'); 2312 video_el.play(); 2313 }); 2314 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 2315 video_el.muted = true; 2316 video_el.loop = true; 2317 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2318 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 2319 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2320 $('body').removeClass('video-not-supported'); 2321 video_el.play(); 2322 } else { 2323 requestTimeout(function(){ 2324 backgroundSelfVideosInit( $ctx ); 2325 }, 1000); 2326 } 2327 }); 2328 } 2329 }; 2330 2331 backgroundSelfVideosInit( $ctx ); 2332 2333 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2334 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 2335 var $el = model.view.$el, 2336 shortcode = model.attributes.shortcode; 2337 2338 if (typeof MediaElement === "function") { 2339 backgroundSelfVideosInit( $el ); 2340 } else { 2341 backgroundSelfVideosInit( $el[0] ); 2342 } 2343 }); 2344 } 2345}; 2346 2347UNCODE.is_scrolling = false; 2348 2349UNCODE.disableHoverScroll = function() { 2350 2351 if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) { 2352 var body = document.body, 2353 timer; 2354 2355 window.addEventListener('scroll', function() {
2356 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 2357 clearRequestTimeout(timer); 2358 if ( body.classList && !body.classList.contains('disable-hover') ) { 2359 body.classList.add('disable-hover'); 2360 window.dispatchEvent(new CustomEvent('disable-hover')); 2361 } 2362 UNCODE.is_scrolling = true; 2363 2364 timer = requestTimeout(function() { 2365 if ( body.classList ) { 2366 body.classList.remove('disable-hover'); 2367 window.dispatchEvent(new CustomEvent('enable-hover')); 2368 } 2369 UNCODE.is_scrolling = false; 2370 }, delay); 2371 }, false); 2372 } 2373}; 2374 2375UNCODE.isotopeLayout = function() { 2376 if ($('.isotope-layout').length > 0) { 2377 var isotopeContainersArray = [], 2378 typeGridArray = [], 2379 layoutGridArray = [], 2380 screenLgArray = [], 2381 screenMdArray = [], 2382 screenSmArray = [], 2383 transitionDuration = [], 2384 $filterItems = [], 2385 $filters = $('.isotope-system .isotope-filters'), 2386 $itemSelector = '.tmb-iso', 2387 $items, 2388 itemMargin, 2389 correctionFactor = 0, 2390 firstLoad = true, 2391 isOriginLeft = $('body').hasClass('rtl') ? false : true; 2392 $('[class*="isotope-container"]').each(function(index) { 2393 var _this = $(this); 2394 var isoData = _this.data(), 2395 $data_lg, 2396 $data_md, 2397 $data_sm; 2398 _this.children('.tmb').addClass('tmb-iso'); 2399 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 2400 else $data_lg = '1000'; 2401 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 2402 else $data_md = '600'; 2403 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 2404 else $data_sm = '480'; 2405 screenLgArray.push($data_lg); 2406 screenMdArray.push($data_md); 2407 screenSmArray.push($data_sm); 2408 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 2409 if (isoData.type == 'metro') typeGridArray.push(true); 2410 else typeGridArray.push(false); 2411 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 2412 else layoutGridArray.push('masonry'); 2413 isotopeContainersArray.push(_this); 2414 _this.attr('data-iso-index', index); 2415 }); 2416 var colWidth = function(index) { 2417 $(isotopeContainersArray[index]).width(''); 2418 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 2419 widthAvailable = $(isotopeContainersArray[index]).width(), 2420 columnNum = 12, 2421 columnWidth = 0, 2422 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 2423 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 2424 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 2425 $rowContainer, 2426 paddingRow, 2427 $colContainer, 2428 paddingCol; 2429 2430 if ( consider_menu ) 2431 winHeight = winHeight - UNCODE.menuHeight; 2432 2433 if ( data_vp_height === '1' ) { 2434 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 2435 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2436 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 2437 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 2438 winHeight = winHeight - ( paddingRow + paddingCol ); 2439 } 2440 2441 if (isPx) { 2442 columnWidth = Math.ceil(widthAvailable / columnNum); 2443 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 2444 } else { 2445 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 2446 } 2447 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 2448 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 2449 for (var i = 0, len = $items.length; i < len; i++) { 2450 var $item = $($items[i]), 2451 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 2452 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 2453 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 2454 2455 2456 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 2457 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 2458 } 2459 2460 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 2461 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 2462 } 2463 2464 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 2465 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2466 switch (parseInt(multiplier_w[1])) { 2467 case (5): 2468 case (4): 2469 case (3): 2470 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2471 multiplier_w[1] = 6; 2472 break; 2473 case (2): 2474 case (1): 2475 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 2476 multiplier_w[1] = 3; 2477 break; 2478 default: 2479 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2480 multiplier_w[1] = 12; 2481 break; 2482 } 2483 2484 if (multiplier_w[1] == 2.4) { // 5 columns 2485 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2486 multiplier_w[1] = 6; 2487 } 2488 } 2489 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 2490 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2491 switch (parseInt(multiplier_w[1])) { 2492 case (5): 2493 case (4): 2494 case (3): 2495 case (2): 2496 case (1): 2497 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2498 multiplier_w[1] = 6; 2499 break; 2500 default: 2501 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2502 multiplier_w[1] = 12; 2503 break; 2504 } 2505 2506 if (multiplier_w[1] == 2.4) { // 5 columns 2507 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2508 multiplier_w[1] = 6; 2509 } 2510 } 2511 } else if (widthAvailable < screenSmArray[index]) { 2512 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2513 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2514 multiplier_w[1] = 12; 2515 if (typeGridArray[index]) multiplier_h[1] = 12; 2516 } 2517 } 2518 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 2519 height; 2520 2521 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 2522 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 2523 if ( widthAvailable < screenSmArray[index] ) { 2524 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 2525 } 2526 } else { 2527 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 2528 } 2529 2530 if (width >= widthAvailable) { 2531 $item.css({ 2532 width: widthAvailable 2533 }); 2534 if (typeGridArray[index]) { 2535 $item.children().add($item.find('.backimg')).css({ 2536 height: height 2537 }); 2538 } 2539 } else { 2540 $item.css({ 2541 width: width 2542 }); 2543 if (typeGridArray[index]) { 2544 $item.children().add($item.find('.backimg')).css({ 2545 height: height 2546 }); 2547 } 2548 } 2549 } 2550 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 2551 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 2552 } else { 2553 return columnWidth; 2554 } 2555 }, 2556 init_isotope = function() { 2557 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 2558 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 2559 isotopeId = isotopeSystem.attr('id'), 2560 $layoutMode = layoutGridArray[i], 2561 setIsotopeFirstRowTimeOut, 2562 setIsotopeFirstRow = function(items){ 2563 var firstRow = true; 2564 $(items).each(function(index, val){ 2565 var el = items[index].element, 2566 el_top = items[index].position.y, 2567 $el = $(el); 2568 if ( index > 0 && el_top > 0 && firstRow ) { 2569 firstRow = false;
2570 } else if ( index == 0 && el_top == 0 ) { 2571 firstRow = true; 2572 } 2573 if ( firstRow ) { 2574 $el.removeClass('tmb-isotope-further-row'); 2575 } else { 2576 $el.addClass('tmb-isotope-further-row'); 2577 } 2578 }); 2579 }; 2580 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 2581 //resizable: true, 2582 itemSelector: $itemSelector, 2583 layoutMode: $layoutMode, 2584 transitionDuration: transitionDuration[i], 2585 masonry: { 2586 columnWidth: colWidth(i) 2587 }, 2588 vertical: { 2589 horizontalAlignment: 0.5, 2590 }, 2591 sortBy: 'original-order', 2592 isOriginLeft: isOriginLeft 2593 }) 2594 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 2595 .on('layoutComplete', function( event, items ){ 2596 if ( typeof items[0] !== 'undefined' ) { 2597 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2598 setIsotopeFirstRow(items); 2599 } 2600 } 2601 }) 2602 .on('arrangeComplete', function( event, items ){ 2603 if ( typeof items[0] !== 'undefined' ) { 2604 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2605 clearRequestTimeout(setIsotopeFirstRowTimeOut); 2606 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 2607 setIsotopeFirstRow(items); 2608 }, 100); 2609 } 2610 } 2611 }); 2612 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 2613 $(isotopeContainersArray[i]).infinitescroll({ 2614 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 2615 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 2616 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat, #' + isotopeId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 2617 animate: false, 2618 behavior: 'local', 2619 debug: false, 2620 loading: { 2621 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 2622 speed: 0, 2623 finished: undefined, 2624 msg: $('#' + isotopeId + ' .loadmore-button'), 2625 }, 2626 errorCallback: function() { 2627 var isotope_system = $(this).closest('.isotope-system'); 2628 $('.loading-button', isotope_system).hide(); 2629 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 2630 } 2631 }, 2632 // append the new items to isotope on the infinitescroll callback function. 2633 function(newElements, opts) { 2634 var $isotope = $(this), 2635 isotope_system = $isotope.closest('.isotope-system'), 2636 isotopeId = isotope_system.attr('id'), 2637 filters = new Array(), 2638 $loading_button = isotope_system.find('.loading-button'), 2639 $infinite_button = isotope_system.find('.loadmore-button'), 2640 $numPages = $('a', $infinite_button).data('pages'), 2641 $woo_results, 2642 delay = 300; 2643 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 2644 $infinite_button.show(); 2645 $loading_button.hide(); 2646 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 2647 $('> li', $isotope).remove(); 2648 $('.isotope-container').find('.woocommerce-result-count-wrapper').remove(); 2649 $.each($(newElements), function (index, val) { 2650 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 2651 $woo_results = $(val); 2652 delete newElements[index]; 2653 } else { 2654 $(val).addClass('tmb-iso'); 2655 if ($(val).is("li")) { 2656 filters.push($(val)[0]); 2657 } 2658 } 2659 }); 2660 newElements = newElements.filter(function(x) { 2661 return filters.indexOf(x) < 0 2662 }); 2663 $.each($(filters), function(index, val) { 2664 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 2665 }); 2666 if ($woo_results && $woo_results.length > 0) { 2667 var old_count = isotope_system.find('.woocommerce-result-count').text(); 2668 var new_count = $woo_results.find('.woocommerce-result-count').text(); 2669 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 2670 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 2671 function replaceMatch(match, p1, p2) { 2672 return old_start + '–' + new_end; 2673 } 2674 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 2675 isotope_system.find('.woocommerce-result-count').text(new_count_text); 2676 } 2677 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 2678 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2679 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 2680 if (typeof getLightbox === 'object') { 2681 getLightbox.refresh(); 2682 } else { 2683 UNCODE.lightbox(); 2684 } 2685 } 2686 if ( typeof twttr !== 'undefined' ) 2687 twttr.widgets.load(isotopeContainersArray[i]); 2688 2689 requestTimeout(function() { 2690 Waypoint.refreshAll(); 2691 $isotope.trigger('more-items-loaded'); 2692 $(window).trigger('more-items-loaded'); 2693 }, 1000); 2694 2695 }); 2696 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 2697 var $infinite_isotope = $(isotopeContainersArray[i]), 2698 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 2699 $infinite_isotope.infinitescroll('pause'); 2700 $infinite_button.on('click', function(event) { 2701 event.preventDefault(); 2702 var $infinite_system = $(event.target).closest('.isotope-system'), 2703 $infinite_isotope = $infinite_system.find('.isotope-container'), 2704 isotopeId = $infinite_system.attr('id'); 2705 $(event.currentTarget).html(SiteParameters.loading); 2706 $infinite_isotope.infinitescroll('resume'); 2707 $infinite_isotope.infinitescroll('retrieve'); 2708 $infinite_isotope.infinitescroll('pause'); 2709 }); 2710 } 2711 } 2712 } 2713 }, 2714 onLayout = function(isotopeObj, startIndex, needsReload) { 2715 var needsReload = needsReload ? true : false;
2716 2717 if (typeof UNCODE.bigText !== 'undefined') { 2718 UNCODE.bigText(); 2719 } 2720 isotopeObj.css('opacity', 1); 2721 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 2722 2723 requestTimeout(function() { 2724 if (startIndex > 0) { 2725 reloadIsotope(isotopeObj); 2726 if (SiteParameters.dynamic_srcset_active === '1') { 2727 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2728 UNCODE.adaptive_srcset(isotopeObj); 2729 } 2730 // window.dispatchEvent(UNCODE.boxEvent); 2731 } else if (needsReload) { 2732 reloadIsotope(isotopeObj); 2733 } 2734 2735 UNCODE.adaptive(); 2736 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 2737 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2738 } 2739 if (typeof MediaElement === "function") { 2740 $(isotopeObj).find('audio,video').each(function() { 2741 $(this).mediaelementplayer({ 2742 pauseOtherPlayers: false, 2743 }); 2744 }); 2745 } 2746 if ($(isotopeObj).find('.nested-carousel').length) { 2747 if (typeof UNCODE.carousel !== 'undefined') { 2748 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 2749 } 2750 requestTimeout(function() { 2751 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2752 }, 200); 2753 } else { 2754 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2755 } 2756 isotopeObj.trigger('isotope-layout-complete'); 2757 2758 }, 100); 2759 2760 }, 2761 boxAnimation = function(items, startIndex, sequential, container) { 2762 var $allItems = items.length - startIndex, 2763 showed = 0, 2764 index = 0; 2765 if (container.closest('.owl-item').length == 1) return false; 2766 $.each(items, function(index, val) { 2767 var $this = $(val), 2768 elInner = $('> .t-inside', val); 2769 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2770 return; 2771 } 2772 if (val[0]) val = val[0]; 2773 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 2774 new Waypoint({ 2775 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2776 element: val, 2777 handler: function() { 2778 var element = $('> .t-inside', this.element), 2779 parent = $(this.element), 2780 currentIndex = parent.index(); 2781 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 2782 delayAttr = parseInt(element.attr('data-delay')); 2783 if (isNaN(delayAttr)) delayAttr = 100; 2784 delay -= showed; 2785 var objTimeout = requestTimeout(function() { 2786 element.removeClass('zoom-reverse').addClass('start_animation'); 2787 showed = parent.index(); 2788 if ( container.data('isotope') ) { 2789 container.isotope('layout'); 2790 } 2791 }, delay * delayAttr) 2792 parent.data('objTimeout', objTimeout); 2793 if (!UNCODE.isUnmodalOpen) { 2794 this.destroy(); 2795 } 2796 }, 2797 offset: '100%' 2798 }) 2799 } else { 2800 if (elInner.hasClass('force-anim')) { 2801 elInner.addClass('start_animation'); 2802 } else { 2803 elInner.css('opacity', 1); 2804 } 2805 container.isotope('layout'); 2806 } 2807 2808 index++; 2809 }); 2810 }, 2811 reloadIsotope = function(isotopeObj) { 2812 var isoIndex = $(isotopeObj).attr('data-iso-index'); 2813 var $layoutMode = ($(isotopeObj).data('layout')); 2814 if ($layoutMode === undefined) { 2815 $layoutMode = 'masonry'; 2816 } 2817 if (isotopeObj.data('isotope')) { 2818 isotopeObj.isotope({ 2819 itemSelector: $itemSelector, 2820 layoutMode: $layoutMode, 2821 transitionDuration: transitionDuration[isoIndex], 2822 masonry: { 2823 columnWidth: colWidth(isoIndex) 2824 }, 2825 vertical: { 2826 horizontalAlignment: 0.5, 2827 }, 2828 sortBy: 'original-order', 2829 isOriginLeft: isOriginLeft 2830 }); 2831 } 2832 } 2833 ; 2834 if ($('.isotope-pagination').length > 0) { 2835 $('.isotope-system').on('click', '.pagination a', function(evt) { 2836 evt.preventDefault(); 2837 2838 if (SiteParameters.index_pagination_disable_scroll !== '1') { 2839 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 2840 container = $(this).closest('.isotope-system'), 2841 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2842 calc_scroll -= UNCODE.get_scroll_offset(); 2843 2844 var menu_container = $('.menu-sticky'); 2845 var menu = menu_container.find('.menu-container'); 2846 2847 if (menu_container.length > 0 && menu.length > 0) { 2848 calc_scroll = calc_scroll - menu.outerHeight(); 2849 } 2850 2851 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2852 delta = bodyTop - calc_scroll, 2853 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 2854 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2855 2856 if (!UNCODE.isFullPage) { 2857 if (scrollSpeed == 0) { 2858 $('html, body').scrollTop(calc_scroll); 2859 } else { 2860 $('html, body').animate({ 2861 scrollTop: calc_scroll 2862 }, {
2863 easing: 'easeInOutQuad', 2864 duration: scrollSpeed, 2865 complete: function () { 2866 UNCODE.scrolling = false; 2867 } 2868 }); 2869 } 2870 } 2871 } 2872 2873 loadIsotope($(this), true); 2874 }); 2875 } 2876 $filters.on('click', 'a.isotope-nav-link', function(evt) { 2877 if ($(this).hasClass('no-isotope-filter')) { 2878 return; 2879 } 2880 var $filter = $(this), 2881 filterContainer = $filter.closest('.isotope-filters'), 2882 filterValue = $filter.attr('data-filter'), 2883 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 2884 transitionDuration = container.data().isotope.options.transitionDuration, 2885 delay = 300, 2886 filterItems = []; 2887 2888 var filter_items = function(){ 2889 if (filterValue !== undefined) { 2890 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2891 var parent = $(val).parent(), 2892 objTimeout = parent.data('objTimeout'); 2893 if (objTimeout) { 2894 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2895 clearRequestTimeout(objTimeout); 2896 } 2897 if (transitionDuration == 0) { 2898 if ($(val).hasClass('animate_when_almost_visible')) { 2899 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2900 } else { 2901 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2902 } 2903 } 2904 }); 2905 requestTimeout(function(){ 2906 if ( filterValue == '*' ) { 2907 container.removeClass('isotope-filtered'); 2908 } else { 2909 container.addClass('isotope-filtered'); 2910 } 2911 container.isotope({ 2912 filter: function() { 2913 var block = $(this), 2914 filterable = (filterValue == '*') || block.hasClass(filterValue), 2915 lightboxElements = $('[data-lbox^=ilightbox]', block); 2916 if (filterable) { 2917 if (lightboxElements.length) { 2918 lightboxElements.removeClass('lb-disabled'); 2919 container.data('lbox', $(lightboxElements[0]).data('lbox')); 2920 } 2921 filterItems.push(block); 2922 } else { 2923 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 2924 } 2925 container.trigger('more-items-loaded'); 2926 $(window).trigger('more-items-loaded'); 2927 return filterable; 2928 } 2929 }); 2930 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 2931 2932 }, delay); 2933 2934 /** once filtered - start **/ 2935 container.isotope('once', 'arrangeComplete', function() { 2936 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2937 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 2938 if (typeof getLightbox === 'object') { 2939 getLightbox.refresh(); 2940 } else { 2941 UNCODE.lightbox(); 2942 } 2943 } 2944 if (transitionDuration == 0) { 2945 requestTimeout(function() { 2946 boxAnimation(filterItems, 0, false, container); 2947 }, 100); 2948 } 2949 requestTimeout(function() { 2950 Waypoint.refreshAll(); 2951 }, 2000); 2952 }); 2953 /** once filtered - end **/ 2954 } else { 2955 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2956 $.each(UNCODE.lightboxArray, function(index, val) { 2957 UNCODE.lightboxArray[index].destroy(); 2958 }); 2959 } 2960 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2961 var parent = $(val).parent(), 2962 objTimeout = parent.data('objTimeout'); 2963 if (objTimeout) { 2964 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2965 clearRequestTimeout(objTimeout); 2966 } 2967 if (transitionDuration == 0) { 2968 if ($(val).hasClass('animate_when_almost_visible')) { 2969 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2970 } else { 2971 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2972 } 2973 } 2974 }); 2975 container.parent().addClass('grid-loading'); 2976 loadIsotope($filter); 2977 } 2978 }; 2979 2980 if (!$filter.hasClass('active')) { 2981 /** Scroll top with filtering */ 2982 if (filterContainer.hasClass('filter-scroll')) { 2983 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2984 calc_scroll -= UNCODE.get_scroll_offset(); 2985 2986 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2987 delta = bodyTop - calc_scroll, 2988 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 2989 filterTolerance = false, 2990 filter_timeout; 2991 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2992 2993 if ( !UNCODE.isFullPage ) { 2994 if (scrollSpeed == 0) { 2995 $('html, body').scrollTop(calc_scroll); 2996 UNCODE.scrolling = false;
2997 filter_items(); 2998 } else { 2999 3000 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 3001 filter_items(); 3002 filterTolerance = true; 3003 } 3004 3005 $('html, body').animate({ 3006 scrollTop: calc_scroll 3007 },{ 3008 easing: 'easeInOutQuad', 3009 duration: scrollSpeed, 3010 complete: function(){ 3011 UNCODE.scrolling = false; 3012 if ( !filterTolerance ) { 3013 filter_timeout = setTimeout(function(){ 3014 clearTimeout(filter_timeout); 3015 filter_items(); 3016 }, 200); 3017 } 3018 } 3019 }); 3020 } 3021 } 3022 } else { 3023 filter_items(); 3024 } 3025 } 3026 evt.preventDefault(); 3027 }); 3028 3029 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 3030 var params = UNCODE.getURLParams(window.location); 3031 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 3032 3033 UNCODE.lastURL = window.location.href; 3034 3035 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 3036 return; 3037 } 3038 3039 if (params.id === undefined) { 3040 $.each($('.isotope-system'), function(index, val) { 3041 loadIsotope($(val)); 3042 }); 3043 } else { 3044 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 3045 loadIsotope($('#' + params.id)); 3046 } 3047 } 3048 }); 3049 3050 var loadIsotope = function($href, $paginating) { 3051 var is_paginating = false; 3052 3053 if (undefined !== $paginating && $paginating) { 3054 var is_paginating = $paginating; 3055 } 3056 3057 var href = ($href.is("a") ? $href.attr('href') : location), 3058 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 3059 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 3060 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 3061 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 3062 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 3063 isotopeId = isotopeSystem.attr('id'); 3064 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 3065 UNCODE.lastURL = href; 3066 history.pushState({ 3067 myIsotope: true 3068 }, document.title, href); 3069 } 3070 if (is_paginating) { 3071 isotopeWrapper.addClass('grid-filtering'); 3072 } 3073 $.ajax({ 3074 url: href 3075 }).done(function(data) { 3076 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 3077 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 3078 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 3079 isotopeWrapper.addClass('isotope-reloaded'); 3080 requestTimeout(function() { 3081 isotopeWrapper.removeClass('grid-loading'); 3082 isotopeWrapper.removeClass('isotope-reloaded'); 3083 isotopeWrapper.removeClass('grid-filtering'); 3084 }, 500); 3085 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 3086 var parent = $(val).parent(), 3087 objTimeout = parent.data('objTimeout'); 3088 if (objTimeout) { 3089 $(val).removeClass('zoom-reverse').removeClass('start_animation') 3090 clearRequestTimeout(objTimeout); 3091 } 3092 if ($(val).hasClass('animate_when_almost_visible')) { 3093 $(val).addClass('zoom-reverse').removeClass('start_animation'); 3094 } else { 3095 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 3096 } 3097 }); 3098 requestTimeout(function() { 3099 if (isotopeContainer.data('isotope')) { 3100 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 3101 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 3102 UNCODE.adaptive(); 3103 if (SiteParameters.dynamic_srcset_active === '1') { 3104 UNCODE.adaptive_srcset(isotopeContainer); 3105 } 3106 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 3107 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 3108 if (typeof getLightbox === 'object') { 3109 getLightbox.refresh(); 3110 } else { 3111 UNCODE.lightbox(); 3112 } 3113 } 3114 } 3115 isotopeContainer.trigger('more-items-loaded'); 3116 $(window).trigger('more-items-loaded'); 3117 }, 300); 3118 $('.pagination', isotopeFooter).remove(); 3119 isotopeFooter.append($resultPagination); 3120 3121 if (isotopeResultCount.length > 0) { 3122 $('.woocommerce-result-count', isotopeResultCount).remove(); 3123 isotopeResultCount.append($resultCount); 3124 } 3125 }); 3126 }; 3127 $filters.each(function(i, buttonGroup) { 3128 var $buttonGroup = $(buttonGroup); 3129 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 3130 $buttonGroup.find('.active').removeClass('active'); 3131 $(this).addClass('active'); 3132 3133 }); 3134 3135 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 3136 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 3137 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 3138 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 3139 e.preventDefault(); 3140 $cats_filters.slideToggle(400, 'easeInOutCirc'); 3141 }); 3142 3143 }); 3144 window.addEventListener('boxResized', function(e) { 3145 if (UNCODE.printDialogOpen !== false) { 3146 return false;
3147 } 3148 $.each($('.isotope-layout'), function(index, val) { 3149 var $layoutMode = ($(this).data('layout')); 3150 if ($layoutMode === undefined) $layoutMode = 'masonry'; 3151 if ($(this).data('isotope')) { 3152 $(this).isotope({ 3153 itemSelector: $itemSelector, 3154 layoutMode: $layoutMode, 3155 transitionDuration: transitionDuration[index], 3156 masonry: { 3157 columnWidth: colWidth(index) 3158 }, 3159 vertical: { 3160 horizontalAlignment: 0.5, 3161 }, 3162 sortBy: 'original-order', 3163 isOriginLeft: isOriginLeft 3164 }); 3165 $(this).isotope('unbindResize'); 3166 if (SiteParameters.dynamic_srcset_active === '1') { 3167 UNCODE.refresh_dynamic_srcset_size($(this)); 3168 } 3169 } 3170 $(this).find('.mejs-video,.mejs-audio').each(function() { 3171 $(this).trigger('resize'); 3172 }); 3173 }); 3174 }, false); 3175 3176 init_isotope(); 3177 }; 3178} 3179 3180UNCODE.lightbox = function() { 3181 if ( SiteParameters.lbox_enhanced ) { 3182 return true; 3183 } 3184 UNCODE.lightboxArray = {}; 3185 requestTimeout(function() { 3186 var groupsArr = {}; 3187 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 3188 var group = this.getAttribute("data-lbox"), 3189 values = $(this).data(); 3190 $(this).attr('data-lbox-init','true') 3191 groupsArr[group] = values; 3192 }); 3193 for (var i in groupsArr) { 3194 var skin = groupsArr[i].skin || 'black', 3195 path = groupsArr[i].dir || 'horizontal', 3196 thumbs = !groupsArr[i].notmb || false, 3197 arrows = !groupsArr[i].noarr || false, 3198 social = groupsArr[i].social || false, 3199 deeplink = groupsArr[i].deep || false, 3200 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 3201 counter = $els.length, 3202 dataAlbum = $els.attr('data-album'); 3203 if (social) social = { 3204 facebook: true, 3205 twitter: true, 3206 reddit: true, 3207 digg: true 3208 }; 3209 UNCODE.lightboxArray[i] = $els.iLightBox({ 3210 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 3211 skin: skin, 3212 path: path, 3213 linkId: deeplink, 3214 infinite: false, 3215 //fullViewPort: 'fit', 3216 smartRecognition: false, 3217 fullAlone: true, 3218 maxScale: 1, 3219 minScale: .02, 3220 //fullStretchTypes: 'flash, video', 3221 overlay: { 3222 opacity: .94 3223 }, 3224 controls: { 3225 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 3226 fullscreen: true, 3227 thumbnail: thumbs, 3228 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 3229 }, 3230 show: { 3231 speed: 200 3232 }, 3233 hide: { 3234 speed: 200 3235 }, 3236 social: { 3237 start: false, 3238 buttons: social 3239 }, 3240 caption: { 3241 start: false 3242 }, 3243 styles: { 3244 nextOpacity: 1, 3245 nextScale: 1, 3246 prevOpacity: 1, 3247 prevScale: 1 3248 }, 3249 effects: { 3250 switchSpeed: 400 3251 }, 3252 slideshow: { 3253 pauseTime: 5000 3254 }, 3255 thumbnails: { 3256 maxWidth: 60, 3257 maxHeight: 60, 3258 activeOpacity: .2 3259 }, 3260 html5video: { 3261 preload: true 3262 }, 3263 callback: { 3264 onOpen: function(){ 3265 $(window).trigger('uncode-custom-cursor'); 3266 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3267 iNoBounce.enable(); 3268 } 3269 }, 3270 onHide: function(){ 3271 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3272 iNoBounce.disable() 3273 } 3274 }, 3275 } 3276 }); 3277 3278 $(document).on('infinite-loaded', function(){ 3279 UNCODE.lightboxArray[i].refresh(); 3280 }); 3281 3282 $(window).on('gdprOpen', function(){ 3283 UNCODE.lightboxArray[i].close(); 3284 }); 3285 }; 3286 }, 100); 3287 3288 $(document).on('click', '.lb-disabled', function(e){ 3289 e.preventDefault(); 3290 }); 3291}; 3292 3293UNCODE.lightgallery = function( $el ) { 3294 var createSelectors = function(){ 3295 $('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){ 3296 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3297 $(this).addClass('lbox-trigger-item'); 3298 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3299 $(this).addClass('lbox-nested-item'); 3300 } else { 3301 $(this).removeClass('lbox-trigger-item'); 3302 $(this).removeClass('lbox-nested-item'); 3303 } 3304 }); 3305 }; 3306 3307 createSelectors(); 3308 3309 var galleries = [], 3310 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3311 return !$(this).closest('.nested-carousel').length; 3312 }), 3313 $_galleries = $('.isotope-container:not([data-lbox-init]), .owl-carousel:not([data-lbox-init]), .custom-grid-container:not([data-lbox-init]), .index-scroll-wrapper:not([data-lbox-init]), .justified-gallery:not([data-lbox-init]), .uncode-single-media-wrapper:not([data-lbox-init]), .woocommerce-product-gallery:not([data-lbox-init]), .icon-box:not([data-lbox-init]), .grid-container:not([data-lbox-init]), .btn-container').has('.lbox-trigger-item').not('.isotope-container *, .owl-carousel *, .index-scroll-wrapper *, .justified-gallery *, .woocommerce-product-gallery *, .grid-container *'), 3314 $galleries = $_galleries.filter(function( index ) { 3315 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3316 }), 3317 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 3318 3319 if ( typeof $el === 'undefined' ) { 3320 $el = $galleries.add( $nested ); 3321 } 3322 3323 var $disabled = $('a.lb-disabled'); 3324 $disabled.on('click', function(e){ 3325 e.preventDefault(); 3326 }); 3327 3328 var beforeSlide = function(event) { 3329 var detail = event.detail, 3330 info = detail.info, 3331 item = detail.item, 3332 $slide = $(detail.currentSlide.selector), 3333 $video = $('video', $slide), 3334 $previous = $(detail.previousSlide.selector), 3335 $prevVideo = $('video', $previous), 3336 isAudio = false;
3337 3338 if ( typeof info.src !== 'undefined' ) { 3339 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 3340 } 3341 3342 if ( ! $video.length && ( info.video || isAudio ) ) { 3343 if ( info.video ) { 3344 if ( typeof info.video === 'object' ) { 3345 var infoJson = info.video; 3346 } else { 3347 var infoJson = JSON.parse(info.video); 3348 } 3349 var src = infoJson.source[0].src, 3350 autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes', 3351 muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes', 3352 loop = $(item).attr('data-loop'); 3353 3354 } else if ( isAudio ) { 3355 var src = info.src, 3356 autoplay = true, 3357 loop = false; 3358 } 3359 if ( typeof src !== 'undefined' ) { 3360 $slide.addClass('has-html5'); 3361 var video = document.createElement('video'); 3362 video.src = src; 3363 video.preload = 'auto'; 3364 video.controls = 'controls'; 3365 video.controlsList = 'nodownload'; 3366 if ( autoplay ) { 3367 video.autoplay = 'autoplay'; 3368 } 3369 if ( muted ) { 3370 video.muted = 'muted'; 3371 } 3372 if ( loop ) { 3373 video.loop = 'loop'; 3374 } 3375 $(video).appendTo($slide); 3376 } 3377 } else { 3378 var $video = $('video', $slide); 3379 if ( $video.length ) { 3380 $video[0].currentTime = 0; 3381 if ( $video[0].autoplay ) { 3382 $video[0].play(); 3383 } 3384 } 3385 } 3386 if ( $prevVideo.length ) { 3387 $prevVideo[0].currentTime = 0; 3388 $prevVideo[0].pause(); 3389 } 3390 }; 3391 3392 var beforeOpen = function(event) { 3393 var detail = event.detail, 3394 items = detail.items, 3395 galleryItems = detail.galleryItems, 3396 outer = detail.outer.selector, 3397 i, ii; 3398 for ( i = 0; i < galleryItems.length; i++ ) { 3399 var item = galleryItems[i]; 3400 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 3401 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 3402 } 3403 } 3404 for ( ii = 0; ii < items.length; ii++ ) { 3405 var item = items[ii]; 3406 if ( $(item).attr('data-icon') === 'video' ) { 3407 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 3408 } 3409 } 3410 3411 }; 3412 3413 //caption builder 3414 var captionBuilder = function($el){ 3415 $el.each( function( index, val ) { 3416 var $gallery = $(this).attr('data-lbox-init','true'), 3417 $_a = '.lbox-trigger-item', 3418 $_nested_a = '.lbox-nested-item'; 3419 3420 $gallery.find($_a, $_nested_a).each(function(){ 3421 var $a = $(this), 3422 $img = $('img', $a).first(), 3423 imgw = $img.attr('data-width'), 3424 imgh = $img.attr('data-height'), 3425 caption = $a.attr('data-caption'), 3426 title = $a.attr('data-title'); 3427 3428 if ( $img.length && $img.attr('data-crop') != true ) { 3429 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 3430 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 3431 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 3432 $a.attr('data-external-thumb-image', $img[0].src); 3433 } 3434 } 3435 3436 if ( typeof title !== 'undefined' && title !== '' ) { 3437 title = '<h6>' + title + '</h6>'; 3438 } else { 3439 title = ''; 3440 } 3441 3442 if ( typeof caption !== 'undefined' && caption !== '' ) { 3443 caption = '<p>' + caption + '</p>'; 3444 title += caption; 3445 } 3446 3447 if ( title !== '' ) { 3448 $a.attr( 'title', title ); 3449 } 3450 3451 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') ) ) { 3452 $a.attr('data-lg-size', imgw + '-' + imgh); 3453 } 3454 }); 3455 }); 3456 }; 3457 captionBuilder($el); 3458 3459 //regular galleries 3460 $el.each( function( index, val ) { 3461 var $gallery = $(this), 3462 $_a = '.lbox-trigger-item', 3463 $_nested_a = '.lbox-nested-item', 3464 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 3465 galleryID = $_first.attr('data-lbox'), 3466 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 3467 tmb = $_first.attr('data-notmb'), 3468 social = $_first.attr('data-social'), 3469 deep = $_first.attr('data-deep'), 3470 zoom = $_first.attr('data-zoom-origin'), 3471 actual = $_first.attr('data-actual-size'), 3472 download = $_first.attr('data-download'), 3473 controls = $_first.attr('data-arrows') !== 'no', 3474 fullScreen = $_first.attr('data-full'),
3475 counter = $_first.attr('data-counter'), 3476 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 3477 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3478 connect = $_first.attr('data-connect'), 3479 lgPlugins = [lgVideo], 3480 itemsLoadedTimeOut; 3481 3482 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3483 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3484 3485 if ( typeof tmb == 'undefined' || !tmb ) { 3486 lgPlugins.push(lgThumbnail); 3487 } 3488 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 3489 lgPlugins.push(lgZoom); 3490 } 3491 if ( typeof deep != 'undefined' && deep != '' ) { 3492 lgPlugins.push(lgHash); 3493 } 3494 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3495 lgPlugins.push(lgFullscreen); 3496 } 3497 if ( social ) { 3498 lgPlugins.push(lgShare); 3499 } 3500 3501 if ( galleries.indexOf( galleryID ) !== -1 ) { 3502 return true; 3503 } 3504 3505 galleries.push( galleryID ); 3506 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 3507 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 3508 var gallery = lightGallery( $triggerGal[0], { 3509 addClass: containerClass, 3510 plugins: lgPlugins, 3511 mode: transition, 3512 selector: $selector, 3513 galleryId: galleryID, 3514 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3515 iframeWidth: '848px', 3516 iframeMaxWidth: '90%', 3517 iframeMaxHeight: '90%', 3518 exThumbImage: 'data-external-thumb-image', 3519 loadYouTubeThumbnail: false, 3520 autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ), 3521 // autoplayFirstVideo: false, 3522 pager: false, 3523 startClass: 'lg-start-opacity', 3524 zoomFromOrigin: zoom, 3525 controls: controls, 3526 download: ( typeof download != 'undefined' && download != '' ), 3527 thumbWidth: 50, 3528 thumbHeight: '50px', 3529 counter: $triggerGal.find($selector).length > 1 ? counter : false, 3530 loadYouTubePoster: false, 3531 enableDrag: $triggerGal.find($selector).length > 1, 3532 mobileSettings: { 3533 showCloseIcon: $('body').hasClass('lightgallery-hide-close') ? false : true, 3534 }, 3535 }); 3536 3537 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 3538 e.preventDefault(); 3539 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 3540 gallery.openGallery(index-1); 3541 }); 3542 3543 clearRequestTimeout(itemsLoadedTimeOut); 3544 $triggerGal.on('more-items-loaded', function(e, items) { 3545 itemsLoadedTimeOut = requestTimeout(function(){ 3546 createSelectors(); 3547 captionBuilder($triggerGal); 3548 gallery.refresh(); 3549 }, 100); 3550 }); 3551 3552 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3553 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3554 $el = model.view.$el; 3555 if ( $el.find($triggerGal).length ) { 3556 gallery.destroy(); 3557 } 3558 }); 3559 } 3560 3561 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 3562 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 3563 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 3564 $(window).trigger('uncode-custom-cursor'); 3565 }); 3566 3567 }); 3568 3569 if ( typeof $el !== 'undefined' ) { 3570 3571 //album galleries 3572 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 3573 var album = val, 3574 galleryID = index, 3575 $album = $(album), 3576 params = $album.attr('data-album'), 3577 tmb = $(val).attr('data-notmb'), 3578 social = $(val).attr('data-social'), 3579 deep = $(val).attr('data-deep'), 3580 actual = $(val).attr('data-actual-size'), 3581 download = $(val).attr('data-download'), 3582 controls = $(val).attr('data-arrows') !== 'no', 3583 fullScreen = $(val).attr('data-full'), 3584 counter = $(val).attr('data-counter'), 3585 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 3586 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3587 lgPlugins = [lgVideo]; 3588 3589 $(val).attr('data-lbox-init','true'); 3590 3591 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : '';
3592 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3593 3594 if ( typeof tmb == 'undefined' || !tmb ) { 3595 lgPlugins.push(lgThumbnail); 3596 } 3597 if ( typeof actual != 'undefined' && actual != '' ) { 3598 lgPlugins.push(lgZoom); 3599 } 3600 if ( typeof deep != 'undefined' && deep != '' ) { 3601 lgPlugins.push(lgHash); 3602 } 3603 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3604 lgPlugins.push(lgFullscreen); 3605 } 3606 if ( social ) { 3607 lgPlugins.push(lgShare); 3608 } 3609 3610 var gallery = window.lightGallery(album, { 3611 dynamic: true, 3612 plugins: lgPlugins, 3613 dynamicEl: JSON.parse(params), 3614 galleryId: galleryID, 3615 addClass: containerClass, 3616 mode: transition, 3617 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3618 iframeWidth: '848px', 3619 iframeMaxWidth: '90%', 3620 iframeMaxHeight: '90%', 3621 loadYouTubeThumbnail: false, 3622 autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ), 3623 // autoplayFirstVideo: false, 3624 pager: false, 3625 startClass: 'lg-start-opacity', 3626 zoomFromOrigin: false, 3627 controls: controls, 3628 download: ( typeof download != 'undefined' && download != '' ), 3629 thumbWidth: 50, 3630 thumbHeight: '50px', 3631 loadYouTubePoster: false, 3632 counter: counter 3633 }); 3634 3635 $album.on('click', function(){ 3636 gallery.openGallery(0); 3637 }); 3638 3639 album.addEventListener('lgBeforeSlide', beforeSlide); 3640 album.addEventListener('lgBeforeOpen', beforeOpen); 3641 album.addEventListener('lgAfterOpen', function(){ 3642 $(window).trigger('uncode-custom-cursor'); 3643 }); 3644 3645 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3646 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3647 $el = model.view.$el; 3648 if ( $el.find($album).length ) { 3649 gallery.destroy(); 3650 } 3651 }); 3652 } 3653 3654 }); 3655 3656 //single images 3657 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 3658 var gallery = lightGallery( $('.page-wrapper')[0], { 3659 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 3660 iframeWidth: '848px', 3661 iframeMaxWidth: '90%', 3662 iframeMaxHeight: '90%', 3663 loadYouTubeThumbnail: false, 3664 // autoplayFirstVideo: false, 3665 startClass: 'lg-start-opacity', 3666 thumbWidth: 50, 3667 thumbHeight: '50px', 3668 download: false, 3669 loadYouTubePoster: false, 3670 counter: false 3671 }); 3672 3673 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 3674 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 3675 }); 3676 } 3677 3678 var onGalleryEsc = function(e){ 3679 if (e.keyCode === 27 || e.key === 'Escape' || e.keyCode === 90 || e.key === 'z') { 3680 if (document.fullscreenElement) { 3681 document.exitFullscreen() 3682 } else { 3683 document.documentElement.requestFullscreen(); 3684 } 3685 } 3686 }; 3687 window.addEventListener('keydown', onGalleryEsc, { once: true }); 3688 3689 $(document).on( 3690 'webkitfullscreenchange mozfullscreenchange fullscreenchange MSFullscreenChange', 3691 function(e){ 3692 if ( e.target.tagName === 'IFRAME' ) { 3693 window.addEventListener('keydown', onGalleryEsc, { once: true }); 3694 } 3695 } 3696 ); 3697}; 3698 3699UNCODE.carousel = function(container) { 3700 var $owlContainers = $('.owl-carousel-container', container); 3701 $owlContainers.each(function() { 3702 var $owlContainer = $(this), 3703 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 3704 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 3705 values = {}, 3706 tempTimeStamp, 3707 newWidth = UNCODE.wwidth, 3708 $owlInsideEqual = []; 3709 $owlSelector.each(function() { 3710 var itemID = $(this).attr('id'), 3711 $elSelector = $(('#' + itemID).toString()); 3712 values['id'] = itemID; 3713 values['items'] = 1;
3714 values['columns'] = 3; 3715 values['fade'] = false; 3716 values['nav'] = false; 3717 values['navmobile'] = false; 3718 values['navskin'] = 'light'; 3719 values['navspeed'] = 400; 3720 values['dots'] = false; 3721 values['dotsmobile'] = false; 3722 values['loop'] = false; 3723 values['autoplay'] = false; 3724 values['timeout'] = 3000; 3725 values['autoheight'] = false; 3726 values['stagepadding'] = 0; 3727 values['margin'] = 0; 3728 values['lg'] = 1; 3729 values['md'] = 1; 3730 values['sm'] = 1; 3731 $.each($(this).data(), function(i, v) { 3732 values[i] = v; 3733 }); 3734 3735 if ($(this).closest('.uncode-slider').length) { 3736 values['navskin'] = ''; 3737 values['navmobile'] = false; 3738 //values['dotsmobile'] = true; 3739 } else { 3740 values['navskin'] = ' style-'+values['navskin']+' style-override'; 3741 } 3742 3743 var setIndexActive = function(event, init){ 3744 var init = typeof init === 'undefined' ? false : init, 3745 thiis = $(event.currentTarget); 3746 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 3747 var scrolltop = $(document).scrollTop(), 3748 size = event.page.size, 3749 i; 3750 var setIndex = requestTimeout(function() { 3751 for ( i = 0; i < size; i++ ) { 3752 var itemCont = event.item.index != null ? (event.item.index + i) : i; 3753 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 3754 if (thiis.closest('.row-slider').length) { 3755 if (currentItem == undefined) { 3756 currentItem = thiis.children()[i]; 3757 } 3758 if ($(currentItem).closest('#page-header').length) { 3759 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3760 UNCODE.switchColorsMenu(scrolltop, 'dark'); 3761 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3762 UNCODE.switchColorsMenu(scrolltop, 'light'); 3763 } 3764 } 3765 var owlCustomNav = $elSelector.closest('.owl-carousel-wrapper-nav').find('.uncode-owl-nav-out.skin-inherit'); 3766 if (owlCustomNav.length) { 3767 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3768 owlCustomNav.addClass('style-dark').removeClass('style-light'); 3769 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3770 owlCustomNav.addClass('style-light').removeClass('style-dark'); 3771 } 3772 } 3773 } 3774 var itendIndex = $(currentItem).attr('data-index'); 3775 if ( isNaN(itendIndex) ) { 3776 itendIndex = 1; 3777 } 3778 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 3779 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 3780 if ($.fn.counterUp) { 3781 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 3782 var $counter = $(this); 3783 $counter.addClass('started').counterUp({ 3784 delay: 10, 3785 time: 1500 3786 }); 3787 }); 3788 } 3789 } 3790 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 3791 }, 200); 3792 } 3793 tempTimeStamp = event.timeStamp; 3794 } 3795 3796 /** Initialize */ 3797 $elSelector.on('initialize.owl.carousel', function(event) { 3798 if (typeof UNCODE.owlNav !== 'undefined') { 3799 UNCODE.owlNav(itemID, event); 3800 } 3801 3802 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3803 window.parent.vc.events.on('shortcodeView:beforeUpdate shortcodeView:destroy', function(model) { 3804 var shortcode = model.attributes.shortcode, 3805 $el = model.view.$el, 3806 $row_wrap = $el.closest('.row'); 3807 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 3808 $row_wrap.find('.owl-carousel-wrapper-nav .uncode-owl-nav-out').remove(); 3809 } 3810 }); 3811 window.parent.vc.events.on('shortcodeView:updated', function(model) { 3812 var shortcode = model.attributes.shortcode; 3813 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 3814 tempTimeStamp = Math.floor(Date.now() / 1000); 3815 } 3816 }); 3817 window.parent.vc.events.on('shortcodeView:updated shortcodeView:ready', function(model) { 3818 var shortcode = model.attributes.shortcode; 3819 if ( shortcode === 'uncode_carousel_nav' && typeof UNCODE.owlNav !== 'undefined') { 3820 UNCODE.owlNav(itemID, event); 3821 $elSelector.trigger('refresh.owl.carousel'); 3822 } 3823 }); 3824 } 3825 }); 3826 3827 /** Initialized */ 3828 $elSelector.on('initialized.owl.carousel', function(event) { 3829 3830 if ( $('.isotope-container', event.currentTarget).length ) { 3831 window.dispatchEvent(UNCODE.boxEvent); 3832 } 3833 3834 $('.owl-dot.active', $elSelector).on('click', function(){ 3835 return false;
3836 }); 3837 3838 var thiis = $(event.currentTarget), 3839 // get the time from the data method 3840 time = thiis.data("timer-id"), 3841 rowParent = thiis.closest('.row-parent'); 3842 3843 if ( typeof rowParent[0] !== 'undefined' ) { 3844 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 3845 } 3846 3847 if (time) { 3848 clearRequestTimeout(time); 3849 } 3850 3851 thiis.addClass('showControls'); 3852 var new_time = requestTimeout(function() { 3853 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 3854 if (thiis.hasClass('owl-height-viewport')) 3855 setItemsRelHeight(thiis); 3856 if (thiis.hasClass('owl-height-equal')) 3857 setItemsHeight(thiis); 3858 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 3859 if (thiis.closest('.unequal, .unexpand').length) { 3860 UNCODE.setRowHeight(rowParent[0], true); 3861 } 3862 if (SiteParameters.dynamic_srcset_active === '1') { 3863 UNCODE.refresh_dynamic_srcset_size(thiis); 3864 } 3865 }, 350); 3866 // save the new time 3867 thiis.data("timer-id", new_time); 3868 3869 var scrolltop = $(document).scrollTop(); 3870 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 3871 3872 //if (!UNCODE.isMobile) { 3873 /** fix autoplay when visible **/ 3874 $(window).on('load', function(){ 3875 if (thiis.data('autoplay')) { 3876 if ( !thiis.closest('.sticky-element').length ) { 3877 thiis.trigger('stop.autoplay.owl'); 3878 } else { 3879 thiis.trigger('play.owl.autoplay'); 3880 } 3881 } 3882 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 3883 return; 3884 } 3885 if ( ! thiis.closest('.sticky-element').length ) { 3886 var carouselInView = new Waypoint.Inview({ 3887 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3888 element: thiis[0], 3889 exited: function() { 3890 var el = $(this.element); 3891 if (el.data('autoplay') ) { 3892 el.trigger('stop.owl.autoplay'); 3893 el.data('stopped','true'); 3894 } 3895 }, 3896 enter: function(direction) { 3897 var el = $(this.element); 3898 requestTimeout(function() { 3899 if (el.data('autoplay')) { 3900 el.trigger('play.owl.autoplay'); 3901 el.data('stopped','false'); 3902 } 3903 }, 100); 3904 } 3905 }); 3906 } 3907 }); 3908 //} 3909 3910 // $(window).on('frontend:carousel_updated', function(){ 3911 // Waypoint.refreshAll(); 3912 // }); 3913 3914 if (!thiis.closest('.isotope-system').length) { 3915 requestTimeout(function() { 3916 animate_thumb($('.t-inside', el), event); 3917 }, 400); 3918 } else { 3919 requestTimeout(function() { 3920 thiis.closest('.isotope-container').isotope('layout'); 3921 }, 400); 3922 } 3923 3924 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3925 currentIndex = $(currentItem).attr('data-index'); 3926 3927 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3928 if ($(val).closest('.uncode-slider').length) { 3929 $(val).removeClass('start_animation'); 3930 } 3931 }); 3932 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3933 if ($(val).closest('.uncode-slider').length) { 3934 $(val).removeClass('already-animated'); 3935 } 3936 }); 3937 3938 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3939 if ($(val).closest('.uncode-slider').length) { 3940 $(val).removeAttr('data-animated'); 3941 } 3942 }); 3943 3944 $.each($('.owl-item.cloned', thiis), function(index, val) { 3945 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 3946 }); 3947 3948 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3949 if ($(val).attr('data-index') != currentIndex) { 3950 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3951 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3952 } 3953 if ($(val).attr('data-index') != currentIndex) { 3954 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 3955 } 3956 if ($(val).attr('data-index') == currentIndex) { 3957 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3958 } 3959 }); 3960 3961 if (thiis.closest('.uncode-slider').length) { 3962 var el = thiis.closest('.row-parent')[0]; 3963 if ($(el).data('imgready')) { 3964 firstLoaded(el, event); 3965 } else { 3966 el.addEventListener("imgLoaded", function(el) { 3967 firstLoaded(el.target, event); 3968 }, false); 3969 } 3970 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 3971 if (transHeight != null) { 3972 requestTimeout(function() { 3973 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 3974 }, 100); 3975 } 3976 } else { 3977 var el = thiis; 3978 el.closest('.uncode-slider').addClass('slider-loaded'); 3979 } 3980 3981 requestTimeout(function() { 3982 if (typeof UNCODE.bigText !== 'undefined') { 3983 UNCODE.bigText(thiis); 3984 } 3985 if (thiis.closest('.uncode-slider').length || thiis.closest('.row').find('.uncode-owl-nav-in').length) { 3986 if (thiis.data('autoplay')) pauseOnHover(thiis); 3987 } 3988 }, 500); 3989 3990 if (thiis.closest('.unequal').length) { 3991 $owlInsideEqual.push(thiis.closest('.row-parent')); 3992 } 3993 3994 var containerClasses = '', 3995 containerStyle = '';
3996 if ( $('.owl-dots-classes', $owlContainer).length ) { 3997 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 3998 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 3999 $('.owl-dots-classes', $owlContainer).remove(); 4000 } 4001 4002 if ( containerClasses !== '' ) { 4003 requestTimeout(function() { 4004 if ( containerClasses !== '' ) 4005 $('.owl-dots', $owlContainer).attr('style', containerStyle); 4006 if ( containerStyle !== '' ) 4007 $('.owl-dots', $owlContainer).addClass(containerClasses); 4008 }, 100); 4009 } 4010 4011 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 4012 $(val).closest('.row-inner').css({ 4013 'margin-top': '-1px' 4014 }); 4015 }); 4016 4017 if ($.fn.isotope) { 4018 if ( thiis.closest('.isotope-container').length ) { 4019 if (thiis.closest('.isotope-container').data('isotope')) { 4020 requestTimeout(function(){ 4021 thiis.closest('.isotope-container').isotope('layout'); 4022 }, 300); 4023 } 4024 $(window).on('load', function(){ 4025 if (thiis.closest('.isotope-container').data('isotope')) { 4026 thiis.closest('.isotope-container').isotope('layout'); 4027 } 4028 }); 4029 } 4030 } 4031 4032 if (thiis.data('autoplay')) { 4033 $(window).on('menuOpen', function(){ 4034 thiis.trigger('stop.owl.autoplay'); 4035 thiis.data('stopped','true'); 4036 }).on('menuClose', function(){ 4037 4038 }); 4039 } 4040 $(window).on('menuClose', function(){ 4041 if (thiis.data('autoplay')) { 4042 thiis.trigger('play.owl.autoplay'); 4043 thiis.data('stopped','false'); 4044 } 4045 }); 4046 4047 setIndexActive(event, true); 4048 4049 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 4050 return !$(this).closest('.nested-carousel').length; 4051 }), 4052 $_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), 4053 $galleries = $_galleries.filter(function( index ) { 4054 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 4055 }); 4056 4057 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 4058 UNCODE.lightgallery( $galleries ); 4059 } 4060 4061 4062 }); 4063 4064 $elSelector.on('resized.owl.carousel', function(event) { 4065 var thiis = $(event.currentTarget); 4066 // if ($(this).closest('.nested-carousel').length) { 4067 // requestTimeout(function() { 4068 // window.dispatchEvent(UNCODE.boxEvent); 4069 // }, 200); 4070 // } 4071 if ( thiis.hasClass('owl-height-equal') ) 4072 setItemsHeight(thiis); 4073 4074 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4075 newWidth = UNCODE.wwidth; 4076 setItemsRelHeight($elSelector); 4077 } 4078 4079 setIndexActive(event); 4080 4081 if (SiteParameters.dynamic_srcset_active === '1') { 4082 UNCODE.refresh_dynamic_srcset_size(thiis); 4083 } 4084 4085 if ($.fn.isotope) { 4086 $(window).on('load', function(){ 4087 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 4088 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 4089 } 4090 }); 4091 } 4092 }); 4093 4094 $elSelector.on('refreshed.owl.carousel', function(event) { 4095 setIndexActive(event); 4096 }); 4097 4098 /** detect resize window for fluid height layout */ 4099 var setFluidResize; 4100 function manageFluidCarouseHeight() { 4101 clearRequestTimeout(setFluidResize); 4102 setFluidResize = requestTimeout(function(){ 4103 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 4104 newWidth = UNCODE.wwidth; 4105 setItemsRelHeight($elSelector); 4106 } 4107 }, 100); 4108 } 4109 window.addEventListener('resize', manageFluidCarouseHeight); 4110 4111 /** Change */ 4112 $elSelector.on('change.owl.carousel', function(event) { 4113 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 4114 }); 4115 4116 /** Changed */ 4117 $elSelector.on('changed.owl.carousel', function(event) { 4118 var $row = $elSelector.parents('.row')[0]; 4119 if ( typeof $row !== 'undefined' ) { 4120 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 4121 } 4122 setIndexActive(event); 4123 }); 4124 4125 var checkDrag = function(e) { 4126 $elSelector.addClass('owl-dragging'); 4127 }; 4128 $elSelector.on('drag.owl.carousel', function(event) { 4129 document.addEventListener("mousemove", checkDrag); 4130 }); 4131 4132 $elSelector.on('dragged.owl.carousel', function(event) { 4133 $elSelector.removeClass('owl-dragging'); 4134 document.removeEventListener("mousemove", checkDrag); 4135 }); 4136 4137 $elSelector.on('translate.owl.carousel', function(event) { 4138 if (UNCODE.isMobile) { 4139 $(event.currentTarget).addClass('owl-translating'); 4140 } 4141 }); 4142 4143 /** Translated */ 4144 $elSelector.on('translated.owl.carousel', function(event) { 4145 4146 var thiis = $(event.currentTarget), 4147 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 4148 currentIndex = $(currentItem).attr('data-index'),
4149 stagePadding = thiis.data('stagepadding'); 4150 4151 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4152 4153 if (!UNCODE.isMobile) { 4154 UNCODE.owlPlayVideo(thiis); 4155 } 4156 4157 requestTimeout(function(){ 4158 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 4159 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 4160 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 4161 if (lastDelayElems == undefined) lastDelayElems = 0; 4162 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4163 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4164 thiis.trigger('stop.owl.autoplay'); 4165 requestTimeout(function() { 4166 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 4167 }, maxDelay); 4168 } 4169 }, 200); 4170 4171 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 4172 if ($(val).closest('.uncode-slider').length) { 4173 $(val).removeClass('start_animation'); 4174 } 4175 }); 4176 4177 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 4178 if ($(val).closest('.uncode-slider').length) { 4179 $(val).removeClass('already-animated'); 4180 } 4181 }); 4182 4183 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4184 if ($(val).closest('.uncode-slider').length) { 4185 $(val).removeAttr('data-animated'); 4186 } 4187 }); 4188 4189 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4190 if ($(val).attr('data-index') != currentIndex) { 4191 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4192 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4193 } 4194 if ($(val).attr('data-index') != currentIndex) { 4195 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4196 } 4197 if ($(val).attr('data-index') == currentIndex) { 4198 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4199 } 4200 }); 4201 4202 if (UNCODE.isMobile) { 4203 thiis.removeClass('owl-translating'); 4204 } 4205 4206 setIndexActive(event); 4207 }); 4208 4209 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4210 4211 /** Init carousel */ 4212 $elSelector.not('.showControls').owlCarousel({ 4213 items: values['items'], 4214 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4215 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4216 nav: values['nav'], 4217 dots: values['dots'], 4218 loop: values['loop'], 4219 stagePadding: values['stagepadding'], 4220 margin: 0, 4221 video: true, 4222 autoWidth: false, 4223 autoplay: false, 4224 autoplayTimeout: values['timeout'], 4225 autoplaySpeed: values['navspeed'], 4226 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4227 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4228 rtl: $('body').hasClass('rtl') ? true : false, 4229 fluidSpeed: true, 4230 navSpeed: values['navspeed'], 4231 dotsSpeed: values['navspeed'] / values['items'], 4232 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4233 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>'], 4234 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4235 responsiveClass: true, 4236 responsiveBaseElement: '.box-container', 4237 responsive: { 4238 0: { 4239 items: values['sm'], 4240 nav: values['navmobile'], 4241 dots: values['dotsmobile'], 4242 dotsSpeed: values['navspeed'] / values['sm'], 4243 }, 4244 480: { 4245 items: values['sm'], 4246 nav: values['navmobile'], 4247 dots: values['dotsmobile'], 4248 dotsSpeed: values['navspeed'] / values['sm'], 4249 }, 4250 570: { 4251 items: values['md'], 4252 nav: values['navmobile'], 4253 dots: values['dotsmobile'], 4254 dotsSpeed: values['navspeed'] / values['md'], 4255 }, 4256 960: { 4257 items: values['lg'], 4258 dotsSpeed: values['navspeed'] / values['lg'], 4259 } 4260 } 4261 }); 4262 4263 var transDuration = parseFloat(values['navspeed']) * 0.3; 4264 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4265 4266 $('.owl-item .tmb', $elSelector).css({ 4267 '-webkit-transition-delay': transDuration + 'ms', 4268 '-moz-transition-delay': transDuration + 'ms', 4269 '-o-transition-delay': transDuration + 'ms', 4270 'transition-delay': transDuration + 'ms', 4271 '-webkit-transition-duration': transDuration2 + 'ms', 4272 '-moz-transition-duration': transDuration2 + 'ms', 4273 '-o-transition-duration': transDuration2 + 'ms', 4274 'transition-duration': transDuration2 + 'ms', 4275 }); 4276 4277 requestTimeout(function() { 4278 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4279 UNCODE.setRowHeight($owlInsideEqual[i]); 4280 }; 4281 }, 300); 4282 4283 $(window).on('load', function(){ 4284 var $elCarousel = $elSelector.data('owl.carousel'); 4285 if ( typeof $elCarousel !== 'undefined' ) { 4286 $elCarousel.trigger('refreshed'); 4287 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4288 UNCODE.setRowHeight($owlInsideEqual[i]); 4289 }; 4290 } 4291 }); 4292 4293 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4294 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4295 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4296 $('#' + carousel_id).find('.owl-item').each( function() { 4297 var $item = $(this), 4298 index = ( $item.index() + 1 ); 4299 $item.attr('data-index', index); 4300 }); 4301 } 4302 }); 4303 4304 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4305 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4306 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4307 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4308 $('#' + carousel_id).find('.owl-item').each( function() { 4309 var $item = $(this), 4310 index = ( $item.index() + 1 ); 4311 $item.attr('data-index', index); 4312 }); 4313 } 4314 }); 4315 } 4316 4317 }); 4318 4319 function firstLoaded(el, event) { 4320 var el = $(el), 4321 uncode_slider = el.find('.uncode-slider'); 4322 el.find('.owl-carousel').css('opacity', 1); 4323 uncode_slider.addClass('slider-loaded'); 4324 if (typeof UNCODE.bigText !== 'undefined') { 4325 UNCODE.bigText(el.find('.owl-item.active')); 4326 } 4327 //if (!UNCODE.isMobile) { 4328 requestTimeout(function() { 4329 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4330 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4331 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4332 if (lastDelayElems == undefined) lastDelayElems = 0; 4333 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4334 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4335 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4336 requestTimeout(function() { 4337 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4338 }, maxDelay); 4339 } 4340 }, 500); 4341 4342 //} 4343 } 4344 4345 function navHover(el) { 4346 var $owlCont = el, 4347 $owlPrev = $owlCont.find('.owl-prev'), 4348 $owlNext = $owlCont.find('.owl-next'), 4349 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4350 $owlPagination = $owlCont.next(), 4351 owlPrevW = $owlPrev.outerWidth(), 4352 owlNextW = $owlNext.outerWidth(), 4353 owlDotsH = $owlDots.innerHeight(), 4354 owlTime = 400, 4355 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4356 if ( $('body').hasClass('rtl') ) { 4357 $owlPrev.css("margin-right", -owlPrevW); 4358 $owlNext.css("margin-left", -owlNextW); 4359 } else { 4360 $owlPrev.css("margin-left", -owlPrevW); 4361 $owlNext.css("margin-right", -owlNextW); 4362 } 4363 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4364 $owlCont.mouseenter(function() { 4365 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4366 $owlPrev.add($owlNext).css({ 4367 marginLeft: 0, 4368 marginRight: 0 4369 }); 4370 if (!owlNested) { 4371 $owlDots.css({ 4372 opacity: 1, 4373 bottom: 0 4374 }); 4375 } 4376 }).mouseleave(function() { 4377 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4378 if ( $('body').hasClass('rtl') ) { 4379 $owlPrev.css("margin-right", -owlPrevW); 4380 $owlNext.css("margin-left", -owlNextW); 4381 } else { 4382 $owlPrev.css("margin-left", -owlPrevW); 4383 $owlNext.css("margin-right", -owlNextW); 4384 } 4385 if (!owlNested) { 4386 $owlDots.css({ 4387 opacity: 1, 4388 bottom: -owlDotsH 4389 }); 4390 } 4391 }); 4392 }; 4393 4394 function animate_elems($this) { 4395 var lastDelay; 4396 $.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) { 4397 var element = $(val), 4398 delayAttr = element.attr('data-delay'), 4399 $first_item = element.closest('.owl-item[data-index="1"]'); 4400 4401 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4402 return false;
4403 } 4404 4405 if (delayAttr == undefined) delayAttr = 0; 4406 requestTimeout(function() { 4407 element.addClass('start_animation'); 4408 }, delayAttr); 4409 lastDelay = delayAttr; 4410 }); 4411 return lastDelay; 4412 } 4413 4414 function animate_thumb(items, event) { 4415 var lastDelay, 4416 itemIndex, 4417 thiis = $(event.currentTarget), 4418 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4419 numActives = $('.owl-item.active', thiis).length, 4420 stagePadding = thiis.data('stagepadding'); 4421 4422 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4423 4424 thiis.data('tempIndex', event.item.index); 4425 $.each(items, function(index, val) { 4426 var parent = $(val).closest('.owl-item'); 4427 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4428 return; 4429 } 4430 if (!$(val).hasClass('start_animation')) { 4431 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4432 var thumbInView = new Waypoint.Inview({ 4433 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4434 element: val, 4435 enter: function(direction) { 4436 var element = $(this.element), 4437 delayAttr = parseInt(element.attr('data-delay')), 4438 itemIndex = element.closest('.owl-item').index() + 1, 4439 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4440 if (itemIndex > tempIndex) { 4441 thiis.data('tempIndex', itemIndex); 4442 } 4443 if (isNaN(delayAttr)) delayAttr = 100; 4444 if (stagePadding) { 4445 var objTimeout = requestTimeout(function() { 4446 element.addClass('start_animation'); 4447 }, index * delayAttr); 4448 lastDelay = index * delayAttr; 4449 } else { 4450 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4451 var objTimeout = requestTimeout(function() { 4452 element.addClass('start_animation'); 4453 }, diffItem * delayAttr); 4454 lastDelay = diffItem * delayAttr; 4455 } 4456 parent.data('objTimeout', objTimeout); 4457 if (!UNCODE.isUnmodalOpen) { 4458 this.destroy(); 4459 } 4460 } 4461 }); 4462 } 4463 } 4464 }); 4465 return lastDelay; 4466 } 4467 4468 function setItemsHeight(item) { 4469 $.each($('.owl-item', item), function(index, val) { 4470 var availableThumbHeight = $('.t-inside', $(val)).height(), 4471 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4472 difference = availableThumbHeight - innerThumbHeight; 4473 if ($('.tmb-content-under', val).length) { 4474 var visualPart = $('.t-entry-visual', val); 4475 if (visualPart.length) { 4476 difference -= $('.t-entry-visual', val).height(); 4477 } 4478 } 4479 if (! $('.tmb-content-lateral', val).length) 4480 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4481 }); 4482 } 4483 4484 function setItemsRelHeight(item) { 4485 $.each($('.owl-item', item), function(index, val) { 4486 var $rowContainer = $(item).parents('.row-parent').eq(0), 4487 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4488 $colContainer = $(item).parents('.uncell').eq(0), 4489 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4490 winHeight = UNCODE.wheight, 4491 multiplier_h = parseInt($(item).attr('data-vp-height')), 4492 data_viewport_h, 4493 consider_menu = $(item).data('vp-menu'); 4494 4495 if ( consider_menu ) { 4496 winHeight = winHeight - UNCODE.menuHeight; 4497 } 4498 4499 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4500 $('.t-inside', val).css( 'height', data_viewport_h ); 4501 }); 4502 } 4503 4504 function pauseOnHover(slider) { 4505 var $owlCustomNavSels = slider.closest('.row').find('.uncode-nav-dots, .uncode-nav-prev, .uncode-nav-next'); 4506 $('.owl-dots, .owl-prev, .owl-next', slider).add($owlCustomNavSels).on({ 4507 mouseenter: function () { 4508 $(slider).addClass('owl-mouseenter'); 4509 $(slider).trigger('stop.owl.autoplay'); 4510 }, 4511 mouseleave: function () { 4512 $(slider).removeClass('owl-mouseenter'); 4513 $(slider).trigger('play.owl.autoplay'); 4514 } 4515 }); 4516 } 4517 }); 4518}; 4519 4520UNCODE.owlPlayVideo = function(carousel) { 4521 var player, iframe; 4522 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4523 var content = $(val).html(); 4524 if (content == '') { 4525 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4526 $(val).append(getCloned); 4527 } 4528 if ($(this).attr('data-provider') == 'vimeo') { 4529 iframe = $(this).find('iframe'); 4530 player = new Vimeo.Player(iframe[0]); 4531 player.play(); 4532 } else if ($(this).attr('data-provider') == 'youtube') { 4533 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4534 } else { 4535 var player = $(this).find('video'); 4536 if (player.length) { 4537 $(this).find('video')[0].volume = 0; 4538 $(this).find('video')[0].play(); 4539 $(val).css('opacity', 1); 4540 } 4541 } 4542 }); 4543}; 4544 4545UNCODE.owlStopVideo = function(carousel) { 4546 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4547 var player, iframe; 4548 if ($(this).attr('data-provider') == 'vimeo') { 4549 iframe = $(this).find('iframe'); 4550 player = new Vimeo.Player(iframe[0]); 4551 player.pause(); 4552 } else if ($(this).attr('data-provider') == 'youtube') { 4553 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4554 } else { 4555 var player = $(this).find('video'); 4556 if (player.length) { 4557 $(this).find('video')[0].volume = 0; 4558 $(this).find('video')[0].play(); 4559 } 4560 } 4561 }); 4562}; 4563 4564UNCODE.animations = function() { 4565 4566 var runWaypoints_TO, 4567 runWaypoints_carousel_TO, 4568 runWaypoints_delay = 0, 4569 highlightComplexFunc = function($wrap, ev){ 4570 4571 var $lines = $('.heading-line-wrap', $wrap), 4572 not_animate = false;
4573 4574 if ( $wrap.data('animate') === true ) { 4575 not_animate = true; 4576 } 4577 4578 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4579 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4580 return; 4581 } 4582 4583 $lines.each(function(_key, _value){ 4584 var $line = $(_value), 4585 $inners = $('.split-word-inner', $line), 4586 $highlights = $('.heading-text-highlight-inner', $line); 4587 4588 var highlitInnerFunc = function(ev){ 4589 var delay = 0; 4590 $highlights.each(function(h_key, high){ 4591 var $highlight = $(high), 4592 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4593 $nextSplit = $split.nextUntil(), 4594 $next = $('.heading-text-highlight-inner', $nextSplit), 4595 countCh = $split.text().length; 4596 4597 $highlight.css({ 4598 '-webkit-transition-duration': (30 * countCh) + 'ms', 4599 '-moz-transition-duration': (30 * countCh) + 'ms', 4600 '-o-transition-duration': (30 * countCh) + 'ms', 4601 'transition-duration': (30 * countCh) + 'ms', 4602 }); 4603 4604 delay += (30 * countCh); 4605 4606 $next.css({ 4607 '-webkit-transition-delay': delay + 'ms', 4608 '-moz-transition-delay': delay + 'ms', 4609 '-o-transition-delay': delay + 'ms', 4610 'transition-delay': delay + 'ms', 4611 }); 4612 }); 4613 $highlights.removeAttr('data-animated'); 4614 if ( _key+1 === $lines.length ) { 4615 $wrap.data('animate', true); 4616 } 4617 }; 4618 4619 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4620 if ( not_animate ) { 4621 $highlights.each(function(h_key, high){ 4622 var $highlight = $(high); 4623 $highlight.css({ 4624 '-webkit-transition-duration': '0ms', 4625 '-moz-transition-duration': '0ms', 4626 '-o-transition-duration': '0ms', 4627 'transition-duration': '0ms', 4628 }); 4629 }); 4630 $highlights.removeAttr('data-animated'); 4631 } else { 4632 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4633 highlitInnerFunc(); 4634 } else { 4635 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4636 } 4637 } 4638 } 4639 }); 4640 }; 4641 4642 $.each($('.header-content-inner'), function(index, val) { 4643 var element = $(val), 4644 transition = ''; 4645 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4646 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4647 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4648 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4649 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4650 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4651 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4652 if (transition != '') { 4653 $(val).removeClass(transition); 4654 var container = element, 4655 containerDelay = container.attr('data-delay'), 4656 containerSpeed = container.attr('data-speed'), 4657 items = $('.header-title > *, .post-info', container); 4658 $.each(items, function(index, val) { 4659 var element = $(val), 4660 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4661 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4662 if (!element.hasClass('animate_when_almost_visible')) { 4663 delayAttr = Number(delayAttr) + (400 * index); 4664 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4665 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4666 } 4667 }); 4668 container.css('opacity', 1); 4669 } 4670 }); 4671 4672 function animate_css_grids_on_load() { 4673 $('.cssgrid-system').each(function() { 4674 var grid = $(this); 4675 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4676 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4677 }); 4678 } 4679 4680 window.waypoint_animation = function(ev) { 4681 $.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) { 4682 if ( $(val).hasClass('el-text-split') || ( ( $(val).closest('.unscroll-horizontal').length || $(val).closest('.index-scroll').length || $(val).closest('.tab-pane:not(.active)').length || $(val).closest('.panel:not(.active-group)').length ) && !SiteParameters.is_frontend_editor ) ) { 4683 return true; 4684 } 4685 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4686 return; 4687 } 4688 var run = true, 4689 $carousel = $(val).closest('.owl-carousel'); 4690 if ( $carousel.length ) { 4691 run = false;
4692 } 4693 if (run) { 4694 new Waypoint({ 4695 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4696 element: val, 4697 handler: function() { 4698 var element = $(this.element), 4699 index = element.index(), 4700 delayAttr = element.attr('data-delay'); 4701 if (delayAttr == undefined) delayAttr = 0; 4702 requestTimeout(function() { 4703 element.addClass('start_animation'); 4704 }, delayAttr); 4705 if (!UNCODE.isUnmodalOpen) { 4706 this.destroy(); 4707 } 4708 }, 4709 offset: UNCODE.isFullPage ? '100%' : '90%' 4710 }); 4711 } 4712 }); 4713 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4714 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4715 return; 4716 } 4717 var run = true, 4718 $carousel = $(val).closest('.owl-carousel'); 4719 if ( $carousel.length ) { 4720 run = false; 4721 } 4722 if (run) { 4723 new Waypoint({ 4724 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4725 element: val, 4726 handler: function() { 4727 var $element = $(this.element), 4728 $childs = $('.animate_when_parent_almost_visible', $element); 4729 $childs.each(function(key,el){ 4730 var $child = $(el), 4731 delaySpeed = $child.attr('data-speed'), 4732 delayAttr = $child.attr('data-delay'), 4733 intervalAttr = $child.attr('data-interval'); 4734 if (delayAttr == undefined) { 4735 delayAttr = 50*key; 4736 } 4737 requestTimeout(function() { 4738 $child.addClass('start_animation'); 4739 if ( $child.hasClass('anim-line-checker') ) { 4740 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4741 var $line = $child.closest('.heading-line-wrap'); 4742 }); 4743 } 4744 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4745 highlightComplexFunc($wrapText, ev); 4746 if ( $child.hasClass('anim-tot-checker') ) { 4747 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4748 if ( $child.hasClass('anim-tot-checker') ) { 4749 $wrapText.addClass('already-animated'); 4750 $element.trigger('already-animated'); 4751 } 4752 }); 4753 } 4754 }, delayAttr ); 4755 }); 4756 $element.addClass('start_animation'); 4757 if (!UNCODE.isUnmodalOpen) { 4758 this.destroy(); 4759 } 4760 }, 4761 offset: UNCODE.isFullPage ? '100%' : '90%' 4762 }); 4763 } 4764 }); 4765 } 4766 window.waypoint_carousel_animation = function(ev) { 4767 $.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) { 4768 if ( $(val).hasClass('el-text-split') ) { 4769 return true; 4770 } 4771 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4772 return; 4773 } 4774 var run = true, 4775 $carousel = $(val).closest('.owl-carousel'), 4776 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4777 $all_first = $('.owl-item[data-index="1"]', $carousel); 4778 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4779 run = false; 4780 } 4781 if (run) { 4782 new Waypoint({ 4783 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4784 element: val, 4785 handler: function() { 4786 var element = $(this.element), 4787 index = element.index(), 4788 delayAttr = element.attr('data-delay'); 4789 if (delayAttr == undefined) delayAttr = 0; 4790 requestTimeout(function() { 4791 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4792 $all_first.attr('data-already-reached', 'true'); 4793 } 4794 element.addClass('start_animation'); 4795 }, delayAttr); 4796 if (!UNCODE.isUnmodalOpen) { 4797 this.destroy(); 4798 } 4799 }, 4800 offset: UNCODE.isFullPage ? '100%' : '90%' 4801 }); 4802 } 4803 }); 4804 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 4805 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4806 return; 4807 } 4808 var run = true, 4809 $carousel = $(val).closest('.owl-carousel'), 4810 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4811 $all_first = $('.owl-item[data-index="1"]', $carousel); 4812 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4813 run = false;
4814 } 4815 if (run) { 4816 new Waypoint({ 4817 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4818 element: val, 4819 handler: function() { 4820 var $element = $(this.element), 4821 $childs = $('.animate_when_parent_almost_visible', $element); 4822 $childs.each(function(key,el){ 4823 var $child = $(el), 4824 delaySpeed = $child.attr('data-speed'), 4825 delayAttr = $child.attr('data-delay'), 4826 intervalAttr = $child.attr('data-interval'); 4827 if (delayAttr == undefined) { 4828 delayAttr = 50*key; 4829 } 4830 requestTimeout(function() { 4831 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4832 $all_first.attr('data-already-reached', 'true'); 4833 } 4834 $child.addClass('start_animation'); 4835 if ( $child.hasClass('anim-line-checker') ) { 4836 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4837 var $line = $child.closest('.heading-line-wrap'); 4838 }); 4839 } 4840 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4841 highlightComplexFunc($wrapText, ev); 4842 if ( $child.hasClass('anim-tot-checker') ) { 4843 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4844 if ( $child.hasClass('anim-tot-checker') ) { 4845 $wrapText.addClass('already-animated'); 4846 } 4847 }); 4848 } 4849 }, delayAttr ); 4850 }); 4851 $element.addClass('start_animation'); 4852 if (!UNCODE.isUnmodalOpen) { 4853 this.destroy(); 4854 } 4855 }, 4856 offset: UNCODE.isFullPage ? '100%' : '90%' 4857 }); 4858 } 4859 }); 4860 } 4861 4862 var runWaypoints = function(ev){ 4863 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 4864 runWaypoints_delay = 400; 4865 } 4866 clearRequestTimeout(runWaypoints_TO); 4867 runWaypoints_TO = requestTimeout(function() { 4868 window.waypoint_animation(ev); 4869 }, runWaypoints_delay); 4870 4871 clearRequestTimeout(runWaypoints_carousel_TO); 4872 runWaypoints_carousel_TO = requestTimeout(function() { 4873 window.waypoint_carousel_animation(ev); 4874 }, 400); 4875 }; 4876 runWaypoints(); 4877 animate_css_grids_on_load(); 4878 4879 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 4880 runWaypoints(ev); 4881 }); 4882 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4883 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 4884 } 4885}; 4886 4887UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 4888 var $allItems = elements.length - startIndex, 4889 showed = 0, 4890 index = 0, 4891 use_index = false 4892 ; 4893 4894 if (filtering) { 4895 if (sequential) { 4896 use_index = true; 4897 } 4898 sequential = false; 4899 } 4900 4901 $.each(elements, function(index, val) { 4902 var $this = $(val), 4903 elInner = $('> .t-inside', val); 4904 4905 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4906 return; 4907 } 4908 if (val[0]) val = val[0]; 4909 4910 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4911 new Waypoint({ 4912 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4913 element: val, 4914 handler: function() { 4915 var element = $('> .t-inside', this.element), 4916 parent = $(this.element); 4917 var _index = use_index? index : 0; 4918 4919 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 4920 delayAttr = parseInt(element.attr('data-delay')); 4921 if (isNaN(delayAttr)) delayAttr = 100; 4922 if (sequential || use_index) { 4923 delay -= showed; 4924 } 4925 var objTimeout = requestTimeout(function() { 4926 element.removeClass('zoom-reverse').addClass('start_animation'); 4927 showed = index; 4928 }, delay * delayAttr); 4929 parent.data('objTimeout', objTimeout); 4930 if (!UNCODE.isUnmodalOpen) { 4931 this.destroy(); 4932 } 4933 }, 4934 offset: UNCODE.isFullPage ? '100%' : '90%' 4935 }); 4936 } 4937 4938 index++; 4939 }); 4940}; 4941 4942UNCODE.tapHover = function() { 4943 4944 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 4945 elClass = "hover"; 4946 4947 $(window).on('click', function() { 4948 $el.removeClass(elClass); 4949 }); 4950 4951 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 4952 e.stopPropagation(); 4953 var link = $(this); 4954 if ( ! link.hasClass(elClass)) { 4955 e.preventDefault(); 4956 link.addClass("hover"); 4957 $el.not(this).removeClass(elClass); 4958 return false;
4959 } 4960 }); 4961}; 4962 4963UNCODE.onePage = function(isMobile) { 4964 var current = 0, 4965 last = 0, 4966 lastScrollTop = 0, 4967 forceScroll = false, 4968 lastScrolled = 0, 4969 isSectionscroller = ($('.main-onepage').length) ? true : false, 4970 isOnePage = false, 4971 getOffset = function () { 4972 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container').outerHeight() : 0); 4973 return calculateOffset; 4974 } 4975 4976 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 4977 // return false; 4978 4979 function init_onepage() { 4980 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 4981 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4982 } 4983 last = $('.onepage-pagination li').last().find('a').data('index'); 4984 $.each($('div[data-parent="true"]'), function(index, val) { 4985 $(this).attr('data-section', index); 4986 if (isMobile) return; 4987 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4988 return; 4989 } 4990 var sectionDown = new Waypoint({ 4991 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4992 element: val, 4993 handler: function(direction) { 4994 if (direction == 'down') { 4995 changeMenuActive(this.element, index); 4996 } 4997 }, 4998 offset: function() { 4999 return 5 + getOffset() 5000 } 5001 }); 5002 var sectionUp = new Waypoint({ 5003 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 5004 element: val, 5005 handler: function(direction) { 5006 if (direction == 'up') { 5007 changeMenuActive(this.element, index); 5008 } 5009 }, 5010 offset: function() { 5011 return -5 - getOffset() 5012 } 5013 }); 5014 5015 if (isSectionscroller) { 5016 var label; 5017 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 5018 else label = ''; 5019 var getName = $(this).attr('data-name'); 5020 if (getName == undefined) getName = index; 5021 if (label != '') { 5022 isOnePage = true; 5023 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 5024 $('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>"); 5025 } 5026 } 5027 }); 5028 5029 if (isSectionscroller) { 5030 $.each($('ul.onepage-pagination li'), function(index, val) { 5031 var $this = $(val), 5032 $a = ('a', $this); 5033 $a.on('click', function(evt) { 5034 if ( $('.is-selected', $this).length ) { 5035 return false; 5036 } 5037 if ( $('body').hasClass('uncode-scroll-no-history') ) { 5038 evt.preventDefault(); 5039 } 5040 Waypoint.refreshAll(); 5041 var el = $('a', evt.currentTarget); 5042 current = lastScrolled = parseInt(el.attr('data-index')); 5043 lastScrolled += 1; 5044 scrollBody(current); 5045 }); 5046 }); 5047 } 5048 5049 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 5050 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 5051 goToSection = String(window.location.hash).replace(/^#/, ""); 5052 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 5053 } 5054 5055 if (typeof goToSection === 'number' && !isNaN(goToSection) && !$('body').hasClass('uncode-no-hash-scroll') ) { 5056 current = lastScrolled = goToSection; 5057 $(window).on('load', function(){ 5058 if ( $('.owl-carousel').length ) { 5059 requestTimeout(function(){ 5060 scrollBody(goToSection); 5061 }, 400); 5062 } else { 5063 scrollBody(goToSection); 5064 } 5065 }); 5066 } 5067 5068 } 5069 5070 function changeMenuActive(section, index) { 5071 current = lastScrolled = parseInt($(section).attr('data-section')); 5072 if (isOnePage) { 5073 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 5074 if (newSection.length) { 5075 $('ul.onepage-pagination li a').removeClass('is-selected'); 5076 newSection.addClass('is-selected'); 5077 } 5078 var getName = $('[data-section="' + index + '"]').attr('data-name'); 5079 if (getName != undefined && getName !== '') { 5080 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 5081 var get_href = $(val).attr('href'); 5082 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5083 $(val).closest('.menu-smart').find('.active').removeClass('active'); 5084 $(val).parent().addClass('active'); 5085 } 5086 }); 5087 } 5088 } 5089 } 5090 5091 if (isOnePage) { 5092 $(window).on('scroll', function() { 5093 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 5094 if (bodyTop == 0) { 5095 $('ul.onepage-pagination li a').removeClass('is-selected'); 5096 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 5097 var getName = $('[data-section=0]').attr('data-name'); 5098 if (getName != undefined && getName !== '') { 5099 $.each($('.menu-container .menu-item > a'), function(i, val) { 5100 var get_href = $(val).attr('href'); 5101 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 5102 $(val).closest('ul').find('.active').removeClass('active'); 5103 $(val).parent().addClass('active'); 5104 } 5105 }); 5106 } 5107 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 5108 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 5109 if (lastSection.length) { 5110 $('ul.onepage-pagination li a').removeClass('is-selected'); 5111 lastSection.addClass('is-selected'); 5112 } 5113 } 5114 }); 5115 } 5116 5117 var scrollBody = function(index) { 5118 $('ul.onepage-pagination li a').removeClass('is-selected'); 5119 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 5120 5121 var getSection = $('[data-section=' + index + ']'), 5122 scrollTo; 5123 5124 if (getSection == undefined) return; 5125 5126 var body = $("html, body"), 5127 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 5128 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 5129 getOffset = UNCODE.get_scroll_offset(index); 5130 if ( typeof getSection.offset() === 'undefined' ) 5131 return; 5132 scrollTo = getSection.offset().top; 5133
5134 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 5135 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 5136 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 5137 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 5138 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 5139 } 5140 5141 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 5142 if ( index === 0 ) { 5143 scrollTo = 0; 5144 } else { 5145 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 5146 } 5147 } else { 5148 scrollTo -= getOffset; 5149 } 5150 } 5151 5152 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 5153 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 5154 5155 if (index != 0) { 5156 UNCODE.scrolling = true; 5157 } 5158 5159 if (scrollSpeed == 0) { 5160 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 5161 UNCODE.scrolling = false; 5162 } else { 5163 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5164 $(this).stop(); 5165 }).animate({ 5166 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5167 }, scrollSpeed, 'easeInOutCubic', function() { 5168 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5169 UNCODE.scrolling = false; 5170 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 5171 || 5172 $('.menu-hided').length ) { 5173 scrollTo = getSection.offset().top; 5174 getOffset = UNCODE.get_scroll_offset(index); 5175 scrollTo -= getOffset; 5176 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 5177 $(this).stop(); 5178 }).animate({ 5179 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 5180 }, scrollSpeed, 'easeInOutCubic', function() { 5181 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5182 UNCODE.scrolling = false; 5183 } 5184 ); 5185 } 5186 }); 5187 } 5188 5189 }; 5190 5191 init_onepage(); 5192}; 5193 5194UNCODE.stickyElements = function() { 5195 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5196 if (!isMobile_wide ) { 5197 5198 var $pageHeader = $('#page-header'), 5199 $headerRow = $('.vc_row', $pageHeader), 5200 startSticky = false; 5201 5202 if ( $headerRow.hasClass('sticky-element') ) { 5203 $headerRow.removeClass('sticky-element'); 5204 $pageHeader.addClass('sticky-element'); 5205 startSticky = true; 5206 } 5207 5208 var calculateOffset = function(el) { 5209 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5210 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5211 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0, 5212 elTop = window.pageYOffset + el.getBoundingClientRect().top; 5213 5214 sideOffset += UNCODE.bodyBorder; 5215 5216 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5217 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && elTop > sideOffset) { 5218 if ($('.menu-shrink').length) { 5219 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5220 } else { 5221 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5222 } 5223 } 5224 5225 return sideOffset; 5226 5227 }, 5228 5229 initStickyElement = function($els) { 5230 if ( $('body').hasClass('vc-safe-mode') ) { 5231 return true; 5232 } 5233 if ( typeof $els === 'undefined' ) { 5234 $els = $('.sticky-element'); 5235 } 5236 $.each($els, function(index, element) { 5237 if ($(element).closest('.tab-pane').length) { 5238 var $paneParent = $(element).closest('.tab-pane'); 5239 if ( !$paneParent.hasClass('active') ) { 5240 return true; 5241 } 5242 } 5243 $(element).stick_in_parent({ 5244 sticky_class: 'is_stucked', 5245 offset_top: calculateOffset(element), 5246 bottoming: true, 5247 inner_scrolling: SiteParameters.sticky_elements === 'on' 5248 }); 5249 }); 5250 }; 5251 5252 var oldW = UNCODE.wwidth, 5253 oldH = UNCODE.wHeight; 5254 5255 requestTimeout(function() { 5256 if ($('.sticky-element').length) { 5257 5258 if ($(window).width() > UNCODE.mediaQuery) { 5259 initStickyElement(); 5260
5261 if ( startSticky === true ) { 5262 $('#page-header').trigger('sticky_kit:recalc'); 5263 } 5264 } 5265 5266 $(window).on('resize lateral_resize', function(event) { 5267 if ( oldW !== UNCODE.wwidth || oldH !== UNCODE.wHeight ) { 5268 $(".sticky-element").trigger("sticky_kit:detach"); 5269 if ($(window).width() > UNCODE.mediaQuery) { 5270 initStickyElement(); 5271 } 5272 oldW = UNCODE.wwidth; 5273 oldH = UNCODE.wHeight; 5274 } 5275 }); 5276 } 5277 }, 1000); 5278 5279 if ($('.sticky-element').length) { 5280 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5281 requestTimeout(function() { 5282 $(document.body).trigger("sticky_kit:recalc"); 5283 }, 100); 5284 }); 5285 } 5286 5287 var $panels = $('.panel-collapse'); 5288 if ( $panels.length ) { 5289 $panels.each(function(){ 5290 var $panel = $(this); 5291 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5292 $(document.body).trigger("sticky_kit:recalc"); 5293 }); 5294 }); 5295 } 5296 5297 $('.nav-tabs a').on('shown.bs.tab', function(e){ 5298 var $tabs = $(e.target).closest('.tab-container'), 5299 $panel = $('.tab-pane.active', $tabs), 5300 $els = $(e.target).nextAll(".sticky-element"); 5301 5302 $els.trigger("sticky_kit:detach"); 5303 initStickyElement($els); 5304 }); 5305 5306 $(window).on('vc-safe-mode-on', function(){ 5307 $(".sticky-element").trigger("sticky_kit:detach"); 5308 }); 5309 5310 $(window).on('vc-safe-mode-off', function(){ 5311 initStickyElement(); 5312 }); 5313 } 5314}; 5315 5316UNCODE.twentytwenty = function() { 5317 5318 if (!$('.twentytwenty-container').length) return; 5319 5320// DOM.event.move 5321// 5322// 2.0.0 5323// 5324// Stephen Band 5325// 5326// Triggers 'movestart', 'move' and 'moveend' events after 5327// mousemoves following a mousedown cross a distance threshold, 5328// similar to the native 'dragstart', 'drag' and 'dragend' events. 5329// Move events are throttled to animation frames. Move event objects 5330// have the properties: 5331// 5332// pageX: 5333// pageY: Page coordinates of pointer. 5334// startX: 5335// startY: Page coordinates of pointer at movestart. 5336// distX: 5337// distY: Distance the pointer has moved since movestart. 5338// deltaX: 5339// deltaY: Distance the finger has moved since last event. 5340// velocityX: 5341// velocityY: Average velocity over last few events. 5342 5343 5344(function(fn) { 5345 if (typeof define === 'function' && define.amd) { 5346 define([], fn); 5347 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5348 module.exports = fn; 5349 } else { 5350 fn(); 5351 } 5352})(function(){ 5353 var assign = Object.assign || window.jQuery && jQuery.extend; 5354 5355 // Number of pixels a pressed pointer travels before movestart 5356 // event is fired. 5357 var threshold = 8; 5358 5359 // Shim for requestAnimationFrame, falling back to timer. See: 5360 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5361 var requestFrame = (function(){ 5362 return ( 5363 window.requestAnimationFrame || 5364 window.webkitRequestAnimationFrame || 5365 window.mozRequestAnimationFrame || 5366 window.oRequestAnimationFrame || 5367 window.msRequestAnimationFrame || 5368 function(fn, element){ 5369 return window.setTimeout(function(){ 5370 fn(); 5371 }, 25); 5372 } 5373 ); 5374 })(); 5375 5376 // Shim for customEvent 5377 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5378 (function () { 5379 if ( typeof window.CustomEvent === "function" ) return false; 5380 function CustomEvent ( event, params ) { 5381 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5382 var evt = document.createEvent( 'CustomEvent' ); 5383 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5384 return evt; 5385 } 5386 5387 CustomEvent.prototype = window.Event.prototype; 5388 window.CustomEvent = CustomEvent; 5389 })(); 5390 5391 var ignoreTags = { 5392 textarea: true, 5393 input: true, 5394 select: true, 5395 button: true 5396 }; 5397 5398 var mouseevents = { 5399 move: 'mousemove', 5400 cancel: 'mouseup dragstart', 5401 end: 'mouseup' 5402 }; 5403 5404 var touchevents = { 5405 move: 'touchmove', 5406 cancel: 'touchend', 5407 end: 'touchend' 5408 }; 5409 5410 var rspaces = /\s+/; 5411 5412 5413 // DOM Events 5414 5415 var eventOptions = { bubbles: true, cancelable: true }; 5416 5417 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5418 5419 function createEvent(type) { 5420 return new CustomEvent(type, eventOptions); 5421 } 5422 5423 function getEvents(node) { 5424 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5425 } 5426 5427 function on(node, types, fn, data, selector) {
5428 types = types.split(rspaces); 5429 5430 var events = getEvents(node); 5431 var i = types.length; 5432 var handlers, type; 5433 5434 function handler(e) { fn(e, data); } 5435 5436 while (i--) { 5437 type = types[i]; 5438 handlers = events[type] || (events[type] = []); 5439 handlers.push([fn, handler]); 5440 node.addEventListener(type, handler); 5441 } 5442 } 5443 5444 function off(node, types, fn, selector) { 5445 types = types.split(rspaces); 5446 5447 var events = getEvents(node); 5448 var i = types.length; 5449 var type, handlers, k; 5450 5451 if (!events) { return; } 5452 5453 while (i--) { 5454 type = types[i]; 5455 handlers = events[type]; 5456 if (!handlers) { continue; } 5457 k = handlers.length; 5458 while (k--) { 5459 if (handlers[k][0] === fn) { 5460 node.removeEventListener(type, handlers[k][1]); 5461 handlers.splice(k, 1); 5462 } 5463 } 5464 } 5465 } 5466 5467 function trigger(node, type, properties) { 5468 // Don't cache events. It prevents you from triggering an event of a 5469 // given type from inside the handler of another event of that type. 5470 var event = createEvent(type); 5471 if (properties) { assign(event, properties); } 5472 node.dispatchEvent(event); 5473 } 5474 5475 5476 // Constructors 5477 5478 function Timer(fn){ 5479 var callback = fn, 5480 active = false, 5481 running = false; 5482 5483 function trigger(time) { 5484 if (active){ 5485 callback(); 5486 requestFrame(trigger); 5487 running = true; 5488 active = false; 5489 } 5490 else { 5491 running = false; 5492 } 5493 } 5494 5495 this.kick = function(fn) { 5496 active = true; 5497 if (!running) { trigger(); } 5498 }; 5499 5500 this.end = function(fn) { 5501 var cb = callback; 5502 5503 if (!fn) { return; } 5504 5505 // If the timer is not running, simply call the end callback. 5506 if (!running) { 5507 fn(); 5508 } 5509 // If the timer is running, and has been kicked lately, then 5510 // queue up the current callback and the end callback, otherwise 5511 // just the end callback. 5512 else { 5513 callback = active ? 5514 function(){ cb(); fn(); } : 5515 fn ; 5516 5517 active = true; 5518 } 5519 }; 5520 } 5521 5522 5523 // Functions 5524 5525 function noop() {} 5526 5527 function preventDefault(e) { 5528 e.preventDefault(); 5529 } 5530 5531 function isIgnoreTag(e) { 5532 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5533 } 5534 5535 function isPrimaryButton(e) { 5536 // Ignore mousedowns on any button other than the left (or primary) 5537 // mouse button, or when a modifier key is pressed. 5538 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5539 } 5540 5541 function identifiedTouch(touchList, id) { 5542 var i, l; 5543 5544 if (touchList.identifiedTouch) { 5545 return touchList.identifiedTouch(id); 5546 } 5547 5548 // touchList.identifiedTouch() does not exist in 5549 // webkit yet… we must do the search ourselves... 5550 5551 i = -1; 5552 l = touchList.length; 5553 5554 while (++i < l) { 5555 if (touchList[i].identifier === id) { 5556 return touchList[i]; 5557 } 5558 } 5559 } 5560 5561 function changedTouch(e, data) { 5562 var touch = identifiedTouch(e.changedTouches, data.identifier); 5563 5564 // This isn't the touch you're looking for. 5565 if (!touch) { return; } 5566 5567 // Chrome Android (at least) includes touches that have not 5568 // changed in e.changedTouches. That's a bit annoying. Check 5569 // that this touch has changed. 5570 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5571 5572 return touch; 5573 } 5574 5575 5576 // Handlers that decide when the first movestart is triggered 5577 5578 function mousedown(e){ 5579 // Ignore non-primary buttons 5580 if (!isPrimaryButton(e)) { return; } 5581 5582 // Ignore form and interactive elements 5583 if (isIgnoreTag(e)) { return; } 5584 5585 on(document, mouseevents.move, mousemove, e); 5586 on(document, mouseevents.cancel, mouseend, e); 5587 } 5588 5589 function mousemove(e, data){ 5590 checkThreshold(e, data, e, removeMouse); 5591 } 5592 5593 function mouseend(e, data) { 5594 removeMouse(); 5595 } 5596 5597 function removeMouse() { 5598 off(document, mouseevents.move, mousemove); 5599 off(document, mouseevents.cancel, mouseend); 5600 } 5601 5602 function touchstart(e) { 5603 // Don't get in the way of interaction with form elements 5604 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5605 5606 var touch = e.changedTouches[0]; 5607 5608 // iOS live updates the touch objects whereas Android gives us copies. 5609 // That means we can't trust the touchstart object to stay the same, 5610 // so we must copy the data. This object acts as a template for 5611 // movestart, move and moveend event objects. 5612 var data = { 5613 target: touch.target, 5614 pageX: touch.pageX, 5615 pageY: touch.pageY, 5616 identifier: touch.identifier, 5617 5618 // The only way to make handlers individually unbindable is by 5619 // making them unique. 5620 touchmove: function(e, data) { touchmove(e, data); }, 5621 touchend: function(e, data) { touchend(e, data); } 5622 }; 5623 5624 on(document, touchevents.move, data.touchmove, data); 5625 on(document, touchevents.cancel, data.touchend, data); 5626 } 5627 5628 function touchmove(e, data) { 5629 var touch = changedTouch(e, data); 5630 if (!touch) { return; } 5631 checkThreshold(e, data, touch, removeTouch); 5632 } 5633 5634 function touchend(e, data) { 5635 var touch = identifiedTouch(e.changedTouches, data.identifier); 5636 if (!touch) { return; } 5637 removeTouch(data); 5638 } 5639 5640 function removeTouch(data) { 5641 off(document, touchevents.move, data.touchmove); 5642 off(document, touchevents.cancel, data.touchend); 5643 } 5644 5645 function checkThreshold(e, data, touch, fn) { 5646 var distX = touch.pageX - data.pageX; 5647 var distY = touch.pageY - data.pageY; 5648
5649 // Do nothing if the threshold has not been crossed. 5650 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5651 5652 triggerStart(e, data, touch, distX, distY, fn); 5653 } 5654 5655 function triggerStart(e, data, touch, distX, distY, fn) { 5656 var touches = e.targetTouches; 5657 var time = e.timeStamp - data.timeStamp; 5658 5659 // Create a movestart object with some special properties that 5660 // are passed only to the movestart handlers. 5661 var template = { 5662 altKey: e.altKey, 5663 ctrlKey: e.ctrlKey, 5664 shiftKey: e.shiftKey, 5665 startX: data.pageX, 5666 startY: data.pageY, 5667 distX: distX, 5668 distY: distY, 5669 deltaX: distX, 5670 deltaY: distY, 5671 pageX: touch.pageX, 5672 pageY: touch.pageY, 5673 velocityX: distX / time, 5674 velocityY: distY / time, 5675 identifier: data.identifier, 5676 targetTouches: touches, 5677 finger: touches ? touches.length : 1, 5678 enableMove: function() { 5679 this.moveEnabled = true; 5680 this.enableMove = noop; 5681 e.preventDefault(); 5682 } 5683 }; 5684 5685 // Trigger the movestart event. 5686 trigger(data.target, 'movestart', template); 5687 5688 // Unbind handlers that tracked the touch or mouse up till now. 5689 fn(data); 5690 } 5691 5692 5693 // Handlers that control what happens following a movestart 5694 5695 function activeMousemove(e, data) { 5696 var timer = data.timer; 5697 5698 data.touch = e; 5699 data.timeStamp = e.timeStamp; 5700 timer.kick(); 5701 } 5702 5703 function activeMouseend(e, data) { 5704 var target = data.target; 5705 var event = data.event; 5706 var timer = data.timer; 5707 5708 removeActiveMouse(); 5709 5710 endEvent(target, event, timer, function() { 5711 // Unbind the click suppressor, waiting until after mouseup 5712 // has been handled. 5713 setTimeout(function(){ 5714 off(target, 'click', preventDefault); 5715 }, 0); 5716 }); 5717 } 5718 5719 function removeActiveMouse() { 5720 off(document, mouseevents.move, activeMousemove); 5721 off(document, mouseevents.end, activeMouseend); 5722 } 5723 5724 function activeTouchmove(e, data) { 5725 var event = data.event; 5726 var timer = data.timer; 5727 var touch = changedTouch(e, event); 5728 5729 if (!touch) { return; } 5730 5731 // Stop the interface from gesturing 5732 e.preventDefault(); 5733 5734 event.targetTouches = e.targetTouches; 5735 data.touch = touch; 5736 data.timeStamp = e.timeStamp; 5737 5738 timer.kick(); 5739 } 5740 5741 function activeTouchend(e, data) { 5742 var target = data.target; 5743 var event = data.event; 5744 var timer = data.timer; 5745 var touch = identifiedTouch(e.changedTouches, event.identifier); 5746 5747 // This isn't the touch you're looking for. 5748 if (!touch) { return; } 5749 5750 removeActiveTouch(data); 5751 endEvent(target, event, timer); 5752 } 5753 5754 function removeActiveTouch(data) { 5755 off(document, touchevents.move, data.activeTouchmove); 5756 off(document, touchevents.end, data.activeTouchend); 5757 } 5758 5759 5760 // Logic for triggering move and moveend events 5761 5762 function updateEvent(event, touch, timeStamp) { 5763 var time = timeStamp - event.timeStamp; 5764 5765 event.distX = touch.pageX - event.startX; 5766 event.distY = touch.pageY - event.startY; 5767 event.deltaX = touch.pageX - event.pageX; 5768 event.deltaY = touch.pageY - event.pageY; 5769 5770 // Average the velocity of the last few events using a decay 5771 // curve to even out spurious jumps in values. 5772 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 5773 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 5774 event.pageX = touch.pageX; 5775 event.pageY = touch.pageY; 5776 } 5777 5778 function endEvent(target, event, timer, fn) { 5779 timer.end(function(){ 5780 trigger(target, 'moveend', event); 5781 return fn && fn(); 5782 }); 5783 } 5784 5785 5786 // Set up the DOM 5787 5788 function movestart(e) { 5789 if (e.defaultPrevented) { return; } 5790 if (!e.moveEnabled) { return; } 5791 5792 var event = { 5793 startX: e.startX, 5794 startY: e.startY, 5795 pageX: e.pageX, 5796 pageY: e.pageY, 5797 distX: e.distX, 5798 distY: e.distY, 5799 deltaX: e.deltaX, 5800 deltaY: e.deltaY, 5801 velocityX: e.velocityX, 5802 velocityY: e.velocityY, 5803 identifier: e.identifier, 5804 targetTouches: e.targetTouches, 5805 finger: e.finger 5806 }; 5807 5808 var data = { 5809 target: e.target, 5810 event: event, 5811 timer: new Timer(update), 5812 touch: undefined, 5813 timeStamp: e.timeStamp 5814 }; 5815 5816 function update(time) { 5817 updateEvent(event, data.touch, data.timeStamp); 5818 trigger(data.target, 'move', event); 5819 } 5820 5821 if (e.identifier === undefined) { 5822 // We're dealing with a mouse event. 5823 // Stop clicks from propagating during a move 5824 on(e.target, 'click', preventDefault); 5825 on(document, mouseevents.move, activeMousemove, data); 5826 on(document, mouseevents.end, activeMouseend, data); 5827 } 5828 else { 5829 // In order to unbind correct handlers they have to be unique 5830 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 5831 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 5832 5833 // We're dealing with a touch. 5834 on(document, touchevents.move, data.activeTouchmove, data); 5835 on(document, touchevents.end, data.activeTouchend, data); 5836 } 5837 } 5838 5839 on(document, 'mousedown', mousedown); 5840 on(document, 'touchstart', touchstart); 5841 on(document, 'movestart', movestart); 5842 5843 5844 // jQuery special events 5845 // 5846 // jQuery event objects are copies of DOM event objects. They need 5847 // a little help copying the move properties across. 5848 5849 if (!window.jQuery) { return; } 5850 5851 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 5852 5853 function enableMove1(e) { e.enableMove(); } 5854 function enableMove2(e) { e.enableMove(); } 5855 function enableMove3(e) { e.enableMove(); } 5856 5857 function add(handleObj) { 5858 var handler = handleObj.handler; 5859 5860 handleObj.handler = function(e) { 5861 // Copy move properties across from originalEvent 5862 var i = properties.length; 5863 var property; 5864 5865 while(i--) { 5866 property = properties[i]; 5867 e[property] = e.originalEvent[property]; 5868 } 5869 5870 handler.apply(this, arguments); 5871 }; 5872 } 5873 5874 jQuery.event.special.movestart = { 5875 setup: function() { 5876 // Movestart must be enabled to allow other move events 5877 on(this, 'movestart', enableMove1); 5878 5879 // Do listen to DOM events 5880 return false;
5881 }, 5882 5883 teardown: function() { 5884 off(this, 'movestart', enableMove1); 5885 return false; 5886 }, 5887 5888 add: add 5889 }; 5890 5891 jQuery.event.special.move = { 5892 setup: function() { 5893 on(this, 'movestart', enableMove2); 5894 return false; 5895 }, 5896 5897 teardown: function() { 5898 off(this, 'movestart', enableMove2); 5899 return false; 5900 }, 5901 5902 add: add 5903 }; 5904 5905 jQuery.event.special.moveend = { 5906 setup: function() { 5907 on(this, 'movestart', enableMove3); 5908 return false; 5909 }, 5910 5911 teardown: function() { 5912 off(this, 'movestart', enableMove3); 5913 return false; 5914 }, 5915 5916 add: add 5917 }; 5918}); 5919 5920 $.fn.twentytwenty = function(options) { 5921 var options = $.extend({ 5922 default_offset_pct: 0.5, 5923 orientation: 'horizontal', 5924 before_label: 'Before', 5925 after_label: 'After', 5926 no_overlay: false, 5927 move_slider_on_hover: false, 5928 move_with_handle_only: true, 5929 click_to_move: false 5930 }, options); 5931 5932 return this.each(function() { 5933 5934 var sliderPct = options.default_offset_pct; 5935 var container = $(this); 5936 var sliderOrientation = options.orientation; 5937 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 5938 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 5939 5940 5941 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 5942 if(!options.no_overlay) { 5943 container.append("<div class='twentytwenty-overlay'></div>"); 5944 var overlay = container.find(".twentytwenty-overlay"); 5945 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 5946 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 5947 } 5948 var beforeImg = container.find("img:first"); 5949 var afterImg = container.find("img:last"); 5950 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 5951 var slider = container.find(".twentytwenty-handle"); 5952 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 5953 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 5954 container.addClass("twentytwenty-container"); 5955 beforeImg.addClass("twentytwenty-before"); 5956 afterImg.addClass("twentytwenty-after"); 5957 5958 var calcOffset = function(dimensionPct) { 5959 var w = beforeImg.width(); 5960 var h = beforeImg.height(); 5961 return { 5962 w: w+"px", 5963 h: h+"px", 5964 cw: (dimensionPct*w)+"px", 5965 ch: (dimensionPct*h)+"px" 5966 }; 5967 }; 5968 5969 var adjustContainer = function(offset) { 5970 if (sliderOrientation === 'vertical') { 5971 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 5972 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 5973 } 5974 else { 5975 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 5976 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 5977 } 5978 container.css("height", offset.h); 5979 }; 5980 5981 var adjustSlider = function(pct) { 5982 var offset = calcOffset(pct); 5983 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 5984 adjustContainer(offset); 5985 }; 5986 5987 // Return the number specified or the min/max number if it outside the range given. 5988 var minMaxNumber = function(num, min, max) { 5989 return Math.max(min, Math.min(max, num)); 5990 }; 5991 5992 // Calculate the slider percentage based on the position. 5993 var getSliderPercentage = function(positionX, positionY) { 5994 var sliderPercentage = (sliderOrientation === 'vertical') ? 5995 (positionY-offsetY)/imgHeight : 5996 (positionX-offsetX)/imgWidth; 5997 5998 return minMaxNumber(sliderPercentage, 0, 1); 5999 }; 6000 6001 6002 $(window).on("resize.twentytwenty", function(e) { 6003 adjustSlider(sliderPct); 6004 }); 6005 6006 var offsetX = 0; 6007 var offsetY = 0; 6008 var imgWidth = 0; 6009 var imgHeight = 0; 6010 var onMoveStart = function(e) { 6011 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 6012 e.preventDefault(); 6013 } 6014 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 6015 e.preventDefault(); 6016 } 6017 container.addClass("active"); 6018 offsetX = container.offset().left; 6019 offsetY = container.offset().top; 6020 imgWidth = beforeImg.width(); 6021 imgHeight = beforeImg.height(); 6022 }; 6023 var onMove = function(e) { 6024 if (container.hasClass("active")) { 6025 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6026 adjustSlider(sliderPct); 6027 } 6028 }; 6029 var onMoveEnd = function() { 6030 container.removeClass("active"); 6031 }; 6032 6033 var moveTarget = options.move_with_handle_only ? slider : container; 6034 moveTarget.on("movestart",onMoveStart); 6035 moveTarget.on("move",onMove); 6036 moveTarget.on("moveend",onMoveEnd); 6037 6038 if (options.move_slider_on_hover) { 6039 container.on("mouseenter", onMoveStart); 6040 container.on("mousemove", onMove); 6041 container.on("mouseleave", onMoveEnd); 6042 } 6043 6044 slider.on("touchmove", function(e) { 6045 e.preventDefault(); 6046 }); 6047 6048 container.find("img").on("mousedown", function(event) { 6049 event.preventDefault(); 6050 }); 6051 6052 if (options.click_to_move) { 6053 container.on('click', function(e) { 6054 offsetX = container.offset().left; 6055 offsetY = container.offset().top; 6056 imgWidth = beforeImg.width(); 6057 imgHeight = beforeImg.height(); 6058 6059 sliderPct = getSliderPercentage(e.pageX, e.pageY); 6060 adjustSlider(sliderPct); 6061 }); 6062 } 6063 6064 $(window).trigger("resize.twentytwenty"); 6065 }); 6066 }; 6067 6068 6069 $(window).on("load", function(e) { 6070 $('.twentytwenty-container').each(function(){ 6071 var $container = $(this); 6072 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6073 $container.twentytwenty(); 6074 } 6075 $('img', $container).on('async-done', function(){ 6076 if ( ! $('.twentytwenty-wrapper', $container).length ) { 6077 $container.twentytwenty(); 6078 } 6079 }); 6080 }); 6081 }); 6082} 6083 6084UNCODE.justifiedGallery = function() { 6085 6086 var breakPointMe = function( val ) { 6087 val = parseInt( val ); 6088 if ( isNaN(val) ) { 6089 return false;
6090 } 6091 if ( val >= 1500 ) { 6092 return 1; 6093 } else if ( val < 1500 && val >= 960 ) { 6094 return 2; 6095 } else if ( val < 960 && val >= 570 ) { 6096 return 3; 6097 } else if ( val < 570 ) { 6098 return 4; 6099 } 6100 } 6101 6102 var gutterByBreakpoint = function( bp, gutter ) { 6103 var ret; 6104 switch(gutter) { 6105 case 'no-gutter': 6106 ret = 0; 6107 break; 6108 case 'px-gutter': 6109 ret = 1; 6110 break; 6111 case 'half-gutter': 6112 ret = 18; 6113 break; 6114 case 'double-gutter': 6115 switch(bp) { 6116 case 3: 6117 case 4: 6118 ret = 36; 6119 break; 6120 default: 6121 ret = 72; 6122 break; 6123 } 6124 break; 6125 case 'triple-gutter': 6126 switch(bp) { 6127 case 3: 6128 case 4: 6129 ret = 36; 6130 break; 6131 default: 6132 ret = 108; 6133 break; 6134 } 6135 break; 6136 case 'quad-gutter': 6137 switch(bp) { 6138 case 2: 6139 ret = 108; 6140 break; 6141 case 3: 6142 ret = 72; 6143 break; 6144 case 4: 6145 ret = 36; 6146 break; 6147 default: 6148 ret = 144; 6149 break; 6150 } 6151 break; 6152 default: 6153 ret = 36;//single-gutter 6154 } 6155 return ret; 6156 } 6157 6158 if ($('.justified-layout').length > 0) { 6159 var justifiedContainersArray = [], 6160 typeGridArray = [], 6161 layoutGridArray = [], 6162 transitionDuration = [], 6163 $filterItems = [], 6164 $filters = $('.justified-system .isotope-filters'), 6165 $itemSelector = '.tmb', 6166 $items, 6167 itemMargin, 6168 correctionFactor = 0, 6169 firstLoad = true, 6170 isOriginLeft = $('body').hasClass('rtl') ? false : true, 6171 prevW = breakPointMe(UNCODE.wwidth); 6172 $('[class*="justified-container"]').each(function() { 6173 var isoData = $(this).data(); 6174 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6175 if (isoData.type == 'metro') typeGridArray.push(true); 6176 else typeGridArray.push(false); 6177 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 6178 else layoutGridArray.push('justified'); 6179 justifiedContainersArray.push($(this)); 6180 }); 6181 var init_justifiedGallery = function() { 6182 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 6183 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 6184 justifiedId = justifiedSystem.attr('id'), 6185 $layoutMode = layoutGridArray[i], 6186 gutter = $(justifiedContainersArray[i]).data('gutter'), 6187 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 6188 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 6189 lastRow = $(justifiedContainersArray[i]).data('last-row'), 6190 margins; 6191 6192 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 6193 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 6194 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6195 6196 margins = gutterByBreakpoint(prevW, gutter); 6197 6198 $(justifiedContainersArray[i]).justifiedGallery({ 6199 rowHeight: rowHeight, 6200 maxRowHeight: maxRowHeight, 6201 margins: margins, 6202 cssAnimation: true, 6203 lastRow: lastRow, 6204 waitThumbnailsLoad: false 6205 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 6206 6207 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 6208 $(justifiedContainersArray[i]).infinitescroll({ 6209 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 6210 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6211 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 6212 animate: false, 6213 behavior: 'local', 6214 debug: false, 6215 loading: { 6216 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 6217 speed: 0, 6218 finished: undefined, 6219 msg: $('#' + justifiedId + ' .loadmore-button'), 6220 }, 6221 errorCallback: function() { 6222 var justified_system = $(this).closest('.justified-system'); 6223 $('.loading-button', justified_system).hide(); 6224 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6225 } 6226 }, 6227 // append the new items to galleryJustified on the infinitescroll callback function. 6228 function(newElements, opts) { 6229 var $galleryJustified = $(this), 6230 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6231 filters = new Array(), 6232 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6233 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6234 $numPages = $('a', $infinite_button).data('pages'),
6235 delay = 300; 6236 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6237 $infinite_button.show(); 6238 $loading_button.hide(); 6239 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6240 $('> li', $galleryJustified).remove(); 6241 $.each($(newElements), function(index, val) { 6242 $(val).addClass('tmb-iso'); 6243 if ($(val).is("li")) { 6244 filters.push($(val)[0]); 6245 } 6246 }); 6247 newElements = newElements.filter(function(x) { 6248 return filters.indexOf(x) < 0 6249 }); 6250 $.each($(filters), function(index, val) { 6251 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6252 }); 6253 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6254 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6255 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6256 if (typeof getLightbox === 'object') { 6257 getLightbox.refresh(); 6258 } else { 6259 UNCODE.lightbox(); 6260 } 6261 } 6262 if ( typeof twttr !== 'undefined' ) 6263 twttr.widgets.load(justifiedContainersArray[i]); 6264 6265 requestTimeout(function() { 6266 $galleryJustified.trigger('more-items-loaded'); 6267 $(window).trigger('more-items-loaded'); 6268 }, 1000); 6269 }); 6270 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6271 var $infinite_justified = $(justifiedContainersArray[i]), 6272 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6273 $infinite_justified.infinitescroll('pause'); 6274 $infinite_button.on('click', function(event) { 6275 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6276 $.each(UNCODE.lightboxArray, function(index, val) { 6277 UNCODE.lightboxArray[index].destroy(); 6278 }); 6279 } 6280 event.preventDefault(); 6281 var $justified_system = $(event.target).closest('.justified-system'), 6282 $infinite_justified = $justified_system.find('.justified-container'), 6283 justifiedId = $justified_system.attr('id'); 6284 $(event.currentTarget).html(SiteParameters.loading); 6285 $infinite_justified.infinitescroll('resume'); 6286 $infinite_justified.infinitescroll('retrieve'); 6287 $infinite_justified.infinitescroll('pause'); 6288 $infinite_justified.trigger('more-items-loaded'); 6289 $(window).trigger('more-items-loaded'); 6290 }); 6291 } 6292 } 6293 } 6294 }, 6295 onLayout = function(justifiedObj, startIndex) { 6296 justifiedObj.css('opacity', 1); 6297 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6298 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6299 6300 requestTimeout(function() { 6301 // window.dispatchEvent(UNCODE.boxEvent); 6302 UNCODE.adaptive(); 6303 if (SiteParameters.dynamic_srcset_active === '1') { 6304 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6305 } 6306 if (typeof MediaElement === "function") { 6307 $(justifiedObj).find('audio,video').each(function() { 6308 $(this).mediaelementplayer({ 6309 pauseOtherPlayers: false, 6310 }); 6311 }); 6312 } 6313 if ($(justifiedObj).find('.nested-carousel').length) { 6314 if (typeof UNCODE.carousel !== 'undefined') { 6315 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6316 } 6317 requestTimeout(function() { 6318 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6319 justifiedObj.addClass('justified-gallery-finished') 6320 Waypoint.refreshAll(); 6321 }, 200); 6322 } else { 6323 requestTimeout(function() { 6324 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6325 justifiedObj.addClass('justified-gallery-finished') 6326 Waypoint.refreshAll(); 6327 }, 300); 6328 } 6329 }, 100); 6330 6331 }, 6332 boxAnimation = function(items, startIndex, sequential, container) { 6333 var $allItems = items.length - startIndex, 6334 showed = 0, 6335 index = 0; 6336 if (container.closest('.owl-item').length == 1) return false;
6337 $.each(items, function(index, val) { 6338 var elInner = $('> .t-inside', val); 6339 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6340 return; 6341 } 6342 if (val[0]) val = val[0]; 6343 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6344 new Waypoint({ 6345 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6346 element: val, 6347 handler: function() { 6348 var element = $('> .t-inside', this.element), 6349 parent = $(this.element), 6350 currentIndex = parent.index(); 6351 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6352 delayAttr = parseInt(element.attr('data-delay')); 6353 if (isNaN(delayAttr)) delayAttr = 100; 6354 delay -= showed; 6355 var objTimeout = requestTimeout(function() { 6356 element.removeClass('zoom-reverse').addClass('start_animation'); 6357 showed = parent.index(); 6358 }, delay * delayAttr); 6359 parent.data('objTimeout', objTimeout); 6360 if (!UNCODE.isUnmodalOpen) { 6361 this.destroy(); 6362 } 6363 }, 6364 offset: '100%' 6365 }) 6366 } else { 6367 elInner.removeClass('animate_when_almost_visible'); 6368 $(val).addClass('no-waypoint-animation'); 6369 /*if (elInner.hasClass('force-anim')) { 6370 elInner.addClass('start_animation'); 6371 } else { 6372 elInner.css('opacity', 1); 6373 }*/ 6374 } 6375 index++; 6376 }); 6377 }; 6378 $filters.on('click', 'a[data-filter]', function(evt) { 6379 var $filter = $(this), 6380 filterContainer = $filter.closest('.isotope-filters'), 6381 filterValue = $filter.attr('data-filter'), 6382 container = $filter.closest('.justified-system').find($('.justified-layout')), 6383 lastRow = container.data('last-row'), 6384 transitionDuration = 0, 6385 delay = 300, 6386 filterItems = []; 6387 6388 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6389 6390 var filter_items = function(){ 6391 if (filterValue !== undefined) { 6392 $.each($('> .tmb > .t-inside', container), function(index, val) { 6393 var parent = $(val).parent(), 6394 objTimeout = parent.data('objTimeout'); 6395 if (objTimeout) { 6396 $(val).removeClass('zoom-reverse'); 6397 clearRequestTimeout(objTimeout); 6398 } 6399 if (transitionDuration == 0) { 6400 if ($(val).hasClass('animate_when_almost_visible')) { 6401 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6402 } else { 6403 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6404 } 6405 } 6406 }); 6407 6408 requestTimeout(function() { 6409 var $block, 6410 selector, 6411 lightboxElements, 6412 $boxes; 6413 6414 if ( filterValue !== '' && filterValue !== '*' ) { 6415 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6416 selector = '.' + filterValue; 6417 $.each($(selector, container), function(index, block) { 6418 lightboxElements = $('[data-lbox^=ilightbox]', block); 6419 if (lightboxElements.length) { 6420 lightboxElements.removeClass('lb-disabled'); 6421 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6422 } 6423 filterItems.push(block); 6424 }); 6425 container.justifiedGallery({ 6426 filter: selector, 6427 lastRow: 'nojustify' 6428 }); 6429 } else { 6430 container.justifiedGallery({ 6431 filter: false, 6432 lastRow: lastRow 6433 }); 6434 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6435 filterItems = $('> .tmb', container); 6436 } 6437 container.trigger('more-items-loaded'); 6438 $(window).trigger('more-items-loaded'); 6439 6440 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6441 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6442 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6443 if (typeof getLightbox === 'object') { 6444 getLightbox.refresh(); 6445 } else { 6446 UNCODE.lightbox(); 6447 } 6448 } 6449 6450 if (transitionDuration == 0) { 6451 requestTimeout(function() { 6452 boxAnimation(filterItems, 0, false, container); 6453 }, 100); 6454 } 6455 requestTimeout(function() { 6456 Waypoint.refreshAll(); 6457 container.trigger('more-items-loaded'); 6458 $(window).trigger('more-items-loaded'); 6459 }, 2000); 6460 6461 }, delay); 6462 } else { 6463 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6464 $.each(UNCODE.lightboxArray, function(index, val) { 6465 UNCODE.lightboxArray[index].destroy(); 6466 }); 6467 } 6468 $.each($('> .tmb > .t-inside', container), function(index, val) { 6469 var parent = $(val).parent(), 6470 objTimeout = parent.data('objTimeout'); 6471 if (objTimeout) { 6472 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6473 clearRequestTimeout(objTimeout); 6474 } 6475 if (transitionDuration == 0) { 6476 if ($(val).hasClass('animate_when_almost_visible')) { 6477 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6478 } else { 6479 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6480 } 6481 } 6482 }); 6483 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6484 UNCODE.lightbox(); 6485 } 6486 container.parent().addClass('justified-loading'); 6487 container.trigger('more-items-loaded'); 6488 $(window).trigger('more-items-loaded'); 6489 } 6490 }; 6491 6492 if (!$filter.hasClass('active')) { 6493 /** Scroll top with filtering */ 6494 if (filterContainer.hasClass('filter-scroll')) { 6495 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6496 calc_scroll -= UNCODE.get_scroll_offset(); 6497 6498 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6499 delta = bodyTop - calc_scroll, 6500 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6501 filterTolerance = false, 6502 filter_timeout; 6503 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6504 6505 if ( !UNCODE.isFullPage ) { 6506 if (scrollSpeed == 0) { 6507 $('html, body').scrollTop(calc_scroll); 6508 UNCODE.scrolling = false;
6509 filter_items(); 6510 } else { 6511 6512 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6513 filter_items(); 6514 filterTolerance = true; 6515 } 6516 6517 $('html, body').animate({ 6518 scrollTop: calc_scroll 6519 },{ 6520 easing: 'easeInOutQuad', 6521 duration: scrollSpeed, 6522 complete: function(){ 6523 UNCODE.scrolling = false; 6524 if ( !filterTolerance ) { 6525 filter_timeout = setTimeout(function(){ 6526 clearTimeout(filter_timeout); 6527 filter_items(); 6528 }, 200); 6529 } 6530 } 6531 }); 6532 } 6533 } 6534 } else { 6535 filter_items(); 6536 } 6537 } 6538 evt.preventDefault(); 6539 }); 6540 6541 $filters.each(function(i, buttonGroup) { 6542 var $buttonGroup = $(buttonGroup); 6543 $buttonGroup.on('click', 'a', function() { 6544 $buttonGroup.find('.active').removeClass('active'); 6545 $(this).addClass('active'); 6546 }); 6547 6548 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6549 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6550 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6551 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6552 e.preventDefault(); 6553 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6554 }); 6555 }); 6556 window.addEventListener('boxResized', function(e) { 6557 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6558 prevW = breakPointMe(UNCODE.wwidth); 6559 $.each($('.justified-layout'), function(index, val) { 6560 var gutter = $(this).data('gutter'), 6561 margins = gutterByBreakpoint( prevW, gutter); 6562 $(this).justifiedGallery({ 6563 margins: margins 6564 }); 6565 $(this).find('.mejs-video,.mejs-audio').each(function() { 6566 $(this).trigger('resize'); 6567 }); 6568 }); 6569 } 6570 }, false); 6571 6572 init_justifiedGallery(); 6573 }; 6574}; 6575 6576UNCODE.cssGrid = function() { 6577 if ($('.cssgrid-layout').length > 0) { 6578 var cssGridContainersArray = []; 6579 var transitionDuration = []; 6580 var $filters = $('.cssgrid-system .cssgrid-filters'); 6581 6582 $('[class*="cssgrid-container"]').each(function() { 6583 cssGridContainersArray.push($(this)); 6584 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6585 }); 6586 6587 var init_cssGridAjax = function() { 6588 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6589 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6590 cssGridId = cssGridSystem.attr('id'); 6591 6592 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6593 6594 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6595 $(cssGridContainersArray[i]).infinitescroll({ 6596 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6597 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6598 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat, #' + cssGridId + ' .woocommerce-result-count-wrapper--default', // selector for all items you'll retrieve 6599 animate: false, 6600 behavior: 'local', 6601 debug: false, 6602 loading: { 6603 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6604 speed: 0, 6605 finished: undefined, 6606 msg: $('#' + cssGridId + ' .loadmore-button'), 6607 }, 6608 errorCallback: function() { 6609 var cssgrid_system = $(this).closest('.cssgrid-system'); 6610 $('.loading-button', cssgrid_system).hide(); 6611 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6612 } 6613 }, 6614 // append the new items to cssGrid on the infinitescroll callback function. 6615 function(newElements, opts) { 6616 var $cssGrid = $(this), 6617 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6618 cssGridId = cssGridSystemCont.attr('id'), 6619 filters = new Array(), 6620 $loading_button = cssGridSystemCont.find('.loading-button'), 6621 $infinite_button = cssGridSystemCont.find('.loadmore-button'), 6622 $numPages = $('a', $infinite_button).data('pages'), 6623 $woo_results,
6624 delay = 300; 6625 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6626 $infinite_button.show(); 6627 $loading_button.hide(); 6628 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6629 $('> li', $cssGrid).remove(); 6630 $('.cssgrid-container').find('.woocommerce-result-count-wrapper').remove(); 6631 $.each($(newElements), function (index, val) { 6632 if ($(val).hasClass('woocommerce-result-count-wrapper')) { 6633 $woo_results = $(val); 6634 delete newElements[index]; 6635 } else { 6636 $(val).addClass('tmb-grid'); 6637 if ($(val).is("li")) { 6638 filters.push($(val)[0]); 6639 } 6640 } 6641 }); 6642 newElements = newElements.filter(function(x) { 6643 return filters.indexOf(x) < 0 6644 }); 6645 $.each($(filters), function(index, val) { 6646 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6647 }); 6648 if ($woo_results && $woo_results.length > 0) { 6649 var old_count = cssGridSystemCont.find('.woocommerce-result-count').text(); 6650 var new_count = $woo_results.find('.woocommerce-result-count').text(); 6651 var old_start = old_count.match(/(\d+)–(\d+)/)[1]; 6652 var new_end = new_count.match(/(\d+)–(\d+)/)[2]; 6653 function replaceMatch(match, p1, p2) { 6654 return old_start + '–' + new_end; 6655 } 6656 var new_count_text = old_count.replace(/(\d+)–(\d+)/, replaceMatch); 6657 cssGridSystemCont.find('.woocommerce-result-count').text(new_count_text); 6658 } 6659 6660 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter');
6661 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6662 if (filterValue !== undefined && filterValue != '*') { 6663 $(newElements).hide(); 6664 var els_to_show = $(); 6665 $(newElements).each(function() { 6666 var el = $(this); 6667 if (el.hasClass(filterValue)) { 6668 els_to_show = els_to_show.add(el); 6669 el.show(); 6670 } 6671 }); 6672 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6673 } else { 6674 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6675 } 6676 6677 UNCODE.adaptive(); 6678 if (SiteParameters.dynamic_srcset_active === '1') { 6679 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6680 } 6681 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6682 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6683 if (typeof getLightbox === 'object') { 6684 getLightbox.refresh(); 6685 } else { 6686 UNCODE.lightbox(); 6687 } 6688 } 6689 if ( typeof twttr !== 'undefined' ) { 6690 twttr.widgets.load(cssGridContainersArray[i]); 6691 } 6692 6693 UNCODE.carousel($(newElements)); 6694 requestTimeout(function() { 6695 $cssGrid.trigger('more-items-loaded'); 6696 $(window).trigger('more-items-loaded'); 6697 }, 1000); 6698 6699 }); 6700 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6701 var $cssgrid_el = $(cssGridContainersArray[i]), 6702 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6703 $cssgrid_el.infinitescroll('pause'); 6704 $infinite_button.on('click', function(event) { 6705 event.preventDefault(); 6706 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6707 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6708 cssGridId = $cssgrid_system.attr('id'); 6709 $(event.currentTarget).html(SiteParameters.loading); 6710 $cssgrid_el.infinitescroll('resume'); 6711 $cssgrid_el.infinitescroll('retrieve'); 6712 $cssgrid_el.infinitescroll('pause'); 6713 }); 6714 } 6715 } 6716 } 6717 }; 6718 6719 init_cssGridAjax(); 6720 6721 if ($('.cssgrid-pagination').length > 0) { 6722 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 6723 evt.preventDefault(); 6724 6725 if (SiteParameters.index_pagination_disable_scroll !== '1') { 6726 var container = $(this).closest('.cssgrid-system'), 6727 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6728 6729 calc_scroll -= UNCODE.get_scroll_offset(); 6730 6731 var menu_container = $('.menu-sticky'); 6732 var menu = menu_container.find('.menu-container'); 6733 6734 if (menu_container.length > 0 && menu.length > 0) { 6735 calc_scroll = calc_scroll - menu.outerHeight(); 6736 } 6737 6738 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6739 delta = bodyTop - calc_scroll, 6740 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6741 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6742 6743 if ( !UNCODE.isFullPage ) { 6744 if (scrollSpeed == 0) { 6745 $('html, body').scrollTop(calc_scroll); 6746 } else { 6747 $('html, body').animate({ 6748 scrollTop: calc_scroll 6749 },{ 6750 easing: 'easeInOutQuad', 6751 duration: scrollSpeed, 6752 complete: function(){ 6753 UNCODE.scrolling = false; 6754 } 6755 }); 6756 } 6757 } 6758 } 6759 6760 loadCssGrid($(this), true); 6761 }); 6762 } 6763 6764 $filters.on('click', 'a.grid-nav-link', function(evt) { 6765 if ($(this).hasClass('no-grid-filter')) { 6766 return; 6767 } 6768 var $filter = $(this), 6769 filterContainer = $filter.closest('.cssgrid-filters'), 6770 filterValue = $filter.attr('data-filter'), 6771 containerSystem = $filter.closest('.cssgrid-system'), 6772 container = containerSystem.find($('.cssgrid-layout')), 6773 transitionDuration = containerSystem.data('transitionDuration'),
6774 delay = 300, 6775 filterItems = [], 6776 all_thumbs = container.find('.tmb-grid'); 6777 6778 var filter_items = function(){ 6779 if (filterValue !== undefined) { 6780 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6781 var parent = $(val).parent(), 6782 objTimeout = parent.data('objTimeout'); 6783 if (objTimeout) { 6784 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6785 clearRequestTimeout(objTimeout); 6786 } 6787 if (transitionDuration == 0) { 6788 if ($(val).hasClass('animate_when_almost_visible')) { 6789 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6790 } else { 6791 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6792 } 6793 } 6794 }); 6795 requestTimeout(function(){ 6796 if ( filterValue == '*' ) { 6797 all_thumbs.show(); 6798 all_thumbs.each(function(index, val) { 6799 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6800 filterItems.push($(this)); 6801 }); 6802 } else { 6803 all_thumbs.each(function() { 6804 var _tmb = $(this); 6805 if (_tmb.hasClass(filterValue)) { 6806 _tmb.show(); 6807 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6808 filterItems.push(_tmb); 6809 } else { 6810 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 6811 _tmb.hide(); 6812 } 6813 }); 6814 } 6815 6816 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6817 6818 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6819 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 6820 var lightboxElements = $('[data-lbox^=ilightbox]', container); 6821 if (lightboxElements.length) { 6822 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6823 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6824 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 6825 if (typeof getLightbox === 'object') { 6826 getLightbox.refresh(); 6827 } else { 6828 UNCODE.lightbox(); 6829 } 6830 } 6831 } 6832 container.trigger('more-items-loaded'); 6833 $(window).trigger('more-items-loaded'); 6834 }, delay); 6835 } else { 6836 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6837 var parent = $(val).parent(), 6838 objTimeout = parent.data('objTimeout'); 6839 if (objTimeout) { 6840 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6841 clearRequestTimeout(objTimeout); 6842 } 6843 if (transitionDuration == 0) { 6844 if ($(val).hasClass('animate_when_almost_visible')) { 6845 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6846 } else { 6847 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6848 } 6849 } 6850 }); 6851 loadCssGrid($filter); 6852 } 6853 }; 6854 6855 if (!$filter.hasClass('active')) { 6856 /** Scroll top with filtering */ 6857 if (filterContainer.hasClass('filter-scroll')) { 6858 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6859 calc_scroll -= UNCODE.get_scroll_offset(); 6860 6861 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6862 delta = bodyTop - calc_scroll, 6863 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6864 filterTolerance = false, 6865 filter_timeout; 6866 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6867 6868 if ( !UNCODE.isFullPage ) { 6869 if (scrollSpeed == 0) { 6870 $('html, body').scrollTop(calc_scroll); 6871 UNCODE.scrolling = false; 6872 filter_items(); 6873 } else { 6874 6875 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6876 filter_items(); 6877 filterTolerance = true; 6878 } 6879 6880 $('html, body').animate({ 6881 scrollTop: calc_scroll 6882 },{ 6883 easing: 'easeInOutQuad', 6884 duration: scrollSpeed, 6885 complete: function(){ 6886 UNCODE.scrolling = false;
6887 if ( !filterTolerance ) { 6888 filter_timeout = setTimeout(function(){ 6889 clearTimeout(filter_timeout); 6890 filter_items(); 6891 }, 200); 6892 } 6893 } 6894 }); 6895 } 6896 } 6897 } else { 6898 filter_items(); 6899 } 6900 } 6901 evt.preventDefault(); 6902 }); 6903 6904 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 6905 var params = UNCODE.getURLParams(window.location); 6906 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 6907 6908 UNCODE.lastURL = window.location.href; 6909 6910 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 6911 return; 6912 } 6913 6914 if (params.id === undefined) { 6915 $.each($('.cssgrid-system'), function(index, val) { 6916 loadCssGrid($(val)); 6917 }); 6918 } else { 6919 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 6920 loadCssGrid($('#' + params.id)); 6921 } 6922 } 6923 }); 6924 6925 var loadCssGrid = function($href, $paginating) { 6926 var is_paginating = false; 6927 6928 if (undefined !== $paginating && $paginating) { 6929 var is_paginating = $paginating; 6930 } 6931 6932 var href = ($href.is("a") ? $href.attr('href') : location), 6933 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 6934 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 6935 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 6936 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 6937 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 6938 cssgridId = cssgridSystem.attr('id'); 6939 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 6940 UNCODE.lastURL = href; 6941 history.pushState({ 6942 myCSSgrid: true 6943 }, document.title, href); 6944 } 6945 cssgridWrapper.addClass('cssgrid-loading'); 6946 if (is_paginating) { 6947 cssgridWrapper.addClass('grid-filtering'); 6948 } 6949 $.ajax({ 6950 url: href 6951 }).done(function(data) { 6952 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 6953 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 6954 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 6955 requestTimeout(function() { 6956 cssgridContainer.html($resultItems); 6957 cssgridWrapper.removeClass('cssgrid-loading'); 6958 cssgridWrapper.removeClass('grid-filtering'); 6959 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6960 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 6961 UNCODE.adaptive(); 6962 if (SiteParameters.dynamic_srcset_active === '1') { 6963 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 6964 } 6965 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6966 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 6967 if (typeof getLightbox === 'object') { 6968 getLightbox.refresh(); 6969 } else { 6970 UNCODE.lightbox(); 6971 } 6972 } 6973 cssgridContainer.trigger('more-items-loaded'); 6974 $(window).trigger('more-items-loaded'); 6975 }, 300); 6976 6977 $('.pagination', cssgridFooter).remove(); 6978 cssgridFooter.append($resultPagination); 6979 6980 if (cssgridResultCount.length > 0) { 6981 $('.woocommerce-result-count', cssgridResultCount).remove(); 6982 cssgridResultCount.append($resultCount); 6983 } 6984 }); 6985 }; 6986 6987 $filters.each(function(i, buttonGroup) { 6988 var $buttonGroup = $(buttonGroup); 6989 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 6990 $buttonGroup.find('.active').removeClass('active'); 6991 $(this).addClass('active'); 6992 6993 }); 6994 6995 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6996 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6997 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6998 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6999 e.preventDefault(); 7000 $cats_filters.slideToggle(400, 'easeInOutCirc'); 7001 }); 7002 7003 }); 7004 }; 7005}; 7006 7007UNCODE.preventDoubleTransition = function() { 7008 $('.sticky-element .animate_when_almost_visible').each(function(){ 7009 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 7010 $el.addClass('do_not_reanimate'); 7011 }); 7012 }); 7013}; 7014 7015UNCODE.checkScrollForTabs = function(){ 7016 var goToSection = window.location.hash.replace('#', ''), 7017 $index; 7018 7019 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 7020 goToSection = encodeURIComponent(goToSection); 7021 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 7022 7023 $index.attr('data-parent', 'parent-' + goToSection); 7024 7025 if (window.location.hash != undefined && window.location.hash != '') { 7026 requestTimeout(function() { 7027 scrollBody('parent-' + goToSection); 7028 }, 500); 7029 } 7030 7031 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 7032 var hash = (e.currentTarget).hash, 7033 index = (e.currentTarget).closest('.uncode-tabs'); 7034 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 7035 $('a[href="' + hash + '"][data-tab-history]').click(); 7036 scrollBody(index); 7037 } 7038 }); 7039 7040 var scrollBody = function(index) { 7041 7042 var getSection = $('a[href="' + index + '"][data-tab-history]'), 7043 scrollTo, 7044 safeGap = 27; 7045 7046 if ( ! getSection.length ) { 7047 getSection = $('div[data-parent="' + index + '"]'); 7048 7049 if ( getSection.attr('data-target') == 'row' ) { 7050 getSection = getSection.closest('.vc_row'); 7051 safeGap = 0; 7052 } 7053 } 7054 7055 if (typeof getSection === 'undefined' || ! getSection.length ) { 7056 return; 7057 } 7058 7059 var body = $("html, body"), 7060 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 7061 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 7062 getOffset = UNCODE.get_scroll_offset(); 7063 if ( typeof getSection.offset() === 'undefined' ) 7064 return; 7065 scrollTo = getSection.offset().top - safeGap; 7066 scrollTo -= getOffset; 7067 7068 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 7069 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 7070 7071 if (index != 0) { 7072 UNCODE.scrolling = true; 7073 } 7074 7075 if (scrollSpeed == 0) { 7076 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 7077 UNCODE.scrolling = false;
7078 } else { 7079 body.animate({ 7080 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 7081 }, scrollSpeed, 'easeInOutQuad', function() { 7082 requestTimeout(function() { 7083 UNCODE.scrolling = false; 7084 if (getOffset != UNCODE.get_scroll_offset()) { 7085 scrollBody(index); 7086 } 7087 }, 100); 7088 }); 7089 } 7090 7091 }; 7092}; 7093 7094UNCODE.printScreen = function() { 7095 var inlineMediaStyle = null, 7096 setResize; 7097 7098 function changeMediaStyle() { 7099 clearRequestTimeout(setResize); 7100 setResize = requestTimeout(function(){ 7101 var $head = document.getElementsByTagName('head')[0], 7102 $newStyle = document.createElement('style'), 7103 winW = window.innerWidth, 7104 printH = window.innerHeight; 7105 7106 $newStyle.setAttribute('type', 'text/css'); 7107 $newStyle.setAttribute('media', 'print'); 7108 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 7109 7110 if (inlineMediaStyle != null) { 7111 $head.replaceChild($newStyle, inlineMediaStyle) 7112 } else { 7113 $head.appendChild($newStyle); 7114 } 7115 inlineMediaStyle = $newStyle; 7116 }, 1000); 7117 } 7118 7119 changeMediaStyle(); 7120 window.addEventListener('resize', changeMediaStyle); 7121}; 7122 7123UNCODE.fullPage = function() { 7124 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 7125 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 7126 return false; 7127 } else { 7128 requestTimeout(function() { 7129 window.scrollTo(0, 0); 7130 }, 10); 7131 } 7132 7133 var $masthead = $('#masthead'), 7134 $logo = $('#logo-container-mobile'), 7135 $logolink = $('[data-minheight]', $logo), 7136 logoMinScale = $logolink.data('minheight'), 7137 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 7138 $container = $('.main-container .post-content'), 7139 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 7140 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 7141 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 7142 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 7143 headerWithOpacity = $('.header-scroll-opacity', $header).length, 7144 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 7145 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 7146 scrollBar = true, 7147 effect, 7148 animationEndTimeOut, 7149 fp_anim_time = 900, 7150 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 7151 is_scrolling = false, 7152 dataNames = [], 7153 is_first = true, 7154 no_history = $('body').hasClass('uncode-scroll-no-history'), 7155 theres_footer = true; 7156 7157 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 7158 $('> div', $footer).each(function(index, el){ 7159 if ( $(el).outerHeight() < 2 ) 7160 theres_footer = false; 7161 else 7162 theres_footer = true; 7163 }); 7164 } 7165 7166 if ( !$footer.length ) 7167 theres_footer = false; 7168 7169 if ( !UNCODE.isFullPageSnap ) { 7170 7171 if ( $('body').hasClass('uncode-fullpage-zoom') ) 7172 effect = 'scaleDown'; 7173 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 7174 effect = 'moveparallax'; 7175 else 7176 effect = 'movecurtain'; 7177 } 7178 7179 if ( $('body').hasClass('uncode-fullpage-trid') ) 7180 fp_anim_time = fp_anim_time*2; 7181 7182 if ( $header.length ) { 7183 if ( headerName !== '' ) 7184 $header.attr('data-name', headerName); 7185 if ( headerLabel !== '' ) 7186 $header.attr('data-label', headerLabel); 7187 $container.prepend($header); 7188 } 7189 if ( theres_footer ) { 7190 $container.append($footer); 7191 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 7192 $('aside.widget ul', $footer).addClass('no-list'); 7193 } 7194 7195 var $all = $rows.add($header); 7196 7197 if ( theres_footer ) 7198 $all = $all.add($footer); 7199 7200 $all.each(function(index, row) { 7201 if( index === 0 ) 7202 $(row).addClass('uncode-scroll-active'); 7203 }); 7204 7205 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 7206 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 7207 7208 $all.each(function(index, val) { 7209 var getName = $(val).data('name'), 7210 label; 7211 7212 if (typeof getName == 'undefined' || getName == 'undefined') 7213 getName = SiteParameters.slide_name + '-' + index; 7214 7215 //if ( dataNames.includes(getName) ) { 7216 if ( dataNames.indexOf(getName) > 0 ) { 7217 getName += '_' + index; 7218 $(val).data('name', getName); 7219 } 7220 7221 dataNames.push(getName); 7222 7223 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 7224 7225 if (typeof $(val).attr('data-label') !== 'undefined') 7226 label = $(val).attr('data-label'); 7227 else label = ''; 7228 7229 if ( $(val).is($footer) ) 7230 return; 7231 7232 if (label != '' ) { 7233 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 7234 $('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>"); 7235 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 7236 $('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>"); 7237 } 7238 }); 7239 7240 var checkVisible = function( el, off ) { 7241 if (typeof jQuery === "function" && el instanceof jQuery) { 7242 el = el[0]; 7243 } 7244 7245 off = typeof off=='undefined' ? 50 : off; 7246 7247 var rect = el.getBoundingClientRect(); 7248 7249 return ( 7250 ( 7251 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7252 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7253 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7254 ) 7255 ); 7256 }; 7257 7258 var animationEndAction = function( index, nextIndex ) { 7259 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7260 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7261 player, iframe; 7262 7263 if ( !$nextSlide.is($footer) ) { 7264 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7265 } 7266 7267 if ( !UNCODE.isFullPageSnap ) { 7268 activateKBurns( nextIndex ); 7269 } 7270 7271 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7272 if ($(this).attr('data-provider') == 'vimeo') { 7273 iframe = $(this).find('iframe'); 7274 player = new Vimeo.Player(iframe[0]); 7275 player.pause(); 7276 } else if ($(this).attr('data-provider') == 'youtube') { 7277 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7278 } else { 7279 if ($(this).is('video')) { 7280 $(this)[0].volume = 0; 7281 $(this)[0].pause(); 7282 } 7283 } 7284 }); 7285 7286 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7287 if ( $nextSlide.is($header) ) 7288 $header.removeClass('header-scrolled'); 7289 } 7290 7291 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 7292 $otherEl.each(function(){ 7293 var $otherThis = $(this), 7294 $bgwrapperOther = $('.background-inner', $otherThis); 7295 if ( !checkVisible($otherThis) ) 7296 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 7297 7298 }); 7299 7300 if ( !checkVisible($currentSlide) ) { 7301 $currentSlide.removeClass('uncode-scroll-visible'); 7302 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 7303 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7304 currentScroll.scrollTo(0, 0, 0); 7305 } 7306 7307 clearRequestTimeout(animationEndTimeOut); 7308 animationEndTimeOut = requestTimeout(function(){ 7309 Waypoint.refreshAll(); 7310 $( document.body ).trigger('uncode_waypoints'); 7311 var eventFP = new CustomEvent('fp-slide-changed'); 7312 window.dispatchEvent(eventFP); 7313 is_scrolling = false; 7314 7315 if ( is_first ) { 7316 $('ul.onepage-pagination a').removeClass('is-selected'); 7317 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7318 is_first = false; 7319 } 7320 7321 }, 500); 7322 }; 7323 7324 var postLeaveActions = function( nextIndex ){ 7325 if ( menuHidden && ! UNCODE.isMobile ) 7326 return false; 7327 7328 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7329 $cols = $('.uncol', $el), 7330 anchor = $el.data('anchor'); 7331 7332 if ( ! UNCODE.isFullPageSnap ) { 7333 $.each($cols, function(index, val){ 7334 if ( $(val).hasClass('style-light') ){ 7335 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7336 return false; 7337 } else if ( $(val).hasClass('style-dark') ) { 7338 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7339 return false; 7340 } 7341 }); 7342 } 7343 7344 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 7345 $('.menu-item' ).removeClass('active'); 7346 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7347 } 7348 7349 if ( !UNCODE.isFullPageSnap ) { 7350 activateBackWash( nextIndex ); 7351 } 7352 }; 7353 7354 var activateBackWash = function( nextIndex ){ 7355 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7356 $bgwrapper; 7357 7358 if ( $el.length ) { 7359 if ( $el.hasClass('with-zoomout') ) { 7360 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7361 } else if ( $('.with-zoomout', $el).length ) { 7362 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 7363 } else { 7364 return false; 7365 } 7366 } else { 7367 return false; 7368 } 7369 7370 $bgwrapper.addClass('uncode-zoomout'); 7371 7372 }; 7373 7374 var activateKBurns = function( nextIndex ){ 7375 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7376 $bgwrapper; 7377 7378 if ( $el.length ) { 7379 if ( $el.hasClass('with-kburns') ) { 7380 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7381 } else if ( $('.with-kburns', $el).length ) { 7382 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 7383 } else { 7384 return false; 7385 } 7386 } else { 7387 return false; 7388 } 7389 7390 $bgwrapper.addClass('uncode-kburns'); 7391 7392 }; 7393 7394 var activateParallax = function( nextIndex, direction ){ 7395 7396 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7397 $cell = $('.fp-tableCell', $el), 7398 animationEnd = 'webkitAnimationEnd animationend', 7399 cellAnim; 7400 7401 switch( direction ) { 7402 case 'up': 7403 cellAnim = 'moveFromTopInner'; 7404 break; 7405 default: 7406 cellAnim = 'moveFromBottomInner'; 7407 } 7408 7409 $cell.css({ 7410 'animation-name': cellAnim, 7411 'animation-duration': fp_anim_time + 'ms', 7412 'animation-delay': '', 7413 'animation-timing-function': fp_easing, 7414 'animation-fill-mode': 'both', 7415 }).off(animationEnd) 7416 .on(animationEnd, function(event) { 7417 if ( event.originalEvent.animationName === cellAnim ) { 7418 $cell 7419 .css({ 7420 'animation-name': '', 7421 'animation-duration': '', 7422 'animation-delay': '', 7423 'animation-timing-function': '', 7424 'animation-fill-mode': '', 7425 }); 7426 } 7427 }); 7428 }; 7429 7430 var scrollHashes = function(){ 7431 var hash = window.location.hash.replace('#', '').split('/'), 7432 hashInd; 7433 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 7434 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 7435 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 7436 $.fn.fullpage.moveTo(hashInd+1); 7437 } 7438 } else if( hash[0] === '' ) { 7439 $.fn.fullpage.moveTo(1); 7440 } 7441 }; 7442 7443 var hideMenu = function( index, nextIndex ){ 7444 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 7445 return false; 7446 7447 var hMenu = UNCODE.menuHeight, 7448 transTime = hMenu * 2; 7449 7450 if ( index === 1 && nextIndex > 1 ) { 7451 hMenu = hMenu * -1; 7452 } else if ( index !== 1 && nextIndex === 1 ) { 7453 hMenu = 0; 7454 } else { 7455 return false;
7456 } 7457 7458 $masthead.css({ 7459 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7460 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7461 '-webkit-transition': 'transform 0.5s ease-in-out', 7462 'transition': 'transform 0.5s ease-in-out' 7463 }); 7464 }; 7465 7466 var shrinkMenu = function( index, nextIndex ){ 7467 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 7468 return false; 7469 7470 if ( index === 1 && nextIndex > 1 ) { 7471 $logo.addClass('shrinked'); 7472 $('div', $logo).each(function(index, val){ 7473 $(val).css({ 7474 'height': logoMinScale, 7475 'line-height': logoMinScale 7476 }); 7477 if ($(val).hasClass('text-logo')) { 7478 $(val).css({ 7479 'font-size': logoMinScale + 'px' 7480 }); 7481 } 7482 }); 7483 requestTimeout(function() { 7484 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7485 }, 300); 7486 } else if ( index !== 1 && nextIndex === 1 ) { 7487 $logo.removeClass('shrinked'); 7488 $('div', $logo).each(function(index, val){ 7489 $(val).css({ 7490 'height': logoMaxScale, 7491 'line-height': logoMaxScale 7492 }); 7493 if ($(val).hasClass('text-logo')) { 7494 $(val).css({ 7495 'font-size': logoMaxScale + 'px' 7496 }); 7497 } 7498 }); 7499 requestTimeout(function() { 7500 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7501 }, 300); 7502 } else { 7503 return false; 7504 } 7505 7506 }; 7507 7508 var anchorLink = function(){ 7509 7510 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 7511 var $this = $(e.currentTarget), 7512 hash = e.currentTarget.href.split('#'), 7513 current = window.location.href.split('#'), 7514 ind, 7515 currentMenuOpened = UNCODE.menuOpened, 7516 go = false; 7517 7518 var hash_url = hash[0].replace(/\/?$/, '/'), 7519 current_url = current[0].replace(/\/?$/, '/'); 7520 7521 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 7522 hash = '#'+hash[1]; 7523 e.preventDefault(); 7524 go = true; 7525 } 7526 7527 if ( go ) { 7528 7529 if ( $(hash).length ) { 7530 ind = $(hash).closest('.fp-section').index(); 7531 } else { 7532 hash = hash.slice(1); 7533 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 7534 } 7535 7536 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 7537 ind = $this.closest('.fp-section').index(); 7538 7539 UNCODE.menuOpened = false; 7540 7541 $.fn.fullpage.moveTo(ind+1); 7542 7543 UNCODE.menuOpened = currentMenuOpened; 7544 if (UNCODE.menuOpened) { 7545 if (UNCODE.wwidth < UNCODE.mediaQuery) { 7546 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 7547 } else { 7548 $('.mmb-container-overlay .overlay-close').trigger('click'); 7549 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 7550 } 7551 } 7552 7553 } 7554 7555 }); 7556 7557 $('.header-scrolldown').on('click', function(event) { 7558 event.preventDefault(); 7559 var scrollDown = $(this), 7560 ind = scrollDown.closest('.fp-section').index(); 7561 7562 $.fn.fullpage.moveTo(ind+2); 7563 }); 7564 7565 var anchor = $('.fp-section.active').data('anchor'); 7566 7567 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 7568 $('.menu-item').removeClass('active'); 7569 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7570 } 7571 7572 }; 7573 7574 var slideLeave = function( index, nextIndex, direction ) { 7575 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7576 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7577 animationEnd = 'webkitAnimationEnd animationend', 7578 transitionEnd = 'webkitTransitionEnd transitionend', 7579 animOut = effect != 'scaleDown' ? effect + direction : effect, 7580 animIn, 7581 isFooter = false, 7582 isFooterNext = false, 7583 footerH = $footer.outerHeight(), 7584 timeout, 7585 player, iframe, 7586 footerCoeff; 7587 switch( direction ) { 7588 case 'up': 7589 animIn = 'moveFromTop'; 7590 break; 7591 default: 7592 animIn = 'moveFromBottom'; 7593 } 7594 7595 if ( $('body').hasClass('uncode-fullpage-trid') ) { 7596 animOut = animIn + 'trid'; 7597 animIn = animOut + 'In'; 7598 } else if ( UNCODE.isFullPageSnap ) { 7599 animIn = animOut = 'none'; 7600 } 7601 7602 hideMenu(index, nextIndex); 7603 shrinkMenu(index, nextIndex); 7604 7605 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7606 if ($(this).attr('data-provider') == 'vimeo') { 7607 iframe = $(this).find('iframe'); 7608 player = new Vimeo.Player(iframe[0]); 7609 player.pause(); 7610 } else if ($(this).attr('data-provider') == 'youtube') { 7611 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7612 } else { 7613 if ($(this).is('video')) { 7614 $(this)[0].volume = 0; 7615 $(this)[0].pause(); 7616 } 7617 } 7618 }); 7619 7620 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 7621 if ($(this).attr('data-provider') == 'vimeo') { 7622 iframe = $(this).find('iframe'); 7623 iframe.on('load', function(){ 7624 player = new Vimeo.Player(iframe); 7625 player.setVolume(0); 7626 player.play(); 7627 }); 7628 player = new Vimeo.Player(iframe); 7629 player.setVolume(0); 7630 player.play(); 7631 } else if ($(this).attr('data-provider') == 'youtube') { 7632 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 7633 } else { 7634 if ($(this).is('video')) { 7635 $(this)[0].volume = 0; 7636 $(this)[0].play(); 7637 } 7638 } 7639 }); 7640 7641 if ( $currentSlide.is($footer) ) 7642 isFooter = true; 7643 7644 if ( $nextSlide.is($footer) ) 7645 isFooterNext = true; 7646 7647 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7648 if ( $currentSlide.is($header) ) 7649 $header.addClass('header-scrolled'); 7650 } 7651 7652 footerCoeff = footerH; 7653 7654 if ( UNCODE.isFullPageSnap ) { 7655 postLeaveActions( nextIndex ); 7656 activateBackWash( nextIndex ); 7657 activateKBurns( nextIndex ); 7658 requestTimeout(function(){ 7659 animationEndAction( index, nextIndex ); 7660 }, fp_anim_time+150); 7661 } else { 7662 if ( isFooterNext ) { 7663 7664 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 7665 $iscrollWrapper.addClass('no-scrolloverflow'); 7666 7667 $nextSlide 7668 .add($currentSlide) 7669 .addClass('uncode-scroll-front') 7670 .addClass('uncode-scroll-active') 7671 .addClass('uncode-scroll-visible'); 7672 $container.css({ 7673 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7674 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7675 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7676 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7677 }).off(transitionEnd) 7678 .one(transitionEnd, function(){ 7679 animationEndAction( index, nextIndex ); 7680 }); 7681 7682 } else if ( isFooter ) { 7683 7684 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 7685 .add($currentSlide) 7686 .addClass('uncode-scroll-front') 7687 .addClass('uncode-scroll-active') 7688 .addClass('uncode-scroll-visible'); 7689 $container.css({ 7690 '-webkit-transform': 'translate3d(0, 0, 0)', 7691 'transform': 'translate3d(0, 0, 0)', 7692 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7693 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7694 }) 7695 .one(transitionEnd, function(){ 7696 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 7697 clearRequestTimeout(timeout); 7698 timeout = requestTimeout(function(){ 7699 $.fn.fullpage.moveTo(nextIndex); 7700 slideLeave( index-1, nextIndex, 'up' ); 7701 $container.off(transitionEnd); 7702 }, 50); 7703 } 7704 animationEndAction( index, nextIndex ); 7705 }); 7706 7707 } else { 7708 7709 postLeaveActions( nextIndex ); 7710 7711 if ( !$('body').hasClass('uncode-fullpage-trid') ) 7712 activateParallax( nextIndex, direction ); 7713 7714 var $outBg = $('.background-wrapper', $currentSlide); 7715 7716 $nextSlide 7717 .addClass('uncode-scroll-front') 7718 .addClass('uncode-scroll-active') 7719 .addClass('uncode-scroll-visible') 7720 .addClass('uncode-scroll-animating-in') 7721 .css({ 7722 'z-index':4, 7723 'animation-name': animIn, 7724 'animation-duration': fp_anim_time + 'ms', 7725 'animation-delay': '', 7726 'animation-timing-function': fp_easing, 7727 'animation-fill-mode': 'both', 7728 'transition': 'initial', 7729 }).off(animationEnd) 7730 .on(animationEnd, function(event) { 7731 if ( event.originalEvent.animationName === animIn ) { 7732 $(this) 7733 .addClass('uncode-scroll-already') 7734 .removeClass('uncode-scroll-front') 7735 .removeClass('uncode-scroll-animating-in') 7736 .css({ 7737 'animation-name': '', 7738 'animation-duration': '', 7739 'animation-delay': '', 7740 'animation-timing-function': '', 7741 'animation-fill-mode': '', 7742 'transition': 'initial', 7743 }); 7744 7745 $currentSlide 7746 .removeClass('uncode-scroll-active') 7747 .add($outBg) 7748 .css({ 7749 'animation-name': '', 7750 'animation-duration': '', 7751 'animation-delay': '', 7752 'animation-timing-function': '', 7753 'animation-fill-mode': '', 7754 'transition': 'initial', 7755 }); 7756 7757 animationEndAction( index, nextIndex ); 7758 7759 } 7760 7761 if ( nextIndex > 1 ) 7762 $('body').addClass('window-scrolled'); 7763 else 7764 $('body').removeClass('window-scrolled'); 7765 }); 7766 7767 $currentSlide 7768 .addClass('uncode-scroll-animating-out') 7769 .removeClass('uncode-scroll-front') 7770 .css({ 7771 'z-index':'1', 7772 'animation-name': animOut, 7773 'animation-duration': fp_anim_time + 'ms', 7774 'animation-delay': '', 7775 'animation-timing-function': fp_easing, 7776 'animation-fill-mode': 'both', 7777 'transition': 'initial', 7778 'will-change': 'auto' 7779 }).off(animationEnd) 7780 .on(animationEnd, function(event) { 7781 if ( event.originalEvent.animationName === animOut ) { 7782 $currentSlide.removeClass('uncode-scroll-animating-out'); 7783 } 7784 }); 7785 7786 if ( $('body').hasClass('uncode-fp-opacity') ) { 7787 $currentSlide.find('> div').css({ 7788 'animation-name': 'opacityout', 7789 'animation-duration': fp_anim_time + 'ms', 7790 'animation-delay': '', 7791 'animation-timing-function': fp_easing, 7792 'animation-fill-mode': 'both', 7793 'transition': 'initial', 7794 }).off(animationEnd) 7795 .on(animationEnd, function(event) { 7796 if ( event.originalEvent.animationName === 'opacityout' ) { 7797 $(event.currentTarget).css({ 7798 'animation-name': '', 7799 'animation-duration': '', 7800 'animation-delay': '', 7801 'animation-timing-function': '', 7802 'animation-fill-mode': '', 7803 'transition': '', 7804 }); 7805 } 7806 }); 7807 } 7808 } 7809 } 7810 7811 $('.scroll-top').on('click', function(e){ 7812 $.fn.fullpage.moveTo(1); 7813 return false;
7814 }); 7815 7816 }; 7817 7818 var init_fullPage = function(mode){ 7819 7820 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 7821 // scrollBar = false; 7822 // } 7823 7824 var checkFPeffects; 7825 7826 $container.fullpage({ 7827 sectionSelector: '.uncode-scroll-lock', 7828 scrollOverflow: true, 7829 scrollOverflowOptions: { 7830 click: false, 7831 preventDefaultException: { tagName:/.*/ } 7832 }, 7833 navigation: false, 7834 scrollBar: scrollBar, 7835 scrollingSpeed: fp_anim_time, 7836 verticalCentered: true, 7837 anchors: no_history ? false : dataNames, 7838 recordHistory: !no_history, 7839 afterRender: function(){ 7840 $('body').removeClass('fp-waiting'); 7841 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 7842 var $invisible = $(this).addClass('hidden-scroll');//, 7843 }); 7844 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 7845 var $visible = $(this).addClass('uncode-scroll-visible'), 7846 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 7847 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 7848 }); 7849 7850 $('ul.onepage-pagination a').on('click', function(e){ 7851 e.preventDefault(); 7852 var $a = $(this), 7853 toIndex = $a.data('index'); 7854 7855 $.fn.fullpage.moveTo(toIndex+1); 7856 }); 7857 7858 requestTimeout(function(){ 7859 scrollHashes(); 7860 }, 1000); 7861 7862 $(window).on('hashchange', function(e){ 7863 requestTimeout(function(){ 7864 scrollHashes(); 7865 }, 500); 7866 }); 7867 7868 anchorLink(); 7869 7870 if ( $('body').hasClass('uncode-fp-opacity') ) { 7871 $all.each(function(index, row) { 7872 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 7873 classBg; 7874 7875 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 7876 classBg = testmatch[0]; 7877 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 7878 } 7879 }); 7880 } 7881 7882 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 7883 $(window).on('menuOpen gdprOpen', function(){ 7884 $.fn.fullpage.setAutoScrolling(false); 7885 }).on('menuClose gdprClose', function(){ 7886 $.fn.fullpage.setAutoScrolling(true); 7887 }); 7888 } 7889 7890 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 7891 requestTimeout(function(){ 7892 $.fn.fullpage.setAutoScrolling(false); 7893 }, 1000); 7894 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 7895 $.fn.fullpage.setAutoScrolling(true); 7896 }); 7897 7898 if ( !UNCODE.isFullPageSnap ) { 7899 clearRequestTimeout(checkFPeffects); 7900 checkFPeffects = requestTimeout(function(){ 7901 activateBackWash( 1 ); 7902 activateKBurns( 1 ); 7903 }, 100); 7904 } 7905 7906 }, 7907 onLeave: function( index, nextIndex, direction ){ 7908 7909 if ( UNCODE.menuOpened || is_scrolling ) 7910 return false; 7911 7912 is_scrolling = true; 7913 7914 var event = new CustomEvent('fp-slide-leave'); 7915 window.dispatchEvent(event); 7916 7917 slideLeave( index, nextIndex, direction ); 7918 7919 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 7920 if ( direction === 'up' ) { 7921 $.fn.fullpage.moveTo(nextIndex-1); 7922 } else { 7923 $.fn.fullpage.moveTo(nextIndex+1); 7924 } 7925 return false; 7926 } 7927 7928 $('ul.onepage-pagination a').removeClass('is-selected'); 7929 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7930 7931 } 7932 }); 7933 }; 7934 7935 init_fullPage(); 7936 $(window).on('load', function(){ 7937 requestTimeout(function(){ 7938 $.fn.fullpage.reBuild(); 7939 }, 3000); 7940 }); 7941 7942 var addScrollingClass, 7943 removeScrollingClass; 7944 7945 window.addEventListener("fp-slide-scroll", function(){ 7946 addScrollingClass = requestTimeout( function(){ 7947 $('body').addClass('fp-slide-scrolling'); 7948 }, 10 ); 7949 7950 clearRequestTimeout(removeScrollingClass); 7951 removeScrollingClass = requestTimeout( function(){ 7952 $('body').removeClass('fp-slide-scrolling'); 7953 }, 150 ); 7954 7955 Waypoint.refreshAll(); 7956 }, false); 7957 7958 var setFPheight = function(){ 7959 var $body = document.body, 7960 $footer = document.getElementById('colophon'), 7961 $maincontainer = document.querySelector('.main-wrapper'), 7962 $boxcontainer = document.querySelector('.box-container'), 7963 $sections = document.querySelectorAll('.fp-section'), 7964 rect = $maincontainer.getBoundingClientRect(), 7965 rect2 = $boxcontainer.getBoundingClientRect(), 7966 $masthead = document.getElementById('masthead'), 7967 _hideMenu = false, 7968 menuHeight = UNCODE.menuHeight; 7969 $body.style.height = UNCODE.wheight + 'px'; 7970 7971 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 7972 _hideMenu = true; 7973 } 7974 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 7975 menuHeight = 0 7976 } 7977 7978 7979 if ( theres_footer ) 7980 $footer.style.top = (rect.height || rect2.height) + 'px'; 7981 7982 for (var i = 0; i < $sections.length; i++) { 7983 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 7984 } 7985 }; 7986 7987 setFPheight(); 7988 7989 window.addEventListener('resize', setFPheight, false); 7990 window.addEventListener('orientationchange', setFPheight, false); 7991 7992}; 7993 7994UNCODE.particles = function() { 7995 $(".vc-particles-background").each(function() { 7996 var $particle = $(this); 7997 var $parent = $particle.closest('[data-parent]'); 7998
7999 $parent.prepend($particle); 8000 // $(window).trigger('resize'); 8001 }) 8002}; 8003 8004 8005UNCODE.readMoreCol = function( $el ){ 8006 if ( typeof $el === 'undefined' || $el === null ) { 8007 $el = $('body'); 8008 } 8009 var $readMoreCols = $('.uncont.overflow-hidden-mask[data-ov-height]', $el); 8010 $readMoreCols.each(function(){ 8011 var $uncont = $(this), 8012 $row = $uncont.closest('.row-container'), 8013 max_h = $uncont.attr('data-ov-height'), 8014 max_h_mobile = $uncont.attr('data-ov-height-mobile'), 8015 actual_max_h = $uncont.outerHeight(), 8016 inner_h, 8017 $read_more = $('+ .btn-more-wrap', $uncont), 8018 read_more_resize = $read_more.hasClass('trigger-resize'), 8019 marginClosedBtn = $uncont.attr('data-margin-closed'), 8020 marginClosed = 0, 8021 marginOpenBtn = $uncont.attr('data-margin-open'), 8022 marginOpen = 0, 8023 anim_t = 250, 8024 resized = false; 8025 8026 max_h_mobile = typeof max_h_mobile === 'undefined' || max_h_mobile === null ? '' : max_h_mobile; 8027 8028 switch (marginClosedBtn) { 8029 case 'sm': 8030 marginClosed = 18 8031 break; 8032 8033 case 'std': 8034 marginClosed = 36 8035 break; 8036 8037 case 'lg': 8038 marginClosed = 72 8039 break; 8040 8041 case '': 8042 default: 8043 marginClosed = 0 8044 break; 8045 8046 } 8047 8048 switch (marginOpenBtn) { 8049 case 'sm': 8050 marginOpen = 18 8051 break; 8052 8053 case 'std': 8054 marginOpen = 36 8055 break; 8056 8057 case 'lg': 8058 marginOpen = 72 8059 break; 8060 8061 case 'no': 8062 marginOpen = 0 8063 break; 8064 8065 } 8066 8067 var checkToggleMobile = function(){ 8068 if ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) { 8069 resized = true; 8070 if ( $read_more.hasClass('state-closed') ) { 8071 $uncont[0].style.height = ''; 8072 $uncont[0].style.maxHeight = max_h_mobile; 8073 } 8074 } if ( resized === true && UNCODE.wwidth > UNCODE.mediaQuery ) { 8075 if ( $read_more.hasClass('state-closed') ) { 8076 $uncont[0].style.height = ''; 8077 $uncont[0].style.maxHeight = max_h; 8078 } 8079 resized = false; 8080 } 8081 } 8082 checkToggleMobile(); 8083 $(window).on('resize', function() { 8084 checkToggleMobile(); 8085 }); 8086 8087 $('a', $read_more).on('click', function(e){ 8088 e.preventDefault(); 8089 8090 var $a = $(this); 8091 8092 if ( $read_more.hasClass('state-closed') ) { 8093 8094 $read_more 8095 .removeClass('state-closed') 8096 .addClass('state-open'); 8097 8098 $uncont.css({ 8099 'max-height': 'none', 8100 'height': 'auto', 8101 }); 8102 8103 inner_h = parseFloat( $uncont.outerHeight() ); 8104 8105 $uncont.css({ 8106 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8107 }); 8108 8109 anim_t = inner_h - actual_max_h; 8110 if ( anim_t < 250 ) { 8111 anim_t = 250; 8112 } else if ( anim_t > 1000 ) { 8113 anim_t = 1000; 8114 } 8115 8116 $uncont.css({ 8117 'transition-duration' : anim_t + 'ms' 8118 }).addClass('overflow-mask-animation').animate({ 8119 'height': inner_h 8120 }, anim_t, 'easeInOutCubic', function(){ 8121 $uncont.css({ 8122 'height' : 'auto' 8123 }).removeClass('overflow-mask'); 8124 if ( read_more_resize === true ) { 8125 window.dispatchEvent(new Event('resize')); 8126 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8127 ScrollTrigger.refresh(true); 8128 } 8129 } 8130 }); 8131 8132 if ( marginOpen != '' ) { 8133 $read_more.animate({ 8134 'margin-top' : marginOpen 8135 }, anim_t, 'easeInOutCubic'); 8136 } 8137 8138 } else { 8139 $read_more 8140 .removeClass('state-open') 8141 .addClass('state-closed'); 8142 8143 $uncont.addClass('overflow-mask').removeClass('overflow-mask-animation').animate({ 8144 'height': ( UNCODE.wwidth <= UNCODE.mediaQuery && max_h_mobile !== '' ) ? max_h_mobile : max_h 8145 }, anim_t, 'easeInOutCubic', function(){ 8146 if ( read_more_resize === true ) { 8147 window.dispatchEvent(new Event('resize')); 8148 if ( typeof ScrollTrigger !== 'undefined' && ScrollTrigger !== null ) { 8149 ScrollTrigger.refresh(true); 8150 } 8151 } 8152 }); 8153 8154 if ( marginClosed !== '' ) { 8155 $read_more.animate({ 8156 'margin-top' : marginClosed 8157 }, anim_t, 'easeInOutCubic'); 8158 } 8159 8160 if ( $a.hasClass('toggle-scroll') ) { 8161 var $masthead = $('#masthead > div:first-child'), 8162 headH = $masthead.outerHeight(), 8163 rectTop = $row[0].getBoundingClientRect().top, 8164 checkNavBar = $a.hasClass('toggle-navbar'), 8165 checkNavBarMobile = $a.hasClass('toggle-navbar-mobile'), 8166 offCont = ( $row.offset().top ); 8167 8168 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 8169 checkNavBar = checkNavBarMobile; 8170 } 8171 8172 if ( checkNavBar ) { 8173 offCont = offCont - headH; 8174 } 8175 8176 if ( rectTop < headH ) { 8177 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 8178 $(this).stop(); 8179 }).animate({ 8180 scrollTop: offCont 8181 }, anim_t, 'easeInOutCubic'); 8182 } 8183 } 8184 8185 } 8186 }); 8187 }); 8188} 8189UNCODE.filters = function() { 8190 var $systems = $('.isotope-system, .cssgrid-system'); 8191 8192 $systems.each(function(index, val){ 8193 var $system = $(this), 8194 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 8195 $widgets = $('.widgetized-cb-wrapper', $system), 8196 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 8197 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 8198 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 8199 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 8200 8201 if ($system.hasClass('isotope-processed')) { 8202 return; 8203 } 8204 8205 $cats_trigger.on('click', function(e) { 8206 if ( ! $('html').hasClass('screen-sm') ) { 8207 // $widgets.add($sorting_dd).slideUp(400); 8208 e.preventDefault(); 8209 $widgets.slideUp(400, 'easeInOutCirc'); 8210 } 8211 }); 8212 8213 $('.filters-toggle-trigger', $system).on('click', function(e) { 8214 e.preventDefault(); 8215 var $filters = $('.isotope-filters .menu-horizontal', $system); 8216 $filters.slideToggle(400, 'easeInOutCirc');
8217 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8218 }); 8219 8220 $widget_trgr.on('click', function(e) { 8221 e.preventDefault(); 8222 $widgets.slideToggle(400, 'easeInOutCirc'); 8223 if (!$('html').hasClass('screen-sm')) { 8224 $cats_filters.slideUp(400, 'easeInOutCirc'); 8225 } 8226 window.dispatchEvent(new CustomEvent('boxResized')); 8227 }); 8228 8229 $sorting_trgr.on('click', function(e) { 8230 e.preventDefault(); 8231 if (!$('html').hasClass('screen-sm')) { 8232 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 8233 } 8234 }); 8235 8236 $system.addClass('isotope-processed'); 8237 }); 8238 8239}; 8240 8241UNCODE.widgets = function() { 8242 var widget_collapses = $('.widget-collapse'); 8243 8244 widget_collapses.each(function(){ 8245 var widget_collapse = $(this), 8246 widget_title = widget_collapse.find('.widget-title'), 8247 widget = widget_title.closest('.widget'), 8248 content = widget.children().not('.widget-title'), 8249 setCTA; 8250 8251 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 8252 widget_title.toggleClass('open'); 8253 } 8254 8255 widget_title.each(function() { 8256 var _this = $(this); 8257 var content = _this.closest('.widget').find('.widget-collapse-content'); 8258 8259 $(window).on('load resize', function(){ 8260 clearRequestTimeout(setCTA); 8261 setCTA = requestTimeout( function() { 8262 if ( content.is(':visible') ) { 8263 _this.addClass( 'open' ); 8264 } else { 8265 _this.removeClass( 'open' ); 8266 } 8267 }, 10 ); 8268 }) 8269 8270 _this.on( 'click', function(){ 8271 8272 // Get content of :after element (+ icon) to check the visibility 8273 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 8274 8275 if (icon_content === 'none' || !icon_content) { 8276 return false; 8277 } 8278 8279 _this.toggleClass('open'); 8280 var isOpen = _this.hasClass('open'), 8281 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 8282 content.animate({ 8283 height: 'toggle', 8284 padding: 'toggle', 8285 opacity: 'toggle', 8286 top: isOpen ? 0 : hasBorder 8287 }, { 8288 duration: 400, 8289 easing: "easeInOutCirc", 8290 }); 8291 8292 return false; 8293 8294 }); 8295 }); 8296 }); 8297 8298 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 8299}; 8300 8301UNCODE.unmodal = function() { 8302 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 8303 $('.unmodal-overlay').fadeIn(); 8304 $('.unmodal-overlay').addClass('loading'); 8305 $('body').addClass('uncode-unmodal-overlay-visible'); 8306 $(window).trigger('unmodal-open'); 8307 }); 8308 8309 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 8310 $('.unmodal-overlay').fadeOut(); 8311 $('.unmodal').fadeOut(); 8312 $('body').removeClass('uncode-unmodal-overlay-visible'); 8313 $('body').removeClass('uncode-unmodal-open'); 8314 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 8315 $(document).trigger('unmodal-close'); 8316 UNCODE.isUnmodalOpen = false; 8317 }); 8318 8319 $(document).on('uncode-unmodal-show-content', function() { 8320 $('.unmodal-overlay').removeClass('loading'); 8321 $('.unmodal').show(); 8322 $('.unmodal').addClass('show-unmodal-with-animation'); 8323 $('.unmodal-content')[0].scrollTop = 0; 8324 $('body').addClass('uncode-unmodal-open'); 8325 UNCODE.isUnmodalOpen = true; 8326 8327 if ($('body').hasClass('qw-body-scroll-disabled')) { 8328 $('html').addClass('uncode-unmodal-body-disable-scroll'); 8329 } 8330 8331 if ($('.unmodal').hasClass('auto-height')) { 8332 set_modal_height(); 8333 } 8334 }); 8335 8336 var set_modal_height = function() { 8337 var modal = $('.unmodal'); 8338 var window_height = $(window).outerHeight(); 8339 var modal_height = modal.outerHeight(); 8340 8341 modal.css('height', 'auto'); 8342 8343 if (modal_height > window_height) { 8344 modal.outerHeight(window_height); 8345 } 8346 } 8347 8348 if ($('.unmodal').hasClass('auto-height')) { 8349 var setCTA; 8350 8351 $(window).on('resize', function() { 8352 clearRequestTimeout(setCTA); 8353 setCTA = requestTimeout(function() { 8354 set_modal_height(); 8355 }, 100); 8356 }); 8357 } 8358}; 8359 8360UNCODE.bgChanger = function() { 8361 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 8362 $bg_first = $('.vc_row[data-bg-remove]'), 8363 bg_remove = $bg_first.attr('data-bg-remove'), 8364 $first = $bg_changers.first(), 8365 $last = $bg_changers.last(), 8366 $bg_wrapper = $('#changer-back-color'), 8367 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 8368 setCTA, localH = UNCODE.wheight, 8369 isScrolling; 8370 8371 $bg_first.removeClass(bg_remove); 8372 8373 var bgChange = function($col, bgColor, skin, tmbskin){ 8374 $bg_wrapper.attr( 'class', bgColor ); 8375 var menuskin; 8376 if ( typeof skin !== 'undefined' ) { 8377 menuskin = skin.replace('style', 'menu') 8378 } 8379 8380 if ( $col.length ) { 8381 $('.uncol[data-skin-change]').each(function(){ 8382 var $isoFooter = $('.isotope-footer', this); 8383 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 8384 if ( menuskin !== '' ) {
8385 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 8386 } 8387 }); 8388 8389 $('.tmb[data-skin-change]').each(function(){ 8390 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 8391 }); 8392 } 8393 }; 8394 8395 var $masthead = $('#masthead'), 8396 transDesktop, 8397 transMobile, 8398 changeSkin, 8399 8400 checkTransparencyAndChange = function( skin ){ 8401 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 8402 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 8403 changeSkin = $masthead.hasClass('menu-change-skin'); 8404 8405 if ( ! transDesktop && ! transMobile ) { 8406 return false; 8407 } 8408 8409 if ( ! changeSkin ) { 8410 return false; 8411 } 8412 8413 if ( skin === 'style-light' ){ 8414 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 8415 return false; 8416 } else if ( skin === 'style-dark' ) { 8417 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 8418 return false; 8419 } 8420 }; 8421 8422 var bg_waypoints = function(){ 8423 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 8424 8425 $.each($bg_changers, function(index, row) { 8426 8427 var $row = $(row), 8428 $col = $('.uncol[data-skin-change]', $row).eq(0), 8429 skin, 8430 $tmbs, 8431 tmbskin, 8432 bgColor = $row.attr('data-bg-color'); 8433 8434 if ( ! $row.is(':visible') ) { 8435 return false; 8436 } 8437 8438 if ( $col.length ) { 8439 skin = $col.attr('data-skin-change'); 8440 $tmbs = $('.tmb[data-skin-change]', $row); 8441 tmbskin = skin.replace('style', 'tmb'); 8442 } 8443 8444 if ( ! $row.hasClass('unscroll-horizontal') ) { 8445 $row.waypoint(function( dir ) { 8446 if ( dir === 'down' ) { 8447 bgChange($col, bgColor, skin, tmbskin); 8448 checkTransparencyAndChange(skin); 8449 } else { 8450 return; 8451 } 8452 }, {
8453 offset: '50%' 8454 }); 8455 8456 $row.waypoint(function( dir ) { 8457 if ( dir === 'up' ) { 8458 bgChange($col, bgColor, skin, tmbskin); 8459 checkTransparencyAndChange(skin); 8460 } else { 8461 return; 8462 } 8463 }, { 8464 offset: function() { 8465 var clH = this.element.clientHeight, 8466 wH = window.innerHeight, 8467 ret = clH > 200 ? -100 : clH * -0.5; 8468 return ( wH / 2 ) - clH; 8469 } 8470 }); 8471 } 8472 8473 }); 8474 8475 $('body').addClass('bg-changer-init'); 8476 8477 } 8478 }; 8479 8480 var body = document.body, 8481 edges = false; 8482 8483 var throttle = function(fn, wait) { 8484 var time = Date.now(); 8485 return function() { 8486 if ((time + wait - Date.now()) < 0) { 8487 fn(); 8488 time = Date.now(); 8489 } 8490 } 8491 } 8492 8493 var $wrapper = document.querySelector(".main-wrapper"), 8494 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 8495 8496 var $title = document.querySelector('#rotating'); 8497 if ( $title !== null ) { 8498 $title.style.whiteSpace = 'nowrap'; 8499 $title.style.transition = 'transform 200ms linear'; 8500 } 8501 8502 window.addEventListener( 'scroll', throttle( function() { 8503 window.clearRequestTimeout( isScrolling ); 8504 8505 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 8506 8507 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 8508 body = document.body, 8509 html = document.documentElement, 8510 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8511 $row = false, 8512 firstOff, 8513 lastOff; 8514 8515 if ( scrolled < 100 && $first.length ) { 8516 firstOff = $first.offset().top; 8517 if ( firstOff < 100 ) { 8518 var $row = $first; 8519 } 8520 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 8521 lastOff = $last.offset().top + $last.outerHeight(); 8522 if ( lastOff > ( docH - 100 ) ) { 8523 var $row = $last; 8524 } 8525 } 8526 8527 if ( $row.length ) { 8528 var $col = $('.uncol[data-skin-change]', $row).eq(0), 8529 skin, 8530 $tmbs, 8531 tmbskin, 8532 bgColor = $row.attr('data-bg-color'); 8533 8534 if ( $col.length ) { 8535 skin = $col.attr('data-skin-change'); 8536 $tmbs = $('.tmb[data-skin-change]', $row); 8537 tmbskin = skin.replace('style', 'tmb'); 8538 } 8539 8540 bgChange($col, bgColor, skin, tmbskin); 8541 checkTransparencyAndChange(skin); 8542 edges = true; 8543 } 8544 8545 }, 150); 8546 8547 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 8548 bg_waypoints(); 8549 Waypoint.refreshAll(); 8550 edges = false; 8551 } 8552 8553 }, 100), false); 8554 8555 $(window).on('resize', function() { 8556 clearRequestTimeout(setCTA); 8557 setCTA = requestTimeout(function() { 8558 if ( localH != UNCODE.wheight ) { 8559 localH = UNCODE.wheight; 8560 bg_waypoints(); 8561 Waypoint.refreshAll(); 8562 } 8563 }, 100); 8564 }); 8565 8566 bg_waypoints(); 8567 8568}; 8569 8570UNCODE.skewIt = function() { 8571 8572 if ( $('body').hasClass('compose-mode') ) { 8573 return; 8574 } 8575 8576 var justscrolled = false; 8577 8578 var loadSkewIt = function(){ 8579 8580 var $pageHeader = $('#page-header'), 8581 $page_body = $('.page-body'), 8582 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 8583 8584 if ( $header_skew.length ) { 8585 $pageHeader.addClass('uncode-skew').css({ 8586 position: 'relative', 8587 zIndex: 1 8588 }); 8589 $header_skew.removeClass('uncode-skew'); 8590 $page_body.css({ 8591 position: 'relative', 8592 zIndex: 0 8593 }); 8594 } 8595 8596 var $skew = $('.uncode-skew'), 8597 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 8598 horizontal = $horizontal.length, 8599 stopSkewing, 8600 lastOffset = 0, 8601 lastDate = Date.now(); 8602 8603 if ( ! $skew.length ) { 8604 return; 8605 } 8606 8607 var dropSkew = function(){ 8608 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 8609 return; 8610 8611 $skew.each(function(){ 8612 var $this = $(this), 8613 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8614 8615 if ( $drop.length ) { 8616 $this.css({ 8617 'transform': 'skew(0)' 8618 }); 8619 var bound = $this[0].getBoundingClientRect(); 8620 $drop.css({ 8621 left: bound.x * -1, 8622 top: bound.y * -1, 8623 }); 8624 } 8625 }); 8626 }; 8627 dropSkew(); 8628 8629 $(window).on('resize', dropSkew); 8630 8631 window.addEventListener( 'scroll', function() { 8632 8633 if ( justscrolled !== true ) { 8634 justscrolled = true; 8635 return; 8636 } 8637 8638 window.clearRequestTimeout( stopSkewing ); 8639 8640 var now = Date.now(), 8641 delayInMs = now - lastDate, 8642 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8643 newOffset = offset - lastOffset, 8644 speed = Math.pow((newOffset / delayInMs), 3) * -1, 8645 body = document.body, 8646 html = document.documentElement, 8647 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8648 wait = 50, 8649 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 8650 8651 if ((lastDate + wait - now) < 0) { 8652 8653 lastDate = now; 8654 lastOffset = offset; 8655 8656 if ( speed > 6 ) { 8657 speed = 6; 8658 } else if ( speed < -6 ) { 8659 speed = -6; 8660 } 8661 8662 if ( speed > 2 && offset < UNCODE.wheight ) { 8663 speed = 2; 8664 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 8665 speed = -2; 8666 } 8667 8668 var speedY = speed, 8669 speedX = speed * 1.25; 8670 8671 if ( horizontal ) { 8672 speedY = 0; 8673 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 8674 speedX = 0; 8675 return; 8676 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 8677 speedX = 0; 8678 return; 8679 } 8680 } else { 8681 speedX = 0; 8682 } 8683 8684 if ( ! $skew.closest('.enter-st').length ) { 8685 speedX = 0; 8686 } 8687 8688 gsap.killTweensOf($skew); 8689 gsap.to( $skew, { 8690 duration: 0.2, 8691 skewY: (speedY * maxSpeed) + "deg", 8692 skewX: (speedX * maxSpeed) + "deg", 8693 ease: Power0.easeNone, 8694 transformOrigin: 'center', 8695 }); 8696 8697 } 8698 8699 stopSkewing = requestTimeout(function() { 8700 gsap.killTweensOf($skew); 8701 gsap.to( $skew, { 8702 duration: 0.5, 8703 skewY: "0deg", 8704 skewX: "0deg", 8705 transformOrigin: 'center', 8706 ease: Expo.easeOut, 8707 }); 8708 8709 $skew.each(function(){ 8710 var $this = $(this), 8711 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8712 8713 if ( $drop.length ) { 8714 var bound = $this[0].getBoundingClientRect() 8715 $drop.css({ 8716 left: bound.x * -1, 8717 top: bound.y * -1, 8718 }); 8719 } 8720 }); 8721 8722 }, 200); 8723 8724 }, false); 8725 8726 }; 8727 8728 $(window).on('load', loadSkewIt); 8729 8730}; 8731 8732UNCODE.rotateIt = function() { 8733 8734 if ( $('body').hasClass('compose-mode') ) { 8735 return; 8736 } 8737 8738 var frameRotate = false;
8739 var loadRotateIt = function(){ 8740 8741 var $toRotate = $('.uncode-rotate'); 8742 8743 $toRotate.each(function(){ 8744 var $rotate = $(this), 8745 deg = 0, 8746 dir = true, 8747 coeff = 1, 8748 lastOffset = 0, 8749 lastDate = Date.now(); 8750 8751 var checkScroll = function($rotate){ 8752 // if ( ! $rotate.length ) { 8753 // return; 8754 // } 8755 8756 var now = Date.now(), 8757 delayInMs = now - lastDate, 8758 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8759 newOffset = offset - lastOffset, 8760 speed = (newOffset / delayInMs) * 5, 8761 body = document.body, 8762 html = document.documentElement, 8763 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 8764 8765 lastDate = now; 8766 lastOffset = offset; 8767 8768 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 8769 deg = 0; 8770 } 8771 8772 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 8773 deg = parseFloat(deg) + parseFloat(speed); 8774 } 8775 8776 if ( $rotate.hasClass('uncode-rotate-hover') ) { 8777 $rotate.hover(function(){ 8778 coeff = 1.75; 8779 }, function(){ 8780 coeff = 1; 8781 }); 8782 } 8783 8784 // if ( speed > 0 ) { 8785 // dir = true 8786 // } else if ( speed < 0 ) { 8787 // dir = false 8788 // } 8789 8790 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 8791 deg = deg+coeff; 8792 // if ( dir ) { 8793 // deg = deg+coeff; 8794 // } else { 8795 // deg = deg-coeff; 8796 // } 8797 } 8798 8799 if ( $rotate.closest('.un-text-marquee').length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 8800 return false; 8801 } 8802 8803 if ( $rotate.closest('.un-text-marquee').length && ! $rotate.closest('.un-marquee-scroll, .un-marquee-opposite').length ) { 8804 var undeg = deg*-1; 8805 $rotate[0].style.transform = 'rotate(' + undeg + 'deg)'; 8806 } else { 8807 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 8808 } 8809 8810 requestAnimationFrame(function() { 8811 if ( frameRotate === true ) { 8812 frameRotate = false; 8813 return; 8814 } 8815 checkScroll($rotate); 8816 }); 8817 }; 8818 8819 checkScroll($rotate); 8820 8821 }); 8822 8823 }; 8824 8825 $(window).on('load', loadRotateIt); 8826 8827 var checkRotate; 8828 var resizeRotate = function(){ 8829 var $inlineRotates = $('.inline-rotate'); 8830 $inlineRotates.each(function(){ 8831 $(this).addClass('inline-rotate-standby'); 8832 }); 8833 clearTimeout(checkRotate); 8834 checkRotate = setTimeout(function(){ 8835 $('.inline-rotate').each(function(){ 8836 $(this).removeClass('inline-rotate-standby'); 8837 frameRotate = true; 8838 }); 8839 loadRotateIt(); 8840 }, 500); 8841 }; 8842 8843 $(window).off('resize.inline-rotate', resizeRotate) 8844 .on('resize.inline-rotate', resizeRotate); 8845 8846}; 8847 8848var marqueeAttempts = 0, 8849 marqueeTO, 8850 marqueeCheckResize; 8851 8852UNCODE.textMarquee = function( $titles ) { 8853 8854 var initTextMarquee = function( $titles ){ 8855 8856 if ( typeof $titles == 'undefined' ) { 8857 $titles = $('.un-text-marquee'); 8858 } 8859 8860 if ( ! $titles.length ) { 8861 return; 8862 } 8863 8864 $titles.each(function(){ 8865 var $title = $(this), 8866 $span = $('> span, > i > span', $title), 8867 txt, 8868 first = true, 8869 dataSpeed = parseFloat( $title.closest('.heading-text').attr('data-marquee-speed') ), 8870 dataSpace = parseFloat( $title.closest('.heading-text').attr('data-marquee-space') ), 8871 dataTrigger = $title.closest('.heading-text').attr('data-marquee-trigger'), 8872 dataNavBar = $title.closest('.heading-text').attr('data-marquee-navbar'), 8873 dataNavBarMobile = $title.closest('.heading-text').attr('data-marquee-navbar-mobile'), 8874 newW = UNCODE.wwidth, 8875 marqueeTL, inview; 8876 8877 if ( $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ) { 8878 dataTrigger = 'row'; 8879 } 8880 8881 if ( UNCODE.wwidth <= UNCODE.mediaQuery ) { 8882 dataNavBar = dataNavBarMobile; 8883 } 8884 8885 dataSpeed = isNaN(dataSpeed) ? 0 : dataSpeed; 8886 dataSpace = isNaN(dataSpace) ? 'default' : dataSpace; 8887 var dataX = dataSpeed; 8888 8889 if ( dataSpeed < 0 ) { 8890 dataSpeed -= 1; 8891 } else if ( dataSpeed > 0 ) { 8892 dataSpeed += 1; 8893 } 8894 8895 if ( dataSpeed <= 0 ) { 8896 dataSpeed = (dataSpeed * 10); 8897 } else { 8898 dataSpeed = ( dataSpeed * 2 ) - 1; 8899 } 8900 8901 $('.marquee-clone-wrap', $title).remove(); 8902 8903 txt = $span.html(); 8904 8905 if ( ! $('.marquee-original-core', $span).length ) { 8906 txt = $span.html(); 8907 $span = $('> span, > i > span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 8908 } else { 8909 txt = $('.marquee-original-core', $span).html(); 8910 } 8911 8912 var spanW, 8913 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 8914 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 8915 speed = 10 - dataSpeed; 8916 8917 $span.prepend($prepended); 8918 $span.append($appended); 8919 8920 var continuousTextMarquee = function(){ 8921 var bound = $title.css({ 8922 'transform': 'none', 8923 'opacity': 0 8924 }).offset(), 8925 ease = 'none'; 8926 8927 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 8928 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 8929 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 8930 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 8931 8932 marqueeTL = new TimelineMax({paused:true, reversed:true}); 8933 8934 var inViewElement = (dataTrigger === 'row') ? $title.closest('.vc_row')[0] : $title[0], 8935 wayOff = dataTrigger === 'row' && dataNavBar === 'yes' ? UNCODE.menuHeight : 0; 8936 8937 inview = new Waypoint.Inview({ 8938 element: inViewElement, 8939 offset: wayOff, 8940 enter: function(direction) { 8941 marqueeTL.play(); 8942 }, 8943 exited: function(direction) { 8944 if ( ! $title.closest('.pin-spacer').length ) { 8945 marqueeTL.pause(); 8946 } 8947 }, 8948 }); 8949 8950 if ( $title.hasClass('un-marquee-hover') ) { 8951 var $column = $title.closest('.wpb_column'), 8952 $col_link = $('.col-link', $column), 8953 $hover_sel = $title; 8954 8955 if ( $col_link.length ) { 8956 $hover_sel = $title.add($column); 8957 } 8958 $hover_sel.on('mouseover', function(){ 8959 speed = ( 10 - dataSpeed ) * 5; 8960 ease = 'power2.out'; 8961 marqueeTL.duration( xSpeed / UNCODE.wwidth * speed ); 8962 }).on('mouseout', function(){ 8963 speed = ( 10 - dataSpeed ); 8964 ease = 'power2.in'; 8965 marqueeTL.duration( xSpeed / UNCODE.wwidth * speed ); 8966 }); 8967 } 8968 8969 gsap.killTweensOf($title);
8970 marqueeTL.fromTo( $title, { 8971 opacity: 1, 8972 x: xStrt * direction * -1 8973 }, 8974 { 8975 duration: xSpeed / UNCODE.wwidth * speed, 8976 x: xEnd * direction, 8977 onComplete: function(){ 8978 first = false; 8979 continuousTextMarquee(); 8980 }, 8981 ease: ease 8982 }); 8983 8984 }; 8985 8986 var runTextMarquee = function(){ 8987 var time = Date.now(); 8988 8989 var textMarqueeScroll = function(){ 8990 var $row = $title.closest('.vc_row'), 8991 $bound = (dataTrigger === 'row' || dataTrigger === 'row-middle') ? $row : $title; 8992 8993 if ( !$bound.length ) { 8994 return; 8995 } 8996 8997 var bound = $bound[0].getBoundingClientRect(), 8998 wait = 100, 8999 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1, 9000 dataMove = dataX >= 0 ? 1 + dataX : -1 * ( 5 / (dataX - 0.5) * 0.25); 9001 9002 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 9003 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 9004 marqueeAttempts < 2 ) { 9005 9006 clearRequestTimeout(marqueeTO); 9007 9008 marqueeTO = requestTimeout(function(){ 9009 marqueeAttempts++; 9010 initTextMarquee(); 9011 }, 100); 9012 } 9013 9014 9015 var bound_top = bound.top, 9016 gsap_calc = ( ( UNCODE.wheight * 0.35 - bound_top ) * dataMove ) * 0.5 * direction; 9017 9018 if ( dataTrigger === 'row' || dataTrigger === 'row-middle' ) { 9019 if ( dataTrigger === 'row-middle' ) { 9020 bound_top = (bound.top + bound.height*0.5) - (UNCODE.wheight * 0.5) 9021 } 9022 if ( dataNavBar === 'yes' ) { 9023 bound_top = bound_top - UNCODE.menuHeight; 9024 } 9025 gsap_calc = ( bound_top * dataMove ) * 0.5 * direction; 9026 } 9027 9028 gsap.killTweensOf($title); 9029 gsap.to( $title, { 9030 duration: 0.24, 9031 x: gsap_calc, 9032 }); 9033 }; 9034 9035 textMarqueeScroll(); 9036 $(window).on( 'load scroll', function(e) { 9037 textMarqueeScroll(); 9038 }); 9039 9040 }; 9041 9042 var cloneSpan = function($_title, cntnt){ 9043 9044 if ( $_title.hasClass('un-marquee-infinite') ) { 9045 $('> span.marquee-clone-wrap', $_title).text(''); 9046 } 9047 9048 gsap.to( $_title, { 9049 duration: 0, 9050 x: 0 9051 }); 9052 spanW = $span.outerWidth(); 9053 9054 if ( !spanW ) { 9055 return; 9056 } 9057 9058 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2, 9059 spaceSpan = dataSpace !== 'default' ? '<span class="marquee-space-' + dataSpace + '">\u00A0</span>' : "\u00A0"; 9060 9061 if ( $_title.hasClass('un-marquee-infinite') ) { 9062 9063 for ( var i = 0; i < part; i++ ) { 9064 $prepended.append(cntnt + spaceSpan); 9065 $appended.append(cntnt + spaceSpan); 9066 } 9067 } 9068 9069 if ( $('body').hasClass('compose-mode') ) { 9070 $('.uncode_fe_safe').remove(); 9071 return; 9072 } 9073 9074 if ( $title.closest('.marquee-freezed').length ) { 9075 return; 9076 } 9077 9078 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 9079 continuousTextMarquee(); 9080 } 9081 9082 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 9083 runTextMarquee(); 9084 } 9085 9086 }; 9087 9088 var marqueeResize = function(e){ 9089 clearRequestTimeout(marqueeCheckResize); 9090 marqueeCheckResize = requestTimeout(function(){ 9091 if ( newW !== UNCODE.wwidth ) { 9092 gsap.killTweensOf($title); 9093 if ( typeof inview !== 'undefined' && inview !== null ) { 9094 inview.destroy(); 9095 } 9096 if ( typeof marqueeTL !== 'undefined' && marqueeTL !== null ) { 9097 marqueeTL.kill(); 9098 } 9099 first = true; 9100 initTextMarquee(); 9101 newW = UNCODE.wwidth; 9102 } 9103 }, 1000); 9104 }; 9105 9106 $(window).off('resize uncode.re-layout', marqueeResize) 9107 .on( 'resize uncode.re-layout', marqueeResize); 9108 9109 cloneSpan($title, txt); 9110 9111 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9112 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 9113 var $_titles = $('.un-text-marquee',e.view.$el); 9114 clearRequestTimeout(marqueeCheckResize); 9115 marqueeCheckResize = requestTimeout(function(){ 9116 initTextMarquee($_titles); 9117 }, 1000); 9118 }); 9119 } 9120 }); 9121 }; 9122 9123 $(document).ready(function(){ 9124 initTextMarquee(); 9125 }); 9126 9127 $(window).on('focus',function(){ 9128 setTimeout(function(){ 9129 initTextMarquee(); 9130 },500); 9131 }); 9132 9133 $(document).on('pumAfterOpen pumAfterClose', function(args){ 9134 initTextMarquee(); 9135 }); 9136 9137}; 9138 9139UNCODE.parallax = function() { 9140 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 9141 if ($('.parallax-el').length > 0) { 9142 var parallax_elements = new Rellax('.parallax-el'); 9143 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 9144 window.addEventListener('boxResized', function(e) { 9145 parallax_elements.refresh(); 9146 }, false); 9147 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 9148 requestTimeout(function() { 9149 parallax_elements.refresh(); 9150 }, 100); 9151 }); 9152 9153 } 9154 } 9155}; 9156 9157UNCODE.magicCursor = function(){ 9158 var $customCursor = $('#uncode-custom-cursor'), 9159 $customPilot = $('#uncode-custom-cursor-pilot'), 9160 $tooltip = $('.title-tooltip', $customCursor),
9161 $cursorSpan = $('> span', $tooltip), 9162 currentBg = false, 9163 fromTitle = false, 9164 setTime, 9165 mouseEvent; 9166 9167 var spanW, spanH, 9168 maxW = false; 9169 9170 function delayChangeCursor(cursorType, cursorTitle, cursorBg, delayt_time, dataTitle, fontClass){ 9171 if ( currentBg !== false && cursorBg === false && cursorType === 'auto' ) { 9172 $tooltip.css({opacity: 0}); 9173 delayt_time += 400; 9174 } 9175 clearRequestTimeout(setTime); 9176 setTime = requestTimeout(function() { 9177 9178 $tooltip.css({opacity: ''}); 9179 9180 $customCursor.find('> span:first-child').add($tooltip).removeClass('tooltip-boing'); 9181 9182 if ( cursorTitle !== '' ) { 9183 if ( fromTitle && dataTitle === 'boing' ) { 9184 setTimeout(function(){ 9185 $customCursor.find('> span:first-child').add($tooltip).addClass('tooltip-boing'); 9186 }, 5); 9187 } 9188 $cursorSpan.attr('class', fontClass).html( cursorTitle ); 9189 } else { 9190 if ( cursorType !== 'auto' ) { 9191 $cursorSpan.html(''); 9192 } 9193 } 9194 9195 $cursorSpan.addClass('in-tooltip'); 9196 9197 $customCursor.attr('data-cursor', cursorType); 9198 9199 if ( fromTitle ) { 9200 $customCursor.addClass('from-tooltip-title'); 9201 } else { 9202 $customCursor.removeClass('from-tooltip-title'); 9203 } 9204 9205 if ( cursorBg !== false ) { 9206 $customCursor.attr('data-bg', 'transparent'); 9207 } else { 9208 $customCursor.removeAttr('data-bg'); 9209 } 9210 9211 currentBg = cursorBg; 9212 9213 if ( cursorTitle !== '' ) { 9214 fromTitle = true; 9215 $customCursor.attr('data-cursor', cursorType); 9216 $customCursor.attr('data-title', 'true'); 9217 $cursorSpan.css({width: ''}); 9218 } else { 9219 fromTitle = false; 9220 $customCursor.removeAttr('data-title'); 9221 } 9222 spanW = $cursorSpan.outerWidth(); 9223 9224 if ( spanW >= maxW && maxW !== false ) { 9225 $customCursor.find('> span:first-child').add($tooltip).addClass('max-width'); 9226 $customCursor.find('> span:first-child').add($tooltip).add($cursorSpan).css({ 9227 width: maxW 9228 }); 9229 spanW = maxW; 9230 } else { 9231 $customCursor.find('> span:first-child').removeClass('max-width'); 9232 } 9233 spanH = $cursorSpan.outerHeight(); 9234 if ( spanW && spanH && cursorTitle !== '' && cursorType.indexOf('icon-') >= 0 ) { 9235 $customCursor.find('> span:first-child').add($tooltip).css({ 9236 width: spanW, 9237 height: spanH 9238 }); 9239 } else { 9240 $customCursor.find('> span:first-child').add($tooltip).removeAttr("style"); 9241 } 9242 if ( $customPilot.length ) { 9243 $customPilot.attr('data-cursor', cursorType); 9244 } 9245 }, delayt_time); 9246 } 9247 9248 function changeCursor($wrap){ 9249 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 9250 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 9251 $href = $wrap.find(href), 9252 cursorType, 9253 cursorTitle = '', 9254 tooltip_class = '', 9255 cursorBg = false; 9256 9257 $href.filter(':not(.cursor-init)').on('mouseenter.cursor',function(e) { 9258 var $this = $(this).addClass('cursor-init'), 9259 $tmb = $this.closest('.tmb'), 9260 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 9261 cursor_bg = $this.closest('[data-cursor]').attr('data-cursor-transparent') || $this.attr('data-cursor-transparent'), 9262 data_title = $this.closest('[data-cursor]').attr('data-cursor-title') || $this.attr('data-cursor-title'), 9263 data_class = $this.closest('[data-cursor]').attr('data-tooltip-class') || $this.attr('data-tooltip-class'), 9264 custom_text = ($this.closest('[data-cursor]').attr('data-tooltip-text') || $this.attr('data-tooltip-text')), 9265 $title = $('.t-entry-title', $tmb), 9266 is_frontend_editor = $this.closest('.vc_controls').length, 9267 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 9268 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 9269 9270 if ( is_frontend_editor ) { 9271 cursorType = 'auto'; 9272 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 9273 cursorType = data_cursor; 9274 } else if ( $parent_cursor.length ) { 9275 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 9276 cursorType = 'icon-light'; 9277 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 9278 cursorType = 'icon-diff'; 9279 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 9280 cursorType = 'icon-accent'; 9281 } else { 9282 cursorType = 'icon-dark'; 9283 } 9284 } else { 9285 cursorType = 'pointer'; 9286 } 9287 9288 if ( typeof data_title !== 'undefined' && data_title !== '' ) { 9289 if ( typeof custom_text !== 'undefined' && custom_text !== '' ) { 9290 cursorTitle = custom_text; 9291 } else { 9292 cursorTitle = $title.clone(); 9293 $('a', cursorTitle).replaceWith(function() { 9294 return this.childNodes; 9295 }); 9296 $('*', cursorTitle).replaceWith(function(){ 9297 return $(this).removeAttr('class'); 9298 });
9299 cursorTitle = cursorTitle.html(); 9300 } 9301 } else { 9302 cursorTitle = ''; 9303 } 9304 9305 if ( typeof data_class !== 'undefined' && data_class !== '' ) { 9306 tooltip_class = data_class; 9307 } else { 9308 tooltip_class = ''; 9309 } 9310 9311 if ( cursor_bg == 'true' ) { 9312 cursorBg = true; 9313 } else { 9314 cursorBg = false; 9315 } 9316 9317 delayChangeCursor(cursorType, cursorTitle, cursorBg, 0, data_title, tooltip_class); 9318 }).on('mouseleave.cursor', function(){ 9319 var outTime = 150; 9320 if ( currentBg !== false && cursorBg === false ) { 9321 outTime = 0; 9322 } 9323 delayChangeCursor('auto', '', false, outTime, false, ''); 9324 }); 9325 9326 $(window).on('disable-hover', function(event) { 9327 document.addEventListener("mousemove", function(e) { 9328 mouseEvent = e; 9329 }); 9330 delayChangeCursor('auto', cursorTitle, cursorBg, 0, false, ''); 9331 }); 9332 9333 $(window).on('enable-hover', function(event) { 9334 if ( typeof mouseEvent !== 'undefined' ) { 9335 var x = mouseEvent.clientX, 9336 y = mouseEvent.clientY; 9337 9338 var elements = document.elementsFromPoint(x, y), 9339 $element = $(elements[0]); 9340 9341 $element.closest(href).trigger('mouseenter'); 9342 } 9343 }); 9344 9345 } 9346 9347 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 9348 changeCursor(); 9349 }); 9350 9351 $(document).ajaxComplete(function( event, xhr, settings ) { 9352 changeCursor(); 9353 }); 9354 9355 $('.isotope-container').on('isotope-layout-complete', function() { 9356 var $this = $(this); 9357 changeCursor($this); 9358 }); 9359 9360}; 9361 9362UNCODE.magneticCursor = function(){ 9363 function magneticCursor($wrap){ 9364 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 9365 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')); 9366 9367 $magnetics.on('mousemove', function(e){ 9368 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 9369 bound = e.currentTarget.getBoundingClientRect(), 9370 coeff = 30, 9371 hor = (bound.width / 2) - (e.clientX - bound.left), 9372 ver = (bound.height / 2) - (e.clientY - bound.top), 9373 toX = hor / bound.width * coeff, 9374 toY = ver / bound.height * coeff, 9375 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 9376 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 9377 toScale = Math.max(scaleX, scaleY); 9378 9379 gsap.killTweensOf($el); 9380 gsap.to( $el, { 9381 duration: 0.75, 9382 x: toX, 9383 y: toY, 9384 scale: toScale, 9385 ease: Power1.easeOut, 9386 transformPerspective: 900, 9387 transformOrigin: 'center', 9388 force3D: true 9389 }); 9390 }).on('mouseout', function(e){ 9391 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 9392 gsap.killTweensOf($el); 9393 gsap.to( $el, { 9394 duration: 0.6, 9395 y: 0, 9396 x: 0, 9397 scale: 1, 9398 ease: Power1.easeOut, 9399 transformPerspective: 900, 9400 transformOrigin: 'center', 9401 force3D: true 9402 }); 9403 }); 9404 }; 9405 9406 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 9407 magneticCursor(); 9408 }); 9409 9410 $(document).ajaxComplete(function( event, xhr, settings ) { 9411 magneticCursor(); 9412 }); 9413 9414 $('.isotope-container').on('isotope-layout-complete', function() { 9415 var $this = $(this); 9416 magneticCursor($this); 9417 }); 9418 9419}; 9420 9421UNCODE.dropImage = function() { 9422 9423 /**************************** 9424 * Image hover * 9425 ****************************/ 9426 function imageHover(){ 9427 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9428 return; 9429 } 9430 9431 var $postLists = $('.uncode-post-titles'); 9432 $postLists.each(function(){ 9433 var $list = $(this), 9434 timing = parseFloat( $list.attr('data-timing') ), 9435 default_image = $list.hasClass('uncode-post-titles-default-image'), 9436 default_title = $list.hasClass('uncode-post-titles-default-title'), 9437 $tmbs = $('.tmb', $list), 9438 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 9439 clientX, 9440 clientY, 9441 $row_parent = $list.closest('.vc_row'), 9442 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 9443 $col_parent = $list.closest('.uncell'), 9444 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 9445 setCTA; 9446 9447 timing *= 0.001; 9448 9449 var drop_bgs = function(){ 9450 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 9451 var $drop = $(this), 9452 srcset = $drop.attr('data-bgset'), 9453 setArr = srcset.split(","), 9454 setArrOrder = [], 9455 biggest = 0, 9456 checkBg = false, 9457 desktopBG = $drop.data('[data-background-image]'), 9458 mobileBG = $drop.data('[data-mobile-background-image]'); 9459 9460 if ( $drop.hasClass('srcset-bg-async') ) { 9461 9462 if ( ( UNCODE.wwidth < UNCODE.mediaQuery && typeof mobileBG !== 'undefined' && mobileBG !== '' ) || ( UNCODE.wwidth >= UNCODE.mediaQuery && typeof desktopBG !== 'undefined' && desktopBG !== '' ) ) { 9463 return; 9464 } 9465 9466 } 9467 9468 if ( SiteParameters.uncode_adaptive == true ) { 9469 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 9470 $drop.css({ 9471 'background-image' : 'url(' + setArr[0] + ')' 9472 }); 9473 } 9474 } else { 9475 for ( var i = 0; i < setArr.length; i++ ) { 9476 var setLoop = setArr[i].trim().split(" ");
9477 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 9478 var parseSet = parseFloat(setLoop[1]); 9479 if ( biggest < parseSet ) { 9480 biggest = parseSet; 9481 } 9482 setArrOrder[parseSet] = setLoop[0]; 9483 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 9484 checkBg = true; 9485 $drop.css({ 9486 'background-image' : 'url(' + setLoop[0] + ')' 9487 }); 9488 } 9489 } 9490 } 9491 9492 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 9493 $drop.css({ 9494 'background-image' : 'url(' + setArrOrder[biggest] + ')' 9495 }); 9496 } 9497 } 9498 9499 }); 9500 }; 9501 9502 drop_bgs(); 9503 9504 var dropMovesSize = function(){ 9505 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 9506 return; 9507 } 9508 $drop_moves.each(function(){ 9509 var $drop_move = $(this), 9510 dataW = $drop_move.attr('data-w'), 9511 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 9512 if ( typeof dataW !== 'undefined' && dataW !== null ) { 9513 dataW = screenInfo.width / 12 * parseFloat( dataW ); 9514 } 9515 $drop_moves.css({ 9516 width: dataW 9517 }); 9518 9519 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9520 $anim_parent.on('animationend', function(){ 9521 var bound = $anim_parent[0].getBoundingClientRect(); 9522 $drop_move.css({ 9523 left: bound.x * -1, 9524 top: bound.y * -1, 9525 }); 9526 }); 9527 } 9528 }); 9529 9530 9531 }; 9532 9533 dropMovesSize(); 9534 9535 $(window).on( 'resize', function(){ 9536 clearRequestTimeout(setCTA); 9537 setCTA = requestTimeout( function() { 9538 drop_bgs(); 9539 dropMovesSize(); 9540 }, 100 ); 9541 }); 9542 9543 if ( $drop_row_parents.length ) { 9544 $row_parent.addClass( 'drop-added' ); 9545 } 9546 9547 $drop_row_parents.each(function(index, val){ 9548 var $drop = $(val); 9549 $row_parent.prepend($drop); 9550 manageVideos($drop, false); 9551 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 9552 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 9553 } 9554 if ( default_image && index == 0 ) { 9555 manageVideos($drop, true); 9556 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 9557 image_ph = new Image(); 9558 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 9559 image_ph.onload = function() { 9560 $drop.addClass('active'); 9561 if ( default_title ) { 9562 $list.addClass('drop-hover'); 9563 $tmbs.first().addClass('drop-active'); 9564 } 9565 }; 9566 image_ph.src = bg_img; 9567 } 9568 } 9569 }); 9570 9571 if ( $drop_col_parents.length ) { 9572 $col_parent.addClass( 'drop-added' ); 9573 } 9574 9575 $drop_col_parents.each(function(index, val){ 9576 var $drop = $(this); 9577 $col_parent.prepend($drop); 9578 manageVideos($drop, false); 9579 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 9580 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 9581 } 9582 if ( default_image && index == 0 ) { 9583 manageVideos($drop, true); 9584 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 9585 image_ph = new Image(); 9586 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 9587 image_ph.onload = function() { 9588 $drop.addClass('active'); 9589 if ( default_title ) { 9590 $list.addClass('drop-hover'); 9591 $tmbs.first().addClass('drop-active'); 9592 } 9593 }; 9594 image_ph.src = bg_img; 9595 } 9596 } 9597 }); 9598 9599 function manageVideos( $el, start ) { 9600 var videoElem = $('video', $el), 9601 $iframe = $('iframe', $el), 9602 iframeID = $iframe.attr('id'); 9603 if ( videoElem.length ) { 9604 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 9605 if ( start ) { 9606 videoElem[0].setCurrentTime(0); 9607 videoElem[0].play(); 9608 } else { 9609 videoElem[0].pause(); 9610 videoElem[0].setCurrentTime(0); 9611 } 9612 } else { 9613 if ( start ) { 9614 videoElem[0].currentTime = 0; 9615 videoElem[0].play(); 9616 } else { 9617 videoElem[0].pause(); 9618 videoElem[0].currentTime = 0; 9619 } 9620 } 9621 } 9622 9623 $el.data('active', start); 9624 9625 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 9626 var iframeIDv = iframeID.replace('okplayer-', ''), 9627 optionsV = $(window).data('okoptions-' + iframeIDv), 9628 vimeo = $iframe[0], 9629 playerV = new Vimeo.Player(vimeo), 9630 timeV = 0; 9631 9632 if (optionsV.time != null) { 9633 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 9634 for ( var i = 0; i < timeArr.length; i++ ) { 9635 if ( timeArr[i] === 'h' ) { 9636 timeV += parseFloat(timeArr[i-1]) * 3600; 9637 } else if ( timeArr[i] === 'm' ) { 9638 timeV += parseFloat(timeArr[i-1]) * 60; 9639 } else if ( timeArr[i] === 's' ) { 9640 timeV += parseFloat(timeArr[i-1]); 9641 } 9642 } 9643 } 9644 playerV.setCurrentTime(timeV); 9645 if ( start ) { 9646 playerV.setVolume(0); 9647 playerV.play(); 9648 } else { 9649 playerV.pause(); 9650 } 9651 } else if ( $el.attr('data-provider') === 'youtube' ) { 9652 if ( start ) { 9653 $el.trigger('uncode-resume'); 9654 } else { 9655 $el.trigger('uncode-pause'); 9656 } 9657 } 9658 9659 } 9660 9661 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9662 9663 document.addEventListener("mousemove", function(e) { 9664 $drop_moves.each(function(){ 9665 var $drop_move = $(this), 9666 duration = 0.4; 9667 9668 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 9669 duration = 0.8; 9670 } 9671 9672 clientX = e.clientX; 9673 clientY = e.clientY; 9674 9675 gsap.to( $drop_move, { 9676 duration: duration, 9677 x: clientX, 9678 y: clientY, 9679 ease: Power1.easeOut, 9680 }); 9681 }); 9682 }); 9683 9684 } else { 9685 9686 $(window).on("touchend scroll", function(e) { 9687 $list.removeClass('drop-hover'); 9688 $drop_moves.removeClass('active'); 9689 $tmbs.removeClass('drop-active'); 9690 }); 9691 9692 $drop_moves.each(function(){ 9693 var $drop_move = $(this), 9694 $tmb = $drop_move.closest('.tmb'), 9695 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 9696 9697 if ( $anim_parent.hasClass('uncode-skew') ) { 9698 $anim_parent.css({ 9699 'transform': 'skew(0)' 9700 }); 9701 } 9702 9703 $tmb.on('touchend', function(e){ 9704 e.stopPropagation(); 9705 9706 $drop_moves.removeClass('active'); 9707 $tmbs.removeClass('drop-active'); 9708 9709 $list.addClass('drop-hover'); 9710 $tmb.addClass('drop-active'); 9711 $drop_move.addClass('active'); 9712 manageVideos($drop_move, true); 9713 clientX = e.changedTouches[0].clientX; 9714 clientY = e.changedTouches[0].clientY; 9715 9716 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9717 var bound = $anim_parent[0].getBoundingClientRect(); 9718 clientX = clientX - bound.x; 9719 clientY = clientY - bound.y; 9720 } 9721 9722 $drop_move.css({ 9723 left: clientX, 9724 top: clientY 9725 }); 9726 }); 9727 }); 9728 9729 } 9730 9731 $tmbs.each(function(e){ 9732 var $tmb = $(this), 9733 // $trgr = $('a', $tmb), 9734 $trgr = $tmb, 9735 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 9736 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9736(.t-inside), .parallax-el'), 9737 $video = $('video', $tmb), 9738 $iframe = $('iframe', $tmb), 9739 $entryTxt = $('.t-entry-text', $tmb), 9740 stopBounding; 9741 9742 $entryTxt.add($drop_move).css({ 9743 'transition-duration': timing + 's' 9744 }); 9745 9746 if ( $video.length ) { 9747 var vidH = $video[0].videoHeight, 9748 vidW = $video[0].videoWidth; 9749 $video.css({ 9750 'height': vidH, 9751 'width': vidW 9752 }); 9753 } 9754 9755 if ( $iframe.length ) { 9756 var vidH = $drop_move.attr('data-height'), 9757 vidW = $drop_move.attr('data-width'); 9758 $iframe.css({ 9759 'height': vidH, 9760 'width': vidW 9761 }); 9762 } 9763 9764 $iframe.each(function(){ 9765 var $video = $(this), 9766 vidH = $video[0].videoHeight, 9767 vidW = $video[0].videoWidth; 9768 $video.css({ 9769 'height': vidH, 9770 'width': vidW 9771 }); 9772 }); 9773 9774 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9775 $trgr.on('mouseenter',function(e){ 9776 $list.addClass('drop-hover'); 9777 $tmbs.removeClass('drop-active'); 9778 $tmb.addClass('drop-active'); 9779 $drop_move.addClass('active'); 9780 manageVideos($drop_move, true); 9781 9782 var clientX = e.clientX, 9783 clientY = e.clientY; 9784 $drop_move.css({ 9785 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 9786 }); 9787 9788 }) 9789 .on('mouseleave', function(e){ 9790 $list.removeClass('drop-hover'); 9791 $drop_move.css({ 9792 'transition-duration': ( timing*1.25 ) + 's' 9793 }); 9794 $drop_move.removeClass('active'); 9795 $tmb.removeClass('drop-active'); 9796 $drop_move.on('transitionend', function(e){ 9797 $drop_move.off('transitionend'); 9798 $drop_move.css({ 9799 'transition-duration': timing + 's' 9800 }); 9801 manageVideos($drop_move,false); 9802 }); 9803 }); 9804 9805 document.addEventListener('visibilitychange', function(){ 9806 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 9807 $drop_move.css({ 9808 'transition-duration': '0s' 9809 }); 9810 $drop_move.removeClass('active'); 9811 manageVideos($drop_move, false); 9812 } 9813 }); 9814 9815 document.addEventListener('scroll', function(){ 9816 window.clearRequestTimeout( stopBounding ); 9817 9818 if ( $drop_move.hasClass('active') ) { 9819 $list.removeClass('drop-hover'); 9820 $tmbs.removeClass('drop-active'); 9821 $drop_move.removeClass('active'); 9822 $drop_move.on('transitionend', function(e){ 9823 $drop_move.off('transitionend'); 9824 $drop_move.css({ 9825 'transition-duration': timing + 's' 9826 }); 9827 manageVideos($drop_move,false); 9828 }); 9829 } 9830 9831 stopBounding = requestTimeout(function() { 9832 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9833 var bound = $anim_parent[0].getBoundingClientRect(); 9834 $drop_move.css({ 9835 left: bound.x * -1, 9836 top: bound.y * -1, 9837 }); 9838 } 9839 }, 200); 9840 9841 }); 9842 } 9843 9844 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 9845 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 9846 9847 $drop.css({ 9848 'transition-duration': timing + 's' 9849 }); 9850 9851 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 9852 $trgr.on('mouseenter',function(e){ 9853 $row_parent.add($col_parent).addClass('drop-list-loaded'); 9854 $list.addClass('drop-hover'); 9855 9856 if ( !$tmb.hasClass('drop-active') ) { 9857 $tmbs.removeClass('drop-active'); 9858 $tmb.addClass('drop-active'); 9859 if ( default_image && !$drop.hasClass('active') ) { 9860 var $prev = $('[data-drop].active', $row_parent); 9861 $prev.css({ 9862 'transition-duration': (timing*1.5) + 's' 9863 }); 9864 $prev.removeClass('active'); 9865 $prev.on('transitionend', function(e){ 9866 $prev.off('transitionend'); 9867 manageVideos($prev,false); 9868 }); 9869 } 9870 $drop.css({ 9871 'transition-duration': timing + 's' 9872 }); 9873 $drop.off('transitionend'); 9874 $drop.addClass('active'); 9875 manageVideos($drop, true); 9876 } 9877 }) 9878 .on('mouseleave', function(e){ 9879 if ( ( default_image && !default_title ) || !default_image ) { 9880 $list.removeClass('drop-hover'); 9881 $tmb.removeClass('drop-active'); 9882 } 9883 if ( ! default_image ) { 9884 $drop.css({ 9885 'transition-duration': (timing*1.5) + 's' 9886 }); 9887 $drop.removeClass('active'); 9888 9889 $drop.on('transitionend', function(e){ 9890 $drop.off('transitionend'); 9891 manageVideos($drop,false); 9892 }); 9893 } 9894 }); 9895 9896 document.addEventListener('visibilitychange', function(){ 9897 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 9898 $drop.css({ 9899 'transition-duration': '0s' 9900 }); 9901 $drop.removeClass('active'); 9902 manageVideos($drop, false); 9903 } 9904 }); 9905 } 9906 }); 9907 9908 }); 9909 }; 9910 9911 $(window).on('load', function(event) { 9912 imageHover(); 9913 }); 9914 9915 var drop_wp_animation = function() { 9916 var $postLists = $('.uncode-post-titles'); 9917 $postLists.each(function(){ 9918 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 9919 new Waypoint({ 9920 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9921 element: val, 9922 handler: function() { 9923 var element = $(this.element), 9924 parent = element.closest('.tmb'), 9925 currentIndex = parent.index(),
9926 delay = currentIndex, 9927 delayAttr = parseInt(element.attr('data-delay')); 9928 if (isNaN(delayAttr)) delayAttr = 100; 9929 var objTimeout = requestTimeout(function() { 9930 element.addClass('start_animation'); 9931 9932 var nextTimeout = requestTimeout(function() { 9933 $('.drop-image-separator', parent).addClass('start_animation'); 9934 }, 50); 9935 9936 }, delay * delayAttr); 9937 if (!UNCODE.isUnmodalOpen) { 9938 this.destroy(); 9939 } 9940 }, 9941 offset: UNCODE.isFullPage ? '100%' : '90%' 9942 }) 9943 }); 9944 }); 9945 } 9946 9947 var runWaypoints_TO, 9948 runWaypoints_delay = 0; 9949 9950 var runWaypoints = function(){ 9951 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 9952 runWaypoints_delay = 400; 9953 } 9954 clearRequestTimeout(runWaypoints_TO); 9955 runWaypoints_TO = requestTimeout(function() { 9956 drop_wp_animation(); 9957 }, runWaypoints_delay); 9958 }; 9959 runWaypoints(); 9960 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 9961 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9962 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 9963 // imageHover(); 9964 runWaypoints(); 9965 }); 9966 } 9967}; 9968 9969UNCODE.postTable = function() { 9970 9971 var clickRow = function(){ 9972 var $postLists = $('.uncode-post-table'); 9973 9974 $postLists.each(function(){ 9975 var $postList = $(this), 9976 $tmbClicks = $('.tmb.tmb-click-row', $postList); 9977 9978 $tmbClicks.each(function(){ 9979 var $tmb = $(this), 9980 $click = $('.table-click-row', $tmb); 9981 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 9982 e.preventDefault(); 9983 e.stopPropagation(); 9984 $click[0].click(); 9985 return false; 9986 }); 9987 }); 9988 9989 }) 9990 }; 9991 9992 clickRow(); 9993 9994 var hoverRow = function(){ 9995 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 9996 9997 $postLists.on('mouseenter', function(){ 9998 $(this).addClass('post-table-hover'); 9999 }); 10000 $postLists.on('mouseleave', function(){ 10001 $(this).removeClass('post-table-hover'); 10002 }); 10003 } 10004 10005 hoverRow(); 10006 10007 var drop_wp_animation = function() { 10008 var $postLists = $('.uncode-post-table'); 10009 $postLists.each(function(){ 10010 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 10011 new Waypoint({ 10012 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10013 element: val, 10014 handler: function() { 10015 var element = $(this.element), 10016 parent = element.closest('.tmb'), 10017 currentIndex = parent.index(), 10018 delay = currentIndex, 10019 delayAttr = parseInt(element.attr('data-delay')); 10020 if (isNaN(delayAttr)) delayAttr = 100; 10021 var objTimeout = requestTimeout(function() { 10022 element.addClass('start_animation'); 10023 }, delay * delayAttr); 10024 if (!UNCODE.isUnmodalOpen) { 10025 this.destroy(); 10026 } 10027 }, 10028 offset: UNCODE.isFullPage ? '100%' : '90%' 10029 }) 10030 }); 10031 }); 10032 } 10033 10034 var runWaypoints_TO, 10035 runWaypoints_delay = 0; 10036 10037 var runWaypoints = function(){ 10038 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 10039 runWaypoints_delay = 400; 10040 } 10041 clearRequestTimeout(runWaypoints_TO); 10042 runWaypoints_TO = requestTimeout(function() { 10043 drop_wp_animation(); 10044 }, runWaypoints_delay); 10045 }; 10046 runWaypoints(); 10047 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 10048 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10049 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 10050 runWaypoints(); 10051 // clickRow(); 10052 }); 10053 } 10054}; 10055 10056UNCODE.rotatingTxt = function($ctxt) { 10057 10058 if ( $('body').hasClass('compose-mode') ) { 10059 return; 10060 } 10061 10062 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 10063 var setCTA; 10064 10065 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 10066 var $heading = $(this), 10067 // debug = 0, 10068 cycle = 0, 10069 $trgt, 10070 $toMove, 10071 $highl, 10072 $col = $heading.closest('.uncont'), 10073 txt, 10074 arrTxt, 10075 textFadeIn, textFadeOut, 10076 removeWraps; 10077 10078 var defineObjs = function() { 10079 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 10080 var $rtx = $(this), 10081 fx = $rtx.attr('data-fx'), 10082 wait = $rtx.attr('data-wait'), 10083 $prev = $(this).prev().addClass('prev-rotating-start'), 10084 splitToMove = [], 10085 splitArray = [], 10086 lineArray = [], 10087 lineIndex = 0, 10088 lineStart = true, 10089 lineEnd = false, 10090 startSplit = false, 10091 $line_wrap = $rtx.closest('.heading-line-wrap'), 10092 same_line = true, 10093 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 10094 indexRtx = $splits.index($rtx); 10095 10096 fx = typeof fx === 'undefined' ? '' : fx;
10097 wait = typeof wait === 'undefined' ? '' : wait; 10098 10099 $splits.each(function(key, val){ 10100 var $split = $(this), 10101 $new_line_wrap = $split.closest('.heading-line-wrap'); 10102 10103 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 10104 splitArray.push( $split ); 10105 } 10106 10107 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10108 startSplit = false; 10109 } 10110 10111 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 10112 splitArray.push( $split ); 10113 10114 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 10115 same_line = true; 10116 } else { 10117 same_line = false; 10118 } 10119 } 10120 10121 if ( key == indexRtx ) { 10122 if ( /\S/.test($split.text()) ) { 10123 startSplit = true; 10124 $line_wrap = $split.closest('.heading-line-wrap'); 10125 splitArray.push( $split ); 10126 } else { 10127 indexRtx++; 10128 } 10129 } 10130 10131 $line_wrap = $new_line_wrap; 10132 }); 10133 10134 $toMove = $($.map(splitToMove, function(el){return el.get();})); 10135 $trgt = $($.map(splitArray, function(el){return el.get();})); 10136 10137 if ( same_line ) { 10138 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 10139 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 10140 } 10141 10142 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 10143 $prev.addClass('empty-span-hidden'); 10144 } 10145 10146 $highl = $('.heading-text-highlight-inner', $trgt); 10147 10148 $rtx.attr('data-animated', 'true'); 10149 if ( cycle == 0 ) { 10150 $( document.body ).trigger('defer-highlights'); 10151 cycle++; 10152 defineObjs(); 10153 return; 10154 } 10155 cycle++; 10156 10157 txt = $rtx.attr('data-text'); 10158 arrTxt = txt.split("|"); 10159 10160 textFadeOut($trgt); 10161 10162 }); 10163 }; 10164 10165 removeWraps = function(){ 10166 10167 // if ( debug == 1 ) return; 10168 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 10169 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 10170 10171 10172 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 10173 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 10174 10175 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 10176 10177 $splitFlow.each(function(){ 10178 $(this).append($temp_highl); 10179 }); 10180 10181 var $line_wrap = $wraps[wrap_k]; 10182 var $parent_wrap = $line_wrap.parentNode; 10183 if ( $parent_wrap !== null ) { 10184 while ( $line_wrap.firstChild ) { 10185 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 10186 } 10187 $parent_wrap.removeChild($line_wrap); 10188 } 10189 } 10190 // debug++; 10191 defineObjs(); 10192 }; 10193 10194 var loop = 0; 10195 textFadeIn = function($trgt){ 10196 var word = arrTxt[loop].split(" "), 10197 worsSpan = '', 10198 $wrap = $trgt.closest('.uncode-rotating-wrap'), 10199 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 10200 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 10201 10202 for (var w = 0; w < word.length; w++) { 10203 var highl; 10204 if ( $highl.length ) { 10205 highl = $highl[0].outerHTML; 10206 } else { 10207 highl = ''; 10208 } 10209 10210 if ( w > 0 ) { 10211 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 10212 } 10213 var charachters = word[w].split(''); 10214 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 10215 for (var c = 0; c < charachters.length; c++) { 10216 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 10217 } 10218 worsSpan += '</span>' + highl + '</span></span>'; 10219 } 10220 10221 if ( $wrap.length && $wrap_inner.length ) { 10222 var words_w = $wrap_inner.outerWidth(); 10223 $wrap.css({ 10224 width: words_w 10225 }); 10226 10227 $highl = $('.heading-text-highlight-inner', $wrap); 10228 $highl.prependTo($wrap); 10229 10230 $wrap_inner.css({ 10231 opacity: 0 10232 }); 10233 10234 $wrap_inner.html(worsSpan); 10235 $('.heading-text-highlight-inner', $wrap_inner).remove(); 10236 words_w = $wrap_inner.innerWidth(); 10237 10238 var duration = 0.45; 10239 10240 $heading.removeClass('auto-width'); 10241 if ( words_w > $col.width() ) { 10242 $heading.addClass('auto-width'); 10243 words_w = 'auto'; 10244 duration = 0; 10245 } 10246 10247 $wrap.css({ 10248 'width': words_w, 10249 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 10250 }); 10251 10252 var $word_inner = $('.split-word-inner', $wrap_inner), 10253 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 10254 10255 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 10256 10257 if ( !$target_fx.length ) { 10258 return; 10259 } 10260 10261 gsap.killTweensOf($target_fx); 10262 10263 if ( fx !== 'zoom' ) { 10264 gsap.fromTo( $target_fx, { 10265 y: fx === 'opacity' ? '0%' : '-10%' 10266 },{ 10267 delay: duration, 10268 duration: 0.25, 10269 y: '0%', 10270 ease: Circ.easeOut, 10271 }); 10272 10273 if ( !$wrap_inner.length ) { 10274 return; 10275 } 10276 10277 gsap.fromTo( $wrap_inner, { 10278 opacity: 0, 10279 },{ 10280 delay: duration, 10281 duration: 0.25, 10282 opacity: 1, 10283 ease: Circ.easeOut, 10284 onComplete: function(){ 10285 $('> .heading-text-highlight-inner', $wrap).remove(); 10286 $wrap_inner.html(worsSpan); 10287 removeWraps(); 10288 } 10289 }) 10290 10291 } else { 10292 gsap.fromTo( $target_fx, { 10293 transformOrigin: '50%', 10294 opacity: 0, 10295 scale: 0.875, 10296 },{ 10297 opacity: 1, 10298 delay: duration, 10299 duration: 0.25, 10300 scale: 1, 10301 ease: Circ.easeOut, 10302 onComplete: function(){ 10303 $('> .heading-text-highlight-inner', $wrap).remove(); 10304 $wrap_inner.html(worsSpan); 10305 removeWraps(); 10306 } 10307 }); 10308 } 10309 10310 } else { 10311 10312 if ( !$wrap_inner.length ) { 10313 return; 10314 } 10315 10316 gsap.to( $wrap_inner, { 10317 duration: 0.4, 10318 opacity: 0, 10319 ease: Power1.easeOut, 10320 onComplete: function(){ 10321 $wrap_inner.html(worsSpan); 10322 words_w = $wrap_inner.innerWidth(); 10323 10324 gsap.to( $wrap_inner, { 10325 duration: 0.2, 10326 opacity: 1, 10327 ease: Power1.easeOut, 10328 onComplete: function(){ 10329 $('> .heading-text-highlight-inner', $wrap).remove(); 10330 $wrap_inner.html(worsSpan); 10331 removeWraps(); 10332 } 10333 }) 10334 } 10335 }); 10336 } 10337 10338 if ( loop < arrTxt.length-1 ) { 10339 loop++; 10340 } else { 10341 loop = 0; 10342 } 10343 10344 }; 10345 10346 textFadeOut = function($trgt){ 10347 var $word_inner = $('.split-word-inner', $trgt), 10348 $wrap = $trgt.closest('.uncode-rotating-wrap'), 10349 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 10350 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 10351 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 10352 10353 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 10354 10355 var gsap_param = { 10356 delay: wait, 10357 duration: 0.25, 10358 y: fx === '' ? '10%' : '0%', 10359 opacity: 0, 10360 ease: Circ.easeOut, 10361 onStart: function(){ 10362 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 10363 $highl = $('.heading-text-highlight-inner', $wrap); 10364 $highl.prependTo($wrap); 10365 } 10366 }, 10367 onComplete: textFadeIn, 10368 onCompleteParams: [$trgt] 10369 }; 10370 10371 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 10372 10373 if ( fx === '' ) { 10374 gsap_param.y = '10%'; 10375 } else if ( fx === 'zoom' ) { 10376 gsap_param.scale = '1.045'; 10377 } 10378 10379 if ( !$target_fx.length ) { 10380 return; 10381 } 10382 10383 if ( $heading.data('waypoint') !== true ) { 10384 var textInView = new Waypoint.Inview({ 10385 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 10386 element: $heading[0], 10387 enter: function(direction) { 10388 $heading.data('waypoint',true); 10389 gsap.fromTo( $target_fx, { 10390 transformOrigin: '50%' 10391 }, gsap_param ); 10392 } 10393 }); 10394 } else { 10395 gsap.fromTo( $target_fx, { 10396 transformOrigin: '50%' 10397 }, gsap_param ); 10398 } 10399 }; 10400 10401 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 10402 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 10403 var $el = model.view.$el, 10404 shortcode = model.attributes.shortcode; 10405 10406 UNCODE.rotatingTxt($el); 10407 }); 10408 } else { 10409 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 10410 $heading.on('already-animated', function(){ 10411 removeWraps(); 10412 window.addEventListener('removeOldLines', function(){ 10413 clearRequestTimeout(setCTA); 10414 setCTA = requestTimeout( removeWraps, 150 ); 10415 }); 10416 }); 10417 } else { 10418 $(window).on('load', function(){ 10419 removeWraps(); 10420 window.addEventListener('removeOldLines', function(){ 10421 clearRequestTimeout(setCTA); 10422 setCTA = requestTimeout( removeWraps, 150 ); 10423 }); 10424 }); 10425 } 10426 } 10427 }); 10428 10429}; 10430 10431UNCODE.verticalText = function() { 10432 $(window).on('menuCanvasOpen', function(){ 10433 $('.vertical-text--fixed').fadeOut(500); 10434 $('.horizontal-text--fixed').fadeOut(500); 10435 }).on('menuCanvasClose', function(){ 10436 $('.vertical-text--fixed').fadeIn(500); 10437 $('.horizontal-text--fixed').fadeIn(500); 10438 }); 10439 10440 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 10441 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 10442 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 10443 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 10444 10445 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 10446 window.addEventListener('scroll', function(e) { 10447 var totalPageHeight = document.body.scrollHeight; 10448 var scrollPoint = window.scrollY + window.innerHeight; 10449 10450 if (window.scrollY > 0) { 10451 showOnTopVerticalTexts.fadeOut(); 10452 showOnTopHorizontalTexts.fadeOut(); 10453 } else { 10454 showOnTopVerticalTexts.fadeIn(); 10455 showOnTopHorizontalTexts.fadeIn(); 10456 } 10457 10458 if (scrollPoint >= totalPageHeight) { 10459 hideOnBottomVerticalTexts.fadeOut(); 10460 hideOnBottomHorizontalTexts.fadeOut(); 10461 } else { 10462 hideOnBottomVerticalTexts.fadeIn(); 10463 hideOnBottomHorizontalTexts.fadeIn(); 10464 } 10465 }, false); 10466 } 10467}; 10468 10469UNCODE.stickyScroll = function( $el ) { 10470 if ( typeof $el === 'undefined' || $el === null ) { 10471 $el = $('body'); 10472 } 10473 var checkVisible = function( el, dir ) { 10474 if (typeof jQuery === "function" && el instanceof jQuery) { 10475 el = el[0]; 10476 } 10477 10478 var off = 50; 10479 dir = typeof dir=='undefined' ? 'right' : dir; 10480 var rect = el.getBoundingClientRect(); 10481 10482 return ( 10483 ( 10484 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 10485 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 10486 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 10487 ) && 10488 ( 10489 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 10490 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 10491 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 10492 ( rect.right <= window.innerWidth && rect.left >= 0 ) 10493 ) 10494 ); 10495 }; 10496 10497 var setItemsRelHeight = function(reset) { 10498 var $_el = $el; 10499 if ( $el.is('.index-scroll') ) { 10500 var $_el = $el.closest('.uncont'); 10501 } 10502 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 10503 $.each($('.tmb', item), function(index, val) { 10504 if ( reset === true ) { 10505 $(val).css( 'visibility', 'hidden' ); 10506 } else { 10507 $(val).css( 'visibility', 'visible' ); 10508 } 10509 }); 10510 }); 10511 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 10512 $.each($('.tmb', item), function(index, val) { 10513 if ( reset === true ) { 10514 $(val).css( 'visibility', 'hidden' ); 10515 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 10516 } else { 10517 var $rowParent = $(item).closest('.row-parent'), 10518 rowRatio = $rowParent.attr('data-height-ratio'), 10519 $rowInner = $(item).closest('.row-child'), 10520 rowRatioInner = $rowInner.attr('data-height'), 10521 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 10522 $colContainer = $(item).closest('.uncell'), 10523 $uncont = $(item).closest('.uncont'), 10524 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 10525 safe_heigth = $(item).data('safe-height'), 10526 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 10527 offSet = $(item).offset().top - $uncont.offset().top, 10528 multiplier_h, 10529 data_viewport_h, 10530 body_border = $('.body-borders .top-border').outerHeight() * 2, 10531 remove_menu = $(item).data('vp-menu'); 10532 10533 if ( rowRatio === 'full' || rowRatio === '' ) { 10534 rowRatio = 1; 10535 } else { 10536 rowRatio = rowRatio / 100; 10537 } 10538 10539 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 10540 rowRatio = rowRatio; 10541 } else { 10542 rowRatio = rowRatio * rowRatioInner / 100; 10543 } 10544 10545 winHeight = winHeight * rowRatio; 10546 10547 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10548 multiplier_h = parseInt($(item).attr('data-vp-height')); 10549 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 10550 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 10551 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 10552 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 10553 } 10554 10555 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 10556 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 10557 if ( remove_menu === true ) { 10558 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 10559 } 10560 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 10561 } else { 10562 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 10563 } 10564 10565 } 10566 }); 10567 }); 10568 $('.index-scroll', $_el).each(function(i, item){ 10569 var $uncoltable = $(item).closest('.uncoltable'), 10570 $rowParent = $(item).closest('.row-parent'), 10571 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 10572 body_border = $('.body-borders .top-border').outerHeight() * 2, 10573 $index_row = $('.index-row', item), 10574 safe_heigth = $index_row.data('safe-height'), 10575 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 10576 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 10577 var data_viewport_h = winHeight - ( paddingRow + body_border ); 10578 $uncoltable.css({ 10579 'min-height': data_viewport_h 10580 }); 10581 } else { 10582 $uncoltable.css({ 10583 'min-height': 'auto' 10584 }); 10585 } 10586 }); 10587 10588 } 10589 setItemsRelHeight(); 10590 10591 var $index_scrolls = $('.index-scroll', $el); 10592
10593 $index_scrolls.each(function(key, value){ 10594 var $index = $(this), 10595 $parent_row = $index.closest('.vc_row[data-parent]'), 10596 $index_row = $('.index-row', $index), 10597 dir = $index_row.attr('data-direction'); 10598 dir = typeof dir === 'undefined' ? 'right' : dir; 10599 10600 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 10601 }); 10602 10603 var $horScrolls = $('.unscroll-horizontal', $el); 10604 10605 if ( $horScrolls.length ) { 10606 10607 $('body').addClass('scrolling-trigger'); 10608 10609 $horScrolls.each(function(key, value){ 10610 var $section = $(this), 10611 $index_scroll = $('.index-scroll', $section), 10612 $index_row = $('.index-row', $index_scroll), 10613 dir = $section.attr('data-direction'), 10614 wrap = $index_row.attr('data-wrap'), 10615 $pinWrap, 10616 $pinTrigger; 10617 10618 dir = typeof dir === 'undefined' ? 'right' : dir; 10619 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 10620 $pinWrap = $('<div class="pin-wrap" />'); 10621 if ( SiteParameters.is_frontend_editor ) { 10622 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 10623 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 10624 } else { 10625 if ( wrap === 'column' ) { 10626 $index_scroll.wrapInner( $pinWrap ); 10627 } else { 10628 $('> .row', $section).wrap( $pinWrap ); 10629 } 10630 $section.wrapInner( $pinTrigger ); 10631 } 10632 10633 }); 10634 10635 var $pinWraps = $('.pin-wrap', $el); 10636 10637 var horScrollSizes = function(){ 10638 10639 $pinWraps.each(function(key, val){ 10640 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 10641 $pinTrigger = $pinWrap.closest('.pin-trigger'), 10642 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 10643 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 10644 $boxContainer = $('.box-container'), 10645 box_m = $boxContainer.css('margin-left'), 10646 st_active = true; 10647 10648 var setHorW, 10649 horWidth = function(){ 10650 $index_scroll.each(function(){ 10651 var $this = $(this), 10652 $index_row = $('.index-row', $this), 10653 $rowContainer = $index_row.closest('.vc_row'), 10654 $rowInner = $index_row.closest('.wpb_row'), 10655 $rowParent = $index_row.closest('.row-parent'), 10656 $tmbs = $('.tmb', $index_row), 10657 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 10658 $uncont = $index_row.closest('.uncont'), 10659 $parent_col = $index_row.closest('.wpb_column'), 10660 col_w = $uncont.width(), 10661 data_lg = parseFloat( $index_row.attr('data-lg') ), 10662 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 10663 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 10664 tmb_w; 10665 10666 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 10667 tmb_w = ( col_w + padding_tmb ) / data_lg; 10668 10669 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 10670 tmb_w = ( col_w + padding_tmb ) / data_sm; 10671 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 10672 tmb_w = ( col_w + padding_tmb ) / data_md; 10673 } 10674 10675 if ( !isNaN(tmb_w) ) { 10676 $tmbs.css({ 10677 'width': tmb_w 10678 }); 10679 } 10680 10681 $tmbs.css({ 10682 'visibility': 'visible' 10683 }); 10684 10685 }); 10686 }; 10687 10688 horWidth(); 10689 clearRequestTimeout(setHorW); 10690 setHorW = requestTimeout( function(){ 10691 setItemsRelHeight(); 10692 horWidth(); 10693 }, 100 ); 10694 10695 if ( SiteParameters.is_frontend_editor ) { 10696 return; 10697 } 10698 10699 var $vmenu = $('body.vmenu .vmenu-container'), 10700 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 10701 winWidth = window.innerWidth - vmenuW, 10702 $tmb = $('.tmb', $index_scroll).eq(0), 10703 paddingRight = parseFloat( $tmb.css('padding-right') ), 10704 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 10705 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 10706 scroll_anim; 10707 10708 if ( $('body').hasClass('rtl') ) { 10709 if ( dir === 'left' ) { 10710 scroll_anim = gsap.fromTo( $pinWrap, { 10711 x: stickyScrollLength 10712 },{ 10713 x: 0, 10714 ease: "none" 10715 }); 10716 } else { 10717 scroll_anim = gsap.fromTo( $pinWrap, { 10718 x: 0 10719 },{ 10720 x: stickyScrollLength, 10721 ease: "none" 10722 }); 10723 } 10724 } else { 10725 if ( dir === 'left' ) { 10726 scroll_anim = gsap.fromTo( $pinWrap, { 10727 x: -stickyScrollLength 10728 },{ 10729 x: 0, 10730 ease: "none" 10731 }); 10732 } else { 10733 scroll_anim = gsap.fromTo( $pinWrap, { 10734 x: 0 10735 },{ 10736 x: -stickyScrollLength, 10737 ease: "none" 10738 }); 10739 } 10740 } 10741 10742 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 10743 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 10744 } 10745 10746 var animationIncrease; 10747 10748 var checkForAnimations = function(){ 10749 animationIncrease = 0 10750 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10751 var _this = this, 10752 isScrolling; 10753 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 10754 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10755 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10756 requestTimeout(function() { 10757 $(_this).addClass('start_animation'); 10758 }, delayAttr + animationIncrease); 10759 animationIncrease += 150; 10760 } 10761 }); 10762 }; 10763 checkForAnimations(); 10764
10765 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 10766 var start = 0; 10767 10768 var horST = ScrollTrigger.create({ 10769 id: "stickySectionScrolling" + key, 10770 scrub: true, 10771 trigger: $pinTrigger[0], 10772 pin: true, 10773 anticipatePin: 1, 10774 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 10775 end: function() { return "+="+stickyScrollLength; }, 10776 animation: scroll_anim, 10777 ease: Sine.easeOut, 10778 onUpdate: checkForAnimations, 10779 invalidateOnRefresh: true, 10780 onEnter: function(){ 10781 $pinTrigger.addClass('enter-st'); 10782 }, 10783 onEnterBack: function(){ 10784 $pinTrigger.addClass('enter-st'); 10785 }, 10786 onLeave: function(){ 10787 $pinTrigger.removeClass('enter-st'); 10788 }, 10789 onLeaveBack: function(){ 10790 $pinTrigger.removeClass('enter-st'); 10791 } 10792 }); 10793 10794 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 10795 window.dispatchEvent(new CustomEvent('boxResized')); 10796 10797 var testSecondTrigger = function(){ 10798 animationIncrease = 0 10799 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10800 var _this = this; 10801 if ( checkVisible(_this) ) { 10802 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10803 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10804 requestTimeout(function() { 10805 $(_this).addClass('start_animation'); 10806 }, delayAttr + animationIncrease); 10807 animationIncrease += 150; 10808 } 10809 }); 10810 10811 }; 10812 10813 var verST = ScrollTrigger.create({ 10814 id: "verticalSectionScrolling" + key, 10815 trigger: $pinTrigger[0], 10816 start: "top center", 10817 end: function() { return "+="+UNCODE.wheight; }, 10818 onUpdate: testSecondTrigger, 10819 invalidateOnRefresh: true 10820 }); 10821 10822 var setCTA, 10823 10824 dis_enable_ST = function(){ 10825 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 10826 horST.kill(); 10827 verST.kill(); 10828 $pinTrigger.addClass('disabled'); 10829 st_active = false; 10830 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 10831 horST.kill(); 10832 verST.kill(); 10833 $pinTrigger.addClass('disabled'); 10834 st_active = false; 10835 } 10836 }; 10837 10838 $(window).on('resize load', function() { 10839 clearRequestTimeout(setCTA); 10840 setCTA = requestTimeout(function() { 10841 dis_enable_ST(); 10842 checkForAnimations(); 10843 }, 500); 10844 }); 10845 10846 }); 10847 }; 10848 10849 $(window).on( 'load', function(){ 10850 horScrollSizes(); 10851 }); 10852 var setResize, 10853 setReLayout, 10854 doubleResize = true, 10855 oldW = UNCODE.wwidth, 10856 isResized = true; 10857 $(window).on( 'load', function(){ 10858 if ( $('.body-borders .top-border').outerHeight() > 0 ) { 10859 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 10860 Array.prototype.forEach.call($row_inners, function(el) { 10861 el.style.height = ''; 10862 el.style.marginBottom = ''; 10863 }); 10864 setItemsRelHeight(); 10865 horScrollSizes(); 10866 ScrollTrigger.refresh(); 10867 } 10868 var carousel = document.querySelector(".owl-carousel"), 10869 grid = document.querySelector(".isotope-container"), 10870 stickyAll = document.querySelectorAll(".index-scroll"); 10871 10872 if ( stickyAll.length ) { 10873 var sticky = stickyAll[(stickyAll.length-1)]; 10874 } 10875 10876 if ( typeof sticky !== "undefined" ) { 10877 10878 if ( typeof carousel !== "undefined" && carousel !== null ) { 10879 var carousel_position = sticky.compareDocumentPosition(carousel); 10880 } 10881 if ( typeof grid !== "undefined" && grid !== null ) { 10882 var grid_position = sticky.compareDocumentPosition(grid); 10883 } 10884 10885 if ( carousel_position === 2 || grid_position === 2 ) { 10886 setTimeout(function(){ 10887 ScrollTrigger.refresh(); 10888 }, 500); 10889 } 10890 10891 } 10892 10893 }); 10894 $(window).on( 'resize orientationchange', function(){ 10895 isResized = (oldW !== UNCODE.wwidth); 10896 if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) { 10897 return; 10898 } else { 10899 oldW = UNCODE.wwidth; 10900 } 10901 setItemsRelHeight(true); 10902 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 10903 Array.prototype.forEach.call($row_inners, function(el) { 10904 el.style.height = ''; 10905 el.style.marginBottom = ''; 10906 }); 10907 clearRequestTimeout(setResize); 10908 setResize = requestTimeout( function(){ 10909 setItemsRelHeight(); 10910 horScrollSizes(); 10911 ScrollTrigger.refresh(); 10912 if ( doubleResize === true ) { 10913 window.dispatchEvent(new Event('resize')); 10914 doubleResize = false;
10915 } else { 10916 doubleResize = true; 10917 } 10918 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, isResized); 10919 }, 100 ); 10920 }); 10921 10922 var show_pins = function(){ 10923 $('.index-scroll').css({'opacity':'1'}); 10924 }; 10925 ScrollTrigger.addEventListener("refresh", show_pins); 10926 $(window).on( 'uncode.re-layout', function(){ 10927 //$('.index-scroll').css({'opacity':'0'}); 10928 $('.pin-spacer').each(function(){ 10929 var space_h = $(this).outerHeight(), 10930 $row = $(this).closest('.row-container'); 10931 $row.css({ 10932 'height': space_h, 10933 'overflow': 'hidden' 10934 }); 10935 }); 10936 ScrollTrigger.refresh(true); 10937 clearRequestTimeout(setReLayout); 10938 setReLayout = requestTimeout( function(){ 10939 $('.row-container').each(function(){ 10940 $(this).css({ 10941 'height': '', 10942 'overflow': '' 10943 }); 10944 }); 10945 }, 1000); 10946 }); 10947 } 10948 10949}; 10950 10951UNCODE.stickyTrigger = function( $el ) { 10952 if ( SiteParameters.is_frontend_editor ) { 10953 return false; 10954 } 10955 10956 var stickyTrigger = function(){ 10957 var stickyTrick = $('.sticky-trigger').each(function(){ 10958 var $sticky = $(this), 10959 $inside = $('> div', $sticky), 10960 insideH = $inside.outerHeight(), 10961 $row = $sticky.closest('.vc_row'), 10962 $uncont = $sticky.closest('.uncont'), 10963 rowBottom, 10964 uncontBottom , 10965 diffBottom; 10966 10967 ScrollTrigger.create({ 10968 trigger: $sticky, 10969 start: function(){ return "top center-=" + insideH/2; }, 10970 endTrigger: $row, 10971 end: function(){ 10972 rowBottom = $row.offset().top + $row.outerHeight(); 10973 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 10974 diffBottom = rowBottom - uncontBottom; 10975 return "bottom center+=" + ( insideH/2 + diffBottom ); 10976 }, 10977 anticipatePin: true, 10978 pin: true, 10979 pinSpacing: false, 10980 scrub: true, 10981 invalidateOnRefresh: true, 10982 }); 10983 10984 }); 10985 }, 10986 setResizeSticky; 10987 10988 $(window).on( 'load', function(){ 10989 stickyTrigger(); 10990 }); 10991 10992 var oldW = UNCODE.wwidth; 10993 $(window).on( 'resize uncode.re-layout', function(e){ 10994 clearRequestTimeout(setResizeSticky); 10995 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 10996 return; 10997 } else { 10998 oldW = UNCODE.wwidth; 10999 } 11000 setResizeSticky = requestTimeout( function(){ 11001 stickyTrigger(); 11002 ScrollTrigger.refresh(); 11003 }, 1000 ); 11004 }); 11005 11006}; 11007 11008UNCODE.revslider = function() { 11009 var revSliderIn = function(){ 11010 $('rs-module').each(function(){ 11011 var $slider = $(this); 11012 11013 $slider.on('revolution.slide.onloaded', function(e, data){ 11014 if ( $(e.currentTarget).closest(".header-revslider").length ) { 11015 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 11016 scrolltop = $(document).scrollTop(); 11017 if ( style != undefined ) { 11018 UNCODE.switchColorsMenu(scrolltop, style); 11019 } 11020 } 11021 }); 11022 11023 $slider.on('revolution.slide.onchange', function(e, data){ 11024 if ( $(e.currentTarget).closest(".header-revslider").length ) { 11025 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 11026 scrolltop = $(document).scrollTop(); 11027 if ( style != undefined ) { 11028 UNCODE.switchColorsMenu(scrolltop, style); 11029 } 11030 } 11031 }); 11032 11033 }); 11034 }; 11035 revSliderIn(); 11036 $(window).on("load", revSliderIn ); 11037}; 11038UNCODE.layerslider = function() { 11039 $(window).on("load", function() { 11040 11041 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 11042 11043 var slideData = slider.slides.current.data, 11044 scrolltop = $(document).scrollTop(); 11045 if( slideData && slideData.skin ) { 11046 11047 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 11048 11049 } 11050 }); 11051 11052 }); 11053}; 11054 11055UNCODE.ajax_filters = function() { 11056 11057/************************* 11058 * 11059 * Filters Menu and Widgets Area 11060 * 11061 ************************/ 11062 11063 var clear_clicked = false; 11064 11065 var init_ajax_grid = function(){ 11066 11067 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 11068 $grids.each(function(index, val){ 11069 var $body = $('body'), 11070 $grid = $(val).addClass('init-ajax-grid'), 11071 starting_point = $grid.attr('data-toggle'), 11072 $trigger = $('.uncode-toggle-ajax-filters', $grid), 11073 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 11074 $isotope_wrapper = $('.isotope-wrapper', $grid), 11075 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 11076 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 11077 $footprint = $('.ajax-filter-footprint', $grid), 11078 sidebar_w, 11079 data_w = parseFloat( $sidebar.attr('data-max-width') ), 11080 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 11081 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 11082 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 11083 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 11084 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 11085 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 11086 sidew, 11087 $inside_row = $('> .row-parent', $vc_row), 11088 bg_row, 11089 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 11090 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 11091 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
11092 sidebar_overlay = false, 11093 sidebar_hover = false, 11094 switchMobile = false, 11095 scrollTop; 11096 11097 if ( $vc_row.attr('class') ) { 11098 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 11099 } 11100 11101 if ( bg_row != null ) { 11102 $side_header.add($side_footer).addClass(bg_row[0]); 11103 } 11104 11105 $trigger.add($apply_filters).on('click', function(e){ 11106 e.preventDefault(); 11107 e.stopPropagation(); 11108 $grid = $('.ajax-grid-system').eq(0); 11109 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 11110 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 11111 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 11112 sidebar_w = $sidebar_wrapper.width(); 11113 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 11114 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 11115 $(this).trigger('uncode-ajax-clear-filters'); 11116 } 11117 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 11118 $grid.toggleClass('ajax-hide-filters-blanks'); 11119 $sidebar.slideToggle({ 11120 duration: 400, 11121 easing: 'easeOutQuad', 11122 }); 11123 } else { 11124 $grid.removeClass('ajax-hide-filters-blanks'); 11125 $grid.toggleClass('ajax-hide-filters'); 11126 if ( $grid.hasClass('ajax-hide-filters') ) { 11127 $body.addClass('ajax-hide-filters'); 11128 } else { 11129 scrollTop = $('html, body').scrollTop(); 11130 $body.removeClass('ajax-hide-filters'); 11131 } 11132 } 11133 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 11134 $('html, body').scrollTop(scrollTop); 11135 } 11136 return false; 11137 }); 11138 11139 $close_btn.on('click', function(e){ 11140 e.preventDefault(); 11141 $grid = $('.ajax-grid-system').eq(0); 11142 $grid.addClass('ajax-hide-filters'); 11143 if ( $grid.hasClass('ajax-hide-filters') ) { 11144 $body.addClass('ajax-hide-filters'); 11145 } else { 11146 scrollTop = $('html, body').scrollTop(); 11147 $body.removeClass('ajax-hide-filters'); 11148 } 11149 $('html, body').scrollTop(scrollTop); 11150 }); 11151 11152 $sidebar_wrapper.on('mouseover',function(){ 11153 sidebar_hover = true; 11154 }).on('mouseout', function(){ 11155 sidebar_hover = false; 11156 }); 11157 11158 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 11159 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 11160 return; 11161 } 11162 if (undefined !== from && from === 'select_active_attributes') { 11163 return; 11164 } 11165 if ($(e.target).closest('.select2-container--open').length ) { 11166 return; 11167 } 11168 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 11169 $grid.add($body).addClass('ajax-hide-filters'); 11170 } 11171 }); 11172 11173 $sorting_trgr.on('click', function(e) { 11174 e.preventDefault(); 11175 }); 11176 11177 var inside_width = function(){ 11178 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 11179 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 11180 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 11181 $inside_row = $('> .row-parent', $vc_row); 11182 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 11183 sidew = $sidebar.width(); 11184 $inside_row.css({ 11185 width: sidew 11186 }); 11187 } else { 11188 $inside_row.css({ 11189 width: '' 11190 }); 11191 } 11192 }; 11193 inside_width(); 11194 11195 var ajax_sidebar_position = function(e, f_editor){ 11196 $grid = $('.ajax-grid-system').eq(0); 11197 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 11198 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 11199 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 11200 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 11201 $inside_row = $('> .row-parent', $vc_row); 11202 scrollTop = $('html, body').scrollTop(); 11203 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 11204 $grid.add($body).addClass('ajax-hide-filters'); 11205 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 11206 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas')); 11207 sidebar_overlay = true; 11208 $body.addClass('ajax-filter-sidebar-overlay'); 11209 $sidebar_wrapper.addClass(skin); 11210 var sideHeadH = $side_header.outerHeight(), 11211 sideFooterH = $side_footer.outerHeight(); 11212 if ( data_w !== '' && data_w > 0 ) { 11213 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 11214 $sidebar.css({ 11215 'max-width': data_w 11216 }); 11217 } else { 11218 $sidebar.css({ 11219 'max-width':'none' 11220 }); 11221 } 11222 } 11223 $vc_row.css({ 11224 'padding-top':sideHeadH, 11225 'padding-bottom':sideFooterH 11226 }); 11227 var sidew = $sidebar.width(); 11228 $inside_row.css({ 11229 width: sidew 11230 }); 11231 switchMobile = true; 11232 } else { 11233 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 11234 scrollTop = $('html, body').scrollTop(); 11235 $grid.add($body).removeClass('ajax-hide-filters'); 11236 } 11237 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 11238 $grid.addClass('ajax-hide-filters-blanks'); 11239 $sidebar.hide(); 11240 } 11241 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 11242 $('.ajax-sidebar-placeholder', $grid).remove();
11243 sidebar_overlay = false; 11244 $body.removeClass('ajax-filter-sidebar-overlay'); 11245 $sidebar_wrapper.removeClass(skin); 11246 if ( data_w !== '' && data_w > 0 ) { 11247 $sidebar.css({ 11248 'max-width':'none' 11249 }); 11250 } 11251 $vc_row.css({ 11252 'padding-top':0, 11253 'padding-bottom':0, 11254 }); 11255 11256 $inside_row.css({ 11257 width: '' 11258 }); 11259 11260 if ( f_editor === true ) { 11261 UNCODE.ajax_filters(); 11262 } 11263 11264 switchMobile = false; 11265 } 11266 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 11267 $('html, body').scrollTop(scrollTop); 11268 } 11269 }; 11270 11271 var sidebar_width = function(){ 11272 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 11273 sidebar_w = $footprint.width(); 11274 $sidebar.css({ width: sidebar_w }); 11275 } else { 11276 $sidebar.css({ width: '' }); 11277 } 11278 }; 11279 sidebar_width(); 11280 11281 if ( SiteParameters.is_frontend_editor ) { 11282 ajax_sidebar_position(); 11283 } 11284 11285 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 11286 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 11287 ajax_sidebar_position(e); 11288 } 11289 sidebar_width(); 11290 }); 11291 11292 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 11293 ajax_sidebar_position(e, true); 11294 }); 11295 11296 $isotope_wrapper.on('transitionend', function(e){ 11297 if ( $(e.target).hasClass('isotope-wrapper') ) { 11298 window.dispatchEvent(new CustomEvent('boxResized')); 11299 } 11300 return false; 11301 }); 11302 11303 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 11304 var $grid = $('.ajax-grid-system').eq(0); 11305 $grid.addClass('ajax-hide-filters'); 11306 } 11307 11308 }); 11309 }; 11310 11311 init_ajax_grid(); 11312 $(document).on('uncode-ajax-filtered', init_ajax_grid); 11313 11314/************************* 11315 * 11316 * Hover hack 11317 * 11318 ************************/ 11319 var widget_hover_hack = function() { 11320 $('.widget, .uncode_widget').each(function(){ 11321 var $widget = $(this), 11322 class_w = $widget.attr('class'), 11323 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 11324 $footer = $widget.closest('#colophon'); 11325 11326 if ( class_w.indexOf('widget_yith') > 0 ) { 11327 return true; 11328 } 11329 11330 $lis.each(function(){ 11331 var $li = $(this), 11332 $a = $('a', $li), 11333 $label = $a.closest('label'); 11334 11335 if ( !$footer.length ) { 11336 $li.addClass('no-evts'); 11337 } 11338 11339 if ( ! $('span', $a).length ) { 11340 $li.addClass( 'li-hover' ); 11341 } 11342 11343 $('li', $li).hover(function(e){ 11344 $(e.target).parents('li').each(function(){ 11345 $(this).addClass( 'parent-li-hover' ); 11346 }); 11347 }, function (e) { 11348 $(e.target).parents('li').each(function(key, val){ 11349 if ( key === 0) { 11350 $(val).removeClass( 'parent-li-hover' ); 11351 } 11352 }); 11353 }); 11354 11355 $li.off('mouseup').on('mouseup', function (e) { 11356 if (e.which !== 3) { 11357 e.stopPropagation(); 11358 var $a = $('a', this).first(); 11359 $a[0].click(); 11360 } 11361 }); 11362 }); 11363 }); 11364 } 11365 if (SiteParameters.disable_hover_hack !== '1') { 11366 widget_hover_hack(); 11367 $(document).on('uncode-ajax-filtered', widget_hover_hack); 11368 } 11369 11370/************************* 11371 * 11372 * Init Filters 11373 * 11374 ************************/ 11375 11376 function init_filters() { 11377 $(document).on('click', '.term-filter-link', function(e) { 11378 var _this = $(this); 11379 var widget = _this.closest('.uncode_widget'); 11380 var container = get_filters_container(); 11381 11382 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 11383 return true; 11384 } 11385 11386 e.preventDefault(); 11387 11388 if (widget.hasClass('widget-ajax-filters--checkbox')) { 11389 _this.parent().find('input[type="checkbox"]').trigger('click'); 11390 } else { 11391 if (_this.hasClass('term-filter-link--active')) { 11392 _this.removeClass('term-filter-link--active'); 11393 } else { 11394 _this.addClass('term-filter-link--active'); 11395 11396 if (widget.hasClass('widget-ajax-filters--single')) { 11397 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 11398 } 11399 } 11400 11401 var url = _this.attr('href'); 11402 11403 reload_items(container, url, true); 11404 } 11405 }); 11406 11407 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 11408 var _this = $(this); 11409 var widget = _this.closest('.uncode_widget'); 11410 var link = _this.closest('.term-filter').find('.term-filter-link'); 11411 var url = link.attr('href'); 11412 var container = get_filters_container(); 11413 11414 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 11415 window.location = url; 11416 return; 11417 } 11418 11419 if (widget.hasClass('widget-ajax-filters--single')) { 11420 widget.find('input[type="checkbox"]').each(function() { 11421 if (_this.attr('id') !== $(this).attr('id')) { 11422 $(this).prop('checked', false); 11423 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 11424 } 11425 }); 11426 } 11427 11428 if (_this.prop('checked')) { 11429 link.addClass('term-filter-link--active'); 11430 } else { 11431 link.removeClass('term-filter-link--active'); 11432 } 11433 11434 reload_items(container, url, true); 11435 }); 11436 11437 $(document).on('change', 'select.select--term-filters', function(e) { 11438 var _this = $(this); 11439 var selected = _this.find('option:selected'); 11440 var option = $(selected); 11441 var url = option.attr('data-term-filter-url'); 11442 var container = get_filters_container(); 11443 var widget = _this.closest('.uncode_widget'); 11444 11445 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 11446 window.location = url; 11447 } else { 11448 reload_items(container, url, true); 11449 } 11450 }); 11451 11452 $(document).on('click', '.filter-list__link', function(e) { 11453 if (SiteParameters.is_frontend_editor) { 11454 return false;
11455 } 11456 11457 e.preventDefault(); 11458 11459 var _this = $(this); 11460 var container = get_filters_container(); 11461 var url = _this.attr('href'); 11462 reload_items(container, url, true); 11463 }); 11464 11465 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 11466 var _this = $(this); 11467 var container = get_filters_container(); 11468 var url = _this.attr('href'); 11469 reload_items(container, url, true); 11470 }); 11471 11472 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 11473 11474 var _this = $(this); 11475 var container = get_filters_container(); 11476 var url = _this.attr('href'); 11477 11478 if ( container.length ) { 11479 e.preventDefault(); 11480 reload_items(container, url, true); 11481 } 11482 }); 11483 11484 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 11485 var _this = $(this); 11486 var container = get_filters_container(); 11487 11488 if (container.length > 0) { 11489 e.preventDefault(); 11490 11491 var min_price = $('#min_price').val(); 11492 var max_price = $('#max_price').val(); 11493 var location = window.location; 11494 var url = location.href; 11495 var page_uri = location.origin + location.pathname; 11496 var is_filtered = page_uri !== url; 11497 11498 if (is_filtered) { 11499 url = remove_parameter_from_url(url, 'min_price'); 11500 url = remove_parameter_from_url(url, 'max_price'); 11501 } 11502 11503 var concat = page_uri === url ? '?' : '&'; 11504 var params = {'min_price': min_price, 'max_price': max_price}; 11505 11506 url = url + concat + $.param(params); 11507 11508 reload_items(container, url, true); 11509 } 11510 }); 11511 11512 var search_timer; 11513 11514 $(document).on('keyup', '.term-filters-search-input', function(e) { 11515 var _this = $(this); 11516 var container = get_filters_container(); 11517 var value = _this.val(); 11518 11519 if (search_timer) { 11520 clearTimeout(search_timer); 11521 } 11522 11523 search_timer = setTimeout(function() { 11524 update_search_url(container, value); 11525 }, 500); 11526 }); 11527 } 11528 11529 function update_search_url(container, search_value) { 11530 var location = window.location; 11531 var url = location.href; 11532 var page_uri = location.origin + location.pathname; 11533 var is_filtered = page_uri !== url; 11534 var key_search = SiteParameters.ajax_filter_key_search; 11535 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 11536 11537 if (is_filtered) { 11538 url = remove_parameter_from_url(url, key_search); 11539 url = remove_parameter_from_url(url, key_unfilter); 11540 } 11541 11542 if (search_value) { 11543 var concat = page_uri === url ? '?' : '&'; 11544 var params = {}; 11545 11546 params[key_search] = search_value; 11547 params[key_unfilter] = 1; 11548 url = url + concat + $.param(params); 11549 } else { 11550 url = remove_parameter_from_url(url, key_search); 11551 } 11552 11553 reload_items(container, url, true); 11554 } 11555 11556 function remove_parameter_from_url(url, parameter) { 11557 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 11558 } 11559 11560 function get_filters_container() { 11561 var container = $('.ajax-grid-system'); 11562 11563 if (container.length == 0) { 11564 container = $('.ajax-filters'); 11565 } 11566 11567 return container; 11568 } 11569 11570 function update_widgets_state(widgets_states, container) { 11571 for (var i = widgets_states.length - 1; i >= 0; i--) { 11572 var state = widgets_states[i]; 11573 11574 if (!state.collapse) { 11575 continue; 11576 } 11577 11578 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 11579 11580 if (state.open) { 11581 new_widget.find('.widget-title').addClass('open'); 11582 if (state.css) { 11583 new_widget.find('.widget-collapse-content').attr('style', state.css); 11584 } 11585 } else { 11586 new_widget.find('.widget-title').removeClass('open'); 11587 if (state.css) { 11588 new_widget.find('.widget-collapse-content').attr('style', state.css); 11589 } 11590 } 11591 } 11592 } 11593 11594 // Reload items via AJAX 11595 function reload_items(container, url, push) { 11596 container.addClass('grid-filtering'); 11597 11598 $.ajax({ 11599 url : url, 11600 success : function(response) { 11601 if (!response) { 11602 return; 11603 } 11604 11605 $(document).trigger('uncode-ajax-pre-filtered'); 11606 11607 var container_id = container.attr('id'); 11608 var pagination = $('.row-navigation'); 11609 11610 if (container_id) { 11611 var container_to_append = $(response).find('#' + container_id); 11612 var pagination_to_append = $(response).find('.row-navigation'); 11613 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11614 11615 // Remember open/closed widgets 11616 var widgets = $('.uncode_widget'); 11617 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 11618 var widgets_states = []; 11619 11620 widgets.each(function() { 11621 var widget = $(this); 11622 var id = widget.attr('data-id'); 11623 var state = { 11624 'id': id, 11625 'collapse': false, 11626 'open': false, 11627 'css': false, 11628 }; 11629 11630 var collapse_wrapper = widget.find('.widget-collapse-content'); 11631 11632 if (collapse_wrapper.length > 0) { 11633 state.collapse = true; 11634 11635 var collapse_wrapper_css = collapse_wrapper.attr('style'); 11636 var title = widget.find('.widget-title'); 11637 11638 state.css = collapse_wrapper_css; 11639 11640 if (title.hasClass('open')) { 11641 state.open = true; 11642 } else { 11643 state.open = false;
11644 } 11645 } 11646 11647 widgets_states.push(state); 11648 }); 11649 11650 // Update widgets state 11651 if (offcanvas_sidebar_wrapper.length === 0) { 11652 update_widgets_state(widgets_states, container_to_append); 11653 } 11654 11655 // Update default sidebar state 11656 if (!container.hasClass('ajax-hide-filters')) { 11657 container_to_append.removeClass('ajax-hide-filters'); 11658 } 11659 11660 // Update horizontal sidebar 11661 if (!container.hasClass('ajax-hide-filters-blanks')) { 11662 container_to_append.removeClass('ajax-hide-filters-blanks'); 11663 } 11664 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 11665 if (horizontal_sidebar_wrapper.length > 0) { 11666 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 11667 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 11668 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 11669 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 11670 11671 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 11672 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 11673 } 11674 11675 // Append container 11676 container.replaceWith(container_to_append); 11677 11678 // Hide first thumbnail until the new srcset is loaded 11679 if (SiteParameters.dynamic_srcset_active === '1') { 11680 container_to_append.find('.tmb-woocommerce-variable-product').addClass('srcset-lazy-animations'); 11681 } 11682 11683 // Remove loading attribute to images 11684 container_to_append.find('img').attr('loading', ''); 11685 11686 // Append pagination 11687 if (pagination.length > 0) { 11688 if (pagination_to_append.length > 0) { 11689 pagination.html(pagination_to_append.html()); 11690 } else { 11691 pagination.html(''); 11692 } 11693 } else { 11694 if (pagination_to_append.length > 0) { 11695 $('.post-wrapper').append(pagination_to_append); 11696 } 11697 } 11698 11699 // Update off canvas sidebar (mobile and overlay) 11700 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11701 11702 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 11703 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 11704 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 11705 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 11706 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 11707 11708 // Update widgets state 11709 update_widgets_state(widgets_states, sidebar_to_append); 11710 11711 // Update sidebar 11712 sidebar_container.html(sidebar_to_append.html()); 11713 } 11714 11715 if (push) { 11716 UNCODE.lastURL = url; 11717 window.history.pushState( 11718 { pageTitle: document.title }, 11719 '', 11720 url 11721 ); 11722 } 11723 11724 if (typeof UNCODE.isotopeLayout !== 'undefined') { 11725 UNCODE.isotopeLayout(); 11726 } 11727 if (typeof UNCODE.justifiedGallery !== 'undefined') { 11728 UNCODE.justifiedGallery(); 11729 } 11730 if (typeof UNCODE.cssGrid !== 'undefined') { 11731 UNCODE.cssGrid(); 11732 } 11733 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 11734 UNCODE.lightbox(); 11735 } 11736 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 11737 UNCODE.lightgallery(); 11738 } 11739 if (typeof UNCODE.carousel !== 'undefined') { 11740 UNCODE.carousel($('body')); 11741 } 11742 UNCODE.animations(); 11743 if (typeof UNCODE.filters !== 'undefined') { 11744 UNCODE.filters(); 11745 } 11746 if (typeof UNCODE.widgets !== 'undefined') { 11747 UNCODE.widgets(); 11748 } 11749 11750 if (SiteParameters.dynamic_srcset_active === '1') { 11751 UNCODE.refresh_dynamic_srcset_size(); 11752 } 11753 11754 if (typeof UNCODE.menuSmartInit !== 'undefined') { 11755 UNCODE.menuSmartInit(); 11756 } 11757 11758 if (typeof UNCODE.parallax !== 'undefined') { 11759 UNCODE.parallax(); 11760 } 11761 11762 maybe_scroll_to_top(); 11763 11764 var woo_select2_cats = $('.dropdown_product_cat'); 11765 11766 if (woo_select2_cats.length > 0) { 11767 woo_select2_cats.on( 'change', function() { 11768 if ( $(this).val() != '' ) { 11769 var this_page = ''; 11770 var home_url = UncodeWCParameters.uncode_wc_widget_product_categories_home_url; 11771 if ( home_url.indexOf( '?' ) > 0 ) { 11772 this_page = home_url + '&product_cat=' + $(this).val(); 11773 } else { 11774 this_page = home_url + '?product_cat=' + $(this).val(); 11775 } 11776 location.href = this_page; 11777 } else { 11778 location.href = UncodeWCParameters.uncode_wc_widget_product_categories_shop_url; 11779 } 11780 }); 11781 11782 if ( $().selectWoo ) { 11783 var wc_product_cat_select = function() { 11784 woo_select2_cats.selectWoo( { 11785 placeholder: UncodeWCParameters.uncode_wc_widget_product_categories_placeholder, 11786 minimumResultsForSearch: 5, 11787 width: '100%', 11788 allowClear: true, 11789 language: { 11790 noResults: function() { 11791 return UncodeWCParameters.uncode_wc_widget_product_categories_no_results; 11792 } 11793 } 11794 } ); 11795 }; 11796 wc_product_cat_select(); 11797 } 11798 } 11799 11800 $(document).trigger('uncode-ajax-filtered'); 11801 $(document.body).trigger('init_price_filter'); 11802 window.dispatchEvent(new CustomEvent('uncode-ajax-filtered')); 11803 } 11804 }, 11805 error: function() {
11806 container.removeClass('grid-filtering'); 11807 11808 if (SiteParameters.enable_debug == true) { 11809 // This console log is disabled by default 11810 // So nothing is printed in a typical installation 11811 // 11812 // It can be enabled for debugging purposes setting 11813 // the 'uncode_enable_debug_on_js_scripts' filter to true 11814 console.log('There was an error retrieving the products'); 11815 } 11816 } 11817 }); 11818 } 11819 11820 // Scroll to top after filtering 11821 function maybe_scroll_to_top() { 11822 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11823 11824 if (offcanvas_sidebar_wrapper.length > 0) { 11825 return; 11826 } 11827 11828 var container = get_filters_container(); 11829 var bound = container[0].getBoundingClientRect(); 11830 11831 if (bound.y < 0) { 11832 $(window).scrollTop(container.offset().top); 11833 } 11834 } 11835 11836 // Back/forward browser buttons 11837 $(window).on("popstate.ajaxfilters", function(e) { 11838 var location = window.location; 11839 var url = location.href; 11840 var params = UNCODE.getURLParams(window.location); 11841 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 11842 11843 UNCODE.lastURL = url; 11844 11845 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 11846 return; 11847 } 11848 11849 var container = get_filters_container(); 11850 11851 reload_items(container, url, false); 11852 }); 11853 11854 // Destroy load more before to init a new one 11855 $(window).on('uncode-ajax-pre-filtered', function() { 11856 if ($.fn.infinitescroll) { 11857 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 11858 } 11859 }); 11860 11861 init_filters(); 11862}; 11863 11864UNCODE.videoThumbs = function() { 11865 var checkResize, 11866 newW = UNCODE.wwidth; 11867 var checkForVideos = function(){ 11868 11869 $(window).on('okevents.y.change', function(e, y){ 11870 var $video = $(y.target.g), 11871 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11872 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11873 restart = !$video_wrap.hasClass('play-pause'), 11874 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 11875 setTime; 11876 if ( newW >= UNCODE.mediaQuery ) { 11877 11878 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 11879 $video_wrap.data('hovered', true); 11880 $video_wrap.addClass('played-on'); 11881 y.target.pauseVideo(); 11882 $tmb.on('mouseenter', function(){ 11883 if ( restart ) { 11884 y.target.seekTo(0); 11885 } 11886 y.target.playVideo(); 11887 }).on('mouseleave', function(){ 11888 clearTimeout(setTime); 11889 setTime = setTimeout(function(){ 11890 y.target.pauseVideo(); 11891 }, 300); 11892 }); 11893 } 11894 11895 } else { 11896 if( $mobile_video_wrap.length ) { 11897 $video_wrap.addClass('played-on'); 11898 y.target.playVideo(); 11899 } 11900 } 11901 11902 }); 11903 11904 $(window).on('okevents.v.loaded', function(e, playerV){ 11905 var $video = $(playerV.element), 11906 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11907 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11908 restart = !$video_wrap.hasClass('play-pause'), 11909 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual, .un-inline-image'), 11910 setTime; 11911 11912 if ( newW >= UNCODE.mediaQuery ) { 11913 11914 if( $video_wrap.length ) { 11915 11916 var playPromise = playerV.play(); 11917 if (playPromise !== undefined) { 11918 playPromise.then(function( value ) { 11919 playerV.pause(); 11920 }); 11921 } 11922 $video_wrap.addClass('played-on'); 11923 $tmb.on('mouseenter', function(){ 11924 if ( restart ) { 11925 playerV.setCurrentTime(0) 11926 } 11927 playerV.play(); 11928 }).on('mouseleave', function(){ 11929 clearTimeout(setTime); 11930 setTime = setTimeout(function(){ 11931 playerV.pause(); 11932 }, 300); 11933 }); 11934 } 11935 11936 } else { 11937 11938 if( $mobile_video_wrap.length ) { 11939 var playPromise = playerV.play(); 11940 if (playPromise !== undefined) { 11941 playPromise.then(function( value ) { 11942 playerV.play(); 11943 }); 11944 } 11945 $video_wrap.addClass('played-on'); 11946 } 11947 } 11948 }); 11949 11950 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 11951 var $video = $(video), 11952 $noscript = $('noscript', $video), 11953 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11954 restart = !$video_wrap.hasClass('play-pause'), 11955 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11956 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
11956: $video.closest('.t-entry-visual, .un-inline-image'), 11957 setTime, 11958 manageVideo = function(){ 11959 video.currentTime = 0; 11960 video.pause(); 11961 if ( newW >= UNCODE.mediaQuery ) { 11962 if ( $video_wrap.length ) { 11963 $video_wrap.addClass('played-on'); 11964 $tmb.on('mouseenter', function(){ 11965 if ( restart ) { 11966 video.currentTime = 0; 11967 } 11968 video.play(); 11969 }).on('mouseleave', function(){ 11970 clearTimeout(setTime); 11971 setTime = setTimeout(function(){ 11972 video.pause(); 11973 }, 300); 11974 }); 11975 } else { 11976 video.play(); 11977 } 11978 } else { 11979 if ( $mobile_video_wrap.length ) { 11980 $mobile_video_wrap.addClass('played-on'); 11981 video.play(); 11982 } 11983 } 11984 11985 }; 11986 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 11987 $noscript.each(function(key, val){ 11988 $noscript.after(val.textContent || val.innerText); 11989 $noscript.remove(); 11990 }); 11991 } 11992 11993 if (typeof MediaElement === "function") { 11994 $video.has('source[src]').mediaelementplayer({ 11995 pauseOtherPlayers: false, 11996 }); 11997 } 11998 if (video.readyState > 0) { 11999 manageVideo(); 12000 } else { 12001 $video.on("loadedmetadata", function(_event) { 12002 manageVideo(); 12003 }); 12004 }; 12005 }); 12006 12007 }; 12008 12009 checkForVideos(); 12010 12011 var checkVideoResize = function(){ 12012 clearRequestTimeout(checkResize); 12013 checkResize = requestTimeout(function(){ 12014 if ( newW !== UNCODE.wwidth ) { 12015 checkForVideos(); 12016 newW = UNCODE.wwidth; 12017 } 12018 }, 1000); 12019 }; 12020 12021 $(window).off('resize.videos', checkVideoResize) 12022 .on( 'resize.videos', checkVideoResize); 12023 12024}; 12025UNCODE.inlineImgs = function() { 12026 var linkInlineImgs = function(){ 12027 $('.un-inline-image').each(function(){ 12028 var $img = $(this), 12029 href = $(this).attr('data-link-href'), 12030 dataImg = $img.data(); 12031 if ( dataImg != '' && href != null && href !== '' ) { 12032 var class_stra_a = 'unline-image-link'; 12033 if ( $(this).hasClass('un-inline-space-over') ) { 12034 class_stra_a += ' un-inline-space-over'; 12035 } else if ( $(this).hasClass('un-inline-space-gutter') ) { 12036 class_stra_a += ' un-inline-space-gutter'; 12037 } 12038 var str_a = '<a class="' + class_stra_a + '" '; 12039 for (var key in dataImg) { 12040 if (dataImg.hasOwnProperty(key) && key.startsWith("link")) { 12041 str_a += " " + key.slice(4).toLowerCase() + "=\"" + dataImg[key] + "\""; 12042 } 12043 } 12044 str_a += ' />'; 12045 $img.wrap(str_a); 12046 } 12047 }); 12048 }; 12049 $(window).on('load', linkInlineImgs ); 12050}; 12051UNCODE.lottie = function() { 12052 if ( SiteParameters.is_frontend_editor ) { 12053 var $lottie_wraps = $('div.uncode-lottie-wrap'); 12054 $lottie_wraps.each(function(){ 12055 var $lottie_wrap = $(this), 12056 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 12057 $player_clone = $div_player.clone(), 12058 player_id = $div_player.attr('data-id'), 12059 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 12060 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 12061 if ( $('#'+player_id).length ) { 12062 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 12063 } 12064 $player_clone.attr('id', player_id); 12065 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 12066 $div_player.after($player_clone); 12067 $div_player.attr('data-init',true); 12068 } 12069 }); 12070 } 12071 var $players = $('.uncode-lottie-wrap lottie-player'); 12072 $players.each(function(){ 12073 var player = this, 12074 this_id = $(player).attr('id'), 12075 _player = document.getElementById(this_id), 12076 trigger = $(player).attr('data-trigger'), 12077 pFrames = $(player).attr('data-frames').split(','), 12078 srcPlayer = $(player).attr('src'); 12079 12080 _player.load(srcPlayer); 12081 12082 _player.addEventListener("ready", function() { 12083 12084 var $_shadow = _player.shadowRoot; 12085 $($_shadow).find('.error').remove(); 12086 12087 var tFrames = _player.getLottie().totalFrames / 100, 12088 pFrame_from = Math.round(tFrames * pFrames[0]), 12089 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 12090 loop = $(player).attr('loop'), 12091 mode, 12092 actions; 12093 12094 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 12095 if ( trigger === 'scroll' ) { 12096 mode = 'scroll'; 12097 actions = [ 12098 { 12099 visibility:[0, 1.0], 12100 type: "seek",
12101 frames: [pFrame_from, pFrame_to], 12102 } 12103 ]; 12104 } else if ( trigger === 'viewport') { 12105 mode = 'scroll'; 12106 actions = [ 12107 { 12108 visibility: [0.20, 1.0], 12109 frames: [pFrame_from, pFrame_to], 12110 type: loop ? "loop" : "play" 12111 } 12112 ]; 12113 } else if ( trigger === 'hover') { 12114 $(player).on('mouseenter', function(){ 12115 _player.play(); 12116 }).on('mouseleave', function(){ 12117 _player.pause(); 12118 }); 12119 if ( pFrame_from > 0 && pFrame_from < 99 ) { 12120 _player.seek(pFrame_from); 12121 _player.addEventListener("frame", function(){ 12122 if ( _player.getLottie().currentFrame >= pFrame_to ) { 12123 _player.seek(pFrame_from); 12124 } 12125 }); 12126 } 12127 } 12128 LottieInteractivity.create({
12129 player: '#' + this_id, 12130 mode: mode, 12131 actions: actions 12132 }); 12133 } else { 12134 if ( pFrame_from > 0 && pFrame_from < 99 ) { 12135 _player.seek(pFrame_from); 12136 _player.addEventListener("frame", function(){ 12137 if ( _player.getLottie().currentFrame >= pFrame_to ) { 12138 _player.seek(pFrame_from); 12139 } 12140 }); 12141 } 12142 } 12143 }); 12144 12145 $(window).on('unlottie-destroy', function(){ 12146 _player.destroy(); 12147 }); 12148 }); 12149}; 12150 12151UNCODE.animatedBgGradient = function( _el ) { 12152 12153 var ev; 12154 12155 if ( typeof _el === 'undefined' || _el === null ) { 12156 _el = document; 12157 ev = false; 12158 } else { 12159 _el = _el[0]; 12160 ev = 'shortcode:update'; 12161 } 12162 12163 var simplex = new SimplexNoise(); 12164 12165 var Uncode_BG_Animated_Gradient = function(blockOverlay, canvasWrap) { 12166 this.block = blockOverlay; 12167 this.wrap = canvasWrap; 12168 this.config(); 12169 this.checker(); 12170 this.loopRAF(); 12171 this.animLoader(); 12172 }; 12173 12174 var AnimGradient = Uncode_BG_Animated_Gradient.prototype; 12175 12176 AnimGradient.config = function() { 12177 this.canvas = document.createElement('canvas'); 12178 this.wrap.appendChild(this.canvas); 12179 this.ctx = this.canvas.getContext('2d'); 12180 this.count = 0; 12181 this.isOrientationChanged = false; 12182 this.res = UNCODE.isMobile ? 90 : 110; 12183 this.resPercent = 100/this.res; 12184 this.resAround = this.resPercent/100; 12185 this.size = typeof this.block.getAttribute('data-bg-noise-size') !== 'undefined' && this.block.getAttribute('data-bg-noise-size') !== null && this.block.getAttribute('data-bg-noise-size') !== '' ? this.block.getAttribute('data-bg-noise-size') : 1; 12186 12187 this.canvas.classList.add('uncode-bg-animated-gradient'); 12188 this.canvas.setAttribute('height', this.res); 12189 this.canvas.setAttribute('width', this.res); 12190 this.canvas.style = 'height: 100%; position: relative; width:100%;'; 12191 12192 this.imgdata = this.ctx.getImageData(0, 0, this.canvas.width, this.canvas.height); 12193 12194 this.cx = this.canvas.width/2; 12195 this.cy = this.canvas.height/2; 12196 this.data = this.imgdata.data; 12197 12198 this.opts = { 12199 col_1st: typeof this.block.getAttribute('data-bg-noise-1') !== 'undefined' && this.block.getAttribute('data-bg-noise-1') !== null && this.block.getAttribute('data-bg-noise-1') !== '' ? this.block.getAttribute('data-bg-noise-1') : false, 12200 col_2nd: typeof this.block.getAttribute('data-bg-noise-2') !== 'undefined' && this.block.getAttribute('data-bg-noise-2') !== null && this.block.getAttribute('data-bg-noise-2') !== '' ? this.block.getAttribute('data-bg-noise-2') : false, 12201 time: typeof this.block.getAttribute('data-bg-noise-speed') !== 'undefined' && this.block.getAttribute('data-bg-noise-speed') !== null && this.block.getAttribute('data-bg-noise-speed') !== '' ? parseFloat(this.block.getAttribute('data-bg-noise-speed')) : 250,//100,250,1500 12202 }; 12203 12204 this.lavaTime = 1; 12205 this.bg_colors = []; 12206 12207 if ( this.opts.col_1st === false && this.opts.col_2nd === false ) { 12208 return; 12209 } 12210 12211 if( this.opts.col_1st === this.opts.col_2nd || this.opts.col_2nd == false ) { 12212 this.singleColor = true; 12213 } 12214 12215 if( this.opts.col_1st ) { 12216 12217 var rgbColor1 = this.hexToRGB(this.opts.col_1st); 12218 12219 this.bg_colors.push({ 12220 r: rgbColor1.r, 12221 g: rgbColor1.g, 12222 b: rgbColor1.b 12223 }); 12224 } 12225 12226 if( this.opts.col_2nd ) { 12227 12228 var rgbColor2 = this.hexToRGB(this.opts.col_2nd); 12229 12230 this.bg_colors.push({ 12231 r: rgbColor2.r, 12232 g: rgbColor2.g, 12233 b: rgbColor2.b 12234 }); 12235 } 12236 12237 }; 12238 12239 AnimGradient.checker = function() { 12240 var scope = this; 12241 this.checkInViewPort(); 12242 12243 window.addEventListener('resize', function() { 12244 if(UNCODE.isMobile && !scope.isOrientationChanged) { 12245 return; 12246 } 12247 scope.ratioCalc(); 12248 }); 12249 12250 window.addEventListener("orientationchange", function() { 12251 scope.isOrientationChanged = true; 12252 }); 12253 12254 this.ratioCalc(); 12255 }; 12256 12257 AnimGradient.ratioCalc = function() { 12258 12259 var blockW = this.block.clientWidth, 12260 blockH = this.block.clientHeight; 12261 12262 var blockRatio = blockH/blockW; 12263 12264 if(blockRatio < 1) { 12265 this.ratioParam = { 12266 x: 1.4, 12267 y: blockRatio*1.4 12268 } 12269 } else { 12270 this.ratioParam = { 12271 x: blockRatio/3, 12272 y: 1 12273 } 12274 } 12275 12276 }; 12277 12278 AnimGradient.checkInViewPort = function() { 12279 if( 'IntersectionObserver' in window ) { 12280 var scope = this, 12281 observer = new IntersectionObserver(function(entries) { 12282
12283 entries.forEach(function(entry){ 12284 if ( entry.isIntersecting ) { 12285 scope.isInViewport = true; 12286 } else { 12287 scope.isInViewport = false; 12288 } 12289 }); 12290 12291 }, { 12292 root: document, 12293 }); 12294 12295 observer.observe(this.block); 12296 } 12297 }; 12298 12299 AnimGradient.hexToRGB = function(hexval) { 12300 var hexecuted = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hexval); 12301 if (!hexecuted) { 12302 return false; 12303 } 12304 return { 12305 r: parseInt(hexecuted[1], 16), 12306 g: parseInt(hexecuted[2], 16), 12307 b: parseInt(hexecuted[3], 16) 12308 } 12309 }; 12310 12311 AnimGradient.factor = function(val_1, val_2, lava) { 12312 return val_1 * (1 - lava) + val_2 * lava; 12313 }; 12314 12315 AnimGradient.factorNoise = function(wave_l, x, y, noise) { 12316 if (this.singleColor) { 12317 return this.bg_colors[0][wave_l]; 12318 } 12319 return this.factor(this.bg_colors[0][wave_l], this.bg_colors[1][wave_l], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*3.5)*noise/2 ); 12320 // return this.factor(this.bg_colors[0][channel], this.bg_colors[1][channel], (this.lava(x,y,this.count*this.lavaTime) * this.resAround*2) ); 12321 }; 12322 12323 AnimGradient.lava = function(x, y, grade) { 12324 var radians = (Math.PI / 180) * grade, 12325 cos = Math.cos(radians), 12326 sin = Math.sin(radians), 12327 nx = (cos * (x - this.cx)) + (sin * (y - this.cy)) + this.cx; 12328 return nx; 12329 }; 12330 12331 AnimGradient.loopRAF = function() { 12332 12333 var scope = this; 12334 12335 if( this.isInViewport ) { 12336 for (var x = 0; x < this.res; x++) { 12337 for (var y = 0; y < this.res; y++) { 12338 12339 var noise = simplex.noise3D((x / this.res * this.ratioParam.x)*this.size, (y / this.res * this.ratioParam.y)*this.size, this.count/this.opts.time); //original 12340 12341 this.data[(x + y * this.res) * 4 + 0] = this.factorNoise('r', x, y, noise); 12342 this.data[(x + y * this.res) * 4 + 1] = this.factorNoise('g', x, y, noise); 12343 this.data[(x + y * this.res) * 4 + 2] = this.factorNoise('b', x, y, noise); 12344 this.data[(x + y * this.res) * 4 + 3] = noise*265; 12345 12346 } 12347 } 12348 12349 this.count++; 12350 12351 this.ctx.putImageData(this.imgdata, 0, 0); 12352 12353 } 12354 12355 requestAnimationFrame(function() { 12356 scope.loopRAF(); 12357 }); 12358 }; 12359 12360 AnimGradient.animLoader = function() { 12361 this.wrap.classList.add('uncode-canvas-bg-noise-wrap-loaded'); 12362 }; 12363 12364 var anim_init = function() { 12365 var bgs = _el.querySelectorAll('.block-bg-overlay'); 12366 12367 bgs.forEach(function(blockOverlay) { 12368 var canvasWrap = blockOverlay.querySelector('.uncode-canvas-bg-noise-wrap'); 12369 if( !blockOverlay || !canvasWrap ) { 12370 return; 12371 } 12372 new Uncode_BG_Animated_Gradient(blockOverlay, canvasWrap); 12373 }); 12374 } 12375 12376 $(window).on('load', function(){ 12377 anim_init(); 12378 }); 12379 12380 if ( ev === 'shortcode:update' ) { 12381 anim_init(); 12382 } 12383 12384}; 12385UNCODE.multibg = function(){ 12386 var $bgsWraps = $('.uncode-multi-bgs'), 12387 $body = $('body'); 12388 $bgsWraps.each(function(){ 12389 var $bgWrap = $(this), 12390 transition = $bgWrap.attr('data-transition'), 12391 transitionTime = $bgWrap.attr('data-transition-time'), 12392 dataPace = $bgWrap.attr('data-transition-pace'), 12393 dataThreshold = $bgWrap.attr('data-transition-threshold'), 12394 dataTime = $bgWrap.attr('data-carousel-time'), 12395 dataMobileCarousel = $bgWrap.attr('data-carousel-mobile'), 12396 random = $bgWrap.attr('data-multi-random'), 12397 _bgWrap = $bgWrap[0], 12398 $multiBgs = $('.multi-background', $bgWrap), 12399 imgFirst, 12400 bgAmount = $multiBgs.length, 12401 isInViewport = false, 12402 lastScrollTop = 0, 12403 counter = 0, 12404 totMove = 0, 12405 autoScroll = typeof dataPace === 'undefined' && transition === 'scroll', 12406 pace = typeof dataPace !== 'undefined' && dataPace !== '' ? parseFloat(dataPace) : ( transition === 'scroll' ? 20 : 200 ), 12407 threshold = typeof dataThreshold !== 'undefined' && dataThreshold !== '' ? parseFloat(dataThreshold) : 0, 12408 offX, offY, 12409 wait = typeof transitionTime !== 'undefined' && transitionTime !== '' ? parseFloat(transitionTime)+1 : 250, 12410 carouselTime = typeof dataTime !== 'undefined' && dataTime !== '' ? parseFloat(dataTime) : 5000, 12411 requestCarousel, 12412 is_header = $bgWrap.closest('#page-header').length, 12413 startTime = new Date(); 12414 12415 transition = typeof transition === 'undefined' ? '' : transition; 12416 12417 if ( random === 'true' ) { 12418 UNCODE.shuffle($multiBgs); 12419 } 12420 12421 imgFirst = $multiBgs.first().find('.background-inner').css('background-image').replace('url(','').replace(')','').replace(/\"/gi, ""); 12422 12423 var loadFirst = function(){
12424 $multiBgs.first().attr('data-load', 'loaded').stop(true,false).animate({ 12425 opacity: 1 12426 }, 250, 'easeInQuad').css({ 12427 zIndex: 1 12428 }); 12429 } 12430 12431 var loadError = function(){ 12432 console.log('Multi BG loading error'); 12433 } 12434 12435 UNCODE.checkImgLoad( imgFirst, loadFirst, loadError ); 12436 12437 var loadSlides = function( $thisBg ){ 12438 $thisBg.attr('data-load', 'loaded'); 12439 } 12440 12441 $multiBgs.not('[data-load="loaded"]').each(function(ind, val){ 12442 var $thisBg = $(val); 12443 12444 if ( typeof $thisBg !== 'undefined' && $thisBg.length ) { 12445 12446 var _imgBg = $(val).find('.background-inner').css('background-image'); 12447 12448 if ( typeof _imgBg === 'undefined' || _imgBg === '' || _imgBg === 'none' ) { 12449 $thisBg.attr('data-load', 'loaded'); 12450 } else { 12451 _imgBg = _imgBg.replace('url(','').replace(')','').replace(/\"/gi, ""); 12452 if ( typeof _imgBg !== 'undefined' ) { 12453 UNCODE.checkImgLoad( _imgBg, loadSlides, loadError, $thisBg ); 12454 } 12455 } 12456 } 12457 }); 12458 12459 var multiCarousel = function(e) { 12460 12461 clearRequestTimeout(requestCarousel); 12462 12463 var checkTime = new Date(); 12464 if ( checkTime - startTime >= carouselTime && isInViewport ) { 12465 var $checkEl = $multiBgs.eq((counter+1)%bgAmount); 12466 12467 if ( $checkEl.attr('data-load') !== 'loaded' ) { 12468 requestTimeout(function(){
12469 multiCarousel(); 12470 }, 100); 12471 return; 12472 } 12473 12474 counter++; 12475 12476 $multiBgs.each(function(ind, val){ 12477 if ( ind === counter%bgAmount ) { 12478 $(val).stop(true,false).animate({ 12479 opacity: 1 12480 }, wait, 'easeInQuad').css({ 12481 zIndex: 1 12482 }); 12483 } else { 12484 $(val).stop(true,false).animate({ 12485 opacity: 0 12486 }, wait, 'easeInQuad').css({ 12487 zIndex: 0 12488 }); 12489 } 12490 }); 12491 12492 } 12493 12494 if ( transition === '' || UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 12495 requestCarousel = requestTimeout(multiCarousel, carouselTime); 12496 } 12497 12498 }; 12499 12500 var multiMove = function(e) { 12501 if ( $body.hasClass('navbar-hover') ) { 12502 return; 12503 } 12504 var checkTime = new Date(), 12505 bound = $bgWrap[0].getBoundingClientRect(), 12506 windowTop = (window.clientYOffset || document.documentElement.scrollTop); 12507 if (offX) { 12508 totMove += Math.sqrt( 12509 Math.pow(offY - e.clientY, 2) + Math.pow(offX - e.clientX, 2) 12510 ); 12511 } 12512 if ( 12513 totMove >= pace && 12514 checkTime - startTime >= wait && 12515 e.clientX <= (bound.left + bound.width) && 12516 e.clientX >= bound.left && 12517 e.clientY <= (bound.top + bound.height) && 12518 e.clientY >= bound.top 12519 ) { 12520 counter++; 12521 startTime = checkTime; 12522 $multiBgs.each(function(ind, val){ 12523 if ( ind === counter%bgAmount ) { 12524 $(val).stop(true,false).animate({ 12525 opacity: 1 12526 }, wait, 'easeInQuad').css({ 12527 zIndex: 1 12528 }); 12529 } else { 12530 $(val).stop(true,false).animate({ 12531 opacity: 0 12532 }, wait, 'easeInQuad').css({ 12533 zIndex: 0 12534 }); 12535 } 12536 }); 12537 12538 totMove = 0; 12539 } 12540 12541 offX = e.clientX; 12542 offY = e.clientY; 12543 12544 }; 12545 12546 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 12547 document.addEventListener("mousemove", multiMove); 12548 } 12549 12550 window.addEventListener('resize', function() { 12551 if ( transition === 'mouse' && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 12552 document.removeEventListener("mousemove", multiMove); 12553 document.addEventListener("mousemove", multiMove); 12554 } 12555 }); 12556 12557 var lightLoopRAF = function() { 12558 12559 var scrollTop = (window.clientYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0), 12560 checkTime = new Date(), 12561 bound = $bgWrap[0].getBoundingClientRect(), 12562 thresholdHeader = is_header ? 100 : threshold, 12563 rePace = ((bound.height - bound.height * threshold / 100) / 100 * pace)+((bound.height - bound.height * thresholdHeader / 100) / 100 * pace); 12564 if ( Math.abs(lastScrollTop - scrollTop) >= rePace ) { 12565 counter++; 12566 lastScrollTop = scrollTop; 12567 startTime = checkTime; 12568 12569 $multiBgs.each(function(ind, val){ 12570 if ( ind === counter%bgAmount ) { 12571 $(val).stop(true,false).animate({ 12572 opacity: 1 12573 }, wait, 'easeInQuad').css({ 12574 zIndex: 1 12575 }); 12576 } else { 12577 $(val).stop(true,false).animate({ 12578 opacity: 0 12579 }, wait, 'easeInQuad').css({ 12580 zIndex: 0 12581 }); 12582 } 12583 }); 12584 12585 } 12586 12587 requestAnimationFrame(function() { 12588 if ( isInViewport ) { 12589 lightLoopRAF(); 12590 } 12591 }); 12592 }; 12593 12594 var currentInd = 0; 12595 12596 var loopRAF = function() { 12597 12598 var multiBgRotate = function(slideInd){ 12599 currentInd = slideInd; 12600 $multiBgs.each(function(ind, val){ 12601 if ( ind === slideInd ) { 12602 $(val).stop(true,false).animate({ 12603 opacity: 1 12604 }, wait, 'easeInQuad').css({ 12605 zIndex: 1 12606 }); 12607 } else { 12608 $(val).stop(true,false).animate({ 12609 opacity: 0 12610 }, wait, 'easeInQuad').css({ 12611 zIndex: 0 12612 }); 12613 } 12614 }); 12615 }; 12616 var bound = $bgWrap[0].getBoundingClientRect(), 12617 thresholdPX = UNCODE.wheight * threshold / 100, 12618 totMove = (UNCODE.wheight + bound.height) - (thresholdPX * (parseFloat(2 - is_header))), 12619 movePX = totMove / bgAmount, 12620 moving = UNCODE.wheight - (bound.top + thresholdPX), 12621 slideInd = 0; 12622 12623 if ( (UNCODE.wheight-bound.top) < thresholdPX && 0 !== currentInd ) { 12624 multiBgRotate(0); 12625 } else if ( bound.top + bound.height < thresholdPX && bgAmount-1 !== currentInd ) { 12626 multiBgRotate(bgAmount-1); 12627 } else { 12628 slideInd = Math.ceil(moving/movePX) - 1; 12629 if ( slideInd < 0 ) { 12630 slideInd = 0; 12631 } else if ( slideInd >= bgAmount ) { 12632 slideInd = bgAmount-1; 12633 } 12634 if ( slideInd !== currentInd ) { 12635 multiBgRotate(slideInd); 12636 } 12637 } 12638 12639 requestAnimationFrame(function() { 12640 if ( isInViewport ) { 12641 loopRAF(); 12642 } 12643 }); 12644 }; 12645 12646 if( 'IntersectionObserver' in window ) { 12647 var observer = new IntersectionObserver(function(entries) { 12648
12649 entries.forEach(function(entry){ 12650 if ( entry.isIntersecting ) { 12651 isInViewport = true; 12652 if ( transition === 'scroll' ) { 12653 if ( autoScroll ) { 12654 loopRAF(); 12655 } else { 12656 lightLoopRAF(); 12657 } 12658 } else { 12659 multiCarousel(); 12660 } 12661 } else { 12662 isInViewport = false; 12663 } 12664 }); 12665 12666 }, { 12667 root: document, 12668 rootMargin: is_header ? '-' + threshold + '% 0px 100% 0px' : '-' + threshold + '% 0px' 12669 }); 12670 12671 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 12672 observer.observe(_bgWrap); 12673 } 12674 12675 window.addEventListener('resize', function() { 12676 observer.unobserve(_bgWrap); 12677 if ( transition !== 'mouse' || ( transition === 'mouse' && UNCODE.wwidth <= UNCODE.mediaQueryMobile && dataMobileCarousel === "yes" ) ) { 12678 observer.observe(_bgWrap); 12679 } 12680 }); 12681 12682 } 12683 12684 }); 12685} 12686 12687UNCODE.owlNav = function(target, ev) { 12688 target = target.replace(/#\S+/g, ''); 12689 var $carousel = $('#'+target), 12690 $slider = $carousel.closest('.uncode-slider'), 12691 $checkNavs = $('.uncode-owl-nav'); 12692 if ( !$checkNavs.length ) { 12693 return; 12694 } 12695 12696 if ( $slider.length ){ 12697 target = $slider.attr('id'); 12698 } 12699 12700 var $navs = $('.uncode-owl-nav[data-target="#' + target + '"]'), 12701 $row; 12702 12703 if ( ! $navs.length ) { 12704 $row = $carousel.closest('.vc_row.row-container'); 12705 $navs = $('.uncode-owl-nav:not([data-target])', $row); 12706 } 12707 12708 if ( ! $navs.length ) { 12709 return; 12710 } 12711 12712 $navs.each(function(){ 12713 var $nav = $(this), 12714 $outer = $nav.closest('.uncode-owl-nav-out'), 12715 $inner = $nav.find('.uncode-owl-nav-in'), 12716 $navDots = $('.uncode-nav-dots', $nav), 12717 $navCounter = $('.uncode-nav-counter', $nav), 12718 $counterIndex = $('.uncode-nav-counter-index', $navCounter), 12719 $counterTotal = $('.uncode-nav-counter-total', $navCounter), 12720 skinInherit = $nav.hasClass('skin-inherit'), 12721 digit = parseFloat($nav.attr('data-digit')), 12722 counterDigit = parseFloat($nav.attr('data-counter-digit')), 12723 navSpeed = parseFloat($carousel.attr('data-navspeed')); 12724 navSpeed = typeof navSpeed !== 'undefined' && navSpeed !== '' ? navSpeed : 400; 12725 12726 if ( $nav.hasClass('pos-abs') ){ 12727 if ( ! $carousel.closest('.owl-carousel-wrapper-nav').length ) { 12728 $carousel.closest('.owl-carousel-wrapper').wrap('<div class="owl-carousel-wrapper-nav" />'); 12729 } 12730 $carousel.closest('.owl-carousel-wrapper-nav').append($outer); 12731 } 12732 12733 $carousel.on('refreshed.owl.carousel', counter); 12734 $carousel.on('resized.owl.carousel', counter); 12735 $carousel.on('changed.owl.carousel', counter); 12736 12737 var totalSlides = 0; 12738 12739 function counter(event) { 12740 if (!event.namespace) { 12741 return; 12742 } 12743 var slides = event.relatedTarget, 12744 current = slides._current, 12745 loop = SiteParameters.is_frontend_editor && slides.closest('.uncode-slider').length ? false : slides.settings.loop, 12746 item = event.item, 12747 page = event.page, 12748 countPages = Math.ceil(item.count / page.size), 12749 $currentSlide = $carousel.find('.owl-item').eq(current), 12750 itemIndex = Math.floor($currentSlide.attr('data-index')) , 12751 activeSlide = Math.ceil(itemIndex / page.size), 12752 $prev = $nav.find('.uncode-nav-prev'), 12753 $next = $nav.find('.uncode-nav-next'), 12754 $col = $currentSlide.find('.uncol').first(); 12755 12756 if ( totalSlides != countPages ) { 12757 totalSlides = countPages; 12758 $navDots.html(''); 12759 var nav_html = ''; 12760 for (var sl_ind = 0; sl_ind < countPages; sl_ind++) { 12761 var padN = sl_ind+1; 12762 if ( digit && digit > 1 ) { 12763 padN = String(padN).padStart(digit, '0'); 12764 } 12765 nav_html += '<span class="uncode-nav-index" data-key="' + Math.floor(sl_ind*page.size) + '"><span>' + padN + '</span></span>'; 12766 } 12767 $navDots.html(nav_html); 12768 12769 var totalSlidesDigit = totalSlides; 12770 12771 if ( counterDigit && counterDigit > 1 ) { 12772 totalSlidesDigit = String(totalSlidesDigit).padStart(counterDigit, '0'); 12773 } 12774 $counterTotal.html(totalSlidesDigit); 12775 } 12776 12777 if ( loop !== true ) { 12778 $nav.find('.uncode-nav-disabled').removeClass('uncode-nav-disabled'); 12779 if ( itemIndex === 1 ) { 12780 $prev.addClass('uncode-nav-disabled'); 12781 } else if ( ( itemIndex - 1 + page.size ) >= item.count ) { 12782 $next.addClass('uncode-nav-disabled');
12783 activeSlide = Math.ceil(item.count / page.size); 12784 } 12785 } 12786 12787 $nav.find('.uncode-nav-index').removeClass('active-index').eq(activeSlide-1).addClass('active-index'); 12788 var activeSlideDigit = activeSlide; 12789 12790 if ( counterDigit && counterDigit > 1 ) { 12791 activeSlideDigit = String(activeSlideDigit).padStart(counterDigit, '0'); 12792 } 12793 $counterIndex.html(activeSlideDigit); 12794 12795 if ( skinInherit ) { 12796 if ( $col.hasClass('style-light') ){ 12797 $nav.removeClass('style-dark').addClass('style-light'); 12798 } else if ( $col.hasClass('style-dark') ) { 12799 $nav.removeClass('style-light').addClass('style-dark'); 12800 } 12801 } 12802 12803 $inner.removeClass('uncode-owl-nav-waiting'); 12804 12805 if ( $nav.hasClass('outer-width') ) { 12806 var navW = $nav.outerWidth(), 12807 nexW = $next.outerWidth(), 12808 prevW = $prev.outerWidth(), 12809 margins = Math.abs( parseFloat( $next.css('margin-left') ) ) + Math.abs( parseFloat( $next.css('margin-right') ) ); 12810 12811 if ( $nav.hasClass('h-align-justify') ) { 12812 $inner.css({'max-width': 'calc(100vw - ' + (nexW + prevW + (margins*2)) + 'px)'}); 12813 if ( navW + nexW + prevW + (margins*2) > UNCODE.wwidth ) { 12814 $inner.css({'margin': 'auto'}); 12815 } else { 12816 $inner.css({'margin': ''}); 12817 } 12818 } else { 12819 $inner.css({'max-width': 'calc(100vw - ' + (2*(nexW + prevW + margins)) + 'px)'}); 12820 if ( navW + (2*(nexW + prevW + margins)) > UNCODE.wwidth ) { 12821 $inner.css({'margin': 'auto'}); 12822 } else { 12823 $inner.css({'margin': ''}); 12824 } 12825 } 12826 } 12827 } 12828 12829 $nav.off('click', '.uncode-nav-index'); 12830 $nav.on('click', '.uncode-nav-index', function(){ 12831 var $bullet = $(this), 12832 slide_index = parseFloat( $bullet.attr('data-key') ); 12833 $carousel.trigger("to.owl.carousel", [slide_index, navSpeed, true]); 12834 }); 12835 $nav.off('click', '.uncode-nav-prev'); 12836 $nav.on('click', '.uncode-nav-prev', function(){ 12837 $carousel.trigger('prev.owl.carousel', [navSpeed]); 12838 }); 12839 $nav.off('click', '.uncode-nav-next'); 12840 $nav.on('click', '.uncode-nav-next', function(){ 12841 $carousel.trigger('next.owl.carousel', [navSpeed]); 12842 }); 12843 12844 if ( $nav.hasClass('animated-arrows') ) { 12845 $('.uncode-nav-prev, .uncode-nav-next', $nav).on('mouseenter', function(){ 12846 $(this).addClass("hover"); 12847 }).on('animationend', function(){ 12848 $(this).removeClass("hover"); 12849 }); 12850 } 12851 12852 var positionNav = function(){ 12853 if ( $nav.hasClass('window-width') ) { 12854 var navOff = parseFloat( $nav.offset().left ) * -1; 12855 if ( navOff > 0 ) { 12856 $inner.css({ transform: 'translateX(' + navOff + 'px)' }); 12857 } else { 12858 $inner.css({ transform: 'none' }); 12859 } 12860 } 12861 } 12862 positionNav(); 12863 $(window).on('resize', positionNav); 12864 }); 12865 12866 $carousel.closest('.owl-carousel-container').find('.uncode-owl-nav').addClass('appended'); 12867}; 12868 12869 UNCODE.init = function() { 12870 var wfl_check = false, wfl_request, waypoint_request; 12871 UNCODE.preventDoubleTransition(); 12872 UNCODE.betterResize(); 12873 UNCODE.utils(); 12874 UNCODE.magnetic(); 12875 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 12876 UNCODE.changeSkinOnScroll(); 12877 } 12878 if (typeof UNCODE.share !== 'undefined') { 12879 UNCODE.share(); 12880 } 12881 if (typeof UNCODE.tooltip !== 'undefined') { 12882 UNCODE.tooltip(); 12883 } 12884 if (typeof UNCODE.counters !== 'undefined') { 12885 UNCODE.counters(); 12886 } 12887 if (typeof UNCODE.countdowns !== 'undefined') { 12888 UNCODE.countdowns(); 12889 } 12890 if (typeof UNCODE.tabs !== 'undefined') { 12891 UNCODE.tabs(); 12892 } 12893 if (typeof UNCODE.collapse !== 'undefined') { 12894 UNCODE.collapse(); 12895 } 12896 if (typeof UNCODE.bigText !== 'undefined') { 12897 UNCODE.bigText(); 12898 } 12899 UNCODE.menuSystem(); 12900 if (typeof UNCODE.bgChanger !== 'undefined') { 12901 UNCODE.bgChanger(); 12902 } 12903 if (typeof UNCODE.magicCursor !== 'undefined') { 12904 UNCODE.magicCursor(); 12905 } 12906 if (typeof UNCODE.magneticCursor !== 'undefined') { 12907 UNCODE.magneticCursor(); 12908 } 12909 if (typeof UNCODE.dropImage !== 'undefined') { 12910 UNCODE.dropImage(); 12911 } 12912 if (typeof UNCODE.postTable !== 'undefined') { 12913 UNCODE.postTable(); 12914 } 12915 if (typeof UNCODE.rotatingTxt !== 'undefined') { 12916 UNCODE.rotatingTxt(); 12917 } 12918 if (typeof UNCODE.okvideo !== 'undefined') { 12919 UNCODE.okvideo(); 12920 } 12921 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 12922 UNCODE.backgroundSelfVideos(); 12923 } 12924 UNCODE.tapHover(); 12925 if (typeof UNCODE.isotopeLayout !== 'undefined') { 12926 UNCODE.isotopeLayout(); 12927 } 12928 if (typeof UNCODE.justifiedGallery !== 'undefined') { 12929 UNCODE.justifiedGallery(); 12930 } 12931 if (typeof UNCODE.cssGrid !== 'undefined') { 12932 UNCODE.cssGrid(); 12933 } 12934 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 12935 UNCODE.lightbox(); 12936 } 12937 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 12938 $(window).on('load more-items-loaded',function(){ 12939 UNCODE.lightgallery(); 12940 }); 12941 } 12942 if (typeof UNCODE.carousel !== 'undefined') { 12943 UNCODE.carousel($('body')); 12944 } 12945 if (typeof UNCODE.lettering !== 'undefined') { 12946 UNCODE.lettering(); 12947 } 12948 UNCODE.animations(); 12949 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 12950 UNCODE.stickyElements(); 12951 } 12952 if (typeof UNCODE.twentytwenty !== 'undefined') { 12953 UNCODE.twentytwenty(); 12954 } 12955 UNCODE.disableHoverScroll(); 12956 UNCODE.printScreen(); 12957 if (typeof UNCODE.particles !== 'undefined') { 12958 UNCODE.particles(); 12959 } 12960 if (typeof UNCODE.filters !== 'undefined') { 12961 UNCODE.filters(); 12962 } 12963 if (typeof UNCODE.ajax_filters !== 'undefined') { 12964 UNCODE.ajax_filters(); 12965 } 12966 if (typeof UNCODE.widgets !== 'undefined') { 12967 UNCODE.widgets(); 12968 } 12969 if (typeof UNCODE.unmodal !== 'undefined') { 12970 UNCODE.unmodal(); 12971 } 12972 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 12973 if ( !UNCODE.isFullPage ) { 12974 UNCODE.checkScrollForTabs(); 12975 } 12976 } 12977 if (typeof UNCODE.onePage !== 'undefined') { 12978 UNCODE.onePage(UNCODE.isMobile); 12979 } 12980 if (typeof UNCODE.fullPage !== 'undefined') { 12981 $(document).ready(function(){ 12982 UNCODE.fullPage(); 12983 }); 12984 } 12985 if (typeof UNCODE.skewIt !== 'undefined') { 12986 UNCODE.skewIt(); 12987 } 12988 if (typeof UNCODE.rotateIt !== 'undefined') { 12989 UNCODE.rotateIt(); 12990 } 12991 if (typeof UNCODE.textMarquee !== 'undefined') { 12992 UNCODE.textMarquee(); 12993 } 12994 if (typeof UNCODE.stickyScroll !== 'undefined') { 12995 UNCODE.stickyScroll(); 12996 } 12997 if (typeof UNCODE.stickyTrigger !== 'undefined') { 12998 UNCODE.stickyTrigger(); 12999 } 13000 if (typeof UNCODE.verticalText !== 'undefined') { 13001 UNCODE.verticalText(); 13002 } 13003 if (typeof UNCODE.videoThumbs !== 'undefined') { 13004 UNCODE.videoThumbs(); 13005 } 13006 if (typeof UNCODE.revslider !== 'undefined') { 13007 UNCODE.revslider(); 13008 } 13009 if (typeof UNCODE.layerslider !== 'undefined') { 13010 UNCODE.layerslider(); 13011 } 13012 if (typeof UNCODE.lottie !== 'undefined') { 13013 UNCODE.lottie(); 13014 } 13015 if (typeof UNCODE.inlineImgs !== 'undefined') { 13016 UNCODE.inlineImgs(); 13017 } 13018 if (typeof UNCODE.animatedBgGradient !== 'undefined') { 13019 UNCODE.animatedBgGradient(); 13020 } 13021 if (typeof UNCODE.readMoreCol !== 'undefined') { 13022 UNCODE.readMoreCol(); 13023 } 13024 if (typeof UNCODE.multibg !== 'undefined') { 13025 UNCODE.multibg(); 13026 } 13027 $(window).on('load',function(){ 13028 clearRequestTimeout(waypoint_request);
13029 waypoint_request = requestTimeout( function(){ 13030 Waypoint.refreshAll(); 13031 }, 1000); 13032 13033 if (typeof UNCODE.parallax !== 'undefined') { 13034 UNCODE.parallax(); 13035 } 13036 }); 13037 } 13038 13039 if ( ! SiteParameters.is_frontend_editor ) { 13040 UNCODE.init(); 13041 } 13042 13043 13044})(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.