1/* ---------------------------------------------------------- 2 * Uncode App 3 * ---------------------------------------------------------- */ 4 5(function($) { 6 "use strict"; 7 var UNCODE = window.UNCODE || {}; 8 window.UNCODE = UNCODE; 9 10 window.requestAnimFrame = (function() { 11 return window.requestAnimationFrame || 12 window.webkitRequestAnimationFrame || 13 window.mozRequestAnimationFrame || 14 window.oRequestAnimationFrame || 15 window.msRequestAnimationFrame || 16 function(/* function */ callback, /* DOMElement */ element){ 17 window.setTimeout(callback, 1000 / 60); 18 }; 19})(); 20 21window.requestTimeout = function(fn, delay) { 22 if( !window.requestAnimationFrame && 23 !window.webkitRequestAnimationFrame && 24 !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support 25 !window.oRequestAnimationFrame && 26 !window.msRequestAnimationFrame) 27 return window.setTimeout(fn, delay); 28 29 var start = new Date().getTime(), 30 handle = new Object(); 31 32 function loop(){ 33 var current = new Date().getTime(), 34 delta = current - start; 35 36 delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop); 37 }; 38 39 handle.value = requestAnimFrame(loop); 40 return handle; 41}; 42 43window.clearRequestTimeout = function(handle) { 44 if ( typeof handle !== 'undefined' ) { 45 window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : 46 window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) : 47 window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */ 48 window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : 49 window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : 50 window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) : 51 clearTimeout(handle); 52 } 53}; 54 55UNCODE.betterResize = function() { 56 var setResize, 57 doubleResize = true, 58 oldW = UNCODE.wwidth; 59 $(window).on( 'resize orientationchange', function(){ 60 if ( oldW === UNCODE.wwidth ) { 61 return; 62 } else { 63 oldW = UNCODE.wwidth; 64 $(window).trigger('wwResize'); 65 } 66 }); 67}; 68 69Number.isInteger = Number.isInteger || function(value) { 70 return typeof value === "number" && 71 isFinite(value) && 72 Math.floor(value) === value; 73}; 74 75UNCODE.utils = function() { 76 $(document).on('mouseover', 'a', function() { 77 $(this).attr('data-title', $(this).attr('title')); 78 $(this).removeAttr('title'); 79 }); 80 $(document).on('mouseout', 'a', function() { 81 $(this).attr('title', $(this).attr('data-title')); 82 $(this).removeAttr('data-title'); 83 }); 84 85 this.get_scroll_offset = function(e) { 86 87 var scroll_offset = 0, 88 target, 89 trigger; 90 91 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 92 target = e.target; 93 trigger = e.currentTarget; 94 } 95 96 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 97 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 98 UNCODE.hideMenu(100); 99 } 100 } 101 102 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { 103 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 104 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 105 if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) { 106 if ( !$('.menu-hided').length ) { 107 scroll_offset += $('.logo-container:visible').outerHeight(); 108 } 109 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 110 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 111 scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink ); 112 } else { 113 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 114 scroll_offset += UNCODE.menuMobileHeight; 115 } else { 116 if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) { 117 //scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 118 } else { 119 if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 120 scroll_offset += UNCODE.menuMobileHeight; 121 } 122 } 123 } 124 } 125 } 126 127 } 128 129 scroll_offset += UNCODE.bodyBorder; 130 131 return scroll_offset; 132 } 133 134 if ( !UNCODE.isFullPage ) { 135 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', function(e) { 136 137 var hash = (e.currentTarget).hash, 138 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 139 anchor = ''; 140 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 141 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 142 e.preventDefault(); 143 if (!$('#tab-reviews').is(':visible')) { 144 $('a[href="#tab-reviews"]').trigger('click'); 145 } 146 var calc_scroll = $('.wootabs .tab-content').offset().top; 147 calc_scroll -= UNCODE.get_scroll_offset(e); 148
149 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 150 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 151 152 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 153 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 154 } 155 } 156 157 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 158 delta = bodyTop - calc_scroll, 159 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 160 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 161 162 requestTimeout(function(){ 163 if (scrollSpeed == 0) { 164 $('html, body').scrollTop(calc_scroll); 165 UNCODE.scrolling = false; 166 } else { 167 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 168 $(this).stop(); 169 }).animate({ 170 scrollTop: calc_scroll 171 }, scrollSpeed, 'easeInOutCubic', function() { 172 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 173 UNCODE.scrolling = false; 174 } 175 ); 176 } 177 }, 200); 178 return; 179 } 180 if (hash != undefined) { 181 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 182 var anchor = this.hash.slice(1); 183 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 184 if ( !specialFormat.test(hash) ) { 185 if ( $(hash).length ) 186 anchor = $(hash); 187 } 188 } 189 } 190 191 if (is_scrolltop || anchor != '') { 192 if (is_scrolltop) { 193 e.preventDefault(); 194 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 195 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 196 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 197 198 if (scrollSpeed == 0) { 199 $('html, body').scrollTop(0); 200 UNCODE.scrolling = false; 201 } else { 202 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 203 $(this).stop(); 204 }).animate({ 205 scrollTop: 0 206 }, scrollSpeed, 'easeInOutCubic', function() { 207 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 208 UNCODE.scrolling = false; 209 }); 210 } 211 } else { 212 var scrollSection = (typeof anchor === 'string') ? $('[data-name="' + anchor + '"]') : anchor; 213 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 214 var get_href = $(val).attr('href'); 215 if (get_href != undefined) { 216 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 217 else $(val).parent().removeClass('active'); 218 } 219 }); 220 if (scrollSection.length) { 221 if ( $('body').hasClass('uncode-scroll-no-history') ) { 222 e.preventDefault(); 223 } 224 225 if (UNCODE.menuOpened) { 226 if (UNCODE.wwidth < UNCODE.mediaQuery) { 227 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 228 } else { 229 $('.mmb-container-overlay .overlay-close').trigger('click'); 230 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 231 } 232 } 233 234 var calc_scroll = scrollSection.offset().top, 235 getOffset = UNCODE.get_scroll_offset(e), 236 $logo = $('.logo-container:visible'), 237 logoH, 238 $menu = $('#masthead .menu-container'), 239 menuH; 240 241 calc_scroll -= isNaN(getOffset) ? 0 : getOffset; 242 243 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 244 delta = bodyTop - calc_scroll, 245 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 246 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 247
248 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 249 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) { 250 logoH = $logo.outerHeight(), 251 menuH = $menu.outerHeight(); 252 if ( calc_scroll < ( logoH + menuH ) ) { 253 calc_scroll = 0; 254 } 255 } 256 } 257 258 if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) { 259 calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() ); 260 } 261 262 if (scrollSpeed == 0) { 263 $('html, body').scrollTop(calc_scroll); 264 UNCODE.scrolling = false; 265 } else { 266 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 267 $(this).stop(); 268 }).animate({ 269 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 270 }, scrollSpeed, 'easeInOutCubic', function() { 271 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 272 UNCODE.scrolling = false; 273 if ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 274 || 275 $('.menu-hided').length ) { 276 calc_scroll = scrollSection.offset().top; 277 getOffset = UNCODE.get_scroll_offset(e); 278 calc_scroll -= getOffset; 279 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 280 $(this).stop(); 281 }).animate({ 282 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 283 }, scrollSpeed, 'easeInOutCubic', function() { 284 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 285 UNCODE.scrolling = false; 286 } 287 ); 288 } 289 }); 290 } 291 } 292 } 293 } 294 }); 295 $('.header-scrolldown').on('click', function(event) { 296 297 event.preventDefault(); 298 299 var pageHeader = $(event.target).closest('#page-header'), 300 pageHeaderTop = pageHeader.offset().top, 301 pageHeaderHeight = pageHeader.outerHeight(), 302 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 303 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 304 305 var calc_scroll = pageHeaderTop + pageHeaderHeight, 306 getOffset = UNCODE.get_scroll_offset(event); 307 calc_scroll -= getOffset; 308 309 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 310 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 311 312 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 313 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 314 } 315 } 316 317 if (scrollSpeed == 0) { 318 $('html, body').scrollTop(calc_scroll); 319 UNCODE.scrolling = false; 320 } else { 321 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 322 $(this).stop(); 323 }).animate({ 324 scrollTop: calc_scroll 325 }, scrollSpeed, 'easeInOutCubic', function() { 326 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 327 UNCODE.scrolling = false; 328 if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) { 329 calc_scroll = pageHeaderTop + pageHeaderHeight; 330 getOffset = UNCODE.get_scroll_offset(event); 331 calc_scroll -= getOffset; 332 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 333 $(this).stop(); 334 }).animate({ 335 scrollTop: calc_scroll 336 }, scrollSpeed, 'easeInOutCubic', function() { 337 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 338 UNCODE.scrolling = false;
339 } 340 ); 341 } 342 } 343 ); 344 } 345 }); 346 } 347 348 // Colomun hover effect 349 // ================= 350 $(document).on('mouseenter', '.col-link', function(e) { 351 var uncol = $(e.target).prev('.uncol'), 352 el = uncol.find('.column-background'); 353 if (el) { 354 $('.btn-container .btn', uncol).toggleClass('active'); 355 var elOverlay = $(el[0]).find('.block-bg-overlay'); 356 if (elOverlay.length) { 357 var getOpacity = $(elOverlay).css('opacity'); 358 if (getOpacity != 1) { 359 getOpacity = Math.round(getOpacity * 100) / 100; 360 var newOpacity = getOpacity + .1; 361 $(elOverlay).data('data-opacity', getOpacity); 362 $(elOverlay).css('opacity', newOpacity); 363 } 364 } 365 } 366 }).on('mouseleave', '.col-link', function(e) { 367 var uncol = $(e.target).prev('.uncol'), 368 el = uncol.find('.column-background'); 369 $('.btn-container .btn', uncol).toggleClass('active'); 370 if (el) { 371 var elOverlay = $(el[0]).find('.block-bg-overlay'); 372 if (elOverlay.length) { 373 var getOpacity = $(elOverlay).data('data-opacity'); 374 $(elOverlay).css('opacity', getOpacity); 375 } 376 } 377 }); 378 379 // Admin bar 380 // ============ 381 var fixAdminBar = function() { 382 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 383 var getAdminBar = $('#wpadminbar'); 384 if (getAdminBar.length) { 385 if (getAdminBar.css('position') !== 'hidden') { 386 var getAdminBarHeight = getAdminBar.height(); 387 if (getAdminBar.css('position') === 'fixed') { 388 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 389 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 390 } else { 391 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 392 $('.body-borders .top-border').css({'margin-top':'0px'}); 393 } 394 } 395 } 396 } 397 }; 398 window.addEventListener('load', fixAdminBar); 399 window.addEventListener('resize', fixAdminBar); 400 // Print 401 // =========== 402 var beforePrint = function() { 403 window.dispatchEvent(new CustomEvent('resize')); 404 window.dispatchEvent(UNCODE.boxEvent); 405 }; 406 407 if (window.matchMedia) { 408 var mediaQueryList = window.matchMedia('print'); 409 mediaQueryList.addListener(function(mql) { 410 if (mql.matches) { 411 beforePrint(); 412 } 413 }); 414 } 415 416 window.onbeforeprint = beforePrint; 417 418 // Safari srcset 419 var safariSrcSet = function(){ 420 if ( !SiteParameters.is_frontend_editor ) { 421 $('html.safari img[sizes]').each(function(){ 422 var $img = $(this), 423 sizeImg = parseInt($img.attr('sizes')); 424 if ( typeof(sizeImg) === 'number' ) { 425 $img.attr('sizes', (sizeImg) + 'px'); 426 } 427 }); 428 } 429 }; 430 window.addEventListener('load', safariSrcSet); 431} 432 433UNCODE.lettering = function() { 434 435 var setCTA; 436 var highlightStill = function(){ 437 438 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 439 440 $.each($heading_texts, function(key, el) { 441 var $heading = $(el); 442 443 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 444 return; 445 } 446 447 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 448 return; 449 } 450 451 var waypoint = new Waypoint({ 452 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 453 element: el, 454 handler: function() { 455 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 456 anims_l = $anims.length; 457 $anims.each(function(_key_, _el_){ 458 var $anim = $(_el_); 459 460 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 461 $anim.addClass('heading-text-highlight-animated'); 462 463 if ( $heading.data('animate') === true ) { 464 $anim.css({ 465 '-webkit-transition-duration': '0ms', 466 '-moz-transition-duration': '0ms', 467 '-o-transition-duration': '0ms', 468 'transition-duration': '0ms', 469 }); 470 } else { 471 $anim.css({ 472 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 473 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 474 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 475 'transition-delay': ((_key_ + 2) * 200) + 'ms', 476 }); 477 } 478 } 479 480 }); 481 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 482 $heading.data('animate', true); 483 }); 484 $anims.removeAttr('data-animated'); 485 }, 486 offset: '100%' 487 }); 488 489 }); 490 491 Waypoint.refreshAll(); 492 $( document.body ).trigger('uncode_waypoints'); 493 494 } 495 496 requestTimeout(function(){ 497 highlightStill(); 498 $(window).on( 'resize', function(){ 499 clearRequestTimeout(setCTA); 500 setCTA = requestTimeout( highlightStill, 100 ); 501 }); 502 }, 400); 503 504}; 505 506UNCODE.isUnmodalOpen = false;
507 508var manageVideoSize = function(){ 509 510 var setVideoFit; 511 $('.wp-block-embed').each(function(){ 512 513 var $this = $(this); 514 515 if ( $('iframe', $this).length ) { 516 517 var $iframe = $('> iframe, > a > iframe', $this), 518 w = parseFloat($iframe.attr('width')), 519 h = parseFloat($iframe.attr('height')), 520 url = $iframe.attr('src'), 521 ratio, frW; 522 523 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 524 525 ratio = h / w; 526 var setResizeiFto, 527 resizeiFrame = function(){ 528 frW = $iframe.width(); 529 $iframe.css({ 530 height: frW * ratio 531 }); 532 }; 533 resizeiFrame(); 534 $(window).on( 'resize load', function(){ 535 clearRequestTimeout(setResizeiFto); 536 setResizeiFto = requestTimeout( function() { 537 resizeiFrame(); 538 }, 10 ); 539 }); 540 541 } 542 543 } 544 545 }); 546 547}; 548 549manageVideoSize(); 550 551UNCODE.vivus = function(icon, time, delay, file) { 552 if (typeof Vivus !== 'undefined') { 553 var icon_options = { 554 type: 'delayed', 555 pathTimingFunction: Vivus.EASE_OUT, 556 animTimingFunction: Vivus.LINEAR, 557 duration: time, 558 } 559 560 if (delay) { 561 icon_options.delayStart = delay; 562 } 563 564 if (file) { 565 icon_options.file = file; 566 } 567 568 new Vivus(icon, icon_options); 569 } 570}; 571 572UNCODE.lastURL = ''; 573 574UNCODE.getURLParams = function(current_location, is_string) { 575 var params = {}; 576 if (is_string) { 577 var url = current_location.split('?')[1]; 578 } else { 579 var url = current_location.search; 580 url = url.substring(1); 581 } 582 if (url) { 583 var parts = url.split('&'); 584 for (var i = 0; i < parts.length; i++) { 585 var nv = parts[i].split('='); 586 if (!nv[0]) { 587 continue; 588 } 589 params[nv[0]] = nv[1] || true; 590 } 591 } 592 return params; 593} 594 595UNCODE.hasEqualURLParams = function(obj1, obj2) { 596 for (var i in obj1) { 597 if (obj1.hasOwnProperty(i)) { 598 if (!obj2.hasOwnProperty(i)) { 599 return false; 600 } 601 if (obj1[i] != obj2[i]) { 602 return false; 603 } 604 } 605 } 606 for (var i in obj2) { 607 if (obj2.hasOwnProperty(i)) { 608 if (!obj1.hasOwnProperty(i)) { 609 return false; 610 } 611 if (obj1[i] != obj2[i]) { 612 return false; 613 } 614 } 615 } 616 return true; 617} 618 619UNCODE.changeSkinOnScroll = function(){ 620 if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { 621 return; 622 } 623 var $masthead = $('#masthead'), 624 transDesktop, 625 transMobile, 626 changeSkin, 627 628 checkTransparencyAndChange = function( $col ){ 629 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 630 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 631 changeSkin = $masthead.hasClass('menu-change-skin'); 632 633 if ( ! transDesktop && ! transMobile ) { 634 return false; 635 } 636 637 if ( ! changeSkin ) { 638 return false; 639 } 640 641 if ( $col.hasClass('style-light') ){ 642 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 643 return false; 644 } else if ( $col.hasClass('style-dark') ) { 645 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 646 return false; 647 } 648 }; 649 650 var prev_row = 'normal', 651 odd = true, 652 $rows = $('.vc_row[data-parent]:visible'); 653 $.each($rows, function(index, row){ 654 var $row = $(row), 655 $col = $('.uncol', $row).first(), 656 $slider = $('.uncode-slider', $row); 657 658 var wayDown = new Waypoint({ 659 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 660 element: row, 661 handler: function(direction) { 662 if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 663 if ( $slider.length ) { 664 $col = $('.owl-item.index-active .uncol', $slider).first(); 665 } 666 checkTransparencyAndChange($col); 667 } 668 if ( odd === false ) { 669 if ( row.hasAttribute('data-bg-changer') ) { 670 prev_row = 'bg-changer'; 671 } else { 672 prev_row = 'normal'; 673 } 674 odd = true; 675 } else { 676 odd = false; 677 } 678 }, 679 offset: function() { 680 return UNCODE.menuHeight / 2 681 } 682 }); 683 var wayUp = new Waypoint({ 684 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 685 element: row, 686 handler: function(direction) { 687 if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { 688 if ( $slider.length ) { 689 $col = $('.owl-item.index-active .uncol', $slider).first(); 690 } 691 checkTransparencyAndChange($col); 692 } 693 if ( odd === false ) { 694 if ( row.hasAttribute('data-bg-changer') ) { 695 prev_row = 'bg-changer'; 696 } else { 697 prev_row = 'normal'; 698 } 699 odd = true; 700 } else { 701 odd = false;
702 } 703 }, 704 offset: function() { 705 return -row.clientHeight + ( UNCODE.menuHeight / 2 ) 706 } 707 }); 708 }); 709 710}; 711 712UNCODE.share = function() { 713 if (typeof Share !== 'undefined') { 714 var share_button_element = $('.share-button'); 715 var share_button_url = share_button_element.data('url'); 716 717 var share_button_config = { 718 ui: { 719 flyout: "top center", 720 button_font: false, 721 button_text: '', 722 icon_font: false 723 } 724 }; 725 726 if (share_button_url) { 727 share_button_config.url = share_button_url.replace("&", "%26"); 728 } 729 730 var share_button_top = new Share('.share-button', share_button_config); 731 } 732}; 733 734UNCODE.tooltip = function() { 735 if (typeof jQuery.fn.tooltip !== 'undefined') { 736 $('.btn-tooltip').tooltip(); 737 } 738}; 739 740UNCODE.counters = function() { 741 var $counters = $('.uncode-counter:not(.counter-init)'); 742 $counters.each(function(){ 743 var $counter = $(this).addClass('counter-init'); 744 if ( $counter.closest( '.owl-carousel' ).length ) { 745 return; 746 } 747 $counter.addClass('started').counterUp({ 748 delay: 10, 749 time: 1500 750 }); 751 }); 752}; 753 754UNCODE.countdowns = function() { 755 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 756 $countdowns.each(function() { 757 var $this = $(this).addClass('counter-init'), 758 finalDate = $(this).data('uncode-countdown'); 759 $this.countdown(finalDate, function(event) { 760 $this.html(event.strftime('<span>%D <small>' + SiteParameters.days + '</small></span> <span>%H <small>' + SiteParameters.hours + '</small></span> <span>%M <small>' + SiteParameters.minutes + '</small></span> <span>%S <small>' + SiteParameters.seconds + '</small></span>')); 761 }); 762 }); 763}; 764 765UNCODE.tabs = function() { 766 767 var tabSwitcher = function($el){ 768 $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){ 769 var $navs = $(value), 770 $active = $('li.active', $navs), 771 $active_a = $('> a', $active), 772 $active_span = $('> span', $active_a), 773 vertical = $navs.closest('.vertical-tab-menu').length; 774 775 if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { 776 $navs.append('<span class="switcher-cursor" />'); 777 } 778 779 var $cursor = $('.switcher-cursor', $navs), 780 active_w = $('a', $active).outerWidth(), 781 span_w = $active_span.outerWidth(), 782 active_pos = $active.position(), 783 active_a_pos = $active_a.position(), 784 span_pos = $active_span.position(), 785 cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w,
786 cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; 787 788 cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); 789 790 if ( ! vertical ) { 791 $cursor.css({ 792 left: cursor_left, 793 width: cursor_w 794 }); 795 } 796 797 $navs.addClass('switch-init'); 798 }); 799 }; 800 801 var $body = $('body'); 802 tabSwitcher($body); 803 804 var tabHoverIntent = function(){ 805 var setHover; 806 $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') 807 .on('mouseover', function(e){ 808 var $this = $(e.target); 809 setHover = requestTimeout(function() { 810 $this.trigger('hover-int'); 811 }, 50); 812 }) 813 .on('mouseout', function(){ 814 clearRequestTimeout(setHover); 815 }); 816 }; 817 tabHoverIntent(); 818 819 var tabInit = function(){ 820 $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { 821 e.preventDefault() 822 var $el = $(this); 823 $el.tab('show'); 824 var $container = $el.closest('.uncode-tabs'); 825 tabSwitcher($container); 826 requestTimeout(function() { 827 window.dispatchEvent(UNCODE.boxEvent); 828 var $tabs = $(e.currentTarget).closest('.uncode-tabs'); 829 830 if ( $tabs.hasClass('tabs-trigger-box-resized') ) { 831 window.dispatchEvent(new CustomEvent('boxResized')); 832 } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { 833 window.dispatchEvent(new Event('resize')); 834 $(window).trigger('uncode.re-layout'); 835 } 836 837 var $active_panel = $('.tab-pane.active', $tabs); 838 839 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 840 var element = $(val), 841 delayAttr = element.attr('data-delay'); 842 if (delayAttr == undefined) delayAttr = 0; 843 requestTimeout(function() { 844 element.addClass('start_animation'); 845 }, delayAttr); 846 }); 847 848 }, 300); 849 850 var $li = $el.closest('li'), 851 mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 852 $('li', $container).not($li).find('.tab-pane').slideUp(250) 853 $('.tab-pane', $li).slideDown(250); 854 var completeSlideDown = requestTimeout(function(){ 855 if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { 856 var pos = $el.offset(), 857 rect = $el[0].getBoundingClientRect(), 858 $masthead = $('#masthead > .menu-container'), 859 considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; 860 861 if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { 862 $('html, body').animate({ 863 scrollTop: ( pos.top ) - considerMenu 864 },{ 865 easing: 'easeInOutQuad', 866 duration: 250 867 }); 868 } 869 } 870 }, 260); 871 }); 872 } 873 tabInit(); 874 875 var tabResponsive = function(){ 876 if ( SiteParameters.is_frontend_editor ) { 877 return true; 878 } 879 var $tabContainers = $('.tab-container.tabs-breakpoint'); 880 $tabContainers.each(function(){ 881 var $tabContainer = $(this), 882 $tabContent = $('.tab-content', $tabContainer), 883 $nav = $('.nav-tabs', $tabContainer), 884 mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; 885 886 $('> li', $nav).each(function(){ 887 var $li = $(this), 888 dataID = $li.attr('data-tab-id'); 889 890 if ( UNCODE.wwidth <= mQuery ) { 891 if ( ! $('.tab-pane', $li ).length ) { 892 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); 893 $li.append($append_pane); 894 } 895 896 if ( $li.hasClass('active') ) { 897 $('> a', $li).click(); 898 } 899 } else { 900 if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { 901 var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); 902 $tabContent.prepend($append_pane.removeAttr('style')); 903 } 904 } 905 }); 906 }); 907 908 } 909 tabResponsive(); 910 911 $(window).on('wwResize', function(){ 912 tabHoverIntent(); 913 tabSwitcher($body); 914 }); 915 916 var setCTA; 917 $(window).on( 'resize', function(){ 918 clearRequestTimeout(setCTA); 919 setCTA = requestTimeout( tabResponsive, 100 ); 920 }); 921 922 $('.nav-tabs').each(function(){ 923 var $nav = $(this), 924 $lis = $('> li:not(.active)', $nav), 925 $links = $('.tab-excerpt-link', $nav); 926 $('.tab-excerpt', $lis).slideUp(400, function(){ 927 $(this).addClass('init'); 928 }); 929 930 $links.each(function(){ 931 var $link = $(this), 932 $par_a = $link.closest('a'), 933 href = $link.attr('data-href'), 934 target = $link.attr('data-target'); 935 $par_a.addClass('inner-link'); 936 $link.on('click', function(){ 937 var _link = document.createElement('a'); 938 _link.href = href; 939 _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; 940 _link.click(); 941 }); 942 }); 943 $nav.addClass('tab-init'); 944 }); 945 946 $('.uncode-tabs.tabs-no-lazy').each(function(){ 947 var $tabs = $(this), 948 $panes = $('.tab-pane:not(.active)', $tabs); 949 $panes.each(function(){ 950 var $pane = $(this), 951 $imgs = $('img[loading="lazy"]', $pane); 952 $imgs.removeAttr('loading'); 953 $imgs.removeAttr('decoding'); 954 }); 955 }); 956 957}; 958UNCODE.collapse = function() { 959 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 960 var $this = $(this), 961 href 962 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 963 var $target = $(target) 964 var parent = $this.attr('data-parent') 965 var $parent = parent && $(parent) 966 var $title = $(this).parent() 967 var $accordion = $(e.target).closest('.uncode-accordion') 968 var $group = $this.closest('.group') 969 var $panel_group = $this.closest('.panel-group') 970 if ($parent) { 971 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 972 if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { 973 $title.removeClass('active'); 974 $group.removeClass('active-group'); 975 } else { 976 if ( $panel_group.attr('data-no-toggle') != true ) { 977 $parent.find('.panel-title').removeClass('active') 978 $parent.find('.group').removeClass('active-group') 979 } 980 $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') 981 $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') 982 } 983 } 984 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 985 requestTimeout(function() { 986 var $accordion = $(e.target).closest('.uncode-accordion'); 987 if ( $accordion.hasClass('tabs-trigger-box-resized') ) { 988 window.dispatchEvent(new CustomEvent('boxResized')); 989 } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { 990 window.dispatchEvent(new Event('resize')); 991 $(window).trigger('uncode.re-layout'); 992 } 993 994 var $active_panel = $('.panel.active-group', $parent); 995 996 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { 997 var element = $(val), 998 delayAttr = element.attr('data-delay'); 999 if (delayAttr == undefined) delayAttr = 0; 1000 requestTimeout(function() { 1001 element.addClass('start_animation'); 1002 }, delayAttr); 1003 }); 1004 1005 }, 500); 1006 }); 1007 1008 $('.uncode-accordion.tabs-no-lazy').each(function(){ 1009 var $accordion = $(this), 1010 $panes = $('.panel:not(.active-group)', $accordion); 1011 $panes.each(function(){ 1012 var $pane = $(this), 1013 $imgs = $('img[loading="lazy"]', $pane); 1014 $imgs.removeAttr('loading'); 1015 $imgs.removeAttr('decoding'); 1016 }); 1017 }); 1018}; 1019 1020UNCODE.bigText = function(el) { 1021 if (el == undefined) { 1022 el = $('body'); 1023 } 1024 $.each($('.bigtext', el), function(index, val) { 1025 $(val).bigtext({ 1026 minfontsize: 24 1027 }); 1028 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 1029 opacity: 1 1030 }); 1031 requestTimeout(function() { 1032 if ($(val).find('.animate_when_almost_visible').length != 0) { 1033 $(val).css({opacity: 1}); 1034 } 1035 }, 400); 1036 }); 1037}; 1038 1039UNCODE.process_shortpixel_image = function(image) { 1040 var data = { 1041 action: 'shortpixel_manual_optimization', 1042 image_id: image,
1043 cleanup: true 1044 }; 1045 1046 $.get(SiteParameters.ajax_url, data); 1047}; 1048 1049UNCODE.menuSystem = function() { 1050 1051 function menuMobile() { 1052 var $body = $('body'), 1053 scrolltop, 1054 $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), 1055 $masthead = $('#masthead'), 1056 $box, 1057 $el, 1058 $el_transp, 1059 elHeight, 1060 offCanvasAnim, 1061 check, 1062 animating = false, 1063 stickyMobile = false, 1064 menuClose = new CustomEvent('menuMobileClose'), 1065 menuOpen = new CustomEvent('menuMobileOpen'); 1066 UNCODE.menuOpened = false; 1067 $mobileToggleButton.on('click', function(event) { 1068 event.stopPropagation(); 1069 var btn = this; 1070 if ($(btn).hasClass('overlay-close')) return; 1071 event.preventDefault(); 1072 $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 1073 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 1074 $box = $(this).closest('.box-container').find('.main-menu-container'); 1075 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 1076 $el_transp = $('.menu-absolute.menu-transparent'); 1077 if (UNCODE.isMobile) { 1078 if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) { 1079 stickyMobile = true; 1080 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 1081 } else { 1082 elHeight = 0; 1083 $.each($box.find('> div'), function(index, val) { 1084 elHeight += $(val).outerHeight(); 1085 }); 1086 } 1087 } else { 1088 elHeight = 0; 1089 $.each($el, function(index, val) { 1090 elHeight += $(val).outerHeight(); 1091 }); 1092 } 1093 var open = function() { 1094 clearTimeout(offCanvasAnim); 1095 if (!animating) { 1096 $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); 1097 scrolltop = $(window).scrollTop(); 1098 window.dispatchEvent(menuOpen); 1099 animating = true; 1100 UNCODE.menuOpened = true; 1101 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 1102 if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { 1103 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1104 } 1105 if ($('body.menu-offcanvas').length) { 1106 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1107 $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1108 } else { 1109 if ( $('.menu-hide, .menu-sticky').length ) { 1110 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 1111 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); 1112 } 1113 } 1114 } 1115 } 1116 if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { 1117 //$("#masthead")[0].scrollIntoView(); 1118 $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 1119 } 1120 $box.addClass('open-items'); 1121 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 1122 $el_transp.addClass('is_mobile_open'); 1123 } 1124 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1125 btn.classList.add('close'); 1126 $box.animate({ 1127 height: elHeight 1128 }, 600, "easeInOutCirc", function() { 1129 animating = false; 1130 if (!stickyMobile) $box.css('height', 'auto'); 1131 }); 1132 } else { 1133 animating = false; 1134 } 1135 } 1136 }; 1137 1138 var close = function() { 1139 clearTimeout(offCanvasAnim); 1140 if (!animating) { 1141 window.dispatchEvent(menuClose); 1142 animating = true; 1143 UNCODE.menuOpened = false;
1144 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1145 btn.classList.remove('close'); 1146 btn.classList.add('closing'); 1147 } 1148 $box.addClass('close'); 1149 requestTimeout(function() { 1150 $box.removeClass('close'); 1151 $box.removeClass('open-items'); 1152 btn.classList.remove('closing'); 1153 if ($el_transp.length) { 1154 $el_transp.removeClass('is_mobile_open'); 1155 } 1156 }, 500); 1157 $body.removeClass('opening-overlay-menu'); 1158 if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 1159 $box.animate({ 1160 height: 0 1161 }, { 1162 duration: 600, 1163 easing: "easeInOutCirc", 1164 complete: function(elements) { 1165 $(elements).css('height', ''); 1166 animating = false; 1167 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 1168 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); 1169 } 1170 $body.removeClass('open-overlay-menu'); 1171 } 1172 }); 1173 } else { 1174 animating = false; 1175 offCanvasAnim = setTimeout(function(){ 1176 $body.removeClass('open-overlay-menu'); 1177 }, 1000); 1178 } 1179 } 1180 }; 1181 check = (!UNCODE.menuOpened) ? open() : close(); 1182 } 1183 }); 1184 1185 $('html').on('click', function(event){ 1186 if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { 1187 $('.uncode-close-offcanvas-mobile').trigger('click'); 1188 } 1189 }); 1190 1191 window.addEventListener('menuMobileTrigged', function(e) { 1192 $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); 1193 }); 1194 window.addEventListener('orientationchange', function(e) { 1195 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 1196 }); 1197 window.addEventListener("resize", function() { 1198 if ($(window).width() < UNCODE.mediaQuery) { 1199 if (UNCODE.isMobile) { 1200 var $box = $('.box-container .main-menu-container'), 1201 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 1202 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 1203 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 1204 elHeight = 0; 1205 $.each($el, function(index, val) { 1206 elHeight += $(val).outerHeight(); 1207 }); 1208 elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1; 1209 $($box).css('height', elHeight + 'px'); 1210 } 1211 } 1212 } 1213 } else { 1214 $('.menu-hide-vertical').removeAttr('style'); 1215 $('.menu-container-mobile').removeAttr('style'); 1216 $('.vmenu-container.menu-container').removeAttr('style'); 1217 } 1218 }); 1219 1220 $(window).on('scroll', function(){ 1221 if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { 1222 $(window).scrollTop(scrolltop); 1223 return false; 1224 } 1225 }); 1226 1227 }; 1228 1229 function menuOffCanvas() { 1230 var menuClose = new CustomEvent('menuCanvasClose'), 1231 menuOpen = new CustomEvent('menuCanvasOpen'); 1232 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { 1233 if ($(window).width() > UNCODE.mediaQuery) { 1234 if ( $('body.vmenu-offcanvas-overlay').length ) { 1235 if ($(event.currentTarget).hasClass('off-close')) { 1236 $(event.currentTarget).removeClass('off-close'); 1237 requestTimeout(function() { 1238 window.dispatchEvent(menuClose); 1239 }, 500); 1240 1241 } else { 1242 $(event.currentTarget).addClass('off-close'); 1243 window.dispatchEvent(menuOpen); 1244 } 1245 } else { 1246 if ($(event.currentTarget).hasClass('close')) { 1247 $(event.currentTarget).removeClass('close'); 1248 $(event.currentTarget).addClass('closing'); 1249 requestTimeout(function() { 1250 $(event.currentTarget).removeClass('closing'); 1251 window.dispatchEvent(menuClose); 1252 }, 500); 1253 1254 } else { 1255 $(event.currentTarget).addClass('close'); 1256 window.dispatchEvent(menuOpen); 1257 } 1258 } 1259 } 1260 1261 $('body').toggleClass('off-opened'); 1262 }); 1263 1264 $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ 1265 if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { 1266 var $vMenuCont = $('#masthead .vmenu-container'), 1267 $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), 1268 1269 vmenu_h = parseFloat( $vMenuCont.outerHeight() ), 1270 vmenu_w = parseFloat( $vMenuCont.outerWidth() ), 1271 vmenu_off = $vMenuCont.offset(), 1272 vmenu_l = parseFloat(vmenu_off.left), 1273 vmenu_t = parseFloat(vmenu_off.top), 1274 vmenu_r = vmenu_l + vmenu_w, 1275 vmenu_b = vmenu_t + vmenu_h, 1276 1277 close_h = parseFloat( $close_menu.outerHeight() ), 1278 close_w = parseFloat( $close_menu.outerWidth() ), 1279 close_off = $close_menu.offset(), 1280 close_l = parseFloat(close_off.left), 1281 close_t = parseFloat(close_off.top), 1282 close_r = close_l + close_w, 1283 close_b = close_t + close_h; 1284 if ( 1285 !( 1286 e.clientX > vmenu_l && 1287 e.clientX < vmenu_r && 1288 e.clientY > vmenu_t && 1289 e.clientY < vmenu_b 1290 ) 1291 || 1292 ( 1293 e.clientX > close_l && 1294 e.clientX < close_r && 1295 e.clientY > close_t && 1296 e.clientY < close_b 1297 ) 1298 ) { 1299 $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); 1300 } 1301 } 1302 }); 1303 }; 1304 1305 function menuOverlay() { 1306 if ( $('.overlay').length ) { 1307 $('.overlay').removeClass('hidden'); 1308 } 1309 if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { 1310 $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').each(function(index, el) { 1311 var transDelay = (index / 20) + 0.1; 1312 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 1313 transDelay = transDelay + 0.3; 1314 $(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's'); 1315 }); 1316 } 1317 1318 }; 1319 var $secondary_parent; 1320 function menuAppend() { 1321 var $body = $('body'), 1322 $menuCont = $('.menu-container:not(.vmenu-container)'), 1323 $vMenuCont = $('.menu-container.vmenu-container'), 1324 $cta = $('.navbar-cta'), 1325 $socials = $('.navbar-social:not(.appended-navbar)'), 1326 $ul = $('.navbar-main ul.menu-primary-inner'), 1327 $ulCta, 1328 $ulSocials, 1329 $navLast, 1330 $firstMenu = $('.main-menu-container:first-child', $menuCont), 1331 $secondMenu = $('.main-menu-container:last-child', $menuCont), 1332 $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), 1333 $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), 1334 $ulFirst = $('> ul', $firstNav), 1335 $ulSecond = $('> ul', $secondNav), 1336 setCTA, 1337 appendCTA = function(){ 1338 return true; 1339 }, 1340 appendSocials = function(){ 1341 return true; 1342 }, 1343 appendSplit = function(){ 1344 return true; 1345 }; 1346 1347 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 1348 $ulCta = $('> ul', $cta); 1349 $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); 1350 1351 appendCTA = function(){ 1352 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1353 1354 $ul.after($ulCta); 1355 } else { 1356 $cta.append($ulCta); 1357 } 1358 } 1359 } 1360 1361 if ( ! $body.hasClass('cta-not-appended') ) { 1362 appendCTA(); 1363 } 1364 1365 var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); 1366 $smartSocial.each(function(){ 1367 var $_smartSocial = $(this); 1368 $('> li', $_smartSocial).each(function(){ 1369 var $li = $(this); 1370 if ( $li.hasClass('mobile-hidden') ) { 1371 $_smartSocial.addClass('mobile-hidden'); 1372 } else { 1373 $_smartSocial.removeClass('mobile-hidden'); 1374 return false;
1375 } 1376 }); 1377 1378 $('> li', $_smartSocial).each(function(){ 1379 var $li = $(this); 1380 if ( $li.hasClass('tablet-hidden') ) { 1381 $_smartSocial.addClass('tablet-hidden'); 1382 } else { 1383 $_smartSocial.removeClass('tablet-hidden'); 1384 return false; 1385 } 1386 }); 1387 }); 1388 1389 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { 1390 $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); 1391 if ( $body.hasClass('hmenu-center-split') ) { 1392 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1393 } else { 1394 $navLast = $('.navbar-nav-last', $vMenuCont); 1395 } 1396 1397 if ( ! $navLast.length ) { 1398 var _navLast = $('<div class="nav navbar-nav navbar-social navbar-nav-last appended-navbar" />'); 1399 if ( $body.hasClass('hmenu-center-split') ) { 1400 $('.menu-horizontal-inner', $menuCont).append(_navLast); 1401 $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); 1402 } else { 1403 $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); 1404 $navLast = $('.navbar-nav-last', $vMenuCont); 1405 } 1406 } 1407 1408 appendSocials = function(){ 1409 if ( !$body.hasClass('menu-overlay-center') ) { 1410 // if ( !$navLast.find('ul.menu-smart-social').length ) { 1411 // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); 1412 // $navLast.append('<ul class="menu-smart menu-smart-social" />'); 1413 // $ulSocials.each(function(){ 1414 // var $li_social = $(this); 1415 // $navLast.find('ul.menu-smart-social').append($li_social); 1416 // }); 1417 // } 1418 // } else { 1419 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1420 $socials.addClass('mobile-hidden').addClass('tablet-hidden') 1421 if ( ! $('> ul.menu-smart-social li', $socials).length ) { 1422 $('> ul.menu-smart-social li', $socials).remove(); 1423 } 1424 $navLast.append($ulSocials); 1425 } else { 1426 if ( ! $('> ul.menu-smart-social li', $navLast).length ) { 1427 $('> ul.menu-smart-social li', $navLast).remove(); 1428 } 1429 $socials.append($ulSocials); 1430 } 1431 } 1432 } 1433 appendSocials(); 1434 } 1435 1436 if ( $vMenuCont.length ) { 1437 var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); 1438 } else { 1439 var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); 1440 } 1441 if ( $accordion_secondary.length ) { 1442 var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); 1443 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1444 if ( !$accordion_secondary_ph.length ) { 1445 $accordion_secondary.after('<span class="accordion-secondary-ph" />'); 1446 } 1447 if ( $vMenuCont.length ) { 1448 $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); 1449 } else { 1450 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1451 $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); 1452 } else { 1453 $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); 1454 } 1455 } 1456 } else { 1457 if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { 1458 $accordion_secondary_ph.before($accordion_secondary); 1459 } 1460 } 1461 } 1462 1463 if ( $vMenuCont.length ) { 1464 var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); 1465 } else { 1466 var $extra_icons = $('.navbar-extra-icons', $menuCont); 1467 } 1468 1469 if ( $extra_icons.length ) { 1470 if ( $vMenuCont.length ) { 1471 if ( $('li:not(.social-icon)', $extra_icons).length ) { 1472 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1473 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1474 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1475 $not_social.each(function(){ 1476 if ( ! $primary_after.length ) { 1477 $('.menu-accordion-primary', $vMenuCont).after('<div class="menu-accordion menu-accordion-primary-after" />'); 1478 $primary_after = $('.menu-accordion-primary-after', $vMenuCont); 1479 $primary_after.append('<ul class="menu-smart sm sm-vertical menu-smart-social" />'); 1480 } 1481 var $extra_li = $(this); 1482 $primary_after.find('> ul').append($extra_li); 1483 }); 1484 } else { 1485 var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), 1486 $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1487 $not_social.each(function(){ 1488 var $extra_li = $(this); 1489 $extra_icons.find('> ul').append($extra_li); 1490 }); 1491 } 1492 } /*else { 1493 var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); 1494 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1495 if ( !$extra_icons_ph.length ) { 1496 $extra_icons.after('<span class="extra-icons-ph" />'); 1497 } 1498 if ( $('.navbar-accordion-cta', $vMenuCont).length ) { 1499 $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); 1500 } else { 1501 $('.menu-accordion-primary', $vMenuCont).after($extra_icons); 1502 } 1503 } else { 1504 if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { 1505 $extra_icons_ph.before($extra_icons); 1506 } 1507 } 1508 }*/ 1509 } else { 1510 if ( ! $body.hasClass('hmenu-center-double') ) { 1511 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1512 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1513 $primary_after = $('.nav.navbar-main-after', $menuCont); 1514 1515 if ( ! $primary_after.length && $not_social.length ) { 1516 if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { 1517 $('.navbar-nav.navbar-cta', $menuCont).after('<div class="nav navbar-main-after" />'); 1518 } else { 1519 $('.navbar-nav.navbar-main', $menuCont).after('<div class="nav navbar-main-after" />'); 1520 } 1521 $primary_after = $('.nav.navbar-main-after', $menuCont); 1522 $primary_after.append('<ul class="menu-smart sm menu-smart-social" />'); 1523 } 1524 var tablet_hidden = true, 1525 mobile_hidden = true; 1526 $not_social.each(function(){ 1527 var $extra_li = $(this); 1528 $primary_after.find('> ul').append($extra_li); 1529 if ( ! $extra_li.hasClass('tablet-hidden') ) { 1530 tablet_hidden = false;
1531 } 1532 if ( ! $extra_li.hasClass('mobile-hidden') ) { 1533 mobile_hidden = false; 1534 } 1535 }); 1536 if ( tablet_hidden === true && $not_social.length ) { 1537 $primary_after.addClass('tablet-hidden'); 1538 } 1539 if ( mobile_hidden === true && $not_social.length ) { 1540 $primary_after.addClass('mobile-hidden'); 1541 } 1542 } else { 1543 var $primary_after = $('.nav.navbar-main-after', $menuCont); 1544 1545 if ( $primary_after.length ) { 1546 var $not_social = $('> ul > li:not(.social-icon)', $primary_after); 1547 $not_social.each(function(){ 1548 var $extra_li = $(this); 1549 $extra_icons.find('> ul').append($extra_li); 1550 }); 1551 $primary_after.remove(); 1552 } 1553 } 1554 } 1555 } 1556 } 1557 1558 if ( ( $body.hasClass('hmenu-center-double') ) ) { 1559 appendSplit = function(){ 1560 if (UNCODE.wwidth < UNCODE.mediaQuery) { 1561 if ( $extra_icons.length ) { 1562 if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { 1563 var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), 1564 $append_ul = $('<ul class="menu-smart sm sm-vertical append-extra-icons" />'); 1565 $not_social.each(function(){ 1566 var $extra_li = $(this); 1567 $append_ul.append($extra_li); 1568 }); 1569 if ( $secondNav.length ) { 1570 $secondNav.append($append_ul); 1571 } else { 1572 $('.menu-horizontal-inner', $menuCont).prepend($append_ul); 1573 } 1574 } 1575 } 1576 if ( $secondNav.length ) { 1577 $secondNav.prepend($ulFirst); 1578 } else { 1579 $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); 1580 } 1581 $firstMenu.hide(); 1582 } else { 1583 $firstNav.append($ulFirst); 1584 var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); 1585 if ( $append_ul.length ) { 1586 var $not_social = $('> li:not(.social-icon)', $append_ul); 1587 $not_social.each(function(){ 1588 var $extra_li = $(this); 1589 $extra_icons.find('> ul').append($extra_li); 1590 }); 1591 } 1592 $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); 1593 $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); 1594 $firstMenu.css({ 1595 'display': 'table-cell' 1596 }); 1597 } 1598 } 1599 } 1600 appendSplit(); 1601 1602 $(window).on( 'resize', function(){ 1603 clearRequestTimeout(setCTA); 1604 setCTA = requestTimeout( function() { 1605 appendCTA(); 1606 appendSocials(); 1607 appendSplit(); 1608 }, 10 ); 1609 }); 1610 } 1611 //menuMobileButton(); 1612 menuMobile(); 1613 menuOffCanvas(); 1614 menuAppend(); 1615 menuOverlay(); 1616 1617 var stickyDropdownSearch = function(){ 1618 var $masthead = $('#masthead'), 1619 $ddSearch = $('.overlay.overlay-search', $masthead), 1620 $styles = $('#stickyDropdownSearch').remove(); 1621 if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { 1622 var $menuWrapper = $('.menu-wrapper'), 1623 $navbar = $('.menu-container-mobile', $menuWrapper), 1624 navbarH = $navbar.outerHeight(), 1625 //$topbar = $('.top-menu', $menuWrapper), 1626 //topbarH = $topbar.outerHeight(), 1627 _css; 1628 1629 _css = '<style type="text/css" id="stickyDropdownSearch">'; 1630 _css += '@media (max-width: 959px) {'; 1631 _css += 'body.hmenu-center.menu-sticky-mobile #masthead .overlay.overlay-search {'; 1632 _css += 'margin-top: ' + parseFloat(navbarH) + 'px !important;'; 1633 _css += '}'; 1634 _css += 'body.hmenu-center.menu-sticky-mobile .navbar.is_stuck + #masthead .overlay.overlay-search {'; 1635 _css += 'position: fixed;'; 1636 _css += 'top: 0;'; 1637 _css += '}'; 1638 _css += '</style>'; 1639 1640 $(_css).appendTo($('head')); 1641 } 1642 } 1643 stickyDropdownSearch(); 1644 1645 var setMenuOverlay; 1646 $(window).on( 'resize', function(){ 1647 if ( $('.overlay').length && $(window).width() > 1024 ) { 1648 $('.overlay').addClass('hidden'); 1649 } 1650 clearRequestTimeout(setMenuOverlay); 1651 setMenuOverlay = requestTimeout( function(){ 1652 menuOverlay(); 1653 menuAppend(); 1654 stickyDropdownSearch(); 1655 }, 150 ); 1656 }); 1657 UNCODE.menuSmartInit(); 1658}; 1659 1660UNCODE.menuSmartInit = function() { 1661 var $menusmart = $('[class*="menu-smart"]'), 1662 $masthead = $('#masthead'), 1663 $hMenu = $('.menu-horizontal-inner', $masthead), 1664 $focus = $('.overlay-menu-focus'), 1665 showTimeout = 50, 1666 hideTimeout = 50, 1667 showTimeoutFunc, hideTimeoutFunc; 1668 1669 $('> li.menu-item-has-children', $menusmart).hover(function(){ 1670 $(this).data('hover', true); 1671 }, function(){ 1672 $(this).data('hover', false); 1673 }); 1674 1675 $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ 1676 e.preventDefault(); 1677 }); 1678 1679 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 1680 var $notLis = $('> .nav > ul > li a', $hMenu), 1681 $menuA = $('a', $masthead).not($notLis), 1682 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 1683 showFuncCond = function() { return true }; 1684 1685 if ( $('body').hasClass('focus-megamenu') ) { 1686 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 1687 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 1688 } else if ( $('body').hasClass('focus-links') ) { 1689 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 1690 } 1691 1692 $hoverSelector.hover(function(){ 1693 clearRequestTimeout(hideTimeoutFunc);
1694 showTimeoutFunc = requestTimeout(function(){ 1695 $('body').addClass('navbar-hover'); 1696 }, showTimeout*2); 1697 }, function(){ 1698 hideTimeoutFunc = requestTimeout(function(){ 1699 if ( ! $('.overlay-search.open', $masthead).length ) { 1700 $('body').removeClass('navbar-hover'); 1701 } 1702 }, hideTimeout*2); 1703 }); 1704 } else { 1705 showFuncCond = function() { return false }; 1706 } 1707 1708 if ($menusmart.length > 0) { 1709 $menusmart.smartmenus({ 1710 subIndicators: false, 1711 subIndicatorsPos: 'append', 1712 //subMenusMinWidth: '13em', 1713 subIndicatorsText: '', 1714 showTimeout: showTimeout, 1715 hideTimeout: hideTimeout, 1716 showFunction: function($ul, complete) { 1717 clearRequestTimeout(showTimeoutFunc); 1718 $ul.fadeIn(0, 'linear', function(){ 1719 complete(); 1720 if ( $ul.hasClass('vc_row') ) { 1721 $ul.css({ 1722 'display': 'table' 1723 }); 1724 } 1725 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 1726 $('body').addClass('open-megamenu'); 1727 } 1728 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 1729 $('body').addClass('navbar-hover'); 1730 } 1731 }).addClass('open-animated'); 1732 }, 1733 hideFunction: function($ul, complete) { 1734 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { 1735 $('body').removeClass('open-megamenu'); 1736 } 1737 var fixIE = $('html.ie').length; 1738 if (fixIE) { 1739 var $rowParent = $($ul).closest('.main-menu-container'); 1740 $rowParent.height('auto'); 1741 } 1742 $ul.fadeOut(0, 'linear', function(){ 1743 complete(); 1744 $ul.removeClass('open-animated'); 1745 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 1746 $('body').removeClass('open-submenu'); 1747 } 1748 }); 1749 }, 1750 collapsibleShowFunction: function($ul, complete) { 1751 $ul.slideDown(400, 'easeInOutCirc', complete); 1752 }, 1753 collapsibleHideFunction: function($ul, complete) { 1754 $ul.slideUp(200, 'easeInOutCirc', complete); 1755 }, 1756 hideOnClick: true 1757 }); 1758 1759 if ( $('body').hasClass('menu-accordion-active') ) { 1760 requestTimeout(function(){ 1761 $menusmart.addClass('menu-smart-init'); 1762 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 1763 }, 1000); 1764 } 1765 1766 $(document).on( 'uncode.smartmenu-appended', function(){ 1767 requestTimeout(function(){ 1768 $menusmart.smartmenus( 'refresh' ); 1769 }, 1000); 1770 }); 1771 } 1772 1773 $('.main-menu-container').each(function(){ 1774 var $main_cont = $(this), 1775 $uls = $('ul', $main_cont); 1776 1777 $uls.each(function(){ 1778 var $ul = $(this), 1779 mobile_hidden = true, 1780 tablet_hidden = true; 1781 $('> li:not(.hidden)', $ul).each(function(){ 1782 if ( !$(this).hasClass('mobile-hidden') ) { 1783 mobile_hidden = false; 1784 return false; 1785 } 1786 }); 1787 $('> li:not(.hidden)', $ul).each(function(){ 1788 if ( !$(this).hasClass('tablet-hidden') ) { 1789 tablet_hidden = false; 1790 return false; 1791 } 1792 }); 1793 if ( mobile_hidden ) { 1794 $ul.addClass('mobile-hidden'); 1795 } 1796 if ( tablet_hidden ) { 1797 $ul.addClass('tablet-hidden'); 1798 } 1799 }); 1800 1801 var $divUlsMB = $('div:has(>ul.mobile-hidden)'); 1802 1803 $divUlsMB.each(function(){ 1804 var $divUlMB = $(this), 1805 div_mobile_hidden = true, 1806 div_tablet_hidden = true; 1807 1808 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1809 if ( !$(this).hasClass('mobile-hidden') ) { 1810 div_mobile_hidden = false; 1811 return false; 1812 } 1813 }); 1814 $('> ul:not(.hidden)', $divUlMB).each(function(){ 1815 if ( !$(this).hasClass('tablet-hidden') ) { 1816 div_tablet_hidden = false; 1817 return false; 1818 } 1819 }); 1820 if ( div_mobile_hidden ) { 1821 $divUlMB.addClass('mobile-hidden'); 1822 } 1823 if ( div_tablet_hidden ) { 1824 $divUlMB.addClass('tablet-hidden'); 1825 } 1826 }); 1827 }); 1828 1829 var overlaySearchButton = function(){ 1830 var $search_wrap = $('.overlay.overlay-search, .widget_search'); 1831 1832 $search_wrap.each(function(){ 1833 var $form = $('form', this), 1834 $icon = $('i', $form); 1835 1836 $icon.on('click', function(){ 1837 $form.submit(); 1838 }); 1839 }); 1840 }; 1841 overlaySearchButton(); 1842} 1843 1844UNCODE.okvideo = function() { 1845 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1846 $.okvideo = function(options) { 1847 // if the option var was just a string, turn it into an object 1848 if (typeof options !== 'object') options = { 1849 'video': options 1850 }; 1851 var base = this; 1852 // kick things off 1853 base.init = function() { 1854 base.options = $.extend({}, $.okvideo.options, options); 1855 // support older versions of okvideo 1856 if (base.options.video === null) base.options.video = base.options.source; 1857 base.setOptions(); 1858 var target = base.options.target || $('body'); 1859 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1860 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1861 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1862 var mask = '<div id="okplayer-mask-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:-998;height:100%;width:100%;"></div>'; 1863 if (OKEvents.utils.isMobile()) { 1864 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>'); 1865 } else { 1866 if (base.options.controls === 3) { 1867 target.append(mask) 1868 } 1869 if (base.options.adproof === 1) { 1870 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:-10%;top:-10%;overflow:hidden;z-index:' + zIndex + ';height:120%;width:120%;"></div>'); 1871 } else { 1872 target.append('<div id="okplayer-' + base.options.id + '" style="position:' + position + ';left:0;top:0;overflow:hidden;z-index:' + zIndex + ';height:100%;width:100%;"></div>'); 1873 } 1874 } 1875 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1876 if (base.options.playlist.list === null) { 1877 if (base.options.video.provider === 'youtube') { 1878 base.loadYouTubeAPI(); 1879 } else if (base.options.video.provider === 'vimeo') { 1880 base.options.volume /= 100; 1881 base.loadVimeoAPI(); 1882 } 1883 } else { 1884 base.loadYouTubeAPI(); 1885 } 1886 } 1887 }; 1888 // clean the options 1889 base.setOptions = function() { 1890 // exchange 'true' for '1' and 'false' for 3 1891 for (var key in this.options) { 1892 if (this.options[key] === true) this.options[key] = 1; 1893 if (this.options[key] === false) this.options[key] = 3; 1894 } 1895 if (base.options.playlist.list === null) { 1896 base.options.video = base.determineProvider(); 1897 } 1898 // pass options to the window 1899 $(window).data('okoptions-' + base.options.id, base.options); 1900 };
1901 // insert js into the head and exectue a callback function 1902 base.insertJS = function(src, callback){ 1903 var tag; 1904 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1905 tag = UNCODE.insertedSripts[src]; 1906 if (callback){ 1907 if (tag.readyState){ //IE 1908 tag.onreadystatechange = function(){ 1909 if (tag.readyState === "loaded" || 1910 tag.readyState === "complete"){ 1911 tag.onreadystatechange = null; 1912 callback(); 1913 } 1914 }; 1915 } else { 1916 $(tag).on('load', callback); 1917 } 1918 } 1919 return; 1920 } 1921 tag = document.createElement('script'); 1922 if (callback){ 1923 if (tag.readyState){ //IE 1924 tag.onreadystatechange = function(){ 1925 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1926 tag.onreadystatechange = null; 1927 callback(); 1928 } 1929 }; 1930 } else { 1931 tag.onload = function() { 1932 callback(); 1933 }; 1934 } 1935 } 1936 tag.src = src; 1937 var firstScriptTag = document.getElementsByTagName('script')[0]; 1938 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1939 if ( ! UNCODE.insertedSripts ) { 1940 UNCODE.insertedSripts = []; 1941 } 1942 UNCODE.insertedSripts[src] = tag; 1943 }; 1944 // load the youtube api 1945 base.loadYouTubeAPI = function(callback) { 1946 base.insertJS('https://www.youtube.com/player_api'); 1947 }; 1948 base.loadYouTubePlaylist = function() { 1949 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1950 }; 1951 // load the vimeo api by replacing the div with an iframe and loading js 1952 base.loadVimeoAPI = function() { 1953 var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id + '&autopause=0', 1954 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" webkitallowfullscreen mozallowfullscreen allowfullscreen >'); 1955 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1956 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1957 base.insertJS('//player.vimeo.com/api/player.js', function() { 1958 vimeoPlayerReady(base.options.id); 1959 }); 1960 }; 1961 // is it from youtube or vimeo? 1962 base.determineProvider = function() { 1963 var a = document.createElement('a'); 1964 a.href = base.options.video; 1965 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1966 var videoid = a.href.split('/')[3].toString(); 1967 var query = videoid.substring(videoid.indexOf('?') + 1); 1968 if (query != '') { 1969 var vars = query.split('&'); 1970 for (var i = 0; i < vars.length; i++) { 1971 var pair = vars[i].split('='); 1972 if (pair[0] == 'v') { 1973 videoid = pair[1]; 1974 } 1975 } 1976 } 1977 return { 1978 "provider": "youtube", 1979 "id": videoid 1980 }; 1981 } else if (/vimeo.com/.test(base.options.video)) { 1982 return { 1983 "provider": "vimeo", 1984 "id": (a.href.split('/')[3].toString()).split('#')[0], 1985 }; 1986 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1987 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1988 if (id.length == 11) { 1989 return { 1990 "provider": "youtube", 1991 "id": id.toString() 1992 }; 1993 } else { 1994 for (var i = 0; i < base.options.video.length; i++) { 1995 if (typeof parseInt(base.options.video[i]) !== "number") { 1996 throw 'not vimeo but thought it was for a sec'; 1997 } 1998 } 1999 return { 2000 "provider": "vimeo", 2001 "id": base.options.video 2002 }; 2003 } 2004 } else { 2005 throw "OKVideo: Invalid video source"; 2006 } 2007 }; 2008 base.init(); 2009 }; 2010 2011 var checkResize, 2012 newW = UNCODE.wwidth; 2013 2014 $.okvideo.options = { 2015 id: null, 2016 source: null, // Deprecate dis l8r 2017 video: null, 2018 playlist: { // eat ur heart out @brokyo 2019 list: null, 2020 index: 0, 2021 startSeconds: 0, 2022 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 2023 }, 2024 disableKeyControl: 1, 2025 captions: 0, 2026 loop: 1, 2027 hd: 1, 2028 volume: 0, 2029 adproof: false, 2030 unstarted: null, 2031 onFinished: null, 2032 onReady: null, 2033 onPlay: null, 2034 onPause: null, 2035 buffering: null, 2036 controls: false, 2037 autoplay: true, 2038 annotations: true, 2039 cued: null 2040 }; 2041 $.fn.okvideo = function(options) { 2042 options.target = this; 2043 return this.each(function() { 2044 (new $.okvideo(options)); 2045 }); 2046 }; 2047 2048 var checkForVideos = function(){ 2049 $(".uncode-video-container.video").each(function(index, el) { 2050 var $this = $(this), 2051 mobile_ready = $this.hasClass('no-control-mobile-autoplay'), 2052 url = $this.attr('data-video'), 2053 id = $this.attr('data-id'), 2054 cloned = $this.closest('.owl-item'); 2055 2056 if ( mobile_ready || newW >= UNCODE.mediaQuery ) { 2057 if (!cloned.hasClass('cloned') || cloned.length == 0) { 2058 $this.okvideo({ 2059 id: id, 2060 source: url.split('#')[0], 2061 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 2062 autoplay: 1, 2063 controls: 0, 2064 volume: 0, 2065 adproof: 0, 2066 caller: $this, 2067 hd: 1, 2068 onReady: function(player) { 2069 var getPlayer = player.c || player.h || player, 2070 $iframe, 2071 getContainer = $(getPlayer).closest('.background-element'); 2072 if (getContainer.length) { 2073 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 2074 } 2075 2076 if ( $this.hasClass('drop-move') ) { 2077 2078 var $iframe = $(getPlayer), 2079 w = parseFloat($iframe.attr('width')), 2080 h = parseFloat($iframe.attr('height')), 2081 ratio = h / w, 2082 setResizeiFto, 2083 resizeiFrame = function(){ 2084 var dataW = $this.attr('data-w'), 2085 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2086 newH = newW * ratio; 2087 $iframe.css({ 2088 width: newW, 2089 height: newH 2090 }); 2091 }; 2092 resizeiFrame(); 2093 $(window).on( 'load', resizeiFrame ); 2094 $(window).on( 'resize', function(){ 2095 clearRequestTimeout(setResizeiFto); 2096 setResizeiFto = requestTimeout( function() { 2097 resizeiFrame(); 2098 }, 10 ); 2099 }); 2100 2101 } 2102 2103 } 2104 }); 2105 } 2106 } 2107 }); 2108 }; 2109 2110 checkForVideos(); 2111 2112 $(window).on('load', function(){ 2113 $('.mejs-fullscreen-button button').on('click', function(){ 2114 var $button = $(this), 2115 $stuck = $button.closest('.is_stucked'); 2116 2117 if ( $stuck.length ) { 2118 $stuck = $(this).trigger("sticky_kit:detach"); 2119 window.scrollTo(0, 0); 2120 } 2121 }); 2122 }); 2123 2124 var checkVideoResize = function(){ 2125 clearRequestTimeout(checkResize); 2126 checkResize = requestTimeout(function(){ 2127 if ( newW !== UNCODE.wwidth ) { 2128 newW = UNCODE.wwidth; 2129 checkForVideos(); 2130 } 2131 }, 1000); 2132 }; 2133 2134 $(window).off('resize', checkVideoResize) 2135 .on( 'resize', checkVideoResize); 2136 2137}; 2138 2139UNCODE.backgroundSelfVideos = function( $ctx ) { 2140 2141 var backgroundSelfVideosInit = function( $ctx ) { 2142 if ( SiteParameters.block_mobile_videos === true ) { 2143 return false;
2144 } 2145 if (typeof MediaElement === "function") { 2146 if ( typeof $ctx === 'undefined' ) { 2147 $ctx = document; 2148 } 2149 2150 $(".background-video-shortcode", $ctx).each(function(index, el) { 2151 if ( $(this).closest('mediaelementwrapper').length ) { 2152 return true; 2153 } 2154 var $video_el = $(this), 2155 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 2156 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 2157 video_id = $video_el.attr('id'); 2158 2159 if ( SiteParameters.is_frontend_editor ) { 2160 video_id = video_id + '_' + index; 2161 $video_el.attr('id', video_id); 2162 } 2163 2164 var media = new MediaElement(video_id, { 2165 startVolume: 0, 2166 loop: true, 2167 success: function(mediaElement, domObject) { 2168 domObject.volume = 0; 2169 $(mediaElement).data('started', false); 2170 mediaElement.addEventListener('timeupdate', function(e) { 2171 if (!$(e.target).data('started')) { 2172 $(mediaElement).data('started', true); 2173 } 2174 }); 2175 mediaElement.addEventListener('loadedmetadata', function(e) { 2176 $('body').removeClass('video-not-supported'); 2177 mediaElement.play(); 2178 }); 2179 if (!UNCODE.isMobile) { 2180 requestTimeout(function() { 2181 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 2182 }, 100); 2183 } 2184 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 2185 mediaElement.play(); 2186 } 2187 2188 if ( $parent_drop_move.length ) { 2189 var setResizeMEto, 2190 resizeMediaElement = function(){ 2191 var dataW = $parent_drop_move.attr('data-w'), 2192 videoW = domObject.width, 2193 videoH = domObject.height, 2194 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 2195 newH = newW / ( videoW / videoH ); 2196 2197 $(domObject).css({ 2198 'height': newH, 2199 'width': newW 2200 }); 2201 }; 2202 $(window).on( 'resize load', function(){ 2203 clearRequestTimeout(setResizeMEto); 2204 setResizeMEto = requestTimeout( function() { 2205 resizeMediaElement(); 2206 }, 10 ); 2207 }); 2208 } 2209 2210 mediaElement.addEventListener('play', function() { 2211 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2212 $(mediaElement).closest('#page-header').addClass('video-started'); 2213 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2214 }, true); 2215 2216 }, 2217 // fires when a problem is detected 2218 error: function() {} 2219 }); 2220 }); 2221 } else { 2222 2223 if ( typeof $ctx === 'undefined' ) { 2224 $ctx = document; 2225 } 2226 2227 const videos = $ctx.querySelectorAll(".background-video-shortcode:not(.started)"); 2228 Array.from(videos).forEach(function(video_el) { 2229 video_el.play(); 2230 if ( video_el.currentTime > 0 && video_el.readyState > 2 ) { 2231 video_el.muted = true; 2232 video_el.loop = true; 2233 $(video_el).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 2234 $(video_el).addClass('started').closest('#page-header').addClass('video-started'); 2235 $(video_el).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 2236 } else { 2237 requestTimeout(function(){ 2238 backgroundSelfVideosInit( $ctx ); 2239 }, 100); 2240 } 2241 }); 2242 } 2243 }; 2244 2245 backgroundSelfVideosInit( $ctx ); 2246 2247 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2248 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 2249 var $el = model.view.$el, 2250 shortcode = model.attributes.shortcode; 2251 2252 if (typeof MediaElement === "function") { 2253 backgroundSelfVideosInit( $el ); 2254 } else { 2255 backgroundSelfVideosInit( $el[0] ); 2256 } 2257 }); 2258 } 2259}; 2260 2261UNCODE.is_scrolling = false; 2262 2263UNCODE.disableHoverScroll = function() { 2264 2265 if (!UNCODE.isMobile && !UNCODE.isFullPage && !SiteParameters.is_frontend_editor) { 2266 var body = document.body, 2267 timer; 2268 2269 window.addEventListener('scroll', function() { 2270 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 2271 clearRequestTimeout(timer); 2272 if ( body.classList && !body.classList.contains('disable-hover') ) { 2273 body.classList.add('disable-hover'); 2274 window.dispatchEvent(new CustomEvent('disable-hover')); 2275 } 2276 UNCODE.is_scrolling = true; 2277 2278 timer = requestTimeout(function() { 2279 if ( body.classList ) { 2280 body.classList.remove('disable-hover'); 2281 window.dispatchEvent(new CustomEvent('enable-hover')); 2282 } 2283 UNCODE.is_scrolling = false;
2284 }, delay); 2285 }, false); 2286 } 2287}; 2288 2289UNCODE.isotopeLayout = function() { 2290 if ($('.isotope-layout').length > 0) { 2291 var isotopeContainersArray = [], 2292 typeGridArray = [], 2293 layoutGridArray = [], 2294 screenLgArray = [], 2295 screenMdArray = [], 2296 screenSmArray = [], 2297 transitionDuration = [], 2298 $filterItems = [], 2299 $filters = $('.isotope-system .isotope-filters'), 2300 $itemSelector = '.tmb-iso', 2301 $items, 2302 itemMargin, 2303 correctionFactor = 0, 2304 firstLoad = true, 2305 isOriginLeft = $('body').hasClass('rtl') ? false : true; 2306 $('[class*="isotope-container"]').each(function(index) { 2307 var _this = $(this); 2308 var isoData = _this.data(), 2309 $data_lg, 2310 $data_md, 2311 $data_sm; 2312 _this.children('.tmb').addClass('tmb-iso'); 2313 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 2314 else $data_lg = '1000'; 2315 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 2316 else $data_md = '600'; 2317 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 2318 else $data_sm = '480'; 2319 screenLgArray.push($data_lg); 2320 screenMdArray.push($data_md); 2321 screenSmArray.push($data_sm); 2322 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 2323 if (isoData.type == 'metro') typeGridArray.push(true); 2324 else typeGridArray.push(false); 2325 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 2326 else layoutGridArray.push('masonry'); 2327 isotopeContainersArray.push(_this); 2328 _this.attr('data-iso-index', index); 2329 }); 2330 var colWidth = function(index) { 2331 $(isotopeContainersArray[index]).width(''); 2332 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 2333 widthAvailable = $(isotopeContainersArray[index]).width(), 2334 columnNum = 12, 2335 columnWidth = 0, 2336 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 2337 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 2338 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 2339 $rowContainer, 2340 paddingRow, 2341 $colContainer, 2342 paddingCol; 2343 2344 if ( consider_menu ) 2345 winHeight = winHeight - UNCODE.menuHeight; 2346 2347 if ( data_vp_height === '1' ) { 2348 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 2349 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2350 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 2351 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 2352 winHeight = winHeight - ( paddingRow + paddingCol ); 2353 } 2354 2355 if (isPx) { 2356 columnWidth = Math.ceil(widthAvailable / columnNum); 2357 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 2358 } else { 2359 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 2360 } 2361 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 2362 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 2363 for (var i = 0, len = $items.length; i < len; i++) { 2364 var $item = $($items[i]), 2365 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 2366 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 2367 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 2368 2369 2370 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 2371 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 2372 } 2373 2374 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 2375 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 2376 } 2377 2378 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 2379 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2380 switch (parseInt(multiplier_w[1])) { 2381 case (5): 2382 case (4): 2383 case (3): 2384 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2385 multiplier_w[1] = 6; 2386 break; 2387 case (2): 2388 case (1): 2389 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 2390 multiplier_w[1] = 3; 2391 break; 2392 default: 2393 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2394 multiplier_w[1] = 12; 2395 break; 2396 } 2397 2398 if (multiplier_w[1] == 2.4) { // 5 columns 2399 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2400 multiplier_w[1] = 6; 2401 } 2402 } 2403 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 2404 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2405 switch (parseInt(multiplier_w[1])) { 2406 case (5): 2407 case (4): 2408 case (3): 2409 case (2): 2410 case (1): 2411 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2412 multiplier_w[1] = 6; 2413 break; 2414 default: 2415 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2416 multiplier_w[1] = 12; 2417 break; 2418 } 2419 2420 if (multiplier_w[1] == 2.4) { // 5 columns 2421 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 2422 multiplier_w[1] = 6; 2423 } 2424 } 2425 } else if (widthAvailable < screenSmArray[index]) { 2426 if (multiplier_w != null && multiplier_w[1] !== undefined) { 2427 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 2428 multiplier_w[1] = 12; 2429 if (typeGridArray[index]) multiplier_h[1] = 12; 2430 } 2431 } 2432 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 2433 height; 2434 2435 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 2436 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 2437 if ( widthAvailable < screenSmArray[index] ) { 2438 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 2439 } 2440 } else { 2441 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 2442 } 2443 2444 if (width >= widthAvailable) { 2445 $item.css({ 2446 width: widthAvailable 2447 }); 2448 if (typeGridArray[index]) { 2449 $item.children().add($item.find('.backimg')).css({ 2450 height: height 2451 }); 2452 } 2453 } else { 2454 $item.css({ 2455 width: width 2456 }); 2457 if (typeGridArray[index]) { 2458 $item.children().add($item.find('.backimg')).css({ 2459 height: height 2460 }); 2461 } 2462 } 2463 } 2464 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 2465 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 2466 } else { 2467 return columnWidth; 2468 } 2469 }, 2470 init_isotope = function() { 2471 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 2472 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 2473 isotopeId = isotopeSystem.attr('id'), 2474 $layoutMode = layoutGridArray[i], 2475 setIsotopeFirstRowTimeOut, 2476 setIsotopeFirstRow = function(items){ 2477 var firstRow = true; 2478 $(items).each(function(index, val){ 2479 var el = items[index].element, 2480 el_top = items[index].position.y, 2481 $el = $(el); 2482 if ( index > 0 && el_top > 0 && firstRow ) { 2483 firstRow = false;
2484 } else if ( index == 0 && el_top == 0 ) { 2485 firstRow = true; 2486 } 2487 if ( firstRow ) { 2488 $el.removeClass('tmb-isotope-further-row'); 2489 } else { 2490 $el.addClass('tmb-isotope-further-row'); 2491 } 2492 }); 2493 }; 2494 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 2495 //resizable: true, 2496 itemSelector: $itemSelector, 2497 layoutMode: $layoutMode, 2498 transitionDuration: transitionDuration[i], 2499 masonry: { 2500 columnWidth: colWidth(i) 2501 }, 2502 vertical: { 2503 horizontalAlignment: 0.5, 2504 }, 2505 sortBy: 'original-order', 2506 isOriginLeft: isOriginLeft 2507 }) 2508 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 2509 .on('layoutComplete', function( event, items ){ 2510 if ( typeof items[0] !== 'undefined' ) { 2511 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2512 setIsotopeFirstRow(items); 2513 } 2514 } 2515 }) 2516 .on('arrangeComplete', function( event, items ){ 2517 if ( typeof items[0] !== 'undefined' ) { 2518 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 2519 clearRequestTimeout(setIsotopeFirstRowTimeOut); 2520 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 2521 setIsotopeFirstRow(items); 2522 }, 100); 2523 } 2524 } 2525 }); 2526 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 2527 $(isotopeContainersArray[i]).infinitescroll({ 2528 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 2529 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 2530 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li.filter-cat', // selector for all items you'll retrieve 2531 animate: false, 2532 behavior: 'local', 2533 debug: false, 2534 loading: { 2535 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 2536 speed: 0, 2537 finished: undefined, 2538 msg: $('#' + isotopeId + ' .loadmore-button'), 2539 }, 2540 errorCallback: function() { 2541 var isotope_system = $(this).closest('.isotope-system'); 2542 $('.loading-button', isotope_system).hide(); 2543 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 2544 } 2545 }, 2546 // append the new items to isotope on the infinitescroll callback function. 2547 function(newElements, opts) { 2548 var $isotope = $(this), 2549 isotopeId = $isotope.closest('.isotope-system').attr('id'), 2550 filters = new Array(), 2551 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 2552 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 2553 $numPages = $('a', $infinite_button).data('pages'), 2554 delay = 300; 2555 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 2556 $infinite_button.show(); 2557 $loading_button.hide(); 2558 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 2559 $('> li', $isotope).remove(); 2560 $.each($(newElements), function(index, val) { 2561 $(val).addClass('tmb-iso'); 2562 if ($(val).is("li")) { 2563 filters.push($(val)[0]); 2564 } 2565 }); 2566 newElements = newElements.filter(function(x) { 2567 return filters.indexOf(x) < 0 2568 }); 2569 $.each($(filters), function(index, val) { 2570 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 2571 }); 2572 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 2573 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2574 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 2575 if (typeof getLightbox === 'object') { 2576 getLightbox.refresh(); 2577 } else { 2578 UNCODE.lightbox(); 2579 } 2580 } 2581 if ( typeof twttr !== 'undefined' ) 2582 twttr.widgets.load(isotopeContainersArray[i]); 2583 2584 requestTimeout(function() { 2585 Waypoint.refreshAll(); 2586 $isotope.trigger('more-items-loaded'); 2587 }, 1000); 2588 2589 }); 2590 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 2591 var $infinite_isotope = $(isotopeContainersArray[i]), 2592 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 2593 $infinite_isotope.infinitescroll('pause'); 2594 $infinite_button.on('click', function(event) { 2595 event.preventDefault(); 2596 var $infinite_system = $(event.target).closest('.isotope-system'), 2597 $infinite_isotope = $infinite_system.find('.isotope-container'), 2598 isotopeId = $infinite_system.attr('id'); 2599 $(event.currentTarget).html(SiteParameters.loading); 2600 $infinite_isotope.infinitescroll('resume'); 2601 $infinite_isotope.infinitescroll('retrieve'); 2602 $infinite_isotope.infinitescroll('pause'); 2603 }); 2604 } 2605 } 2606 } 2607 }, 2608 onLayout = function(isotopeObj, startIndex, needsReload) { 2609 var needsReload = needsReload ? true : false;
2610 2611 if (typeof UNCODE.bigText !== 'undefined') { 2612 UNCODE.bigText(); 2613 } 2614 isotopeObj.css('opacity', 1); 2615 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 2616 2617 requestTimeout(function() { 2618 if (startIndex > 0) { 2619 reloadIsotope(isotopeObj); 2620 if (SiteParameters.dynamic_srcset_active === '1') { 2621 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2622 UNCODE.adaptive_srcset(isotopeObj); 2623 } 2624 // window.dispatchEvent(UNCODE.boxEvent); 2625 } else if (needsReload) { 2626 reloadIsotope(isotopeObj); 2627 } 2628 2629 UNCODE.adaptive(); 2630 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 2631 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 2632 } 2633 if (typeof MediaElement === "function") { 2634 $(isotopeObj).find('audio,video').each(function() { 2635 $(this).mediaelementplayer({ 2636 pauseOtherPlayers: false, 2637 }); 2638 }); 2639 } 2640 if ($(isotopeObj).find('.nested-carousel').length) { 2641 if (typeof UNCODE.carousel !== 'undefined') { 2642 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 2643 } 2644 requestTimeout(function() { 2645 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2646 }, 200); 2647 } else { 2648 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 2649 } 2650 isotopeObj.trigger('isotope-layout-complete'); 2651 2652 }, 100); 2653 2654 }, 2655 boxAnimation = function(items, startIndex, sequential, container) { 2656 var $allItems = items.length - startIndex, 2657 showed = 0, 2658 index = 0; 2659 if (container.closest('.owl-item').length == 1) return false; 2660 $.each(items, function(index, val) { 2661 var $this = $(val), 2662 elInner = $('> .t-inside', val); 2663 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2664 return; 2665 } 2666 if (val[0]) val = val[0]; 2667 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 2668 new Waypoint({ 2669 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2670 element: val, 2671 handler: function() { 2672 var element = $('> .t-inside', this.element), 2673 parent = $(this.element), 2674 currentIndex = parent.index(); 2675 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 2676 delayAttr = parseInt(element.attr('data-delay')); 2677 if (isNaN(delayAttr)) delayAttr = 100; 2678 delay -= showed; 2679 var objTimeout = requestTimeout(function() { 2680 element.removeClass('zoom-reverse').addClass('start_animation'); 2681 showed = parent.index(); 2682 if ( container.data('isotope') ) { 2683 container.isotope('layout'); 2684 } 2685 }, delay * delayAttr) 2686 parent.data('objTimeout', objTimeout); 2687 if (!UNCODE.isUnmodalOpen) { 2688 this.destroy(); 2689 } 2690 }, 2691 offset: '100%' 2692 }) 2693 } else { 2694 if (elInner.hasClass('force-anim')) { 2695 elInner.addClass('start_animation'); 2696 } else { 2697 elInner.css('opacity', 1); 2698 } 2699 container.isotope('layout'); 2700 } 2701 2702 index++; 2703 }); 2704 }, 2705 reloadIsotope = function(isotopeObj) { 2706 var isoIndex = $(isotopeObj).attr('data-iso-index'); 2707 var $layoutMode = ($(isotopeObj).data('layout')); 2708 if ($layoutMode === undefined) { 2709 $layoutMode = 'masonry'; 2710 } 2711 if (isotopeObj.data('isotope')) { 2712 isotopeObj.isotope({ 2713 itemSelector: $itemSelector, 2714 layoutMode: $layoutMode, 2715 transitionDuration: transitionDuration[isoIndex], 2716 masonry: { 2717 columnWidth: colWidth(isoIndex) 2718 }, 2719 vertical: { 2720 horizontalAlignment: 0.5, 2721 }, 2722 sortBy: 'original-order', 2723 isOriginLeft: isOriginLeft 2724 }); 2725 } 2726 } 2727 ; 2728 if ($('.isotope-pagination').length > 0) { 2729 $('.isotope-system').on('click', '.pagination a', function(evt) { 2730 evt.preventDefault(); 2731 2732 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 2733 container = $(this).closest('.isotope-system'), 2734 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2735 calc_scroll -= UNCODE.get_scroll_offset(); 2736 2737 var menu_container = $('.menu-sticky'); 2738 var menu = menu_container.find('.menu-container'); 2739 2740 if (menu_container.length > 0 && menu.length > 0) { 2741 calc_scroll = calc_scroll - menu.outerHeight(); 2742 } 2743 2744 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2745 delta = bodyTop - calc_scroll, 2746 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 2747 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2748 2749 if ( !UNCODE.isFullPage ) { 2750 if (scrollSpeed == 0) { 2751 $('html, body').scrollTop(calc_scroll); 2752 } else { 2753 $('html, body').animate({ 2754 scrollTop: calc_scroll 2755 },{ 2756 easing: 'easeInOutQuad', 2757 duration: scrollSpeed, 2758 complete: function(){ 2759 UNCODE.scrolling = false;
2760 } 2761 }); 2762 } 2763 } 2764 2765 loadIsotope($(this), true); 2766 evt.preventDefault(); 2767 }); 2768 } 2769 $filters.on('click', 'a.isotope-nav-link', function(evt) { 2770 if ($(this).hasClass('no-isotope-filter')) { 2771 return; 2772 } 2773 var $filter = $(this), 2774 filterContainer = $filter.closest('.isotope-filters'), 2775 filterValue = $filter.attr('data-filter'), 2776 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 2777 transitionDuration = container.data().isotope.options.transitionDuration, 2778 delay = 300, 2779 filterItems = []; 2780 2781 var filter_items = function(){ 2782 if (filterValue !== undefined) { 2783 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2784 var parent = $(val).parent(), 2785 objTimeout = parent.data('objTimeout'); 2786 if (objTimeout) { 2787 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2788 clearRequestTimeout(objTimeout); 2789 } 2790 if (transitionDuration == 0) { 2791 if ($(val).hasClass('animate_when_almost_visible')) { 2792 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2793 } else { 2794 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2795 } 2796 } 2797 }); 2798 requestTimeout(function(){ 2799 if ( filterValue == '*' ) { 2800 container.removeClass('isotope-filtered'); 2801 } else { 2802 container.addClass('isotope-filtered'); 2803 } 2804 container.isotope({ 2805 filter: function() { 2806 var block = $(this), 2807 filterable = (filterValue == '*') || block.hasClass(filterValue), 2808 lightboxElements = $('[data-lbox^=ilightbox]', block); 2809 if (filterable) { 2810 if (lightboxElements.length) { 2811 lightboxElements.removeClass('lb-disabled'); 2812 container.data('lbox', $(lightboxElements[0]).data('lbox')); 2813 } 2814 filterItems.push(block); 2815 } else { 2816 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 2817 } 2818 container.trigger('more-items-loaded'); 2819 return filterable; 2820 } 2821 }); 2822 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 2823 2824 }, delay); 2825 2826 /** once filtered - start **/ 2827 container.isotope('once', 'arrangeComplete', function() { 2828 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2829 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 2830 if (typeof getLightbox === 'object') { 2831 getLightbox.refresh(); 2832 } else { 2833 UNCODE.lightbox(); 2834 } 2835 } 2836 if (transitionDuration == 0) { 2837 requestTimeout(function() { 2838 boxAnimation(filterItems, 0, false, container); 2839 }, 100); 2840 } 2841 requestTimeout(function() { 2842 Waypoint.refreshAll(); 2843 }, 2000); 2844 }); 2845 /** once filtered - end **/ 2846 } else { 2847 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2848 $.each(UNCODE.lightboxArray, function(index, val) { 2849 UNCODE.lightboxArray[index].destroy(); 2850 }); 2851 } 2852 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 2853 var parent = $(val).parent(), 2854 objTimeout = parent.data('objTimeout'); 2855 if (objTimeout) { 2856 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2857 clearRequestTimeout(objTimeout); 2858 } 2859 if (transitionDuration == 0) { 2860 if ($(val).hasClass('animate_when_almost_visible')) { 2861 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2862 } else { 2863 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 2864 } 2865 } 2866 }); 2867 container.parent().addClass('grid-loading'); 2868 loadIsotope($filter); 2869 } 2870 }; 2871 2872 if (!$filter.hasClass('active')) { 2873 /** Scroll top with filtering */ 2874 if (filterContainer.hasClass('filter-scroll')) { 2875 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 2876 calc_scroll -= UNCODE.get_scroll_offset(); 2877 2878 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 2879 delta = bodyTop - calc_scroll, 2880 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 2881 filterTolerance = false, 2882 filter_timeout; 2883 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 2884 2885 if ( !UNCODE.isFullPage ) { 2886 if (scrollSpeed == 0) { 2887 $('html, body').scrollTop(calc_scroll); 2888 UNCODE.scrolling = false;
2889 filter_items(); 2890 } else { 2891 2892 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 2893 filter_items(); 2894 filterTolerance = true; 2895 } 2896 2897 $('html, body').animate({ 2898 scrollTop: calc_scroll 2899 },{ 2900 easing: 'easeInOutQuad', 2901 duration: scrollSpeed, 2902 complete: function(){ 2903 UNCODE.scrolling = false; 2904 if ( !filterTolerance ) { 2905 filter_timeout = setTimeout(function(){ 2906 clearTimeout(filter_timeout); 2907 filter_items(); 2908 }, 200); 2909 } 2910 } 2911 }); 2912 } 2913 } 2914 } else { 2915 filter_items(); 2916 } 2917 } 2918 evt.preventDefault(); 2919 }); 2920 2921 $(window).off('popstate.isotopegrid').on("popstate.isotopegrid", function(e) { 2922 var params = UNCODE.getURLParams(window.location); 2923 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 2924 2925 UNCODE.lastURL = window.location.href; 2926 2927 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 2928 return; 2929 } 2930 2931 if (params.id === undefined) { 2932 $.each($('.isotope-system'), function(index, val) { 2933 loadIsotope($(val)); 2934 }); 2935 } else { 2936 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 2937 loadIsotope($('#' + params.id)); 2938 } 2939 } 2940 }); 2941 2942 var loadIsotope = function($href, $paginating) { 2943 var is_paginating = false; 2944 2945 if (undefined !== $paginating && $paginating) { 2946 var is_paginating = $paginating; 2947 } 2948 2949 var href = ($href.is("a") ? $href.attr('href') : location), 2950 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 2951 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 2952 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 2953 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 2954 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 2955 isotopeId = isotopeSystem.attr('id'); 2956 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 2957 UNCODE.lastURL = href; 2958 history.pushState({ 2959 myIsotope: true 2960 }, document.title, href); 2961 } 2962 if (is_paginating) { 2963 isotopeWrapper.addClass('grid-filtering'); 2964 } 2965 $.ajax({ 2966 url: href 2967 }).done(function(data) { 2968 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 2969 $resultPagination = $(data).find('#' + isotopeId + ' .pagination')[0], 2970 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count')[0]; 2971 isotopeWrapper.addClass('isotope-reloaded'); 2972 requestTimeout(function() { 2973 isotopeWrapper.removeClass('grid-loading'); 2974 isotopeWrapper.removeClass('isotope-reloaded'); 2975 isotopeWrapper.removeClass('grid-filtering'); 2976 }, 500); 2977 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 2978 var parent = $(val).parent(), 2979 objTimeout = parent.data('objTimeout'); 2980 if (objTimeout) { 2981 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2982 clearRequestTimeout(objTimeout); 2983 } 2984 if ($(val).hasClass('animate_when_almost_visible')) { 2985 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2986 } else { 2987 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 2988 } 2989 }); 2990 requestTimeout(function() { 2991 if (isotopeContainer.data('isotope')) { 2992 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 2993 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 2994 UNCODE.adaptive(); 2995 if (SiteParameters.dynamic_srcset_active === '1') { 2996 UNCODE.adaptive_srcset(isotopeContainer); 2997 } 2998 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 2999 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 3000 if (typeof getLightbox === 'object') { 3001 getLightbox.refresh(); 3002 } else { 3003 UNCODE.lightbox(); 3004 } 3005 } 3006 } 3007 isotopeContainer.trigger('more-items-loaded'); 3008 }, 300); 3009 $('.pagination', isotopeFooter).remove(); 3010 isotopeFooter.append($resultPagination); 3011 3012 if (isotopeResultCount.length > 0) { 3013 $('.woocommerce-result-count', isotopeResultCount).remove(); 3014 isotopeResultCount.append($resultCount); 3015 } 3016 }); 3017 }; 3018 $filters.each(function(i, buttonGroup) { 3019 var $buttonGroup = $(buttonGroup); 3020 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 3021 $buttonGroup.find('.active').removeClass('active'); 3022 $(this).addClass('active'); 3023 3024 }); 3025 3026 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 3027 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 3028 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 3029 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 3030 e.preventDefault(); 3031 $cats_filters.slideToggle(400, 'easeInOutCirc'); 3032 }); 3033 3034 }); 3035 window.addEventListener('boxResized', function(e) { 3036 if (UNCODE.printDialogOpen !== false) { 3037 return false;
3038 } 3039 $.each($('.isotope-layout'), function(index, val) { 3040 var $layoutMode = ($(this).data('layout')); 3041 if ($layoutMode === undefined) $layoutMode = 'masonry'; 3042 if ($(this).data('isotope')) { 3043 $(this).isotope({ 3044 itemSelector: $itemSelector, 3045 layoutMode: $layoutMode, 3046 transitionDuration: transitionDuration[index], 3047 masonry: { 3048 columnWidth: colWidth(index) 3049 }, 3050 vertical: { 3051 horizontalAlignment: 0.5, 3052 }, 3053 sortBy: 'original-order', 3054 isOriginLeft: isOriginLeft 3055 }); 3056 $(this).isotope('unbindResize'); 3057 if (SiteParameters.dynamic_srcset_active === '1') { 3058 UNCODE.refresh_dynamic_srcset_size($(this)); 3059 } 3060 } 3061 $(this).find('.mejs-video,.mejs-audio').each(function() { 3062 $(this).trigger('resize'); 3063 }); 3064 }); 3065 }, false); 3066 3067 init_isotope(); 3068 }; 3069} 3070 3071UNCODE.lightbox = function() { 3072 if ( SiteParameters.lbox_enhanced ) { 3073 return true; 3074 } 3075 UNCODE.lightboxArray = {}; 3076 requestTimeout(function() { 3077 var groupsArr = {}; 3078 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init]), .uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function() { 3079 var group = this.getAttribute("data-lbox"), 3080 values = $(this).data(); 3081 $(this).attr('data-lbox-init','true') 3082 groupsArr[group] = values; 3083 }); 3084 for (var i in groupsArr) { 3085 var skin = groupsArr[i].skin || 'black', 3086 path = groupsArr[i].dir || 'horizontal', 3087 thumbs = !groupsArr[i].notmb || false, 3088 arrows = !groupsArr[i].noarr || false, 3089 social = groupsArr[i].social || false, 3090 deeplink = groupsArr[i].deep || false, 3091 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)'), 3092 counter = $els.length, 3093 dataAlbum = $els.attr('data-album'); 3094 if (social) social = { 3095 facebook: true, 3096 twitter: true, 3097 reddit: true, 3098 digg: true 3099 }; 3100 UNCODE.lightboxArray[i] = $els.iLightBox({ 3101 selector: '[data-lbox="' + i + '"]:not(.lb-disabled), .uncode-lbox:not(.lb-disabled)', 3102 skin: skin, 3103 path: path, 3104 linkId: deeplink, 3105 infinite: false, 3106 //fullViewPort: 'fit', 3107 smartRecognition: false, 3108 fullAlone: true, 3109 maxScale: 1, 3110 minScale: .02, 3111 //fullStretchTypes: 'flash, video', 3112 overlay: { 3113 opacity: .94 3114 }, 3115 controls: { 3116 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 3117 fullscreen: true, 3118 thumbnail: thumbs, 3119 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 3120 }, 3121 show: { 3122 speed: 200 3123 }, 3124 hide: { 3125 speed: 200 3126 }, 3127 social: { 3128 start: false, 3129 buttons: social 3130 }, 3131 caption: { 3132 start: false 3133 }, 3134 styles: { 3135 nextOpacity: 1, 3136 nextScale: 1, 3137 prevOpacity: 1, 3138 prevScale: 1 3139 }, 3140 effects: { 3141 switchSpeed: 400 3142 }, 3143 slideshow: { 3144 pauseTime: 5000 3145 }, 3146 thumbnails: { 3147 maxWidth: 60, 3148 maxHeight: 60, 3149 activeOpacity: .2 3150 }, 3151 html5video: { 3152 preload: true 3153 }, 3154 callback: { 3155 onOpen: function(){ 3156 $(window).trigger('uncode-custom-cursor'); 3157 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3158 iNoBounce.enable(); 3159 } 3160 }, 3161 onHide: function(){ 3162 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 3163 iNoBounce.disable() 3164 } 3165 }, 3166 } 3167 }); 3168 3169 $(document).on('infinite-loaded', function(){ 3170 UNCODE.lightboxArray[i].refresh(); 3171 }); 3172 3173 $(window).on('gdprOpen', function(){ 3174 UNCODE.lightboxArray[i].close(); 3175 }); 3176 }; 3177 }, 100); 3178 3179 $(document).on('click', '.lb-disabled', function(e){ 3180 e.preventDefault(); 3181 }); 3182}; 3183 3184UNCODE.lightgallery = function( $el ) { 3185 var createSelectors = function(){ 3186 $('a[data-lbox]:not([data-lbox-init]):not([data-album])').each(function(){ 3187 if ( !$(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3188 $(this).addClass('lbox-trigger-item'); 3189 } else if ( $(this).closest('.nested-carousel').length && !$(this).closest('.owl-item.cloned').length && !$(this).hasClass('lb-disabled') ) { 3190 $(this).addClass('lbox-nested-item'); 3191 } else { 3192 $(this).removeClass('lbox-trigger-item'); 3193 $(this).removeClass('lbox-nested-item'); 3194 } 3195 }); 3196 }; 3197 3198 createSelectors(); 3199 3200 var galleries = [], 3201 nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3202 return !$(this).closest('.nested-carousel').length; 3203 }), 3204 $_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 *'), 3205 $galleries = $_galleries.filter(function( index ) { 3206 return !$(this).closest('.owl-carousel').length || $(this).is('.owl-carousel'); 3207 }), 3208 $nested = $('.nested-carousel:not([data-lbox-init])').has('.lbox-nested-item'); 3209 3210 if ( typeof $el === 'undefined' ) { 3211 $el = $galleries.add( $nested ); 3212 } 3213 3214 var $disabled = $('a.lb-disabled'); 3215 $disabled.on('click', function(e){ 3216 e.preventDefault(); 3217 }); 3218 3219 var beforeSlide = function(event) { 3220 var detail = event.detail, 3221 info = detail.info, 3222 item = detail.item, 3223 $slide = $(detail.currentSlide.selector), 3224 $video = $('video', $slide), 3225 $previous = $(detail.previousSlide.selector), 3226 $prevVideo = $('video', $previous), 3227 isAudio = false;
3228 3229 if ( typeof info.src !== 'undefined' ) { 3230 isAudio = info.src.search(/.mp3|.m4a/i) > -1; 3231 } 3232 3233 if ( ! $video.length && ( info.video || isAudio ) ) { 3234 if ( info.video ) { 3235 if ( typeof info.video === 'object' ) { 3236 var infoJson = info.video; 3237 } else { 3238 var infoJson = JSON.parse(info.video); 3239 } 3240 var src = infoJson.source[0].src, 3241 autoplay = $(item).attr('data-autoplay') || event.target.autoplay === true || $(item).closest('[data-lb-autoplay=yes]').length || $(event.target).attr('data-lb-autoplay') === 'yes', 3242 muted = $(item).closest('[data-lb-muted=yes]').length || $(event.target).attr('data-lb-muted') === 'yes', 3243 loop = $(item).attr('data-loop'); 3244 3245 } else if ( isAudio ) { 3246 var src = info.src, 3247 autoplay = true, 3248 loop = false; 3249 } 3250 if ( typeof src !== 'undefined' ) { 3251 $slide.addClass('has-html5'); 3252 var video = document.createElement('video'); 3253 video.src = src; 3254 video.preload = 'auto'; 3255 video.controls = 'controls'; 3256 video.controlsList = 'nodownload'; 3257 if ( autoplay ) { 3258 video.autoplay = 'autoplay'; 3259 } 3260 if ( muted ) { 3261 video.muted = 'muted'; 3262 } 3263 if ( loop ) { 3264 video.loop = 'loop'; 3265 } 3266 $(video).appendTo($slide); 3267 } 3268 } else { 3269 var $video = $('video', $slide); 3270 if ( $video.length ) { 3271 $video[0].currentTime = 0; 3272 if ( $video[0].autoplay ) { 3273 $video[0].play(); 3274 } 3275 } 3276 } 3277 if ( $prevVideo.length ) { 3278 $prevVideo[0].currentTime = 0; 3279 $prevVideo[0].pause(); 3280 } 3281 }; 3282 3283 var beforeOpen = function(event) { 3284 var detail = event.detail, 3285 items = detail.items, 3286 galleryItems = detail.galleryItems, 3287 outer = detail.outer.selector, 3288 i, ii; 3289 for ( i = 0; i < galleryItems.length; i++ ) { 3290 var item = galleryItems[i]; 3291 if ( typeof item.video !== 'undefined' || item.oembed === 'video' ) { 3292 $(outer).find('.lg-thumb-item[data-lg-item-id="' + i + '"]').addClass('thumbnail-video'); 3293 } 3294 } 3295 for ( ii = 0; ii < items.length; ii++ ) { 3296 var item = items[ii]; 3297 if ( $(item).attr('data-icon') === 'video' ) { 3298 $(outer).find('.lg-thumb-item[data-lg-item-id="' + ii + '"]').addClass('thumbnail-video'); 3299 } 3300 } 3301 3302 }; 3303 3304 //caption builder 3305 $el.each( function( index, val ) { 3306 var $gallery = $(this).attr('data-lbox-init','true'), 3307 $_a = '.lbox-trigger-item', 3308 $_nested_a = '.lbox-nested-item'; 3309 3310 $gallery.find($_a, $_nested_a).each(function(){ 3311 var $a = $(this), 3312 $img = $('img', $a).first(), 3313 imgw = $img.attr('data-width'), 3314 imgh = $img.attr('data-height'), 3315 caption = $a.attr('data-caption'), 3316 title = $a.attr('data-title'); 3317 3318 if ( $img.length && $img.attr('data-crop') != true ) { 3319 if ( typeof $img.attr('data-guid') !== 'undefined' && $img.attr('data-guid') !== '' ) { 3320 $a.attr('data-external-thumb-image', $img.attr('data-guid')); 3321 } else if ( $img[0].src && typeof $img.attr('data-srcset') == 'undefined' && $a.attr('data-external-thumb-image') == '' ) { 3322 $a.attr('data-external-thumb-image', $img[0].src); 3323 } 3324 } 3325 3326 if ( typeof title !== 'undefined' && title !== '' ) { 3327 title = '<h6>' + title + '</h6>'; 3328 } else { 3329 title = ''; 3330 } 3331 3332 if ( typeof caption !== 'undefined' && caption !== '' ) { 3333 caption = '<p>' + caption + '</p>'; 3334 title += caption; 3335 } 3336 3337 if ( title !== '' ) { 3338 $a.attr( 'title', title ); 3339 } 3340 3341 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') ) ) { 3342 $a.attr('data-lg-size', imgw + '-' + imgh); 3343 } 3344 }); 3345 }); 3346 3347 //regular galleries 3348 $el.each( function( index, val ) { 3349 var $gallery = $(this), 3350 $_a = '.lbox-trigger-item', 3351 $_nested_a = '.lbox-nested-item', 3352 $_first = !$gallery.hasClass( 'nested-carousel' ) ? $($_a, $gallery).first() : $($_nested_a, $gallery).first(), 3353 galleryID = $_first.attr('data-lbox'), 3354 $_connected_a = $_a + '[data-lbox="' + galleryID + '"]', 3355 tmb = $_first.attr('data-notmb'), 3356 social = $_first.attr('data-social'), 3357 deep = $_first.attr('data-deep'), 3358 zoom = $_first.attr('data-zoom-origin'), 3359 actual = $_first.attr('data-actual-size'), 3360 download = $_first.attr('data-download'), 3361 controls = $_first.attr('data-arrows') !== 'no', 3362 fullScreen = $_first.attr('data-full'),
3363 counter = $_first.attr('data-counter'), 3364 transition = typeof $_first.attr('data-transition') !== 'undefined' ? $_first.attr('data-transition') : 'lg-slide', 3365 containerClass = $_first.closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3366 connect = $_first.attr('data-connect'), 3367 lgPlugins = [lgVideo], 3368 itemsLoadedTimeOut; 3369 3370 containerClass += $_first.attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3371 containerClass += controls && $_first.attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3372 3373 if ( typeof tmb == 'undefined' || !tmb ) { 3374 lgPlugins.push(lgThumbnail); 3375 } 3376 if ( ( typeof actual != 'undefined' && actual != '' ) || $gallery.is('.woocommerce-product-gallery') ) { 3377 lgPlugins.push(lgZoom); 3378 } 3379 if ( typeof deep != 'undefined' && deep != '' ) { 3380 lgPlugins.push(lgHash); 3381 } 3382 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3383 lgPlugins.push(lgFullscreen); 3384 } 3385 if ( social ) { 3386 lgPlugins.push(lgShare); 3387 } 3388 3389 if ( galleries.indexOf( galleryID ) !== -1 ) { 3390 return true; 3391 } 3392 3393 galleries.push( galleryID ); 3394 var $triggerGal = connect ? $('.page-wrapper') : $gallery, 3395 $selector = !$triggerGal.hasClass( 'nested-carousel' ) ? ( connect ? $_connected_a : $_a ) : $_nested_a; 3396 var gallery = lightGallery( $triggerGal[0], { 3397 addClass: containerClass, 3398 plugins: lgPlugins, 3399 mode: transition, 3400 selector: $selector, 3401 galleryId: galleryID, 3402 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3403 iframeWidth: '848px', 3404 iframeMaxWidth: '90%', 3405 iframeMaxHeight: '90%', 3406 exThumbImage: 'data-external-thumb-image', 3407 loadYouTubeThumbnail: false, 3408 autoplayVideoOnSlide: ( $gallery.attr('data-lb-autoplay') === 'yes' ), 3409 // autoplayFirstVideo: false, 3410 pager: false, 3411 startClass: 'lg-start-opacity', 3412 zoomFromOrigin: zoom, 3413 controls: controls, 3414 download: ( typeof download != 'undefined' && download != '' ), 3415 thumbWidth: 50, 3416 thumbHeight: '50px', 3417 counter: $triggerGal.find($selector).length > 1 ? counter : false, 3418 loadYouTubePoster: false, 3419 enableDrag: $triggerGal.find($selector).length > 1 3420 }); 3421 3422 $('.owl-item.cloned', $gallery).find(nested_a).on('click', function(e){ 3423 e.preventDefault(); 3424 var index = $(this).closest('.owl-item.cloned').attr('data-index'); 3425 gallery.openGallery(index-1); 3426 }); 3427 3428 $triggerGal.on('more-items-loaded', function(e, items) { 3429 clearRequestTimeout(itemsLoadedTimeOut); 3430 itemsLoadedTimeOut = requestTimeout(function(){ 3431 createSelectors(); 3432 gallery.refresh(); 3433 }, 100); 3434 }); 3435 3436 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3437 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3438 $el = model.view.$el; 3439 if ( $el.find($triggerGal).length ) { 3440 gallery.destroy(); 3441 } 3442 }); 3443 } 3444 3445 $triggerGal[0].addEventListener('lgBeforeSlide', beforeSlide); 3446 $triggerGal[0].addEventListener('lgBeforeOpen', beforeOpen); 3447 $triggerGal[0].addEventListener('lgAfterOpen', function(){ 3448 $(window).trigger('uncode-custom-cursor'); 3449 }); 3450 3451 }); 3452 3453 if ( typeof $el !== 'undefined' ) { 3454 3455 //album galleries 3456 $('a[data-album]:not([data-lbox-init])').each(function(index, val) { 3457 var album = val, 3458 galleryID = index, 3459 $album = $(album), 3460 params = $album.attr('data-album'), 3461 tmb = $(val).attr('data-notmb'), 3462 social = $(val).attr('data-social'), 3463 deep = $(val).attr('data-deep'), 3464 actual = $(val).attr('data-actual-size'), 3465 download = $(val).attr('data-download'), 3466 controls = $(val).attr('data-arrows') !== 'no', 3467 fullScreen = $(val).attr('data-full'), 3468 counter = $(val).attr('data-counter'), 3469 transition = typeof $(val).attr('data-transition') !== 'undefined' ? $(val).attr('data-transition') : 'lg-slide', 3470 containerClass = $(val).closest('[data-skin="white"]').length ? 'lg-light-skin' : '', 3471 lgPlugins = [lgVideo]; 3472 3473 $(val).attr('data-lbox-init','true'); 3474 3475 containerClass += $(val).attr('data-transparency') === 'opaque' ? ' lg-opaque' : ''; 3476 containerClass += controls && $(val).attr('data-arrows-bg') === 'semi-transparent' ? ' lg-semi-transparent-arrows' : ''; 3477 3478 if ( typeof tmb == 'undefined' || !tmb ) { 3479 lgPlugins.push(lgThumbnail); 3480 } 3481 if ( typeof actual != 'undefined' && actual != '' ) { 3482 lgPlugins.push(lgZoom); 3483 } 3484 if ( typeof deep != 'undefined' && deep != '' ) { 3485 lgPlugins.push(lgHash); 3486 } 3487 if ( typeof fullScreen != 'undefined' && fullScreen != '' ) { 3488 lgPlugins.push(lgFullscreen); 3489 } 3490 if ( social ) { 3491 lgPlugins.push(lgShare); 3492 } 3493 3494 var gallery = window.lightGallery(album, { 3495 dynamic: true, 3496 plugins: lgPlugins, 3497 dynamicEl: JSON.parse(params), 3498 galleryId: galleryID, 3499 addClass: containerClass, 3500 mode: transition, 3501 thumbnail: ( typeof tmb == 'undefined' || !tmb ), 3502 iframeWidth: '848px', 3503 iframeMaxWidth: '90%', 3504 iframeMaxHeight: '90%',
3505 loadYouTubeThumbnail: false, 3506 autoplayVideoOnSlide: ( $album.attr('data-lb-autoplay') === 'yes' ), 3507 // autoplayFirstVideo: false, 3508 pager: false, 3509 startClass: 'lg-start-opacity', 3510 zoomFromOrigin: false, 3511 controls: controls, 3512 download: ( typeof download != 'undefined' && download != '' ), 3513 thumbWidth: 50, 3514 thumbHeight: '50px', 3515 loadYouTubePoster: false, 3516 counter: counter 3517 }); 3518 3519 $album.on('click', function(){ 3520 gallery.openGallery(0); 3521 }); 3522 3523 album.addEventListener('lgBeforeSlide', beforeSlide); 3524 album.addEventListener('lgBeforeOpen', beforeOpen); 3525 album.addEventListener('lgAfterOpen', function(){ 3526 $(window).trigger('uncode-custom-cursor'); 3527 }); 3528 3529 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3530 window.parent.vc.events.once('shortcodeView:beforeUpdate', function(model) { 3531 $el = model.view.$el; 3532 if ( $el.find($album).length ) { 3533 gallery.destroy(); 3534 } 3535 }); 3536 } 3537 3538 }); 3539 3540 //single images 3541 $('.uncode-lbox:not(.lb-disabled):not([data-lbox-init])').each(function(index, val) { 3542 var gallery = lightGallery( $('.page-wrapper')[0], { 3543 selector: '.uncode-lbox:not(.lb-disabled):not([data-lbox-init])', 3544 iframeWidth: '848px', 3545 iframeMaxWidth: '90%', 3546 iframeMaxHeight: '90%', 3547 loadYouTubeThumbnail: false, 3548 // autoplayFirstVideo: false, 3549 startClass: 'lg-start-opacity', 3550 thumbWidth: 50, 3551 thumbHeight: '50px', 3552 download: false, 3553 loadYouTubePoster: false, 3554 counter: false 3555 }); 3556 3557 $('.page-wrapper')[0].addEventListener('lgBeforeSlide', beforeSlide); 3558 $('.page-wrapper')[0].addEventListener('lgBeforeOpen', beforeOpen); 3559 }); 3560 } 3561}; 3562 3563UNCODE.carousel = function(container) { 3564 var $owlContainers = $('.owl-carousel-container', container); 3565 $owlContainers.each(function() { 3566 var $owlContainer = $(this), 3567 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 3568 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 3569 values = {}, 3570 tempTimeStamp, 3571 newWidth = UNCODE.wwidth, 3572 $owlInsideEqual = []; 3573 $owlSelector.each(function() { 3574 var itemID = $(this).attr('id'), 3575 $elSelector = $(('#' + itemID).toString()); 3576 values['id'] = itemID; 3577 values['items'] = 1;
3578 values['columns'] = 3; 3579 values['fade'] = false; 3580 values['nav'] = false; 3581 values['navmobile'] = false; 3582 values['navskin'] = 'light'; 3583 values['navspeed'] = 400; 3584 values['dots'] = false; 3585 values['dotsmobile'] = false; 3586 values['loop'] = false; 3587 values['autoplay'] = false; 3588 values['timeout'] = 3000; 3589 values['autoheight'] = false; 3590 values['stagepadding'] = 0; 3591 values['margin'] = 0; 3592 values['lg'] = 1; 3593 values['md'] = 1; 3594 values['sm'] = 1; 3595 $.each($(this).data(), function(i, v) { 3596 values[i] = v; 3597 }); 3598 3599 if ($(this).closest('.uncode-slider').length) { 3600 values['navskin'] = ''; 3601 values['navmobile'] = false; 3602 //values['dotsmobile'] = true; 3603 } else { 3604 values['navskin'] = ' style-'+values['navskin']+' style-override'; 3605 } 3606 3607 var setIndexActive = function(event, init){ 3608 var init = typeof init === 'undefined' ? false : init, 3609 thiis = $(event.currentTarget); 3610 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 3611 var scrolltop = $(document).scrollTop(), 3612 size = event.page.size, 3613 i; 3614 var setIndex = requestTimeout(function() { 3615 for ( i = 0; i < size; i++ ) { 3616 var itemCont = event.item.index != null ? (event.item.index + i) : i; 3617 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 3618 if (thiis.closest('.row-slider').length) { 3619 if (currentItem == undefined) { 3620 currentItem = thiis.children()[i]; 3621 } 3622 if ($(currentItem).closest('#page-header').length) { 3623 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 3624 UNCODE.switchColorsMenu(scrolltop, 'dark'); 3625 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 3626 UNCODE.switchColorsMenu(scrolltop, 'light'); 3627 } 3628 } 3629 } 3630 var itendIndex = $(currentItem).attr('data-index'); 3631 if ( isNaN(itendIndex) ) { 3632 itendIndex = 1; 3633 } 3634 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 3635 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 3636 if ($.fn.counterUp) { 3637 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .uncode-counter').each(function(){ 3638 var $counter = $(this); 3639 $counter.addClass('started').counterUp({ 3640 delay: 10, 3641 time: 1500 3642 }); 3643 }); 3644 } 3645 } 3646 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 3647 }, 200); 3648 } 3649 tempTimeStamp = event.timeStamp; 3650 } 3651 3652 /** Initialized */ 3653 $elSelector.on('initialized.owl.carousel', function(event) { 3654 3655 if ( $('.isotope-container', event.currentTarget).length ) { 3656 window.dispatchEvent(UNCODE.boxEvent); 3657 } 3658 3659 $('.owl-dot.active', $elSelector).on('click', function(){ 3660 return false; 3661 }); 3662 3663 var thiis = $(event.currentTarget), 3664 // get the time from the data method 3665 time = thiis.data("timer-id"), 3666 rowParent = thiis.closest('.row-parent'); 3667 3668 if ( typeof rowParent[0] !== 'undefined' ) { 3669 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 3670 } 3671 3672 if (time) { 3673 clearRequestTimeout(time); 3674 } 3675 3676 thiis.addClass('showControls'); 3677 var new_time = requestTimeout(function() { 3678 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 3679 if (thiis.hasClass('owl-height-viewport')) 3680 setItemsRelHeight(thiis); 3681 if (thiis.hasClass('owl-height-equal')) 3682 setItemsHeight(thiis); 3683 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 3684 if (thiis.closest('.unequal, .unexpand').length) { 3685 UNCODE.setRowHeight(rowParent[0], true); 3686 } 3687 if (SiteParameters.dynamic_srcset_active === '1') { 3688 UNCODE.refresh_dynamic_srcset_size(thiis); 3689 } 3690 }, 350); 3691 // save the new time 3692 thiis.data("timer-id", new_time); 3693 3694 var scrolltop = $(document).scrollTop(); 3695 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 3696 3697 //if (!UNCODE.isMobile) { 3698 /** fix autoplay when visible **/ 3699 $(window).on('load', function(){ 3700 if (thiis.data('autoplay')) { 3701 if ( !thiis.closest('.sticky-element').length ) { 3702 thiis.trigger('stop.autoplay.owl'); 3703 } else { 3704 thiis.trigger('play.owl.autoplay'); 3705 } 3706 } 3707 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 3708 return; 3709 } 3710 if ( ! thiis.closest('.sticky-element').length ) { 3711 var carouselInView = new Waypoint.Inview({ 3712 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3713 element: thiis[0], 3714 exited: function() { 3715 var el = $(this.element); 3716 if (el.data('autoplay') ) { 3717 el.trigger('stop.owl.autoplay'); 3718 el.data('stopped','true'); 3719 } 3720 }, 3721 enter: function(direction) { 3722 var el = $(this.element); 3723 requestTimeout(function() { 3724 if (el.data('autoplay')) { 3725 el.trigger('play.owl.autoplay'); 3726 el.data('stopped','false'); 3727 } 3728 }, 100); 3729 } 3730 }); 3731 } 3732 }); 3733 //} 3734 3735 // $(window).on('frontend:carousel_updated', function(){ 3736 // Waypoint.refreshAll(); 3737 // }); 3738 3739 if (!thiis.closest('.isotope-system').length) { 3740 requestTimeout(function() { 3741 animate_thumb($('.t-inside', el), event); 3742 }, 400); 3743 } else { 3744 requestTimeout(function() { 3745 thiis.closest('.isotope-container').isotope('layout'); 3746 }, 400); 3747 } 3748 3749 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3750 currentIndex = $(currentItem).attr('data-index'); 3751 3752 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3753 if ($(val).closest('.uncode-slider').length) { 3754 $(val).removeClass('start_animation'); 3755 } 3756 }); 3757 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3758 if ($(val).closest('.uncode-slider').length) { 3759 $(val).removeClass('already-animated'); 3760 } 3761 }); 3762 3763 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 3764 if ($(val).closest('.uncode-slider').length) { 3765 $(val).removeAttr('data-animated'); 3766 } 3767 }); 3768 3769 $.each($('.owl-item.cloned', thiis), function(index, val) {
3770 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 3771 }); 3772 3773 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 3774 if ($(val).attr('data-index') != currentIndex) { 3775 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 3776 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 3777 } 3778 if ($(val).attr('data-index') != currentIndex) { 3779 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 3780 } 3781 if ($(val).attr('data-index') == currentIndex) { 3782 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 3783 } 3784 }); 3785 3786 if (thiis.closest('.uncode-slider').length) { 3787 var el = thiis.closest('.row-parent')[0]; 3788 if ($(el).data('imgready')) { 3789 firstLoaded(el, event); 3790 } else { 3791 el.addEventListener("imgLoaded", function(el) { 3792 firstLoaded(el.target, event); 3793 }, false); 3794 } 3795 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 3796 if (transHeight != null) { 3797 requestTimeout(function() { 3798 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 3799 }, 100); 3800 } 3801 } else { 3802 var el = thiis; 3803 el.closest('.uncode-slider').addClass('slider-loaded'); 3804 } 3805 3806 requestTimeout(function() { 3807 if (typeof UNCODE.bigText !== 'undefined') { 3808 UNCODE.bigText(thiis); 3809 } 3810 if (thiis.closest('.uncode-slider').length) { 3811 if (thiis.data('autoplay')) pauseOnHover(thiis); 3812 } 3813 }, 500); 3814 3815 if (thiis.closest('.unequal').length) { 3816 $owlInsideEqual.push(thiis.closest('.row-parent')); 3817 } 3818 3819 var containerClasses = '', 3820 containerStyle = ''; 3821 if ( $('.owl-dots-classes', $owlContainer).length ) { 3822 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 3823 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 3824 $('.owl-dots-classes', $owlContainer).remove(); 3825 } 3826 3827 if ( containerClasses !== '' ) { 3828 requestTimeout(function() { 3829 if ( containerClasses !== '' ) 3830 $('.owl-dots', $owlContainer).attr('style', containerStyle); 3831 if ( containerStyle !== '' ) 3832 $('.owl-dots', $owlContainer).addClass(containerClasses); 3833 }, 100); 3834 } 3835 3836 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 3837 $(val).closest('.row-inner').css({ 3838 'margin-top': '-1px' 3839 }); 3840 }); 3841 3842 if ($.fn.isotope) { 3843 if ( thiis.closest('.isotope-container').length ) { 3844 if (thiis.closest('.isotope-container').data('isotope')) { 3845 requestTimeout(function(){ 3846 thiis.closest('.isotope-container').isotope('layout'); 3847 }, 300); 3848 } 3849 $(window).on('load', function(){ 3850 if (thiis.closest('.isotope-container').data('isotope')) { 3851 thiis.closest('.isotope-container').isotope('layout'); 3852 } 3853 }); 3854 } 3855 } 3856 3857 if (thiis.data('autoplay')) { 3858 $(window).on('menuOpen', function(){ 3859 thiis.trigger('stop.owl.autoplay'); 3860 thiis.data('stopped','true'); 3861 }).on('menuClose', function(){ 3862 3863 }); 3864 } 3865 $(window).on('menuClose', function(){ 3866 if (thiis.data('autoplay')) { 3867 thiis.trigger('play.owl.autoplay'); 3868 thiis.data('stopped','false'); 3869 } 3870 }); 3871 3872 setIndexActive(event, true); 3873 3874 var nested_a = $('a[data-lbox]:not(.lb-disabled):not([data-lbox-init]):not([data-album])').filter(function( index ) { 3875 return !$(this).closest('.nested-carousel').length; 3876 }), 3877 $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); 3878 3879 3880 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 3881 UNCODE.lightgallery( $galleries ); 3882 } 3883 3884 3885 }); 3886 3887 $elSelector.on('resized.owl.carousel', function(event) { 3888 var thiis = $(event.currentTarget); 3889 // if ($(this).closest('.nested-carousel').length) { 3890 // requestTimeout(function() { 3891 // window.dispatchEvent(UNCODE.boxEvent); 3892 // }, 200); 3893 // } 3894 if ( thiis.hasClass('owl-height-equal') ) 3895 setItemsHeight(thiis); 3896 3897 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 3898 newWidth = UNCODE.wwidth; 3899 setItemsRelHeight($elSelector); 3900 } 3901 3902 setIndexActive(event); 3903
3904 if (SiteParameters.dynamic_srcset_active === '1') { 3905 UNCODE.refresh_dynamic_srcset_size(thiis); 3906 } 3907 3908 if ($.fn.isotope) { 3909 $(window).on('load', function(){ 3910 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 3911 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 3912 } 3913 }); 3914 } 3915 }); 3916 3917 /** detect resize window for fluid height layout */ 3918 var setFluidResize; 3919 function manageFluidCarouseHeight() { 3920 clearRequestTimeout(setFluidResize); 3921 setFluidResize = requestTimeout(function(){ 3922 if ( UNCODE.wwidth > UNCODE.mediaQuery || ( UNCODE.wwidth <= UNCODE.mediaQuery && newWidth !== UNCODE.wwidth ) ) { 3923 newWidth = UNCODE.wwidth; 3924 setItemsRelHeight($elSelector); 3925 } 3926 }, 100); 3927 } 3928 window.addEventListener('resize', manageFluidCarouseHeight); 3929 3930 /** Change */ 3931 $elSelector.on('change.owl.carousel', function(event) { 3932 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 3933 }); 3934 3935 /** Changed */ 3936 $elSelector.on('changed.owl.carousel', function(event) { 3937 var $row = $elSelector.parents('.row')[0]; 3938 if ( typeof $row !== 'undefined' ) { 3939 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 3940 } 3941 setIndexActive(event); 3942 }); 3943 3944 var checkDrag = function(e) { 3945 $elSelector.addClass('owl-dragging'); 3946 }; 3947 $elSelector.on('drag.owl.carousel', function(event) { 3948 document.addEventListener("mousemove", checkDrag); 3949 }); 3950 3951 $elSelector.on('dragged.owl.carousel', function(event) { 3952 $elSelector.removeClass('owl-dragging'); 3953 document.removeEventListener("mousemove", checkDrag); 3954 }); 3955 3956 $elSelector.on('translate.owl.carousel', function(event) { 3957 if (UNCODE.isMobile) { 3958 $(event.currentTarget).addClass('owl-translating'); 3959 } 3960 }); 3961 3962 /** Translated */ 3963 $elSelector.on('translated.owl.carousel', function(event) { 3964 3965 var thiis = $(event.currentTarget), 3966 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 3967 currentIndex = $(currentItem).attr('data-index'), 3968 stagePadding = thiis.data('stagepadding'); 3969 3970 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 3971 3972 if (!UNCODE.isMobile) { 3973 UNCODE.owlPlayVideo(thiis); 3974 } 3975 3976 requestTimeout(function(){ 3977 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 3978 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 3979 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 3980 if (lastDelayElems == undefined) lastDelayElems = 0; 3981 if (lastDelayThumb == undefined) lastDelayThumb = 0; 3982 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 3983 thiis.trigger('stop.owl.autoplay'); 3984 requestTimeout(function() { 3985 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 3986 }, maxDelay); 3987 } 3988 }, 200); 3989 3990 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 3991 if ($(val).closest('.uncode-slider').length) { 3992 $(val).removeClass('start_animation'); 3993 } 3994 }); 3995 3996 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 3997 if ($(val).closest('.uncode-slider').length) { 3998 $(val).removeClass('already-animated'); 3999 } 4000 }); 4001 4002 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 4003 if ($(val).closest('.uncode-slider').length) { 4004 $(val).removeAttr('data-animated'); 4005 } 4006 }); 4007 4008 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 4009 if ($(val).attr('data-index') != currentIndex) { 4010 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 4011 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 4012 } 4013 if ($(val).attr('data-index') != currentIndex) { 4014 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 4015 } 4016 if ($(val).attr('data-index') == currentIndex) { 4017 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 4018 } 4019 }); 4020 4021 if (UNCODE.isMobile) { 4022 thiis.removeClass('owl-translating'); 4023 } 4024 4025 setIndexActive(event); 4026 }); 4027 4028 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 4029 4030 /** Init carousel */ 4031 $elSelector.not('.showControls').owlCarousel({ 4032 items: values['items'], 4033 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 4034 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 4035 nav: values['nav'], 4036 dots: values['dots'], 4037 loop: values['loop'], 4038 stagePadding: values['stagepadding'], 4039 margin: 0, 4040 video: true, 4041 autoWidth: false, 4042 autoplay: false, 4043 autoplayTimeout: values['timeout'], 4044 autoplaySpeed: values['navspeed'], 4045 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 4046 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 4047 rtl: $('body').hasClass('rtl') ? true : false, 4048 fluidSpeed: true, 4049 navSpeed: values['navspeed'], 4050 dotsSpeed: values['navspeed'] / values['items'], 4051 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 4052 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>'], 4053 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 4054 responsiveClass: true, 4055 responsiveBaseElement: '.box-container', 4056 responsive: { 4057 0: { 4058 items: values['sm'], 4059 nav: values['navmobile'], 4060 dots: values['dotsmobile'], 4061 dotsSpeed: values['navspeed'] / values['sm'], 4062 }, 4063 480: { 4064 items: values['sm'], 4065 nav: values['navmobile'], 4066 dots: values['dotsmobile'], 4067 dotsSpeed: values['navspeed'] / values['sm'], 4068 }, 4069 570: { 4070 items: values['md'], 4071 nav: values['navmobile'], 4072 dots: values['dotsmobile'], 4073 dotsSpeed: values['navspeed'] / values['md'], 4074 }, 4075 960: { 4076 items: values['lg'], 4077 dotsSpeed: values['navspeed'] / values['lg'], 4078 } 4079 } 4080 }); 4081 4082 var transDuration = parseFloat(values['navspeed']) * 0.3; 4083 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 4084 4085 $('.owl-item .tmb', $elSelector).css({ 4086 '-webkit-transition-delay': transDuration + 'ms', 4087 '-moz-transition-delay': transDuration + 'ms', 4088 '-o-transition-delay': transDuration + 'ms', 4089 'transition-delay': transDuration + 'ms', 4090 '-webkit-transition-duration': transDuration2 + 'ms', 4091 '-moz-transition-duration': transDuration2 + 'ms', 4092 '-o-transition-duration': transDuration2 + 'ms', 4093 'transition-duration': transDuration2 + 'ms', 4094 }); 4095 4096 requestTimeout(function() { 4097 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4098 UNCODE.setRowHeight($owlInsideEqual[i]); 4099 }; 4100 }, 300); 4101 4102 $(window).on('load', function(){ 4103 var $elCarousel = $elSelector.data('owl.carousel'); 4104 if ( typeof $elCarousel !== 'undefined' ) { 4105 $elCarousel.trigger('refreshed'); 4106 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 4107 UNCODE.setRowHeight($owlInsideEqual[i]); 4108 }; 4109 } 4110 }); 4111 4112 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 4113 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4114 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 4115 $('#' + carousel_id).find('.owl-item').each( function() { 4116 var $item = $(this), 4117 index = ( $item.index() + 1 ); 4118 $item.attr('data-index', index); 4119 }); 4120 } 4121 }); 4122 4123 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4124 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 4125 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 4126 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 4127 $('#' + carousel_id).find('.owl-item').each( function() { 4128 var $item = $(this), 4129 index = ( $item.index() + 1 ); 4130 $item.attr('data-index', index); 4131 }); 4132 } 4133 }); 4134 } 4135 4136 }); 4137 4138 function firstLoaded(el, event) { 4139 var el = $(el), 4140 uncode_slider = el.find('.uncode-slider'); 4141 el.find('.owl-carousel').css('opacity', 1); 4142 uncode_slider.addClass('slider-loaded'); 4143 if (typeof UNCODE.bigText !== 'undefined') { 4144 UNCODE.bigText(el.find('.owl-item.active')); 4145 } 4146 //if (!UNCODE.isMobile) { 4147 requestTimeout(function() { 4148 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 4149 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 4150 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 4151 if (lastDelayElems == undefined) lastDelayElems = 0; 4152 if (lastDelayThumb == undefined) lastDelayThumb = 0; 4153 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 4154 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 4155 requestTimeout(function() { 4156 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 4157 }, maxDelay); 4158 } 4159 }, 500); 4160 4161 //} 4162 } 4163 4164 function navHover(el) { 4165 var $owlCont = el, 4166 $owlPrev = $owlCont.find('.owl-prev'), 4167 $owlNext = $owlCont.find('.owl-next'), 4168 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 4169 $owlPagination = $owlCont.next(), 4170 owlPrevW = $owlPrev.outerWidth(), 4171 owlNextW = $owlNext.outerWidth(), 4172 owlDotsH = $owlDots.innerHeight(), 4173 owlTime = 400, 4174 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4175 if ( $('body').hasClass('rtl') ) { 4176 $owlPrev.css("margin-right", -owlPrevW); 4177 $owlNext.css("margin-left", -owlNextW); 4178 } else { 4179 $owlPrev.css("margin-left", -owlPrevW); 4180 $owlNext.css("margin-right", -owlNextW); 4181 } 4182 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 4183 $owlCont.mouseenter(function() { 4184 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4185 $owlPrev.add($owlNext).css({ 4186 marginLeft: 0, 4187 marginRight: 0 4188 }); 4189 if (!owlNested) { 4190 $owlDots.css({ 4191 opacity: 1, 4192 bottom: 0 4193 }); 4194 } 4195 }).mouseleave(function() { 4196 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 4197 if ( $('body').hasClass('rtl') ) { 4198 $owlPrev.css("margin-right", -owlPrevW); 4199 $owlNext.css("margin-left", -owlNextW); 4200 } else { 4201 $owlPrev.css("margin-left", -owlPrevW); 4202 $owlNext.css("margin-right", -owlNextW); 4203 } 4204 if (!owlNested) { 4205 $owlDots.css({ 4206 opacity: 1, 4207 bottom: -owlDotsH 4208 }); 4209 } 4210 }); 4211 }; 4212 4213 function animate_elems($this) { 4214 var lastDelay; 4215 $.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) { 4216 var element = $(val), 4217 delayAttr = element.attr('data-delay'), 4218 $first_item = element.closest('.owl-item[data-index="1"]'); 4219 4220 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 4221 return false;
4222 } 4223 4224 if (delayAttr == undefined) delayAttr = 0; 4225 requestTimeout(function() { 4226 element.addClass('start_animation'); 4227 }, delayAttr); 4228 lastDelay = delayAttr; 4229 }); 4230 return lastDelay; 4231 } 4232 4233 function animate_thumb(items, event) { 4234 var lastDelay, 4235 itemIndex, 4236 thiis = $(event.currentTarget), 4237 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 4238 numActives = $('.owl-item.active', thiis).length, 4239 stagePadding = thiis.data('stagepadding'); 4240 4241 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 4242 4243 thiis.data('tempIndex', event.item.index); 4244 $.each(items, function(index, val) { 4245 var parent = $(val).closest('.owl-item'); 4246 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4247 return; 4248 } 4249 if (!$(val).hasClass('start_animation')) { 4250 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 4251 var thumbInView = new Waypoint.Inview({ 4252 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4253 element: val, 4254 enter: function(direction) { 4255 var element = $(this.element), 4256 delayAttr = parseInt(element.attr('data-delay')), 4257 itemIndex = element.closest('.owl-item').index() + 1, 4258 diffItem = Math.abs(itemIndex - tempIndex) - 1; 4259 if (itemIndex > tempIndex) { 4260 thiis.data('tempIndex', itemIndex); 4261 } 4262 if (isNaN(delayAttr)) delayAttr = 100; 4263 if (stagePadding) { 4264 var objTimeout = requestTimeout(function() { 4265 element.addClass('start_animation'); 4266 }, index * delayAttr); 4267 lastDelay = index * delayAttr; 4268 } else { 4269 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 4270 var objTimeout = requestTimeout(function() { 4271 element.addClass('start_animation'); 4272 }, diffItem * delayAttr); 4273 lastDelay = diffItem * delayAttr; 4274 } 4275 parent.data('objTimeout', objTimeout); 4276 if (!UNCODE.isUnmodalOpen) { 4277 this.destroy(); 4278 } 4279 } 4280 }); 4281 } 4282 } 4283 }); 4284 return lastDelay; 4285 } 4286 4287 function setItemsHeight(item) { 4288 $.each($('.owl-item', item), function(index, val) { 4289 var availableThumbHeight = $('.t-inside', $(val)).height(), 4290 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 4291 difference = availableThumbHeight - innerThumbHeight; 4292 if ($('.tmb-content-under', val).length) { 4293 var visualPart = $('.t-entry-visual', val); 4294 if (visualPart.length) { 4295 difference -= $('.t-entry-visual', val).height(); 4296 } 4297 } 4298 if (! $('.tmb-content-lateral', val).length) 4299 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 4300 }); 4301 } 4302 4303 function setItemsRelHeight(item) { 4304 $.each($('.owl-item', item), function(index, val) { 4305 var $rowContainer = $(item).parents('.row-parent').eq(0), 4306 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 4307 $colContainer = $(item).parents('.uncell').eq(0), 4308 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 4309 winHeight = UNCODE.wheight, 4310 multiplier_h = parseInt($(item).attr('data-vp-height')), 4311 data_viewport_h, 4312 consider_menu = $(item).data('vp-menu'); 4313 4314 if ( consider_menu ) { 4315 winHeight = winHeight - UNCODE.menuHeight; 4316 } 4317 4318 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 4319 $('.t-inside', val).css( 'height', data_viewport_h ); 4320 }); 4321 } 4322 4323 function pauseOnHover(slider) { 4324 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 4325 mouseenter: function () { 4326 $(slider).addClass('owl-mouseenter'); 4327 $(slider).trigger('stop.owl.autoplay'); 4328 }, 4329 mouseleave: function () { 4330 $(slider).removeClass('owl-mouseenter'); 4331 $(slider).trigger('play.owl.autoplay'); 4332 } 4333 }); 4334 } 4335 }); 4336}; 4337 4338UNCODE.owlPlayVideo = function(carousel) { 4339 var player, iframe; 4340 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 4341 var content = $(val).html(); 4342 if (content == '') { 4343 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 4344 $(val).append(getCloned); 4345 } 4346 if ($(this).attr('data-provider') == 'vimeo') { 4347 iframe = $(this).find('iframe'); 4348 player = new Vimeo.Player(iframe[0]); 4349 player.play(); 4350 } else if ($(this).attr('data-provider') == 'youtube') { 4351 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 4352 } else { 4353 var player = $(this).find('video'); 4354 if (player.length) { 4355 $(this).find('video')[0].volume = 0; 4356 $(this).find('video')[0].play(); 4357 $(val).css('opacity', 1); 4358 } 4359 } 4360 }); 4361}; 4362 4363UNCODE.owlStopVideo = function(carousel) { 4364 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 4365 var player, iframe; 4366 if ($(this).attr('data-provider') == 'vimeo') { 4367 iframe = $(this).find('iframe'); 4368 player = new Vimeo.Player(iframe[0]); 4369 player.pause(); 4370 } else if ($(this).attr('data-provider') == 'youtube') { 4371 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4372 } else { 4373 var player = $(this).find('video'); 4374 if (player.length) { 4375 $(this).find('video')[0].volume = 0; 4376 $(this).find('video')[0].play(); 4377 } 4378 } 4379 }); 4380}; 4381 4382UNCODE.animations = function() { 4383 4384 var runWaypoints_TO, 4385 runWaypoints_carousel_TO, 4386 runWaypoints_delay = 0, 4387 highlightComplexFunc = function($wrap, ev){ 4388 4389 var $lines = $('.heading-line-wrap', $wrap), 4390 not_animate = false;
4391 4392 if ( $wrap.data('animate') === true ) { 4393 not_animate = true; 4394 } 4395 4396 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 4397 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 4398 return; 4399 } 4400 4401 $lines.each(function(_key, _value){ 4402 var $line = $(_value), 4403 $inners = $('.split-word-inner', $line), 4404 $highlights = $('.heading-text-highlight-inner', $line); 4405 4406 var highlitInnerFunc = function(ev){ 4407 var delay = 0; 4408 $highlights.each(function(h_key, high){ 4409 var $highlight = $(high), 4410 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 4411 $nextSplit = $split.nextUntil(), 4412 $next = $('.heading-text-highlight-inner', $nextSplit), 4413 countCh = $split.text().length; 4414 4415 $highlight.css({ 4416 '-webkit-transition-duration': (30 * countCh) + 'ms', 4417 '-moz-transition-duration': (30 * countCh) + 'ms', 4418 '-o-transition-duration': (30 * countCh) + 'ms', 4419 'transition-duration': (30 * countCh) + 'ms', 4420 }); 4421 4422 delay += (30 * countCh); 4423 4424 $next.css({ 4425 '-webkit-transition-delay': delay + 'ms', 4426 '-moz-transition-delay': delay + 'ms', 4427 '-o-transition-delay': delay + 'ms', 4428 'transition-delay': delay + 'ms', 4429 }); 4430 }); 4431 $highlights.removeAttr('data-animated'); 4432 if ( _key+1 === $lines.length ) { 4433 $wrap.data('animate', true); 4434 } 4435 }; 4436 4437 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 4438 if ( not_animate ) { 4439 $highlights.each(function(h_key, high){ 4440 var $highlight = $(high); 4441 $highlight.css({ 4442 '-webkit-transition-duration': '0ms', 4443 '-moz-transition-duration': '0ms', 4444 '-o-transition-duration': '0ms', 4445 'transition-duration': '0ms', 4446 }); 4447 }); 4448 $highlights.removeAttr('data-animated'); 4449 } else { 4450 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 4451 highlitInnerFunc(); 4452 } else { 4453 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 4454 } 4455 } 4456 } 4457 }); 4458 }; 4459 4460 $.each($('.header-content-inner'), function(index, val) { 4461 var element = $(val), 4462 transition = ''; 4463 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 4464 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 4465 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 4466 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 4467 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 4468 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 4469 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 4470 if (transition != '') { 4471 $(val).removeClass(transition); 4472 var container = element, 4473 containerDelay = container.attr('data-delay'), 4474 containerSpeed = container.attr('data-speed'), 4475 items = $('.header-title > *, .post-info', container); 4476 $.each(items, function(index, val) { 4477 var element = $(val), 4478 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 4479 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 4480 if (!element.hasClass('animate_when_almost_visible')) { 4481 delayAttr = Number(delayAttr) + (400 * index); 4482 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 4483 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 4484 } 4485 }); 4486 container.css('opacity', 1); 4487 } 4488 }); 4489 4490 function animate_css_grids_on_load() { 4491 $('.cssgrid-system').each(function() { 4492 var grid = $(this); 4493 var sequential = grid.hasClass('cssgrid-animate-sequential') ? true : false; 4494 UNCODE.animate_css_grids(grid, grid.find('.tmb-grid'), 0, sequential, false); 4495 }); 4496 } 4497 4498 window.waypoint_animation = function(ev) { 4499 $.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) { 4500 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 ) ) { 4501 return true; 4502 } 4503 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4504 return; 4505 } 4506 var run = true, 4507 $carousel = $(val).closest('.owl-carousel'); 4508 if ( $carousel.length ) { 4509 run = false;
4510 } 4511 if (run) { 4512 new Waypoint({ 4513 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4514 element: val, 4515 handler: function() { 4516 var element = $(this.element), 4517 index = element.index(), 4518 delayAttr = element.attr('data-delay'); 4519 if (delayAttr == undefined) delayAttr = 0; 4520 requestTimeout(function() { 4521 element.addClass('start_animation'); 4522 }, delayAttr); 4523 if (!UNCODE.isUnmodalOpen) { 4524 this.destroy(); 4525 } 4526 }, 4527 offset: UNCODE.isFullPage ? '100%' : '90%' 4528 }); 4529 } 4530 }); 4531 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 4532 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4533 return; 4534 } 4535 var run = true, 4536 $carousel = $(val).closest('.owl-carousel'); 4537 if ( $carousel.length ) { 4538 run = false; 4539 } 4540 if (run) { 4541 new Waypoint({ 4542 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4543 element: val, 4544 handler: function() { 4545 var $element = $(this.element), 4546 $childs = $('.animate_when_parent_almost_visible', $element); 4547 $childs.each(function(key,el){ 4548 var $child = $(el), 4549 delaySpeed = $child.attr('data-speed'), 4550 delayAttr = $child.attr('data-delay'), 4551 intervalAttr = $child.attr('data-interval'); 4552 if (delayAttr == undefined) { 4553 delayAttr = 50*key; 4554 } 4555 requestTimeout(function() { 4556 $child.addClass('start_animation'); 4557 if ( $child.hasClass('anim-line-checker') ) { 4558 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4559 var $line = $child.closest('.heading-line-wrap'); 4560 }); 4561 } 4562 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4563 highlightComplexFunc($wrapText, ev); 4564 if ( $child.hasClass('anim-tot-checker') ) { 4565 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4566 if ( $child.hasClass('anim-tot-checker') ) { 4567 $wrapText.addClass('already-animated'); 4568 $element.trigger('already-animated'); 4569 } 4570 }); 4571 } 4572 }, delayAttr ); 4573 }); 4574 $element.addClass('start_animation'); 4575 if (!UNCODE.isUnmodalOpen) { 4576 this.destroy(); 4577 } 4578 }, 4579 offset: UNCODE.isFullPage ? '100%' : '90%' 4580 }); 4581 } 4582 }); 4583 } 4584 window.waypoint_carousel_animation = function(ev) { 4585 $.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) { 4586 if ( $(val).hasClass('el-text-split') ) { 4587 return true; 4588 } 4589 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4590 return; 4591 } 4592 var run = true, 4593 $carousel = $(val).closest('.owl-carousel'), 4594 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4595 $all_first = $('.owl-item[data-index="1"]', $carousel); 4596 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4597 run = false; 4598 } 4599 if (run) { 4600 new Waypoint({ 4601 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4602 element: val, 4603 handler: function() { 4604 var element = $(this.element), 4605 index = element.index(), 4606 delayAttr = element.attr('data-delay'); 4607 if (delayAttr == undefined) delayAttr = 0; 4608 requestTimeout(function() { 4609 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4610 $all_first.attr('data-already-reached', 'true'); 4611 } 4612 element.addClass('start_animation'); 4613 }, delayAttr); 4614 if (!UNCODE.isUnmodalOpen) { 4615 this.destroy(); 4616 } 4617 }, 4618 offset: UNCODE.isFullPage ? '100%' : '90%' 4619 }); 4620 } 4621 }); 4622 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 4623 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4624 return; 4625 } 4626 var run = true, 4627 $carousel = $(val).closest('.owl-carousel'), 4628 $first_item = $(val).closest('.owl-item[data-index="1"]'), 4629 $all_first = $('.owl-item[data-index="1"]', $carousel); 4630 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 4631 run = false;
4632 } 4633 if (run) { 4634 new Waypoint({ 4635 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4636 element: val, 4637 handler: function() { 4638 var $element = $(this.element), 4639 $childs = $('.animate_when_parent_almost_visible', $element); 4640 $childs.each(function(key,el){ 4641 var $child = $(el), 4642 delaySpeed = $child.attr('data-speed'), 4643 delayAttr = $child.attr('data-delay'), 4644 intervalAttr = $child.attr('data-interval'); 4645 if (delayAttr == undefined) { 4646 delayAttr = 50*key; 4647 } 4648 requestTimeout(function() { 4649 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 4650 $all_first.attr('data-already-reached', 'true'); 4651 } 4652 $child.addClass('start_animation'); 4653 if ( $child.hasClass('anim-line-checker') ) { 4654 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4655 var $line = $child.closest('.heading-line-wrap'); 4656 }); 4657 } 4658 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 4659 highlightComplexFunc($wrapText, ev); 4660 if ( $child.hasClass('anim-tot-checker') ) { 4661 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 4662 if ( $child.hasClass('anim-tot-checker') ) { 4663 $wrapText.addClass('already-animated'); 4664 } 4665 }); 4666 } 4667 }, delayAttr ); 4668 }); 4669 $element.addClass('start_animation'); 4670 if (!UNCODE.isUnmodalOpen) { 4671 this.destroy(); 4672 } 4673 }, 4674 offset: UNCODE.isFullPage ? '100%' : '90%' 4675 }); 4676 } 4677 }); 4678 } 4679 4680 var runWaypoints = function(ev){ 4681 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 4682 runWaypoints_delay = 400; 4683 } 4684 clearRequestTimeout(runWaypoints_TO); 4685 runWaypoints_TO = requestTimeout(function() { 4686 window.waypoint_animation(ev); 4687 }, runWaypoints_delay); 4688 4689 clearRequestTimeout(runWaypoints_carousel_TO); 4690 runWaypoints_carousel_TO = requestTimeout(function() { 4691 window.waypoint_carousel_animation(ev); 4692 }, 400); 4693 }; 4694 runWaypoints(); 4695 animate_css_grids_on_load(); 4696 4697 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 4698 runWaypoints(ev); 4699 }); 4700 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 4701 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 4702 } 4703}; 4704 4705UNCODE.animate_css_grids = function(container, elements, startIndex, sequential, filtering) { 4706 var $allItems = elements.length - startIndex, 4707 showed = 0, 4708 index = 0, 4709 use_index = false 4710 ; 4711 4712 if (filtering) { 4713 if (sequential) { 4714 use_index = true; 4715 } 4716 sequential = false; 4717 } 4718 4719 $.each(elements, function(index, val) { 4720 var $this = $(val), 4721 elInner = $('> .t-inside', val); 4722 4723 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4724 return; 4725 } 4726 if (val[0]) val = val[0]; 4727 4728 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4729 new Waypoint({ 4730 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4731 element: val, 4732 handler: function() { 4733 var element = $('> .t-inside', this.element), 4734 parent = $(this.element); 4735 var _index = use_index? index : 0; 4736 4737 var delay = (!sequential) ? _index : ((startIndex !== 0) ? index - $allItems : index), 4738 delayAttr = parseInt(element.attr('data-delay')); 4739 if (isNaN(delayAttr)) delayAttr = 100; 4740 if (sequential || use_index) { 4741 delay -= showed; 4742 } 4743 var objTimeout = requestTimeout(function() { 4744 element.removeClass('zoom-reverse').addClass('start_animation'); 4745 showed = index; 4746 }, delay * delayAttr); 4747 parent.data('objTimeout', objTimeout); 4748 if (!UNCODE.isUnmodalOpen) { 4749 this.destroy(); 4750 } 4751 }, 4752 offset: UNCODE.isFullPage ? '100%' : '90%' 4753 }); 4754 } 4755 4756 index++; 4757 }); 4758}; 4759 4760UNCODE.tapHover = function() { 4761 4762 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-visual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 4763 elClass = "hover"; 4764 4765 $(window).on('click', function() { 4766 $el.removeClass(elClass); 4767 }); 4768 4769 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 4770 e.stopPropagation(); 4771 var link = $(this); 4772 if ( ! link.hasClass(elClass)) { 4773 e.preventDefault(); 4774 link.addClass("hover"); 4775 $el.not(this).removeClass(elClass); 4776 return false;
4777 } 4778 }); 4779}; 4780 4781UNCODE.onePage = function(isMobile) { 4782 var current = 0, 4783 last = 0, 4784 lastScrollTop = 0, 4785 forceScroll = false, 4786 lastScrolled = 0, 4787 isSectionscroller = ($('.main-onepage').length) ? true : false, 4788 isOnePage = false, 4789 getOffset = function () { 4790 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); 4791 return calculateOffset; 4792 } 4793 4794 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 4795 // return false; 4796 4797 function init_onepage() { 4798 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 4799 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4800 } 4801 last = $('.onepage-pagination li').last().find('a').data('index'); 4802 $.each($('div[data-parent="true"]'), function(index, val) { 4803 $(this).attr('data-section', index); 4804 if (isMobile) return; 4805 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4806 return; 4807 } 4808 var sectionDown = new Waypoint({ 4809 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4810 element: val, 4811 handler: function(direction) { 4812 if (direction == 'down') { 4813 changeMenuActive(this.element, index); 4814 } 4815 }, 4816 offset: function() { 4817 return 5 + getOffset() 4818 } 4819 }); 4820 var sectionUp = new Waypoint({ 4821 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4822 element: val, 4823 handler: function(direction) { 4824 if (direction == 'up') { 4825 changeMenuActive(this.element, index); 4826 } 4827 }, 4828 offset: function() { 4829 return -5 - getOffset() 4830 } 4831 }); 4832 4833 if (isSectionscroller) { 4834 var label; 4835 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 4836 else label = ''; 4837 var getName = $(this).attr('data-name'); 4838 if (getName == undefined) getName = index; 4839 if (label != '') { 4840 isOnePage = true; 4841 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 4842 $('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>"); 4843 } 4844 } 4845 }); 4846 4847 if (isSectionscroller) { 4848 $.each($('ul.onepage-pagination li'), function(index, val) { 4849 var $this = $(val), 4850 $a = ('a', $this); 4851 $a.on('click', function(evt) { 4852 if ( $('.is-selected', $this).length ) { 4853 return false; 4854 } 4855 if ( $('body').hasClass('uncode-scroll-no-history') ) { 4856 evt.preventDefault(); 4857 } 4858 Waypoint.refreshAll(); 4859 var el = $('a', evt.currentTarget); 4860 current = lastScrolled = parseInt(el.attr('data-index')); 4861 lastScrolled += 1; 4862 scrollBody(current); 4863 }); 4864 }); 4865 } 4866 4867 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 4868 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 4869 goToSection = String(window.location.hash).replace(/^#/, ""); 4870 goToSection = Number($('[data-name="' + goToSection + '"]').attr('data-section')); 4871 } 4872 4873 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 4874 current = lastScrolled = goToSection; 4875 $(window).on('load', function(){ 4876 if ( $('.owl-carousel').length ) { 4877 requestTimeout(function(){ 4878 scrollBody(goToSection); 4879 }, 400); 4880 } else { 4881 scrollBody(goToSection); 4882 } 4883 }); 4884 } 4885 4886 } 4887 4888 function changeMenuActive(section, index) { 4889 current = lastScrolled = parseInt($(section).attr('data-section')); 4890 if (isOnePage) { 4891 var newSection = $('.onepage-pagination li a[data-index="' + index + '"]'); 4892 if (newSection.length) { 4893 $('ul.onepage-pagination li a').removeClass('is-selected'); 4894 newSection.addClass('is-selected'); 4895 } 4896 var getName = $('[data-section="' + index + '"]').attr('data-name'); 4897 if (getName != undefined && getName !== '') { 4898 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 4899 var get_href = $(val).attr('href'); 4900 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4901 $(val).closest('.menu-smart').find('.active').removeClass('active'); 4902 $(val).parent().addClass('active'); 4903 } 4904 }); 4905 } 4906 } 4907 } 4908 4909 if (isOnePage) { 4910 $(window).on('scroll', function() { 4911 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 4912 if (bodyTop == 0) { 4913 $('ul.onepage-pagination li a').removeClass('is-selected'); 4914 $('.onepage-pagination li a[data-index="0"]').addClass('is-selected'); 4915 var getName = $('[data-section=0]').attr('data-name'); 4916 if (getName != undefined && getName !== '') { 4917 $.each($('.menu-container .menu-item > a'), function(i, val) { 4918 var get_href = $(val).attr('href'); 4919 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 4920 $(val).closest('ul').find('.active').removeClass('active'); 4921 $(val).parent().addClass('active'); 4922 } 4923 }); 4924 } 4925 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 4926 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 4927 if (lastSection.length) { 4928 $('ul.onepage-pagination li a').removeClass('is-selected'); 4929 lastSection.addClass('is-selected'); 4930 } 4931 } 4932 }); 4933 } 4934 4935 var scrollBody = function(index) { 4936 $('ul.onepage-pagination li a').removeClass('is-selected'); 4937 $('.onepage-pagination li a[data-index="' + index + '"]').addClass('is-selected'); 4938 4939 var getSection = $('[data-section=' + index + ']'), 4940 scrollTo; 4941 4942 if (getSection == undefined) return; 4943 4944 var body = $("html, body"), 4945 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4946 delta = bodyTop - ($('[data-section="' + index + '"]').length ? $('[data-section="' + index + '"]').offset().top : 0), 4947 getOffset = UNCODE.get_scroll_offset(index); 4948 if ( typeof getSection.offset() === 'undefined' ) 4949 return; 4950 scrollTo = getSection.offset().top; 4951
4952 // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 4953 if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { 4954 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 4955 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 4956 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 4957 } 4958 4959 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 4960 if ( index === 0 ) { 4961 scrollTo = 0; 4962 } else { 4963 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 4964 } 4965 } else { 4966 scrollTo -= getOffset; 4967 } 4968 } 4969 4970 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4971 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4972 4973 if (index != 0) { 4974 UNCODE.scrolling = true; 4975 } 4976 4977 if (scrollSpeed == 0) { 4978 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4979 UNCODE.scrolling = false; 4980 } else { 4981 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4982 $(this).stop(); 4983 }).animate({ 4984 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4985 }, scrollSpeed, 'easeInOutCubic', function() { 4986 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 4987 UNCODE.scrolling = false; 4988 if ( ( scrollTo != UNCODE.get_scroll_offset(index) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) 4989 || 4990 $('.menu-hided').length ) { 4991 scrollTo = getSection.offset().top; 4992 getOffset = UNCODE.get_scroll_offset(index); 4993 scrollTo -= getOffset; 4994 body.on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 4995 $(this).stop(); 4996 }).animate({ 4997 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4998 }, scrollSpeed, 'easeInOutCubic', function() { 4999 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 5000 UNCODE.scrolling = false; 5001 } 5002 ); 5003 } 5004 }); 5005 } 5006 5007 }; 5008 5009 init_onepage(); 5010}; 5011 5012UNCODE.stickyElements = function() { 5013 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 5014 if (!isMobile_wide) { 5015 5016 var $pageHeader = $('#page-header'), 5017 $headerRow = $('.vc_row', $pageHeader), 5018 startSticky = false; 5019 5020 if ( $headerRow.hasClass('sticky-element') ) { 5021 $headerRow.removeClass('sticky-element'); 5022 $pageHeader.addClass('sticky-element'); 5023 startSticky = true; 5024 } 5025 5026 var calculateOffset = function(el) { 5027 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 5028 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 5029 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0; 5030 5031 sideOffset += UNCODE.bodyBorder; 5032 5033 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 5034 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) { 5035 if ($('.menu-shrink').length) { 5036 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 5037 } else { 5038 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 5039 } 5040 } 5041 5042 return sideOffset; 5043 5044 }, 5045 5046 initStickyElement = function() { 5047 $.each($('.sticky-element'), function(index, element) { 5048 $(element).stick_in_parent({ 5049 sticky_class: 'is_stucked', 5050 offset_top: calculateOffset(element), 5051 bottoming: true, 5052 inner_scrolling: SiteParameters.sticky_elements === 'on' 5053 }); 5054 }); 5055 }; 5056 5057 requestTimeout(function() { 5058 if ($('.sticky-element').length) { 5059 5060 if ($(window).width() > UNCODE.mediaQuery) { 5061 initStickyElement(); 5062
5063 if ( startSticky === true ) { 5064 $('#page-header').trigger('sticky_kit:recalc'); 5065 } 5066 } 5067 5068 $(window).on('resize lateral_resize', function(event) { 5069 if ($(window).width() > UNCODE.mediaQuery) { 5070 initStickyElement(); 5071 } else { 5072 $(".sticky-element").trigger("sticky_kit:detach"); 5073 } 5074 }); 5075 } 5076 }, 1000); 5077 5078 if ($('.sticky-element').length) { 5079 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 5080 requestTimeout(function() { 5081 $(document.body).trigger("sticky_kit:recalc"); 5082 }, 100); 5083 }); 5084 } 5085 5086 var $panels = $('.panel-collapse'); 5087 if ( $panels.length ) { 5088 $panels.each(function(){ 5089 var $panel = $(this); 5090 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 5091 $(document.body).trigger("sticky_kit:recalc"); 5092 }); 5093 }); 5094 } 5095 } 5096}; 5097 5098UNCODE.twentytwenty = function() { 5099 5100 if (!$('.twentytwenty-container').length) return; 5101 5102// DOM.event.move 5103// 5104// 2.0.0 5105// 5106// Stephen Band 5107// 5108// Triggers 'movestart', 'move' and 'moveend' events after 5109// mousemoves following a mousedown cross a distance threshold, 5110// similar to the native 'dragstart', 'drag' and 'dragend' events. 5111// Move events are throttled to animation frames. Move event objects 5112// have the properties: 5113// 5114// pageX: 5115// pageY: Page coordinates of pointer. 5116// startX: 5117// startY: Page coordinates of pointer at movestart. 5118// distX: 5119// distY: Distance the pointer has moved since movestart. 5120// deltaX: 5121// deltaY: Distance the finger has moved since last event. 5122// velocityX: 5123// velocityY: Average velocity over last few events. 5124 5125 5126(function(fn) { 5127 if (typeof define === 'function' && define.amd) { 5128 define([], fn); 5129 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 5130 module.exports = fn; 5131 } else { 5132 fn(); 5133 } 5134})(function(){ 5135 var assign = Object.assign || window.jQuery && jQuery.extend; 5136 5137 // Number of pixels a pressed pointer travels before movestart 5138 // event is fired. 5139 var threshold = 8; 5140 5141 // Shim for requestAnimationFrame, falling back to timer. See: 5142 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 5143 var requestFrame = (function(){ 5144 return ( 5145 window.requestAnimationFrame || 5146 window.webkitRequestAnimationFrame || 5147 window.mozRequestAnimationFrame || 5148 window.oRequestAnimationFrame || 5149 window.msRequestAnimationFrame || 5150 function(fn, element){ 5151 return window.setTimeout(function(){ 5152 fn(); 5153 }, 25); 5154 } 5155 ); 5156 })(); 5157 5158 // Shim for customEvent 5159 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 5160 (function () { 5161 if ( typeof window.CustomEvent === "function" ) return false; 5162 function CustomEvent ( event, params ) { 5163 params = params || { bubbles: false, cancelable: false, detail: undefined }; 5164 var evt = document.createEvent( 'CustomEvent' ); 5165 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 5166 return evt; 5167 } 5168 5169 CustomEvent.prototype = window.Event.prototype; 5170 window.CustomEvent = CustomEvent; 5171 })(); 5172 5173 var ignoreTags = { 5174 textarea: true, 5175 input: true, 5176 select: true, 5177 button: true 5178 }; 5179 5180 var mouseevents = { 5181 move: 'mousemove', 5182 cancel: 'mouseup dragstart', 5183 end: 'mouseup' 5184 }; 5185 5186 var touchevents = { 5187 move: 'touchmove', 5188 cancel: 'touchend', 5189 end: 'touchend' 5190 }; 5191 5192 var rspaces = /\s+/; 5193 5194 5195 // DOM Events 5196 5197 var eventOptions = { bubbles: true, cancelable: true }; 5198 5199 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 5200 5201 function createEvent(type) { 5202 return new CustomEvent(type, eventOptions); 5203 } 5204 5205 function getEvents(node) { 5206 return node[eventsSymbol] || (node[eventsSymbol] = {}); 5207 } 5208 5209 function on(node, types, fn, data, selector) { 5210 types = types.split(rspaces); 5211 5212 var events = getEvents(node); 5213 var i = types.length; 5214 var handlers, type; 5215 5216 function handler(e) { fn(e, data); } 5217 5218 while (i--) { 5219 type = types[i]; 5220 handlers = events[type] || (events[type] = []); 5221 handlers.push([fn, handler]); 5222 node.addEventListener(type, handler); 5223 } 5224 } 5225 5226 function off(node, types, fn, selector) { 5227 types = types.split(rspaces); 5228 5229 var events = getEvents(node); 5230 var i = types.length;
5231 var type, handlers, k; 5232 5233 if (!events) { return; } 5234 5235 while (i--) { 5236 type = types[i]; 5237 handlers = events[type]; 5238 if (!handlers) { continue; } 5239 k = handlers.length; 5240 while (k--) { 5241 if (handlers[k][0] === fn) { 5242 node.removeEventListener(type, handlers[k][1]); 5243 handlers.splice(k, 1); 5244 } 5245 } 5246 } 5247 } 5248 5249 function trigger(node, type, properties) { 5250 // Don't cache events. It prevents you from triggering an event of a 5251 // given type from inside the handler of another event of that type. 5252 var event = createEvent(type); 5253 if (properties) { assign(event, properties); } 5254 node.dispatchEvent(event); 5255 } 5256 5257 5258 // Constructors 5259 5260 function Timer(fn){ 5261 var callback = fn, 5262 active = false, 5263 running = false; 5264 5265 function trigger(time) { 5266 if (active){ 5267 callback(); 5268 requestFrame(trigger); 5269 running = true; 5270 active = false; 5271 } 5272 else { 5273 running = false; 5274 } 5275 } 5276 5277 this.kick = function(fn) { 5278 active = true; 5279 if (!running) { trigger(); } 5280 }; 5281 5282 this.end = function(fn) { 5283 var cb = callback; 5284 5285 if (!fn) { return; } 5286 5287 // If the timer is not running, simply call the end callback. 5288 if (!running) { 5289 fn(); 5290 } 5291 // If the timer is running, and has been kicked lately, then 5292 // queue up the current callback and the end callback, otherwise 5293 // just the end callback. 5294 else { 5295 callback = active ? 5296 function(){ cb(); fn(); } : 5297 fn ; 5298 5299 active = true; 5300 } 5301 }; 5302 } 5303 5304 5305 // Functions 5306 5307 function noop() {} 5308 5309 function preventDefault(e) { 5310 e.preventDefault(); 5311 } 5312 5313 function isIgnoreTag(e) { 5314 return !!ignoreTags[e.target.tagName.toLowerCase()]; 5315 } 5316 5317 function isPrimaryButton(e) { 5318 // Ignore mousedowns on any button other than the left (or primary) 5319 // mouse button, or when a modifier key is pressed. 5320 return (e.which === 1 && !e.ctrlKey && !e.altKey); 5321 } 5322 5323 function identifiedTouch(touchList, id) { 5324 var i, l; 5325 5326 if (touchList.identifiedTouch) { 5327 return touchList.identifiedTouch(id); 5328 } 5329 5330 // touchList.identifiedTouch() does not exist in 5331 // webkit yet… we must do the search ourselves... 5332 5333 i = -1; 5334 l = touchList.length; 5335 5336 while (++i < l) { 5337 if (touchList[i].identifier === id) { 5338 return touchList[i]; 5339 } 5340 } 5341 } 5342 5343 function changedTouch(e, data) { 5344 var touch = identifiedTouch(e.changedTouches, data.identifier); 5345 5346 // This isn't the touch you're looking for. 5347 if (!touch) { return; } 5348 5349 // Chrome Android (at least) includes touches that have not 5350 // changed in e.changedTouches. That's a bit annoying. Check 5351 // that this touch has changed. 5352 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 5353 5354 return touch; 5355 } 5356 5357 5358 // Handlers that decide when the first movestart is triggered 5359 5360 function mousedown(e){ 5361 // Ignore non-primary buttons 5362 if (!isPrimaryButton(e)) { return; } 5363 5364 // Ignore form and interactive elements 5365 if (isIgnoreTag(e)) { return; } 5366 5367 on(document, mouseevents.move, mousemove, e); 5368 on(document, mouseevents.cancel, mouseend, e); 5369 } 5370 5371 function mousemove(e, data){ 5372 checkThreshold(e, data, e, removeMouse); 5373 } 5374 5375 function mouseend(e, data) { 5376 removeMouse(); 5377 } 5378 5379 function removeMouse() { 5380 off(document, mouseevents.move, mousemove); 5381 off(document, mouseevents.cancel, mouseend); 5382 } 5383 5384 function touchstart(e) { 5385 // Don't get in the way of interaction with form elements 5386 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 5387 5388 var touch = e.changedTouches[0]; 5389 5390 // iOS live updates the touch objects whereas Android gives us copies. 5391 // That means we can't trust the touchstart object to stay the same, 5392 // so we must copy the data. This object acts as a template for 5393 // movestart, move and moveend event objects. 5394 var data = { 5395 target: touch.target, 5396 pageX: touch.pageX, 5397 pageY: touch.pageY, 5398 identifier: touch.identifier, 5399 5400 // The only way to make handlers individually unbindable is by 5401 // making them unique. 5402 touchmove: function(e, data) { touchmove(e, data); }, 5403 touchend: function(e, data) { touchend(e, data); } 5404 }; 5405 5406 on(document, touchevents.move, data.touchmove, data); 5407 on(document, touchevents.cancel, data.touchend, data); 5408 } 5409 5410 function touchmove(e, data) { 5411 var touch = changedTouch(e, data); 5412 if (!touch) { return; } 5413 checkThreshold(e, data, touch, removeTouch); 5414 } 5415 5416 function touchend(e, data) { 5417 var touch = identifiedTouch(e.changedTouches, data.identifier); 5418 if (!touch) { return; } 5419 removeTouch(data); 5420 } 5421 5422 function removeTouch(data) { 5423 off(document, touchevents.move, data.touchmove); 5424 off(document, touchevents.cancel, data.touchend); 5425 } 5426 5427 function checkThreshold(e, data, touch, fn) { 5428 var distX = touch.pageX - data.pageX; 5429 var distY = touch.pageY - data.pageY; 5430
5431 // Do nothing if the threshold has not been crossed. 5432 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 5433 5434 triggerStart(e, data, touch, distX, distY, fn); 5435 } 5436 5437 function triggerStart(e, data, touch, distX, distY, fn) { 5438 var touches = e.targetTouches; 5439 var time = e.timeStamp - data.timeStamp; 5440 5441 // Create a movestart object with some special properties that 5442 // are passed only to the movestart handlers. 5443 var template = { 5444 altKey: e.altKey, 5445 ctrlKey: e.ctrlKey, 5446 shiftKey: e.shiftKey, 5447 startX: data.pageX, 5448 startY: data.pageY, 5449 distX: distX, 5450 distY: distY, 5451 deltaX: distX, 5452 deltaY: distY, 5453 pageX: touch.pageX, 5454 pageY: touch.pageY, 5455 velocityX: distX / time, 5456 velocityY: distY / time, 5457 identifier: data.identifier, 5458 targetTouches: touches, 5459 finger: touches ? touches.length : 1, 5460 enableMove: function() { 5461 this.moveEnabled = true; 5462 this.enableMove = noop; 5463 e.preventDefault(); 5464 } 5465 }; 5466 5467 // Trigger the movestart event. 5468 trigger(data.target, 'movestart', template); 5469 5470 // Unbind handlers that tracked the touch or mouse up till now. 5471 fn(data); 5472 } 5473 5474 5475 // Handlers that control what happens following a movestart 5476 5477 function activeMousemove(e, data) { 5478 var timer = data.timer; 5479 5480 data.touch = e; 5481 data.timeStamp = e.timeStamp; 5482 timer.kick(); 5483 } 5484 5485 function activeMouseend(e, data) { 5486 var target = data.target; 5487 var event = data.event; 5488 var timer = data.timer; 5489 5490 removeActiveMouse(); 5491 5492 endEvent(target, event, timer, function() { 5493 // Unbind the click suppressor, waiting until after mouseup 5494 // has been handled. 5495 setTimeout(function(){ 5496 off(target, 'click', preventDefault); 5497 }, 0); 5498 }); 5499 } 5500 5501 function removeActiveMouse() { 5502 off(document, mouseevents.move, activeMousemove); 5503 off(document, mouseevents.end, activeMouseend); 5504 } 5505 5506 function activeTouchmove(e, data) { 5507 var event = data.event; 5508 var timer = data.timer; 5509 var touch = changedTouch(e, event); 5510 5511 if (!touch) { return; } 5512 5513 // Stop the interface from gesturing 5514 e.preventDefault(); 5515 5516 event.targetTouches = e.targetTouches; 5517 data.touch = touch; 5518 data.timeStamp = e.timeStamp; 5519 5520 timer.kick(); 5521 } 5522 5523 function activeTouchend(e, data) { 5524 var target = data.target; 5525 var event = data.event; 5526 var timer = data.timer; 5527 var touch = identifiedTouch(e.changedTouches, event.identifier); 5528 5529 // This isn't the touch you're looking for. 5530 if (!touch) { return; } 5531 5532 removeActiveTouch(data); 5533 endEvent(target, event, timer); 5534 } 5535 5536 function removeActiveTouch(data) { 5537 off(document, touchevents.move, data.activeTouchmove); 5538 off(document, touchevents.end, data.activeTouchend); 5539 } 5540 5541 5542 // Logic for triggering move and moveend events 5543 5544 function updateEvent(event, touch, timeStamp) { 5545 var time = timeStamp - event.timeStamp; 5546 5547 event.distX = touch.pageX - event.startX; 5548 event.distY = touch.pageY - event.startY; 5549 event.deltaX = touch.pageX - event.pageX; 5550 event.deltaY = touch.pageY - event.pageY; 5551 5552 // Average the velocity of the last few events using a decay 5553 // curve to even out spurious jumps in values. 5554 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 5555 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 5556 event.pageX = touch.pageX; 5557 event.pageY = touch.pageY; 5558 } 5559 5560 function endEvent(target, event, timer, fn) { 5561 timer.end(function(){ 5562 trigger(target, 'moveend', event); 5563 return fn && fn(); 5564 }); 5565 } 5566 5567 5568 // Set up the DOM 5569 5570 function movestart(e) { 5571 if (e.defaultPrevented) { return; } 5572 if (!e.moveEnabled) { return; } 5573 5574 var event = { 5575 startX: e.startX, 5576 startY: e.startY, 5577 pageX: e.pageX, 5578 pageY: e.pageY, 5579 distX: e.distX, 5580 distY: e.distY, 5581 deltaX: e.deltaX, 5582 deltaY: e.deltaY, 5583 velocityX: e.velocityX, 5584 velocityY: e.velocityY, 5585 identifier: e.identifier, 5586 targetTouches: e.targetTouches, 5587 finger: e.finger 5588 }; 5589 5590 var data = { 5591 target: e.target, 5592 event: event, 5593 timer: new Timer(update), 5594 touch: undefined, 5595 timeStamp: e.timeStamp 5596 }; 5597 5598 function update(time) { 5599 updateEvent(event, data.touch, data.timeStamp); 5600 trigger(data.target, 'move', event); 5601 } 5602 5603 if (e.identifier === undefined) { 5604 // We're dealing with a mouse event. 5605 // Stop clicks from propagating during a move 5606 on(e.target, 'click', preventDefault); 5607 on(document, mouseevents.move, activeMousemove, data); 5608 on(document, mouseevents.end, activeMouseend, data); 5609 } 5610 else { 5611 // In order to unbind correct handlers they have to be unique 5612 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 5613 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 5614 5615 // We're dealing with a touch. 5616 on(document, touchevents.move, data.activeTouchmove, data); 5617 on(document, touchevents.end, data.activeTouchend, data); 5618 } 5619 } 5620 5621 on(document, 'mousedown', mousedown); 5622 on(document, 'touchstart', touchstart); 5623 on(document, 'movestart', movestart); 5624 5625 5626 // jQuery special events 5627 // 5628 // jQuery event objects are copies of DOM event objects. They need 5629 // a little help copying the move properties across. 5630 5631 if (!window.jQuery) { return; } 5632 5633 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 5634 5635 function enableMove1(e) { e.enableMove(); } 5636 function enableMove2(e) { e.enableMove(); } 5637 function enableMove3(e) { e.enableMove(); } 5638 5639 function add(handleObj) { 5640 var handler = handleObj.handler; 5641 5642 handleObj.handler = function(e) { 5643 // Copy move properties across from originalEvent 5644 var i = properties.length; 5645 var property; 5646 5647 while(i--) { 5648 property = properties[i]; 5649 e[property] = e.originalEvent[property]; 5650 } 5651 5652 handler.apply(this, arguments); 5653 }; 5654 } 5655 5656 jQuery.event.special.movestart = { 5657 setup: function() { 5658 // Movestart must be enabled to allow other move events 5659 on(this, 'movestart', enableMove1); 5660 5661 // Do listen to DOM events 5662 return false;
5663 }, 5664 5665 teardown: function() { 5666 off(this, 'movestart', enableMove1); 5667 return false; 5668 }, 5669 5670 add: add 5671 }; 5672 5673 jQuery.event.special.move = { 5674 setup: function() { 5675 on(this, 'movestart', enableMove2); 5676 return false; 5677 }, 5678 5679 teardown: function() { 5680 off(this, 'movestart', enableMove2); 5681 return false; 5682 }, 5683 5684 add: add 5685 }; 5686 5687 jQuery.event.special.moveend = { 5688 setup: function() { 5689 on(this, 'movestart', enableMove3); 5690 return false; 5691 }, 5692 5693 teardown: function() { 5694 off(this, 'movestart', enableMove3); 5695 return false; 5696 }, 5697 5698 add: add 5699 }; 5700}); 5701 5702 $.fn.twentytwenty = function(options) { 5703 var options = $.extend({ 5704 default_offset_pct: 0.5, 5705 orientation: 'horizontal', 5706 before_label: 'Before', 5707 after_label: 'After', 5708 no_overlay: false, 5709 move_slider_on_hover: false, 5710 move_with_handle_only: true, 5711 click_to_move: false 5712 }, options); 5713 5714 return this.each(function() { 5715 5716 var sliderPct = options.default_offset_pct; 5717 var container = $(this); 5718 var sliderOrientation = options.orientation; 5719 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 5720 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 5721 5722 5723 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 5724 if(!options.no_overlay) { 5725 container.append("<div class='twentytwenty-overlay'></div>"); 5726 var overlay = container.find(".twentytwenty-overlay"); 5727 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 5728 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 5729 } 5730 var beforeImg = container.find("img:first"); 5731 var afterImg = container.find("img:last"); 5732 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 5733 var slider = container.find(".twentytwenty-handle"); 5734 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 5735 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 5736 container.addClass("twentytwenty-container"); 5737 beforeImg.addClass("twentytwenty-before"); 5738 afterImg.addClass("twentytwenty-after"); 5739 5740 var calcOffset = function(dimensionPct) { 5741 var w = beforeImg.width(); 5742 var h = beforeImg.height(); 5743 return { 5744 w: w+"px", 5745 h: h+"px", 5746 cw: (dimensionPct*w)+"px", 5747 ch: (dimensionPct*h)+"px" 5748 }; 5749 }; 5750 5751 var adjustContainer = function(offset) { 5752 if (sliderOrientation === 'vertical') { 5753 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 5754 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 5755 } 5756 else { 5757 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 5758 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 5759 } 5760 container.css("height", offset.h); 5761 }; 5762 5763 var adjustSlider = function(pct) { 5764 var offset = calcOffset(pct); 5765 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 5766 adjustContainer(offset); 5767 }; 5768 5769 // Return the number specified or the min/max number if it outside the range given. 5770 var minMaxNumber = function(num, min, max) { 5771 return Math.max(min, Math.min(max, num)); 5772 }; 5773 5774 // Calculate the slider percentage based on the position. 5775 var getSliderPercentage = function(positionX, positionY) { 5776 var sliderPercentage = (sliderOrientation === 'vertical') ? 5777 (positionY-offsetY)/imgHeight : 5778 (positionX-offsetX)/imgWidth; 5779 5780 return minMaxNumber(sliderPercentage, 0, 1); 5781 }; 5782 5783 5784 $(window).on("resize.twentytwenty", function(e) { 5785 adjustSlider(sliderPct); 5786 }); 5787 5788 var offsetX = 0; 5789 var offsetY = 0; 5790 var imgWidth = 0; 5791 var imgHeight = 0; 5792 var onMoveStart = function(e) { 5793 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 5794 e.preventDefault(); 5795 } 5796 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 5797 e.preventDefault(); 5798 } 5799 container.addClass("active"); 5800 offsetX = container.offset().left; 5801 offsetY = container.offset().top; 5802 imgWidth = beforeImg.width(); 5803 imgHeight = beforeImg.height(); 5804 }; 5805 var onMove = function(e) { 5806 if (container.hasClass("active")) { 5807 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5808 adjustSlider(sliderPct); 5809 } 5810 }; 5811 var onMoveEnd = function() { 5812 container.removeClass("active"); 5813 }; 5814 5815 var moveTarget = options.move_with_handle_only ? slider : container; 5816 moveTarget.on("movestart",onMoveStart); 5817 moveTarget.on("move",onMove); 5818 moveTarget.on("moveend",onMoveEnd); 5819 5820 if (options.move_slider_on_hover) { 5821 container.on("mouseenter", onMoveStart); 5822 container.on("mousemove", onMove); 5823 container.on("mouseleave", onMoveEnd); 5824 } 5825 5826 slider.on("touchmove", function(e) { 5827 e.preventDefault(); 5828 }); 5829 5830 container.find("img").on("mousedown", function(event) { 5831 event.preventDefault(); 5832 }); 5833 5834 if (options.click_to_move) { 5835 container.on('click', function(e) { 5836 offsetX = container.offset().left; 5837 offsetY = container.offset().top; 5838 imgWidth = beforeImg.width(); 5839 imgHeight = beforeImg.height(); 5840 5841 sliderPct = getSliderPercentage(e.pageX, e.pageY); 5842 adjustSlider(sliderPct); 5843 }); 5844 } 5845 5846 $(window).trigger("resize.twentytwenty"); 5847 }); 5848 }; 5849 5850 5851 $(window).on("load", function(e) { 5852 $('.twentytwenty-container').each(function(){ 5853 var $container = $(this); 5854 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5855 $container.twentytwenty(); 5856 } 5857 $('img', $container).on('async-done', function(){ 5858 if ( ! $('.twentytwenty-wrapper', $container).length ) { 5859 $container.twentytwenty(); 5860 } 5861 }); 5862 }); 5863 }); 5864} 5865 5866UNCODE.justifiedGallery = function() { 5867 5868 var breakPointMe = function( val ) { 5869 val = parseInt( val ); 5870 if ( isNaN(val) ) { 5871 return false;
5872 } 5873 if ( val >= 1500 ) { 5874 return 1; 5875 } else if ( val < 1500 && val >= 960 ) { 5876 return 2; 5877 } else if ( val < 960 && val >= 570 ) { 5878 return 3; 5879 } else if ( val < 570 ) { 5880 return 4; 5881 } 5882 } 5883 5884 var gutterByBreakpoint = function( bp, gutter ) { 5885 var ret; 5886 switch(gutter) { 5887 case 'no-gutter': 5888 ret = 0; 5889 break; 5890 case 'px-gutter': 5891 ret = 1; 5892 break; 5893 case 'half-gutter': 5894 ret = 18; 5895 break; 5896 case 'double-gutter': 5897 switch(bp) { 5898 case 3: 5899 case 4: 5900 ret = 36; 5901 break; 5902 default: 5903 ret = 72; 5904 break; 5905 } 5906 break; 5907 case 'triple-gutter': 5908 switch(bp) { 5909 case 3: 5910 case 4: 5911 ret = 36; 5912 break; 5913 default: 5914 ret = 108; 5915 break; 5916 } 5917 break; 5918 case 'quad-gutter': 5919 switch(bp) { 5920 case 2: 5921 ret = 108; 5922 break; 5923 case 3: 5924 ret = 72; 5925 break; 5926 case 4: 5927 ret = 36; 5928 break; 5929 default: 5930 ret = 144; 5931 break; 5932 } 5933 break; 5934 default: 5935 ret = 36;//single-gutter 5936 } 5937 return ret; 5938 } 5939 5940 if ($('.justified-layout').length > 0) { 5941 var justifiedContainersArray = [], 5942 typeGridArray = [], 5943 layoutGridArray = [], 5944 transitionDuration = [], 5945 $filterItems = [], 5946 $filters = $('.justified-system .isotope-filters'), 5947 $itemSelector = '.tmb', 5948 $items, 5949 itemMargin, 5950 correctionFactor = 0, 5951 firstLoad = true, 5952 isOriginLeft = $('body').hasClass('rtl') ? false : true, 5953 prevW = breakPointMe(UNCODE.wwidth); 5954 $('[class*="justified-container"]').each(function() { 5955 var isoData = $(this).data(); 5956 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 5957 if (isoData.type == 'metro') typeGridArray.push(true); 5958 else typeGridArray.push(false); 5959 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 5960 else layoutGridArray.push('justified'); 5961 justifiedContainersArray.push($(this)); 5962 }); 5963 var init_justifiedGallery = function() { 5964 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 5965 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 5966 justifiedId = justifiedSystem.attr('id'), 5967 $layoutMode = layoutGridArray[i], 5968 gutter = $(justifiedContainersArray[i]).data('gutter'), 5969 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 5970 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 5971 lastRow = $(justifiedContainersArray[i]).data('last-row'), 5972 margins; 5973 5974 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 5975 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 5976 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 5977 5978 margins = gutterByBreakpoint(prevW, gutter); 5979 5980 $(justifiedContainersArray[i]).justifiedGallery({ 5981 rowHeight: rowHeight, 5982 maxRowHeight: maxRowHeight, 5983 margins: margins, 5984 cssAnimation: true, 5985 lastRow: lastRow, 5986 waitThumbnailsLoad: false 5987 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 5988 5989 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 5990 $(justifiedContainersArray[i]).infinitescroll({ 5991 navSelector: '#' + justifiedId + ' .loadmore-button', // selector for the pagination container 5992 nextSelector: '#' + justifiedId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 5993 itemSelector: '#' + justifiedId + ' .justified-layout .tmb, #' + justifiedId + ' .isotope-filters li', // selector for all items you'll retrieve 5994 animate: false, 5995 behavior: 'local', 5996 debug: false, 5997 loading: { 5998 selector: '#' + justifiedId + '.justified-system .justified-footer-inner', 5999 speed: 0, 6000 finished: undefined, 6001 msg: $('#' + justifiedId + ' .loadmore-button'), 6002 }, 6003 errorCallback: function() { 6004 var justified_system = $(this).closest('.justified-system'); 6005 $('.loading-button', justified_system).hide(); 6006 $('.loadmore-button', justified_system).attr('style', 'display:none !important'); 6007 } 6008 }, 6009 // append the new items to galleryJustified on the infinitescroll callback function. 6010 function(newElements, opts) { 6011 var $galleryJustified = $(this), 6012 justifiedId = $galleryJustified.closest('.justified-system').attr('id'), 6013 filters = new Array(), 6014 $loading_button = $galleryJustified.closest('.justified-system').find('.loading-button'), 6015 $infinite_button = $galleryJustified.closest('.justified-system').find('.loadmore-button'), 6016 $numPages = $('a', $infinite_button).data('pages'),
6017 delay = 300; 6018 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6019 $infinite_button.show(); 6020 $loading_button.hide(); 6021 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6022 $('> li', $galleryJustified).remove(); 6023 $.each($(newElements), function(index, val) { 6024 $(val).addClass('tmb-iso'); 6025 if ($(val).is("li")) { 6026 filters.push($(val)[0]); 6027 } 6028 }); 6029 newElements = newElements.filter(function(x) { 6030 return filters.indexOf(x) < 0 6031 }); 6032 $.each($(filters), function(index, val) { 6033 if ($('#' + justifiedId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + justifiedId + ' .isotope-filters ul').append($(val)); 6034 }); 6035 $galleryJustified.justifiedGallery('norewind', onLayout($galleryJustified, newElements.length)); 6036 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6037 var getLightbox = UNCODE.lightboxArray['ilightbox_' + justifiedId]; 6038 if (typeof getLightbox === 'object') { 6039 getLightbox.refresh(); 6040 } else { 6041 UNCODE.lightbox(); 6042 } 6043 } 6044 if ( typeof twttr !== 'undefined' ) 6045 twttr.widgets.load(justifiedContainersArray[i]); 6046 6047 requestTimeout(function() { 6048 $galleryJustified.trigger('more-items-loaded'); 6049 }, 1000); 6050 }); 6051 if ($(justifiedContainersArray[i]).hasClass('isotope-infinite-button')) { 6052 var $infinite_justified = $(justifiedContainersArray[i]), 6053 $infinite_button = $infinite_justified.closest('.justified-system').find('.loadmore-button a'); 6054 $infinite_justified.infinitescroll('pause'); 6055 $infinite_button.on('click', function(event) { 6056 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6057 $.each(UNCODE.lightboxArray, function(index, val) { 6058 UNCODE.lightboxArray[index].destroy(); 6059 }); 6060 } 6061 event.preventDefault(); 6062 var $justified_system = $(event.target).closest('.justified-system'), 6063 $infinite_justified = $justified_system.find('.justified-container'), 6064 justifiedId = $justified_system.attr('id'); 6065 $(event.currentTarget).html(SiteParameters.loading); 6066 $infinite_justified.infinitescroll('resume'); 6067 $infinite_justified.infinitescroll('retrieve'); 6068 $infinite_justified.infinitescroll('pause'); 6069 $infinite_justified.trigger('more-items-loaded'); 6070 }); 6071 } 6072 } 6073 } 6074 }, 6075 onLayout = function(justifiedObj, startIndex) { 6076 justifiedObj.css('opacity', 1); 6077 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 6078 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 6079 6080 requestTimeout(function() { 6081 // window.dispatchEvent(UNCODE.boxEvent); 6082 UNCODE.adaptive(); 6083 if (SiteParameters.dynamic_srcset_active === '1') { 6084 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 6085 } 6086 if (typeof MediaElement === "function") { 6087 $(justifiedObj).find('audio,video').each(function() { 6088 $(this).mediaelementplayer({ 6089 pauseOtherPlayers: false, 6090 }); 6091 }); 6092 } 6093 if ($(justifiedObj).find('.nested-carousel').length) { 6094 if (typeof UNCODE.carousel !== 'undefined') { 6095 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 6096 } 6097 requestTimeout(function() { 6098 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6099 justifiedObj.addClass('justified-gallery-finished') 6100 Waypoint.refreshAll(); 6101 }, 200); 6102 } else { 6103 requestTimeout(function() { 6104 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 6105 justifiedObj.addClass('justified-gallery-finished') 6106 Waypoint.refreshAll(); 6107 }, 300); 6108 } 6109 }, 100); 6110 6111 }, 6112 boxAnimation = function(items, startIndex, sequential, container) { 6113 var $allItems = items.length - startIndex, 6114 showed = 0, 6115 index = 0; 6116 if (container.closest('.owl-item').length == 1) return false; 6117 $.each(items, function(index, val) { 6118 var elInner = $('> .t-inside', val); 6119 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 6120 return; 6121 } 6122 if (val[0]) val = val[0]; 6123 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 6124 new Waypoint({ 6125 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 6126 element: val, 6127 handler: function() { 6128 var element = $('> .t-inside', this.element), 6129 parent = $(this.element), 6130 currentIndex = parent.index();
6131 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 6132 delayAttr = parseInt(element.attr('data-delay')); 6133 if (isNaN(delayAttr)) delayAttr = 100; 6134 delay -= showed; 6135 var objTimeout = requestTimeout(function() { 6136 element.removeClass('zoom-reverse').addClass('start_animation'); 6137 showed = parent.index(); 6138 }, delay * delayAttr); 6139 parent.data('objTimeout', objTimeout); 6140 if (!UNCODE.isUnmodalOpen) { 6141 this.destroy(); 6142 } 6143 }, 6144 offset: '100%' 6145 }) 6146 } else { 6147 elInner.removeClass('animate_when_almost_visible'); 6148 $(val).addClass('no-waypoint-animation'); 6149 /*if (elInner.hasClass('force-anim')) { 6150 elInner.addClass('start_animation'); 6151 } else { 6152 elInner.css('opacity', 1); 6153 }*/ 6154 } 6155 index++; 6156 }); 6157 }; 6158 $filters.on('click', 'a[data-filter]', function(evt) { 6159 var $filter = $(this), 6160 filterContainer = $filter.closest('.isotope-filters'), 6161 filterValue = $filter.attr('data-filter'), 6162 container = $filter.closest('.justified-system').find($('.justified-layout')), 6163 lastRow = container.data('last-row'), 6164 transitionDuration = 0, 6165 delay = 300, 6166 filterItems = []; 6167 6168 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 6169 6170 var filter_items = function(){ 6171 if (filterValue !== undefined) { 6172 $.each($('> .tmb > .t-inside', container), function(index, val) { 6173 var parent = $(val).parent(), 6174 objTimeout = parent.data('objTimeout'); 6175 if (objTimeout) { 6176 $(val).removeClass('zoom-reverse'); 6177 clearRequestTimeout(objTimeout); 6178 } 6179 if (transitionDuration == 0) { 6180 if ($(val).hasClass('animate_when_almost_visible')) { 6181 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6182 } else { 6183 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6184 } 6185 } 6186 }); 6187 6188 requestTimeout(function() { 6189 var $block, 6190 selector, 6191 lightboxElements, 6192 $boxes; 6193 6194 if ( filterValue !== '' && filterValue !== '*' ) { 6195 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 6196 selector = '.' + filterValue; 6197 $.each($(selector, container), function(index, block) { 6198 lightboxElements = $('[data-lbox^=ilightbox]', block); 6199 if (lightboxElements.length) { 6200 lightboxElements.removeClass('lb-disabled'); 6201 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6202 } 6203 filterItems.push(block); 6204 }); 6205 container.justifiedGallery({ 6206 filter: selector, 6207 lastRow: 'nojustify' 6208 }); 6209 } else { 6210 container.justifiedGallery({ 6211 filter: false, 6212 lastRow: lastRow 6213 }); 6214 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 6215 filterItems = $('> .tmb', container); 6216 } 6217 container.trigger('more-items-loaded'); 6218 6219 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6220 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6221 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 6222 if (typeof getLightbox === 'object') { 6223 getLightbox.refresh(); 6224 } else { 6225 UNCODE.lightbox(); 6226 } 6227 } 6228 6229 if (transitionDuration == 0) { 6230 requestTimeout(function() { 6231 boxAnimation(filterItems, 0, false, container); 6232 }, 100); 6233 } 6234 requestTimeout(function() { 6235 Waypoint.refreshAll(); 6236 container.trigger('more-items-loaded'); 6237 }, 2000); 6238 6239 }, delay); 6240 } else { 6241 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6242 $.each(UNCODE.lightboxArray, function(index, val) { 6243 UNCODE.lightboxArray[index].destroy(); 6244 }); 6245 } 6246 $.each($('> .tmb > .t-inside', container), function(index, val) { 6247 var parent = $(val).parent(), 6248 objTimeout = parent.data('objTimeout'); 6249 if (objTimeout) { 6250 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6251 clearRequestTimeout(objTimeout); 6252 } 6253 if (transitionDuration == 0) { 6254 if ($(val).hasClass('animate_when_almost_visible')) { 6255 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6256 } else { 6257 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6258 } 6259 } 6260 }); 6261 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6262 UNCODE.lightbox(); 6263 } 6264 container.parent().addClass('justified-loading'); 6265 container.trigger('more-items-loaded'); 6266 } 6267 }; 6268 6269 if (!$filter.hasClass('active')) { 6270 /** Scroll top with filtering */ 6271 if (filterContainer.hasClass('filter-scroll')) { 6272 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6273 calc_scroll -= UNCODE.get_scroll_offset(); 6274 6275 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6276 delta = bodyTop - calc_scroll, 6277 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6278 filterTolerance = false, 6279 filter_timeout; 6280 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6281 6282 if ( !UNCODE.isFullPage ) { 6283 if (scrollSpeed == 0) { 6284 $('html, body').scrollTop(calc_scroll); 6285 UNCODE.scrolling = false;
6286 filter_items(); 6287 } else { 6288 6289 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6290 filter_items(); 6291 filterTolerance = true; 6292 } 6293 6294 $('html, body').animate({ 6295 scrollTop: calc_scroll 6296 },{ 6297 easing: 'easeInOutQuad', 6298 duration: scrollSpeed, 6299 complete: function(){ 6300 UNCODE.scrolling = false; 6301 if ( !filterTolerance ) { 6302 filter_timeout = setTimeout(function(){ 6303 clearTimeout(filter_timeout); 6304 filter_items(); 6305 }, 200); 6306 } 6307 } 6308 }); 6309 } 6310 } 6311 } else { 6312 filter_items(); 6313 } 6314 } 6315 evt.preventDefault(); 6316 }); 6317 6318 $filters.each(function(i, buttonGroup) { 6319 var $buttonGroup = $(buttonGroup); 6320 $buttonGroup.on('click', 'a', function() { 6321 $buttonGroup.find('.active').removeClass('active'); 6322 $(this).addClass('active'); 6323 }); 6324 6325 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6326 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6327 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6328 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6329 e.preventDefault(); 6330 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6331 }); 6332 }); 6333 window.addEventListener('boxResized', function(e) { 6334 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 6335 prevW = breakPointMe(UNCODE.wwidth); 6336 $.each($('.justified-layout'), function(index, val) { 6337 var gutter = $(this).data('gutter'), 6338 margins = gutterByBreakpoint( prevW, gutter); 6339 $(this).justifiedGallery({ 6340 margins: margins 6341 }); 6342 $(this).find('.mejs-video,.mejs-audio').each(function() { 6343 $(this).trigger('resize'); 6344 }); 6345 }); 6346 } 6347 }, false); 6348 6349 init_justifiedGallery(); 6350 }; 6351}; 6352 6353UNCODE.cssGrid = function() { 6354 if ($('.cssgrid-layout').length > 0) { 6355 var cssGridContainersArray = []; 6356 var transitionDuration = []; 6357 var $filters = $('.cssgrid-system .cssgrid-filters'); 6358 6359 $('[class*="cssgrid-container"]').each(function() { 6360 cssGridContainersArray.push($(this)); 6361 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 6362 }); 6363 6364 var init_cssGridAjax = function() { 6365 for (var i = 0, len = cssGridContainersArray.length; i < len; i++) { 6366 var cssGridSystem = $(cssGridContainersArray[i]).closest($('.cssgrid-system')), 6367 cssGridId = cssGridSystem.attr('id'); 6368 6369 cssGridSystem.data('transitionDuration', transitionDuration[i]); 6370 6371 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite') && $.fn.infinitescroll) { 6372 $(cssGridContainersArray[i]).infinitescroll({ 6373 navSelector: '#' + cssGridId + ' .loadmore-button', // selector for the pagination container 6374 nextSelector: '#' + cssGridId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 6375 itemSelector: '#' + cssGridId + ' .cssgrid-layout .tmb, #' + cssGridId + ' .grid-filters li.filter-cat', // selector for all items you'll retrieve 6376 animate: false, 6377 behavior: 'local', 6378 debug: false, 6379 loading: { 6380 selector: '#' + cssGridId + '.cssgrid-system .cssgrid-footer-inner', 6381 speed: 0, 6382 finished: undefined, 6383 msg: $('#' + cssGridId + ' .loadmore-button'), 6384 }, 6385 errorCallback: function() { 6386 var cssgrid_system = $(this).closest('.cssgrid-system'); 6387 $('.loading-button', cssgrid_system).hide(); 6388 $('.loadmore-button', cssgrid_system).attr('style', 'display:none !important'); 6389 } 6390 }, 6391 // append the new items to cssGrid on the infinitescroll callback function. 6392 function(newElements, opts) { 6393 var $cssGrid = $(this), 6394 cssGridSystemCont = $cssGrid.closest('.cssgrid-system'), 6395 cssGridId = cssGridSystemCont.attr('id'), 6396 filters = new Array(), 6397 $loading_button = $cssGrid.closest('.cssgrid-system').find('.loading-button'), 6398 $infinite_button = $cssGrid.closest('.cssgrid-system').find('.loadmore-button'), 6399 $numPages = $('a', $infinite_button).data('pages'),
6400 delay = 300; 6401 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 6402 $infinite_button.show(); 6403 $loading_button.hide(); 6404 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 6405 $('> li', $cssGrid).remove(); 6406 $.each($(newElements), function(index, val) { 6407 $(val).addClass('tmb-grid'); 6408 if ($(val).is("li")) { 6409 filters.push($(val)[0]); 6410 } 6411 }); 6412 newElements = newElements.filter(function(x) { 6413 return filters.indexOf(x) < 0 6414 }); 6415 $.each($(filters), function(index, val) { 6416 if ($('#' + cssGridId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + cssGridId + ' .grid-filters ul').append($(val)); 6417 }); 6418 6419 var filterValue = cssGridSystemCont.find('.grid-nav-link.active').attr('data-filter'); 6420 var sequential = cssGridSystemCont.hasClass('cssgrid-animate-sequential') ? true : false; 6421 if (filterValue !== undefined && filterValue != '*') { 6422 $(newElements).hide(); 6423 var els_to_show = $(); 6424 $(newElements).each(function() { 6425 var el = $(this); 6426 if (el.hasClass(filterValue)) { 6427 els_to_show = els_to_show.add(el); 6428 el.show(); 6429 } 6430 }); 6431 UNCODE.animate_css_grids(cssGridSystemCont, els_to_show, els_to_show.length, sequential, true); 6432 } else { 6433 UNCODE.animate_css_grids(cssGridSystemCont, $(newElements), $(newElements).length, sequential, true); 6434 } 6435 6436 UNCODE.adaptive(); 6437 if (SiteParameters.dynamic_srcset_active === '1') { 6438 UNCODE.refresh_dynamic_srcset_size($cssGrid); 6439 } 6440 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6441 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssGridId]; 6442 if (typeof getLightbox === 'object') { 6443 getLightbox.refresh(); 6444 } else { 6445 UNCODE.lightbox(); 6446 } 6447 } 6448 if ( typeof twttr !== 'undefined' ) { 6449 twttr.widgets.load(cssGridContainersArray[i]); 6450 } 6451 6452 UNCODE.carousel($(newElements)); 6453 requestTimeout(function() { 6454 $cssGrid.trigger('more-items-loaded'); 6455 }, 1000); 6456 6457 }); 6458 if ($(cssGridContainersArray[i]).hasClass('cssgrid-infinite-button')) { 6459 var $cssgrid_el = $(cssGridContainersArray[i]), 6460 $infinite_button = $cssgrid_el.closest('.cssgrid-system').find('.loadmore-button a'); 6461 $cssgrid_el.infinitescroll('pause'); 6462 $infinite_button.on('click', function(event) { 6463 event.preventDefault(); 6464 var $cssgrid_system = $(event.target).closest('.cssgrid-system'), 6465 $cssgrid_el = $cssgrid_system.find('.cssgrid-container'), 6466 cssGridId = $cssgrid_system.attr('id'); 6467 $(event.currentTarget).html(SiteParameters.loading); 6468 $cssgrid_el.infinitescroll('resume'); 6469 $cssgrid_el.infinitescroll('retrieve'); 6470 $cssgrid_el.infinitescroll('pause'); 6471 }); 6472 } 6473 } 6474 } 6475 }; 6476 6477 init_cssGridAjax(); 6478 6479 if ($('.cssgrid-pagination').length > 0) { 6480 $('.cssgrid-system').on('click', '.pagination a', function(evt) { 6481 evt.preventDefault(); 6482 6483 var container = $(this).closest('.cssgrid-system'), 6484 calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6485 6486 calc_scroll -= UNCODE.get_scroll_offset(); 6487 6488 var menu_container = $('.menu-sticky'); 6489 var menu = menu_container.find('.menu-container'); 6490 6491 if (menu_container.length > 0 && menu.length > 0) { 6492 calc_scroll = calc_scroll - menu.outerHeight(); 6493 } 6494 6495 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6496 delta = bodyTop - calc_scroll, 6497 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6498 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6499 6500 if ( !UNCODE.isFullPage ) { 6501 if (scrollSpeed == 0) { 6502 $('html, body').scrollTop(calc_scroll); 6503 } else { 6504 $('html, body').animate({ 6505 scrollTop: calc_scroll 6506 },{ 6507 easing: 'easeInOutQuad', 6508 duration: scrollSpeed, 6509 complete: function(){ 6510 UNCODE.scrolling = false;
6511 } 6512 }); 6513 } 6514 } 6515 6516 loadCssGrid($(this), true); 6517 evt.preventDefault(); 6518 }); 6519 } 6520 6521 $filters.on('click', 'a.grid-nav-link', function(evt) { 6522 if ($(this).hasClass('no-grid-filter')) { 6523 return; 6524 } 6525 var $filter = $(this), 6526 filterContainer = $filter.closest('.cssgrid-filters'), 6527 filterValue = $filter.attr('data-filter'), 6528 containerSystem = $filter.closest('.cssgrid-system'), 6529 container = containerSystem.find($('.cssgrid-layout')), 6530 transitionDuration = containerSystem.data('transitionDuration'), 6531 delay = 300, 6532 filterItems = [], 6533 all_thumbs = container.find('.tmb-grid'); 6534 6535 var filter_items = function(){ 6536 if (filterValue !== undefined) { 6537 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6538 var parent = $(val).parent(), 6539 objTimeout = parent.data('objTimeout'); 6540 if (objTimeout) { 6541 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6542 clearRequestTimeout(objTimeout); 6543 } 6544 if (transitionDuration == 0) { 6545 if ($(val).hasClass('animate_when_almost_visible')) { 6546 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6547 } else { 6548 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6549 } 6550 } 6551 }); 6552 requestTimeout(function(){ 6553 if ( filterValue == '*' ) { 6554 all_thumbs.show(); 6555 all_thumbs.each(function(index, val) { 6556 $(val).find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6557 filterItems.push($(this)); 6558 }); 6559 } else { 6560 all_thumbs.each(function() { 6561 var _tmb = $(this); 6562 if (_tmb.hasClass(filterValue)) { 6563 _tmb.show(); 6564 _tmb.find('[data-lbox^=ilightbox]').removeClass('lb-disabled'); 6565 filterItems.push(_tmb); 6566 } else { 6567 _tmb.find('[data-lbox^=ilightbox]').addClass('lb-disabled'); 6568 _tmb.hide(); 6569 } 6570 }); 6571 } 6572 6573 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 6574 6575 var sequential = containerSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6576 UNCODE.animate_css_grids(containerSystem, filterItems, 0, sequential, true); 6577 var lightboxElements = $('[data-lbox^=ilightbox]', container); 6578 if (lightboxElements.length) { 6579 container.data('lbox', $(lightboxElements[0]).data('lbox')); 6580 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6581 var getLightbox = UNCODE.lightboxArray['ilightbox_' + container.closest('.cssgrid-system').attr('id')]; 6582 if (typeof getLightbox === 'object') { 6583 getLightbox.refresh(); 6584 } else { 6585 UNCODE.lightbox(); 6586 } 6587 } 6588 } 6589 container.trigger('more-items-loaded'); 6590 }, delay); 6591 } else { 6592 $.each($('> .tmb-grid > .t-inside', container), function(index, val) { 6593 var parent = $(val).parent(), 6594 objTimeout = parent.data('objTimeout'); 6595 if (objTimeout) { 6596 $(val).removeClass('zoom-reverse').removeClass('start_animation') 6597 clearRequestTimeout(objTimeout); 6598 } 6599 if (transitionDuration == 0) { 6600 if ($(val).hasClass('animate_when_almost_visible')) { 6601 $(val).addClass('zoom-reverse').removeClass('start_animation'); 6602 } else { 6603 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 6604 } 6605 } 6606 }); 6607 loadCssGrid($filter); 6608 } 6609 }; 6610 6611 if (!$filter.hasClass('active')) { 6612 /** Scroll top with filtering */ 6613 if (filterContainer.hasClass('filter-scroll')) { 6614 var calc_scroll = SiteParameters.index_pagination_scroll_to != false ? eval(SiteParameters.index_pagination_scroll_to) : container.closest('.row-parent').offset().top; 6615 calc_scroll -= UNCODE.get_scroll_offset(); 6616 6617 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6618 delta = bodyTop - calc_scroll, 6619 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed, 6620 filterTolerance = false, 6621 filter_timeout; 6622 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6623 6624 if ( !UNCODE.isFullPage ) { 6625 if (scrollSpeed == 0) { 6626 $('html, body').scrollTop(calc_scroll); 6627 UNCODE.scrolling = false;
6628 filter_items(); 6629 } else { 6630 6631 if ( bodyTop <= (calc_scroll+20) && bodyTop >= (calc_scroll-20) ) { 6632 filter_items(); 6633 filterTolerance = true; 6634 } 6635 6636 $('html, body').animate({ 6637 scrollTop: calc_scroll 6638 },{ 6639 easing: 'easeInOutQuad', 6640 duration: scrollSpeed, 6641 complete: function(){ 6642 UNCODE.scrolling = false; 6643 if ( !filterTolerance ) { 6644 filter_timeout = setTimeout(function(){ 6645 clearTimeout(filter_timeout); 6646 filter_items(); 6647 }, 200); 6648 } 6649 } 6650 }); 6651 } 6652 } 6653 } else { 6654 filter_items(); 6655 } 6656 } 6657 evt.preventDefault(); 6658 }); 6659 6660 $(window).off('popstate.cssgrid').on("popstate.cssgrid", function(e) { 6661 var params = UNCODE.getURLParams(window.location); 6662 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 6663 6664 UNCODE.lastURL = window.location.href; 6665 6666 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 6667 return; 6668 } 6669 6670 if (params.id === undefined) { 6671 $.each($('.cssgrid-system'), function(index, val) { 6672 loadCssGrid($(val)); 6673 }); 6674 } else { 6675 if (!params.hasOwnProperty(SiteParameters.ajax_filter_key_unfilter)) { 6676 loadCssGrid($('#' + params.id)); 6677 } 6678 } 6679 }); 6680 6681 var loadCssGrid = function($href, $paginating) { 6682 var is_paginating = false; 6683 6684 if (undefined !== $paginating && $paginating) { 6685 var is_paginating = $paginating; 6686 } 6687 6688 var href = ($href.is("a") ? $href.attr('href') : location), 6689 cssgridSystem = ($href.is("a") ? $href.closest($('.cssgrid-system')) : $href), 6690 cssgridWrapper = cssgridSystem.find($('.cssgrid-wrapper')), 6691 cssgridFooter = cssgridSystem.find($('.cssgrid-footer-inner')), 6692 cssgridResultCount = cssgridSystem.find($('.woocommerce-result-count-wrapper')), 6693 cssgridContainer = cssgridSystem.find($('.cssgrid-layout')), 6694 cssgridId = cssgridSystem.attr('id'); 6695 if ( $href.is("a") && ! cssgridSystem.hasClass('un-no-history') ) { 6696 UNCODE.lastURL = href; 6697 history.pushState({ 6698 myCSSgrid: true 6699 }, document.title, href); 6700 } 6701 cssgridWrapper.addClass('cssgrid-loading'); 6702 if (is_paginating) { 6703 cssgridWrapper.addClass('grid-filtering'); 6704 } 6705 $.ajax({ 6706 url: href 6707 }).done(function(data) { 6708 var $resultItems = $(data).find('#' + cssgridId + ' .cssgrid-layout').html(), 6709 $resultPagination = $(data).find('#' + cssgridId + ' .pagination')[0], 6710 $resultCount = $(data).find('#' + cssgridId + ' .woocommerce-result-count')[0]; 6711 requestTimeout(function() { 6712 cssgridContainer.html($resultItems); 6713 cssgridWrapper.removeClass('cssgrid-loading'); 6714 cssgridWrapper.removeClass('grid-filtering'); 6715 var sequential = cssgridSystem.hasClass('cssgrid-animate-sequential') ? true : false; 6716 UNCODE.animate_css_grids(cssgridSystem, cssgridContainer.find('.tmb-grid'), 0, sequential, false); 6717 UNCODE.adaptive(); 6718 if (SiteParameters.dynamic_srcset_active === '1') { 6719 UNCODE.refresh_dynamic_srcset_size(cssgridContainer); 6720 } 6721 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 6722 var getLightbox = UNCODE.lightboxArray['ilightbox_' + cssgridContainer.closest('.cssgrid-system').attr('id')]; 6723 if (typeof getLightbox === 'object') { 6724 getLightbox.refresh(); 6725 } else { 6726 UNCODE.lightbox(); 6727 } 6728 } 6729 cssgridContainer.trigger('more-items-loaded'); 6730 }, 300); 6731 6732 $('.pagination', cssgridFooter).remove(); 6733 cssgridFooter.append($resultPagination); 6734 6735 if (cssgridResultCount.length > 0) { 6736 $('.woocommerce-result-count', cssgridResultCount).remove(); 6737 cssgridResultCount.append($resultCount); 6738 } 6739 }); 6740 }; 6741 6742 $filters.each(function(i, buttonGroup) { 6743 var $buttonGroup = $(buttonGroup); 6744 $buttonGroup.on('click', 'a:not(.no-grid-filter)', function() { 6745 $buttonGroup.find('.active').removeClass('active'); 6746 $(this).addClass('active'); 6747 6748 }); 6749 6750 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 6751 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 6752 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 6753 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 6754 e.preventDefault(); 6755 $cats_filters.slideToggle(400, 'easeInOutCirc'); 6756 }); 6757 6758 }); 6759 }; 6760}; 6761 6762UNCODE.preventDoubleTransition = function() { 6763 $('.sticky-element .animate_when_almost_visible').each(function(){ 6764 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 6765 $el.addClass('do_not_reanimate'); 6766 }); 6767 }); 6768}; 6769 6770UNCODE.checkScrollForTabs = function(){ 6771 var goToSection = window.location.hash.replace('#', ''), 6772 $index; 6773 6774 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 6775 goToSection = encodeURIComponent(goToSection); 6776 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 6777 6778 $index.attr('data-parent', 'parent-' + goToSection); 6779 6780 if (window.location.hash != undefined && window.location.hash != '') { 6781 requestTimeout(function() { 6782 scrollBody('parent-' + goToSection); 6783 }, 500); 6784 } 6785 6786 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 6787 var hash = (e.currentTarget).hash, 6788 index = (e.currentTarget).closest('.uncode-tabs'); 6789 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 6790 $('a[href="' + hash + '"][data-tab-history]').click(); 6791 scrollBody(index); 6792 } 6793 }); 6794 6795 var scrollBody = function(index) { 6796 6797 var getSection = $('a[href="' + index + '"][data-tab-history]'), 6798 scrollTo, 6799 safeGap = 27; 6800 6801 if ( ! getSection.length ) { 6802 getSection = $('div[data-parent="' + index + '"]'); 6803 6804 if ( getSection.attr('data-target') == 'row' ) { 6805 getSection = getSection.closest('.vc_row'); 6806 safeGap = 0; 6807 } 6808 } 6809 6810 if (typeof getSection === 'undefined' || ! getSection.length ) { 6811 return; 6812 } 6813 6814 var body = $("html, body"), 6815 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 6816 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 6817 getOffset = UNCODE.get_scroll_offset(); 6818 if ( typeof getSection.offset() === 'undefined' ) 6819 return; 6820 scrollTo = getSection.offset().top - safeGap; 6821 scrollTo -= getOffset; 6822 6823 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 6824 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 6825 6826 if (index != 0) { 6827 UNCODE.scrolling = true; 6828 } 6829 6830 if (scrollSpeed == 0) { 6831 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 6832 UNCODE.scrolling = false;
6833 } else { 6834 body.animate({ 6835 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 6836 }, scrollSpeed, 'easeInOutQuad', function() { 6837 requestTimeout(function() { 6838 UNCODE.scrolling = false; 6839 if (getOffset != UNCODE.get_scroll_offset()) { 6840 scrollBody(index); 6841 } 6842 }, 100); 6843 }); 6844 } 6845 6846 }; 6847}; 6848 6849UNCODE.printScreen = function() { 6850 var inlineMediaStyle = null, 6851 setResize; 6852 6853 function changeMediaStyle() { 6854 clearRequestTimeout(setResize); 6855 setResize = requestTimeout(function(){ 6856 var $head = document.getElementsByTagName('head')[0], 6857 $newStyle = document.createElement('style'), 6858 winW = window.innerWidth, 6859 printH = window.innerHeight; 6860 6861 $newStyle.setAttribute('type', 'text/css'); 6862 $newStyle.setAttribute('media', 'print'); 6863 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 6864 6865 if (inlineMediaStyle != null) { 6866 $head.replaceChild($newStyle, inlineMediaStyle) 6867 } else { 6868 $head.appendChild($newStyle); 6869 } 6870 inlineMediaStyle = $newStyle; 6871 }, 1000); 6872 } 6873 6874 changeMediaStyle(); 6875 window.addEventListener('resize', changeMediaStyle); 6876}; 6877 6878UNCODE.fullPage = function() { 6879 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 6880 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 6881 return false; 6882 } else { 6883 requestTimeout(function() { 6884 window.scrollTo(0, 0); 6885 }, 10); 6886 } 6887 6888 var $masthead = $('#masthead'), 6889 $logo = $('#logo-container-mobile'), 6890 $logolink = $('[data-minheight]', $logo), 6891 logoMinScale = $logolink.data('minheight'), 6892 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 6893 $container = $('.main-container .post-content'), 6894 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 6895 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 6896 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 6897 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 6898 headerWithOpacity = $('.header-scroll-opacity', $header).length, 6899 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 6900 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 6901 scrollBar = true, 6902 effect, 6903 animationEndTimeOut, 6904 fp_anim_time = 900, 6905 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 6906 is_scrolling = false, 6907 dataNames = [], 6908 is_first = true, 6909 no_history = $('body').hasClass('uncode-scroll-no-history'), 6910 theres_footer = true; 6911 6912 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 6913 $('> div', $footer).each(function(index, el){ 6914 if ( $(el).outerHeight() < 2 ) 6915 theres_footer = false; 6916 else 6917 theres_footer = true; 6918 }); 6919 } 6920 6921 if ( !$footer.length ) 6922 theres_footer = false; 6923 6924 if ( !UNCODE.isFullPageSnap ) { 6925 6926 if ( $('body').hasClass('uncode-fullpage-zoom') ) 6927 effect = 'scaleDown'; 6928 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 6929 effect = 'moveparallax'; 6930 else 6931 effect = 'movecurtain'; 6932 } 6933 6934 if ( $('body').hasClass('uncode-fullpage-trid') ) 6935 fp_anim_time = fp_anim_time*2; 6936 6937 if ( $header.length ) { 6938 if ( headerName !== '' ) 6939 $header.attr('data-name', headerName); 6940 if ( headerLabel !== '' ) 6941 $header.attr('data-label', headerLabel); 6942 $container.prepend($header); 6943 } 6944 if ( theres_footer ) { 6945 $container.append($footer); 6946 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 6947 $('aside.widget ul', $footer).addClass('no-list'); 6948 } 6949 6950 var $all = $rows.add($header); 6951 6952 if ( theres_footer ) 6953 $all = $all.add($footer); 6954 6955 $all.each(function(index, row) { 6956 if( index === 0 ) 6957 $(row).addClass('uncode-scroll-active'); 6958 }); 6959 6960 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 6961 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 6962 6963 $all.each(function(index, val) { 6964 var getName = $(val).data('name'), 6965 label; 6966 6967 if (typeof getName == 'undefined' || getName == 'undefined') 6968 getName = SiteParameters.slide_name + '-' + index; 6969 6970 //if ( dataNames.includes(getName) ) { 6971 if ( dataNames.indexOf(getName) > 0 ) { 6972 getName += '_' + index; 6973 $(val).data('name', getName); 6974 } 6975 6976 dataNames.push(getName); 6977 6978 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 6979 6980 if (typeof $(val).attr('data-label') !== 'undefined') 6981 label = $(val).attr('data-label'); 6982 else label = ''; 6983 6984 if ( $(val).is($footer) ) 6985 return; 6986 6987 if (label != '' ) { 6988 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 6989 $('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>"); 6990 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 6991 $('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>"); 6992 } 6993 }); 6994 6995 var checkVisible = function( el, off ) { 6996 if (typeof jQuery === "function" && el instanceof jQuery) { 6997 el = el[0]; 6998 } 6999 7000 off = typeof off=='undefined' ? 50 : off; 7001 7002 var rect = el.getBoundingClientRect(); 7003 7004 return ( 7005 ( 7006 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7007 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 7008 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 7009 ) 7010 ); 7011 }; 7012 7013 var animationEndAction = function( index, nextIndex ) { 7014 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7015 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7016 player, iframe; 7017 7018 if ( !$nextSlide.is($footer) ) { 7019 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 7020 } 7021 7022 if ( !UNCODE.isFullPageSnap ) { 7023 activateKBurns( nextIndex ); 7024 } 7025 7026 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7027 if ($(this).attr('data-provider') == 'vimeo') { 7028 iframe = $(this).find('iframe'); 7029 player = new Vimeo.Player(iframe[0]); 7030 player.pause(); 7031 } else if ($(this).attr('data-provider') == 'youtube') { 7032 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7033 } else { 7034 if ($(this).is('video')) { 7035 $(this)[0].volume = 0; 7036 $(this)[0].pause(); 7037 } 7038 } 7039 }); 7040 7041 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7042 if ( $nextSlide.is($header) ) 7043 $header.removeClass('header-scrolled'); 7044 } 7045 7046 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 7047 $otherEl.each(function(){ 7048 var $otherThis = $(this), 7049 $bgwrapperOther = $('.background-inner', $otherThis); 7050 if ( !checkVisible($otherThis) ) 7051 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 7052 7053 }); 7054 7055 if ( !checkVisible($currentSlide) ) { 7056 $currentSlide.removeClass('uncode-scroll-visible'); 7057 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 7058 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
7059 currentScroll.scrollTo(0, 0, 0); 7060 } 7061 7062 clearRequestTimeout(animationEndTimeOut); 7063 animationEndTimeOut = requestTimeout(function(){ 7064 Waypoint.refreshAll(); 7065 $( document.body ).trigger('uncode_waypoints'); 7066 var eventFP = new CustomEvent('fp-slide-changed'); 7067 window.dispatchEvent(eventFP); 7068 is_scrolling = false; 7069 7070 if ( is_first ) { 7071 $('ul.onepage-pagination a').removeClass('is-selected'); 7072 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7073 is_first = false; 7074 } 7075 7076 }, 500); 7077 }; 7078 7079 var postLeaveActions = function( nextIndex ){ 7080 if ( menuHidden && ! UNCODE.isMobile ) 7081 return false; 7082 7083 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7084 $cols = $('.uncol', $el), 7085 anchor = $el.data('anchor'); 7086 7087 if ( ! UNCODE.isFullPageSnap ) { 7088 $.each($cols, function(index, val){ 7089 if ( $(val).hasClass('style-light') ){ 7090 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7091 return false; 7092 } else if ( $(val).hasClass('style-dark') ) { 7093 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7094 return false; 7095 } 7096 }); 7097 } 7098 7099 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 7100 $('.menu-item' ).removeClass('active'); 7101 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7102 } 7103 7104 if ( !UNCODE.isFullPageSnap ) { 7105 activateBackWash( nextIndex ); 7106 } 7107 }; 7108 7109 var activateBackWash = function( nextIndex ){ 7110 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7111 $bgwrapper; 7112 7113 if ( $el.length ) { 7114 if ( $el.hasClass('with-zoomout') ) { 7115 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7116 } else if ( $('.with-zoomout', $el).length ) { 7117 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 7118 } else { 7119 return false; 7120 } 7121 } else { 7122 return false; 7123 } 7124 7125 $bgwrapper.addClass('uncode-zoomout'); 7126 7127 }; 7128 7129 var activateKBurns = function( nextIndex ){ 7130 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7131 $bgwrapper; 7132 7133 if ( $el.length ) { 7134 if ( $el.hasClass('with-kburns') ) { 7135 $bgwrapper = $('.background-inner:nth-child(1)', $el); 7136 } else if ( $('.with-kburns', $el).length ) { 7137 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 7138 } else { 7139 return false; 7140 } 7141 } else { 7142 return false; 7143 } 7144 7145 $bgwrapper.addClass('uncode-kburns'); 7146 7147 }; 7148 7149 var activateParallax = function( nextIndex, direction ){ 7150 7151 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7152 $cell = $('.fp-tableCell', $el), 7153 animationEnd = 'webkitAnimationEnd animationend', 7154 cellAnim; 7155 7156 switch( direction ) { 7157 case 'up': 7158 cellAnim = 'moveFromTopInner'; 7159 break; 7160 default: 7161 cellAnim = 'moveFromBottomInner'; 7162 } 7163 7164 $cell.css({ 7165 'animation-name': cellAnim, 7166 'animation-duration': fp_anim_time + 'ms', 7167 'animation-delay': '', 7168 'animation-timing-function': fp_easing, 7169 'animation-fill-mode': 'both', 7170 }).off(animationEnd) 7171 .on(animationEnd, function(event) { 7172 if ( event.originalEvent.animationName === cellAnim ) { 7173 $cell 7174 .css({ 7175 'animation-name': '', 7176 'animation-duration': '', 7177 'animation-delay': '', 7178 'animation-timing-function': '', 7179 'animation-fill-mode': '', 7180 }); 7181 } 7182 }); 7183 }; 7184 7185 var scrollHashes = function(){ 7186 var hash = window.location.hash.replace('#', '').split('/'), 7187 hashInd; 7188 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 7189 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 7190 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 7191 $.fn.fullpage.moveTo(hashInd+1); 7192 } 7193 } else if( hash[0] === '' ) { 7194 $.fn.fullpage.moveTo(1); 7195 } 7196 }; 7197 7198 var hideMenu = function( index, nextIndex ){ 7199 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 7200 return false; 7201 7202 var hMenu = UNCODE.menuHeight, 7203 transTime = hMenu * 2; 7204 7205 if ( index === 1 && nextIndex > 1 ) { 7206 hMenu = hMenu * -1; 7207 } else if ( index !== 1 && nextIndex === 1 ) { 7208 hMenu = 0; 7209 } else { 7210 return false;
7211 } 7212 7213 $masthead.css({ 7214 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7215 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 7216 '-webkit-transition': 'transform 0.5s ease-in-out', 7217 'transition': 'transform 0.5s ease-in-out' 7218 }); 7219 }; 7220 7221 var shrinkMenu = function( index, nextIndex ){ 7222 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 7223 return false; 7224 7225 if ( index === 1 && nextIndex > 1 ) { 7226 $logo.addClass('shrinked'); 7227 $('div', $logo).each(function(index, val){ 7228 $(val).css({ 7229 'height': logoMinScale, 7230 'line-height': logoMinScale 7231 }); 7232 if ($(val).hasClass('text-logo')) { 7233 $(val).css({ 7234 'font-size': logoMinScale + 'px' 7235 }); 7236 } 7237 }); 7238 requestTimeout(function() { 7239 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7240 }, 300); 7241 } else if ( index !== 1 && nextIndex === 1 ) { 7242 $logo.removeClass('shrinked'); 7243 $('div', $logo).each(function(index, val){ 7244 $(val).css({ 7245 'height': logoMaxScale, 7246 'line-height': logoMaxScale 7247 }); 7248 if ($(val).hasClass('text-logo')) { 7249 $(val).css({ 7250 'font-size': logoMaxScale + 'px' 7251 }); 7252 } 7253 }); 7254 requestTimeout(function() { 7255 UNCODE.menuMobileHeight = $masthead.outerHeight(); 7256 }, 300); 7257 } else { 7258 return false; 7259 } 7260 7261 }; 7262 7263 var anchorLink = function(){ 7264 7265 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 7266 var $this = $(e.currentTarget), 7267 hash = e.currentTarget.href.split('#'), 7268 current = window.location.href.split('#'), 7269 ind, 7270 currentMenuOpened = UNCODE.menuOpened, 7271 go = false; 7272 7273 var hash_url = hash[0].replace(/\/?$/, '/'), 7274 current_url = current[0].replace(/\/?$/, '/'); 7275 7276 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 7277 hash = '#'+hash[1]; 7278 e.preventDefault(); 7279 go = true; 7280 } 7281 7282 if ( go ) { 7283 7284 if ( $(hash).length ) { 7285 ind = $(hash).closest('.fp-section').index(); 7286 } else { 7287 hash = hash.slice(1); 7288 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 7289 } 7290 7291 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 7292 ind = $this.closest('.fp-section').index(); 7293 7294 UNCODE.menuOpened = false; 7295 7296 $.fn.fullpage.moveTo(ind+1); 7297 7298 UNCODE.menuOpened = currentMenuOpened; 7299 if (UNCODE.menuOpened) { 7300 if (UNCODE.wwidth < UNCODE.mediaQuery) { 7301 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 7302 } else { 7303 $('.mmb-container-overlay .overlay-close').trigger('click'); 7304 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 7305 } 7306 } 7307 7308 } 7309 7310 }); 7311 7312 $('.header-scrolldown').on('click', function(event) { 7313 event.preventDefault(); 7314 var scrollDown = $(this), 7315 ind = scrollDown.closest('.fp-section').index(); 7316 7317 $.fn.fullpage.moveTo(ind+2); 7318 }); 7319 7320 var anchor = $('.fp-section.active').data('anchor'); 7321 7322 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 7323 $('.menu-item').removeClass('active'); 7324 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 7325 } 7326 7327 }; 7328 7329 var slideLeave = function( index, nextIndex, direction ) { 7330 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 7331 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 7332 animationEnd = 'webkitAnimationEnd animationend', 7333 transitionEnd = 'webkitTransitionEnd transitionend', 7334 animOut = effect != 'scaleDown' ? effect + direction : effect, 7335 animIn, 7336 isFooter = false, 7337 isFooterNext = false, 7338 footerH = $footer.outerHeight(), 7339 timeout, 7340 player, iframe, 7341 footerCoeff; 7342 switch( direction ) { 7343 case 'up': 7344 animIn = 'moveFromTop'; 7345 break; 7346 default: 7347 animIn = 'moveFromBottom'; 7348 } 7349 7350 if ( $('body').hasClass('uncode-fullpage-trid') ) { 7351 animOut = animIn + 'trid'; 7352 animIn = animOut + 'In'; 7353 } else if ( UNCODE.isFullPageSnap ) { 7354 animIn = animOut = 'none'; 7355 } 7356 7357 hideMenu(index, nextIndex); 7358 shrinkMenu(index, nextIndex); 7359 7360 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 7361 if ($(this).attr('data-provider') == 'vimeo') { 7362 iframe = $(this).find('iframe'); 7363 player = new Vimeo.Player(iframe[0]); 7364 player.pause(); 7365 } else if ($(this).attr('data-provider') == 'youtube') { 7366 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 7367 } else { 7368 if ($(this).is('video')) { 7369 $(this)[0].volume = 0; 7370 $(this)[0].pause(); 7371 } 7372 } 7373 }); 7374 7375 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 7376 if ($(this).attr('data-provider') == 'vimeo') { 7377 iframe = $(this).find('iframe'); 7378 iframe.on('load', function(){ 7379 player = new Vimeo.Player(iframe); 7380 player.setVolume(0); 7381 player.play(); 7382 }); 7383 player = new Vimeo.Player(iframe); 7384 player.setVolume(0); 7385 player.play(); 7386 } else if ($(this).attr('data-provider') == 'youtube') { 7387 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 7388 } else { 7389 if ($(this).is('video')) { 7390 $(this)[0].volume = 0; 7391 $(this)[0].play(); 7392 } 7393 } 7394 }); 7395 7396 if ( $currentSlide.is($footer) ) 7397 isFooter = true; 7398 7399 if ( $nextSlide.is($footer) ) 7400 isFooterNext = true; 7401 7402 if ( ! UNCODE.isMobile && headerWithOpacity ) { 7403 if ( $currentSlide.is($header) ) 7404 $header.addClass('header-scrolled'); 7405 } 7406 7407 footerCoeff = footerH; 7408 7409 if ( UNCODE.isFullPageSnap ) { 7410 postLeaveActions( nextIndex ); 7411 activateBackWash( nextIndex ); 7412 activateKBurns( nextIndex ); 7413 requestTimeout(function(){ 7414 animationEndAction( index, nextIndex ); 7415 }, fp_anim_time+150); 7416 } else { 7417 if ( isFooterNext ) { 7418 7419 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 7420 $iscrollWrapper.addClass('no-scrolloverflow'); 7421 7422 $nextSlide 7423 .add($currentSlide) 7424 .addClass('uncode-scroll-front') 7425 .addClass('uncode-scroll-active') 7426 .addClass('uncode-scroll-visible'); 7427 $container.css({ 7428 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7429 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 7430 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7431 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7432 }).off(transitionEnd) 7433 .one(transitionEnd, function(){ 7434 animationEndAction( index, nextIndex ); 7435 }); 7436 7437 } else if ( isFooter ) { 7438 7439 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 7440 .add($currentSlide) 7441 .addClass('uncode-scroll-front') 7442 .addClass('uncode-scroll-active') 7443 .addClass('uncode-scroll-visible'); 7444 $container.css({ 7445 '-webkit-transform': 'translate3d(0, 0, 0)', 7446 'transform': 'translate3d(0, 0, 0)', 7447 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7448 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 7449 }) 7450 .one(transitionEnd, function(){ 7451 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 7452 clearRequestTimeout(timeout); 7453 timeout = requestTimeout(function(){ 7454 $.fn.fullpage.moveTo(nextIndex); 7455 slideLeave( index-1, nextIndex, 'up' ); 7456 $container.off(transitionEnd); 7457 }, 50); 7458 } 7459 animationEndAction( index, nextIndex ); 7460 }); 7461 7462 } else { 7463 7464 postLeaveActions( nextIndex ); 7465 7466 if ( !$('body').hasClass('uncode-fullpage-trid') ) 7467 activateParallax( nextIndex, direction ); 7468 7469 var $outBg = $('.background-wrapper', $currentSlide); 7470 7471 $nextSlide 7472 .addClass('uncode-scroll-front') 7473 .addClass('uncode-scroll-active') 7474 .addClass('uncode-scroll-visible') 7475 .addClass('uncode-scroll-animating-in') 7476 .css({ 7477 'z-index':4, 7478 'animation-name': animIn, 7479 'animation-duration': fp_anim_time + 'ms', 7480 'animation-delay': '', 7481 'animation-timing-function': fp_easing, 7482 'animation-fill-mode': 'both', 7483 'transition': 'initial', 7484 }).off(animationEnd) 7485 .on(animationEnd, function(event) { 7486 if ( event.originalEvent.animationName === animIn ) { 7487 $(this) 7488 .addClass('uncode-scroll-already') 7489 .removeClass('uncode-scroll-front') 7490 .removeClass('uncode-scroll-animating-in') 7491 .css({ 7492 'animation-name': '', 7493 'animation-duration': '', 7494 'animation-delay': '', 7495 'animation-timing-function': '', 7496 'animation-fill-mode': '', 7497 'transition': 'initial', 7498 }); 7499 7500 $currentSlide 7501 .removeClass('uncode-scroll-active') 7502 .add($outBg) 7503 .css({ 7504 'animation-name': '', 7505 'animation-duration': '', 7506 'animation-delay': '', 7507 'animation-timing-function': '', 7508 'animation-fill-mode': '', 7509 'transition': 'initial', 7510 }); 7511 7512 animationEndAction( index, nextIndex ); 7513 7514 } 7515 7516 if ( nextIndex > 1 ) 7517 $('body').addClass('window-scrolled'); 7518 else 7519 $('body').removeClass('window-scrolled'); 7520 }); 7521 7522 $currentSlide 7523 .addClass('uncode-scroll-animating-out') 7524 .removeClass('uncode-scroll-front') 7525 .css({ 7526 'z-index':'1', 7527 'animation-name': animOut, 7528 'animation-duration': fp_anim_time + 'ms', 7529 'animation-delay': '', 7530 'animation-timing-function': fp_easing, 7531 'animation-fill-mode': 'both', 7532 'transition': 'initial', 7533 'will-change': 'auto' 7534 }).off(animationEnd) 7535 .on(animationEnd, function(event) { 7536 if ( event.originalEvent.animationName === animOut ) { 7537 $currentSlide.removeClass('uncode-scroll-animating-out'); 7538 } 7539 }); 7540 7541 if ( $('body').hasClass('uncode-fp-opacity') ) { 7542 $currentSlide.find('> div').css({ 7543 'animation-name': 'opacityout', 7544 'animation-duration': fp_anim_time + 'ms', 7545 'animation-delay': '', 7546 'animation-timing-function': fp_easing, 7547 'animation-fill-mode': 'both', 7548 'transition': 'initial', 7549 }).off(animationEnd) 7550 .on(animationEnd, function(event) { 7551 if ( event.originalEvent.animationName === 'opacityout' ) { 7552 $(event.currentTarget).css({ 7553 'animation-name': '', 7554 'animation-duration': '', 7555 'animation-delay': '', 7556 'animation-timing-function': '', 7557 'animation-fill-mode': '', 7558 'transition': '', 7559 }); 7560 } 7561 }); 7562 } 7563 } 7564 } 7565 7566 $('.scroll-top').on('click', function(e){ 7567 $.fn.fullpage.moveTo(1); 7568 return false;
7569 }); 7570 7571 }; 7572 7573 var init_fullPage = function(mode){ 7574 7575 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 7576 // scrollBar = false; 7577 // } 7578 7579 var checkFPeffects; 7580 7581 $container.fullpage({ 7582 sectionSelector: '.uncode-scroll-lock', 7583 scrollOverflow: true, 7584 scrollOverflowOptions: { 7585 click: false, 7586 preventDefaultException: { tagName:/.*/ } 7587 }, 7588 navigation: false, 7589 scrollBar: scrollBar, 7590 scrollingSpeed: fp_anim_time, 7591 verticalCentered: true, 7592 anchors: no_history ? false : dataNames, 7593 recordHistory: !no_history, 7594 afterRender: function(){ 7595 $('body').removeClass('fp-waiting'); 7596 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 7597 var $invisible = $(this).addClass('hidden-scroll');//, 7598 }); 7599 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 7600 var $visible = $(this).addClass('uncode-scroll-visible'), 7601 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 7602 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 7603 }); 7604 7605 $('ul.onepage-pagination a').on('click', function(e){ 7606 e.preventDefault(); 7607 var $a = $(this), 7608 toIndex = $a.data('index'); 7609 7610 $.fn.fullpage.moveTo(toIndex+1); 7611 }); 7612 7613 requestTimeout(function(){ 7614 scrollHashes(); 7615 }, 1000); 7616 7617 $(window).on('hashchange', function(e){ 7618 requestTimeout(function(){ 7619 scrollHashes(); 7620 }, 500); 7621 }); 7622 7623 anchorLink(); 7624 7625 if ( $('body').hasClass('uncode-fp-opacity') ) { 7626 $all.each(function(index, row) { 7627 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 7628 classBg; 7629 7630 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 7631 classBg = testmatch[0]; 7632 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 7633 } 7634 }); 7635 } 7636 7637 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 7638 $(window).on('menuOpen gdprOpen', function(){ 7639 $.fn.fullpage.setAutoScrolling(false); 7640 }).on('menuClose gdprClose', function(){ 7641 $.fn.fullpage.setAutoScrolling(true); 7642 }); 7643 } 7644 7645 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 7646 requestTimeout(function(){ 7647 $.fn.fullpage.setAutoScrolling(false); 7648 }, 1000); 7649 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 7650 $.fn.fullpage.setAutoScrolling(true); 7651 }); 7652 7653 if ( !UNCODE.isFullPageSnap ) { 7654 clearRequestTimeout(checkFPeffects); 7655 checkFPeffects = requestTimeout(function(){ 7656 activateBackWash( 1 ); 7657 activateKBurns( 1 ); 7658 }, 100); 7659 } 7660 7661 }, 7662 onLeave: function( index, nextIndex, direction ){ 7663 7664 if ( UNCODE.menuOpened || is_scrolling ) 7665 return false; 7666 7667 is_scrolling = true; 7668 7669 var event = new CustomEvent('fp-slide-leave'); 7670 window.dispatchEvent(event); 7671 7672 slideLeave( index, nextIndex, direction ); 7673 7674 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 7675 if ( direction === 'up' ) { 7676 $.fn.fullpage.moveTo(nextIndex-1); 7677 } else { 7678 $.fn.fullpage.moveTo(nextIndex+1); 7679 } 7680 return false; 7681 } 7682 7683 $('ul.onepage-pagination a').removeClass('is-selected'); 7684 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 7685 7686 } 7687 }); 7688 }; 7689 7690 init_fullPage(); 7691 $(window).on('load', function(){ 7692 requestTimeout(function(){ 7693 $.fn.fullpage.reBuild(); 7694 }, 3000); 7695 }); 7696 7697 var addScrollingClass, 7698 removeScrollingClass; 7699 7700 window.addEventListener("fp-slide-scroll", function(){ 7701 addScrollingClass = requestTimeout( function(){ 7702 $('body').addClass('fp-slide-scrolling'); 7703 }, 10 ); 7704 7705 clearRequestTimeout(removeScrollingClass); 7706 removeScrollingClass = requestTimeout( function(){ 7707 $('body').removeClass('fp-slide-scrolling'); 7708 }, 150 ); 7709 7710 Waypoint.refreshAll(); 7711 }, false); 7712 7713 var setFPheight = function(){ 7714 var $body = document.body, 7715 $footer = document.getElementById('colophon'), 7716 $maincontainer = document.querySelector('.main-wrapper'), 7717 $boxcontainer = document.querySelector('.box-container'), 7718 $sections = document.querySelectorAll('.fp-section'), 7719 rect = $maincontainer.getBoundingClientRect(), 7720 rect2 = $boxcontainer.getBoundingClientRect(), 7721 $masthead = document.getElementById('masthead'), 7722 _hideMenu = false, 7723 menuHeight = UNCODE.menuHeight; 7724 $body.style.height = UNCODE.wheight + 'px'; 7725 7726 if ( !document.body.classList.contains('vmenu') && document.body.classList.contains('uncode-fp-menu-hide') ) { 7727 _hideMenu = true; 7728 } 7729 if ( $masthead.classList.contains('menu-transparent') || _hideMenu === true ) { 7730 menuHeight = 0 7731 } 7732 7733 7734 if ( theres_footer ) 7735 $footer.style.top = (rect.height || rect2.height) + 'px'; 7736 7737 for (var i = 0; i < $sections.length; i++) { 7738 $sections[i].style.maxHeight = UNCODE.wheight - menuHeight + 'px'; 7739 } 7740 }; 7741 7742 setFPheight(); 7743 7744 window.addEventListener('resize', setFPheight, false); 7745 window.addEventListener('orientationchange', setFPheight, false); 7746 7747}; 7748 7749UNCODE.particles = function() { 7750 $(".vc-particles-background").each(function() { 7751 var $particle = $(this); 7752 var $parent = $particle.closest('[data-parent]'); 7753
7754 $parent.prepend($particle); 7755 // $(window).trigger('resize'); 7756 }) 7757}; 7758 7759 7760UNCODE.filters = function() { 7761 var $systems = $('.isotope-system, .cssgrid-system'); 7762 7763 $systems.each(function(index, val){ 7764 var $system = $(this), 7765 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $system), 7766 $widgets = $('.widgetized-cb-wrapper', $system), 7767 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $system), 7768 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $system), 7769 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $system), 7770 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $system); 7771 7772 if ($system.hasClass('isotope-processed')) { 7773 return; 7774 } 7775 7776 $cats_trigger.on('click', function(e) { 7777 if ( ! $('html').hasClass('screen-sm') ) { 7778 // $widgets.add($sorting_dd).slideUp(400); 7779 e.preventDefault(); 7780 $widgets.slideUp(400, 'easeInOutCirc'); 7781 } 7782 }); 7783 7784 $('.filters-toggle-trigger', $system).on('click', function(e) { 7785 e.preventDefault(); 7786 var $filters = $('.isotope-filters .menu-horizontal', $system); 7787 $filters.slideToggle(400, 'easeInOutCirc'); 7788 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7789 }); 7790 7791 $widget_trgr.on('click', function(e) { 7792 e.preventDefault(); 7793 $widgets.slideToggle(400, 'easeInOutCirc'); 7794 if (!$('html').hasClass('screen-sm')) { 7795 $cats_filters.slideUp(400, 'easeInOutCirc'); 7796 } 7797 window.dispatchEvent(new CustomEvent('boxResized')); 7798 }); 7799 7800 $sorting_trgr.on('click', function(e) { 7801 e.preventDefault(); 7802 if (!$('html').hasClass('screen-sm')) { 7803 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 7804 } 7805 }); 7806 7807 $system.addClass('isotope-processed'); 7808 }); 7809 7810}; 7811 7812UNCODE.widgets = function() { 7813 var widget_collapses = $('.widget-collapse'); 7814 7815 widget_collapses.each(function(){ 7816 var widget_collapse = $(this), 7817 widget_title = widget_collapse.find('.widget-title'), 7818 widget = widget_title.closest('.widget'), 7819 content = widget.children().not('.widget-title'), 7820 setCTA; 7821 7822 if ( widget_collapse.hasClass( 'widget-tablet-collapse-open' ) && UNCODE.wwidth <= UNCODE.mediaQuery && UNCODE.wwidth > UNCODE.mediaQueryMobile ) { 7823 widget_title.toggleClass('open'); 7824 } 7825 7826 widget_title.each(function() { 7827 var _this = $(this); 7828 var content = _this.closest('.widget').find('.widget-collapse-content'); 7829 7830 $(window).on('load resize', function(){ 7831 clearRequestTimeout(setCTA); 7832 setCTA = requestTimeout( function() { 7833 if ( content.is(':visible') ) { 7834 _this.addClass( 'open' ); 7835 } else { 7836 _this.removeClass( 'open' ); 7837 } 7838 }, 10 ); 7839 }) 7840 7841 _this.on( 'click', function(){ 7842 7843 // Get content of :after element (+ icon) to check the visibility 7844 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 7845 7846 if (icon_content === 'none' || !icon_content) { 7847 return false; 7848 } 7849 7850 _this.toggleClass('open'); 7851 var isOpen = _this.hasClass('open'), 7852 hasBorder = _this.closest('.widget-no-separator').length ? 9 : 27; 7853 content.animate({ 7854 height: 'toggle', 7855 padding: 'toggle', 7856 opacity: 'toggle', 7857 top: isOpen ? 0 : hasBorder 7858 }, { 7859 duration: 400, 7860 easing: "easeInOutCirc", 7861 }); 7862 7863 return false; 7864 7865 }); 7866 }); 7867 }); 7868 7869 var $widgets_without_title = $('.collapse-init').removeClass('collapse-init'); 7870}; 7871 7872UNCODE.unmodal = function() { 7873 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 7874 $('.unmodal-overlay').fadeIn(); 7875 $('.unmodal-overlay').addClass('loading'); 7876 $('body').addClass('uncode-unmodal-overlay-visible'); 7877 $(window).trigger('unmodal-open'); 7878 }); 7879 7880 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 7881 $('.unmodal-overlay').fadeOut(); 7882 $('.unmodal').fadeOut(); 7883 $('body').removeClass('uncode-unmodal-overlay-visible'); 7884 $('body').removeClass('uncode-unmodal-open'); 7885 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 7886 $(document).trigger('unmodal-close'); 7887 UNCODE.isUnmodalOpen = false; 7888 }); 7889 7890 $(document).on('uncode-unmodal-show-content', function() { 7891 $('.unmodal-overlay').removeClass('loading'); 7892 $('.unmodal').show(); 7893 $('.unmodal').addClass('show-unmodal-with-animation'); 7894 $('.unmodal-content')[0].scrollTop = 0; 7895 $('body').addClass('uncode-unmodal-open'); 7896 UNCODE.isUnmodalOpen = true; 7897 7898 if ($('body').hasClass('qw-body-scroll-disabled')) { 7899 $('html').addClass('uncode-unmodal-body-disable-scroll'); 7900 } 7901 7902 if ($('.unmodal').hasClass('auto-height')) { 7903 set_modal_height(); 7904 } 7905 }); 7906 7907 var set_modal_height = function() { 7908 var modal = $('.unmodal'); 7909 var window_height = $(window).outerHeight(); 7910 var modal_height = modal.outerHeight(); 7911 7912 modal.css('height', 'auto'); 7913 7914 if (modal_height > window_height) { 7915 modal.outerHeight(window_height); 7916 } 7917 } 7918 7919 if ($('.unmodal').hasClass('auto-height')) { 7920 var setCTA; 7921 7922 $(window).on('resize', function() { 7923 clearRequestTimeout(setCTA); 7924 setCTA = requestTimeout(function() { 7925 set_modal_height(); 7926 }, 100); 7927 }); 7928 } 7929}; 7930 7931UNCODE.bgChanger = function() { 7932 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 7933 $bg_first = $('.vc_row[data-bg-remove]'), 7934 bg_remove = $bg_first.attr('data-bg-remove'), 7935 $first = $bg_changers.first(), 7936 $last = $bg_changers.last(), 7937 $bg_wrapper = $('#changer-back-color'), 7938 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 7939 setCTA, localH = UNCODE.wheight, 7940 isScrolling; 7941 7942 $bg_first.removeClass(bg_remove); 7943 7944 var bgChange = function($col, bgColor, skin, tmbskin){ 7945 $bg_wrapper.attr( 'class', bgColor ); 7946 var menuskin; 7947 if ( typeof skin !== 'undefined' ) { 7948 menuskin = skin.replace('style', 'menu') 7949 } 7950 7951 if ( $col.length ) { 7952 $('.uncol[data-skin-change]').each(function(){ 7953 var $isoFooter = $('.isotope-footer', this); 7954 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 7955 if ( menuskin !== '' ) {
7956 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 7957 } 7958 }); 7959 7960 $('.tmb[data-skin-change]').each(function(){ 7961 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 7962 }); 7963 } 7964 }; 7965 7966 var $masthead = $('#masthead'), 7967 transDesktop, 7968 transMobile, 7969 changeSkin, 7970 7971 checkTransparencyAndChange = function( skin ){ 7972 transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; 7973 transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; 7974 changeSkin = $masthead.hasClass('menu-change-skin'); 7975 7976 if ( ! transDesktop && ! transMobile ) { 7977 return false; 7978 } 7979 7980 if ( ! changeSkin ) { 7981 return false; 7982 } 7983 7984 if ( skin === 'style-light' ){ 7985 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 7986 return false; 7987 } else if ( skin === 'style-dark' ) { 7988 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 7989 return false; 7990 } 7991 }; 7992 7993 var bg_waypoints = function(){ 7994 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 7995 7996 $.each($bg_changers, function(index, row) { 7997 7998 var $row = $(row), 7999 $col = $('.uncol[data-skin-change]', $row).eq(0), 8000 skin, 8001 $tmbs, 8002 tmbskin, 8003 bgColor = $row.attr('data-bg-color'); 8004 8005 if ( ! $row.is(':visible') ) { 8006 return false; 8007 } 8008 8009 if ( $col.length ) { 8010 skin = $col.attr('data-skin-change'); 8011 $tmbs = $('.tmb[data-skin-change]', $row); 8012 tmbskin = skin.replace('style', 'tmb'); 8013 } 8014 8015 if ( ! $row.hasClass('unscroll-horizontal') ) { 8016 $row.waypoint(function( dir ) { 8017 if ( dir === 'down' ) { 8018 bgChange($col, bgColor, skin, tmbskin); 8019 checkTransparencyAndChange(skin); 8020 } else { 8021 return; 8022 } 8023 }, {
8024 offset: '50%' 8025 }); 8026 8027 $row.waypoint(function( dir ) { 8028 if ( dir === 'up' ) { 8029 bgChange($col, bgColor, skin, tmbskin); 8030 checkTransparencyAndChange(skin); 8031 } else { 8032 return; 8033 } 8034 }, { 8035 offset: function() { 8036 var clH = this.element.clientHeight, 8037 wH = window.innerHeight, 8038 ret = clH > 200 ? -100 : clH * -0.5; 8039 return ( wH / 2 ) - clH; 8040 } 8041 }); 8042 } 8043 8044 }); 8045 8046 $('body').addClass('bg-changer-init'); 8047 8048 } 8049 }; 8050 8051 var body = document.body, 8052 edges = false; 8053 8054 var throttle = function(fn, wait) { 8055 var time = Date.now(); 8056 return function() { 8057 if ((time + wait - Date.now()) < 0) { 8058 fn(); 8059 time = Date.now(); 8060 } 8061 } 8062 } 8063 8064 var $wrapper = document.querySelector(".main-wrapper"), 8065 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 8066 8067 var $title = document.querySelector('#rotating'); 8068 if ( $title !== null ) { 8069 $title.style.whiteSpace = 'nowrap'; 8070 $title.style.transition = 'transform 200ms linear'; 8071 } 8072 8073 window.addEventListener( 'scroll', throttle( function() { 8074 window.clearRequestTimeout( isScrolling ); 8075 8076 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 8077 8078 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 8079 body = document.body, 8080 html = document.documentElement, 8081 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8082 $row = false, 8083 firstOff, 8084 lastOff; 8085 8086 if ( scrolled < 100 && $first.length ) { 8087 firstOff = $first.offset().top; 8088 if ( firstOff < 100 ) { 8089 var $row = $first; 8090 } 8091 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) && $last.length ) { 8092 lastOff = $last.offset().top + $last.outerHeight(); 8093 if ( lastOff > ( docH - 100 ) ) { 8094 var $row = $last; 8095 } 8096 } 8097 8098 if ( $row.length ) { 8099 var $col = $('.uncol[data-skin-change]', $row).eq(0), 8100 skin, 8101 $tmbs, 8102 tmbskin, 8103 bgColor = $row.attr('data-bg-color'); 8104 8105 if ( $col.length ) { 8106 skin = $col.attr('data-skin-change'); 8107 $tmbs = $('.tmb[data-skin-change]', $row); 8108 tmbskin = skin.replace('style', 'tmb'); 8109 } 8110 8111 bgChange($col, bgColor, skin, tmbskin); 8112 checkTransparencyAndChange(skin); 8113 edges = true; 8114 } 8115 8116 }, 150); 8117 8118 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 8119 bg_waypoints(); 8120 Waypoint.refreshAll(); 8121 edges = false; 8122 } 8123 8124 }, 100), false); 8125 8126 $(window).on('resize', function() { 8127 clearRequestTimeout(setCTA); 8128 setCTA = requestTimeout(function() { 8129 if ( localH != UNCODE.wheight ) { 8130 localH = UNCODE.wheight; 8131 bg_waypoints(); 8132 Waypoint.refreshAll(); 8133 } 8134 }, 100); 8135 }); 8136 8137 bg_waypoints(); 8138 8139}; 8140 8141UNCODE.skewIt = function() { 8142 8143 if ( $('body').hasClass('compose-mode') ) { 8144 return; 8145 } 8146 8147 var justscrolled = false; 8148 8149 var loadSkewIt = function(){ 8150 8151 var $pageHeader = $('#page-header'), 8152 $page_body = $('.page-body'), 8153 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 8154 8155 if ( $header_skew.length ) { 8156 $pageHeader.addClass('uncode-skew').css({ 8157 position: 'relative', 8158 zIndex: 1 8159 }); 8160 $header_skew.removeClass('uncode-skew'); 8161 $page_body.css({ 8162 position: 'relative', 8163 zIndex: 0 8164 }); 8165 } 8166 8167 var $skew = $('.uncode-skew'), 8168 $horizontal = $skew.hasClass('index-scroll') ? $skew : $skew.closest('.index-scroll'), 8169 horizontal = $horizontal.length, 8170 stopSkewing, 8171 lastOffset = 0, 8172 lastDate = Date.now(); 8173 8174 if ( ! $skew.length ) { 8175 return; 8176 } 8177 8178 var dropSkew = function(){ 8179 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 8180 return; 8181 8182 $skew.each(function(){ 8183 var $this = $(this), 8184 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8185 8186 if ( $drop.length ) { 8187 $this.css({ 8188 'transform': 'skew(0)' 8189 }); 8190 var bound = $this[0].getBoundingClientRect(); 8191 $drop.css({ 8192 left: bound.x * -1, 8193 top: bound.y * -1, 8194 }); 8195 } 8196 }); 8197 }; 8198 dropSkew(); 8199 8200 $(window).on('resize', dropSkew); 8201 8202 window.addEventListener( 'scroll', function() { 8203 8204 if ( justscrolled !== true ) { 8205 justscrolled = true; 8206 return; 8207 } 8208 8209 window.clearRequestTimeout( stopSkewing ); 8210 8211 var now = Date.now(), 8212 delayInMs = now - lastDate, 8213 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8214 newOffset = offset - lastOffset, 8215 speed = Math.pow((newOffset / delayInMs), 3) * -1, 8216 body = document.body, 8217 html = document.documentElement, 8218 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 8219 wait = 50, 8220 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 8221 8222 if ((lastDate + wait - now) < 0) { 8223 8224 lastDate = now; 8225 lastOffset = offset; 8226 8227 if ( speed > 6 ) { 8228 speed = 6; 8229 } else if ( speed < -6 ) { 8230 speed = -6; 8231 } 8232 8233 if ( speed > 2 && offset < UNCODE.wheight ) { 8234 speed = 2; 8235 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 8236 speed = -2; 8237 } 8238 8239 var speedY = speed, 8240 speedX = speed * 1.25; 8241 8242 if ( horizontal ) { 8243 speedY = 0; 8244 if ( $horizontal.hasClass('row-scroll-no-md') && UNCODE.wwidth <= UNCODE.mediaQuery ) { 8245 speedX = 0; 8246 return; 8247 } else if ( $horizontal.hasClass('row-scroll-no-sm') && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 8248 speedX = 0; 8249 return; 8250 } 8251 } else { 8252 speedX = 0; 8253 } 8254 8255 if ( ! $skew.closest('.enter-st').length ) { 8256 speedX = 0; 8257 } 8258 8259 gsap.killTweensOf($skew); 8260 gsap.to( $skew, { 8261 duration: 0.2, 8262 skewY: (speedY * maxSpeed) + "deg", 8263 skewX: (speedX * maxSpeed) + "deg", 8264 ease: Power0.easeNone, 8265 transformOrigin: 'center', 8266 }); 8267 8268 } 8269 8270 stopSkewing = requestTimeout(function() { 8271 gsap.killTweensOf($skew); 8272 gsap.to( $skew, { 8273 duration: 0.5, 8274 skewY: "0deg", 8275 skewX: "0deg", 8276 transformOrigin: 'center', 8277 ease: Expo.easeOut, 8278 }); 8279 8280 $skew.each(function(){ 8281 var $this = $(this), 8282 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 8283 8284 if ( $drop.length ) { 8285 var bound = $this[0].getBoundingClientRect() 8286 $drop.css({ 8287 left: bound.x * -1, 8288 top: bound.y * -1, 8289 }); 8290 } 8291 }); 8292 8293 }, 200); 8294 8295 }, false); 8296 8297 }; 8298 8299 $(window).on('load', loadSkewIt); 8300 8301}; 8302 8303UNCODE.rotateIt = function() { 8304 8305 if ( $('body').hasClass('compose-mode') ) { 8306 return; 8307 } 8308 8309 var loadRotateIt = function(){ 8310 8311 var $toRotate = $('.uncode-rotate'); 8312 8313 $toRotate.each(function(){ 8314 var $rotate = $(this), 8315 deg = 0, 8316 dir = true, 8317 coeff = 1, 8318 lastOffset = 0, 8319 lastDate = Date.now(); 8320 8321 var checkScroll = function($rotate){ 8322 // if ( ! $rotate.length ) { 8323 // return; 8324 // } 8325 8326 var now = Date.now(), 8327 delayInMs = now - lastDate, 8328 offset = window.pageYOffset || window.document.documentElement.scrollTop, 8329 newOffset = offset - lastOffset, 8330 speed = (newOffset / delayInMs) * 5, 8331 body = document.body, 8332 html = document.documentElement, 8333 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 8334 8335 lastDate = now; 8336 lastOffset = offset; 8337 8338 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 8339 deg = 0; 8340 } 8341 8342 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 8343 deg = parseFloat(deg) + parseFloat(speed); 8344 } 8345 8346 if ( $rotate.hasClass('uncode-rotate-hover') ) { 8347 $rotate.hover(function(){ 8348 coeff = 1.75; 8349 }, function(){ 8350 coeff = 1; 8351 }); 8352 } 8353 8354 // if ( speed > 0 ) { 8355 // dir = true 8356 // } else if ( speed < 0 ) { 8357 // dir = false 8358 // } 8359 8360 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 8361 deg = deg+coeff; 8362 // if ( dir ) { 8363 // deg = deg+coeff; 8364 // } else { 8365 // deg = deg-coeff; 8366 // } 8367 } 8368 8369 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 8370 8371 requestAnimationFrame(function() { 8372 checkScroll($rotate); 8373 }); 8374 8375 }; 8376 8377 checkScroll($rotate); 8378 8379 }); 8380 8381 }; 8382 8383 $(window).on('load', loadRotateIt); 8384 8385}; 8386 8387var marqueeAttempts = 0, 8388 marqueeTO; 8389 8390UNCODE.textMarquee = function( $titles ) { 8391 8392 if ( typeof $titles == 'undefined' ) { 8393 $titles = $('.un-text-marquee'); 8394 } 8395 8396 if ( ! $titles.length ) { 8397 return; 8398 } 8399 8400 $titles.each(function(){ 8401 var $title = $(this), 8402 $span = $('> span', $title), 8403 txt, 8404 first = true, 8405 newW = UNCODE.wwidth; 8406 8407 $('.marquee-clone-wrap', $title).remove(); 8408 8409 txt = $title.text(); 8410 8411 if ( ! $('.marquee-original-core', $span).length ) { 8412 $span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 8413 } 8414 8415 var checkResize, 8416 spanW, 8417 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 8418 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 8419 clearSpeed, 8420 speed = 10; 8421 8422 $span.prepend($prepended); 8423 $span.append($appended); 8424 8425 var continuousTextMarquee = function(){ 8426 var bound = $title.css({ 8427 'transform': 'none', 8428 'opacity': 0 8429 }).offset(); 8430 8431 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 8432 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 8433 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 8434 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 8435 8436 var marqueeTL = new TimelineMax({paused:true, reversed:true}); 8437 8438 var inViewElement = $title.closest('.sticky-trigger').length || $title.closest('.pin-spacer').length ? $title.closest('.vc_row')[0] : $title[0]; 8439 8440 var inview = new Waypoint.Inview({ 8441 element: inViewElement, 8442 enter: function(direction) { 8443 marqueeTL.play(); 8444 }, 8445 exited: function(direction) { 8446 marqueeTL.pause(); 8447 } 8448 }); 8449 8450 //gsap.killTweensOf($title);
8451 marqueeTL.fromTo( $title, { 8452 opacity: 1, 8453 x: xStrt 8454 }, 8455 { 8456 duration: xSpeed / UNCODE.wwidth * speed, 8457 x: xEnd * direction, 8458 onComplete: function(){ 8459 first = false; 8460 continuousTextMarquee(); 8461 }, 8462 ease: Linear.easeNone 8463 }); 8464 }; 8465 8466 var runTextMarquee = function(){ 8467 var time = Date.now(); 8468 8469 var textMarqueeScroll = function(){ 8470 var $row = $title.closest('.vc_row'), 8471 $bound = $title.closest('.pin-spacer').length ? $row : $title, 8472 bound = $bound[0].getBoundingClientRect(), 8473 wait = 100, 8474 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1; 8475 8476 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 8477 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 8478 marqueeAttempts < 2 ) { 8479 8480 clearRequestTimeout(marqueeTO); 8481 8482 marqueeTO = requestTimeout(function(){ 8483 marqueeAttempts++; 8484 UNCODE.textMarquee(); 8485 }, 100); 8486 } 8487 8488 //if ((time + wait - Date.now()) < 0) { 8489 //if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) { 8490 // $title[0].style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)'; 8491 gsap.killTweensOf($title); 8492 gsap.to( $title, { 8493 duration: 0.24, 8494 x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction, 8495 //ease: Expo.easeOut, 8496 }); 8497 //} 8498 //time = Date.now(); 8499 //} 8500 }; 8501 8502 textMarqueeScroll(); 8503 $(window).on( 'load scroll', function() { 8504 textMarqueeScroll(); 8505 }); 8506 8507 }; 8508 8509 var cloneSpan = function($_title, cntnt){ 8510 8511 if ( $_title.hasClass('un-marquee-infinite') ) { 8512 $('> span.marquee-clone-wrap', $_title).text(''); 8513 } 8514 8515 gsap.to( $_title, { 8516 duration: 0, 8517 x: 0 8518 }); 8519 spanW = $span.outerWidth(); 8520 8521 if ( !spanW ) { 8522 return; 8523 } 8524 8525 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2; 8526 8527 if ( $_title.hasClass('un-marquee-infinite') ) { 8528 8529 for ( var i = 0; i < part; i++ ) { 8530 $prepended[0].textContent += cntnt + "\u00A0"; 8531 $appended[0].textContent += cntnt + "\u00A0"; 8532 } 8533 } 8534 8535 if ( $('body').hasClass('compose-mode') ) { 8536 return; 8537 } 8538 8539 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 8540 continuousTextMarquee(); 8541 } 8542 8543 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 8544 runTextMarquee(); 8545 } 8546 8547 }; 8548 8549 var marqueResize = function(){ 8550 clearRequestTimeout(checkResize); 8551 checkResize = requestTimeout(function(){ 8552 if ( newW !== UNCODE.wwidth ) { 8553 gsap.killTweensOf($title); 8554 UNCODE.textMarquee(); 8555 newW = UNCODE.wwidth; 8556 } 8557 }, 1000); 8558 }; 8559 8560 $(window).off('resize', marqueResize) 8561 .on( 'resize', marqueResize); 8562 8563 cloneSpan($title, txt); 8564 8565 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8566 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 8567 // imageHover(); 8568 var $_titles = $('.un-text-marquee',e.view.$el); 8569 UNCODE.textMarquee($_titles); 8570 }); 8571 } 8572 }); 8573 8574}; 8575 8576UNCODE.parallax = function() { 8577 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 8578 if ($('.parallax-el').length > 0) { 8579 var parallax_elements = new Rellax('.parallax-el'); 8580 $( document.body ).trigger('uncode_parallax_done', parallax_elements); 8581 window.addEventListener('boxResized', function(e) { 8582 parallax_elements.refresh(); 8583 }, false); 8584 $(window).on('uncode_wc_variation_gallery_loaded', function (event) { 8585 requestTimeout(function() { 8586 parallax_elements.refresh(); 8587 }, 100); 8588 }); 8589 8590 } 8591 } 8592}; 8593 8594UNCODE.magicCursor = function(){ 8595 var $customCursor = $('#uncode-custom-cursor'), 8596 $customPilot = $('#uncode-custom-cursor-pilot'), 8597 $postLists = $('.uncode-post-titles'), 8598 currentCursor = 'auto', 8599 setTime, 8600 isScrolling, 8601 mouseEvent; 8602 8603 function delayChangeCursor(cursorType, delayt_time){ 8604 clearRequestTimeout(setTime); 8605 setTime = requestTimeout(function() { 8606 $customCursor.attr('data-cursor', cursorType); 8607 if ( $customPilot.length ) { 8608 $customPilot.attr('data-cursor', cursorType); 8609 }
8610 currentCursor = cursorType; 8611 }, delayt_time); 8612 } 8613 8614 function changeCursor($wrap){ 8615 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 8616 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href], a[data-lbox]', 8617 $href = $wrap.find(href), 8618 cursorType, 8619 setTime, set_delay; 8620 8621 $href.hover(function(e) { 8622 var $this = $(this), 8623 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 8624 is_frontend_editor = $this.closest('.vc_controls').length, 8625 hasSrcOrClck = $('[src]', $this).length || $('.t-background-cover', $this).length || $this.closest('.tmb-click-row').length, 8626 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 8627 if ( is_frontend_editor ) { 8628 cursorType = 'auto'; 8629 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 8630 cursorType = data_cursor; 8631 } else if ( $parent_cursor.length ) { 8632 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 8633 cursorType = 'icon-light'; 8634 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 8635 cursorType = 'icon-diff'; 8636 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 8637 cursorType = 'icon-accent'; 8638 } else { 8639 cursorType = 'icon-dark'; 8640 } 8641 } else { 8642 cursorType = 'pointer'; 8643 } 8644 delayChangeCursor(cursorType, 0); 8645 }, function(){ 8646 delayChangeCursor('auto', 150); 8647 }); 8648 8649 $(window).on('disable-hover', function(event) { 8650 document.addEventListener("mousemove", function(e) { 8651 mouseEvent = e; 8652 }); 8653 delayChangeCursor('auto', 0); 8654 }); 8655 8656 $(window).on('enable-hover', function(event) { 8657 if ( typeof mouseEvent !== 'undefined' ) { 8658 var x = mouseEvent.clientX, 8659 y = mouseEvent.clientY; 8660 8661 var elements = document.elementsFromPoint(x, y), 8662 $element = $(elements[0]); 8663 8664 $element.closest(href).trigger('mouseenter'); 8665 } 8666 }); 8667 8668 } 8669 8670 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8671 changeCursor(); 8672 }); 8673 8674 $(document).ajaxComplete(function( event, xhr, settings ) { 8675 changeCursor(); 8676 }); 8677 8678 $('.isotope-container').on('isotope-layout-complete', function() { 8679 var $this = $(this); 8680 changeCursor($this); 8681 }); 8682 8683}; 8684 8685UNCODE.magneticCursor = function(){ 8686 function magneticCursor($wrap){ 8687 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 8688 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')); 8689 8690 $magnetics.on('mousemove', function(e){ 8691 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 8692 bound = e.currentTarget.getBoundingClientRect(), 8693 coeff = 30, 8694 hor = (bound.width / 2) - (e.clientX - bound.left), 8695 ver = (bound.height / 2) - (e.clientY - bound.top), 8696 toX = hor / bound.width * coeff, 8697 toY = ver / bound.height * coeff, 8698 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 8699 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 8700 toScale = Math.max(scaleX, scaleY); 8701 8702 gsap.killTweensOf($el); 8703 gsap.to( $el, { 8704 duration: 0.75, 8705 x: toX, 8706 y: toY, 8707 scale: toScale, 8708 ease: Power1.easeOut, 8709 transformPerspective: 900, 8710 transformOrigin: 'center', 8711 force3D: true 8712 }); 8713 }).on('mouseout', function(e){ 8714 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 8715 gsap.killTweensOf($el); 8716 gsap.to( $el, { 8717 duration: 0.6, 8718 y: 0, 8719 x: 0, 8720 scale: 1, 8721 ease: Power1.easeOut, 8722 transformPerspective: 900, 8723 transformOrigin: 'center', 8724 force3D: true 8725 }); 8726 }); 8727 }; 8728 8729 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 8730 magneticCursor(); 8731 }); 8732 8733 $(document).ajaxComplete(function( event, xhr, settings ) { 8734 magneticCursor(); 8735 }); 8736 8737 $('.isotope-container').on('isotope-layout-complete', function() { 8738 var $this = $(this); 8739 magneticCursor($this); 8740 }); 8741 8742}; 8743 8744UNCODE.dropImage = function() { 8745 8746 /**************************** 8747 * Image hover * 8748 ****************************/ 8749 function imageHover(){ 8750 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 8751 return; 8752 } 8753 8754 var $postLists = $('.uncode-post-titles'); 8755 $postLists.each(function(){ 8756 var $list = $(this), 8757 timing = parseFloat( $list.attr('data-timing') ), 8758 default_image = $list.hasClass('uncode-post-titles-default-image'), 8759 default_title = $list.hasClass('uncode-post-titles-default-title'), 8760 $tmbs = $('.tmb', $list), 8761 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 8762 clientX, 8763 clientY, 8764 $row_parent = $list.closest('.vc_row'), 8765 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 8766 $col_parent = $list.closest('.uncell'), 8767 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 8768 setCTA; 8769 8770 timing *= 0.001; 8771 8772 var drop_bgs = function(){ 8773 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 8774 var $drop = $(this), 8775 srcset = $drop.attr('data-bgset'), 8776 setArr = srcset.split(","), 8777 setArrOrder = [], 8778 biggest = 0, 8779 checkBg = false;
8780 8781 if ( SiteParameters.uncode_adaptive == true ) { 8782 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 8783 $drop.css({ 8784 'background-image' : 'url(' + setArr[0] + ')' 8785 }); 8786 } 8787 } else { 8788 for ( var i = 0; i < setArr.length; i++ ) { 8789 var setLoop = setArr[i].trim().split(" "); 8790 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 8791 var parseSet = parseFloat(setLoop[1]); 8792 if ( biggest < parseSet ) { 8793 biggest = parseSet; 8794 } 8795 setArrOrder[parseSet] = setLoop[0]; 8796 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 8797 checkBg = true; 8798 $drop.css({ 8799 'background-image' : 'url(' + setLoop[0] + ')' 8800 }); 8801 } 8802 } 8803 } 8804 8805 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 8806 $drop.css({ 8807 'background-image' : 'url(' + setArrOrder[biggest] + ')' 8808 }); 8809 } 8810 } 8811 8812 }); 8813 }; 8814 8815 drop_bgs(); 8816 8817 var dropMovesSize = function(){ 8818 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 8819 return; 8820 } 8821 $drop_moves.each(function(){ 8822 var $drop_move = $(this), 8823 dataW = $drop_move.attr('data-w'), 8824 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 8825 if ( typeof dataW !== 'undefined' && dataW !== null ) { 8826 dataW = screenInfo.width / 12 * parseFloat( dataW ); 8827 } 8828 $drop_moves.css({ 8829 width: dataW 8830 }); 8831 8832 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 8833 $anim_parent.on('animationend', function(){ 8834 var bound = $anim_parent[0].getBoundingClientRect(); 8835 $drop_move.css({ 8836 left: bound.x * -1, 8837 top: bound.y * -1, 8838 }); 8839 }); 8840 } 8841 }); 8842 8843 8844 }; 8845 8846 dropMovesSize(); 8847 8848 $(window).on( 'resize', function(){ 8849 clearRequestTimeout(setCTA); 8850 setCTA = requestTimeout( function() { 8851 drop_bgs(); 8852 dropMovesSize(); 8853 }, 100 ); 8854 }); 8855 8856 if ( $drop_row_parents.length ) { 8857 $row_parent.addClass( 'drop-added' ); 8858 } 8859 8860 $drop_row_parents.each(function(index, val){ 8861 var $drop = $(val); 8862 $row_parent.prepend($drop); 8863 manageVideos($drop, false); 8864 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8865 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8866 } 8867 if ( default_image && index == 0 ) { 8868 manageVideos($drop, true); 8869 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8870 image_ph = new Image(); 8871 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8872 image_ph.onload = function() { 8873 $drop.addClass('active'); 8874 if ( default_title ) { 8875 $list.addClass('drop-hover'); 8876 $tmbs.first().addClass('drop-active'); 8877 } 8878 }; 8879 image_ph.src = bg_img; 8880 } 8881 } 8882 }); 8883 8884 if ( $drop_col_parents.length ) { 8885 $col_parent.addClass( 'drop-added' ); 8886 } 8887 8888 $drop_col_parents.each(function(index, val){ 8889 var $drop = $(this); 8890 $col_parent.prepend($drop); 8891 manageVideos($drop, false); 8892 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 8893 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 8894 } 8895 if ( default_image && index == 0 ) { 8896 manageVideos($drop, true); 8897 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 8898 image_ph = new Image(); 8899 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 8900 image_ph.onload = function() { 8901 $drop.addClass('active'); 8902 if ( default_title ) { 8903 $list.addClass('drop-hover'); 8904 $tmbs.first().addClass('drop-active'); 8905 } 8906 }; 8907 image_ph.src = bg_img; 8908 } 8909 } 8910 }); 8911 8912 function manageVideos( $el, start ) { 8913 var videoElem = $('video', $el), 8914 $iframe = $('iframe', $el), 8915 iframeID = $iframe.attr('id'); 8916 if ( videoElem.length ) { 8917 if ( Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 8918 if ( start ) { 8919 videoElem[0].setCurrentTime(0); 8920 videoElem[0].play(); 8921 } else { 8922 videoElem[0].pause(); 8923 videoElem[0].setCurrentTime(0); 8924 } 8925 } else { 8926 if ( start ) { 8927 videoElem[0].currentTime = 0; 8928 videoElem[0].play(); 8929 } else { 8930 videoElem[0].pause(); 8931 videoElem[0].currentTime = 0; 8932 } 8933 } 8934 } 8935 8936 $el.data('active', start); 8937 8938 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 8939 var iframeIDv = iframeID.replace('okplayer-', ''), 8940 optionsV = $(window).data('okoptions-' + iframeIDv), 8941 vimeo = $iframe[0], 8942 playerV = new Vimeo.Player(vimeo), 8943 timeV = 0; 8944 8945 if (optionsV.time != null) { 8946 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 8947 for ( var i = 0; i < timeArr.length; i++ ) { 8948 if ( timeArr[i] === 'h' ) { 8949 timeV += parseFloat(timeArr[i-1]) * 3600; 8950 } else if ( timeArr[i] === 'm' ) { 8951 timeV += parseFloat(timeArr[i-1]) * 60; 8952 } else if ( timeArr[i] === 's' ) { 8953 timeV += parseFloat(timeArr[i-1]); 8954 } 8955 } 8956 } 8957 playerV.setCurrentTime(timeV); 8958 if ( start ) { 8959 playerV.setVolume(0); 8960 playerV.play(); 8961 } else { 8962 playerV.pause(); 8963 } 8964 } else if ( $el.attr('data-provider') === 'youtube' ) { 8965 if ( start ) { 8966 $el.trigger('uncode-resume'); 8967 } else { 8968 $el.trigger('uncode-pause'); 8969 } 8970 } 8971 8972 } 8973 8974 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 8975 8976 document.addEventListener("mousemove", function(e) { 8977 $drop_moves.each(function(){ 8978 var $drop_move = $(this), 8979 duration = 0.4; 8980 8981 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 8982 duration = 0.8; 8983 } 8984 8985 clientX = e.clientX; 8986 clientY = e.clientY; 8987 8988 gsap.to( $drop_move, { 8989 duration: duration, 8990 x: clientX, 8991 y: clientY, 8992 ease: Power1.easeOut, 8993 }); 8994 }); 8995 }); 8996 8997 } else { 8998 8999 $(window).on("touchend scroll", function(e) { 9000 $list.removeClass('drop-hover'); 9001 $drop_moves.removeClass('active'); 9002 $tmbs.removeClass('drop-active'); 9003 }); 9004 9005 $drop_moves.each(function(){ 9006 var $drop_move = $(this), 9007 $tmb = $drop_move.closest('.tmb'), 9008 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 9009 9010 if ( $anim_parent.hasClass('uncode-skew') ) { 9011 $anim_parent.css({ 9012 'transform': 'skew(0)' 9013 }); 9014 } 9015 9016 $tmb.on('touchend', function(e){ 9017 e.stopPropagation(); 9018 9019 $drop_moves.removeClass('active'); 9020 $tmbs.removeClass('drop-active'); 9021 9022 $list.addClass('drop-hover'); 9023 $tmb.addClass('drop-active'); 9024 $drop_move.addClass('active'); 9025 manageVideos($drop_move, true); 9026 clientX = e.changedTouches[0].clientX; 9027 clientY = e.changedTouches[0].clientY; 9028 9029 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9030 var bound = $anim_parent[0].getBoundingClientRect(); 9031 clientX = clientX - bound.x; 9032 clientY = clientY - bound.y; 9033 } 9034 9035 $drop_move.css({ 9036 left: clientX, 9037 top: clientY 9038 }); 9039 }); 9040 }); 9041 9042 } 9043 9044 $tmbs.each(function(e){ 9045 var $tmb = $(this), 9046 // $trgr = $('a', $tmb), 9047 $trgr = $tmb, 9048 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 9049 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
9049(.t-inside), .parallax-el'), 9050 $video = $('video', $tmb), 9051 $iframe = $('iframe', $tmb), 9052 $entryTxt = $('.t-entry-text', $tmb), 9053 stopBounding; 9054 9055 $entryTxt.add($drop_move).css({ 9056 'transition-duration': timing + 's' 9057 }); 9058 9059 if ( $video.length ) { 9060 var vidH = $video[0].videoHeight, 9061 vidW = $video[0].videoWidth; 9062 $video.css({ 9063 'height': vidH, 9064 'width': vidW 9065 }); 9066 } 9067 9068 if ( $iframe.length ) { 9069 var vidH = $drop_move.attr('data-height'), 9070 vidW = $drop_move.attr('data-width'); 9071 $iframe.css({ 9072 'height': vidH, 9073 'width': vidW 9074 }); 9075 } 9076 9077 $iframe.each(function(){ 9078 var $video = $(this), 9079 vidH = $video[0].videoHeight, 9080 vidW = $video[0].videoWidth; 9081 $video.css({ 9082 'height': vidH, 9083 'width': vidW 9084 }); 9085 }); 9086 9087 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 9088 $trgr.on('mouseenter',function(e){ 9089 $list.addClass('drop-hover'); 9090 $tmbs.removeClass('drop-active'); 9091 $tmb.addClass('drop-active'); 9092 $drop_move.addClass('active'); 9093 manageVideos($drop_move, true); 9094 9095 var clientX = e.clientX, 9096 clientY = e.clientY; 9097 $drop_move.css({ 9098 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 9099 }); 9100 9101 }) 9102 .on('mouseleave', function(e){ 9103 $list.removeClass('drop-hover'); 9104 $drop_move.css({ 9105 'transition-duration': ( timing*1.25 ) + 's' 9106 }); 9107 $drop_move.removeClass('active'); 9108 $tmb.removeClass('drop-active'); 9109 $drop_move.on('transitionend', function(e){ 9110 $drop_move.off('transitionend'); 9111 $drop_move.css({ 9112 'transition-duration': timing + 's' 9113 }); 9114 manageVideos($drop_move,false); 9115 }); 9116 }); 9117 9118 document.addEventListener('visibilitychange', function(){ 9119 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 9120 $drop_move.css({ 9121 'transition-duration': '0s' 9122 }); 9123 $drop_move.removeClass('active'); 9124 manageVideos($drop_move, false); 9125 } 9126 }); 9127 9128 document.addEventListener('scroll', function(){ 9129 window.clearRequestTimeout( stopBounding ); 9130 9131 if ( $drop_move.hasClass('active') ) { 9132 $list.removeClass('drop-hover'); 9133 $tmbs.removeClass('drop-active'); 9134 $drop_move.removeClass('active'); 9135 $drop_move.on('transitionend', function(e){ 9136 $drop_move.off('transitionend'); 9137 $drop_move.css({ 9138 'transition-duration': timing + 's' 9139 }); 9140 manageVideos($drop_move,false); 9141 }); 9142 } 9143 9144 stopBounding = requestTimeout(function() { 9145 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 9146 var bound = $anim_parent[0].getBoundingClientRect(); 9147 $drop_move.css({ 9148 left: bound.x * -1, 9149 top: bound.y * -1, 9150 }); 9151 } 9152 }, 200); 9153 9154 }); 9155 } 9156 9157 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 9158 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 9159 9160 $drop.css({ 9161 'transition-duration': timing + 's' 9162 }); 9163 9164 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 9165 $trgr.on('mouseenter',function(e){ 9166 $row_parent.add($col_parent).addClass('drop-list-loaded'); 9167 $list.addClass('drop-hover'); 9168 9169 if ( !$tmb.hasClass('drop-active') ) { 9170 $tmbs.removeClass('drop-active'); 9171 $tmb.addClass('drop-active'); 9172 if ( default_image && !$drop.hasClass('active') ) { 9173 var $prev = $('[data-drop].active', $row_parent); 9174 $prev.css({ 9175 'transition-duration': (timing*1.5) + 's' 9176 }); 9177 $prev.removeClass('active'); 9178 $prev.on('transitionend', function(e){ 9179 $prev.off('transitionend'); 9180 manageVideos($prev,false); 9181 }); 9182 } 9183 $drop.css({ 9184 'transition-duration': timing + 's' 9185 }); 9186 $drop.off('transitionend'); 9187 $drop.addClass('active'); 9188 manageVideos($drop, true); 9189 } 9190 }) 9191 .on('mouseleave', function(e){ 9192 if ( ( default_image && !default_title ) || !default_image ) { 9193 $list.removeClass('drop-hover'); 9194 $tmb.removeClass('drop-active'); 9195 } 9196 if ( ! default_image ) { 9197 $drop.css({ 9198 'transition-duration': (timing*1.5) + 's' 9199 }); 9200 $drop.removeClass('active'); 9201 9202 $drop.on('transitionend', function(e){ 9203 $drop.off('transitionend'); 9204 manageVideos($drop,false); 9205 }); 9206 } 9207 }); 9208 9209 document.addEventListener('visibilitychange', function(){ 9210 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 9211 $drop.css({ 9212 'transition-duration': '0s' 9213 }); 9214 $drop.removeClass('active'); 9215 manageVideos($drop, false); 9216 } 9217 }); 9218 } 9219 }); 9220 9221 }); 9222 }; 9223 9224 $(window).on('load', function(event) { 9225 imageHover(); 9226 }); 9227 9228 var drop_wp_animation = function() { 9229 var $postLists = $('.uncode-post-titles'); 9230 $postLists.each(function(){ 9231 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 9232 new Waypoint({ 9233 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9234 element: val, 9235 handler: function() { 9236 var element = $(this.element), 9237 parent = element.closest('.tmb'), 9238 currentIndex = parent.index(),
9239 delay = currentIndex, 9240 delayAttr = parseInt(element.attr('data-delay')); 9241 if (isNaN(delayAttr)) delayAttr = 100; 9242 var objTimeout = requestTimeout(function() { 9243 element.addClass('start_animation'); 9244 9245 var nextTimeout = requestTimeout(function() { 9246 $('.drop-image-separator', parent).addClass('start_animation'); 9247 }, 50); 9248 9249 }, delay * delayAttr); 9250 if (!UNCODE.isUnmodalOpen) { 9251 this.destroy(); 9252 } 9253 }, 9254 offset: UNCODE.isFullPage ? '100%' : '90%' 9255 }) 9256 }); 9257 }); 9258 } 9259 9260 var runWaypoints_TO, 9261 runWaypoints_delay = 0; 9262 9263 var runWaypoints = function(){ 9264 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 9265 runWaypoints_delay = 400; 9266 } 9267 clearRequestTimeout(runWaypoints_TO); 9268 runWaypoints_TO = requestTimeout(function() { 9269 drop_wp_animation(); 9270 }, runWaypoints_delay); 9271 }; 9272 runWaypoints(); 9273 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 9274 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9275 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 9276 // imageHover(); 9277 runWaypoints(); 9278 }); 9279 } 9280}; 9281 9282UNCODE.postTable = function() { 9283 9284 var clickRow = function(){ 9285 var $postLists = $('.uncode-post-table'); 9286 9287 $postLists.each(function(){ 9288 var $postList = $(this), 9289 $tmbClicks = $('.tmb.tmb-click-row', $postList); 9290 9291 $tmbClicks.each(function(){ 9292 var $tmb = $(this), 9293 $click = $('.table-click-row', $tmb); 9294 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 9295 e.preventDefault(); 9296 e.stopPropagation(); 9297 $click[0].click(); 9298 return false; 9299 }); 9300 }); 9301 9302 }) 9303 }; 9304 9305 clickRow(); 9306 9307 var hoverRow = function(){ 9308 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 9309 9310 $postLists.on('mouseenter', function(){ 9311 $(this).addClass('post-table-hover'); 9312 }); 9313 $postLists.on('mouseleave', function(){ 9314 $(this).removeClass('post-table-hover'); 9315 }); 9316 } 9317 9318 hoverRow(); 9319 9320 var drop_wp_animation = function() { 9321 var $postLists = $('.uncode-post-table'); 9322 $postLists.each(function(){ 9323 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 9324 new Waypoint({ 9325 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9326 element: val, 9327 handler: function() { 9328 var element = $(this.element), 9329 parent = element.closest('.tmb'), 9330 currentIndex = parent.index(), 9331 delay = currentIndex, 9332 delayAttr = parseInt(element.attr('data-delay')); 9333 if (isNaN(delayAttr)) delayAttr = 100; 9334 var objTimeout = requestTimeout(function() { 9335 element.addClass('start_animation'); 9336 }, delay * delayAttr); 9337 if (!UNCODE.isUnmodalOpen) { 9338 this.destroy(); 9339 } 9340 }, 9341 offset: UNCODE.isFullPage ? '100%' : '90%' 9342 }) 9343 }); 9344 }); 9345 } 9346 9347 var runWaypoints_TO, 9348 runWaypoints_delay = 0; 9349 9350 var runWaypoints = function(){ 9351 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 9352 runWaypoints_delay = 400; 9353 } 9354 clearRequestTimeout(runWaypoints_TO); 9355 runWaypoints_TO = requestTimeout(function() { 9356 drop_wp_animation(); 9357 }, runWaypoints_delay); 9358 }; 9359 runWaypoints(); 9360 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 9361 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9362 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 9363 runWaypoints(); 9364 // clickRow(); 9365 }); 9366 } 9367}; 9368 9369UNCODE.rotatingTxt = function($ctxt) { 9370 9371 if ( $('body').hasClass('compose-mode') ) { 9372 return; 9373 } 9374 9375 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 9376 var setCTA; 9377 9378 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 9379 var $heading = $(this), 9380 // debug = 0, 9381 cycle = 0, 9382 $trgt, 9383 $toMove, 9384 $highl, 9385 $col = $heading.closest('.uncont'), 9386 txt, 9387 arrTxt, 9388 textFadeIn, textFadeOut, 9389 removeWraps; 9390 9391 var defineObjs = function() { 9392 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 9393 var $rtx = $(this), 9394 fx = $rtx.attr('data-fx'), 9395 wait = $rtx.attr('data-wait'), 9396 $prev = $(this).prev().addClass('prev-rotating-start'), 9397 splitToMove = [], 9398 splitArray = [], 9399 lineArray = [], 9400 lineIndex = 0, 9401 lineStart = true, 9402 lineEnd = false, 9403 startSplit = false, 9404 $line_wrap = $rtx.closest('.heading-line-wrap'), 9405 same_line = true, 9406 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 9407 indexRtx = $splits.index($rtx); 9408 9409 fx = typeof fx === 'undefined' ? '' : fx;
9410 wait = typeof wait === 'undefined' ? '' : wait; 9411 9412 $splits.each(function(key, val){ 9413 var $split = $(this), 9414 $new_line_wrap = $split.closest('.heading-line-wrap'); 9415 9416 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 9417 splitArray.push( $split ); 9418 } 9419 9420 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 9421 startSplit = false; 9422 } 9423 9424 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 9425 splitArray.push( $split ); 9426 9427 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 9428 same_line = true; 9429 } else { 9430 same_line = false; 9431 } 9432 } 9433 9434 if ( key == indexRtx ) { 9435 if ( /\S/.test($split.text()) ) { 9436 startSplit = true; 9437 $line_wrap = $split.closest('.heading-line-wrap'); 9438 splitArray.push( $split ); 9439 } else { 9440 indexRtx++; 9441 } 9442 } 9443 9444 $line_wrap = $new_line_wrap; 9445 }); 9446 9447 $toMove = $($.map(splitToMove, function(el){return el.get();})); 9448 $trgt = $($.map(splitArray, function(el){return el.get();})); 9449 9450 if ( same_line ) { 9451 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 9452 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 9453 } 9454 9455 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 9456 $prev.addClass('empty-span-hidden'); 9457 } 9458 9459 $highl = $('.heading-text-highlight-inner', $trgt); 9460 9461 $rtx.attr('data-animated', 'true'); 9462 if ( cycle == 0 ) { 9463 $( document.body ).trigger('defer-highlights'); 9464 cycle++; 9465 defineObjs(); 9466 return; 9467 } 9468 cycle++; 9469 9470 txt = $rtx.attr('data-text'); 9471 arrTxt = txt.split("|"); 9472 9473 textFadeOut($trgt); 9474 9475 }); 9476 }; 9477 9478 removeWraps = function(){ 9479 9480 // if ( debug == 1 ) return; 9481 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 9482 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 9483 9484 9485 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 9486 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 9487 9488 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 9489 9490 $splitFlow.each(function(){ 9491 $(this).append($temp_highl); 9492 }); 9493 9494 var $line_wrap = $wraps[wrap_k]; 9495 var $parent_wrap = $line_wrap.parentNode; 9496 if ( $parent_wrap !== null ) { 9497 while ( $line_wrap.firstChild ) { 9498 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 9499 } 9500 $parent_wrap.removeChild($line_wrap); 9501 } 9502 } 9503 // debug++; 9504 defineObjs(); 9505 }; 9506 9507 var loop = 0; 9508 textFadeIn = function($trgt){ 9509 var word = arrTxt[loop].split(" "), 9510 worsSpan = '', 9511 $wrap = $trgt.closest('.uncode-rotating-wrap'), 9512 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 9513 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 9514 9515 for (var w = 0; w < word.length; w++) { 9516 var highl; 9517 if ( $highl.length ) { 9518 highl = $highl[0].outerHTML; 9519 } else { 9520 highl = ''; 9521 } 9522 9523 if ( w > 0 ) { 9524 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 9525 } 9526 var charachters = word[w].split(''); 9527 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 9528 for (var c = 0; c < charachters.length; c++) { 9529 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 9530 } 9531 worsSpan += '</span>' + highl + '</span></span>'; 9532 } 9533 9534 if ( $wrap.length && $wrap_inner.length ) { 9535 var words_w = $wrap_inner.outerWidth(); 9536 $wrap.css({ 9537 width: words_w 9538 }); 9539 9540 $highl = $('.heading-text-highlight-inner', $wrap); 9541 $highl.prependTo($wrap); 9542 9543 $wrap_inner.css({ 9544 opacity: 0 9545 }); 9546 9547 $wrap_inner.html(worsSpan); 9548 $('.heading-text-highlight-inner', $wrap_inner).remove(); 9549 words_w = $wrap_inner.innerWidth(); 9550 9551 var duration = 0.45; 9552 9553 $heading.removeClass('auto-width'); 9554 if ( words_w > $col.width() ) { 9555 $heading.addClass('auto-width'); 9556 words_w = 'auto'; 9557 duration = 0; 9558 } 9559 9560 $wrap.css({ 9561 'width': words_w, 9562 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 9563 }); 9564 9565 var $word_inner = $('.split-word-inner', $wrap_inner), 9566 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 9567 9568 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 9569 9570 if ( !$target_fx.length ) { 9571 return; 9572 } 9573 9574 gsap.killTweensOf($target_fx); 9575 9576 if ( fx !== 'zoom' ) { 9577 gsap.fromTo( $target_fx, { 9578 y: fx === 'opacity' ? '0%' : '-10%' 9579 },{ 9580 delay: duration, 9581 duration: 0.25, 9582 y: '0%', 9583 ease: Circ.easeOut, 9584 }); 9585 9586 if ( !$wrap_inner.length ) { 9587 return; 9588 } 9589 9590 gsap.fromTo( $wrap_inner, { 9591 opacity: 0, 9592 },{ 9593 delay: duration, 9594 duration: 0.25, 9595 opacity: 1, 9596 ease: Circ.easeOut, 9597 onComplete: function(){ 9598 $('> .heading-text-highlight-inner', $wrap).remove(); 9599 $wrap_inner.html(worsSpan); 9600 removeWraps(); 9601 } 9602 }) 9603 9604 } else { 9605 gsap.fromTo( $target_fx, { 9606 transformOrigin: '50%', 9607 opacity: 0, 9608 scale: 0.875, 9609 },{ 9610 opacity: 1, 9611 delay: duration, 9612 duration: 0.25, 9613 scale: 1, 9614 ease: Circ.easeOut, 9615 onComplete: function(){ 9616 $('> .heading-text-highlight-inner', $wrap).remove(); 9617 $wrap_inner.html(worsSpan); 9618 removeWraps(); 9619 } 9620 }); 9621 } 9622 9623 } else { 9624 9625 if ( !$wrap_inner.length ) { 9626 return; 9627 } 9628 9629 gsap.to( $wrap_inner, { 9630 duration: 0.4, 9631 opacity: 0, 9632 ease: Power1.easeOut, 9633 onComplete: function(){ 9634 $wrap_inner.html(worsSpan); 9635 words_w = $wrap_inner.innerWidth(); 9636 9637 gsap.to( $wrap_inner, { 9638 duration: 0.2, 9639 opacity: 1, 9640 ease: Power1.easeOut, 9641 onComplete: function(){ 9642 $('> .heading-text-highlight-inner', $wrap).remove(); 9643 $wrap_inner.html(worsSpan); 9644 removeWraps(); 9645 } 9646 }) 9647 } 9648 }); 9649 } 9650 9651 if ( loop < arrTxt.length-1 ) { 9652 loop++; 9653 } else { 9654 loop = 0; 9655 } 9656 9657 }; 9658 9659 textFadeOut = function($trgt){ 9660 var $word_inner = $('.split-word-inner', $trgt), 9661 $wrap = $trgt.closest('.uncode-rotating-wrap'), 9662 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 9663 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 9664 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 9665 9666 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 9667 9668 var gsap_param = { 9669 delay: wait, 9670 duration: 0.25, 9671 y: fx === '' ? '10%' : '0%', 9672 opacity: 0, 9673 ease: Circ.easeOut, 9674 onStart: function(){ 9675 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 9676 $highl = $('.heading-text-highlight-inner', $wrap); 9677 $highl.prependTo($wrap); 9678 } 9679 }, 9680 onComplete: textFadeIn, 9681 onCompleteParams: [$trgt] 9682 }; 9683 9684 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 9685 9686 if ( fx === '' ) { 9687 gsap_param.y = '10%'; 9688 } else if ( fx === 'zoom' ) { 9689 gsap_param.scale = '1.045'; 9690 } 9691 9692 if ( !$target_fx.length ) { 9693 return; 9694 } 9695 9696 if ( $heading.data('waypoint') !== true ) { 9697 var textInView = new Waypoint.Inview({ 9698 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 9699 element: $heading[0], 9700 enter: function(direction) { 9701 $heading.data('waypoint',true); 9702 gsap.fromTo( $target_fx, { 9703 transformOrigin: '50%' 9704 }, gsap_param ); 9705 } 9706 }); 9707 } else { 9708 gsap.fromTo( $target_fx, { 9709 transformOrigin: '50%' 9710 }, gsap_param ); 9711 } 9712 }; 9713 9714 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 9715 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 9716 var $el = model.view.$el, 9717 shortcode = model.attributes.shortcode; 9718 9719 UNCODE.rotatingTxt($el); 9720 }); 9721 } else { 9722 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 9723 $heading.on('already-animated', function(){ 9724 removeWraps(); 9725 window.addEventListener('removeOldLines', function(){ 9726 clearRequestTimeout(setCTA); 9727 setCTA = requestTimeout( removeWraps, 150 ); 9728 }); 9729 }); 9730 } else { 9731 $(window).on('load', function(){ 9732 removeWraps(); 9733 window.addEventListener('removeOldLines', function(){ 9734 clearRequestTimeout(setCTA); 9735 setCTA = requestTimeout( removeWraps, 150 ); 9736 }); 9737 }); 9738 } 9739 } 9740 }); 9741 9742}; 9743 9744UNCODE.verticalText = function() { 9745 $(window).on('menuCanvasOpen', function(){ 9746 $('.vertical-text--fixed').fadeOut(500); 9747 $('.horizontal-text--fixed').fadeOut(500); 9748 }).on('menuCanvasClose', function(){ 9749 $('.vertical-text--fixed').fadeIn(500); 9750 $('.horizontal-text--fixed').fadeIn(500); 9751 }); 9752 9753 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 9754 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 9755 var hideOnBottomHorizontalTexts = $('.horizontal-text--vis-hide-bottom'); 9756 var showOnTopHorizontalTexts = $('.horizontal-text--vis-show-top'); 9757 9758 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0 || hideOnBottomHorizontalTexts.length > 0 || showOnTopHorizontalTexts.length > 0) { 9759 window.addEventListener('scroll', function(e) { 9760 var totalPageHeight = document.body.scrollHeight; 9761 var scrollPoint = window.scrollY + window.innerHeight; 9762 9763 if (window.scrollY > 0) { 9764 showOnTopVerticalTexts.fadeOut(); 9765 showOnTopHorizontalTexts.fadeOut(); 9766 } else { 9767 showOnTopVerticalTexts.fadeIn(); 9768 showOnTopHorizontalTexts.fadeIn(); 9769 } 9770 9771 if (scrollPoint >= totalPageHeight) { 9772 hideOnBottomVerticalTexts.fadeOut(); 9773 hideOnBottomHorizontalTexts.fadeOut(); 9774 } else { 9775 hideOnBottomVerticalTexts.fadeIn(); 9776 hideOnBottomHorizontalTexts.fadeIn(); 9777 } 9778 }, false); 9779 } 9780}; 9781 9782UNCODE.stickyScroll = function( $el ) { 9783 if ( typeof $el === 'undefined' || $el === null ) { 9784 $el = $('body'); 9785 } 9786 var checkVisible = function( el, dir ) { 9787 if (typeof jQuery === "function" && el instanceof jQuery) { 9788 el = el[0]; 9789 } 9790 9791 var off = 50; 9792 dir = typeof dir=='undefined' ? 'right' : dir; 9793 var rect = el.getBoundingClientRect(); 9794 9795 return ( 9796 ( 9797 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9798 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 9799 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 9800 ) && 9801 ( 9802 ( rect.left >= 0 && (rect.left + (window.innerWidth || document.documentElement.clientWidth)/2) <= (window.innerWidth || document.documentElement.clientWidth) ) || 9803 ( rect.left >= 0 && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ) || 9804 ( rect.right <= window.innerWidth && (rect.right - off) >= 0 ) || 9805 ( rect.right <= window.innerWidth && rect.left >= 0 ) 9806 ) 9807 ); 9808 }; 9809 9810 var setItemsRelHeight = function(reset) { 9811 var $_el = $el; 9812 if ( $el.is('.index-scroll') ) { 9813 var $_el = $el.closest('.uncont'); 9814 } 9815 $('.index-scroll:not(.hor-scroll-vh) .index-row', $_el).each(function(i, item){ 9816 $.each($('.tmb', item), function(index, val) { 9817 if ( reset === true ) { 9818 $(val).css( 'visibility', 'hidden' ); 9819 } else { 9820 $(val).css( 'visibility', 'visible' ); 9821 } 9822 }); 9823 }); 9824 $('.index-scroll.hor-scroll-vh .index-row', $_el).each(function(i, item){ 9825 $.each($('.tmb', item), function(index, val) { 9826 if ( reset === true ) { 9827 $(val).css( 'visibility', 'hidden' ); 9828 $('img:not(.avatar), picture, .t-background-cover', val).css( 'height', 'auto' ); 9829 } else { 9830 var $rowParent = $(item).closest('.row-parent'), 9831 rowRatio = $rowParent.attr('data-height-ratio'), 9832 $rowInner = $(item).closest('.row-child'), 9833 rowRatioInner = $rowInner.attr('data-height'), 9834 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9835 $colContainer = $(item).closest('.uncell'), 9836 $uncont = $(item).closest('.uncont'), 9837 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 9838 safe_heigth = $(item).data('safe-height'), 9839 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(), 9840 offSet = $(item).offset().top - $uncont.offset().top, 9841 multiplier_h, 9842 data_viewport_h, 9843 body_border = $('.body-borders .top-border').outerHeight() * 2, 9844 remove_menu = $(item).data('vp-menu'); 9845 9846 if ( rowRatio === 'full' || rowRatio === '' ) { 9847 rowRatio = 1; 9848 } else { 9849 rowRatio = rowRatio / 100; 9850 } 9851 9852 if ( typeof rowRatioInner === 'undefined' || rowRatioInner === 'full' || rowRatioInner === '' || rowRatioInner == null ) { 9853 rowRatio = rowRatio; 9854 } else { 9855 rowRatio = rowRatio * rowRatioInner / 100; 9856 } 9857 9858 winHeight = winHeight * rowRatio; 9859 9860 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 9861 multiplier_h = parseInt($(item).attr('data-vp-height')); 9862 } else if ( UNCODE.wwidth < UNCODE.mediaQuery && UNCODE.wwidth >= UNCODE.mediaQueryMobile ) { 9863 multiplier_h = parseInt($(item).attr('data-vp-height-md')); 9864 } else if ( UNCODE.wwidth < UNCODE.mediaQueryMobile ) { 9865 multiplier_h = parseInt($(item).attr('data-vp-height-sm')); 9866 } 9867 9868 if ( typeof multiplier_h !== 'undefined' && multiplier_h !== null && multiplier_h > 0) { 9869 data_viewport_h = winHeight*(multiplier_h/100) - ( paddingRow + paddingCol + body_border + offSet ); 9870 if ( remove_menu === true ) { 9871 data_viewport_h = data_viewport_h - UNCODE.menuHeight; 9872 } 9873 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', data_viewport_h ); 9874 } else { 9875 $('img:not(.avatar), picture, .t-background-cover, .fluid-object', val).css( 'height', 'auto' ); 9876 } 9877 9878 } 9879 }); 9880 }); 9881 $('.index-scroll', $_el).each(function(i, item){ 9882 var $uncoltable = $(item).closest('.uncoltable'), 9883 $rowParent = $(item).closest('.row-parent'), 9884 paddingRow = parseInt($rowParent.css('padding-top')) + parseInt($rowParent.css('padding-bottom')), 9885 body_border = $('.body-borders .top-border').outerHeight() * 2, 9886 $index_row = $('.index-row', item), 9887 safe_heigth = $index_row.data('safe-height'), 9888 winHeight = safe_heigth ? UNCODE.wheight : $('#vh_layout_help').outerHeight(); 9889 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 9890 var data_viewport_h = winHeight - ( paddingRow + body_border ); 9891 $uncoltable.css({ 9892 'min-height': data_viewport_h 9893 }); 9894 } else { 9895 $uncoltable.css({ 9896 'min-height': 'auto' 9897 }); 9898 } 9899 }); 9900 9901 } 9902 setItemsRelHeight(); 9903 9904 var $index_scrolls = $('.index-scroll', $el); 9905
9906 $index_scrolls.each(function(key, value){ 9907 var $index = $(this), 9908 $parent_row = $index.closest('.vc_row[data-parent]'), 9909 $index_row = $('.index-row', $index), 9910 dir = $index_row.attr('data-direction'); 9911 dir = typeof dir === 'undefined' ? 'right' : dir; 9912 9913 $parent_row.addClass('unscroll-horizontal').attr('data-direction', dir); 9914 }); 9915 9916 var $horScrolls = $('.unscroll-horizontal', $el); 9917 9918 if ( $horScrolls.length ) { 9919 9920 $('body').addClass('scrolling-trigger'); 9921 9922 $horScrolls.each(function(key, value){ 9923 var $section = $(this), 9924 $index_scroll = $('.index-scroll', $section), 9925 $index_row = $('.index-row', $index_scroll), 9926 dir = $section.attr('data-direction'), 9927 wrap = $index_row.attr('data-wrap'), 9928 $pinWrap, 9929 $pinTrigger; 9930 9931 dir = typeof dir === 'undefined' ? 'right' : dir; 9932 $pinTrigger = $('<div class="pin-trigger" data-direction="' + dir + '" />'); 9933 $pinWrap = $('<div class="pin-wrap" />'); 9934 if ( SiteParameters.is_frontend_editor ) { 9935 var gutterClass = $('.index-wrapper', $index_scroll).attr('class').match(/\b([^\s]+)-gutter\b/g, ''); 9936 $('.index-wrapper', $index_scroll).wrapInner($pinWrap.addClass(gutterClass[0])); 9937 } else { 9938 if ( wrap === 'column' ) { 9939 $index_scroll.wrapInner( $pinWrap ); 9940 } else { 9941 $('> .row', $section).wrap( $pinWrap ); 9942 } 9943 $section.wrapInner( $pinTrigger ); 9944 } 9945 9946 }); 9947 9948 var $pinWraps = $('.pin-wrap', $el); 9949 9950 var horScrollSizes = function(){ 9951 9952 $pinWraps.each(function(key, val){ 9953 var $pinWrap = $(this).attr('id','pin_wrap_' + key), 9954 $pinTrigger = $pinWrap.closest('.pin-trigger'), 9955 dir = $pinTrigger.length ? $pinTrigger.attr('data-direction') : $pinWrap.closest('[data-direction]').attr('data-direction'), 9956 $index_scroll = SiteParameters.is_frontend_editor ? $pinWrap.closest('.index-scroll') : $('.index-scroll', $pinTrigger), 9957 $boxContainer = $('.box-container'), 9958 box_m = $boxContainer.css('margin-left'), 9959 st_active = true; 9960 9961 var setHorW, 9962 horWidth = function(){ 9963 $index_scroll.each(function(){ 9964 var $this = $(this), 9965 $index_row = $('.index-row', $this), 9966 $rowContainer = $index_row.closest('.vc_row'), 9967 $rowInner = $index_row.closest('.wpb_row'), 9968 $rowParent = $index_row.closest('.row-parent'), 9969 $tmbs = $('.tmb', $index_row), 9970 padding_tmb = parseFloat( $tmbs.first().css('padding-right') ), 9971 $uncont = $index_row.closest('.uncont'), 9972 $parent_col = $index_row.closest('.wpb_column'), 9973 col_w = $uncont.width(), 9974 data_lg = parseFloat( $index_row.attr('data-lg') ), 9975 data_md = $this.hasClass('row-scroll-no-md') ? 1 : parseFloat( $index_row.attr('data-md') ), 9976 data_sm = $this.hasClass('row-scroll-no-sm') ? 1 : parseFloat( $index_row.attr('data-sm') ), 9977 tmb_w; 9978 9979 col_w = col_w > UNCODE.wwidth ? UNCODE.wwidth : col_w; 9980 tmb_w = ( col_w + padding_tmb ) / data_lg; 9981 9982 if ( typeof data_sm !== 'undefined' && data_sm !== '' && UNCODE.wwidth < 570 ) { 9983 tmb_w = ( col_w + padding_tmb ) / data_sm; 9984 } else if ( typeof data_md !== 'undefined' && data_md !== '' && UNCODE.wwidth >= 570 && UNCODE.wwidth < 960 ) { 9985 tmb_w = ( col_w + padding_tmb ) / data_md; 9986 } 9987 9988 if ( !isNaN(tmb_w) ) { 9989 $tmbs.css({ 9990 'width': tmb_w 9991 }); 9992 } 9993 9994 $tmbs.css({ 9995 'visibility': 'visible' 9996 }); 9997 9998 }); 9999 }; 10000 10001 horWidth(); 10002 clearRequestTimeout(setHorW); 10003 setHorW = requestTimeout( function(){ 10004 setItemsRelHeight(); 10005 horWidth(); 10006 }, 100 ); 10007 10008 if ( SiteParameters.is_frontend_editor ) { 10009 return; 10010 } 10011 10012 var $vmenu = $('body.vmenu .vmenu-container'), 10013 vmenuW = $vmenu.length && UNCODE.wwidth > UNCODE.mediaQuery ? $vmenu.width() : 0, 10014 winWidth = window.innerWidth - vmenuW, 10015 $tmb = $('.tmb', $index_scroll).eq(0), 10016 paddingRight = parseFloat( $tmb.css('padding-right') ), 10017 stickyScrollLength = ( $('.index-row', $index_scroll).width() - ( $index_scroll.width() + paddingRight ) ), 10018 remove_menu = $('.index-row', $index_scroll).data('vp-menu'), 10019 scroll_anim; 10020 10021 if ( $('body').hasClass('rtl') ) { 10022 if ( dir === 'left' ) { 10023 scroll_anim = gsap.fromTo( $pinWrap, { 10024 x: stickyScrollLength 10025 },{ 10026 x: 0, 10027 ease: "none" 10028 }); 10029 } else { 10030 scroll_anim = gsap.fromTo( $pinWrap, { 10031 x: 0 10032 },{ 10033 x: stickyScrollLength, 10034 ease: "none" 10035 }); 10036 } 10037 } else { 10038 if ( dir === 'left' ) { 10039 scroll_anim = gsap.fromTo( $pinWrap, { 10040 x: -stickyScrollLength 10041 },{ 10042 x: 0, 10043 ease: "none" 10044 }); 10045 } else { 10046 scroll_anim = gsap.fromTo( $pinWrap, { 10047 x: 0 10048 },{ 10049 x: -stickyScrollLength, 10050 ease: "none" 10051 }); 10052 } 10053 } 10054 10055 if ( typeof ScrollTrigger.getById("stickySectionScrolling" + key) !== 'undefined' ) { 10056 ScrollTrigger.getById("stickySectionScrolling" + key).kill(true); 10057 } 10058 10059 var animationIncrease; 10060 10061 var checkForAnimations = function(){ 10062 animationIncrease = 0 10063 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10064 var _this = this, 10065 isScrolling; 10066 if ( ScrollTrigger.isInViewport($pinTrigger[0]) && ScrollTrigger.isInViewport(_this, 0.5, true) ) { 10067 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10068 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10069 requestTimeout(function() { 10070 $(_this).addClass('start_animation'); 10071 }, delayAttr + animationIncrease); 10072 animationIncrease += 150; 10073 } 10074 }); 10075 }; 10076 checkForAnimations(); 10077
10078 // var start = $index_scroll.length ? parseFloat($index_scroll.position().top) : 0; 10079 var start = 0; 10080 10081 var horST = ScrollTrigger.create({ 10082 id: "stickySectionScrolling" + key, 10083 scrub: true, 10084 trigger: $pinTrigger[0], 10085 pin: true, 10086 anticipatePin: 1, 10087 start: function() { return "top top+=" + parseFloat( $('.top-border').height() + ( remove_menu === true ? UNCODE.menuHeight : 0 ) ); }, 10088 end: function() { return "+="+stickyScrollLength; }, 10089 animation: scroll_anim, 10090 ease: Sine.easeOut, 10091 onUpdate: checkForAnimations, 10092 invalidateOnRefresh: true, 10093 onEnter: function(){ 10094 $pinTrigger.addClass('enter-st'); 10095 }, 10096 onEnterBack: function(){ 10097 $pinTrigger.addClass('enter-st'); 10098 }, 10099 onLeave: function(){ 10100 $pinTrigger.removeClass('enter-st'); 10101 }, 10102 onLeaveBack: function(){ 10103 $pinTrigger.removeClass('enter-st'); 10104 } 10105 }); 10106 10107 window.dispatchEvent(new CustomEvent('dynamic_srcset_load')); 10108 window.dispatchEvent(new CustomEvent('boxResized')); 10109 10110 var testSecondTrigger = function(){ 10111 animationIncrease = 0 10112 $('.animate_when_almost_visible:not(.start_animation)', $pinTrigger).each(function(){ 10113 var _this = this; 10114 if ( checkVisible(_this) ) { 10115 var delayAttr = parseFloat( $(_this).attr('data-delay') ); 10116 if (delayAttr == undefined || isNaN(delayAttr)) delayAttr = 0; 10117 requestTimeout(function() { 10118 $(_this).addClass('start_animation'); 10119 }, delayAttr + animationIncrease); 10120 animationIncrease += 150; 10121 } 10122 }); 10123 10124 }; 10125 10126 var verST = ScrollTrigger.create({ 10127 id: "verticalSectionScrolling" + key, 10128 trigger: $pinTrigger[0], 10129 start: "top center", 10130 end: function() { return "+="+UNCODE.wheight; }, 10131 onUpdate: testSecondTrigger, 10132 invalidateOnRefresh: true 10133 }); 10134 10135 var setCTA, 10136 10137 dis_enable_ST = function(){ 10138 if ( $('.row-scroll-no-md', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQuery ) { 10139 horST.kill(); 10140 verST.kill(); 10141 $pinTrigger.addClass('disabled'); 10142 st_active = false; 10143 } else if ( $('.row-scroll-no-sm', $pinTrigger).length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) { 10144 horST.kill(); 10145 verST.kill(); 10146 $pinTrigger.addClass('disabled'); 10147 st_active = false; 10148 } 10149 }; 10150 10151 $(window).on('resize load', function() { 10152 clearRequestTimeout(setCTA); 10153 setCTA = requestTimeout(function() { 10154 dis_enable_ST(); 10155 checkForAnimations(); 10156 }, 500); 10157 }); 10158 10159 }); 10160 }; 10161 10162 $(window).on( 'load', function(){ 10163 horScrollSizes(); 10164 }); 10165 var setResize, 10166 setReLayout, 10167 doubleResize = true, 10168 oldW = UNCODE.wwidth; 10169 $(window).on( 'resize orientationchange', function(){ 10170 if ( 'onorientationchange' in window && oldW === UNCODE.wwidth ) { 10171 return; 10172 } else { 10173 oldW = UNCODE.wwidth; 10174 } 10175 setItemsRelHeight(true); 10176 var $row_inners = document.querySelectorAll('.pin-spacer .row-inner'); 10177 Array.prototype.forEach.call($row_inners, function(el) { 10178 el.style.height = ''; 10179 el.style.marginBottom = ''; 10180 }); 10181 clearRequestTimeout(setResize); 10182 setResize = requestTimeout( function(){ 10183 setItemsRelHeight(); 10184 horScrollSizes(); 10185 ScrollTrigger.refresh(); 10186 if ( doubleResize === true ) { 10187 window.dispatchEvent(new Event('resize')); 10188 doubleResize = false; 10189 } else { 10190 doubleResize = true; 10191 } 10192 UNCODE.setRowHeight(document.querySelectorAll('.page-wrapper .row-parent'), false, true); 10193 }, 100 ); 10194 }); 10195 10196 var show_pins = function(){ 10197 $('.index-scroll').css({'opacity':'1'}); 10198 setResize = requestTimeout( function(){ 10199 }, 10 ); 10200 }; 10201 ScrollTrigger.addEventListener("refresh", show_pins); 10202 $(window).on( 'uncode.re-layout', function(){ 10203 //$('.index-scroll').css({'opacity':'0'}); 10204 $('.pin-spacer').each(function(){ 10205 var space_h = $(this).outerHeight(), 10206 $row = $(this).closest('.row-container'); 10207 $row.css({ 10208 'height': space_h, 10209 'overflow': 'hidden' 10210 }); 10211 }); 10212 ScrollTrigger.refresh(true); 10213 clearRequestTimeout(setReLayout); 10214 setReLayout = requestTimeout( function(){ 10215 $('.row-container').each(function(){ 10216 $(this).css({ 10217 'height': '', 10218 'overflow': '' 10219 }); 10220 }); 10221 }, 1000); 10222 }); 10223 } 10224 10225}; 10226 10227UNCODE.stickyTrigger = function( $el ) { 10228 if ( SiteParameters.is_frontend_editor ) { 10229 return false;
10230 } 10231 10232 var stickyTrigger = function(){ 10233 var stickyTrick = $('.sticky-trigger').each(function(){ 10234 var $sticky = $(this), 10235 $inside = $('> div', $sticky), 10236 insideH = $inside.outerHeight(), 10237 $row = $sticky.closest('.vc_row'), 10238 $uncont = $sticky.closest('.uncont'), 10239 rowBottom, 10240 uncontBottom , 10241 diffBottom; 10242 10243 ScrollTrigger.create({ 10244 trigger: $sticky, 10245 start: function(){ return "top center-=" + insideH/2; }, 10246 endTrigger: $row, 10247 end: function(){ 10248 rowBottom = $row.offset().top + $row.outerHeight(); 10249 uncontBottom = $uncont.offset().top + $uncont.outerHeight(); 10250 diffBottom = rowBottom - uncontBottom; 10251 return "bottom center+=" + ( insideH/2 + diffBottom ); 10252 }, 10253 anticipatePin: true, 10254 pin: true, 10255 pinSpacing: false, 10256 scrub: true, 10257 invalidateOnRefresh: true, 10258 }); 10259 10260 }); 10261 }, 10262 setResizeSticky; 10263 10264 $(window).on( 'load', function(){ 10265 stickyTrigger(); 10266 }); 10267 10268 var oldW = UNCODE.wwidth; 10269 $(window).on( 'resize uncode.re-layout', function(e){ 10270 clearRequestTimeout(setResizeSticky); 10271 if ( e.type === 'resize' && oldW === UNCODE.wwidth ) { 10272 return; 10273 } else { 10274 oldW = UNCODE.wwidth; 10275 } 10276 setResizeSticky = requestTimeout( function(){ 10277 stickyTrigger(); 10278 ScrollTrigger.refresh(); 10279 }, 1000 ); 10280 }); 10281 10282}; 10283 10284UNCODE.revslider = function() { 10285 var revSliderIn = function(){ 10286 $('rs-module').each(function(){ 10287 var $slider = $(this); 10288 10289 $slider.on('revolution.slide.onloaded', function(e, data){ 10290 if ( $(e.currentTarget).closest(".header-revslider").length ) { 10291 var style = $(e.currentTarget).find("rs-slide").eq(0).attr("data-skin"), 10292 scrolltop = $(document).scrollTop(); 10293 if ( style != undefined ) { 10294 UNCODE.switchColorsMenu(scrolltop, style); 10295 } 10296 } 10297 }); 10298 10299 $slider.on('revolution.slide.onchange', function(e, data){ 10300 if ( $(e.currentTarget).closest(".header-revslider").length ) { 10301 var style = $(e.currentTarget).find("rs-slide").eq(data.slideIndex - 1).attr("data-skin"), 10302 scrolltop = $(document).scrollTop(); 10303 if ( style != undefined ) { 10304 UNCODE.switchColorsMenu(scrolltop, style); 10305 } 10306 } 10307 }); 10308 10309 }); 10310 }; 10311 revSliderIn(); 10312 $(window).on("load", revSliderIn ); 10313}; 10314UNCODE.layerslider = function() { 10315 $(window).on("load", function() { 10316 10317 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 10318 10319 var slideData = slider.slides.current.data, 10320 scrolltop = $(document).scrollTop(); 10321 if( slideData && slideData.skin ) { 10322 10323 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 10324 10325 } 10326 }); 10327 10328 }); 10329}; 10330 10331UNCODE.ajax_filters = function() { 10332 10333/************************* 10334 * 10335 * Filters Menu and Widgets Area 10336 * 10337 ************************/ 10338 10339 var clear_clicked = false; 10340 10341 var init_ajax_grid = function(){ 10342 10343 var $grids = $('.ajax-grid-system:not(.init-ajax-grid)'); 10344 $grids.each(function(index, val){ 10345 var $body = $('body'), 10346 $grid = $(val).addClass('init-ajax-grid'), 10347 starting_point = $grid.attr('data-toggle'), 10348 $trigger = $('.uncode-toggle-ajax-filters', $grid), 10349 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper', $grid), 10350 $isotope_wrapper = $('.isotope-wrapper', $grid), 10351 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper), 10352 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $grid), 10353 $footprint = $('.ajax-filter-footprint', $grid), 10354 sidebar_w, 10355 data_w = parseFloat( $sidebar.attr('data-max-width') ), 10356 $firstCol = $grid.closest('.uncol.style-light, .uncol.style-dark'), 10357 skin = $firstCol.hasClass('style-light') ? 'style-light' : 'style-dark', 10358 $positioned_top = $('.ajax-filter-position-horizontal', $grid), 10359 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 10360 $close_btn = $('.close-ajax-filter-sidebar', $sidebar_wrapper), 10361 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0), 10362 sidew, 10363 $inside_row = $('> .row-parent', $vc_row), 10364 bg_row, 10365 $side_header = $('.ajax-filter-sidebar-header', $sidebar_wrapper), 10366 $side_footer = $('.ajax-filter-sidebar-footer', $sidebar_wrapper), 10367 $apply_filters = $('.ajax-filter-sidebar__button', $side_footer),
10368 sidebar_overlay = false, 10369 sidebar_hover = false, 10370 switchMobile = false, 10371 scrollTop; 10372 10373 if ( $vc_row.attr('class') ) { 10374 bg_row = $vc_row.attr('class').match(/style-color-([^-]+)-bg/); 10375 } 10376 10377 if ( bg_row != null ) { 10378 $side_header.add($side_footer).addClass(bg_row[0]); 10379 } 10380 10381 $trigger.add($apply_filters).on('click', function(e){ 10382 e.preventDefault(); 10383 e.stopPropagation(); 10384 $grid = $('.ajax-grid-system').eq(0); 10385 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 10386 overlay_desktop = $('.ajax-filter-position-left-overlay, .ajax-filter-position-right-overlay', $grid).length, 10387 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10388 sidebar_w = $sidebar_wrapper.width(); 10389 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10390 if ($(this).hasClass('ajax-filter-sidebar__button--clear')) { 10391 $(this).trigger('uncode-ajax-clear-filters'); 10392 } 10393 if ( $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10394 $grid.toggleClass('ajax-hide-filters-blanks'); 10395 $sidebar.slideToggle({ 10396 duration: 400, 10397 easing: 'easeOutQuad', 10398 }); 10399 } else { 10400 $grid.removeClass('ajax-hide-filters-blanks'); 10401 $grid.toggleClass('ajax-hide-filters'); 10402 if ( $grid.hasClass('ajax-hide-filters') ) { 10403 $body.addClass('ajax-hide-filters'); 10404 } else { 10405 scrollTop = $('html, body').scrollTop(); 10406 $body.removeClass('ajax-hide-filters'); 10407 } 10408 } 10409 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 10410 $('html, body').scrollTop(scrollTop); 10411 } 10412 return false; 10413 }); 10414 10415 $close_btn.on('click', function(e){ 10416 e.preventDefault(); 10417 $grid = $('.ajax-grid-system').eq(0); 10418 $grid.addClass('ajax-hide-filters'); 10419 if ( $grid.hasClass('ajax-hide-filters') ) { 10420 $body.addClass('ajax-hide-filters'); 10421 } else { 10422 scrollTop = $('html, body').scrollTop(); 10423 $body.removeClass('ajax-hide-filters'); 10424 } 10425 $('html, body').scrollTop(scrollTop); 10426 }); 10427 10428 $sidebar_wrapper.on('mouseover',function(){ 10429 sidebar_hover = true; 10430 }).on('mouseout', function(){ 10431 sidebar_hover = false; 10432 }); 10433 10434 $body.off('click.ajax-filter-sidebar').on('click.ajax-filter-sidebar', function( e, from ){ 10435 if ( $(e.target).closest('.ajax-filter-sidebar').length ) { 10436 return; 10437 } 10438 if (undefined !== from && from === 'select_active_attributes') { 10439 return; 10440 } 10441 if ( ! $body.hasClass('ajax-hide-filters') && !sidebar_hover && $body.hasClass('ajax-filter-sidebar-overlay') ) { 10442 $grid.add($body).addClass('ajax-hide-filters'); 10443 } 10444 }); 10445 10446 $sorting_trgr.on('click', function(e) { 10447 e.preventDefault(); 10448 }); 10449 10450 var inside_width = function(){ 10451 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10452 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10453 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 10454 $inside_row = $('> .row-parent', $vc_row); 10455 if ( ( UNCODE.wwidth < UNCODE.mediaQuery ) || overlay_desktop ) { 10456 sidew = $sidebar.width(); 10457 $inside_row.css({ 10458 width: sidew 10459 }); 10460 } else { 10461 $inside_row.css({ 10462 width: '' 10463 }); 10464 } 10465 }; 10466 inside_width(); 10467 10468 var ajax_sidebar_position = function(e, f_editor){ 10469 $grid = $('.ajax-grid-system').eq(0); 10470 $sidebar_wrapper = $('.ajax-filter-sidebar-wrapper').eq(0); 10471 $positioned_top = $('.ajax-filter-position-horizontal', $grid); 10472 $sidebar = $('.ajax-filter-sidebar', $sidebar_wrapper); 10473 $vc_row = $('.vc_row', $sidebar_wrapper).eq(0); 10474 $inside_row = $('> .row-parent', $vc_row); 10475 scrollTop = $('html, body').scrollTop(); 10476 if ( f_editor !== true && ( ( UNCODE.wwidth < UNCODE.mediaQuery && switchMobile !== true) || overlay_desktop ) ) { 10477 $grid.add($body).addClass('ajax-hide-filters'); 10478 $sidebar_wrapper.after('<span class="ajax-sidebar-placeholder" />'); 10479 $body.append($sidebar_wrapper.addClass('main-container ajax-filter-sidebar--offcanvas')); 10480 sidebar_overlay = true; 10481 $body.addClass('ajax-filter-sidebar-overlay'); 10482 $sidebar_wrapper.addClass(skin); 10483 var sideHeadH = $side_header.outerHeight(), 10484 sideFooterH = $side_footer.outerHeight(); 10485 if ( data_w !== '' && data_w > 0 ) { 10486 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 10487 $sidebar.css({ 10488 'max-width': data_w 10489 }); 10490 } else { 10491 $sidebar.css({ 10492 'max-width':'none' 10493 }); 10494 } 10495 } 10496 $vc_row.css({ 10497 'padding-top':sideHeadH, 10498 'padding-bottom':sideFooterH 10499 }); 10500 var sidew = $sidebar.width(); 10501 $inside_row.css({ 10502 width: sidew 10503 }); 10504 switchMobile = true; 10505 } else { 10506 if ( ( typeof e !== 'undefined' && e.type === 'wwResize' && starting_point === 'hidden' ) || f_editor === true ) { 10507 scrollTop = $('html, body').scrollTop(); 10508 $grid.add($body).removeClass('ajax-hide-filters'); 10509 } 10510 if ( typeof e !== 'undefined' && e.type === 'wwResize' && $positioned_top.length && UNCODE.wwidth < UNCODE.mediaQuery ) { 10511 $grid.addClass('ajax-hide-filters-blanks'); 10512 $sidebar.hide(); 10513 } 10514 $('.ajax-sidebar-placeholder', $grid).after($sidebar_wrapper.removeClass('main-container ajax-filter-sidebar--offcanvas')); 10515 $('.ajax-sidebar-placeholder', $grid).remove();
10516 sidebar_overlay = false; 10517 $body.removeClass('ajax-filter-sidebar-overlay'); 10518 $sidebar_wrapper.removeClass(skin); 10519 if ( data_w !== '' && data_w > 0 ) { 10520 $sidebar.css({ 10521 'max-width':'none' 10522 }); 10523 } 10524 $vc_row.css({ 10525 'padding-top':0, 10526 'padding-bottom':0, 10527 }); 10528 10529 $inside_row.css({ 10530 width: '' 10531 }); 10532 10533 if ( f_editor === true ) { 10534 UNCODE.ajax_filters(); 10535 } 10536 10537 switchMobile = false; 10538 } 10539 if ( overlay_desktop || UNCODE.wwidth < UNCODE.mediaQuery ) { 10540 $('html, body').scrollTop(scrollTop); 10541 } 10542 }; 10543 10544 var sidebar_width = function(){ 10545 if ( ! $body.hasClass('ajax-filter-sidebar-overlay') && ! $positioned_top.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 10546 sidebar_w = $footprint.width(); 10547 $sidebar.css({ width: sidebar_w }); 10548 } else { 10549 $sidebar.css({ width: '' }); 10550 } 10551 }; 10552 sidebar_width(); 10553 10554 if ( SiteParameters.is_frontend_editor ) { 10555 ajax_sidebar_position(); 10556 } 10557 10558 $(window).off('load.ajax_filters wwResize.ajax_filters').on('load.ajax_filters wwResize.ajax_filters', function(e){ 10559 if ( ! SiteParameters.is_frontend_editor || e.type === 'wwResize' ) { 10560 ajax_sidebar_position(e); 10561 } 10562 sidebar_width(); 10563 }); 10564 10565 $(window).off('uncode.ajax_filters').one('uncode.ajax_filters', function(e){ 10566 ajax_sidebar_position(e, true); 10567 }); 10568 10569 $isotope_wrapper.on('transitionend', function(e){ 10570 if ( $(e.target).hasClass('isotope-wrapper') ) { 10571 window.dispatchEvent(new CustomEvent('boxResized')); 10572 } 10573 return false; 10574 }); 10575 10576 if ( UNCODE.wwidth < UNCODE.mediaQuery && $body.hasClass('ajax-hide-filters') ) { 10577 var $grid = $('.ajax-grid-system').eq(0); 10578 $grid.addClass('ajax-hide-filters'); 10579 } 10580 10581 }); 10582 }; 10583 10584 init_ajax_grid(); 10585 $(document).on('uncode-ajax-filtered', init_ajax_grid); 10586 10587/************************* 10588 * 10589 * Hover hack 10590 * 10591 ************************/ 10592 var widget_hover_hack = function() { 10593 $('.widget, .uncode_widget').each(function(){ 10594 var $widget = $(this), 10595 class_w = $widget.attr('class'), 10596 $lis = $('ul:not(.menu-horizontal) > li', $widget).has('a'), 10597 $footer = $widget.closest('#colophon'); 10598 10599 if ( class_w.indexOf('widget_yith') > 0 ) { 10600 return true; 10601 } 10602 10603 $lis.each(function(){ 10604 var $li = $(this), 10605 $a = $('a', $li), 10606 $label = $a.closest('label'); 10607 10608 if ( !$footer.length ) { 10609 $li.addClass('no-evts'); 10610 } 10611 10612 if ( ! $('span', $a).length ) { 10613 $li.addClass( 'li-hover' ); 10614 } 10615 10616 $('li', $li).hover(function(e){ 10617 $(e.target).parents('li').each(function(){ 10618 $(this).addClass( 'parent-li-hover' ); 10619 }); 10620 }, function (e) { 10621 $(e.target).parents('li').each(function(key, val){ 10622 if ( key === 0) { 10623 $(val).removeClass( 'parent-li-hover' ); 10624 } 10625 }); 10626 }); 10627 10628 $li.off('mouseup').on('mouseup', function (e) { 10629 if (e.which !== 3) { 10630 e.stopPropagation(); 10631 var $a = $('a', this).first(); 10632 $a[0].click(); 10633 } 10634 }); 10635 }); 10636 }); 10637 } 10638 widget_hover_hack(); 10639 $(document).on('uncode-ajax-filtered', widget_hover_hack); 10640 10641/************************* 10642 * 10643 * Init Filters 10644 * 10645 ************************/ 10646 10647 function init_filters() { 10648 $(document).on('click', '.term-filter-link', function(e) { 10649 var _this = $(this); 10650 var widget = _this.closest('.uncode_widget'); 10651 var container = get_filters_container(); 10652 10653 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10654 return true; 10655 } 10656 10657 e.preventDefault(); 10658 10659 if (widget.hasClass('widget-ajax-filters--checkbox')) { 10660 _this.parent().find('input[type="checkbox"]').trigger('click'); 10661 } else { 10662 if (_this.hasClass('term-filter-link--active')) { 10663 _this.removeClass('term-filter-link--active'); 10664 } else { 10665 _this.addClass('term-filter-link--active'); 10666 10667 if (widget.hasClass('widget-ajax-filters--single')) { 10668 widget.find('.term-filter-link').not(_this).removeClass('term-filter-link--active'); 10669 } 10670 } 10671 10672 var url = _this.attr('href'); 10673 10674 reload_items(container, url, true); 10675 } 10676 }); 10677 10678 $(document).on('click', '.term-filter input[type="checkbox"]', function(e) { 10679 var _this = $(this); 10680 var widget = _this.closest('.uncode_widget'); 10681 var link = _this.closest('.term-filter').find('.term-filter-link'); 10682 var url = link.attr('href'); 10683 var container = get_filters_container(); 10684 10685 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10686 window.location = url; 10687 return; 10688 } 10689 10690 if (widget.hasClass('widget-ajax-filters--single')) { 10691 widget.find('input[type="checkbox"]').each(function() { 10692 if (_this.attr('id') !== $(this).attr('id')) { 10693 $(this).prop('checked', false); 10694 $(this).closest('.term-filter').find('.term-filter-link').removeClass('term-filter-link--active'); 10695 } 10696 }); 10697 } 10698 10699 if (_this.prop('checked')) { 10700 link.addClass('term-filter-link--active'); 10701 } else { 10702 link.removeClass('term-filter-link--active'); 10703 } 10704 10705 reload_items(container, url, true); 10706 }); 10707 10708 $(document).on('change', 'select.select--term-filters', function(e) { 10709 var _this = $(this); 10710 var selected = _this.find('option:selected'); 10711 var option = $(selected); 10712 var url = option.attr('data-term-filter-url'); 10713 var container = get_filters_container(); 10714 var widget = _this.closest('.uncode_widget'); 10715 10716 if (widget.hasClass('widget-ajax-filters--no-ajax')) { 10717 window.location = url; 10718 } else { 10719 reload_items(container, url, true); 10720 } 10721 }); 10722 10723 $(document).on('click', '.filter-list__link', function(e) { 10724 if (SiteParameters.is_frontend_editor) { 10725 return false;
10726 } 10727 10728 e.preventDefault(); 10729 10730 var _this = $(this); 10731 var container = get_filters_container(); 10732 var url = _this.attr('href'); 10733 reload_items(container, url, true); 10734 }); 10735 10736 $('.ajax-filter-sidebar__button--clear').on('uncode-ajax-clear-filters', function(e) { 10737 var _this = $(this); 10738 var container = get_filters_container(); 10739 var url = _this.attr('href'); 10740 reload_items(container, url, true); 10741 }); 10742 10743 $(document).on('click', '.uncode-woocommerce-sorting-dropdown__link', function(e) { 10744 10745 var _this = $(this); 10746 var container = get_filters_container(); 10747 var url = _this.attr('href'); 10748 10749 if ( container.length ) { 10750 e.preventDefault(); 10751 reload_items(container, url, true); 10752 } 10753 }); 10754 10755 $(document).on('click', '.uncode_woocommerce_widget--price-filter .button', function(e) { 10756 var _this = $(this); 10757 var container = get_filters_container(); 10758 10759 if (container.length > 0) { 10760 e.preventDefault(); 10761 10762 var min_price = $('#min_price').val(); 10763 var max_price = $('#max_price').val(); 10764 var location = window.location; 10765 var url = location.href; 10766 var page_uri = location.origin + location.pathname; 10767 var is_filtered = page_uri !== url; 10768 10769 if (is_filtered) { 10770 url = remove_parameter_from_url(url, 'min_price'); 10771 url = remove_parameter_from_url(url, 'max_price'); 10772 } 10773 10774 var concat = page_uri === url ? '?' : '&'; 10775 var params = {'min_price': min_price, 'max_price': max_price}; 10776 10777 url = url + concat + $.param(params); 10778 10779 reload_items(container, url, true); 10780 } 10781 }); 10782 10783 var search_timer; 10784 10785 $(document).on('keyup', '.term-filters-search-input', function(e) { 10786 var _this = $(this); 10787 var container = get_filters_container(); 10788 var value = _this.val(); 10789 10790 if (search_timer) { 10791 clearTimeout(search_timer); 10792 } 10793 10794 search_timer = setTimeout(function() { 10795 update_search_url(container, value); 10796 }, 500); 10797 }); 10798 } 10799 10800 function update_search_url(container, search_value) { 10801 var location = window.location; 10802 var url = location.href; 10803 var page_uri = location.origin + location.pathname; 10804 var is_filtered = page_uri !== url; 10805 var key_search = SiteParameters.ajax_filter_key_search; 10806 var key_unfilter = SiteParameters.ajax_filter_key_unfilter; 10807 10808 if (is_filtered) { 10809 url = remove_parameter_from_url(url, key_search); 10810 url = remove_parameter_from_url(url, key_unfilter); 10811 } 10812 10813 if (search_value) { 10814 var concat = page_uri === url ? '?' : '&'; 10815 var params = {}; 10816 10817 params[key_search] = search_value; 10818 params[key_unfilter] = 1; 10819 url = url + concat + $.param(params); 10820 } else { 10821 url = remove_parameter_from_url(url, key_search); 10822 } 10823 10824 reload_items(container, url, true); 10825 } 10826 10827 function remove_parameter_from_url(url, parameter) { 10828 return url.replace(new RegExp('[?&]' + parameter + '=[^&#]*(#.*)?$'), '$1').replace(new RegExp('([?&])' + parameter + '=[^&]*&'), '$1'); 10829 } 10830 10831 function get_filters_container() { 10832 var container = $('.ajax-grid-system'); 10833 10834 if (container.length == 0) { 10835 container = $('.ajax-filters'); 10836 } 10837 10838 return container; 10839 } 10840 10841 function update_widgets_state(widgets_states, container) { 10842 for (var i = widgets_states.length - 1; i >= 0; i--) { 10843 var state = widgets_states[i]; 10844 10845 if (!state.collapse) { 10846 continue; 10847 } 10848 10849 var new_widget = container.find('.uncode_widget[data-id="' + state.id + '"'); 10850 10851 if (state.open) { 10852 new_widget.find('.widget-title').addClass('open'); 10853 if (state.css) { 10854 new_widget.find('.widget-collapse-content').attr('style', state.css); 10855 } 10856 } else { 10857 new_widget.find('.widget-title').removeClass('open'); 10858 if (state.css) { 10859 new_widget.find('.widget-collapse-content').attr('style', state.css); 10860 } 10861 } 10862 } 10863 } 10864 10865 // Reload items via AJAX 10866 function reload_items(container, url, push) { 10867 container.addClass('grid-filtering'); 10868 10869 $.ajax({ 10870 url : url, 10871 success : function(response) { 10872 if (!response) { 10873 return; 10874 } 10875 10876 $(document).trigger('uncode-ajax-pre-filtered'); 10877 10878 var container_id = container.attr('id'); 10879 var pagination = $('.row-navigation'); 10880 10881 if (container_id) { 10882 var container_to_append = $(response).find('#' + container_id); 10883 var pagination_to_append = $(response).find('.row-navigation'); 10884 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10885 10886 // Remember open/closed widgets 10887 var widgets = $('.uncode_widget'); 10888 var widgets_container = widgets.closest('.ajax-filter-sidebar--offcanvas').length > 0 ? $('.ajax-filter-sidebar--offcanvas') : container_to_append; 10889 var widgets_states = []; 10890 10891 widgets.each(function() { 10892 var widget = $(this); 10893 var id = widget.attr('data-id'); 10894 var state = { 10895 'id': id, 10896 'collapse': false, 10897 'open': false, 10898 'css': false, 10899 }; 10900 10901 var collapse_wrapper = widget.find('.widget-collapse-content'); 10902 10903 if (collapse_wrapper.length > 0) { 10904 state.collapse = true; 10905 10906 var collapse_wrapper_css = collapse_wrapper.attr('style'); 10907 var title = widget.find('.widget-title'); 10908 10909 state.css = collapse_wrapper_css; 10910 10911 if (title.hasClass('open')) { 10912 state.open = true; 10913 } else { 10914 state.open = false;
10915 } 10916 } 10917 10918 widgets_states.push(state); 10919 }); 10920 10921 // Update widgets state 10922 if (offcanvas_sidebar_wrapper.length === 0) { 10923 update_widgets_state(widgets_states, container_to_append); 10924 } 10925 10926 // Update default sidebar state 10927 if (!container.hasClass('ajax-hide-filters')) { 10928 container_to_append.removeClass('ajax-hide-filters'); 10929 } 10930 10931 // Update horizontal sidebar 10932 if (!container.hasClass('ajax-hide-filters-blanks')) { 10933 container_to_append.removeClass('ajax-hide-filters-blanks'); 10934 } 10935 var horizontal_sidebar_wrapper = $('.ajax-filter-position-horizontal'); 10936 if (horizontal_sidebar_wrapper.length > 0) { 10937 var horizontal_sidebar_wrapper = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar'); 10938 var horizontal_sidebar_wrapper_style = horizontal_sidebar_wrapper.attr('style'); 10939 var horizontal_sidebar_row = horizontal_sidebar_wrapper.find('.ajax-filter-sidebar-body .vc_row').eq(0); 10940 var horizontal_sidebar_row_style = horizontal_sidebar_row.attr('style'); 10941 10942 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar').attr('style', horizontal_sidebar_wrapper_style); 10943 container_to_append.find('.ajax-filter-position-horizontal .ajax-filter-sidebar-body .vc_row').eq(0).attr('style', horizontal_sidebar_row_style); 10944 } 10945 10946 // Append container 10947 container.replaceWith(container_to_append); 10948 10949 // Append pagination 10950 if (pagination.length > 0) { 10951 if (pagination_to_append.length > 0) { 10952 pagination.html(pagination_to_append.html()); 10953 } else { 10954 pagination.html(''); 10955 } 10956 } else { 10957 if (pagination_to_append.length > 0) { 10958 $('.post-wrapper').append(pagination_to_append); 10959 } 10960 } 10961 10962 // Update off canvas sidebar (mobile and overlay) 10963 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 10964 10965 if (offcanvas_sidebar_wrapper.length > 0 || UNCODE.wwidth < UNCODE.mediaQuery) { 10966 var sidebar_container = offcanvas_sidebar_wrapper.find('.vc_row').eq(0); 10967 var sidebar_to_append = $(response).find('.ajax-filter-sidebar-body').find('.vc_row').eq(0); 10968 container_to_append.find('.ajax-filter-sidebar-wrapper').after('<span class="ajax-sidebar-placeholder" />'); 10969 container_to_append.find('.ajax-filter-sidebar-wrapper').remove(); 10970 10971 // Update widgets state 10972 update_widgets_state(widgets_states, sidebar_to_append); 10973 10974 // Update sidebar 10975 sidebar_container.html(sidebar_to_append.html()); 10976 } 10977 10978 if (push) { 10979 UNCODE.lastURL = url; 10980 window.history.pushState( 10981 { pageTitle: document.title }, 10982 '', 10983 url 10984 ); 10985 } 10986 10987 if (typeof UNCODE.isotopeLayout !== 'undefined') { 10988 UNCODE.isotopeLayout(); 10989 } 10990 if (typeof UNCODE.justifiedGallery !== 'undefined') { 10991 UNCODE.justifiedGallery(); 10992 } 10993 if (typeof UNCODE.cssGrid !== 'undefined') { 10994 UNCODE.cssGrid(); 10995 } 10996 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 10997 UNCODE.lightbox(); 10998 } 10999 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 11000 UNCODE.lightgallery(); 11001 } 11002 if (typeof UNCODE.carousel !== 'undefined') { 11003 UNCODE.carousel($('body')); 11004 } 11005 UNCODE.animations(); 11006 if (typeof UNCODE.filters !== 'undefined') { 11007 UNCODE.filters(); 11008 } 11009 if (typeof UNCODE.widgets !== 'undefined') { 11010 UNCODE.widgets(); 11011 } 11012 11013 if (SiteParameters.dynamic_srcset_active === '1') { 11014 UNCODE.refresh_dynamic_srcset_size(); 11015 } 11016 11017 if (typeof UNCODE.menuSmartInit !== 'undefined') { 11018 UNCODE.menuSmartInit(); 11019 } 11020 11021 if (typeof UNCODE.parallax !== 'undefined') { 11022 UNCODE.parallax(); 11023 } 11024 11025 maybe_scroll_to_top(); 11026 11027 $(document).trigger('uncode-ajax-filtered'); 11028 $(document.body).trigger('init_price_filter'); 11029 } 11030 }, 11031 error: function() { 11032 container.removeClass('grid-filtering'); 11033 11034 if (SiteParameters.enable_debug == true) { 11035 // This console log is disabled by default 11036 // So nothing is printed in a typical installation 11037 // 11038 // It can be enabled for debugging purposes setting 11039 // the 'uncode_enable_debug_on_js_scripts' filter to true 11040 console.log('There was an error retrieving the products'); 11041 } 11042 } 11043 }); 11044 } 11045 11046 // Scroll to top after filtering 11047 function maybe_scroll_to_top() { 11048 var offcanvas_sidebar_wrapper = $('.ajax-filter-sidebar--offcanvas'); 11049 11050 if (offcanvas_sidebar_wrapper.length > 0) { 11051 return; 11052 } 11053 11054 var container = get_filters_container(); 11055 var bound = container[0].getBoundingClientRect(); 11056 11057 if (bound.y < 0) { 11058 $(window).scrollTop(container.offset().top); 11059 } 11060 } 11061 11062 // Back/forward browser buttons 11063 $(window).on("popstate.ajaxfilters", function(e) { 11064 var location = window.location; 11065 var url = location.href; 11066 var params = UNCODE.getURLParams(window.location); 11067 var old_params = UNCODE.getURLParams(UNCODE.lastURL, true); 11068 11069 UNCODE.lastURL = url; 11070 11071 if (UNCODE.hasEqualURLParams(params, old_params) || ($.isEmptyObject(params) && $.isEmptyObject(old_params))) { 11072 return; 11073 } 11074 11075 var container = get_filters_container(); 11076 11077 reload_items(container, url, false); 11078 }); 11079 11080 // Destroy load more before to init a new one 11081 $(window).on('uncode-ajax-pre-filtered', function() { 11082 if ($.fn.infinitescroll) { 11083 $('.cssgrid-infinite, .isotope-infinite').infinitescroll('destroy'); 11084 } 11085 }); 11086 11087 init_filters(); 11088}; 11089 11090UNCODE.videoThumbs = function() { 11091 var checkResize, 11092 newW = UNCODE.wwidth; 11093 var checkForVideos = function(){ 11094 11095 $(window).on('okevents.y.change', function(e, y){ 11096 var $video = $(y.target.g), 11097 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11098 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11099 restart = !$video_wrap.hasClass('play-pause'), 11100 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside')
11100: $video.closest('.t-entry-visual'), 11101 setTime; 11102 if ( newW >= UNCODE.mediaQuery ) { 11103 11104 if( $video_wrap.length && $video_wrap.data('hovered') !== true ) { 11105 $video_wrap.data('hovered', true); 11106 $video_wrap.addClass('played-on'); 11107 y.target.pauseVideo(); 11108 $tmb.on('mouseenter', function(){ 11109 if ( restart ) { 11110 y.target.seekTo(0); 11111 } 11112 y.target.playVideo(); 11113 }).on('mouseleave', function(){ 11114 clearTimeout(setTime); 11115 setTime = setTimeout(function(){ 11116 y.target.pauseVideo(); 11117 }, 300); 11118 }); 11119 } 11120 11121 } else { 11122 if( $mobile_video_wrap.length ) { 11123 $video_wrap.addClass('played-on'); 11124 y.target.playVideo(); 11125 } 11126 } 11127 11128 }); 11129 11130 $(window).on('okevents.v.loaded', function(e, playerV){ 11131 var $video = $(playerV.element), 11132 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11133 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11134 restart = !$video_wrap.hasClass('play-pause'), 11135 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'), 11136 setTime; 11137 11138 if ( newW >= UNCODE.mediaQuery ) { 11139 11140 if( $video_wrap.length ) { 11141 11142 var playPromise = playerV.play(); 11143 if (playPromise !== undefined) { 11144 playPromise.then(function( value ) { 11145 playerV.pause(); 11146 }); 11147 } 11148 $video_wrap.addClass('played-on'); 11149 $tmb.on('mouseenter', function(){ 11150 if ( restart ) { 11151 playerV.setCurrentTime(0) 11152 } 11153 playerV.play(); 11154 }).on('mouseleave', function(){ 11155 clearTimeout(setTime); 11156 setTime = setTimeout(function(){ 11157 playerV.pause(); 11158 }, 300); 11159 }); 11160 } 11161 11162 } else { 11163 11164 if( $mobile_video_wrap.length ) { 11165 var playPromise = playerV.play(); 11166 if (playPromise !== undefined) { 11167 playPromise.then(function( value ) { 11168 playerV.play(); 11169 }); 11170 } 11171 $video_wrap.addClass('played-on'); 11172 } 11173 } 11174 }); 11175 11176 $('.fluid-object.self-video.is-no-control video').each(function(key, video){ 11177 var $video = $(video), 11178 $noscript = $('noscript', $video), 11179 $video_wrap = $video.closest('.fluid-object.is-no-control.play-on-hover'), 11180 restart = !$video_wrap.hasClass('play-pause'), 11181 $mobile_video_wrap = $video.closest('.fluid-object.is-no-control.no-control-mobile-autoplay'), 11182 $tmb = $video.closest('.tmb-all-hover.tmb-content-under').length ? $video.closest('.t-inside') : $video.closest('.t-entry-visual'), 11183 setTime, 11184 manageVideo = function(){ 11185 video.currentTime = 0; 11186 video.pause(); 11187 if ( newW >= UNCODE.mediaQuery ) { 11188 if ( $video_wrap.length ) { 11189 $video_wrap.addClass('played-on'); 11190 $tmb.on('mouseenter', function(){ 11191 if ( restart ) { 11192 video.currentTime = 0; 11193 } 11194 video.play(); 11195 }).on('mouseleave', function(){ 11196 clearTimeout(setTime); 11197 setTime = setTimeout(function(){ 11198 video.pause(); 11199 }, 300); 11200 }); 11201 } else { 11202 video.play(); 11203 } 11204 } else { 11205 if ( $mobile_video_wrap.length ) { 11206 $mobile_video_wrap.addClass('played-on'); 11207 video.play(); 11208 } 11209 } 11210 11211 }; 11212 if ( $noscript.length && newW >= UNCODE.mediaQuery ) { 11213 $noscript.each(function(key, val){ 11214 $noscript.after(val.textContent || val.innerText); 11215 $noscript.remove(); 11216 }); 11217 } 11218 11219 if (typeof MediaElement === "function") { 11220 $video.has('source[src]').mediaelementplayer({ 11221 pauseOtherPlayers: false, 11222 }); 11223 } 11224 if (video.readyState > 0) { 11225 manageVideo(); 11226 } else { 11227 $video.on("loadedmetadata", function(_event) { 11228 manageVideo(); 11229 }); 11230 }; 11231 }); 11232 11233 }; 11234 11235 checkForVideos(); 11236 11237 var checkVideoResize = function(){ 11238 clearRequestTimeout(checkResize); 11239 checkResize = requestTimeout(function(){ 11240 if ( newW !== UNCODE.wwidth ) { 11241 checkForVideos(); 11242 newW = UNCODE.wwidth; 11243 } 11244 }, 1000); 11245 }; 11246 11247 $(window).off('resize.videos', checkVideoResize) 11248 .on( 'resize.videos', checkVideoResize); 11249 11250}; 11251UNCODE.lottie = function() { 11252 if ( SiteParameters.is_frontend_editor ) { 11253 var $lottie_wraps = $('div.uncode-lottie-wrap'); 11254 $lottie_wraps.each(function(){ 11255 var $lottie_wrap = $(this), 11256 $div_player = $('div.uncode-lottie-player', $lottie_wrap), 11257 $player_clone = $div_player.clone(), 11258 player_id = $div_player.attr('data-id'), 11259 $lottie_players = $('lottie-player', $lottie_wrap).remove(); 11260 if ( $div_player.attr('data-init') !== true && $player_clone.length ) { 11261 if ( $('#'+player_id).length ) { 11262 player_id += '_' + Math.floor(Math.random() * 10000000000000000); 11263 } 11264 $player_clone.attr('id', player_id); 11265 $player_clone = $player_clone[0].outerHTML.replace("<div", "<lottie-player").replace("</div", "</lottie-player"); 11266 $div_player.after($player_clone); 11267 $div_player.attr('data-init',true); 11268 } 11269 }); 11270 } 11271 var $players = $('.uncode-lottie-wrap lottie-player'); 11272 $players.each(function(){ 11273 var player = this, 11274 this_id = $(player).attr('id'), 11275 _player = document.getElementById(this_id), 11276 trigger = $(player).attr('data-trigger'), 11277 pFrames = $(player).attr('data-frames').split(','), 11278 srcPlayer = $(player).attr('src'); 11279 11280 _player.load(srcPlayer); 11281 11282 _player.addEventListener("ready", function() { 11283 11284 var $_shadow = _player.shadowRoot; 11285 $($_shadow).find('.error').remove(); 11286 11287 var tFrames = _player.getLottie().totalFrames / 100, 11288 pFrame_from = Math.round(tFrames * pFrames[0]), 11289 pFrame_to = Math.round( tFrames * pFrames[1] ) - 1, 11290 loop = $(player).attr('loop'), 11291 mode, 11292 actions; 11293 11294 if ( typeof trigger !== 'undefined' && typeof LottieInteractivity !== 'undefined' ) { 11295 if ( trigger === 'scroll' ) { 11296 mode = 'scroll'; 11297 actions = [ 11298 { 11299 visibility:[0, 1.0], 11300 type: "seek",
11301 frames: [pFrame_from, pFrame_to], 11302 } 11303 ]; 11304 } else if ( trigger === 'viewport') { 11305 mode = 'scroll'; 11306 actions = [ 11307 { 11308 visibility: [0.20, 1.0], 11309 frames: [pFrame_from, pFrame_to], 11310 type: loop ? "loop" : "play" 11311 } 11312 ]; 11313 } else if ( trigger === 'hover') { 11314 $(player).on('mouseenter', function(){ 11315 _player.play(); 11316 }).on('mouseleave', function(){ 11317 _player.pause(); 11318 }); 11319 if ( pFrame_from > 0 && pFrame_from < 99 ) { 11320 _player.seek(pFrame_from); 11321 _player.addEventListener("frame", function(){ 11322 if ( _player.getLottie().currentFrame >= pFrame_to ) { 11323 _player.seek(pFrame_from); 11324 } 11325 }); 11326 } 11327 } 11328 LottieInteractivity.create({
11329 player: '#' + this_id, 11330 mode: mode, 11331 actions: actions 11332 }); 11333 } else { 11334 if ( pFrame_from > 0 && pFrame_from < 99 ) { 11335 _player.seek(pFrame_from); 11336 _player.addEventListener("frame", function(){ 11337 if ( _player.getLottie().currentFrame >= pFrame_to ) { 11338 _player.seek(pFrame_from); 11339 } 11340 }); 11341 } 11342 } 11343 }); 11344 11345 $(window).on('unlottie-destroy', function(){ 11346 _player.destroy(); 11347 }); 11348 }); 11349}; 11350 11351 UNCODE.init = function() { 11352 var wfl_check = false, wfl_request, waypoint_request; 11353 UNCODE.preventDoubleTransition(); 11354 UNCODE.betterResize(); 11355 UNCODE.utils(); 11356 if (typeof UNCODE.changeSkinOnScroll !== 'undefined') { 11357 UNCODE.changeSkinOnScroll(); 11358 } 11359 if (typeof UNCODE.share !== 'undefined') { 11360 UNCODE.share(); 11361 } 11362 if (typeof UNCODE.tooltip !== 'undefined') { 11363 UNCODE.tooltip(); 11364 } 11365 if (typeof UNCODE.counters !== 'undefined') { 11366 UNCODE.counters(); 11367 } 11368 if (typeof UNCODE.countdowns !== 'undefined') { 11369 UNCODE.countdowns(); 11370 } 11371 if (typeof UNCODE.tabs !== 'undefined') { 11372 UNCODE.tabs(); 11373 } 11374 if (typeof UNCODE.collapse !== 'undefined') { 11375 UNCODE.collapse(); 11376 } 11377 if (typeof UNCODE.bigText !== 'undefined') { 11378 UNCODE.bigText(); 11379 } 11380 UNCODE.menuSystem(); 11381 if (typeof UNCODE.bgChanger !== 'undefined') { 11382 UNCODE.bgChanger(); 11383 } 11384 if (typeof UNCODE.magicCursor !== 'undefined') { 11385 UNCODE.magicCursor(); 11386 } 11387 if (typeof UNCODE.magneticCursor !== 'undefined') { 11388 UNCODE.magneticCursor(); 11389 } 11390 if (typeof UNCODE.dropImage !== 'undefined') { 11391 UNCODE.dropImage(); 11392 } 11393 if (typeof UNCODE.postTable !== 'undefined') { 11394 UNCODE.postTable(); 11395 } 11396 if (typeof UNCODE.rotatingTxt !== 'undefined') { 11397 UNCODE.rotatingTxt(); 11398 } 11399 if (typeof UNCODE.okvideo !== 'undefined') { 11400 UNCODE.okvideo(); 11401 } 11402 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 11403 UNCODE.backgroundSelfVideos(); 11404 } 11405 UNCODE.tapHover(); 11406 if (typeof UNCODE.isotopeLayout !== 'undefined') { 11407 UNCODE.isotopeLayout(); 11408 } 11409 if (typeof UNCODE.justifiedGallery !== 'undefined') { 11410 UNCODE.justifiedGallery(); 11411 } 11412 if (typeof UNCODE.cssGrid !== 'undefined') { 11413 UNCODE.cssGrid(); 11414 } 11415 if (typeof UNCODE.lightbox !== 'undefined' && !SiteParameters.lbox_enhanced) { 11416 UNCODE.lightbox(); 11417 } 11418 if (typeof UNCODE.lightgallery !== 'undefined' && SiteParameters.lbox_enhanced) { 11419 $(window).on('load',function(){ 11420 UNCODE.lightgallery(); 11421 }); 11422 } 11423 if (typeof UNCODE.carousel !== 'undefined') { 11424 UNCODE.carousel($('body')); 11425 } 11426 if (typeof UNCODE.lettering !== 'undefined') { 11427 UNCODE.lettering(); 11428 } 11429 UNCODE.animations(); 11430 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 11431 UNCODE.stickyElements(); 11432 } 11433 if (typeof UNCODE.twentytwenty !== 'undefined') { 11434 UNCODE.twentytwenty(); 11435 } 11436 UNCODE.disableHoverScroll(); 11437 UNCODE.printScreen(); 11438 if (typeof UNCODE.particles !== 'undefined') { 11439 UNCODE.particles(); 11440 } 11441 if (typeof UNCODE.filters !== 'undefined') { 11442 UNCODE.filters(); 11443 } 11444 if (typeof UNCODE.ajax_filters !== 'undefined') { 11445 UNCODE.ajax_filters(); 11446 } 11447 if (typeof UNCODE.widgets !== 'undefined') { 11448 UNCODE.widgets(); 11449 } 11450 if (typeof UNCODE.unmodal !== 'undefined') { 11451 UNCODE.unmodal(); 11452 } 11453 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 11454 if ( !UNCODE.isFullPage ) { 11455 UNCODE.checkScrollForTabs(); 11456 } 11457 } 11458 if (typeof UNCODE.onePage !== 'undefined') { 11459 UNCODE.onePage(UNCODE.isMobile); 11460 } 11461 if (typeof UNCODE.fullPage !== 'undefined') { 11462 $(document).ready(function(){ 11463 UNCODE.fullPage(); 11464 }); 11465 } 11466 if (typeof UNCODE.skewIt !== 'undefined') { 11467 UNCODE.skewIt(); 11468 } 11469 if (typeof UNCODE.rotateIt !== 'undefined') { 11470 UNCODE.rotateIt(); 11471 } 11472 if (typeof UNCODE.textMarquee !== 'undefined') { 11473 UNCODE.textMarquee(); 11474 } 11475 if (typeof UNCODE.stickyScroll !== 'undefined') { 11476 UNCODE.stickyScroll(); 11477 } 11478 if (typeof UNCODE.stickyTrigger !== 'undefined') { 11479 UNCODE.stickyTrigger(); 11480 } 11481 if (typeof UNCODE.verticalText !== 'undefined') { 11482 UNCODE.verticalText(); 11483 } 11484 if (typeof UNCODE.videoThumbs !== 'undefined') { 11485 UNCODE.videoThumbs(); 11486 } 11487 if (typeof UNCODE.revslider !== 'undefined') { 11488 UNCODE.revslider(); 11489 } 11490 if (typeof UNCODE.layerslider !== 'undefined') { 11491 UNCODE.layerslider(); 11492 } 11493 if (typeof UNCODE.lottie !== 'undefined') { 11494 UNCODE.lottie(); 11495 } 11496 $(window).on('load',function(){ 11497 clearRequestTimeout(waypoint_request);
11498 waypoint_request = requestTimeout( function(){ 11499 Waypoint.refreshAll(); 11500 }, 1000); 11501 11502 if (typeof UNCODE.parallax !== 'undefined') { 11503 UNCODE.parallax(); 11504 } 11505 }); 11506 } 11507 11508 if ( ! SiteParameters.is_frontend_editor ) { 11509 UNCODE.init(); 11510 } 11511 11512 11513})(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.