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 55Number.isInteger = Number.isInteger || function(value) { 56 return typeof value === "number" && 57 isFinite(value) && 58 Math.floor(value) === value; 59}; 60 61UNCODE.utils = function() { 62 $(document).on('mouseover', 'a', function() { 63 $(this).attr('data-title', $(this).attr('title')); 64 $(this).removeAttr('title'); 65 }); 66 $(document).on('mouseout', 'a', function() { 67 $(this).attr('title', $(this).attr('data-title')); 68 $(this).removeAttr('data-title'); 69 }); 70 71 this.get_scroll_offset = function(e) { 72 73 var scroll_offset = 0, 74 is_first_link = false, 75 target, 76 trigger; 77 78 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 79 target = e.target; 80 trigger = e.currentTarget; 81 } 82 83 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 84 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 85 UNCODE.hideMenu(100); 86 } 87 } 88 89 if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { 90 if ( UNCODE.wwidth < UNCODE.mediaQuery && $('body').hasClass('menu-mobile-transparent') ) { 91 if ( $('.menu-sticky').length && !$('.menu-hide').length ) { 92 scroll_offset += $('#logo-container-mobile').outerHeight(); 93 } 94 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 95 scroll_offset += $('.menu-sticky .menu-container').outerHeight(); 96 } else { 97 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 98 scroll_offset += UNCODE.menuMobileHeight; 99 } else { 100 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 ) { 101 scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 102 } else { 103 if ( $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 104 scroll_offset += UNCODE.menuMobileHeight; 105 } 106 } 107 } 108 } 109 } 110 111 scroll_offset += UNCODE.bodyBorder; 112 113 return scroll_offset; 114 } 115 116 if ( !UNCODE.isFullPage ) { 117 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link)', function(e) { 118 119 var hash = (e.currentTarget).hash, 120 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 121 anchor = ''; 122 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 123 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 124 e.preventDefault(); 125 if (!$('#tab-reviews').is(':visible')) { 126 $('a[href="#tab-reviews"]').trigger('click'); 127 } 128 var calc_scroll = $('.wootabs .tab-content').offset().top; 129 calc_scroll -= UNCODE.get_scroll_offset(e); 130 131 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 132 133 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 134 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 135 } 136 137 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 138 delta = bodyTop - calc_scroll, 139 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 140 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 141 142 requestTimeout(function(){ 143 if (scrollSpeed == 0) { 144 $('html, body').scrollTop(calc_scroll); 145 UNCODE.scrolling = false;
146 } else { 147 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 148 $(this).stop(); 149 }).animate({ 150 scrollTop: calc_scroll 151 }, scrollSpeed, 'easeInOutCubic', function() { 152 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 153 UNCODE.scrolling = false; 154 } 155 ); 156 } 157 }, 200); 158 return; 159 } 160 if (hash != undefined) { 161 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 162 var anchor = this.hash.slice(1); 163 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 164 if ( !specialFormat.test(hash) ) { 165 if ( $(hash).length ) 166 anchor = $(hash); 167 } 168 } 169 } 170 171 if (is_scrolltop || anchor != '') { 172 if (is_scrolltop) { 173 e.preventDefault(); 174 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 175 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 176 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 177 178 if (scrollSpeed == 0) { 179 $('html, body').scrollTop(0); 180 UNCODE.scrolling = false; 181 } else { 182 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 183 $(this).stop(); 184 }).animate({ 185 scrollTop: 0 186 }, scrollSpeed, 'easeInOutCubic', function() { 187 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 188 UNCODE.scrolling = false; 189 }); 190 } 191 } else { 192 var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor; 193 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 194 var get_href = $(val).attr('href'); 195 if (get_href != undefined) { 196 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 197 else $(val).parent().removeClass('active'); 198 } 199 }); 200 if (scrollSection.length) { 201 if ( $('body').hasClass('uncode-scroll-no-history') ) { 202 e.preventDefault(); 203 } 204 205 if (UNCODE.menuOpened) { 206 if (UNCODE.wwidth < UNCODE.mediaQuery) { 207 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 208 } else { 209 $('.mmb-container-overlay .overlay-close').trigger('click'); 210 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 211 } 212 } 213 214 var calc_scroll = scrollSection.offset().top, 215 getOffset = UNCODE.get_scroll_offset(e), 216 $logo = $('#logo-container-mobile'), 217 logoH, 218 $menu = $('#masthead .menu-container'), 219 menuH; 220 221 calc_scroll -= getOffset; 222 223 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 224 delta = bodyTop - calc_scroll, 225 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 226 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 227 228 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') ) { 229 logoH = $logo.outerHeight(), 230 menuH = $menu.outerHeight(); 231 if ( calc_scroll < ( logoH + menuH ) ) { 232 calc_scroll = 0; 233 } 234 } 235 236 if (scrollSpeed == 0) { 237 $('html, body').scrollTop(calc_scroll); 238 UNCODE.scrolling = false; 239 } else { 240 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 241 $(this).stop(); 242 }).animate({ 243 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 244 }, scrollSpeed, 'easeInOutCubic', function() { 245 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 246 UNCODE.scrolling = false; 247 if (getOffset != UNCODE.get_scroll_offset(e)) { 248 calc_scroll = scrollSection.offset().top; 249 getOffset = UNCODE.get_scroll_offset(e); 250 calc_scroll -= getOffset; 251 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 252 $(this).stop(); 253 }).animate({ 254 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 255 }, scrollSpeed, 'easeInOutCubic', function() { 256 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 257 UNCODE.scrolling = false;
258 } 259 ); 260 } 261 }); 262 } 263 } 264 } 265 } 266 }); 267 $('.header-scrolldown').on('click', function(event) { 268 269 event.preventDefault(); 270 271 var pageHeader = $(event.target).closest('#page-header'), 272 pageHeaderTop = pageHeader.offset().top, 273 pageHeaderHeight = pageHeader.outerHeight(), 274 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 275 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 276 277 var calc_scroll = pageHeaderTop + pageHeaderHeight, 278 getOffset = UNCODE.get_scroll_offset(event); 279 calc_scroll -= getOffset; 280 281 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 282 283 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 284 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 285 } 286 287 if (scrollSpeed == 0) { 288 $('html, body').scrollTop(calc_scroll); 289 UNCODE.scrolling = false; 290 } else { 291 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 292 $(this).stop(); 293 }).animate({ 294 scrollTop: calc_scroll 295 }, scrollSpeed, 'easeInOutCubic', function() { 296 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 297 UNCODE.scrolling = false; 298 if (getOffset != UNCODE.get_scroll_offset(event)) { 299 calc_scroll = pageHeaderTop + pageHeaderHeight; 300 getOffset = UNCODE.get_scroll_offset(event); 301 calc_scroll -= getOffset; 302 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 303 $(this).stop(); 304 }).animate({ 305 scrollTop: calc_scroll 306 }, scrollSpeed, 'easeInOutCubic', function() { 307 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 308 UNCODE.scrolling = false; 309 } 310 ); 311 } 312 } 313 ); 314 } 315 }); 316 } 317 318 // Colomun hover effect 319 // ================= 320 $(document).on('mouseenter', '.col-link', function(e) { 321 var uncol = $(e.target).prev('.uncol'), 322 el = uncol.find('.column-background'); 323 if (el) { 324 $('.btn-container .btn', uncol).toggleClass('active'); 325 var elOverlay = $(el[0]).find('.block-bg-overlay'); 326 if (elOverlay.length) { 327 var getOpacity = $(elOverlay).css('opacity'); 328 if (getOpacity != 1) { 329 getOpacity = Math.round(getOpacity * 100) / 100; 330 var newOpacity = getOpacity + .1; 331 $(elOverlay).data('data-opacity', getOpacity); 332 $(elOverlay).css('opacity', newOpacity); 333 } 334 } 335 } 336 }).on('mouseleave', '.col-link', function(e) { 337 var uncol = $(e.target).prev('.uncol'), 338 el = uncol.find('.column-background'); 339 $('.btn-container .btn', uncol).toggleClass('active'); 340 if (el) { 341 var elOverlay = $(el[0]).find('.block-bg-overlay'); 342 if (elOverlay.length) { 343 var getOpacity = $(elOverlay).data('data-opacity'); 344 $(elOverlay).css('opacity', getOpacity); 345 } 346 } 347 }); 348 349 // Admin bar 350 // ============ 351 var fixAdminBar = function() { 352 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 353 var getAdminBar = $('#wpadminbar'); 354 if (getAdminBar.length) { 355 if (getAdminBar.css('position') !== 'hidden') { 356 var getAdminBarHeight = getAdminBar.height(); 357 if (getAdminBar.css('position') === 'fixed') { 358 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 359 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 360 } else { 361 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 362 $('.body-borders .top-border').css({'margin-top':'0px'}); 363 } 364 } 365 } 366 } 367 }; 368 window.addEventListener('load', fixAdminBar); 369 window.addEventListener('resize', fixAdminBar); 370 // Print 371 // =========== 372 var beforePrint = function() { 373 window.dispatchEvent(new CustomEvent('resize')); 374 window.dispatchEvent(UNCODE.boxEvent); 375 }; 376 377 if (window.matchMedia) { 378 var mediaQueryList = window.matchMedia('print'); 379 mediaQueryList.addListener(function(mql) { 380 if (mql.matches) { 381 beforePrint(); 382 } 383 }); 384 } 385 386 window.onbeforeprint = beforePrint; 387} 388 389UNCODE.lettering = function() { 390 391 var setCTA; 392 var highlightStill = function(){ 393 394 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 395 396 $.each($heading_texts, function(key, el) { 397 var $heading = $(el); 398 399 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 400 return; 401 } 402 403 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 404 return; 405 } 406 407 var waypoint = new Waypoint({ 408 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 409 element: el, 410 handler: function() { 411 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 412 anims_l = $anims.length; 413 $anims.each(function(_key_, _el_){ 414 var $anim = $(_el_); 415 416 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 417 $anim.addClass('heading-text-highlight-animated'); 418 419 if ( $heading.data('animate') === true ) { 420 $anim.css({ 421 '-webkit-transition-duration': '0ms', 422 '-moz-transition-duration': '0ms', 423 '-o-transition-duration': '0ms', 424 'transition-duration': '0ms', 425 }); 426 } else { 427 $anim.css({ 428 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 429 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 430 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 431 'transition-delay': ((_key_ + 2) * 200) + 'ms', 432 }); 433 } 434 } 435 436 }); 437 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 438 $heading.data('animate', true); 439 }); 440 $anims.removeAttr('data-animated'); 441 }, 442 offset: '100%' 443 }); 444 445 }); 446 447 Waypoint.refreshAll(); 448 $( document.body ).trigger('uncode_waypoints'); 449 450 } 451 452 requestTimeout(function(){ 453 highlightStill(); 454 $(window).on( 'resize', function(){ 455 clearRequestTimeout(setCTA); 456 setCTA = requestTimeout( highlightStill, 100 ); 457 }); 458 }, 400); 459 460}; 461 462UNCODE.isUnmodalOpen = false;
463 464var manageVideoSize = function(){ 465 466 var setVideoFit; 467 $('.wp-block-embed').each(function(){ 468 469 var $this = $(this); 470 471 if ( $('iframe', $this).length ) { 472 473 var $iframe = $('> iframe, > a > iframe', $this), 474 w = parseFloat($iframe.attr('width')), 475 h = parseFloat($iframe.attr('height')), 476 url = $iframe.attr('src'), 477 ratio, frW; 478 479 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 480 481 ratio = h / w; 482 var setResizeiFto, 483 resizeiFrame = function(){ 484 frW = $iframe.width(); 485 $iframe.css({ 486 height: frW * ratio 487 }); 488 }; 489 resizeiFrame(); 490 $(window).on( 'resize load', function(){ 491 clearRequestTimeout(setResizeiFto); 492 setResizeiFto = requestTimeout( function() { 493 resizeiFrame(); 494 }, 10 ); 495 }); 496 497 } 498 499 } 500 501 }); 502 503}; 504 505manageVideoSize(); 506 507UNCODE.vivus = function(icon, time, delay, file) { 508 if (typeof Vivus !== 'undefined') { 509 var icon_options = { 510 type: 'delayed', 511 pathTimingFunction: Vivus.EASE_OUT, 512 animTimingFunction: Vivus.LINEAR, 513 duration: time, 514 } 515 516 if (delay) { 517 icon_options.delayStart = delay; 518 } 519 520 if (file) { 521 icon_options.file = file; 522 } 523 524 new Vivus(icon, icon_options); 525 } 526}; 527 528UNCODE.share = function() { 529 if (typeof Share !== 'undefined') { 530 var share_button_element = $('.share-button'); 531 var share_button_url = share_button_element.data('url'); 532 533 var share_button_config = { 534 ui: { 535 flyout: "top center", 536 button_font: false, 537 button_text: '', 538 icon_font: false 539 } 540 }; 541 542 if (share_button_url) { 543 share_button_config.url = share_button_url.replace("&", "%26"); 544 } 545 546 var share_button_top = new Share('.share-button', share_button_config); 547 } 548}; 549 550UNCODE.tooltip = function() { 551 if (typeof jQuery.fn.tooltip !== 'undefined') { 552 $('.btn-tooltip').tooltip(); 553 } 554}; 555 556UNCODE.counters = function() { 557 var $counters = $('.counter:not(.counter-init)'); 558 $counters.each(function(){ 559 var $counter = $(this).addClass('counter-init'); 560 if ( $counter.closest( '.owl-carousel' ).length ) { 561 return; 562 } 563 $counter.addClass('started').counterUp({ 564 delay: 10, 565 time: 1500 566 }); 567 }); 568}; 569 570UNCODE.countdowns = function() { 571 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 572 $countdowns.each(function() { 573 var $this = $(this).addClass('counter-init'), 574 finalDate = $(this).data('uncode-countdown'); 575 $this.countdown(finalDate, function(event) { 576 $this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>')); 577 }); 578 }); 579}; 580 581UNCODE.tabs = function() { 582 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { 583 e.preventDefault() 584 $(this).tab('show'); 585 requestTimeout(function() { 586 window.dispatchEvent(UNCODE.boxEvent); 587 }, 300); 588 }); 589}; 590 591UNCODE.collapse = function() { 592 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 593 var $this = $(this), 594 href 595 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 596 var $target = $(target) 597 var data = $target.data('bs.collapse') 598 var option = data ? 'toggle' : $this.data() 599 var parent = $this.attr('data-parent') 600 var $parent = parent && $(parent) 601 var $title = $(this).parent() 602 if ($parent) { 603 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 604 if ($title.hasClass('active')) { 605 $title.removeClass('active'); 606 } else { 607 $parent.find('.panel-title').removeClass('active') 608 $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') 609 } 610 } 611 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 612 }); 613}; 614 615UNCODE.bigText = function(el) { 616 if (el == undefined) { 617 el = $('body'); 618 } 619 $.each($('.bigtext', el), function(index, val) { 620 $(val).bigtext({ 621 minfontsize: 24 622 }); 623 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 624 opacity: 1 625 }); 626 requestTimeout(function() { 627 if ($(val).find('.animate_when_almost_visible').length != 0) { 628 $(val).css({opacity: 1}); 629 } 630 }, 400); 631 }); 632}; 633 634UNCODE.process_shortpixel_image = function(image) { 635 var data = { 636 action: 'shortpixel_manual_optimization', 637 image_id: image,
638 cleanup: true 639 }; 640 641 $.get(SiteParameters.ajax_url, data); 642}; 643 644UNCODE.menuSystem = function() { 645 646 function menuMobile() { 647 var $body = $('body'), 648 $mobileToggleButton = $('.mobile-menu-button'), 649 $box, 650 $el, 651 $el_transp, 652 elHeight, 653 check, 654 animating = false, 655 stickyMobile = false, 656 menuClose = new CustomEvent('menuMobileClose'), 657 menuOpen = new CustomEvent('menuMobileOpen'); 658 UNCODE.menuOpened = false; 659 $mobileToggleButton.on('click', function(event) { 660 var btn = this; 661 if ($(btn).hasClass('overlay-close')) return; 662 event.preventDefault(); 663 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 664 $box = $(this).closest('.box-container').find('.main-menu-container'); 665 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 666 $el_transp = $('.menu-absolute.menu-transparent'); 667 if (UNCODE.isMobile) { 668 if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered').length ) { 669 stickyMobile = true; 670 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 671 } else { 672 elHeight = 0; 673 $.each($box.find('> div'), function(index, val) { 674 elHeight += $(val).outerHeight(); 675 }); 676 } 677 } else { 678 elHeight = 0; 679 $.each($el, function(index, val) { 680 elHeight += $(val).outerHeight(); 681 }); 682 } 683 var open = function() { 684 if (!animating) { 685 $body.addClass('open-overlay-menu'); 686 window.dispatchEvent(menuOpen); 687 animating = true; 688 UNCODE.menuOpened = true; 689 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 690 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 691 if ($('body.menu-offcanvas').length) { 692 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); 693 $('.vmenu-container.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 694 } else { 695 if ( $('.menu-hide, .menu-sticky').length ) { 696 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 697 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); 698 } 699 } 700 } 701 } 702 if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) { 703 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 704 } 705 btn.classList.add('close'); 706 $box.addClass('open-items'); 707 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 708 $el_transp.addClass('is_mobile_open'); 709 } 710 $box.animate({ 711 height: elHeight 712 }, 600, "easeInOutCirc", function() { 713 animating = false; 714 if (!stickyMobile) $box.css('height', 'auto'); 715 }); 716 } 717 }; 718 719 var close = function() { 720 if (!animating) { 721 window.dispatchEvent(menuClose); 722 animating = true; 723 UNCODE.menuOpened = false; 724 btn.classList.remove('close'); 725 btn.classList.add('closing'); 726 $box.addClass('close'); 727 requestTimeout(function() { 728 $box.removeClass('close'); 729 $box.removeClass('open-items'); 730 btn.classList.remove('closing'); 731 if ($el_transp.length) { 732 $el_transp.removeClass('is_mobile_open'); 733 } 734 }, 500); 735 $box.animate({ 736 height: 0 737 }, { 738 duration: 600, 739 easing: "easeInOutCirc", 740 complete: function(elements) { 741 $(elements).css('height', ''); 742 animating = false; 743 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 744 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.isotope-filters)').css('position','relative'); 745 } 746 $body.removeClass('open-overlay-menu'); 747 } 748 }); 749 } 750 }; 751 check = (!UNCODE.menuOpened) ? open() : close(); 752 } 753 }); 754 window.addEventListener('menuMobileTrigged', function(e) { 755 $('.mobile-menu-button.close').trigger('click'); 756 }); 757 window.addEventListener('orientationchange', function(e) { 758 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 759 }); 760 window.addEventListener("resize", function() { 761 if ($(window).width() < UNCODE.mediaQuery) { 762 if (UNCODE.isMobile) { 763 var $box = $('.box-container .main-menu-container'), 764 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 765 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') { 766 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 767 elHeight = 0; 768 $.each($el, function(index, val) { 769 elHeight += $(val).outerHeight(); 770 }); 771 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; 772 $($box).css('height', elHeight + 'px'); 773 } 774 } 775 } 776 } else { 777 $('.menu-hide-vertical').removeAttr('style'); 778 $('.menu-container-mobile').removeAttr('style'); 779 $('.vmenu-container.menu-container').removeAttr('style'); 780 } 781 }); 782 }; 783 784 function menuOffCanvas() { 785 var menuClose = new CustomEvent('menuCanvasClose'), 786 menuOpen = new CustomEvent('menuCanvasOpen'); 787 $('.menu-primary .menu-button-offcanvas').click(function(event) { 788 if ($(window).width() > UNCODE.mediaQuery) { 789 if ($(event.currentTarget).hasClass('close')) { 790 $(event.currentTarget).removeClass('close'); 791 $(event.currentTarget).addClass('closing'); 792 requestTimeout(function() { 793 $(event.currentTarget).removeClass('closing'); 794 window.dispatchEvent(menuClose); 795 }, 500); 796 797 } else { 798 $(event.currentTarget).addClass('close'); 799 window.dispatchEvent(menuOpen); 800 } 801 } 802 803 $('body').toggleClass('off-opened'); 804 }); 805 }; 806 function menuSmart() { 807 var $menusmart = $('[class*="menu-smart"]'), 808 $masthead = $('#masthead'), 809 $hMenu = $('.menu-horizontal-inner', $masthead),
810 $focus = $('.overlay-menu-focus'), 811 showTimeout = 50, 812 hideTimeout = 50, 813 showTimeoutFunc, hideTimeoutFunc; 814 815 $('> li.menu-item-has-children', $menusmart).hover(function(){ 816 $(this).data('hover', true); 817 }, function(){ 818 $(this).data('hover', false); 819 }); 820 821 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 822 var $notLis = $('> .nav > ul > li a', $hMenu), 823 $menuA = $('a', $masthead).not($notLis), 824 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 825 showFuncCond = function() { return true }; 826 827 if ( $('body').hasClass('focus-megamenu') ) { 828 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 829 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 830 } else if ( $('body').hasClass('focus-links') ) { 831 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 832 } 833 834 $hoverSelector.hover(function(){ 835 clearRequestTimeout(hideTimeoutFunc); 836 showTimeoutFunc = requestTimeout(function(){ 837 $('body').addClass('navbar-hover'); 838 }, showTimeout*2); 839 }, function(){ 840 hideTimeoutFunc = requestTimeout(function(){ 841 $('body').removeClass('navbar-hover'); 842 }, hideTimeout*2); 843 }); 844 } else { 845 showFuncCond = function() { return false }; 846 } 847 848 if ($menusmart.length > 0) { 849 $menusmart.smartmenus({ 850 subIndicators: false, 851 subIndicatorsPos: 'append', 852 //subMenusMinWidth: '13em', 853 subIndicatorsText: '', 854 showTimeout: showTimeout, 855 hideTimeout: hideTimeout, 856 showFunction: function($ul, complete) { 857 clearRequestTimeout(showTimeoutFunc); 858 $ul.fadeIn(0, 'linear', function(){ 859 complete(); 860 if ( $ul.hasClass('vc_row') ) { 861 $ul.css({ 862 'display': 'table' 863 }); 864 } 865 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 866 $('body').addClass('open-megamenu'); 867 } 868 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { 869 $('body').addClass('navbar-hover'); 870 } 871 }).addClass('open-animated'); 872 }, 873 hideFunction: function($ul, complete) { 874 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 875 $('body').removeClass('open-megamenu'); 876 } 877 var fixIE = $('html.ie').length; 878 if (fixIE) { 879 var $rowParent = $($ul).closest('.main-menu-container'); 880 $rowParent.height('auto'); 881 } 882 $ul.fadeOut(0, 'linear', function(){ 883 complete(); 884 $ul.removeClass('open-animated'); 885 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 886 $('body').removeClass('open-submenu'); 887 } 888 }); 889 }, 890 collapsibleShowFunction: function($ul, complete) { 891 $ul.slideDown(400, 'easeInOutCirc', complete); 892 }, 893 collapsibleHideFunction: function($ul, complete) { 894 $ul.slideUp(200, 'easeInOutCirc', complete); 895 }, 896 hideOnClick: true 897 }); 898 899 if ( $('body').hasClass('menu-accordion-active') ) { 900 requestTimeout(function(){ 901 $menusmart.addClass('menu-smart-init'); 902 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 903 }, 1000); 904 } 905 } 906 907 }; 908 function menuOverlay() { 909 if ( $('.overlay').length ) { 910 $('.overlay').removeClass('hidden'); 911 } 912 if ($('.overlay-sequential, .menu-mobile-animated').length > 0) { 913 $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) { 914 var transDelay = (index / 20) + 0.1; 915 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 916 transDelay = transDelay + 0.3; 917 $(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'); 918 }); 919 } 920 }; 921 function menuAppend() { 922 var $body = $('body'), 923 $menuCont = $('.menu-container'), 924 $cta = $('.navbar-cta'), 925 $socials = $('.navbar-social'), 926 $ul = $('.navbar-main ul.menu-primary-inner'), 927 $ulCta, 928 $ulSocials, 929 $firstMenu = $('.main-menu-container:first-child', $menuCont), 930 $secondMenu = $('.main-menu-container:last-child', $menuCont), 931 $firstNav = $('.navbar-nav:first-child', $firstMenu), 932 $secondNav = $('.navbar-nav:first-child', $secondMenu), 933 $ulFirst = $('> ul', $firstNav), 934 $ulSecond = $('> ul', $secondNav), 935 setCTA, 936 appendCTA = function(){ 937 return true; 938 }, 939 appendSocials = function(){ 940 return true; 941 }, 942 appendSplit = function(){ 943 return true; 944 }; 945 946 if ( $body.hasClass('cta-not-appended') ) 947 return false;
948 949 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 950 $ulCta = $('> ul', $cta); 951 952 appendCTA = function(){ 953 if (UNCODE.wwidth < UNCODE.mediaQuery) { 954 $ul.after($ulCta); 955 } else { 956 $cta.append($ulCta); 957 } 958 } 959 } 960 appendCTA(); 961 962 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) { 963 $ulSocials = $('> ul', $socials); 964 965 appendSocials = function(){ 966 if (UNCODE.wwidth < UNCODE.mediaQuery) { 967 $ul.after($ulSocials); 968 } else { 969 $socials.append($ulSocials); 970 } 971 } 972 } 973 appendSocials(); 974 975 if ( ( $body.hasClass('hmenu-center-double') ) ) { 976 appendSplit = function(){ 977 if (UNCODE.wwidth < UNCODE.mediaQuery) { 978 if ( $secondNav.length ) { 979 $secondNav.prepend($ulFirst); 980 } 981 $firstMenu.hide(); 982 } else { 983 $firstNav.append($ulFirst); 984 $firstMenu.css({ 985 'display': 'table-cell' 986 }); 987 } 988 } 989 } 990 appendSplit(); 991 992 $(window).on( 'resize', function(){ 993 clearRequestTimeout(setCTA); 994 setCTA = requestTimeout( function() { 995 appendCTA(); 996 appendSocials(); 997 appendSplit(); 998 }, 10 ); 999 }); 1000 } 1001 //menuMobileButton(); 1002 menuMobile(); 1003 menuOffCanvas(); 1004 menuSmart(); 1005 menuAppend(); 1006 menuOverlay(); 1007 var setMenuOverlay; 1008 $(window).on( 'resize', function(){ 1009 if ( $('.overlay').length && $(window).width() > 1024 ) { 1010 $('.overlay').addClass('hidden'); 1011 } 1012 clearRequestTimeout(setMenuOverlay); 1013 setMenuOverlay = requestTimeout( menuOverlay, 150 ); 1014 }); 1015}; 1016 1017UNCODE.okvideo = function() { 1018 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 1019 $.okvideo = function(options) { 1020 // if the option var was just a string, turn it into an object 1021 if (typeof options !== 'object') options = { 1022 'video': options 1023 }; 1024 var base = this; 1025 // kick things off 1026 base.init = function() { 1027 base.options = $.extend({}, $.okvideo.options, options); 1028 // support older versions of okvideo 1029 if (base.options.video === null) base.options.video = base.options.source; 1030 base.setOptions(); 1031 var target = base.options.target || $('body'); 1032 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 1033 var zIndex = base.options.controls === 3 ? -999 : "auto"; 1034 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 1035 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>'; 1036 if (OKEvents.utils.isMobile()) { 1037 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>'); 1038 } else { 1039 if (base.options.controls === 3) { 1040 target.append(mask) 1041 } 1042 if (base.options.adproof === 1) { 1043 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>'); 1044 } else { 1045 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>'); 1046 } 1047 } 1048 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 1049 if (base.options.playlist.list === null) { 1050 if (base.options.video.provider === 'youtube') { 1051 base.loadYouTubeAPI(); 1052 } else if (base.options.video.provider === 'vimeo') { 1053 base.options.volume /= 100; 1054 base.loadVimeoAPI(); 1055 } 1056 } else { 1057 base.loadYouTubeAPI(); 1058 } 1059 } 1060 }; 1061 // clean the options 1062 base.setOptions = function() { 1063 // exchange 'true' for '1' and 'false' for 3 1064 for (var key in this.options) { 1065 if (this.options[key] === true) this.options[key] = 1; 1066 if (this.options[key] === false) this.options[key] = 3; 1067 } 1068 if (base.options.playlist.list === null) { 1069 base.options.video = base.determineProvider(); 1070 } 1071 // pass options to the window 1072 $(window).data('okoptions-' + base.options.id, base.options); 1073 };
1074 // insert js into the head and exectue a callback function 1075 base.insertJS = function(src, callback){ 1076 var tag; 1077 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1078 tag = UNCODE.insertedSripts[src]; 1079 if (callback){ 1080 if (tag.readyState){ //IE 1081 tag.onreadystatechange = function(){ 1082 if (tag.readyState === "loaded" || 1083 tag.readyState === "complete"){ 1084 tag.onreadystatechange = null; 1085 callback(); 1086 } 1087 }; 1088 } else { 1089 $(tag).on('load', callback); 1090 } 1091 } 1092 return; 1093 } 1094 tag = document.createElement('script'); 1095 if (callback){ 1096 if (tag.readyState){ //IE 1097 tag.onreadystatechange = function(){ 1098 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1099 tag.onreadystatechange = null; 1100 callback(); 1101 } 1102 }; 1103 } else { 1104 tag.onload = function() { 1105 callback(); 1106 }; 1107 } 1108 } 1109 tag.src = src; 1110 var firstScriptTag = document.getElementsByTagName('script')[0]; 1111 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1112 if ( ! UNCODE.insertedSripts ) { 1113 UNCODE.insertedSripts = []; 1114 } 1115 UNCODE.insertedSripts[src] = tag; 1116 }; 1117 // load the youtube api 1118 base.loadYouTubeAPI = function(callback) { 1119 base.insertJS('https://www.youtube.com/player_api'); 1120 }; 1121 base.loadYouTubePlaylist = function() { 1122 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1123 }; 1124 // load the vimeo api by replacing the div with an iframe and loading js 1125 base.loadVimeoAPI = function() { 1126 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, 1127 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />'); 1128 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1129 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1130 base.insertJS('//f.vimeocdn.com/js/froogaloop2.min.js', function() { 1131 vimeoPlayerReady(base.options.id); 1132 }); 1133 }; 1134 // is it from youtube or vimeo? 1135 base.determineProvider = function() { 1136 var a = document.createElement('a'); 1137 a.href = base.options.video; 1138 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1139 var videoid = a.href.split('/')[3].toString(); 1140 var query = videoid.substring(videoid.indexOf('?') + 1); 1141 if (query != '') { 1142 var vars = query.split('&'); 1143 for (var i = 0; i < vars.length; i++) { 1144 var pair = vars[i].split('='); 1145 if (pair[0] == 'v') { 1146 videoid = pair[1]; 1147 } 1148 } 1149 } 1150 return { 1151 "provider": "youtube", 1152 "id": videoid 1153 }; 1154 } else if (/vimeo.com/.test(base.options.video)) { 1155 return { 1156 "provider": "vimeo", 1157 "id": (a.href.split('/')[3].toString()).split('#')[0], 1158 }; 1159 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1160 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1161 if (id.length == 11) { 1162 return { 1163 "provider": "youtube", 1164 "id": id.toString() 1165 }; 1166 } else { 1167 for (var i = 0; i < base.options.video.length; i++) { 1168 if (typeof parseInt(base.options.video[i]) !== "number") { 1169 throw 'not vimeo but thought it was for a sec'; 1170 } 1171 } 1172 return { 1173 "provider": "vimeo", 1174 "id": base.options.video 1175 }; 1176 } 1177 } else { 1178 throw "OKVideo: Invalid video source"; 1179 } 1180 }; 1181 base.init(); 1182 }; 1183 $.okvideo.options = { 1184 id: null, 1185 source: null, // Deprecate dis l8r 1186 video: null, 1187 playlist: { // eat ur heart out @brokyo 1188 list: null, 1189 index: 0, 1190 startSeconds: 0, 1191 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 1192 }, 1193 disableKeyControl: 1, 1194 captions: 0, 1195 loop: 1, 1196 hd: 1, 1197 volume: 0, 1198 adproof: false, 1199 unstarted: null, 1200 onFinished: null, 1201 onReady: null, 1202 onPlay: null, 1203 onPause: null, 1204 buffering: null, 1205 controls: false, 1206 autoplay: true, 1207 annotations: true, 1208 cued: null 1209 }; 1210 $.fn.okvideo = function(options) { 1211 options.target = this; 1212 return this.each(function() { 1213 (new $.okvideo(options)); 1214 }); 1215 }; 1216 1217 $(".no-touch .uncode-video-container.video").each(function(index, el) { 1218 var $this = $(this), 1219 url = $this.attr('data-video'), 1220 id = $this.attr('data-id'), 1221 cloned = $this.closest('.owl-item'); 1222 if (!cloned.hasClass('cloned') || cloned.length == 0) { 1223 $this.okvideo({ 1224 id: id, 1225 source: url.split('#')[0], 1226 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 1227 autoplay: 1, 1228 controls: 0, 1229 volume: 0, 1230 adproof: 0, 1231 caller: $this, 1232 hd: 1, 1233 onReady: function(player) { 1234 var getPlayer = player.c || player.h || player, 1235 $iframe, 1236 getContainer = $(getPlayer).closest('.background-element'); 1237 if (getContainer.length) { 1238 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video:not(.drop-move)'); 1239 } 1240 1241 if ( $this.hasClass('drop-move') ) { 1242 1243 var $iframe = $(getPlayer), 1244 w = parseFloat($iframe.attr('width')), 1245 h = parseFloat($iframe.attr('height')), 1246 ratio = h / w, 1247 setResizeiFto, 1248 resizeiFrame = function(){ 1249 var dataW = $this.attr('data-w'), 1250 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1251 newH = newW * ratio; 1252 $iframe.css({ 1253 width: newW, 1254 height: newH 1255 }); 1256 }; 1257 resizeiFrame(); 1258 $(window).on( 'load', resizeiFrame ); 1259 $(window).on( 'resize', function(){ 1260 clearRequestTimeout(setResizeiFto); 1261 setResizeiFto = requestTimeout( function() { 1262 resizeiFrame(); 1263 }, 10 ); 1264 }); 1265 1266 } 1267 1268 } 1269 }); 1270 } 1271 }); 1272 1273 $(window).on('load', function(){ 1274 $('.mejs-fullscreen-button button').on('click', function(){ 1275 var $button = $(this), 1276 $stuck = $button.closest('.is_stucked'); 1277 1278 if ( $stuck.length ) { 1279 $stuck = $(this).trigger("sticky_kit:detach"); 1280 window.scrollTo(0, 0); 1281 } 1282 }); 1283 }); 1284}; 1285 1286UNCODE.backgroundSelfVideos = function( $ctx ) { 1287 1288 if ( typeof $ctx === 'undefined' ) { 1289 $ctx = $('body'); 1290 } 1291 1292 var backgroundSelfVideosInit = function( $ctx ) { 1293 $(".background-video-shortcode", $ctx).each(function(index, el) { 1294 if ( SiteParameters.block_mobile_videos === true ) { 1295 return false;
1296 } 1297 if ( $(this).closest('mediaelementwrapper').length ) { 1298 return true; 1299 } 1300 var $video_el = $(this), 1301 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 1302 $parent_drop_move = $video_el.closest('.t-entry-drop.drop-move'), 1303 video_id = $video_el.attr('id'); 1304 1305 if ( SiteParameters.is_frontend_editor ) { 1306 video_id = video_id + '_' + index; 1307 $video_el.attr('id', video_id); 1308 } 1309 1310 if (typeof MediaElement === "function") { 1311 var media = new MediaElement(video_id, { 1312 startVolume: 0, 1313 loop: true, 1314 success: function(mediaElement, domObject) { 1315 domObject.volume = 0; 1316 $(mediaElement).data('started', false); 1317 mediaElement.addEventListener('timeupdate', function(e) { 1318 if (!$(e.target).data('started')) { 1319 $(mediaElement).data('started', true); 1320 } 1321 }); 1322 mediaElement.addEventListener('loadedmetadata', function(e) { 1323 mediaElement.play(); 1324 }); 1325 if (!UNCODE.isMobile) { 1326 requestTimeout(function() { 1327 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video:not(.drop-move), .uncode-video-container.self-video:not(.drop-move)'); 1328 }, 100); 1329 } 1330 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 1331 mediaElement.play(); 1332 } 1333 1334 if ( $parent_drop_move.length ) { 1335 var setResizeMEto, 1336 resizeMediaElement = function(){ 1337 var dataW = $parent_drop_move.attr('data-w'), 1338 videoW = domObject.width, 1339 videoH = domObject.height, 1340 newW = UNCODE.wwidth / 12 * parseFloat( dataW ), 1341 newH = newW / ( videoW / videoH ); 1342 1343 $(domObject).css({ 1344 'height': newH, 1345 'width': newW 1346 }); 1347 }; 1348 $(window).on( 'resize load', function(){ 1349 clearRequestTimeout(setResizeMEto); 1350 setResizeMEto = requestTimeout( function() { 1351 resizeMediaElement(); 1352 }, 10 ); 1353 }); 1354 } 1355 1356 mediaElement.addEventListener('play', function() { 1357 $(mediaElement).closest('.uncode-video-container:not(.t-entry-drop)').css('opacity', '1'); 1358 $(mediaElement).closest('#page-header').addClass('video-started'); 1359 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1360 }, true); 1361 1362 }, 1363 // fires when a problem is detected 1364 error: function() {} 1365 }); 1366 1367 } 1368 }); 1369 }; 1370 1371 backgroundSelfVideosInit( $ctx ); 1372 1373 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 1374 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 1375 var $el = model.view.$el, 1376 shortcode = model.attributes.shortcode; 1377 1378 backgroundSelfVideosInit( $el ); 1379 }); 1380 } 1381}; 1382 1383UNCODE.is_scrolling = false; 1384 1385UNCODE.disableHoverScroll = function() { 1386 1387 if (!UNCODE.isMobile && !UNCODE.isFullPage) { 1388 var body = document.body, 1389 timer; 1390 1391 window.addEventListener('scroll', function() { 1392 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 1393 clearRequestTimeout(timer); 1394 if ( body.classList && !body.classList.contains('disable-hover') ) { 1395 body.classList.add('disable-hover'); 1396 window.dispatchEvent(new CustomEvent('disable-hover')); 1397 } 1398 UNCODE.is_scrolling = true; 1399 1400 timer = requestTimeout(function() { 1401 if ( body.classList ) { 1402 body.classList.remove('disable-hover'); 1403 window.dispatchEvent(new CustomEvent('enable-hover')); 1404 } 1405 UNCODE.is_scrolling = false; 1406 }, delay); 1407 }, false); 1408 } 1409}; 1410 1411UNCODE.isotopeLayout = function() { 1412 if ($('.isotope-layout').length > 0) { 1413 var isotopeContainersArray = [], 1414 typeGridArray = [], 1415 layoutGridArray = [], 1416 screenLgArray = [], 1417 screenMdArray = [], 1418 screenSmArray = [], 1419 transitionDuration = [], 1420 $filterItems = [], 1421 $filters = $('.isotope-system .isotope-filters'), 1422 $itemSelector = '.tmb-iso', 1423 $items, 1424 itemMargin, 1425 correctionFactor = 0, 1426 firstLoad = true, 1427 isOriginLeft = $('body').hasClass('rtl') ? false : true; 1428 $('[class*="isotope-container"]').each(function(index) { 1429 var _this = $(this); 1430 var isoData = _this.data(), 1431 $data_lg, 1432 $data_md, 1433 $data_sm; 1434 _this.children('.tmb').addClass('tmb-iso'); 1435 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 1436 else $data_lg = '1000'; 1437 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 1438 else $data_md = '600'; 1439 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 1440 else $data_sm = '480'; 1441 screenLgArray.push($data_lg); 1442 screenMdArray.push($data_md); 1443 screenSmArray.push($data_sm); 1444 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 1445 if (isoData.type == 'metro') typeGridArray.push(true);
1446 else typeGridArray.push(false); 1447 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 1448 else layoutGridArray.push('masonry'); 1449 isotopeContainersArray.push(_this); 1450 _this.attr('data-iso-index', index); 1451 }); 1452 var colWidth = function(index) { 1453 $(isotopeContainersArray[index]).width(''); 1454 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 1455 widthAvailable = $(isotopeContainersArray[index]).width(), 1456 columnNum = 12, 1457 columnWidth = 0, 1458 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 1459 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 1460 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 1461 $rowContainer, 1462 paddingRow, 1463 $colContainer, 1464 paddingCol; 1465 1466 if ( consider_menu ) 1467 winHeight = winHeight - UNCODE.menuHeight; 1468 1469 if ( data_vp_height === '1' ) { 1470 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 1471 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 1472 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 1473 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 1474 winHeight = winHeight - ( paddingRow + paddingCol ); 1475 } 1476 1477 if (isPx) { 1478 columnWidth = Math.ceil(widthAvailable / columnNum); 1479 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 1480 } else { 1481 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 1482 } 1483 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 1484 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 1485 for (var i = 0, len = $items.length; i < len; i++) { 1486 var $item = $($items[i]), 1487 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 1488 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 1489 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 1490 1491 1492 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 1493 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 1494 } 1495 1496 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 1497 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 1498 } 1499 1500 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 1501 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1502 switch (parseInt(multiplier_w[1])) { 1503 case (5): 1504 case (4): 1505 case (3): 1506 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1507 multiplier_w[1] = 6; 1508 break; 1509 case (2): 1510 case (1): 1511 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 1512 multiplier_w[1] = 3; 1513 break; 1514 default: 1515 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1516 multiplier_w[1] = 12; 1517 break; 1518 } 1519 1520 if (multiplier_w[1] == 2.4) { // 5 columns 1521 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1522 multiplier_w[1] = 6; 1523 } 1524 } 1525 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 1526 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1527 switch (parseInt(multiplier_w[1])) { 1528 case (5): 1529 case (4): 1530 case (3): 1531 case (2): 1532 case (1): 1533 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1534 multiplier_w[1] = 6; 1535 break; 1536 default: 1537 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1538 multiplier_w[1] = 12; 1539 break; 1540 } 1541 1542 if (multiplier_w[1] == 2.4) { // 5 columns 1543 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1544 multiplier_w[1] = 6; 1545 } 1546 } 1547 } else if (widthAvailable < screenSmArray[index]) { 1548 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1549 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1550 multiplier_w[1] = 12; 1551 if (typeGridArray[index]) multiplier_h[1] = 12; 1552 } 1553 } 1554 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 1555 height; 1556 1557 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 1558 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 1559 if ( widthAvailable < screenSmArray[index] ) { 1560 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 1561 } 1562 } else { 1563 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 1564 } 1565 1566 if (width >= widthAvailable) { 1567 $item.css({ 1568 width: widthAvailable 1569 }); 1570 if (typeGridArray[index]) { 1571 $item.children().add($item.find('.backimg')).css({ 1572 height: height 1573 }); 1574 } 1575 } else { 1576 $item.css({ 1577 width: width 1578 }); 1579 if (typeGridArray[index]) { 1580 $item.children().add($item.find('.backimg')).css({ 1581 height: height 1582 }); 1583 } 1584 } 1585 } 1586 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 2.4) { // 5 columns 1587 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 1588 } else { 1589 return columnWidth; 1590 } 1591 }, 1592 init_isotope = function() { 1593 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 1594 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 1595 isotopeId = isotopeSystem.attr('id'), 1596 $layoutMode = layoutGridArray[i], 1597 setIsotopeFirstRowTimeOut, 1598 setIsotopeFirstRow = function(items){ 1599 var firstRow = true; 1600 $(items).each(function(index, val){ 1601 var el = items[index].element, 1602 el_top = items[index].position.y, 1603 $el = $(el); 1604 if ( index > 0 && el_top > 0 && firstRow ) { 1605 firstRow = false;
1606 } else if ( index == 0 && el_top == 0 ) { 1607 firstRow = true; 1608 } 1609 if ( firstRow ) { 1610 $el.removeClass('tmb-isotope-further-row'); 1611 } else { 1612 $el.addClass('tmb-isotope-further-row'); 1613 } 1614 }); 1615 }; 1616 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 1617 //resizable: true, 1618 itemSelector: $itemSelector, 1619 layoutMode: $layoutMode, 1620 transitionDuration: transitionDuration[i], 1621 masonry: { 1622 columnWidth: colWidth(i) 1623 }, 1624 vertical: { 1625 horizontalAlignment: 0.5, 1626 }, 1627 sortBy: 'original-order', 1628 isOriginLeft: isOriginLeft 1629 }) 1630 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 1631 .on('layoutComplete', function( event, items ){ 1632 if ( typeof items[0] !== 'undefined' ) { 1633 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1634 setIsotopeFirstRow(items); 1635 } 1636 } 1637 }) 1638 .on('arrangeComplete', function( event, items ){ 1639 if ( typeof items[0] !== 'undefined' ) { 1640 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1641 clearRequestTimeout(setIsotopeFirstRowTimeOut); 1642 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 1643 setIsotopeFirstRow(items); 1644 }, 100); 1645 } 1646 } 1647 }); 1648 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite') && $.fn.infinitescroll) { 1649 $(isotopeContainersArray[i]).infinitescroll({ 1650 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 1651 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 1652 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items you'll retrieve 1653 animate: false, 1654 behavior: 'local', 1655 debug: false, 1656 loading: { 1657 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 1658 speed: 0, 1659 finished: undefined, 1660 msg: $('#' + isotopeId + ' .loadmore-button'), 1661 }, 1662 errorCallback: function() { 1663 var isotope_system = $(this).closest('.isotope-system'); 1664 $('.loading-button', isotope_system).hide(); 1665 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 1666 } 1667 }, 1668 // append the new items to isotope on the infinitescroll callback function. 1669 function(newElements, opts) { 1670 var $isotope = $(this), 1671 isotopeId = $isotope.closest('.isotope-system').attr('id'), 1672 filters = new Array(), 1673 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 1674 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 1675 $numPages = $('a', $infinite_button).data('pages'), 1676 delay = 300; 1677 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 1678 $infinite_button.show(); 1679 $loading_button.hide(); 1680 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 1681 $('> li', $isotope).remove(); 1682 $.each($(newElements), function(index, val) { 1683 $(val).addClass('tmb-iso'); 1684 if ($(val).is("li")) { 1685 filters.push($(val)[0]); 1686 } 1687 }); 1688 newElements = newElements.filter(function(x) { 1689 return filters.indexOf(x) < 0 1690 }); 1691 $.each($(filters), function(index, val) { 1692 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 1693 }); 1694 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 1695 if (typeof UNCODE.lightbox !== 'undefined') { 1696 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 1697 if (typeof getLightbox === 'object') getLightbox.refresh(); 1698 } 1699 if ( typeof twttr !== 'undefined' ) 1700 twttr.widgets.load(isotopeContainersArray[i]); 1701 1702 }); 1703 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 1704 var $infinite_isotope = $(isotopeContainersArray[i]), 1705 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 1706 $infinite_isotope.infinitescroll('pause'); 1707 $infinite_button.on('click', function(event) { 1708 event.preventDefault(); 1709 var $infinite_system = $(event.target).closest('.isotope-system'), 1710 $infinite_isotope = $infinite_system.find('.isotope-container'), 1711 isotopeId = $infinite_system.attr('id'); 1712 $(event.currentTarget).html(SiteParameters.loading); 1713 $infinite_isotope.infinitescroll('resume'); 1714 $infinite_isotope.infinitescroll('retrieve'); 1715 $infinite_isotope.infinitescroll('pause'); 1716 }); 1717 } 1718 } 1719 } 1720 }, 1721 onLayout = function(isotopeObj, startIndex, needsReload) { 1722 var needsReload = needsReload ? true : false;
1723 1724 if (typeof UNCODE.bigText !== 'undefined') { 1725 UNCODE.bigText(); 1726 } 1727 isotopeObj.css('opacity', 1); 1728 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 1729 1730 requestTimeout(function() { 1731 if (startIndex > 0) { 1732 reloadIsotope(isotopeObj); 1733 if (SiteParameters.dynamic_srcset_active === '1') { 1734 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1735 UNCODE.adaptive_srcset(isotopeObj); 1736 } 1737 // window.dispatchEvent(UNCODE.boxEvent); 1738 } else if (needsReload) { 1739 reloadIsotope(isotopeObj); 1740 } 1741 1742 UNCODE.adaptive(); 1743 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 1744 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1745 } 1746 $(isotopeObj).find('audio,video').each(function() { 1747 $(this).mediaelementplayer({ 1748 pauseOtherPlayers: false, 1749 }); 1750 }); 1751 if ($(isotopeObj).find('.nested-carousel').length) { 1752 if (typeof UNCODE.carousel !== 'undefined') { 1753 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 1754 } 1755 requestTimeout(function() { 1756 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1757 }, 200); 1758 } else { 1759 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1760 } 1761 isotopeObj.trigger('isotope-layout-complete'); 1762 1763 }, 100); 1764 1765 }, 1766 boxAnimation = function(items, startIndex, sequential, container) { 1767 var $allItems = items.length - startIndex, 1768 showed = 0, 1769 index = 0; 1770 if (container.closest('.owl-item').length == 1) return false; 1771 $.each(items, function(index, val) { 1772 var $this = $(val), 1773 elInner = $('> .t-inside', val); 1774 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 1775 return; 1776 } 1777 if (val[0]) val = val[0]; 1778 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 1779 new Waypoint({ 1780 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 1781 element: val, 1782 handler: function() { 1783 var element = $('> .t-inside', this.element), 1784 parent = $(this.element), 1785 currentIndex = parent.index(); 1786 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 1787 delayAttr = parseInt(element.attr('data-delay')); 1788 if (isNaN(delayAttr)) delayAttr = 100; 1789 delay -= showed; 1790 var objTimeout = requestTimeout(function() { 1791 element.removeClass('zoom-reverse').addClass('start_animation'); 1792 showed = parent.index(); 1793 container.isotope('layout'); 1794 }, delay * delayAttr) 1795 parent.data('objTimeout', objTimeout); 1796 if (!UNCODE.isUnmodalOpen) { 1797 this.destroy(); 1798 } 1799 }, 1800 offset: '100%' 1801 }) 1802 } else { 1803 if (elInner.hasClass('force-anim')) { 1804 elInner.addClass('start_animation'); 1805 } else { 1806 elInner.css('opacity', 1); 1807 } 1808 container.isotope('layout'); 1809 } 1810 1811 index++; 1812 }); 1813 }, 1814 reloadIsotope = function(isotopeObj) { 1815 var isoIndex = $(isotopeObj).attr('data-iso-index'); 1816 var $layoutMode = ($(isotopeObj).data('layout')); 1817 if ($layoutMode === undefined) { 1818 $layoutMode = 'masonry'; 1819 } 1820 if (isotopeObj.data('isotope')) { 1821 isotopeObj.isotope({ 1822 itemSelector: $itemSelector, 1823 layoutMode: $layoutMode, 1824 transitionDuration: transitionDuration[isoIndex], 1825 masonry: { 1826 columnWidth: colWidth(isoIndex) 1827 }, 1828 vertical: { 1829 horizontalAlignment: 0.5, 1830 }, 1831 sortBy: 'original-order', 1832 isOriginLeft: isOriginLeft 1833 }); 1834 } 1835 } 1836 ; 1837 if ($('.isotope-pagination').length > 0) { 1838 $('.isotope-system').on('click', '.pagination a', function(evt) { 1839 evt.preventDefault(); 1840 1841 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 1842 container = $(this).closest('.isotope-system'), 1843 calc_scroll = container.closest('.uncol').offset().top, 1844 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 1845 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 1846 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 1847 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 1848 1849 calc_scroll -= filterOffset - 1; 1850 calc_scroll -= UNCODE.get_scroll_offset(); 1851 1852 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 1853 delta = bodyTop - calc_scroll, 1854 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 1855 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 1856 1857 if ( !UNCODE.isFullPage ) { 1858 if (scrollSpeed == 0) { 1859 $('html, body').scrollTop(calc_scroll); 1860 } else { 1861 $('html, body').animate({ 1862 scrollTop: calc_scroll 1863 },{ 1864 easing: 'easeInOutQuad', 1865 duration: scrollSpeed, 1866 complete: function(){ 1867 UNCODE.scrolling = false;
1868 } 1869 }); 1870 } 1871 } 1872 1873 loadIsotope($(this)); 1874 evt.preventDefault(); 1875 }); 1876 } 1877 $filters.on('click', 'a.isotope-nav-link', function(evt) { 1878 if ($(this).hasClass('no-isotope-filter')) { 1879 return; 1880 } 1881 var $filter = $(this), 1882 filterContainer = $filter.closest('.isotope-filters'), 1883 filterValue = $filter.attr('data-filter'), 1884 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 1885 transitionDuration = container.data().isotope.options.transitionDuration, 1886 delay = 300, 1887 filterItems = []; 1888 if (!$filter.hasClass('active')) { 1889 /** Scroll top with filtering */ 1890 if (filterContainer.hasClass('filter-scroll')) { 1891 var calc_scroll = container.closest('.uncol').offset().top, 1892 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 1893 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 1894 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 1895 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 1896 1897 calc_scroll -= filterOffset - 1; 1898 calc_scroll -= UNCODE.get_scroll_offset(); 1899 1900 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 1901 delta = bodyTop - calc_scroll, 1902 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 1903 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 1904 1905 if ( !UNCODE.isFullPage ) { 1906 if (scrollSpeed == 0) { 1907 $('html, body').scrollTop(calc_scroll); 1908 UNCODE.scrolling = false; 1909 } else { 1910 $('html, body').animate({ 1911 scrollTop: calc_scroll 1912 },{ 1913 easing: 'easeInOutQuad', 1914 duration: scrollSpeed, 1915 complete: function(){ 1916 UNCODE.scrolling = false; 1917 } 1918 }); 1919 } 1920 } 1921 } 1922 if (filterValue !== undefined) { 1923 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 1924 var parent = $(val).parent(), 1925 objTimeout = parent.data('objTimeout'); 1926 if (objTimeout) { 1927 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1928 clearRequestTimeout(objTimeout); 1929 } 1930 if (transitionDuration == 0) { 1931 if ($(val).hasClass('animate_when_almost_visible')) { 1932 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1933 } else { 1934 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 1935 } 1936 } 1937 }); 1938 requestTimeout(function(){ 1939 if ( filterValue == '*' ) { 1940 container.removeClass('isotope-filtered'); 1941 } else { 1942 container.addClass('isotope-filtered'); 1943 } 1944 container.isotope({ 1945 filter: function() { 1946 var block = $(this), 1947 filterable = (filterValue == '*') || block.hasClass(filterValue), 1948 lightboxElements = $('[data-lbox^=ilightbox]', block); 1949 if (filterable) { 1950 if (lightboxElements.length) { 1951 lightboxElements.removeClass('lb-disabled'); 1952 container.data('lbox', $(lightboxElements[0]).data('lbox')); 1953 } 1954 filterItems.push(block); 1955 } else { 1956 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 1957 } 1958 return filterable; 1959 } 1960 }); 1961 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 1962 }, delay); 1963 1964 /** once filtered - start **/ 1965 container.isotope('once', 'arrangeComplete', function() { 1966 if (typeof UNCODE.lightbox !== 'undefined') { 1967 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 1968 if (typeof getLightbox === 'object') getLightbox.refresh(); 1969 } 1970 if (transitionDuration == 0) { 1971 requestTimeout(function() { 1972 boxAnimation(filterItems, 0, false, container); 1973 }, 100); 1974 } 1975 requestTimeout(function() { 1976 Waypoint.refreshAll(); 1977 }, 2000); 1978 }); 1979 /** once filtered - end **/ 1980 } else { 1981 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 1982 var parent = $(val).parent(), 1983 objTimeout = parent.data('objTimeout'); 1984 if (objTimeout) { 1985 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1986 clearRequestTimeout(objTimeout); 1987 } 1988 if (transitionDuration == 0) { 1989 if ($(val).hasClass('animate_when_almost_visible')) { 1990 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1991 } else { 1992 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 1993 } 1994 } 1995 }); 1996 container.parent().addClass('isotope-loading'); 1997 loadIsotope($filter); 1998 } 1999 } 2000 evt.preventDefault(); 2001 }); 2002 $(window).on("popstate", function(e) { 2003 if (e.originalEvent.state === null) return; 2004 var params = {}; 2005 if (location.search) { 2006 var parts = location.search.substring(1).split('&'); 2007 for (var i = 0; i < parts.length; i++) { 2008 var nv = parts[i].split('='); 2009 if (!nv[0]) continue; 2010 params[nv[0]] = nv[1] || true; 2011 } 2012 } 2013 if (params.id === undefined) { 2014 $.each($('.isotope-system'), function(index, val) { 2015 loadIsotope($(val)); 2016 }); 2017 } else loadIsotope($('#' + params.id)); 2018 }); 2019 2020 var loadIsotope = function($href) { 2021 var href = ($href.is("a") ? $href.attr('href') : location), 2022 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 2023 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 2024 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 2025 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 2026 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 2027 isotopeId = isotopeSystem.attr('id'); 2028 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 2029 history.pushState({ 2030 myIsotope: true 2031 }, document.title, href); 2032 } 2033 $.ajax({ 2034 url: href 2035 }).done(function(data) { 2036 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 2037 $resultPagination = $(data).find('#' + isotopeId + ' .pagination'), 2038 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count'); 2039 isotopeWrapper.addClass('isotope-reloaded'); 2040 requestTimeout(function() { 2041 isotopeWrapper.removeClass('isotope-loading'); 2042 isotopeWrapper.removeClass('isotope-reloaded'); 2043 }, 500); 2044 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 2045 var parent = $(val).parent(), 2046 objTimeout = parent.data('objTimeout'); 2047 if (objTimeout) { 2048 $(val).removeClass('zoom-reverse').removeClass('start_animation') 2049 clearRequestTimeout(objTimeout); 2050 } 2051 if ($(val).hasClass('animate_when_almost_visible')) { 2052 $(val).addClass('zoom-reverse').removeClass('start_animation'); 2053 } else { 2054 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 2055 } 2056 }); 2057 requestTimeout(function() { 2058 if (isotopeContainer.data('isotope')) { 2059 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 2060 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 2061 UNCODE.adaptive();
2062 if (SiteParameters.dynamic_srcset_active === '1') { 2063 UNCODE.adaptive_srcset(isotopeContainer); 2064 } 2065 if (typeof UNCODE.lightbox !== 'undefined') { 2066 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 2067 if (typeof getLightbox === 'object') getLightbox.refresh(); 2068 } 2069 } 2070 }, 300); 2071 $('.pagination', isotopeFooter).remove(); 2072 isotopeFooter.append($resultPagination); 2073 2074 if (isotopeResultCount.length > 0) { 2075 $('.woocommerce-result-count', isotopeResultCount).remove(); 2076 isotopeResultCount.append($resultCount); 2077 } 2078 }); 2079 }; 2080 $filters.each(function(i, buttonGroup) { 2081 var $buttonGroup = $(buttonGroup); 2082 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 2083 $buttonGroup.find('.active').removeClass('active'); 2084 $(this).addClass('active'); 2085 2086 }); 2087 2088 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 2089 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 2090 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 2091 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 2092 e.preventDefault(); 2093 $cats_filters.slideToggle(400, 'easeInOutCirc'); 2094 }); 2095 2096 }); 2097 window.addEventListener('boxResized', function(e) { 2098 if (UNCODE.printDialogOpen !== false) { 2099 return false; 2100 } 2101 $.each($('.isotope-layout'), function(index, val) { 2102 var $layoutMode = ($(this).data('layout')); 2103 if ($layoutMode === undefined) $layoutMode = 'masonry'; 2104 if ($(this).data('isotope')) { 2105 $(this).isotope({ 2106 itemSelector: $itemSelector, 2107 layoutMode: $layoutMode, 2108 transitionDuration: transitionDuration[index], 2109 masonry: { 2110 columnWidth: colWidth(index) 2111 }, 2112 vertical: { 2113 horizontalAlignment: 0.5, 2114 }, 2115 sortBy: 'original-order', 2116 isOriginLeft: isOriginLeft 2117 }); 2118 $(this).isotope('unbindResize'); 2119 if (SiteParameters.dynamic_srcset_active === '1') { 2120 UNCODE.refresh_dynamic_srcset_size($(this)); 2121 } 2122 } 2123 $(this).find('.mejs-video,.mejs-audio').each(function() { 2124 $(this).trigger('resize'); 2125 }); 2126 }); 2127 }, false); 2128 2129 init_isotope(); 2130 }; 2131} 2132 2133UNCODE.lightbox = function() { 2134 UNCODE.lightboxArray = {}; 2135 requestTimeout(function() { 2136 var groupsArr = {}; 2137 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init])').each(function() { 2138 var group = this.getAttribute("data-lbox"), 2139 values = $(this).data(); 2140 $(this).attr('data-lbox-init','true') 2141 groupsArr[group] = values; 2142 }); 2143 for (var i in groupsArr) { 2144 var skin = groupsArr[i].skin || 'black', 2145 path = groupsArr[i].dir || 'horizontal', 2146 thumbs = !groupsArr[i].notmb || false, 2147 arrows = !groupsArr[i].noarr || false, 2148 social = groupsArr[i].social || false, 2149 deeplink = groupsArr[i].deep || false, 2150 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled)'), 2151 counter = $els.length, 2152 dataAlbum = $els.attr('data-album'); 2153 if (social) social = { 2154 facebook: true, 2155 twitter: true, 2156 reddit: true, 2157 digg: true 2158 }; 2159 UNCODE.lightboxArray[i] = $els.iLightBox({ 2160 selector: '[data-lbox="' + i + '"]:not(.lb-disabled)', 2161 skin: skin, 2162 path: path, 2163 linkId: deeplink, 2164 infinite: false, 2165 //fullViewPort: 'fit', 2166 smartRecognition: false, 2167 fullAlone: true, 2168 maxScale: 1, 2169 minScale: .02, 2170 //fullStretchTypes: 'flash, video', 2171 overlay: { 2172 opacity: .94 2173 }, 2174 controls: { 2175 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 2176 fullscreen: true, 2177 thumbnail: thumbs, 2178 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 2179 }, 2180 show: { 2181 speed: 200 2182 }, 2183 hide: { 2184 speed: 200 2185 }, 2186 social: { 2187 start: false, 2188 buttons: social 2189 }, 2190 caption: { 2191 start: false 2192 }, 2193 styles: { 2194 nextOpacity: 1, 2195 nextScale: 1, 2196 prevOpacity: 1, 2197 prevScale: 1 2198 }, 2199 effects: { 2200 switchSpeed: 400 2201 }, 2202 slideshow: { 2203 pauseTime: 5000 2204 }, 2205 thumbnails: { 2206 maxWidth: 60, 2207 maxHeight: 60, 2208 activeOpacity: .2 2209 }, 2210 html5video: { 2211 preload: true 2212 }, 2213 callback: { 2214 onOpen: function(){ 2215 $(window).trigger('uncode-custom-cursor'); 2216 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2217 iNoBounce.enable(); 2218 } 2219 }, 2220 onHide: function(){ 2221 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2222 iNoBounce.disable() 2223 } 2224 }, 2225 } 2226 }); 2227 2228 $(document).on('infinite-loaded', function(){ 2229 UNCODE.lightboxArray[i].refresh(); 2230 }); 2231 2232 $(window).on('gdprOpen', function(){ 2233 UNCODE.lightboxArray[i].close(); 2234 }); 2235 }; 2236 }, 100); 2237 2238 $(document).on('click', '.lb-disabled', function(e){ 2239 e.preventDefault(); 2240 }); 2241}; 2242 2243UNCODE.carousel = function(container) { 2244 var $owlContainers = $('.owl-carousel-container', container); 2245 $owlContainers.each(function() { 2246 var $owlContainer = $(this), 2247 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 2248 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 2249 values = {}, 2250 tempTimeStamp, 2251 currentIndex, 2252 $owlInsideEqual = []; 2253 $owlSelector.each(function() { 2254 var itemID = $(this).attr('id'), 2255 $elSelector = $(('#' + itemID).toString()); 2256 values['id'] = itemID; 2257 values['items'] = 1;
2258 values['columns'] = 3; 2259 values['fade'] = false; 2260 values['nav'] = false; 2261 values['navmobile'] = false; 2262 values['navskin'] = 'light'; 2263 values['navspeed'] = 400; 2264 values['dots'] = false; 2265 values['dotsmobile'] = false; 2266 values['loop'] = false; 2267 values['autoplay'] = false; 2268 values['timeout'] = 3000; 2269 values['autoheight'] = false; 2270 values['stagepadding'] = 0; 2271 values['margin'] = 0; 2272 values['lg'] = 1; 2273 values['md'] = 1; 2274 values['sm'] = 1; 2275 $.each($(this).data(), function(i, v) { 2276 values[i] = v; 2277 }); 2278 2279 if ($(this).closest('.uncode-slider').length) { 2280 values['navskin'] = ''; 2281 values['navmobile'] = false; 2282 //values['dotsmobile'] = true; 2283 } else { 2284 values['navskin'] = ' style-'+values['navskin']+' style-override'; 2285 } 2286 2287 var setIndexActive = function(event, init){ 2288 var init = typeof init === 'undefined' ? false : init, 2289 thiis = $(event.currentTarget); 2290 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 2291 var scrolltop = $(document).scrollTop(), 2292 size = event.page.size, 2293 i; 2294 var setIndex = requestTimeout(function() { 2295 for ( i = 0; i < size; i++ ) { 2296 var itemCont = event.item.index != null ? (event.item.index + i) : i; 2297 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 2298 if (thiis.closest('.row-slider').length) { 2299 if (currentItem == undefined) { 2300 currentItem = thiis.children()[i]; 2301 } 2302 if ($(currentItem).closest('#page-header').length) { 2303 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 2304 UNCODE.switchColorsMenu(scrolltop, 'dark'); 2305 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 2306 UNCODE.switchColorsMenu(scrolltop, 'light'); 2307 } 2308 } 2309 } 2310 var itendIndex = $(currentItem).attr('data-index'); 2311 if ( isNaN(itendIndex) ) { 2312 itendIndex = 1; 2313 } 2314 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 2315 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 2316 if ($.fn.counterUp) { 2317 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .counter').each(function(){ 2318 var $counter = $(this); 2319 $counter.addClass('started').counterUp({ 2320 delay: 10, 2321 time: 1500 2322 }); 2323 }); 2324 } 2325 } 2326 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 2327 }, 200); 2328 } 2329 tempTimeStamp = event.timeStamp; 2330 } 2331 2332 /** Initialized */ 2333 $elSelector.on('initialized.owl.carousel', function(event) { 2334 2335 if ( $('.isotope-container', event.currentTarget).length ) { 2336 window.dispatchEvent(UNCODE.boxEvent); 2337 } 2338 2339 $('.owl-dot.active', $elSelector).on('click', function(){ 2340 return false; 2341 }); 2342 2343 var thiis = $(event.currentTarget), 2344 // get the time from the data method 2345 time = thiis.data("timer-id"), 2346 rowParent = thiis.closest('.row-parent'); 2347 2348 if ( typeof rowParent[0] !== 'undefined' ) { 2349 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 2350 } 2351 2352 if (time) { 2353 clearRequestTimeout(time); 2354 } 2355 2356 thiis.addClass('showControls'); 2357 var new_time = requestTimeout(function() { 2358 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 2359 if (thiis.hasClass('owl-height-viewport')) 2360 setItemsRelHeight(thiis); 2361 if (thiis.hasClass('owl-height-equal')) 2362 setItemsHeight(thiis); 2363 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 2364 if (thiis.closest('.unequal, .unexpand').length) { 2365 UNCODE.setRowHeight(rowParent[0], true); 2366 } 2367 if (SiteParameters.dynamic_srcset_active === '1') { 2368 UNCODE.refresh_dynamic_srcset_size(thiis); 2369 } 2370 }, 350); 2371 // save the new time 2372 thiis.data("timer-id", new_time); 2373 2374 var scrolltop = $(document).scrollTop(); 2375 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 2376 2377 //if (!UNCODE.isMobile) { 2378 /** fix autoplay when visible **/ 2379 $(window).on('load', function(){ 2380 if (thiis.data('autoplay')) { 2381 thiis.trigger('stop.autoplay.owl'); 2382 } 2383 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 2384 return; 2385 } 2386 var carouselInView = new Waypoint.Inview({ 2387 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2388 element: thiis[0], 2389 exited: function() { 2390 var el = $(this.element); 2391 if (el.data('autoplay')) { 2392 el.trigger('stop.owl.autoplay'); 2393 el.data('stopped','true'); 2394 } 2395 }, 2396 enter: function(direction) { 2397 var el = $(this.element); 2398 requestTimeout(function() { 2399 if (el.data('autoplay')) { 2400 el.trigger('play.owl.autoplay'); 2401 el.data('stopped','false'); 2402 } 2403 }, 100); 2404 } 2405 }); 2406 }); 2407 //} 2408 2409 // $(window).on('frontend:carousel_updated', function(){ 2410 // Waypoint.refreshAll(); 2411 // }); 2412 2413 if (!thiis.closest('.isotope-system').length) { 2414 requestTimeout(function() { 2415 animate_thumb($('.t-inside', el), event); 2416 }, 400); 2417 } 2418 2419 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 2420 currentIndex = $(currentItem).attr('data-index'); 2421 2422 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 2423 if ($(val).closest('.uncode-slider').length) { 2424 $(val).removeClass('start_animation'); 2425 } 2426 }); 2427 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 2428 if ($(val).closest('.uncode-slider').length) { 2429 $(val).removeClass('already-animated'); 2430 } 2431 }); 2432 2433 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 2434 if ($(val).closest('.uncode-slider').length) { 2435 $(val).removeAttr('data-animated'); 2436 } 2437 }); 2438 2439 $.each($('.owl-item.cloned', thiis), function(index, val) {
2440 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 2441 }); 2442 2443 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 2444 if ($(val).attr('data-index') != currentIndex) { 2445 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 2446 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 2447 } 2448 if ($(val).attr('data-index') != currentIndex) { 2449 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 2450 } 2451 if ($(val).attr('data-index') == currentIndex) { 2452 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 2453 } 2454 }); 2455 2456 if (thiis.closest('.uncode-slider').length) { 2457 var el = thiis.closest('.row-parent')[0]; 2458 if ($(el).data('imgready')) { 2459 firstLoaded(el, event); 2460 } else { 2461 el.addEventListener("imgLoaded", function(el) { 2462 firstLoaded(el.target, event); 2463 }, false); 2464 } 2465 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 2466 if (transHeight != null) { 2467 requestTimeout(function() { 2468 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 2469 }, 100); 2470 } 2471 } else { 2472 var el = thiis; 2473 el.closest('.uncode-slider').addClass('slider-loaded'); 2474 } 2475 2476 requestTimeout(function() { 2477 if (typeof UNCODE.bigText !== 'undefined') { 2478 UNCODE.bigText(thiis); 2479 } 2480 if (thiis.closest('.uncode-slider').length) { 2481 if (thiis.data('autoplay')) pauseOnHover(thiis); 2482 } 2483 }, 500); 2484 2485 if (thiis.closest('.unequal').length) { 2486 $owlInsideEqual.push(thiis.closest('.row-parent')); 2487 } 2488 2489 var containerClasses = '', 2490 containerStyle = ''; 2491 if ( $('.owl-dots-classes', $owlContainer).length ) { 2492 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 2493 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 2494 $('.owl-dots-classes', $owlContainer).remove(); 2495 } 2496 2497 if ( containerClasses !== '' ) { 2498 requestTimeout(function() { 2499 if ( containerClasses !== '' ) 2500 $('.owl-dots', $owlContainer).attr('style', containerStyle); 2501 if ( containerStyle !== '' ) 2502 $('.owl-dots', $owlContainer).addClass(containerClasses); 2503 }, 100); 2504 } 2505 2506 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 2507 $(val).closest('.row-inner').css({ 2508 'margin-top': '-1px' 2509 }); 2510 }); 2511 2512 if ($.fn.isotope) { 2513 if ( thiis.closest('.isotope-container').length ) { 2514 if (thiis.closest('.isotope-container').data('isotope')) { 2515 requestTimeout(function(){ 2516 thiis.closest('.isotope-container').isotope('layout'); 2517 }, 300); 2518 } 2519 $(window).on('load', function(){ 2520 if (thiis.closest('.isotope-container').data('isotope')) { 2521 thiis.closest('.isotope-container').isotope('layout'); 2522 } 2523 }); 2524 } 2525 } 2526 2527 if (thiis.data('autoplay')) { 2528 $(window).on('menuOpen', function(){ 2529 thiis.trigger('stop.owl.autoplay'); 2530 thiis.data('stopped','true'); 2531 }).on('menuClose', function(){ 2532 2533 }); 2534 } 2535 $(window).on('menuClose', function(){ 2536 if (thiis.data('autoplay')) { 2537 thiis.trigger('play.owl.autoplay'); 2538 thiis.data('stopped','false'); 2539 } 2540 }); 2541 2542 setIndexActive(event, true); 2543 }); 2544 2545 $elSelector.on('resized.owl.carousel', function(event) { 2546 var thiis = $(event.currentTarget); 2547 // if ($(this).closest('.nested-carousel').length) { 2548 // requestTimeout(function() { 2549 // window.dispatchEvent(UNCODE.boxEvent); 2550 // }, 200); 2551 // } 2552 if ( thiis.hasClass('owl-height-equal') ) 2553 setItemsHeight(thiis); 2554 2555 setItemsRelHeight($elSelector); 2556 2557 setIndexActive(event); 2558 2559 if (SiteParameters.dynamic_srcset_active === '1') { 2560 UNCODE.refresh_dynamic_srcset_size(thiis); 2561 } 2562 2563 if ($.fn.isotope) { 2564 $(window).on('load', function(){ 2565 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 2566 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 2567 } 2568 }); 2569 } 2570 }); 2571 2572 /** detect resize window for fluid height layout */ 2573 var setFluidResize;
2574 function manageFluidCarouseHeight() { 2575 clearRequestTimeout(setFluidResize); 2576 setFluidResize = requestTimeout(function(){ 2577 setItemsRelHeight($elSelector); 2578 }, 100); 2579 } 2580 window.addEventListener('resize', manageFluidCarouseHeight); 2581 2582 /** Change */ 2583 $elSelector.on('change.owl.carousel', function(event) { 2584 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 2585 }); 2586 2587 /** Changed */ 2588 $elSelector.on('changed.owl.carousel', function(event) { 2589 var $row = $elSelector.parents('.row')[0]; 2590 if ( typeof $row !== 'undefined' ) { 2591 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 2592 } 2593 setIndexActive(event); 2594 }); 2595 2596 $elSelector.on('translate.owl.carousel', function(event) { 2597 if (UNCODE.isMobile) { 2598 $(event.currentTarget).addClass('owl-translating'); 2599 } 2600 }); 2601 2602 /** Translated */ 2603 $elSelector.on('translated.owl.carousel', function(event) { 2604 2605 var thiis = $(event.currentTarget), 2606 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 2607 currentIndex = $(currentItem).attr('data-index'), 2608 stagePadding = thiis.data('stagepadding'); 2609 2610 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 2611 2612 if (!UNCODE.isMobile) { 2613 UNCODE.owlPlayVideo(thiis); 2614 } 2615 2616 requestTimeout(function(){ 2617 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 2618 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 2619 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 2620 if (lastDelayElems == undefined) lastDelayElems = 0; 2621 if (lastDelayThumb == undefined) lastDelayThumb = 0; 2622 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 2623 thiis.trigger('stop.owl.autoplay'); 2624 requestTimeout(function() { 2625 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 2626 }, maxDelay); 2627 } 2628 }, 200); 2629 2630 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 2631 if ($(val).closest('.uncode-slider').length) { 2632 $(val).removeClass('start_animation'); 2633 } 2634 }); 2635 2636 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 2637 if ($(val).closest('.uncode-slider').length) { 2638 $(val).removeClass('already-animated'); 2639 } 2640 }); 2641 2642 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 2643 if ($(val).closest('.uncode-slider').length) { 2644 $(val).removeAttr('data-animated'); 2645 } 2646 }); 2647 2648 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 2649 if ($(val).attr('data-index') != currentIndex) { 2650 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 2651 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 2652 } 2653 if ($(val).attr('data-index') != currentIndex) { 2654 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 2655 } 2656 if ($(val).attr('data-index') == currentIndex) { 2657 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 2658 } 2659 }); 2660 2661 if (UNCODE.isMobile) { 2662 thiis.removeClass('owl-translating'); 2663 } 2664 2665 setIndexActive(event); 2666 }); 2667 2668 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 2669 2670 /** Init carousel */ 2671 $elSelector.not('.showControls').owlCarousel({ 2672 items: values['items'], 2673 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 2674 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 2675 nav: values['nav'], 2676 dots: values['dots'], 2677 loop: values['loop'], 2678 stagePadding: values['stagepadding'], 2679 margin: 0, 2680 video: true, 2681 autoWidth: false, 2682 autoplay: false, 2683 autoplayTimeout: values['timeout'], 2684 autoplaySpeed: values['navspeed'], 2685 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 2686 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : values['autoheight'] ), 2687 rtl: $('body').hasClass('rtl') ? true : false, 2688 fluidSpeed: true, 2689 navSpeed: values['navspeed'], 2690 dotsSpeed: values['navspeed'] / values['items'], 2691 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 2692 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>'], 2693 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 2694 responsiveClass: true, 2695 responsiveBaseElement: '.box-container', 2696 responsive: { 2697 0: { 2698 items: values['sm'], 2699 nav: values['navmobile'], 2700 dots: values['dotsmobile'], 2701 dotsSpeed: values['navspeed'] / values['sm'], 2702 }, 2703 480: { 2704 items: values['sm'], 2705 nav: values['navmobile'], 2706 dots: values['dotsmobile'], 2707 dotsSpeed: values['navspeed'] / values['sm'], 2708 }, 2709 570: { 2710 items: values['md'], 2711 nav: values['navmobile'], 2712 dots: values['dotsmobile'], 2713 dotsSpeed: values['navspeed'] / values['md'], 2714 }, 2715 960: { 2716 items: values['lg'], 2717 dotsSpeed: values['navspeed'] / values['lg'], 2718 } 2719 } 2720 }); 2721 2722 var transDuration = parseFloat(values['navspeed']) * 0.3; 2723 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 2724 2725 $('.owl-item .tmb', $elSelector).css({ 2726 '-webkit-transition-delay': transDuration + 'ms', 2727 '-moz-transition-delay': transDuration + 'ms', 2728 '-o-transition-delay': transDuration + 'ms', 2729 'transition-delay': transDuration + 'ms', 2730 '-webkit-transition-duration': transDuration2 + 'ms', 2731 '-moz-transition-duration': transDuration2 + 'ms', 2732 '-o-transition-duration': transDuration2 + 'ms', 2733 'transition-duration': transDuration2 + 'ms', 2734 }); 2735 2736 requestTimeout(function() { 2737 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 2738 UNCODE.setRowHeight($owlInsideEqual[i]); 2739 }; 2740 }, 300); 2741 2742 $(window).on('load', function(){ 2743 var $elCarousel = $elSelector.data('owl.carousel'); 2744 if ( typeof $elCarousel !== 'undefined' ) { 2745 $elCarousel.trigger('refreshed'); 2746 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 2747 UNCODE.setRowHeight($owlInsideEqual[i]); 2748 }; 2749 } 2750 }); 2751 2752 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 2753 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 2754 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 2755 $('#' + carousel_id).find('.owl-item').each( function() { 2756 var $item = $(this), 2757 index = ( $item.index() + 1 ); 2758 $item.attr('data-index', index); 2759 }); 2760 } 2761 }); 2762 2763 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2764 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 2765 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 2766 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 2767 $('#' + carousel_id).find('.owl-item').each( function() { 2768 var $item = $(this), 2769 index = ( $item.index() + 1 ); 2770 $item.attr('data-index', index); 2771 }); 2772 } 2773 }); 2774 } 2775 2776 }); 2777 2778 function firstLoaded(el, event) { 2779 var el = $(el), 2780 uncode_slider = el.find('.uncode-slider'); 2781 el.find('.owl-carousel').css('opacity', 1); 2782 uncode_slider.addClass('slider-loaded'); 2783 if (typeof UNCODE.bigText !== 'undefined') { 2784 UNCODE.bigText(el.find('.owl-item.active')); 2785 } 2786 //if (!UNCODE.isMobile) { 2787 requestTimeout(function() { 2788 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 2789 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 2790 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 2791 if (lastDelayElems == undefined) lastDelayElems = 0; 2792 if (lastDelayThumb == undefined) lastDelayThumb = 0; 2793 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 2794 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 2795 requestTimeout(function() { 2796 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 2797 }, maxDelay); 2798 } 2799 }, 500); 2800 2801 //} 2802 } 2803 2804 function navHover(el) { 2805 var $owlCont = el, 2806 $owlPrev = $owlCont.find('.owl-prev'), 2807 $owlNext = $owlCont.find('.owl-next'), 2808 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 2809 $owlPagination = $owlCont.next(), 2810 owlPrevW = $owlPrev.outerWidth(), 2811 owlNextW = $owlNext.outerWidth(), 2812 owlDotsH = $owlDots.innerHeight(), 2813 owlTime = 400, 2814 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2815 if ( $('body').hasClass('rtl') ) { 2816 $owlPrev.css("margin-right", -owlPrevW); 2817 $owlNext.css("margin-left", -owlNextW); 2818 } else { 2819 $owlPrev.css("margin-left", -owlPrevW); 2820 $owlNext.css("margin-right", -owlNextW); 2821 } 2822 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 2823 $owlCont.mouseenter(function() { 2824 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2825 $owlPrev.add($owlNext).css({ 2826 marginLeft: 0, 2827 marginRight: 0 2828 }); 2829 if (!owlNested) { 2830 $owlDots.css({ 2831 opacity: 1, 2832 bottom: 0 2833 }); 2834 } 2835 }).mouseleave(function() { 2836 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2837 if ( $('body').hasClass('rtl') ) { 2838 $owlPrev.css("margin-right", -owlPrevW); 2839 $owlNext.css("margin-left", -owlNextW); 2840 } else { 2841 $owlPrev.css("margin-left", -owlPrevW); 2842 $owlNext.css("margin-right", -owlNextW); 2843 } 2844 if (!owlNested) { 2845 $owlDots.css({ 2846 opacity: 1, 2847 bottom: -owlDotsH 2848 }); 2849 } 2850 }); 2851 }; 2852 2853 function animate_elems($this) { 2854 var lastDelay; 2855 $.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) { 2856 var element = $(val), 2857 delayAttr = element.attr('data-delay'), 2858 $first_item = element.closest('.owl-item[data-index="1"]'); 2859 2860 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 2861 return false;
2862 } 2863 2864 if (delayAttr == undefined) delayAttr = 0; 2865 requestTimeout(function() { 2866 element.addClass('start_animation'); 2867 }, delayAttr); 2868 lastDelay = delayAttr; 2869 }); 2870 return lastDelay; 2871 } 2872 2873 function animate_thumb(items, event) { 2874 var lastDelay, 2875 itemIndex, 2876 thiis = $(event.currentTarget), 2877 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 2878 numActives = $('.owl-item.active', thiis).length, 2879 stagePadding = thiis.data('stagepadding'); 2880 2881 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 2882 2883 thiis.data('tempIndex', event.item.index); 2884 $.each(items, function(index, val) { 2885 var parent = $(val).closest('.owl-item'); 2886 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2887 return; 2888 } 2889 if (!$(val).hasClass('start_animation')) { 2890 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 2891 var thumbInView = new Waypoint.Inview({ 2892 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2893 element: val, 2894 enter: function(direction) { 2895 var element = $(this.element), 2896 delayAttr = parseInt(element.attr('data-delay')), 2897 itemIndex = element.closest('.owl-item').index() + 1, 2898 diffItem = Math.abs(itemIndex - tempIndex) - 1; 2899 if (itemIndex > tempIndex) { 2900 thiis.data('tempIndex', itemIndex); 2901 } 2902 if (isNaN(delayAttr)) delayAttr = 100; 2903 if (stagePadding) { 2904 var objTimeout = requestTimeout(function() { 2905 element.addClass('start_animation'); 2906 }, index * delayAttr); 2907 lastDelay = index * delayAttr; 2908 } else { 2909 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 2910 var objTimeout = requestTimeout(function() { 2911 element.addClass('start_animation'); 2912 }, diffItem * delayAttr); 2913 lastDelay = diffItem * delayAttr; 2914 } 2915 parent.data('objTimeout', objTimeout); 2916 if (!UNCODE.isUnmodalOpen) { 2917 this.destroy(); 2918 } 2919 } 2920 }); 2921 } 2922 } 2923 }); 2924 return lastDelay; 2925 } 2926 2927 function setItemsHeight(item) { 2928 $.each($('.owl-item', item), function(index, val) { 2929 var availableThumbHeight = $('.t-inside', $(val)).height(), 2930 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 2931 difference = availableThumbHeight - innerThumbHeight; 2932 if ($('.tmb-content-under', val).length) { 2933 var visualPart = $('.t-entry-visual', val); 2934 if (visualPart.length) { 2935 difference -= $('.t-entry-visual', val).height(); 2936 } 2937 } 2938 if (! $('.tmb-content-lateral', val).length) 2939 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 2940 }); 2941 } 2942 2943 function setItemsRelHeight(item) { 2944 $.each($('.owl-item', item), function(index, val) { 2945 var $rowContainer = $(item).parents('.row-parent').eq(0), 2946 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2947 $colContainer = $(item).parents('.uncell').eq(0), 2948 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 2949 winHeight = UNCODE.wheight, 2950 multiplier_h = parseInt($(item).attr('data-vp-height')), 2951 data_viewport_h, 2952 consider_menu = $(item).data('vp-menu'); 2953 2954 if ( consider_menu ) { 2955 winHeight = winHeight - UNCODE.menuHeight; 2956 } 2957 2958 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 2959 $('.t-inside', val).css( 'height', data_viewport_h ); 2960 }); 2961 } 2962 2963 function pauseOnHover(slider) { 2964 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 2965 mouseenter: function () { 2966 $(slider).addClass('owl-mouseenter'); 2967 $(slider).trigger('stop.owl.autoplay'); 2968 }, 2969 mouseleave: function () { 2970 $(slider).removeClass('owl-mouseenter'); 2971 $(slider).trigger('play.owl.autoplay'); 2972 } 2973 }); 2974 } 2975 }); 2976}; 2977 2978UNCODE.owlPlayVideo = function(carousel) { 2979 var player, iframe; 2980 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 2981 var content = $(val).html(); 2982 if (content == '') { 2983 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 2984 $(val).append(getCloned); 2985 } 2986 if ($(this).attr('data-provider') == 'vimeo') { 2987 iframe = $(this).find('iframe'); 2988 player = $f(iframe[0]); 2989 player.api('play'); 2990 } else if ($(this).attr('data-provider') == 'youtube') { 2991 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 2992 } else { 2993 var player = $(this).find('video'); 2994 if (player.length) { 2995 $(this).find('video')[0].volume = 0; 2996 $(this).find('video')[0].play(); 2997 $(val).css('opacity', 1); 2998 } 2999 } 3000 }); 3001}; 3002 3003UNCODE.owlStopVideo = function(carousel) { 3004 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 3005 var player, iframe; 3006 if ($(this).attr('data-provider') == 'vimeo') { 3007 iframe = $(this).find('iframe'); 3008 player = $f(iframe[0]); 3009 player.api('pause'); 3010 } else if ($(this).attr('data-provider') == 'youtube') { 3011 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 3012 } else { 3013 var player = $(this).find('video'); 3014 if (player.length) { 3015 $(this).find('video')[0].volume = 0; 3016 $(this).find('video')[0].play(); 3017 } 3018 } 3019 }); 3020}; 3021 3022UNCODE.animations = function() { 3023 3024 var runWaypoints_TO, 3025 runWaypoints_carousel_TO, 3026 runWaypoints_delay = 0, 3027 highlightComplexFunc = function($wrap, ev){ 3028 3029 var $lines = $('.heading-line-wrap', $wrap), 3030 not_animate = false;
3031 3032 if ( $wrap.data('animate') === true ) { 3033 not_animate = true; 3034 } 3035 3036 var $rotatingTxt = $('.uncode-rotating-text-start', $wrap); 3037 if ( $rotatingTxt.length && $rotatingTxt.attr('data-animated') !== 'true' ) { 3038 return; 3039 } 3040 3041 $lines.each(function(_key, _value){ 3042 var $line = $(_value), 3043 $inners = $('.split-word-inner', $line), 3044 $highlights = $('.heading-text-highlight-inner', $line); 3045 3046 var highlitInnerFunc = function(ev){ 3047 var delay = 0; 3048 $highlights.each(function(h_key, high){ 3049 var $highlight = $(high), 3050 $split = $highlight.closest('.split-word:not(.uncode-rotating-span)'), 3051 $nextSplit = $split.nextUntil(), 3052 $next = $('.heading-text-highlight-inner', $nextSplit), 3053 countCh = $split.text().length; 3054 3055 $highlight.css({ 3056 '-webkit-transition-duration': (30 * countCh) + 'ms', 3057 '-moz-transition-duration': (30 * countCh) + 'ms', 3058 '-o-transition-duration': (30 * countCh) + 'ms', 3059 'transition-duration': (30 * countCh) + 'ms', 3060 }); 3061 3062 delay += (30 * countCh); 3063 3064 $next.css({ 3065 '-webkit-transition-delay': delay + 'ms', 3066 '-moz-transition-delay': delay + 'ms', 3067 '-o-transition-delay': delay + 'ms', 3068 'transition-delay': delay + 'ms', 3069 }); 3070 }); 3071 $highlights.removeAttr('data-animated'); 3072 if ( _key+1 === $lines.length ) { 3073 $wrap.data('animate', true); 3074 } 3075 }; 3076 3077 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 3078 if ( not_animate ) { 3079 $highlights.each(function(h_key, high){ 3080 var $highlight = $(high); 3081 $highlight.css({ 3082 '-webkit-transition-duration': '0ms', 3083 '-moz-transition-duration': '0ms', 3084 '-o-transition-duration': '0ms', 3085 'transition-duration': '0ms', 3086 }); 3087 }); 3088 $highlights.removeAttr('data-animated'); 3089 } else { 3090 if ( typeof ev !== 'undefined' && ev.type === 'defer-highlights' ) { 3091 highlitInnerFunc(); 3092 } else { 3093 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', highlitInnerFunc); 3094 } 3095 } 3096 } 3097 }); 3098 }; 3099 3100 $.each($('.header-content-inner'), function(index, val) { 3101 var element = $(val), 3102 transition = ''; 3103 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 3104 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 3105 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 3106 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 3107 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 3108 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 3109 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 3110 if (transition != '') { 3111 $(val).removeClass(transition); 3112 var container = element, 3113 containerDelay = container.attr('data-delay'), 3114 containerSpeed = container.attr('data-speed'), 3115 items = $('.header-title > *, .post-info', container); 3116 $.each(items, function(index, val) { 3117 var element = $(val), 3118 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 3119 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 3120 if (!element.hasClass('animate_when_almost_visible')) { 3121 delayAttr = Number(delayAttr) + (400 * index); 3122 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 3123 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 3124 } 3125 }); 3126 container.css('opacity', 1); 3127 } 3128 }); 3129 3130 window.waypoint_animation = function(ev) { 3131 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text'), function(index, val) { 3132 if ( $(val).hasClass('el-text-split') ) { 3133 return true; 3134 } 3135 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3136 return; 3137 } 3138 var run = true, 3139 $carousel = $(val).closest('.owl-carousel'); 3140 if ( $carousel.length ) { 3141 run = false; 3142 } 3143 if (run) { 3144 new Waypoint({ 3145 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3146 element: val, 3147 handler: function() { 3148 var element = $(this.element), 3149 index = element.index(), 3150 delayAttr = element.attr('data-delay'); 3151 if (delayAttr == undefined) delayAttr = 0; 3152 requestTimeout(function() { 3153 element.addClass('start_animation'); 3154 }, delayAttr); 3155 if (!UNCODE.isUnmodalOpen) { 3156 this.destroy(); 3157 } 3158 }, 3159 offset: UNCODE.isFullPage ? '100%' : '90%' 3160 }); 3161 } 3162 }); 3163 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 3164 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3165 return; 3166 } 3167 var run = true, 3168 $carousel = $(val).closest('.owl-carousel'); 3169 if ( $carousel.length ) { 3170 run = false;
3171 } 3172 if (run) { 3173 new Waypoint({ 3174 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3175 element: val, 3176 handler: function() { 3177 var $element = $(this.element), 3178 $childs = $('.animate_when_parent_almost_visible', $element); 3179 $childs.each(function(key,el){ 3180 var $child = $(el), 3181 delaySpeed = $child.attr('data-speed'), 3182 delayAttr = $child.attr('data-delay'), 3183 intervalAttr = $child.attr('data-interval'); 3184 if (delayAttr == undefined) { 3185 delayAttr = 50*key; 3186 } 3187 requestTimeout(function() { 3188 $child.addClass('start_animation'); 3189 if ( $child.hasClass('anim-line-checker') ) { 3190 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3191 var $line = $child.closest('.heading-line-wrap'); 3192 }); 3193 } 3194 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3195 highlightComplexFunc($wrapText, ev); 3196 if ( $child.hasClass('anim-tot-checker') ) { 3197 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3198 if ( $child.hasClass('anim-tot-checker') ) { 3199 $wrapText.addClass('already-animated'); 3200 $element.trigger('already-animated'); 3201 } 3202 }); 3203 } 3204 }, delayAttr ); 3205 }); 3206 $element.addClass('start_animation'); 3207 if (!UNCODE.isUnmodalOpen) { 3208 this.destroy(); 3209 } 3210 }, 3211 offset: UNCODE.isFullPage ? '100%' : '90%' 3212 }); 3213 } 3214 }); 3215 } 3216 window.waypoint_carousel_animation = function(ev) { 3217 $.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) { 3218 if ( $(val).hasClass('el-text-split') ) { 3219 return true; 3220 } 3221 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3222 return; 3223 } 3224 var run = true, 3225 $carousel = $(val).closest('.owl-carousel'), 3226 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3227 $all_first = $('.owl-item[data-index="1"]', $carousel); 3228 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3229 run = false; 3230 } 3231 if (run) { 3232 new Waypoint({ 3233 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3234 element: val, 3235 handler: function() { 3236 var element = $(this.element), 3237 index = element.index(), 3238 delayAttr = element.attr('data-delay'); 3239 if (delayAttr == undefined) delayAttr = 0; 3240 requestTimeout(function() { 3241 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3242 $all_first.attr('data-already-reached', 'true'); 3243 } 3244 element.addClass('start_animation'); 3245 }, delayAttr); 3246 if (!UNCODE.isUnmodalOpen) { 3247 this.destroy(); 3248 } 3249 }, 3250 offset: UNCODE.isFullPage ? '100%' : '90%' 3251 }); 3252 } 3253 }); 3254 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 3255 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3256 return; 3257 } 3258 var run = true, 3259 $carousel = $(val).closest('.owl-carousel'), 3260 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3261 $all_first = $('.owl-item[data-index="1"]', $carousel); 3262 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3263 run = false; 3264 } 3265 if (run) { 3266 new Waypoint({ 3267 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3268 element: val, 3269 handler: function() { 3270 var $element = $(this.element), 3271 $childs = $('.animate_when_parent_almost_visible', $element); 3272 $childs.each(function(key,el){ 3273 var $child = $(el), 3274 delaySpeed = $child.attr('data-speed'), 3275 delayAttr = $child.attr('data-delay'), 3276 intervalAttr = $child.attr('data-interval'); 3277 if (delayAttr == undefined) { 3278 delayAttr = 50*key; 3279 } 3280 requestTimeout(function() { 3281 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3282 $all_first.attr('data-already-reached', 'true'); 3283 } 3284 $child.addClass('start_animation'); 3285 if ( $child.hasClass('anim-line-checker') ) { 3286 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3287 var $line = $child.closest('.heading-line-wrap'); 3288 }); 3289 } 3290 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3291 highlightComplexFunc($wrapText, ev); 3292 if ( $child.hasClass('anim-tot-checker') ) { 3293 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3294 if ( $child.hasClass('anim-tot-checker') ) { 3295 $wrapText.addClass('already-animated'); 3296 } 3297 }); 3298 } 3299 }, delayAttr ); 3300 }); 3301 $element.addClass('start_animation'); 3302 if (!UNCODE.isUnmodalOpen) { 3303 this.destroy(); 3304 } 3305 }, 3306 offset: UNCODE.isFullPage ? '100%' : '90%' 3307 }); 3308 } 3309 }); 3310 } 3311 3312 var runWaypoints = function(ev){ 3313 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 3314 runWaypoints_delay = 400; 3315 } 3316 clearRequestTimeout(runWaypoints_TO); 3317 runWaypoints_TO = requestTimeout(function() { 3318 window.waypoint_animation(ev); 3319 }, runWaypoints_delay); 3320 3321 clearRequestTimeout(runWaypoints_carousel_TO); 3322 runWaypoints_carousel_TO = requestTimeout(function() { 3323 window.waypoint_carousel_animation(ev); 3324 }, 400); 3325 }; 3326 runWaypoints(); 3327 $( document.body ).on( 'uncode_waypoints defer-highlights', function(ev) { 3328 runWaypoints(ev); 3329 }); 3330 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3331 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 3332 } 3333}; 3334 3335UNCODE.tapHover = function() { 3336 3337 var $el = $('html.touch .tmb:not(.tmb-no-double-tap)').find('.t-entry-v
3337isual-cont > a, .drop-hover-link'), //.length //html.touch a.btn 3338 elClass = "hover"; 3339 3340 $(window).on('click', function() { 3341 $el.removeClass(elClass); 3342 }); 3343 3344 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 3345 e.stopPropagation(); 3346 var link = $(this); 3347 if ( ! link.hasClass(elClass)) { 3348 e.preventDefault(); 3349 link.addClass("hover"); 3350 $el.not(this).removeClass(elClass); 3351 return false; 3352 } 3353 }); 3354}; 3355 3356UNCODE.onePage = function(isMobile) { 3357 var current = 0, 3358 last = 0, 3359 lastScrollTop = 0, 3360 forceScroll = false, 3361 lastScrolled = 0, 3362 isSectionscroller = ($('.main-onepage').length) ? true : false, 3363 isOnePage = false, 3364 getOffset = function () { 3365 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0); 3366 return calculateOffset; 3367 } 3368 3369 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 3370 // return false; 3371 3372 function init_onepage() { 3373 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 3374 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 3375 } 3376 last = $('.onepage-pagination li').last().find('a').data('index'); 3377 $.each($('div[data-parent=true]'), function(index, val) { 3378 $(this).attr('data-section', index); 3379 if (isMobile) return; 3380 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3381 return; 3382 } 3383 var sectionDown = new Waypoint({ 3384 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3385 element: val, 3386 handler: function(direction) { 3387 if (direction == 'down') { 3388 changeMenuActive(this.element, index); 3389 } 3390 }, 3391 offset: function() { 3392 return 5 + getOffset() 3393 } 3394 }); 3395 var sectionUp = new Waypoint({ 3396 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3397 element: val, 3398 handler: function(direction) { 3399 if (direction == 'up') { 3400 changeMenuActive(this.element, index); 3401 } 3402 }, 3403 offset: function() { 3404 return -5 - getOffset() 3405 } 3406 }); 3407 3408 if (isSectionscroller) { 3409 var label; 3410 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 3411 else label = ''; 3412 var getName = $(this).attr('data-name'); 3413 if (getName == undefined) getName = index; 3414 if (label != '') { 3415 isOnePage = true; 3416 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 3417 $('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>"); 3418 } 3419 } 3420 }); 3421 3422 if (isSectionscroller) { 3423 $.each($('ul.onepage-pagination li'), function(index, val) { 3424 var $this = $(val); 3425 $this.on('click', function(evt) { 3426 if ( $('body').hasClass('uncode-scroll-no-history') ) 3427 evt.preventDefault(); 3428 Waypoint.refreshAll(); 3429 var el = $('a', evt.currentTarget); 3430 current = lastScrolled = parseInt(el.attr('data-index')); 3431 lastScrolled += 1; 3432 scrollBody(current); 3433 }); 3434 }); 3435 } 3436 3437 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 3438 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 3439 goToSection = String(window.location.hash).replace(/^#/, ""); 3440 goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section')); 3441 } 3442 3443 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 3444 current = lastScrolled = goToSection; 3445 $(window).on('load', function(){ 3446 if ( $('.owl-carousel').length ) { 3447 requestTimeout(function(){ 3448 scrollBody(goToSection); 3449 }, 400); 3450 } else { 3451 scrollBody(goToSection); 3452 } 3453 }); 3454 } 3455 3456 } 3457 3458 function changeMenuActive(section, index) { 3459 current = lastScrolled = parseInt($(section).attr('data-section')); 3460 if (isOnePage) { 3461 var newSection = $('.onepage-pagination li a[data-index=' + index + ']'); 3462 if (newSection.length) { 3463 $('ul.onepage-pagination li a').removeClass('is-selected'); 3464 newSection.addClass('is-selected'); 3465 } 3466 var getName = $('[data-section=' + index + ']').attr('data-name'); 3467 if (getName != undefined && getName !== '') { 3468 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 3469 var get_href = $(val).attr('href'); 3470 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 3471 $(val).closest('.menu-smart').find('.active').removeClass('active'); 3472 $(val).parent().addClass('active'); 3473 } 3474 }); 3475 } 3476 } 3477 } 3478 3479 if (isOnePage) { 3480 $(window).on('scroll', function() { 3481 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 3482 if (bodyTop == 0) { 3483 $('ul.onepage-pagination li a').removeClass('is-selected'); 3484 $('.onepage-pagination li a[data-index=0]').addClass('is-selected'); 3485 var getName = $('[data-section=0]').attr('data-name'); 3486 if (getName != undefined && getName !== '') { 3487 $.each($('.menu-container .menu-item > a'), function(i, val) { 3488 var get_href = $(val).attr('href'); 3489 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 3490 $(val).closest('ul').find('.active').removeClass('active'); 3491 $(val).parent().addClass('active'); 3492 } 3493 }); 3494 } 3495 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 3496 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 3497 if (lastSection.length) { 3498 $('ul.onepage-pagination li a').removeClass('is-selected'); 3499 lastSection.addClass('is-selected'); 3500 } 3501 } 3502 }); 3503 } 3504 3505 var scrollBody = function(index) { 3506 $('ul.onepage-pagination li a').removeClass('is-selected'); 3507 $('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected'); 3508 3509 var getSection = $('[data-section=' + index + ']'), 3510 scrollTo; 3511 3512 if (getSection == undefined) return; 3513 3514 var body = $("html, body"), 3515 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3516 delta = bodyTop - ($('[data-section=' + index + ']').length ? $('[data-section=' + index + ']').offset().top : 0), 3517 getOffset = UNCODE.get_scroll_offset(index); 3518 if ( typeof getSection.offset() === 'undefined' ) 3519 return; 3520 scrollTo = getSection.offset().top; 3521 3522 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 3523 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 3524 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 3525 } 3526 3527 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && $('.body').hasClass('vmenu') ) { 3528 if ( index === 0 ) { 3529 scrollTo = 0; 3530 } else { 3531 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 3532 } 3533 } else { 3534 scrollTo -= getOffset; 3535 } 3536 3537 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 3538 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3539 3540 if (index != 0) { 3541 UNCODE.scrolling = true; 3542 } 3543 3544 if (scrollSpeed == 0) { 3545 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 3546 UNCODE.scrolling = false;
3547 } else { 3548 body.animate({ 3549 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 3550 }, scrollSpeed, 'easeInOutQuad', function() { 3551 requestTimeout(function(){ 3552 UNCODE.scrolling = false; 3553 if (getOffset != UNCODE.get_scroll_offset(index)) { 3554 scrollBody(index); 3555 } 3556 }, 100); 3557 }); 3558 } 3559 3560 }; 3561 3562 init_onepage(); 3563}; 3564 3565UNCODE.stickyElements = function() { 3566 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 3567 if (!isMobile_wide) { 3568 3569 var $pageHeader = $('#page-header'), 3570 $headerRow = $('.vc_row', $pageHeader), 3571 startSticky = false; 3572 3573 if ( $headerRow.hasClass('sticky-element') ) { 3574 $headerRow.removeClass('sticky-element'); 3575 $pageHeader.addClass('sticky-element'); 3576 startSticky = true; 3577 } 3578 3579 var calculateOffset = function(el) { 3580 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 3581 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 3582 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0; 3583 3584 sideOffset += UNCODE.bodyBorder; 3585 3586 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 3587 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-desktop-transparent').length) { 3588 if ($('.menu-shrink').length) { 3589 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 3590 } else { 3591 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 3592 } 3593 } 3594 3595 return sideOffset; 3596 3597 }, 3598 3599 initStickyElement = function() { 3600 $.each($('.sticky-element'), function(index, element) { 3601 $(element).stick_in_parent({ 3602 sticky_class: 'is_stucked', 3603 offset_top: calculateOffset(element), 3604 bottoming: true, 3605 inner_scrolling: SiteParameters.sticky_elements === 'on' 3606 }); 3607 }); 3608 }; 3609 3610 requestTimeout(function() { 3611 if ($('.sticky-element').length) { 3612 3613 if ($(window).width() > UNCODE.mediaQuery) { 3614 initStickyElement(); 3615 3616 if ( startSticky === true ) { 3617 $('#page-header').trigger('sticky_kit:recalc'); 3618 } 3619 } 3620 3621 $(window).on('resize', function(event) { 3622 if ($(window).width() > UNCODE.mediaQuery) { 3623 initStickyElement(); 3624 } else { 3625 $(".sticky-element").trigger("sticky_kit:detach"); 3626 } 3627 }); 3628 } 3629 }, 1000); 3630 3631 var $panels = $('.panel-collapse'); 3632 if ( $panels.length ) { 3633 $panels.each(function(){ 3634 var $panel = $(this); 3635 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 3636 $(document.body).trigger("sticky_kit:recalc"); 3637 }); 3638 }); 3639 } 3640 } 3641}; 3642 3643UNCODE.twentytwenty = function() { 3644 3645 if (!$('.twentytwenty-container').length) return; 3646 3647// DOM.event.move 3648// 3649// 2.0.0 3650// 3651// Stephen Band 3652// 3653// Triggers 'movestart', 'move' and 'moveend' events after 3654// mousemoves following a mousedown cross a distance threshold, 3655// similar to the native 'dragstart', 'drag' and 'dragend' events. 3656// Move events are throttled to animation frames. Move event objects 3657// have the properties: 3658// 3659// pageX: 3660// pageY: Page coordinates of pointer. 3661// startX: 3662// startY: Page coordinates of pointer at movestart. 3663// distX: 3664// distY: Distance the pointer has moved since movestart. 3665// deltaX: 3666// deltaY: Distance the finger has moved since last event. 3667// velocityX: 3668// velocityY: Average velocity over last few events. 3669 3670 3671(function(fn) { 3672 if (typeof define === 'function' && define.amd) { 3673 define([], fn); 3674 } else if ((typeof module !== "undefined" && module !== null) && module.exports) { 3675 module.exports = fn; 3676 } else { 3677 fn(); 3678 } 3679})(function(){ 3680 var assign = Object.assign || window.jQuery && jQuery.extend; 3681 3682 // Number of pixels a pressed pointer travels before movestart 3683 // event is fired. 3684 var threshold = 8; 3685 3686 // Shim for requestAnimationFrame, falling back to timer. See: 3687 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 3688 var requestFrame = (function(){ 3689 return ( 3690 window.requestAnimationFrame || 3691 window.webkitRequestAnimationFrame || 3692 window.mozRequestAnimationFrame || 3693 window.oRequestAnimationFrame || 3694 window.msRequestAnimationFrame || 3695 function(fn, element){ 3696 return window.setTimeout(function(){ 3697 fn(); 3698 }, 25); 3699 } 3700 ); 3701 })(); 3702 3703 // Shim for customEvent 3704 // see https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill 3705 (function () { 3706 if ( typeof window.CustomEvent === "function" ) return false;
3707 function CustomEvent ( event, params ) { 3708 params = params || { bubbles: false, cancelable: false, detail: undefined }; 3709 var evt = document.createEvent( 'CustomEvent' ); 3710 evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail ); 3711 return evt; 3712 } 3713 3714 CustomEvent.prototype = window.Event.prototype; 3715 window.CustomEvent = CustomEvent; 3716 })(); 3717 3718 var ignoreTags = { 3719 textarea: true, 3720 input: true, 3721 select: true, 3722 button: true 3723 }; 3724 3725 var mouseevents = { 3726 move: 'mousemove', 3727 cancel: 'mouseup dragstart', 3728 end: 'mouseup' 3729 }; 3730 3731 var touchevents = { 3732 move: 'touchmove', 3733 cancel: 'touchend', 3734 end: 'touchend' 3735 }; 3736 3737 var rspaces = /\s+/; 3738 3739 3740 // DOM Events 3741 3742 var eventOptions = { bubbles: true, cancelable: true }; 3743 3744 var eventsSymbol = typeof Symbol === "function" ? Symbol('events') : {}; 3745 3746 function createEvent(type) { 3747 return new CustomEvent(type, eventOptions); 3748 } 3749 3750 function getEvents(node) { 3751 return node[eventsSymbol] || (node[eventsSymbol] = {}); 3752 } 3753 3754 function on(node, types, fn, data, selector) { 3755 types = types.split(rspaces); 3756 3757 var events = getEvents(node); 3758 var i = types.length; 3759 var handlers, type; 3760 3761 function handler(e) { fn(e, data); } 3762 3763 while (i--) { 3764 type = types[i]; 3765 handlers = events[type] || (events[type] = []); 3766 handlers.push([fn, handler]); 3767 node.addEventListener(type, handler); 3768 } 3769 } 3770 3771 function off(node, types, fn, selector) { 3772 types = types.split(rspaces); 3773 3774 var events = getEvents(node); 3775 var i = types.length;
3776 var type, handlers, k; 3777 3778 if (!events) { return; } 3779 3780 while (i--) { 3781 type = types[i]; 3782 handlers = events[type]; 3783 if (!handlers) { continue; } 3784 k = handlers.length; 3785 while (k--) { 3786 if (handlers[k][0] === fn) { 3787 node.removeEventListener(type, handlers[k][1]); 3788 handlers.splice(k, 1); 3789 } 3790 } 3791 } 3792 } 3793 3794 function trigger(node, type, properties) { 3795 // Don't cache events. It prevents you from triggering an event of a 3796 // given type from inside the handler of another event of that type. 3797 var event = createEvent(type); 3798 if (properties) { assign(event, properties); } 3799 node.dispatchEvent(event); 3800 } 3801 3802 3803 // Constructors 3804 3805 function Timer(fn){ 3806 var callback = fn, 3807 active = false, 3808 running = false; 3809 3810 function trigger(time) { 3811 if (active){ 3812 callback(); 3813 requestFrame(trigger); 3814 running = true; 3815 active = false; 3816 } 3817 else { 3818 running = false; 3819 } 3820 } 3821 3822 this.kick = function(fn) { 3823 active = true; 3824 if (!running) { trigger(); } 3825 }; 3826 3827 this.end = function(fn) { 3828 var cb = callback; 3829 3830 if (!fn) { return; } 3831 3832 // If the timer is not running, simply call the end callback. 3833 if (!running) { 3834 fn(); 3835 } 3836 // If the timer is running, and has been kicked lately, then 3837 // queue up the current callback and the end callback, otherwise 3838 // just the end callback. 3839 else { 3840 callback = active ? 3841 function(){ cb(); fn(); } : 3842 fn ; 3843 3844 active = true; 3845 } 3846 }; 3847 } 3848 3849 3850 // Functions 3851 3852 function noop() {} 3853 3854 function preventDefault(e) { 3855 e.preventDefault(); 3856 } 3857 3858 function isIgnoreTag(e) { 3859 return !!ignoreTags[e.target.tagName.toLowerCase()]; 3860 } 3861 3862 function isPrimaryButton(e) { 3863 // Ignore mousedowns on any button other than the left (or primary) 3864 // mouse button, or when a modifier key is pressed. 3865 return (e.which === 1 && !e.ctrlKey && !e.altKey); 3866 } 3867 3868 function identifiedTouch(touchList, id) { 3869 var i, l; 3870 3871 if (touchList.identifiedTouch) { 3872 return touchList.identifiedTouch(id); 3873 } 3874 3875 // touchList.identifiedTouch() does not exist in 3876 // webkit yet… we must do the search ourselves... 3877 3878 i = -1; 3879 l = touchList.length; 3880 3881 while (++i < l) { 3882 if (touchList[i].identifier === id) { 3883 return touchList[i]; 3884 } 3885 } 3886 } 3887 3888 function changedTouch(e, data) { 3889 var touch = identifiedTouch(e.changedTouches, data.identifier); 3890 3891 // This isn't the touch you're looking for. 3892 if (!touch) { return; } 3893 3894 // Chrome Android (at least) includes touches that have not 3895 // changed in e.changedTouches. That's a bit annoying. Check 3896 // that this touch has changed. 3897 if (touch.pageX === data.pageX && touch.pageY === data.pageY) { return; } 3898 3899 return touch; 3900 } 3901 3902 3903 // Handlers that decide when the first movestart is triggered 3904 3905 function mousedown(e){ 3906 // Ignore non-primary buttons 3907 if (!isPrimaryButton(e)) { return; } 3908 3909 // Ignore form and interactive elements 3910 if (isIgnoreTag(e)) { return; } 3911 3912 on(document, mouseevents.move, mousemove, e); 3913 on(document, mouseevents.cancel, mouseend, e); 3914 } 3915 3916 function mousemove(e, data){ 3917 checkThreshold(e, data, e, removeMouse); 3918 } 3919 3920 function mouseend(e, data) { 3921 removeMouse(); 3922 } 3923 3924 function removeMouse() { 3925 off(document, mouseevents.move, mousemove); 3926 off(document, mouseevents.cancel, mouseend); 3927 } 3928 3929 function touchstart(e) { 3930 // Don't get in the way of interaction with form elements 3931 if (ignoreTags[e.target.tagName.toLowerCase()]) { return; } 3932 3933 var touch = e.changedTouches[0]; 3934 3935 // iOS live updates the touch objects whereas Android gives us copies. 3936 // That means we can't trust the touchstart object to stay the same, 3937 // so we must copy the data. This object acts as a template for 3938 // movestart, move and moveend event objects. 3939 var data = { 3940 target: touch.target, 3941 pageX: touch.pageX, 3942 pageY: touch.pageY, 3943 identifier: touch.identifier, 3944 3945 // The only way to make handlers individually unbindable is by 3946 // making them unique. 3947 touchmove: function(e, data) { touchmove(e, data); }, 3948 touchend: function(e, data) { touchend(e, data); } 3949 }; 3950 3951 on(document, touchevents.move, data.touchmove, data); 3952 on(document, touchevents.cancel, data.touchend, data); 3953 } 3954 3955 function touchmove(e, data) { 3956 var touch = changedTouch(e, data); 3957 if (!touch) { return; } 3958 checkThreshold(e, data, touch, removeTouch); 3959 } 3960 3961 function touchend(e, data) { 3962 var touch = identifiedTouch(e.changedTouches, data.identifier); 3963 if (!touch) { return; } 3964 removeTouch(data); 3965 } 3966 3967 function removeTouch(data) { 3968 off(document, touchevents.move, data.touchmove); 3969 off(document, touchevents.cancel, data.touchend); 3970 } 3971 3972 function checkThreshold(e, data, touch, fn) { 3973 var distX = touch.pageX - data.pageX; 3974 var distY = touch.pageY - data.pageY; 3975
3976 // Do nothing if the threshold has not been crossed. 3977 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 3978 3979 triggerStart(e, data, touch, distX, distY, fn); 3980 } 3981 3982 function triggerStart(e, data, touch, distX, distY, fn) { 3983 var touches = e.targetTouches; 3984 var time = e.timeStamp - data.timeStamp; 3985 3986 // Create a movestart object with some special properties that 3987 // are passed only to the movestart handlers. 3988 var template = { 3989 altKey: e.altKey, 3990 ctrlKey: e.ctrlKey, 3991 shiftKey: e.shiftKey, 3992 startX: data.pageX, 3993 startY: data.pageY, 3994 distX: distX, 3995 distY: distY, 3996 deltaX: distX, 3997 deltaY: distY, 3998 pageX: touch.pageX, 3999 pageY: touch.pageY, 4000 velocityX: distX / time, 4001 velocityY: distY / time, 4002 identifier: data.identifier, 4003 targetTouches: touches, 4004 finger: touches ? touches.length : 1, 4005 enableMove: function() { 4006 this.moveEnabled = true; 4007 this.enableMove = noop; 4008 e.preventDefault(); 4009 } 4010 }; 4011 4012 // Trigger the movestart event. 4013 trigger(data.target, 'movestart', template); 4014 4015 // Unbind handlers that tracked the touch or mouse up till now. 4016 fn(data); 4017 } 4018 4019 4020 // Handlers that control what happens following a movestart 4021 4022 function activeMousemove(e, data) { 4023 var timer = data.timer; 4024 4025 data.touch = e; 4026 data.timeStamp = e.timeStamp; 4027 timer.kick(); 4028 } 4029 4030 function activeMouseend(e, data) { 4031 var target = data.target; 4032 var event = data.event; 4033 var timer = data.timer; 4034 4035 removeActiveMouse(); 4036 4037 endEvent(target, event, timer, function() { 4038 // Unbind the click suppressor, waiting until after mouseup 4039 // has been handled. 4040 setTimeout(function(){ 4041 off(target, 'click', preventDefault); 4042 }, 0); 4043 }); 4044 } 4045 4046 function removeActiveMouse() { 4047 off(document, mouseevents.move, activeMousemove); 4048 off(document, mouseevents.end, activeMouseend); 4049 } 4050 4051 function activeTouchmove(e, data) { 4052 var event = data.event; 4053 var timer = data.timer; 4054 var touch = changedTouch(e, event); 4055 4056 if (!touch) { return; } 4057 4058 // Stop the interface from gesturing 4059 e.preventDefault(); 4060 4061 event.targetTouches = e.targetTouches; 4062 data.touch = touch; 4063 data.timeStamp = e.timeStamp; 4064 4065 timer.kick(); 4066 } 4067 4068 function activeTouchend(e, data) { 4069 var target = data.target; 4070 var event = data.event; 4071 var timer = data.timer; 4072 var touch = identifiedTouch(e.changedTouches, event.identifier); 4073 4074 // This isn't the touch you're looking for. 4075 if (!touch) { return; } 4076 4077 removeActiveTouch(data); 4078 endEvent(target, event, timer); 4079 } 4080 4081 function removeActiveTouch(data) { 4082 off(document, touchevents.move, data.activeTouchmove); 4083 off(document, touchevents.end, data.activeTouchend); 4084 } 4085 4086 4087 // Logic for triggering move and moveend events 4088 4089 function updateEvent(event, touch, timeStamp) { 4090 var time = timeStamp - event.timeStamp; 4091 4092 event.distX = touch.pageX - event.startX; 4093 event.distY = touch.pageY - event.startY; 4094 event.deltaX = touch.pageX - event.pageX; 4095 event.deltaY = touch.pageY - event.pageY; 4096 4097 // Average the velocity of the last few events using a decay 4098 // curve to even out spurious jumps in values. 4099 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 4100 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 4101 event.pageX = touch.pageX; 4102 event.pageY = touch.pageY; 4103 } 4104 4105 function endEvent(target, event, timer, fn) { 4106 timer.end(function(){ 4107 trigger(target, 'moveend', event); 4108 return fn && fn(); 4109 }); 4110 } 4111 4112 4113 // Set up the DOM 4114 4115 function movestart(e) { 4116 if (e.defaultPrevented) { return; } 4117 if (!e.moveEnabled) { return; } 4118 4119 var event = { 4120 startX: e.startX, 4121 startY: e.startY, 4122 pageX: e.pageX, 4123 pageY: e.pageY, 4124 distX: e.distX, 4125 distY: e.distY, 4126 deltaX: e.deltaX, 4127 deltaY: e.deltaY, 4128 velocityX: e.velocityX, 4129 velocityY: e.velocityY, 4130 identifier: e.identifier, 4131 targetTouches: e.targetTouches, 4132 finger: e.finger 4133 }; 4134 4135 var data = { 4136 target: e.target, 4137 event: event, 4138 timer: new Timer(update), 4139 touch: undefined, 4140 timeStamp: e.timeStamp 4141 }; 4142 4143 function update(time) { 4144 updateEvent(event, data.touch, data.timeStamp); 4145 trigger(data.target, 'move', event); 4146 } 4147 4148 if (e.identifier === undefined) { 4149 // We're dealing with a mouse event. 4150 // Stop clicks from propagating during a move 4151 on(e.target, 'click', preventDefault); 4152 on(document, mouseevents.move, activeMousemove, data); 4153 on(document, mouseevents.end, activeMouseend, data); 4154 } 4155 else { 4156 // In order to unbind correct handlers they have to be unique 4157 data.activeTouchmove = function(e, data) { activeTouchmove(e, data); }; 4158 data.activeTouchend = function(e, data) { activeTouchend(e, data); }; 4159 4160 // We're dealing with a touch. 4161 on(document, touchevents.move, data.activeTouchmove, data); 4162 on(document, touchevents.end, data.activeTouchend, data); 4163 } 4164 } 4165 4166 on(document, 'mousedown', mousedown); 4167 on(document, 'touchstart', touchstart); 4168 on(document, 'movestart', movestart); 4169 4170 4171 // jQuery special events 4172 // 4173 // jQuery event objects are copies of DOM event objects. They need 4174 // a little help copying the move properties across. 4175 4176 if (!window.jQuery) { return; } 4177 4178 var properties = ("startX startY pageX pageY distX distY deltaX deltaY velocityX velocityY").split(' '); 4179 4180 function enableMove1(e) { e.enableMove(); } 4181 function enableMove2(e) { e.enableMove(); } 4182 function enableMove3(e) { e.enableMove(); } 4183 4184 function add(handleObj) { 4185 var handler = handleObj.handler; 4186 4187 handleObj.handler = function(e) { 4188 // Copy move properties across from originalEvent 4189 var i = properties.length; 4190 var property; 4191 4192 while(i--) { 4193 property = properties[i]; 4194 e[property] = e.originalEvent[property]; 4195 } 4196 4197 handler.apply(this, arguments); 4198 }; 4199 } 4200 4201 jQuery.event.special.movestart = { 4202 setup: function() { 4203 // Movestart must be enabled to allow other move events 4204 on(this, 'movestart', enableMove1); 4205 4206 // Do listen to DOM events 4207 return false;
4208 }, 4209 4210 teardown: function() { 4211 off(this, 'movestart', enableMove1); 4212 return false; 4213 }, 4214 4215 add: add 4216 }; 4217 4218 jQuery.event.special.move = { 4219 setup: function() { 4220 on(this, 'movestart', enableMove2); 4221 return false; 4222 }, 4223 4224 teardown: function() { 4225 off(this, 'movestart', enableMove2); 4226 return false; 4227 }, 4228 4229 add: add 4230 }; 4231 4232 jQuery.event.special.moveend = { 4233 setup: function() { 4234 on(this, 'movestart', enableMove3); 4235 return false; 4236 }, 4237 4238 teardown: function() { 4239 off(this, 'movestart', enableMove3); 4240 return false; 4241 }, 4242 4243 add: add 4244 }; 4245}); 4246 4247 $.fn.twentytwenty = function(options) { 4248 var options = $.extend({ 4249 default_offset_pct: 0.5, 4250 orientation: 'horizontal', 4251 before_label: 'Before', 4252 after_label: 'After', 4253 no_overlay: false, 4254 move_slider_on_hover: false, 4255 move_with_handle_only: true, 4256 click_to_move: false 4257 }, options); 4258 4259 return this.each(function() { 4260 4261 var sliderPct = options.default_offset_pct; 4262 var container = $(this); 4263 var sliderOrientation = options.orientation; 4264 var beforeDirection = (sliderOrientation === 'vertical') ? 'down' : 'left'; 4265 var afterDirection = (sliderOrientation === 'vertical') ? 'up' : 'right'; 4266 4267 4268 container.wrap("<div class='twentytwenty-wrapper twentytwenty-" + sliderOrientation + "'></div>"); 4269 if(!options.no_overlay) { 4270 container.append("<div class='twentytwenty-overlay'></div>"); 4271 var overlay = container.find(".twentytwenty-overlay"); 4272 overlay.append("<div class='twentytwenty-before-label' data-content='"+options.before_label+"'></div>"); 4273 overlay.append("<div class='twentytwenty-after-label' data-content='"+options.after_label+"'></div>"); 4274 } 4275 var beforeImg = container.find("img:first"); 4276 var afterImg = container.find("img:last"); 4277 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 4278 var slider = container.find(".twentytwenty-handle"); 4279 slider.append("<span class='twentytwenty-" + beforeDirection + "-arrow'></span>"); 4280 slider.append("<span class='twentytwenty-" + afterDirection + "-arrow'></span>"); 4281 container.addClass("twentytwenty-container"); 4282 beforeImg.addClass("twentytwenty-before"); 4283 afterImg.addClass("twentytwenty-after"); 4284 4285 var calcOffset = function(dimensionPct) { 4286 var w = beforeImg.width(); 4287 var h = beforeImg.height(); 4288 return { 4289 w: w+"px", 4290 h: h+"px", 4291 cw: (dimensionPct*w)+"px", 4292 ch: (dimensionPct*h)+"px" 4293 }; 4294 }; 4295 4296 var adjustContainer = function(offset) { 4297 if (sliderOrientation === 'vertical') { 4298 beforeImg.css("clip", "rect(0,"+offset.w+","+offset.ch+",0)"); 4299 afterImg.css("clip", "rect("+offset.ch+","+offset.w+","+offset.h+",0)"); 4300 } 4301 else { 4302 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 4303 afterImg.css("clip", "rect(0,"+offset.w+","+offset.h+","+offset.cw+")"); 4304 } 4305 container.css("height", offset.h); 4306 }; 4307 4308 var adjustSlider = function(pct) { 4309 var offset = calcOffset(pct); 4310 slider.css((sliderOrientation==="vertical") ? "top" : "left", (sliderOrientation==="vertical") ? offset.ch : offset.cw); 4311 adjustContainer(offset); 4312 }; 4313 4314 // Return the number specified or the min/max number if it outside the range given. 4315 var minMaxNumber = function(num, min, max) { 4316 return Math.max(min, Math.min(max, num)); 4317 }; 4318 4319 // Calculate the slider percentage based on the position. 4320 var getSliderPercentage = function(positionX, positionY) { 4321 var sliderPercentage = (sliderOrientation === 'vertical') ? 4322 (positionY-offsetY)/imgHeight : 4323 (positionX-offsetX)/imgWidth; 4324 4325 return minMaxNumber(sliderPercentage, 0, 1); 4326 }; 4327 4328 4329 $(window).on("resize.twentytwenty", function(e) { 4330 adjustSlider(sliderPct); 4331 }); 4332 4333 var offsetX = 0; 4334 var offsetY = 0; 4335 var imgWidth = 0; 4336 var imgHeight = 0; 4337 var onMoveStart = function(e) { 4338 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY)) && sliderOrientation !== 'vertical') { 4339 e.preventDefault(); 4340 } 4341 else if (((e.distX < e.distY && e.distX < -e.distY) || (e.distX > e.distY && e.distX > -e.distY)) && sliderOrientation === 'vertical') { 4342 e.preventDefault(); 4343 } 4344 container.addClass("active"); 4345 offsetX = container.offset().left; 4346 offsetY = container.offset().top; 4347 imgWidth = beforeImg.width(); 4348 imgHeight = beforeImg.height(); 4349 }; 4350 var onMove = function(e) { 4351 if (container.hasClass("active")) { 4352 sliderPct = getSliderPercentage(e.pageX, e.pageY); 4353 adjustSlider(sliderPct); 4354 } 4355 }; 4356 var onMoveEnd = function() { 4357 container.removeClass("active"); 4358 }; 4359 4360 var moveTarget = options.move_with_handle_only ? slider : container; 4361 moveTarget.on("movestart",onMoveStart); 4362 moveTarget.on("move",onMove); 4363 moveTarget.on("moveend",onMoveEnd); 4364 4365 if (options.move_slider_on_hover) { 4366 container.on("mouseenter", onMoveStart); 4367 container.on("mousemove", onMove); 4368 container.on("mouseleave", onMoveEnd); 4369 } 4370 4371 slider.on("touchmove", function(e) { 4372 e.preventDefault(); 4373 }); 4374 4375 container.find("img").on("mousedown", function(event) { 4376 event.preventDefault(); 4377 }); 4378 4379 if (options.click_to_move) { 4380 container.on('click', function(e) { 4381 offsetX = container.offset().left; 4382 offsetY = container.offset().top; 4383 imgWidth = beforeImg.width(); 4384 imgHeight = beforeImg.height(); 4385 4386 sliderPct = getSliderPercentage(e.pageX, e.pageY); 4387 adjustSlider(sliderPct); 4388 }); 4389 } 4390 4391 $(window).trigger("resize.twentytwenty"); 4392 }); 4393 }; 4394 4395 4396 $(window).on("load", function(e) { 4397 $('.twentytwenty-container').twentytwenty(); 4398 $('.twentytwenty-container img').on('async-done', function(){ 4399 $(this).closest('.twentytwenty-container').twentytwenty(); 4400 }); 4401 }); 4402} 4403 4404UNCODE.justifiedGallery = function() { 4405 4406 var breakPointMe = function( val ) { 4407 val = parseInt( val ); 4408 if ( isNaN(val) ) { 4409 return false;
4410 } 4411 if ( val >= 1500 ) { 4412 return 1; 4413 } else if ( val < 1500 && val >= 960 ) { 4414 return 2; 4415 } else if ( val < 960 && val >= 570 ) { 4416 return 3; 4417 } else if ( val < 570 ) { 4418 return 4; 4419 } 4420 } 4421 4422 var gutterByBreakpoint = function( bp, gutter ) { 4423 var ret; 4424 switch(gutter) { 4425 case 'no-gutter': 4426 ret = 0; 4427 break; 4428 case 'px-gutter': 4429 ret = 1; 4430 break; 4431 case 'half-gutter': 4432 ret = 18; 4433 break; 4434 case 'double-gutter': 4435 switch(bp) { 4436 case 3: 4437 case 4: 4438 ret = 36; 4439 break; 4440 default: 4441 ret = 72; 4442 break; 4443 } 4444 break; 4445 case 'triple-gutter': 4446 switch(bp) { 4447 case 3: 4448 case 4: 4449 ret = 36; 4450 break; 4451 default: 4452 ret = 108; 4453 break; 4454 } 4455 break; 4456 case 'quad-gutter': 4457 switch(bp) { 4458 case 2: 4459 ret = 108; 4460 break; 4461 case 3: 4462 ret = 72; 4463 break; 4464 case 4: 4465 ret = 36; 4466 break; 4467 default: 4468 ret = 144; 4469 break; 4470 } 4471 break; 4472 default: 4473 ret = 36;//single-gutter 4474 } 4475 return ret; 4476 } 4477 4478 if ($('.justified-layout').length > 0) { 4479 var justifiedContainersArray = [], 4480 typeGridArray = [], 4481 layoutGridArray = [], 4482 transitionDuration = [], 4483 $filterItems = [], 4484 $filters = $('.justified-system .isotope-filters'), 4485 $itemSelector = '.tmb', 4486 $items, 4487 itemMargin, 4488 correctionFactor = 0, 4489 firstLoad = true, 4490 isOriginLeft = $('body').hasClass('rtl') ? false : true, 4491 prevW = breakPointMe(UNCODE.wwidth); 4492 $('[class*="justified-container"]').each(function() { 4493 var isoData = $(this).data(); 4494 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 4495 if (isoData.type == 'metro') typeGridArray.push(true); 4496 else typeGridArray.push(false); 4497 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 4498 else layoutGridArray.push('justified'); 4499 justifiedContainersArray.push($(this)); 4500 }); 4501 var init_justifiedGallery = function() { 4502 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 4503 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 4504 justifiedId = justifiedSystem.attr('id'), 4505 $layoutMode = layoutGridArray[i], 4506 gutter = $(justifiedContainersArray[i]).data('gutter'), 4507 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 4508 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 4509 lastRow = $(justifiedContainersArray[i]).data('last-row'), 4510 margins; 4511 4512 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 4513 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 4514 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 4515 4516 margins = gutterByBreakpoint(prevW, gutter); 4517 4518 $(justifiedContainersArray[i]).justifiedGallery({ 4519 rowHeight: rowHeight, 4520 maxRowHeight: maxRowHeight, 4521 margins: margins, 4522 cssAnimation: true, 4523 lastRow: lastRow, 4524 waitThumbnailsLoad: false 4525 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 4526 } 4527 }, 4528 onLayout = function(justifiedObj, startIndex) { 4529 justifiedObj.css('opacity', 1); 4530 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 4531 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 4532 4533 requestTimeout(function() { 4534 // window.dispatchEvent(UNCODE.boxEvent); 4535 UNCODE.adaptive(); 4536 if (SiteParameters.dynamic_srcset_active === '1') { 4537 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 4538 } 4539 $(justifiedObj).find('audio,video').each(function() { 4540 $(this).mediaelementplayer({ 4541 pauseOtherPlayers: false, 4542 }); 4543 }); 4544 if ($(justifiedObj).find('.nested-carousel').length) { 4545 if (typeof UNCODE.carousel !== 'undefined') { 4546 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 4547 } 4548 requestTimeout(function() { 4549 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 4550 justifiedObj.addClass('justified-gallery-finished') 4551 Waypoint.refreshAll(); 4552 }, 200); 4553 } else { 4554 requestTimeout(function() { 4555 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 4556 justifiedObj.addClass('justified-gallery-finished') 4557 Waypoint.refreshAll(); 4558 }, 300); 4559 } 4560 }, 100); 4561 4562 }, 4563 boxAnimation = function(items, startIndex, sequential, container) { 4564 var $allItems = items.length - startIndex, 4565 showed = 0, 4566 index = 0; 4567 if (container.closest('.owl-item').length == 1) return false;
4568 $.each(items, function(index, val) { 4569 var elInner = $('> .t-inside', val); 4570 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4571 return; 4572 } 4573 if (val[0]) val = val[0]; 4574 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4575 new Waypoint({ 4576 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4577 element: val, 4578 handler: function() { 4579 var element = $('> .t-inside', this.element), 4580 parent = $(this.element), 4581 currentIndex = parent.index(); 4582 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 4583 delayAttr = parseInt(element.attr('data-delay')); 4584 if (isNaN(delayAttr)) delayAttr = 100; 4585 delay -= showed; 4586 var objTimeout = requestTimeout(function() { 4587 element.removeClass('zoom-reverse').addClass('start_animation'); 4588 showed = parent.index(); 4589 }, delay * delayAttr); 4590 parent.data('objTimeout', objTimeout); 4591 if (!UNCODE.isUnmodalOpen) { 4592 this.destroy(); 4593 } 4594 }, 4595 offset: '100%' 4596 }) 4597 } else { 4598 elInner.removeClass('animate_when_almost_visible'); 4599 $(val).addClass('no-waypoint-animation'); 4600 /*if (elInner.hasClass('force-anim')) { 4601 elInner.addClass('start_animation'); 4602 } else { 4603 elInner.css('opacity', 1); 4604 }*/ 4605 } 4606 index++; 4607 }); 4608 }; 4609 $filters.on('click', 'a[data-filter]', function(evt) { 4610 var $filter = $(this), 4611 filterContainer = $filter.closest('.isotope-filters'), 4612 filterValue = $filter.attr('data-filter'), 4613 container = $filter.closest('.justified-system').find($('.justified-layout')), 4614 lastRow = container.data('last-row'), 4615 transitionDuration = 0, 4616 delay = 300, 4617 filterItems = []; 4618 4619 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 4620 4621 if (!$filter.hasClass('active')) { 4622 /** Scroll top with filtering */ 4623 if (filterContainer.hasClass('filter-scroll')) { 4624 var calc_scroll = container.closest('.uncol').offset().top, 4625 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 4626 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 4627 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 4628 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 4629 4630 calc_scroll -= filterOffset - 1; 4631 calc_scroll -= UNCODE.get_scroll_offset(); 4632 4633 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4634 delta = bodyTop - calc_scroll, 4635 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4636 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4637 4638 if ( !UNCODE.isFullPage ) { 4639 if (scrollSpeed == 0) { 4640 $('html, body').scrollTop(calc_scroll); 4641 UNCODE.scrolling = false; 4642 } else { 4643 $('html, body').animate({ 4644 scrollTop: calc_scroll 4645 },{ 4646 easing: 'easeInOutQuad', 4647 duration: scrollSpeed, 4648 complete: function(){ 4649 UNCODE.scrolling = false; 4650 } 4651 }); 4652 } 4653 } 4654 } 4655 if (filterValue !== undefined) { 4656 $.each($('> .tmb > .t-inside', container), function(index, val) { 4657 var parent = $(val).parent(), 4658 objTimeout = parent.data('objTimeout'); 4659 if (objTimeout) { 4660 $(val).removeClass('zoom-reverse'); 4661 clearRequestTimeout(objTimeout); 4662 } 4663 if (transitionDuration == 0) { 4664 if ($(val).hasClass('animate_when_almost_visible')) { 4665 $(val).addClass('zoom-reverse').removeClass('start_animation'); 4666 } else { 4667 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 4668 } 4669 } 4670 }); 4671 4672 requestTimeout(function() { 4673 var $block, 4674 selector, 4675 lightboxElements, 4676 $boxes; 4677 4678 if ( filterValue !== '' && filterValue !== '*' ) { 4679 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 4680 selector = '.' + filterValue; 4681 $.each($(selector, container), function(index, block) { 4682 lightboxElements = $('[data-lbox^=ilightbox]', block); 4683 if (lightboxElements.length) { 4684 lightboxElements.removeClass('lb-disabled'); 4685 container.data('lbox', $(lightboxElements[0]).data('lbox')); 4686 } 4687 filterItems.push(block); 4688 }); 4689 container.justifiedGallery({ 4690 filter: selector, 4691 lastRow: 'nojustify' 4692 }); 4693 } else { 4694 container.justifiedGallery({ 4695 filter: false, 4696 lastRow: lastRow 4697 }); 4698 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 4699 filterItems = $('> .tmb', container); 4700 } 4701 4702 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 4703 if (typeof UNCODE.lightbox !== 'undefined') { 4704 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 4705 if (typeof getLightbox === 'object') getLightbox.refresh(); 4706 } 4707 4708 if (transitionDuration == 0) { 4709 requestTimeout(function() { 4710 boxAnimation(filterItems, 0, false, container); 4711 }, 100); 4712 } 4713 requestTimeout(function() { 4714 Waypoint.refreshAll(); 4715 }, 2000); 4716 4717 }, delay); 4718 } else { 4719 $.each($('> .tmb > .t-inside', container), function(index, val) { 4720 var parent = $(val).parent(), 4721 objTimeout = parent.data('objTimeout'); 4722 if (objTimeout) { 4723 $(val).removeClass('zoom-reverse').removeClass('start_animation') 4724 clearRequestTimeout(objTimeout); 4725 } 4726 if (transitionDuration == 0) { 4727 if ($(val).hasClass('animate_when_almost_visible')) { 4728 $(val).addClass('zoom-reverse').removeClass('start_animation'); 4729 } else { 4730 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 4731 } 4732 } 4733 }); 4734 container.parent().addClass('justified-loading'); 4735 } 4736 } 4737 evt.preventDefault(); 4738 }); 4739 4740 $filters.each(function(i, buttonGroup) { 4741 var $buttonGroup = $(buttonGroup); 4742 $buttonGroup.on('click', 'a', function() { 4743 $buttonGroup.find('.active').removeClass('active'); 4744 $(this).addClass('active'); 4745 }); 4746 4747 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 4748 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 4749 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 4750 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 4751 e.preventDefault(); 4752 $cats_filters.slideToggle(400, 'easeInOutCirc'); 4753 }); 4754 }); 4755 window.addEventListener('boxResized', function(e) { 4756 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 4757 prevW = breakPointMe(UNCODE.wwidth); 4758 $.each($('.justified-layout'), function(index, val) { 4759 var gutter = $(this).data('gutter'), 4760 margins = gutterByBreakpoint( prevW, gutter); 4761 $(this).justifiedGallery({ 4762 margins: margins 4763 }); 4764 $(this).find('.mejs-video,.mejs-audio').each(function() { 4765 $(this).trigger('resize'); 4766 }); 4767 }); 4768 } 4769 }, false); 4770 4771 init_justifiedGallery(); 4772 }; 4773}; 4774 4775UNCODE.preventDoubleTransition = function() { 4776 $('.sticky-element .animate_when_almost_visible').each(function(){ 4777 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 4778 $el.addClass('do_not_reanimate'); 4779 }); 4780 }); 4781}; 4782 4783UNCODE.checkScrollForTabs = function(){ 4784 var goToSection = window.location.hash.replace('#', ''), 4785 $index; 4786 4787 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 4788 goToSection = encodeURIComponent(goToSection); 4789 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 4790 4791 $index.attr('data-parent', 'parent-' + goToSection); 4792 4793 if (window.location.hash != undefined && window.location.hash != '') { 4794 requestTimeout(function() { 4795 scrollBody('parent-' + goToSection); 4796 }, 500); 4797 } 4798 4799 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 4800 var hash = (e.currentTarget).hash, 4801 index = (e.currentTarget).closest('.uncode-tabs'); 4802 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 4803 $('a[href="' + hash + '"][data-tab-history]').click(); 4804 scrollBody(index); 4805 } 4806 }); 4807 4808 var scrollBody = function(index) { 4809 4810 var getSection = $('a[href="' + index + '"][data-tab-history]'), 4811 scrollTo; 4812 4813 if ( ! getSection.length ) { 4814 getSection = $('div[data-parent="' + index + '"]'); 4815 4816 if ( getSection.attr('data-target') == 'row' ) { 4817 getSection = getSection.closest('.vc_row'); 4818 } 4819 } 4820 4821 if (typeof getSection === 'undefined' || ! getSection.length ) { 4822 return; 4823 } 4824 4825 var body = $("html, body"), 4826 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4827 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 4828 getOffset = UNCODE.get_scroll_offset(); 4829 if ( typeof getSection.offset() === 'undefined' ) 4830 return; 4831 scrollTo = getSection.offset().top - 27; 4832 scrollTo -= getOffset; 4833 4834 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4835 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4836 4837 if (index != 0) { 4838 UNCODE.scrolling = true; 4839 } 4840 4841 if (scrollSpeed == 0) { 4842 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4843 UNCODE.scrolling = false;
4844 } else { 4845 body.animate({ 4846 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4847 }, scrollSpeed, 'easeInOutQuad', function() { 4848 requestTimeout(function() { 4849 UNCODE.scrolling = false; 4850 if (getOffset != UNCODE.get_scroll_offset()) { 4851 scrollBody(index); 4852 } 4853 }, 100); 4854 }); 4855 } 4856 4857 }; 4858}; 4859 4860UNCODE.printScreen = function() { 4861 var inlineMediaStyle = null, 4862 setResize; 4863 4864 function changeMediaStyle() { 4865 clearRequestTimeout(setResize); 4866 setResize = requestTimeout(function(){ 4867 var $head = document.getElementsByTagName('head')[0], 4868 $newStyle = document.createElement('style'), 4869 winW = window.innerWidth, 4870 printH = window.innerHeight; 4871 4872 $newStyle.setAttribute('type', 'text/css'); 4873 $newStyle.setAttribute('media', 'print'); 4874 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 4875 4876 if (inlineMediaStyle != null) { 4877 $head.replaceChild($newStyle, inlineMediaStyle) 4878 } else { 4879 $head.appendChild($newStyle); 4880 } 4881 inlineMediaStyle = $newStyle; 4882 }, 1000); 4883 } 4884 4885 changeMediaStyle(); 4886 window.addEventListener('resize', changeMediaStyle); 4887}; 4888 4889UNCODE.fullPage = function() { 4890 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 4891 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 4892 return false; 4893 } else { 4894 requestTimeout(function() { 4895 window.scrollTo(0, 0); 4896 }, 10); 4897 } 4898 4899 var $masthead = $('#masthead'), 4900 $logo = $('#logo-container-mobile'), 4901 $logolink = $('[data-minheight]', $logo), 4902 logoMinScale = $logolink.data('minheight'), 4903 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 4904 $mainWrapper = $('.main-wrapper')[0], 4905 $container = $('.main-container .post-content'), 4906 $mobileMenuWrapper = $('.menu-wrapper'), 4907 mobMenuPos, 4908 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 4909 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 4910 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 4911 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 4912 headerWithOpacity = $('.header-scroll-opacity', $header).length, 4913 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 4914 menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight, 4915 footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0, 4916 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 4917 $scrollTop = $('.scroll-top'), 4918 scrollBar = true, 4919 effect, 4920 animationEndTimeOut, 4921 fp_anim_time = 900, 4922 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 4923 is_scrolling = false, 4924 dataNames = [], 4925 is_first = true, 4926 no_history = $('body').hasClass('uncode-scroll-no-history'), 4927 theres_footer = true; 4928 4929 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 4930 $('> div', $footer).each(function(index, el){ 4931 if ( $(el).outerHeight() < 2 ) 4932 theres_footer = false; 4933 else 4934 theres_footer = true; 4935 }); 4936 } 4937 4938 if ( !$footer.length ) 4939 theres_footer = false; 4940 4941 if ( !UNCODE.isFullPageSnap ) { 4942 /*if ( theres_footer ) 4943 $footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/ 4944 4945 if ( $('body').hasClass('uncode-fullpage-zoom') ) 4946 effect = 'scaleDown'; 4947 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 4948 effect = 'moveparallax'; 4949 else 4950 effect = 'movecurtain'; 4951 } 4952 4953 if ( $('body').hasClass('uncode-fullpage-trid') ) 4954 fp_anim_time = fp_anim_time*2; 4955 4956 if ( $header.length ) { 4957 if ( headerName !== '' ) 4958 $header.attr('data-name', headerName); 4959 if ( headerLabel !== '' ) 4960 $header.attr('data-label', headerLabel); 4961 $container.prepend($header); 4962 } 4963 if ( theres_footer ) { 4964 $container.append($footer); 4965 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 4966 $('aside.widget ul', $footer).addClass('no-list'); 4967 } 4968 4969 var $all = $rows.add($header); 4970 4971 if ( theres_footer ) 4972 $all = $all.add($footer); 4973 4974 $all.each(function(index, row) { 4975 if( index === 0 ) 4976 $(row).addClass('uncode-scroll-active'); 4977 }); 4978 4979 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 4980 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4981 4982 $all.each(function(index, val) { 4983 var getName = $(val).data('name'), 4984 label; 4985 4986 if (typeof getName == 'undefined' || getName == 'undefined') 4987 getName = SiteParameters.slide_name + '-' + index; 4988 4989 //if ( dataNames.includes(getName) ) { 4990 if ( dataNames.indexOf(getName) > 0 ) { 4991 getName += '_' + index; 4992 $(val).data('name', getName); 4993 } 4994 4995 dataNames.push(getName); 4996 4997 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 4998 4999 if (typeof $(val).attr('data-label') !== 'undefined') 5000 label = $(val).attr('data-label'); 5001 else label = ''; 5002 5003 if ( $(val).is($footer) ) 5004 return; 5005 5006 if (label != '' ) { 5007 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 5008 $('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>"); 5009 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 5010 $('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>"); 5011 } 5012 5013 }); 5014 5015 var checkVisible = function( el, off ) { 5016 if (typeof jQuery === "function" && el instanceof jQuery) { 5017 el = el[0]; 5018 } 5019 5020 off = typeof off=='undefined' ? 50 : off; 5021 5022 var rect = el.getBoundingClientRect(); 5023 5024 return ( 5025 ( 5026 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 5027 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 5028 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 5029 ) 5030 ); 5031 }; 5032 5033 var animationEndAction = function( index, nextIndex ) { 5034 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 5035 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5036 player, iframe; 5037 5038 if ( !$nextSlide.is($footer) ) { 5039 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 5040 } 5041 5042 if ( !UNCODE.isFullPageSnap ) { 5043 activateKBurns( nextIndex ); 5044 } 5045 5046 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 5047 if ($(this).attr('data-provider') == 'vimeo') { 5048 iframe = $(this).find('iframe'); 5049 player = $f(iframe[0]); 5050 player.api('pause'); 5051 } else if ($(this).attr('data-provider') == 'youtube') { 5052 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 5053 } else { 5054 if ($(this).is('video')) { 5055 $(this)[0].volume = 0; 5056 $(this)[0].pause(); 5057 } 5058 } 5059 }); 5060 5061 if ( ! UNCODE.isMobile && headerWithOpacity ) { 5062 if ( $nextSlide.is($header) ) 5063 $header.removeClass('header-scrolled'); 5064 } 5065 5066 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 5067 $otherEl.each(function(){ 5068 var $otherThis = $(this), 5069 $bgwrapperOther = $('.background-inner', $otherThis); 5070 if ( !checkVisible($otherThis) ) 5071 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 5072 5073 }); 5074 5075 if ( !checkVisible($currentSlide) ) { 5076 $currentSlide.removeClass('uncode-scroll-visible'); 5077 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 5078 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
5079 currentScroll.scrollTo(0, 0, 0); 5080 } 5081 5082 clearRequestTimeout(animationEndTimeOut); 5083 animationEndTimeOut = requestTimeout(function(){ 5084 Waypoint.refreshAll(); 5085 $( document.body ).trigger('uncode_waypoints'); 5086 var eventFP = new CustomEvent('fp-slide-changed'); 5087 window.dispatchEvent(eventFP); 5088 is_scrolling = false; 5089 5090 if ( is_first ) { 5091 $('ul.onepage-pagination a').removeClass('is-selected'); 5092 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 5093 is_first = false; 5094 } 5095 5096 }, 500); 5097 }; 5098 5099 var postLeaveActions = function( nextIndex ){ 5100 if ( menuHidden && ! UNCODE.isMobile ) 5101 return false; 5102 5103 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5104 $cols = $('.uncol', $el), 5105 anchor = $el.data('anchor'); 5106 5107 if ( ! UNCODE.isFullPageSnap ) { 5108 $.each($cols, function(index, val){ 5109 if ( $(val).hasClass('style-light') ){ 5110 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 5111 return false; 5112 } else if ( $(val).hasClass('style-dark') ) { 5113 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 5114 return false; 5115 } 5116 }); 5117 } 5118 5119 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 5120 $('.menu-item' ).removeClass('active'); 5121 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 5122 } 5123 5124 if ( !UNCODE.isFullPageSnap ) { 5125 activateBackWash( nextIndex ); 5126 } 5127 }; 5128 5129 var activateBackWash = function( nextIndex ){ 5130 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5131 $bgwrapper; 5132 5133 if ( $el.length ) { 5134 if ( $el.hasClass('with-zoomout') ) { 5135 $bgwrapper = $('.background-inner:nth-child(1)', $el); 5136 } else if ( $('.with-zoomout', $el).length ) { 5137 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 5138 } else { 5139 return false; 5140 } 5141 } else { 5142 return false; 5143 } 5144 5145 $bgwrapper.addClass('uncode-zoomout'); 5146 5147 }; 5148 5149 var activateKBurns = function( nextIndex ){ 5150 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5151 $bgwrapper; 5152 5153 if ( $el.length ) { 5154 if ( $el.hasClass('with-kburns') ) { 5155 $bgwrapper = $('.background-inner:nth-child(1)', $el); 5156 } else if ( $('.with-kburns', $el).length ) { 5157 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 5158 } else { 5159 return false; 5160 } 5161 } else { 5162 return false; 5163 } 5164 5165 $bgwrapper.addClass('uncode-kburns'); 5166 5167 }; 5168 5169 var activateParallax = function( nextIndex, direction ){ 5170 5171 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5172 $cell = $('.fp-tableCell', $el), 5173 animationEnd = 'webkitAnimationEnd animationend', 5174 cellAnim; 5175 5176 switch( direction ) { 5177 case 'up': 5178 cellAnim = 'moveFromTopInner'; 5179 break; 5180 default: 5181 cellAnim = 'moveFromBottomInner'; 5182 } 5183 5184 $cell.css({ 5185 'animation-name': cellAnim, 5186 'animation-duration': fp_anim_time + 'ms', 5187 'animation-delay': '', 5188 'animation-timing-function': fp_easing, 5189 'animation-fill-mode': 'both', 5190 }).off(animationEnd) 5191 .on(animationEnd, function(event) { 5192 if ( event.originalEvent.animationName === cellAnim ) { 5193 $cell 5194 .css({ 5195 'animation-name': '', 5196 'animation-duration': '', 5197 'animation-delay': '', 5198 'animation-timing-function': '', 5199 'animation-fill-mode': '', 5200 }); 5201 } 5202 }); 5203 }; 5204 5205 var scrollHashes = function(){ 5206 var hash = window.location.hash.replace('#', '').split('/'), 5207 hashInd; 5208 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 5209 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 5210 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 5211 $.fn.fullpage.moveTo(hashInd+1); 5212 } 5213 } else if( hash[0] === '' ) { 5214 $.fn.fullpage.moveTo(1); 5215 } 5216 }; 5217 5218 var hideMenu = function( index, nextIndex ){ 5219 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 5220 return false; 5221 5222 var hMenu = UNCODE.menuHeight, 5223 transTime = hMenu * 2; 5224 5225 if ( index === 1 && nextIndex > 1 ) { 5226 hMenu = hMenu * -1; 5227 } else if ( index !== 1 && nextIndex === 1 ) { 5228 hMenu = 0; 5229 } else { 5230 return false;
5231 } 5232 5233 $masthead.css({ 5234 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 5235 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 5236 '-webkit-transition': 'transform 0.5s ease-in-out', 5237 'transition': 'transform 0.5s ease-in-out' 5238 }); 5239 }; 5240 5241 var shrinkMenu = function( index, nextIndex ){ 5242 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 5243 return false; 5244 5245 if ( index === 1 && nextIndex > 1 ) { 5246 $logo.addClass('shrinked'); 5247 $('div', $logo).each(function(index, val){ 5248 $(val).css({ 5249 'height': logoMinScale, 5250 'line-height': logoMinScale 5251 }); 5252 if ($(val).hasClass('text-logo')) { 5253 $(val).css({ 5254 'font-size': logoMinScale + 'px' 5255 }); 5256 } 5257 }); 5258 requestTimeout(function() { 5259 UNCODE.menuMobileHeight = $masthead.outerHeight(); 5260 }, 300); 5261 } else if ( index !== 1 && nextIndex === 1 ) { 5262 $logo.removeClass('shrinked'); 5263 $('div', $logo).each(function(index, val){ 5264 $(val).css({ 5265 'height': logoMaxScale, 5266 'line-height': logoMaxScale 5267 }); 5268 if ($(val).hasClass('text-logo')) { 5269 $(val).css({ 5270 'font-size': logoMaxScale + 'px' 5271 }); 5272 } 5273 }); 5274 requestTimeout(function() { 5275 UNCODE.menuMobileHeight = $masthead.outerHeight(); 5276 }, 300); 5277 } else { 5278 return false; 5279 } 5280 5281 }; 5282 5283 var anchorLink = function(){ 5284 5285 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 5286 var $this = $(e.currentTarget), 5287 hash = e.currentTarget.href.split('#'), 5288 current = window.location.href.split('#'), 5289 ind, 5290 currentMenuOpened = UNCODE.menuOpened, 5291 go = false; 5292 5293 var hash_url = hash[0].replace(/\/?$/, '/'), 5294 current_url = current[0].replace(/\/?$/, '/'); 5295 5296 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 5297 hash = '#'+hash[1]; 5298 e.preventDefault(); 5299 go = true; 5300 } 5301 5302 if ( go ) { 5303 5304 if ( $(hash).length ) { 5305 ind = $(hash).closest('.fp-section').index(); 5306 } else { 5307 hash = hash.slice(1); 5308 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 5309 } 5310 5311 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 5312 ind = $this.closest('.fp-section').index(); 5313 5314 UNCODE.menuOpened = false; 5315 5316 $.fn.fullpage.moveTo(ind+1); 5317 5318 UNCODE.menuOpened = currentMenuOpened; 5319 if (UNCODE.menuOpened) { 5320 if (UNCODE.wwidth < UNCODE.mediaQuery) { 5321 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 5322 } else { 5323 $('.mmb-container-overlay .overlay-close').trigger('click'); 5324 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 5325 } 5326 } 5327 5328 } 5329 5330 }); 5331 5332 $('.header-scrolldown').on('click', function(event) { 5333 event.preventDefault(); 5334 var scrollDown = $(this), 5335 ind = scrollDown.closest('.fp-section').index(); 5336 5337 $.fn.fullpage.moveTo(ind+2); 5338 }); 5339 5340 var anchor = $('.fp-section.active').data('anchor'); 5341 5342 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 5343 $('.menu-item').removeClass('active'); 5344 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 5345 } 5346 5347 }; 5348 5349 var slideLeave = function( index, nextIndex, direction ) { 5350 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 5351 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5352 animationEnd = 'webkitAnimationEnd animationend', 5353 transitionEnd = 'webkitTransitionEnd transitionend', 5354 animOut = effect != 'scaleDown' ? effect + direction : effect, 5355 animIn, 5356 animInDelay = effect == 'scaleDown' ? 0 : 0, 5357 isFooter = false, 5358 isFooterNext = false, 5359 isHeader = false, 5360 isHeaderNext = false, 5361 containerOff = $container.offset().top, 5362 footerH = $footer.outerHeight(), 5363 timeout, 5364 dataHash = $nextSlide.attr('data-anchor'), 5365 player, iframe, 5366 footerCoeff; 5367 switch( direction ) { 5368 case 'up': 5369 animIn = 'moveFromTop'; 5370 break; 5371 default: 5372 animIn = 'moveFromBottom'; 5373 } 5374 5375 if ( $('body').hasClass('uncode-fullpage-trid') ) { 5376 animOut = animIn + 'trid'; 5377 animIn = animOut + 'In'; 5378 } else if ( UNCODE.isFullPageSnap ) { 5379 animIn = animOut = 'none'; 5380 } 5381 5382 hideMenu(index, nextIndex); 5383 shrinkMenu(index, nextIndex); 5384 5385 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 5386 if ($(this).attr('data-provider') == 'vimeo') { 5387 iframe = $(this).find('iframe'); 5388 player = $f(iframe[0]); 5389 player.api('pause'); 5390 } else if ($(this).attr('data-provider') == 'youtube') { 5391 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 5392 } else { 5393 if ($(this).is('video')) { 5394 $(this)[0].volume = 0; 5395 $(this)[0].pause(); 5396 } 5397 } 5398 }); 5399 5400 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 5401 if ($(this).attr('data-provider') == 'vimeo') { 5402 iframe = $(this).find('iframe'); 5403 player = $f(iframe[0]); 5404 player.api('play'); 5405 } else if ($(this).attr('data-provider') == 'youtube') { 5406 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 5407 } else { 5408 if ($(this).is('video')) { 5409 $(this)[0].volume = 0; 5410 $(this)[0].play(); 5411 } 5412 } 5413 }); 5414 5415 if ( $currentSlide.is($footer) ) 5416 isFooter = true; 5417 5418 if ( $nextSlide.is($footer) ) 5419 isFooterNext = true; 5420 5421 // if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer ) 5422 // window.location.hash = '#' + dataHash; 5423 5424 if ( ! UNCODE.isMobile && headerWithOpacity ) { 5425 if ( $currentSlide.is($header) ) 5426 $header.addClass('header-scrolled'); 5427 } 5428 5429 footerCoeff = footerH; 5430 5431 if ( UNCODE.isFullPageSnap ) { 5432 postLeaveActions( nextIndex ); 5433 activateBackWash( nextIndex ); 5434 activateKBurns( nextIndex ); 5435 requestTimeout(function(){ 5436 animationEndAction( index, nextIndex ); 5437 }, fp_anim_time+150); 5438 } else { 5439 if ( isFooterNext ) { 5440 5441 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 5442 $iscrollWrapper.addClass('no-scrolloverflow'); 5443 5444 $nextSlide 5445 .add($currentSlide) 5446 .addClass('uncode-scroll-front') 5447 .addClass('uncode-scroll-active') 5448 .addClass('uncode-scroll-visible'); 5449 $container.css({ 5450 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 5451 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 5452 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5453 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5454 }).off(transitionEnd) 5455 .one(transitionEnd, function(){ 5456 animationEndAction( index, nextIndex ); 5457 }); 5458 5459 } else if ( isFooter ) { 5460 5461 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 5462 .add($currentSlide) 5463 .addClass('uncode-scroll-front') 5464 .addClass('uncode-scroll-active') 5465 .addClass('uncode-scroll-visible'); 5466 $container.css({ 5467 '-webkit-transform': 'translate3d(0, 0, 0)', 5468 'transform': 'translate3d(0, 0, 0)', 5469 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5470 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5471 }) 5472 .one(transitionEnd, function(){ 5473 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 5474 clearRequestTimeout(timeout); 5475 timeout = requestTimeout(function(){ 5476 $.fn.fullpage.moveTo(nextIndex); 5477 slideLeave( index-1, nextIndex, 'up' ); 5478 $container.off(transitionEnd); 5479 }, 50); 5480 } 5481 animationEndAction( index, nextIndex ); 5482 }); 5483 5484 } else { 5485 5486 postLeaveActions( nextIndex ); 5487 5488 if ( !$('body').hasClass('uncode-fullpage-trid') ) 5489 activateParallax( nextIndex, direction ); 5490 5491 var $outBg = $('.background-wrapper', $currentSlide); 5492 5493 $nextSlide 5494 .addClass('uncode-scroll-front') 5495 .addClass('uncode-scroll-active') 5496 .addClass('uncode-scroll-visible') 5497 .addClass('uncode-scroll-animating-in') 5498 .css({ 5499 'z-index':4, 5500 'animation-name': animIn, 5501 'animation-duration': fp_anim_time + 'ms', 5502 'animation-delay': '', 5503 'animation-timing-function': fp_easing, 5504 'animation-fill-mode': 'both', 5505 'transition': 'initial', 5506 }).off(animationEnd) 5507 .on(animationEnd, function(event) { 5508 if ( event.originalEvent.animationName === animIn ) { 5509 $(this) 5510 .addClass('uncode-scroll-already') 5511 .removeClass('uncode-scroll-front') 5512 .removeClass('uncode-scroll-animating-in') 5513 .css({ 5514 'animation-name': '', 5515 'animation-duration': '', 5516 'animation-delay': '', 5517 'animation-timing-function': '', 5518 'animation-fill-mode': '', 5519 'transition': 'initial', 5520 }); 5521 5522 $currentSlide 5523 .removeClass('uncode-scroll-active') 5524 .add($outBg) 5525 .css({ 5526 'animation-name': '', 5527 'animation-duration': '', 5528 'animation-delay': '', 5529 'animation-timing-function': '', 5530 'animation-fill-mode': '', 5531 'transition': 'initial', 5532 }); 5533 5534 animationEndAction( index, nextIndex ); 5535 5536 } 5537 5538 if ( nextIndex > 1 ) 5539 $('body').addClass('window-scrolled'); 5540 else 5541 $('body').removeClass('window-scrolled'); 5542 }); 5543 5544 $currentSlide 5545 .addClass('uncode-scroll-animating-out') 5546 .removeClass('uncode-scroll-front') 5547 .css({ 5548 'z-index':'1', 5549 'animation-name': animOut, 5550 'animation-duration': fp_anim_time + 'ms', 5551 'animation-delay': '', 5552 'animation-timing-function': fp_easing, 5553 'animation-fill-mode': 'both', 5554 'transition': 'initial', 5555 'will-change': 'auto' 5556 }).off(animationEnd) 5557 .on(animationEnd, function(event) { 5558 if ( event.originalEvent.animationName === animOut ) { 5559 $currentSlide.removeClass('uncode-scroll-animating-out'); 5560 } 5561 }); 5562 5563 if ( $('body').hasClass('uncode-fp-opacity') ) { 5564 $currentSlide.find('> div').css({ 5565 'animation-name': 'opacityout', 5566 'animation-duration': fp_anim_time + 'ms', 5567 'animation-delay': '', 5568 'animation-timing-function': fp_easing, 5569 'animation-fill-mode': 'both', 5570 'transition': 'initial', 5571 }).off(animationEnd) 5572 .on(animationEnd, function(event) { 5573 if ( event.originalEvent.animationName === 'opacityout' ) { 5574 $(event.currentTarget).css({ 5575 'animation-name': '', 5576 'animation-duration': '', 5577 'animation-delay': '', 5578 'animation-timing-function': '', 5579 'animation-fill-mode': '', 5580 'transition': '', 5581 }); 5582 } 5583 }); 5584 } 5585 } 5586 } 5587 5588 $('.scroll-top').on('click', function(e){ 5589 $.fn.fullpage.moveTo(1); 5590 return false;
5591 }); 5592 5593 }; 5594 5595 var init_fullPage = function(mode){ 5596 5597 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 5598 // scrollBar = false; 5599 // } 5600 5601 var checkFPeffects; 5602 5603 $container.fullpage({ 5604 sectionSelector: '.uncode-scroll-lock', 5605 scrollOverflow: true, 5606 scrollOverflowOptions: { 5607 click: false, 5608 preventDefaultException: { tagName:/.*/ } 5609 }, 5610 navigation: false, 5611 scrollBar: scrollBar, 5612 scrollingSpeed: fp_anim_time, 5613 verticalCentered: true, 5614 anchors: no_history ? false : dataNames, 5615 recordHistory: !no_history, 5616 afterRender: function(){ 5617 $('body').removeClass('fp-waiting'); 5618 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 5619 var $invisible = $(this).addClass('hidden-scroll');//, 5620 }); 5621 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 5622 var $visible = $(this).addClass('uncode-scroll-visible'), 5623 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 5624 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 5625 }); 5626 5627 $('ul.onepage-pagination a').on('click', function(e){ 5628 e.preventDefault(); 5629 var $a = $(this), 5630 toIndex = $a.data('index'); 5631 5632 $.fn.fullpage.moveTo(toIndex+1); 5633 }); 5634 5635 requestTimeout(function(){ 5636 scrollHashes(); 5637 }, 1000); 5638 5639 $(window).on('hashchange', function(e){ 5640 requestTimeout(function(){ 5641 scrollHashes(); 5642 }, 500); 5643 }); 5644 5645 anchorLink(); 5646 5647 if ( $('body').hasClass('uncode-fp-opacity') ) { 5648 $all.each(function(index, row) { 5649 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 5650 classBg; 5651 5652 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 5653 classBg = testmatch[0]; 5654 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 5655 } 5656 }); 5657 } 5658 5659 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 5660 $(window).on('menuOpen gdprOpen', function(){ 5661 $.fn.fullpage.setAutoScrolling(false); 5662 }).on('menuClose gdprClose', function(){ 5663 $.fn.fullpage.setAutoScrolling(true); 5664 }); 5665 } 5666 5667 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 5668 requestTimeout(function(){ 5669 $.fn.fullpage.setAutoScrolling(false); 5670 }, 1000); 5671 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 5672 $.fn.fullpage.setAutoScrolling(true); 5673 }); 5674 5675 if ( !UNCODE.isFullPageSnap ) { 5676 clearRequestTimeout(checkFPeffects); 5677 checkFPeffects = requestTimeout(function(){ 5678 activateBackWash( 1 ); 5679 activateKBurns( 1 ); 5680 }, 100); 5681 } 5682 5683 }, 5684 onLeave: function( index, nextIndex, direction ){ 5685 5686 if ( UNCODE.menuOpened || is_scrolling ) 5687 return false; 5688 5689 is_scrolling = true; 5690 5691 var event = new CustomEvent('fp-slide-leave'); 5692 window.dispatchEvent(event); 5693 5694 slideLeave( index, nextIndex, direction ); 5695 5696 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 5697 if ( direction === 'up' ) { 5698 $.fn.fullpage.moveTo(nextIndex-1); 5699 } else { 5700 $.fn.fullpage.moveTo(nextIndex+1); 5701 } 5702 return false; 5703 } 5704 5705 $('ul.onepage-pagination a').removeClass('is-selected'); 5706 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 5707 5708 } 5709 }); 5710 }; 5711 5712 init_fullPage(); 5713 $(window).on('load', function(){ 5714 requestTimeout(function(){ 5715 $.fn.fullpage.reBuild(); 5716 }, 3000); 5717 }); 5718 5719 var addScrollingClass, 5720 removeScrollingClass; 5721 5722 window.addEventListener("fp-slide-scroll", function(){ 5723 addScrollingClass = requestTimeout( function(){ 5724 $('body').addClass('fp-slide-scrolling'); 5725 }, 10 ); 5726 5727 clearRequestTimeout(removeScrollingClass); 5728 removeScrollingClass = requestTimeout( function(){ 5729 $('body').removeClass('fp-slide-scrolling'); 5730 }, 150 ); 5731 5732 Waypoint.refreshAll(); 5733 }, false); 5734 5735 var setFPheight = function(){ 5736 var $body = document.body, 5737 $footer = document.getElementById('colophon'), 5738 $maincontainer = document.querySelector('.main-wrapper'), 5739 $boxcontainer = document.querySelector('.box-container'), 5740 rect = $maincontainer.getBoundingClientRect(), 5741 rect2 = $boxcontainer.getBoundingClientRect(); 5742 $body.style.height = UNCODE.wheight + 'px'; 5743 if ( theres_footer ) 5744 $footer.style.top = (rect.height || rect2.height) + 'px'; 5745 }; 5746 5747 setFPheight(); 5748 5749 window.addEventListener('resize', setFPheight, false); 5750 window.addEventListener('orientationchange', setFPheight, false); 5751 5752}; 5753 5754UNCODE.particles = function() { 5755 $(".vc-particles-background").each(function() { 5756 var $particle = $(this); 5757 var $parent = $particle.closest('[data-parent]'); 5758
5759 $parent.prepend($particle); 5760 // $(window).trigger('resize'); 5761 }) 5762}; 5763 5764 5765UNCODE.filters = function() { 5766 var $isotopes = $('.isotope-system'); 5767 5768 $isotopes.each(function(index, val){ 5769 var $isotope = $(this), 5770 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $isotope), 5771 $widgets = $('.widgetized-cb-wrapper', $isotope), 5772 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $isotope), 5773 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $isotope), 5774 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $isotope), 5775 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $isotope); 5776 5777 if ($isotope.hasClass('isotope-processed')) { 5778 return; 5779 } 5780 5781 $cats_trigger.on('click', function(e) { 5782 if ( ! $('html').hasClass('screen-sm') ) { 5783 // $widgets.add($sorting_dd).slideUp(400); 5784 e.preventDefault(); 5785 $widgets.slideUp(400, 'easeInOutCirc'); 5786 } 5787 }); 5788 5789 $('.filters-toggle-trigger', $isotope).on('click', function(e) { 5790 e.preventDefault(); 5791 var $filters = $('.isotope-filters .menu-horizontal', $isotope); 5792 $filters.slideToggle(400, 'easeInOutCirc'); 5793 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 5794 }); 5795 5796 $widget_trgr.on('click', function(e) { 5797 e.preventDefault(); 5798 $widgets.slideToggle(400, 'easeInOutCirc'); 5799 if (!$('html').hasClass('screen-sm')) { 5800 $cats_filters.slideUp(400, 'easeInOutCirc'); 5801 } 5802 window.dispatchEvent(new CustomEvent('boxResized')); 5803 }); 5804 5805 $sorting_trgr.on('click', function(e) { 5806 e.preventDefault(); 5807 if (!$('html').hasClass('screen-sm')) { 5808 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 5809 } 5810 }); 5811 5812 $isotope.addClass('isotope-processed'); 5813 }) 5814 5815}; 5816 5817UNCODE.widgets = function() { 5818 var widget_titles = $('.widget-mobile-collapse').find('.widget-title'); 5819 var widgets = widget_titles.closest('.widget'); 5820 5821 widgets.each(function() { 5822 var _this = $(this); 5823 var content = _this.children().not('.widget-title'); 5824 5825 if (_this.hasClass('widget-mobile-done')) { 5826 return; 5827 } 5828 5829 content.wrapAll( '<div class="widget-collapse-content"></div> '); 5830 _this.removeClass('collapse-init'); 5831 _this.addClass('widget-mobile-done'); 5832 }); 5833 5834 var widgets_without_title = $('.collapse-init'); 5835 5836 widgets_without_title.removeClass('collapse-init'); 5837 5838 widget_titles.on('click', function() { 5839 var _this = $(this); 5840 var content = _this.closest('.widget').find('.widget-collapse-content'); 5841 5842 // Get content of :after element (+ icon) to check the visibility 5843 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 5844 5845 if (icon_content === 'none' || !icon_content) { 5846 return false; 5847 } 5848 5849 _this.toggleClass('open'); 5850 content.slideToggle(400, 'easeInOutCirc'); 5851 5852 return false; 5853 }); 5854}; 5855 5856UNCODE.unmodal = function() { 5857 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 5858 $('.unmodal-overlay').fadeIn(); 5859 $('.unmodal-overlay').addClass('loading'); 5860 $('body').addClass('uncode-unmodal-overlay-visible'); 5861 $(window).trigger('unmodal-open'); 5862 }); 5863 5864 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 5865 $('.unmodal-overlay').fadeOut(); 5866 $('.unmodal').fadeOut(); 5867 $('body').removeClass('uncode-unmodal-overlay-visible'); 5868 $('body').removeClass('uncode-unmodal-open'); 5869 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 5870 $(document).trigger('unmodal-close'); 5871 UNCODE.isUnmodalOpen = false; 5872 }); 5873 5874 $(document).on('uncode-unmodal-show-content', function() { 5875 $('.unmodal-overlay').removeClass('loading'); 5876 $('.unmodal').show(); 5877 $('.unmodal').addClass('show-unmodal-with-animation'); 5878 $('.unmodal-content')[0].scrollTop = 0; 5879 $('body').addClass('uncode-unmodal-open'); 5880 UNCODE.isUnmodalOpen = true; 5881 5882 if ($('body').hasClass('qw-body-scroll-disabled')) { 5883 $('html').addClass('uncode-unmodal-body-disable-scroll'); 5884 } 5885 5886 if ($('.unmodal').hasClass('auto-height')) { 5887 set_modal_height(); 5888 } 5889 }); 5890 5891 var set_modal_height = function() { 5892 var modal = $('.unmodal'); 5893 var window_height = $(window).outerHeight(); 5894 var modal_height = modal.outerHeight(); 5895 5896 modal.css('height', 'auto'); 5897 5898 if (modal_height > window_height) { 5899 modal.outerHeight(window_height); 5900 } 5901 } 5902 5903 if ($('.unmodal').hasClass('auto-height')) { 5904 var setCTA; 5905 5906 $(window).on('resize', function() { 5907 clearRequestTimeout(setCTA); 5908 setCTA = requestTimeout(function() { 5909 set_modal_height(); 5910 }, 100); 5911 }); 5912 } 5913}; 5914 5915UNCODE.bgChanger = function() { 5916 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 5917 $bg_first = $('.vc_row[data-bg-remove]'), 5918 bg_remove = $bg_first.attr('data-bg-remove'), 5919 $first = $bg_changers.first(), 5920 $last = $bg_changers.last(), 5921 $bg_wrapper = $('#changer-back-color'), 5922 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 5923 setCTA, localH = UNCODE.wheight, 5924 isScrolling; 5925 5926 $bg_first.removeClass(bg_remove); 5927 5928 var bgChange = function($col, bgColor, skin, tmbskin){ 5929 $bg_wrapper.attr( 'class', bgColor ); 5930 var menuskin; 5931 if ( typeof skin !== 'undefined' ) { 5932 menuskin = skin.replace('style', 'menu') 5933 } 5934 5935 if ( $col.length ) { 5936 $('.uncol[data-skin-change]').each(function(){ 5937 var $isoFooter = $('.isotope-footer', this); 5938 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 5939 if ( menuskin !== '' ) {
5940 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 5941 } 5942 }); 5943 5944 $('.tmb[data-skin-change]').each(function(){ 5945 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 5946 }); 5947 } 5948 }; 5949 5950 var bg_waypoints = function(){ 5951 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 5952 5953 $.each($bg_changers, function(index, row) { 5954 5955 var $row = $(row), 5956 $col = $('.uncol[data-skin-change]', $row).eq(0), 5957 skin, 5958 $tmbs, 5959 tmbskin, 5960 bgColor = $row.attr('data-bg-color'); 5961 5962 if ( ! $row.is(':visible') ) { 5963 return false; 5964 } 5965 5966 if ( $col.length ) { 5967 skin = $col.attr('data-skin-change'); 5968 $tmbs = $('.tmb[data-skin-change]', $row); 5969 tmbskin = skin.replace('style', 'tmb'); 5970 } 5971 5972 $row.waypoint(function( dir ) { 5973 if ( dir === 'down' ) { 5974 bgChange($col, bgColor, skin, tmbskin); 5975 } else { 5976 return; 5977 } 5978 }, { 5979 offset: '50%' 5980 }); 5981 5982 $row.waypoint(function( dir ) { 5983 if ( dir === 'up' ) { 5984 bgChange($col, bgColor, skin, tmbskin); 5985 } else { 5986 return; 5987 } 5988 }, { 5989 offset: function() { 5990 var clH = this.element.clientHeight, 5991 wH = window.innerHeight, 5992 ret = clH > 200 ? -100 : clH * -0.5; 5993 return ( wH / 2 ) - clH; 5994 } 5995 }); 5996 5997 }); 5998 5999 $('body').addClass('bg-changer-init'); 6000 6001 } 6002 }; 6003 6004 var body = document.body, 6005 edges = false; 6006 6007 var throttle = function(fn, wait) { 6008 var time = Date.now(); 6009 return function() { 6010 if ((time + wait - Date.now()) < 0) { 6011 fn(); 6012 time = Date.now(); 6013 } 6014 } 6015 } 6016 6017 var $wrapper = document.querySelector(".main-wrapper"), 6018 currentPixel = window.pageYOffset || window.document.documentElement.scrollTop; 6019 6020 var $title = document.querySelector('#rotating'); 6021 if ( $title !== null ) { 6022 $title.style.whiteSpace = 'nowrap'; 6023 $title.style.transition = 'transform 200ms linear'; 6024 } 6025 6026 window.addEventListener( 'scroll', throttle( function() { 6027 window.clearRequestTimeout( isScrolling ); 6028 6029 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 6030 6031 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 6032 body = document.body, 6033 html = document.documentElement, 6034 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 6035 $row = false; 6036 6037 if ( scrolled < 100 ) { 6038 var $row = $first; 6039 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) ) { 6040 var $row = $last; 6041 } 6042 6043 if ( $row.length ) { 6044 var $col = $('.uncol[data-skin-change]', $row).eq(0), 6045 skin, 6046 $tmbs, 6047 tmbskin, 6048 bgColor = $row.attr('data-bg-color'); 6049 6050 if ( $col.length ) { 6051 skin = $col.attr('data-skin-change'); 6052 $tmbs = $('.tmb[data-skin-change]', $row); 6053 tmbskin = skin.replace('style', 'tmb'); 6054 } 6055 6056 bgChange($col, bgColor, skin, tmbskin); 6057 edges = true; 6058 } 6059 6060 }, 150); 6061 6062 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 6063 bg_waypoints(); 6064 Waypoint.refreshAll(); 6065 edges = false; 6066 } 6067 6068 }, 100), false); 6069 6070 $(window).on('resize', function() { 6071 clearRequestTimeout(setCTA); 6072 setCTA = requestTimeout(function() { 6073 if ( localH != UNCODE.wheight ) { 6074 localH = UNCODE.wheight; 6075 bg_waypoints(); 6076 Waypoint.refreshAll(); 6077 } 6078 }, 100); 6079 }); 6080 6081 bg_waypoints(); 6082 6083}; 6084 6085UNCODE.skewIt = function() { 6086 6087 if ( $('body').hasClass('compose-mode') ) { 6088 return; 6089 } 6090 6091 var justscrolled = false; 6092 6093 var loadSkewIt = function(){ 6094 6095 var $pageHeader = $('#page-header'), 6096 $page_body = $('.page-body'), 6097 $header_skew = $('.uncode-skew.vc_row[data-parent]', $pageHeader); 6098 6099 if ( $header_skew.length ) { 6100 $pageHeader.addClass('uncode-skew').css({ 6101 position: 'relative', 6102 zIndex: 1 6103 }); 6104 $header_skew.removeClass('uncode-skew'); 6105 $page_body.css({ 6106 position: 'relative', 6107 zIndex: 0 6108 }); 6109 } 6110 6111 var $skew = $('.uncode-skew'), 6112 stopSkewing, 6113 lastOffset = 0, 6114 lastDate = Date.now(); 6115 6116 if ( ! $skew.length ) { 6117 return; 6118 } 6119 6120 var dropSkew = function(){ 6121 if ( UNCODE.wwidth < UNCODE.mediaQuery ) 6122 return; 6123 6124 $skew.each(function(){ 6125 var $this = $(this), 6126 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 6127 6128 if ( $drop.length ) { 6129 $this.css({ 6130 'transform': 'skew(0)' 6131 }); 6132 var bound = $this[0].getBoundingClientRect(); 6133 $drop.css({ 6134 left: bound.x * -1, 6135 top: bound.y * -1, 6136 }); 6137 } 6138 }); 6139 }; 6140 dropSkew(); 6141 6142 $(window).on('resize', dropSkew); 6143 6144 window.addEventListener( 'scroll', function() { 6145 6146 if ( justscrolled !== true ) { 6147 justscrolled = true; 6148 return; 6149 } 6150 6151 window.clearRequestTimeout( stopSkewing ); 6152 6153 var now = Date.now(), 6154 delayInMs = now - lastDate, 6155 offset = window.pageYOffset || window.document.documentElement.scrollTop, 6156 newOffset = offset - lastOffset, 6157 speed = Math.pow((newOffset / delayInMs), 3) * -1, 6158 body = document.body, 6159 html = document.documentElement, 6160 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 6161 wait = 50, 6162 maxSpeed = UNCODE.wwidth > UNCODE.mediaQuery ? 1 : 2; 6163 6164 if ((lastDate + wait - now) < 0) { 6165 6166 lastDate = now; 6167 lastOffset = offset; 6168 6169 if ( speed > 6 ) { 6170 speed = 6; 6171 } else if ( speed < -6 ) { 6172 speed = -6; 6173 } 6174 6175 if ( speed > 2 && offset < UNCODE.wheight ) { 6176 speed = 2; 6177 } else if ( speed < -2 && ( offset + (UNCODE.wheight*2) ) > docH ) { 6178 speed = -2; 6179 } 6180 6181 gsap.killTweensOf($skew); 6182 gsap.to( $skew, { 6183 duration: 0.2, 6184 skewY: (speed * maxSpeed) + "deg", 6185 ease: Power0.easeNone, 6186 //transformPerspective: 900, 6187 transformOrigin: 'center', 6188 //force3D: true 6189 }); 6190 6191 } 6192 6193 stopSkewing = requestTimeout(function() { 6194 gsap.killTweensOf($skew); 6195 gsap.to( $skew, { 6196 duration: 0.5, 6197 skewY: "0deg", 6198 ease: Power0.easeNone, 6199 //transformPerspective: 900, 6200 transformOrigin: 'center', 6201 //force3D: true, 6202 ease: Expo.easeOut, 6203 }); 6204 6205 $skew.each(function(){ 6206 var $this = $(this), 6207 $drop = $('.t-entry-drop:not(.drop-parent)', $this); 6208 6209 if ( $drop.length ) { 6210 var bound = $this[0].getBoundingClientRect() 6211 $drop.css({ 6212 left: bound.x * -1, 6213 top: bound.y * -1, 6214 }); 6215 } 6216 }); 6217 6218 }, 200); 6219 6220 }, false); 6221 6222 }; 6223 6224 $(window).on('load', loadSkewIt); 6225 6226}; 6227 6228UNCODE.rotateIt = function() { 6229 6230 if ( $('body').hasClass('compose-mode') ) { 6231 return; 6232 } 6233 6234 var loadRotateIt = function(){ 6235 6236 var $toRotate = $('.uncode-rotate'); 6237 6238 $toRotate.each(function(){ 6239 var $rotate = $(this), 6240 deg = 0, 6241 dir = true, 6242 coeff = 1, 6243 lastOffset = 0, 6244 lastDate = Date.now(); 6245 6246 var checkScroll = function($rotate){ 6247 // if ( ! $rotate.length ) { 6248 // return; 6249 // } 6250 6251 var now = Date.now(), 6252 delayInMs = now - lastDate, 6253 offset = window.pageYOffset || window.document.documentElement.scrollTop, 6254 newOffset = offset - lastOffset, 6255 speed = (newOffset / delayInMs) * 5, 6256 body = document.body, 6257 html = document.documentElement, 6258 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); 6259 6260 lastDate = now; 6261 lastOffset = offset; 6262 6263 if ( Math.abs(deg) > 359 || isNaN(deg) ) { 6264 deg = 0; 6265 } 6266 6267 if ( $rotate.hasClass('uncode-rotate-scroll') || $rotate.hasClass('uncode-rotate-speed') ) { 6268 deg = parseFloat(deg) + parseFloat(speed); 6269 } 6270 6271 if ( $rotate.hasClass('uncode-rotate-hover') ) { 6272 $rotate.hover(function(){ 6273 coeff = 1.75; 6274 }, function(){ 6275 coeff = 1; 6276 }); 6277 } 6278 6279 // if ( speed > 0 ) { 6280 // dir = true 6281 // } else if ( speed < 0 ) { 6282 // dir = false 6283 // } 6284 6285 if ( ! $rotate.hasClass('uncode-rotate-scroll') ) { 6286 deg = deg+coeff; 6287 // if ( dir ) { 6288 // deg = deg+coeff; 6289 // } else { 6290 // deg = deg-coeff; 6291 // } 6292 } 6293 6294 $rotate[0].style.transform = 'rotate(' + deg + 'deg)'; 6295 6296 requestAnimationFrame(function() { 6297 checkScroll($rotate); 6298 }); 6299 6300 }; 6301 6302 checkScroll($rotate); 6303 6304 }); 6305 6306 }; 6307 6308 $(window).on('load', loadRotateIt); 6309 6310}; 6311 6312var marqueeAttempts = 0, 6313 marqueeTO; 6314 6315UNCODE.textMarquee = function( $titles ) { 6316 6317 if ( typeof $titles == 'undefined' ) { 6318 $titles = $('.un-text-marquee'); 6319 } 6320 6321 if ( ! $titles.length ) { 6322 return; 6323 } 6324 6325 $titles.each(function(){ 6326 var $title = $(this), 6327 $span = $('> span', $title), 6328 txt, 6329 first = true, 6330 newW = UNCODE.wwidth; 6331 6332 $('.marquee-clone-wrap', $title).remove(); 6333 6334 txt = $title.text(); 6335 6336 if ( ! $('.marquee-original-core', $span).length ) { 6337 $span = $('> span', $title).wrapInner('<span class="marquee-original-core" />').addClass('marquee-original'); 6338 } 6339 6340 var checkResize, 6341 spanW, 6342 $prepended = $('<span class="marquee-clone-wrap wrap-prepended" />'), 6343 $appended = $('<span class="marquee-clone-wrap wrap-appended" />'), 6344 clearSpeed, 6345 speed = 10; 6346 6347 $span.prepend($prepended); 6348 $span.append($appended); 6349 6350 var continuousTextMarquee = function(){ 6351 var bound = $title.css({ 6352 'transform': 'none', 6353 'opacity': 0 6354 }).offset(); 6355 6356 var xStrt = first || $title.hasClass('un-marquee-infinite') ? 0 : UNCODE.wwidth - bound.left, 6357 xEnd = $title.hasClass('un-marquee-infinite') ? spanW : ( spanW + bound.left ), 6358 xSpeed = $title.hasClass('un-marquee-infinite') ? ( spanW + bound.left ) : ( xStrt + ( UNCODE.wwidth + bound.left ) ), 6359 direction = $title.hasClass('un-marquee-opposite') ? 1 : -1; 6360 6361 var marqueeTL = new TimelineMax({paused:true, reversed:true}); 6362 6363 var inview = new Waypoint.Inview({ 6364 element: $title[0], 6365 enter: function(direction) { 6366 marqueeTL.play(); 6367 }, 6368 exited: function(direction) { 6369 marqueeTL.pause(); 6370 } 6371 }); 6372 6373 //gsap.killTweensOf($title);
6374 marqueeTL.fromTo( $title, { 6375 opacity: 1, 6376 x: xStrt 6377 }, 6378 { 6379 duration: xSpeed / UNCODE.wwidth * speed, 6380 x: xEnd * direction, 6381 onComplete: function(){ 6382 first = false; 6383 continuousTextMarquee(); 6384 }, 6385 ease: Linear.easeNone 6386 }); 6387 }; 6388 6389 var runTextMarquee = function(){ 6390 var time = Date.now(); 6391 6392 var textMarqueeScroll = function(){ 6393 var bound = bound = $title[0].getBoundingClientRect(), 6394 wait = 100, 6395 direction = $title.hasClass('un-marquee-scroll-opposite') ? -1 : 1; 6396 6397 if ( bound.top === 0 && bound.bottom === 0 && bound.left === 0 && bound.right === 0 && 6398 bound.height === 0 && bound.width === 0 && bound.x === 0 && bound.y === 0 && 6399 marqueeAttempts < 2 ) { 6400 6401 clearRequestTimeout(marqueeTO); 6402 6403 marqueeTO = requestTimeout(function(){ 6404 marqueeAttempts++; 6405 UNCODE.textMarquee(); 6406 }, 100); 6407 } 6408 6409 if ((time + wait - Date.now()) < 0) { 6410 if ( bound.top > ( bound.height * -4 ) && ( bound.top - bound.height ) < UNCODE.wheight * 2 ) { 6411 // $title.style.transform = 'translateX(' + ( UNCODE.wheight * 0.5 - bound.top ) * 0.75 + 'px)'; 6412 gsap.killTweensOf($title); 6413 gsap.to( $title, { 6414 duration: 0.5, 6415 x: ( UNCODE.wheight * 0.35 - bound.top ) * 0.5 * direction, 6416 //ease: Expo.easeOut, 6417 }); 6418 } 6419 time = Date.now(); 6420 } 6421 }; 6422 6423 textMarqueeScroll(); 6424 $(window).on( 'load scroll', function() { 6425 textMarqueeScroll(); 6426 }); 6427 6428 }; 6429 6430 var cloneSpan = function($_title, cntnt){ 6431 6432 if ( $_title.hasClass('un-marquee-infinite') ) { 6433 $('> span.marquee-clone-wrap', $_title).text(''); 6434 } 6435 6436 gsap.to( $_title, { 6437 duration: 0, 6438 x: 0 6439 }); 6440 spanW = $span.outerWidth(); 6441 6442 if ( !spanW ) { 6443 return; 6444 } 6445 6446 var part = Math.ceil( UNCODE.wwidth / spanW ) * 2; 6447 6448 if ( $_title.hasClass('un-marquee-infinite') ) { 6449 6450 for ( var i = 0; i < part; i++ ) { 6451 $prepended[0].textContent += cntnt + "\u00A0"; 6452 $appended[0].textContent += cntnt + "\u00A0"; 6453 } 6454 } 6455 6456 if ( $('body').hasClass('compose-mode') ) { 6457 return; 6458 } 6459 6460 if ( $_title.hasClass('un-marquee') || $_title.hasClass('un-marquee-opposite') ) { 6461 continuousTextMarquee(); 6462 } 6463 6464 if ( $_title.hasClass('un-marquee-scroll') || $_title.hasClass('un-marquee-scroll-opposite') ) { 6465 runTextMarquee(); 6466 } 6467 6468 }; 6469 6470 var marqueResize = function(){ 6471 clearRequestTimeout(checkResize); 6472 checkResize = requestTimeout(function(){ 6473 if ( newW !== UNCODE.wwidth ) { 6474 gsap.killTweensOf($title); 6475 UNCODE.textMarquee(); 6476 newW = UNCODE.wwidth; 6477 } 6478 }, 1000); 6479 }; 6480 6481 $(window).off('resize', marqueResize) 6482 .on( 'resize', marqueResize); 6483 6484 cloneSpan($title, txt); 6485 6486 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 6487 window.parent.vc.events.on( 'shortcodeView:updated', function( e ){ 6488 // imageHover(); 6489 var $_titles = $('.un-text-marquee',e.view.$el); 6490 UNCODE.textMarquee($_titles); 6491 }); 6492 } 6493 }); 6494 6495}; 6496 6497UNCODE.parallax = function() { 6498 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 6499 if ($('.parallax-el').length > 0) { 6500 var parallax_elements = new Rellax('.parallax-el'); 6501 } 6502 } 6503}; 6504 6505UNCODE.magicCursor = function(){ 6506 var $customCursor = $('#uncode-custom-cursor'), 6507 $customPilot = $('#uncode-custom-cursor-pilot'), 6508 $postLists = $('.uncode-post-titles'), 6509 currentCursor = 'auto', 6510 setTime, 6511 isScrolling, 6512 mouseEvent; 6513 6514 function delayChangeCursor(cursorType, delayt_time){ 6515 clearRequestTimeout(setTime); 6516 setTime = requestTimeout(function() { 6517 $customCursor.attr('data-cursor', cursorType); 6518 if ( $customPilot.length ) { 6519 $customPilot.attr('data-cursor', cursorType); 6520 } 6521 currentCursor = cursorType; 6522 }, delayt_time); 6523 } 6524 6525 function changeCursor($wrap){ 6526 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 6527 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]', 6528 $href = $wrap.find(href), 6529 cursorType, 6530 setTime, set_delay; 6531 6532 $href.hover(function(e) { 6533 var $this = $(this), 6534 data_cursor = $this.closest('[data-cursor]').attr('data-cursor') || $this.attr('data-cursor'), 6535 is_frontend_editor = $this.closest('.vc_controls').length, 6536 hasSrcOrClck = $('[src]', $this).length || $this.closest('.tmb-click-row').length, 6537 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 6538 if ( is_frontend_editor ) { 6539 cursorType = 'auto'; 6540 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrcOrClck ) { 6541 cursorType = data_cursor; 6542 } else if ( $parent_cursor.length ) { 6543 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 6544 cursorType = 'icon-light';
6545 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 6546 cursorType = 'icon-diff'; 6547 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 6548 cursorType = 'icon-accent'; 6549 } else { 6550 cursorType = 'icon-dark'; 6551 } 6552 } else { 6553 cursorType = 'pointer'; 6554 } 6555 delayChangeCursor(cursorType, 0); 6556 }, function(){ 6557 delayChangeCursor('auto', 150); 6558 }); 6559 6560 $(window).on('disable-hover', function(event) { 6561 document.addEventListener("mousemove", function(e) { 6562 mouseEvent = e; 6563 }); 6564 delayChangeCursor('auto', 0); 6565 }); 6566 6567 $(window).on('enable-hover', function(event) { 6568 if ( typeof mouseEvent !== 'undefined' ) { 6569 var x = mouseEvent.clientX, 6570 y = mouseEvent.clientY; 6571 6572 var elements = document.elementsFromPoint(x, y), 6573 $element = $(elements[0]); 6574 6575 $element.closest(href).trigger('mouseenter'); 6576 } 6577 }); 6578 6579 } 6580 6581 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 6582 changeCursor(); 6583 }); 6584 6585 $(document).ajaxComplete(function( event, xhr, settings ) { 6586 changeCursor(); 6587 }); 6588 6589 $('.isotope-container').on('isotope-layout-complete', function() { 6590 var $this = $(this); 6591 changeCursor($this); 6592 }); 6593 6594}; 6595 6596UNCODE.magneticCursor = function(){ 6597 function magneticCursor($wrap){ 6598 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 6599 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')); 6600 6601 $magnetics.on('mousemove', function(e){ 6602 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 6603 bound = e.currentTarget.getBoundingClientRect(), 6604 coeff = 30, 6605 hor = (bound.width / 2) - (e.clientX - bound.left), 6606 ver = (bound.height / 2) - (e.clientY - bound.top), 6607 toX = hor / bound.width * coeff, 6608 toY = ver / bound.height * coeff, 6609 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 6610 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 6611 toScale = Math.max(scaleX, scaleY); 6612 6613 gsap.killTweensOf($el); 6614 gsap.to( $el, { 6615 duration: 0.75, 6616 x: toX, 6617 y: toY, 6618 scale: toScale, 6619 ease: Power1.easeOut, 6620 transformPerspective: 900, 6621 transformOrigin: 'center', 6622 force3D: true 6623 }); 6624 }).on('mouseout', function(e){ 6625 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 6626 gsap.killTweensOf($el); 6627 gsap.to( $el, { 6628 duration: 0.6, 6629 y: 0, 6630 x: 0, 6631 scale: 1, 6632 ease: Power1.easeOut, 6633 transformPerspective: 900, 6634 transformOrigin: 'center', 6635 force3D: true 6636 }); 6637 }); 6638 }; 6639 6640 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 6641 magneticCursor(); 6642 }); 6643 6644 $(document).ajaxComplete(function( event, xhr, settings ) { 6645 magneticCursor(); 6646 }); 6647 6648 $('.isotope-container').on('isotope-layout-complete', function() { 6649 var $this = $(this); 6650 magneticCursor($this); 6651 }); 6652 6653}; 6654 6655UNCODE.dropImage = function() { 6656 6657 /**************************** 6658 * Image hover * 6659 ****************************/ 6660 function imageHover(){ 6661 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 6662 return; 6663 } 6664 6665 var $postLists = $('.uncode-post-titles'); 6666 $postLists.each(function(){ 6667 var $list = $(this), 6668 timing = parseFloat( $list.attr('data-timing') ), 6669 default_image = $list.hasClass('uncode-post-titles-default-image'), 6670 default_title = $list.hasClass('uncode-post-titles-default-title'), 6671 $tmbs = $('.tmb', $list), 6672 $drop_moves = $('.t-entry-drop:not(.drop-parent)', $tmbs), 6673 clientX, 6674 clientY, 6675 $row_parent = $list.closest('.vc_row'), 6676 $drop_row_parents = $('.drop-parent.drop-parent-row', $list), 6677 $col_parent = $list.closest('.uncell'), 6678 $drop_col_parents = $('.drop-parent.drop-parent-column', $list), 6679 setCTA; 6680 6681 timing *= 0.001; 6682 6683 var drop_bgs = function(){ 6684 $drop_row_parents.add($drop_col_parents).filter('[data-bgset]').each(function(e){ 6685 var $drop = $(this), 6686 srcset = $drop.attr('data-bgset'), 6687 setArr = srcset.split(","), 6688 setArrOrder = [], 6689 biggest = 0, 6690 checkBg = false;
6691 6692 if ( SiteParameters.uncode_adaptive == true ) { 6693 if ( typeof setArr[0] !== 'undefined' && setArr[0] !== null ) { 6694 $drop.css({ 6695 'background-image' : 'url(' + setArr[0] + ')' 6696 }); 6697 } 6698 } else { 6699 for ( var i = 0; i < setArr.length; i++ ) { 6700 var setLoop = setArr[i].trim().split(" "); 6701 if ( typeof setLoop[1] !== 'undefined' && setLoop[1] !== '' ) { 6702 var parseSet = parseFloat(setLoop[1]); 6703 if ( biggest < parseSet ) { 6704 biggest = parseSet; 6705 } 6706 setArrOrder[parseSet] = setLoop[0]; 6707 if ( screenInfo.width <= parseSet && typeof setLoop[0] !== 'undefined' && setLoop[0] !== null ) { 6708 checkBg = true; 6709 $drop.css({ 6710 'background-image' : 'url(' + setLoop[0] + ')' 6711 }); 6712 } 6713 } 6714 } 6715 6716 if ( !checkBg && typeof setArrOrder[biggest] !== 'undefined' && setArrOrder[biggest] !== null ) { 6717 $drop.css({ 6718 'background-image' : 'url(' + setArrOrder[biggest] + ')' 6719 }); 6720 } 6721 } 6722 6723 }); 6724 }; 6725 6726 drop_bgs(); 6727 6728 var dropMovesSize = function(){ 6729 if ( UNCODE.wwidth < UNCODE.mediaQuery ) { 6730 return; 6731 } 6732 $drop_moves.each(function(){ 6733 var $drop_move = $(this), 6734 dataW = $drop_move.attr('data-w'), 6735 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not(.t-inside), .parallax-el'); 6736 if ( typeof dataW !== 'undefined' && dataW !== null ) { 6737 dataW = screenInfo.width / 12 * parseFloat( dataW ); 6738 } 6739 $drop_moves.css({ 6740 width: dataW 6741 }); 6742 6743 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 6744 $anim_parent.on('animationend', function(){ 6745 var bound = $anim_parent[0].getBoundingClientRect(); 6746 $drop_move.css({ 6747 left: bound.x * -1, 6748 top: bound.y * -1, 6749 }); 6750 }); 6751 } 6752 }); 6753 6754 6755 }; 6756 6757 dropMovesSize(); 6758 6759 $(window).on( 'resize', function(){ 6760 clearRequestTimeout(setCTA); 6761 setCTA = requestTimeout( function() { 6762 drop_bgs(); 6763 dropMovesSize(); 6764 }, 100 ); 6765 }); 6766 6767 if ( $drop_row_parents.length ) { 6768 $row_parent.addClass( 'drop-added' ); 6769 } 6770 6771 $drop_row_parents.each(function(index, val){ 6772 var $drop = $(val); 6773 $row_parent.prepend($drop); 6774 manageVideos($drop, false); 6775 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 6776 UNCODE.initVideoComponent($row_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 6777 } 6778 if ( default_image && index == 0 ) { 6779 manageVideos($drop, true); 6780 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 6781 image_ph = new Image(); 6782 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 6783 image_ph.onload = function() { 6784 $drop.addClass('active'); 6785 if ( default_title ) { 6786 $list.addClass('drop-hover'); 6787 $tmbs.first().addClass('drop-active'); 6788 } 6789 }; 6790 image_ph.src = bg_img; 6791 } 6792 } 6793 }); 6794 6795 if ( $drop_col_parents.length ) { 6796 $col_parent.addClass( 'drop-added' ); 6797 } 6798 6799 $drop_col_parents.each(function(index, val){ 6800 var $drop = $(this); 6801 $col_parent.prepend($drop); 6802 manageVideos($drop, false); 6803 if ( typeof UNCODE.initVideoComponent !== 'undefined' ) { 6804 UNCODE.initVideoComponent($col_parent[0], '.uncode-video-container.video, .uncode-video-container.self-video'); 6805 } 6806 if ( default_image && index == 0 ) { 6807 manageVideos($drop, true); 6808 var bg_img = $drop.css('background-image').match(/url\(["']?([^"']*)["']?\)/)[1], 6809 image_ph = new Image(); 6810 if ( typeof bg_img !== 'undefined' && bg_img !== null ) { 6811 image_ph.onload = function() { 6812 $drop.addClass('active'); 6813 if ( default_title ) { 6814 $list.addClass('drop-hover'); 6815 $tmbs.first().addClass('drop-active'); 6816 } 6817 }; 6818 image_ph.src = bg_img; 6819 } 6820 } 6821 }); 6822 6823 function manageVideos( $el, start ) { 6824 var videoElem = $('video', $el), 6825 $iframe = $('iframe', $el), 6826 iframeID = $iframe.attr('id'); 6827 if ( videoElem.length && Object.prototype.toString.call( videoElem[0].setCurrentTime) == '[object Function]') { 6828 if ( start ) { 6829 videoElem[0].setCurrentTime(0); 6830 videoElem[0].play(); 6831 } else { 6832 videoElem[0].pause(); 6833 videoElem[0].setCurrentTime(0); 6834 } 6835 } 6836 6837 $el.data('active', start); 6838 6839 if ( $el.attr('data-provider') === 'vimeo' && typeof iframeID !== 'undefined' && iframeID !== null ) { 6840 var iframeIDv = iframeID.replace('okplayer-', ''), 6841 optionsV = $(window).data('okoptions-' + iframeIDv), 6842 vimeo = $iframe[0], 6843 playerV = $f(vimeo), // `$f` is froogaloop, assumed is loaded 6844 timeV = 0; 6845 6846 if (optionsV.time != null) { 6847 var timeArr = (optionsV.time).replace('t=', '').split(/([^\d.-])/); 6848 for ( var i = 0; i < timeArr.length; i++ ) { 6849 if ( timeArr[i] === 'h' ) { 6850 timeV += parseFloat(timeArr[i-1]) * 3600; 6851 } else if ( timeArr[i] === 'm' ) { 6852 timeV += parseFloat(timeArr[i-1]) * 60; 6853 } else if ( timeArr[i] === 's' ) { 6854 timeV += parseFloat(timeArr[i-1]); 6855 } 6856 } 6857 } 6858 playerV.api('seekTo', timeV); 6859 if ( start ) { 6860 playerV.api('play'); 6861 } else { 6862 playerV.api('pause'); 6863 } 6864 } else if ( $el.attr('data-provider') === 'youtube' ) { 6865 if ( start ) { 6866 $el.trigger('uncode-resume'); 6867 } else { 6868 $el.trigger('uncode-pause'); 6869 } 6870 } 6871 6872 } 6873 6874 if ( UNCODE.wwidth >= UNCODE.mediaQuery ) { 6875 6876 document.addEventListener("mousemove", function(e) { 6877 $drop_moves.each(function(){ 6878 var $drop_move = $(this), 6879 duration = 0.4; 6880 6881 if ( $('#uncode-custom-cursor:not(.in-content)').length ) { 6882 duration = 0.8; 6883 } 6884 6885 clientX = e.clientX; 6886 clientY = e.clientY; 6887 6888 gsap.to( $drop_move, { 6889 duration: duration, 6890 x: clientX, 6891 y: clientY, 6892 ease: Power1.easeOut, 6893 }); 6894 }); 6895 }); 6896 6897 } else { 6898 6899 $(window).on("touchend scroll", function(e) { 6900 $list.removeClass('drop-hover'); 6901 $drop_moves.removeClass('active'); 6902 $tmbs.removeClass('drop-active'); 6903 }); 6904 6905 $drop_moves.each(function(){ 6906 var $drop_move = $(this), 6907 $tmb = $drop_move.closest('.tmb'), 6908 $anim_parent = $drop_move.closest('.animate_when_almost_visible, .uncode-skew, .parallax-el'); 6909 6910 if ( $anim_parent.hasClass('uncode-skew') ) { 6911 $anim_parent.css({ 6912 'transform': 'skew(0)' 6913 }); 6914 } 6915 6916 $tmb.on('touchend', function(e){ 6917 e.stopPropagation(); 6918 6919 $drop_moves.removeClass('active'); 6920 $tmbs.removeClass('drop-active'); 6921 6922 $list.addClass('drop-hover'); 6923 $tmb.addClass('drop-active'); 6924 $drop_move.addClass('active'); 6925 manageVideos($drop_move, true); 6926 clientX = e.changedTouches[0].clientX; 6927 clientY = e.changedTouches[0].clientY; 6928 6929 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 6930 var bound = $anim_parent[0].getBoundingClientRect(); 6931 clientX = clientX - bound.x; 6932 clientY = clientY - bound.y; 6933 } 6934 6935 $drop_move.css({ 6936 left: clientX, 6937 top: clientY 6938 }); 6939 }); 6940 }); 6941 6942 } 6943 6944 $tmbs.each(function(e){ 6945 var $tmb = $(this), 6946 // $trgr = $('a', $tmb), 6947 $trgr = $tmb, 6948 $drop_move = $('.t-entry-drop:not(.drop-parent)', $tmb), 6949 $anim_parent = $drop_move.closest('.animate_when_almost_visible:not(.uncode-skew):not
6949(.t-inside), .parallax-el'), 6950 $video = $('video', $tmb), 6951 $iframe = $('iframe', $tmb), 6952 $entryTxt = $('.t-entry-text', $tmb), 6953 stopBounding; 6954 6955 $entryTxt.add($drop_move).css({ 6956 'transition-duration': timing + 's' 6957 }); 6958 6959 if ( $video.length ) { 6960 var vidH = $video[0].videoHeight, 6961 vidW = $video[0].videoWidth; 6962 $video.css({ 6963 'height': vidH, 6964 'width': vidW 6965 }); 6966 } 6967 6968 if ( $iframe.length ) { 6969 var vidH = $drop_move.attr('data-height'), 6970 vidW = $drop_move.attr('data-width'); 6971 $iframe.css({ 6972 'height': vidH, 6973 'width': vidW 6974 }); 6975 } 6976 6977 $iframe.each(function(){ 6978 var $video = $(this), 6979 vidH = $video[0].videoHeight, 6980 vidW = $video[0].videoWidth; 6981 $video.css({ 6982 'height': vidH, 6983 'width': vidW 6984 }); 6985 }); 6986 6987 if ( $drop_move.length && UNCODE.wwidth >= UNCODE.mediaQuery ) { 6988 $trgr.on('mouseenter',function(e){ 6989 $list.addClass('drop-hover'); 6990 $tmbs.removeClass('drop-active'); 6991 $tmb.addClass('drop-active'); 6992 $drop_move.addClass('active'); 6993 manageVideos($drop_move, true); 6994 6995 var clientX = e.clientX, 6996 clientY = e.clientY; 6997 $drop_move.css({ 6998 'transform': 'translate3d(' + clientX + 'px, ' + clientY + 'px, 0px)' 6999 }); 7000 7001 }) 7002 .on('mouseleave', function(e){ 7003 $list.removeClass('drop-hover'); 7004 $drop_move.css({ 7005 'transition-duration': ( timing*1.25 ) + 's' 7006 }); 7007 $drop_move.removeClass('active'); 7008 $tmb.removeClass('drop-active'); 7009 $drop_move.on('transitionend', function(e){ 7010 $drop_move.off('transitionend'); 7011 $drop_move.css({ 7012 'transition-duration': timing + 's' 7013 }); 7014 manageVideos($drop_move,false); 7015 }); 7016 }); 7017 7018 document.addEventListener('visibilitychange', function(){ 7019 if ( document.visibilityState == 'hidden' && $drop_move.data('active') === true ) { 7020 $drop_move.css({ 7021 'transition-duration': '0s' 7022 }); 7023 $drop_move.removeClass('active'); 7024 manageVideos($drop_move, false); 7025 } 7026 }); 7027 7028 document.addEventListener('scroll', function(){ 7029 window.clearRequestTimeout( stopBounding ); 7030 7031 if ( $drop_move.hasClass('active') ) { 7032 $list.removeClass('drop-hover'); 7033 $tmbs.removeClass('drop-active'); 7034 $drop_move.removeClass('active'); 7035 $drop_move.on('transitionend', function(e){ 7036 $drop_move.off('transitionend'); 7037 $drop_move.css({ 7038 'transition-duration': timing + 's' 7039 }); 7040 manageVideos($drop_move,false); 7041 }); 7042 } 7043 7044 stopBounding = requestTimeout(function() { 7045 if ( $anim_parent.length && $anim_parent.css('transform') !== '' && $anim_parent.css('transform') !== 'none' ) { 7046 var bound = $anim_parent[0].getBoundingClientRect(); 7047 $drop_move.css({ 7048 left: bound.x * -1, 7049 top: bound.y * -1, 7050 }); 7051 } 7052 }, 200); 7053 7054 }); 7055 } 7056 7057 var datatarget = $trgr.closest('[data-drop-target]').attr('data-drop-target'), 7058 $drop = $('[data-drop="' + datatarget + '"]', $row_parent); 7059 7060 $drop.css({ 7061 'transition-duration': timing + 's' 7062 }); 7063 7064 if ( ( $drop_row_parents.length || $drop_col_parents.length ) && $drop.length ) { 7065 $trgr.on('mouseenter',function(e){ 7066 $row_parent.add($col_parent).addClass('drop-list-loaded'); 7067 $list.addClass('drop-hover'); 7068 7069 if ( !$tmb.hasClass('drop-active') ) { 7070 $tmbs.removeClass('drop-active'); 7071 $tmb.addClass('drop-active'); 7072 if ( default_image && !$drop.hasClass('active') ) { 7073 var $prev = $('[data-drop].active', $row_parent); 7074 $prev.css({ 7075 'transition-duration': (timing*1.5) + 's' 7076 }); 7077 $prev.removeClass('active'); 7078 $prev.on('transitionend', function(e){ 7079 $prev.off('transitionend'); 7080 manageVideos($prev,false); 7081 }); 7082 } 7083 $drop.css({ 7084 'transition-duration': timing + 's' 7085 }); 7086 $drop.off('transitionend'); 7087 $drop.addClass('active'); 7088 manageVideos($drop, true); 7089 } 7090 }) 7091 .on('mouseleave', function(e){ 7092 if ( ( default_image && !default_title ) || !default_image ) { 7093 $list.removeClass('drop-hover'); 7094 $tmb.removeClass('drop-active'); 7095 } 7096 if ( ! default_image ) { 7097 $drop.css({ 7098 'transition-duration': (timing*1.5) + 's' 7099 }); 7100 $drop.removeClass('active'); 7101 7102 $drop.on('transitionend', function(e){ 7103 $drop.off('transitionend'); 7104 manageVideos($drop,false); 7105 }); 7106 } 7107 }); 7108 7109 document.addEventListener('visibilitychange', function(){ 7110 if ( document.visibilityState == 'hidden' && $drop.data('active') === true && ! default_image ) { 7111 $drop.css({ 7112 'transition-duration': '0s' 7113 }); 7114 $drop.removeClass('active'); 7115 manageVideos($drop, false); 7116 } 7117 }); 7118 } 7119 }); 7120 7121 }); 7122 }; 7123 7124 $(window).on('load', function(event) { 7125 imageHover(); 7126 }); 7127 7128 var drop_wp_animation = function() { 7129 var $postLists = $('.uncode-post-titles'); 7130 $postLists.each(function(){ 7131 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 7132 new Waypoint({ 7133 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 7134 element: val, 7135 handler: function() { 7136 var element = $(this.element), 7137 parent = element.closest('.tmb'), 7138 currentIndex = parent.index(),
7139 delay = currentIndex, 7140 delayAttr = parseInt(element.attr('data-delay')); 7141 if (isNaN(delayAttr)) delayAttr = 100; 7142 var objTimeout = requestTimeout(function() { 7143 element.addClass('start_animation'); 7144 7145 var nextTimeout = requestTimeout(function() { 7146 $('.drop-image-separator', parent).addClass('start_animation'); 7147 }, 50); 7148 7149 }, delay * delayAttr); 7150 if (!UNCODE.isUnmodalOpen) { 7151 this.destroy(); 7152 } 7153 }, 7154 offset: UNCODE.isFullPage ? '100%' : '90%' 7155 }) 7156 }); 7157 }); 7158 } 7159 7160 var runWaypoints_TO, 7161 runWaypoints_delay = 0; 7162 7163 var runWaypoints = function(){ 7164 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 7165 runWaypoints_delay = 400; 7166 } 7167 clearRequestTimeout(runWaypoints_TO); 7168 runWaypoints_TO = requestTimeout(function() { 7169 drop_wp_animation(); 7170 }, runWaypoints_delay); 7171 }; 7172 runWaypoints(); 7173 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 7174 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 7175 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 7176 // imageHover(); 7177 runWaypoints(); 7178 }); 7179 } 7180}; 7181 7182UNCODE.postTable = function() { 7183 7184 var clickRow = function(){ 7185 var $postLists = $('.uncode-post-table'); 7186 7187 $postLists.each(function(){ 7188 var $postList = $(this), 7189 $tmbClicks = $('.tmb.tmb-click-row', $postList); 7190 7191 $tmbClicks.each(function(){ 7192 var $tmb = $(this), 7193 $click = $('.table-click-row', $tmb); 7194 $('*:not(.table-click-row)', $tmb).on('click', function(e){ 7195 e.preventDefault(); 7196 e.stopPropagation(); 7197 $click[0].click(); 7198 return false; 7199 }); 7200 }); 7201 7202 }) 7203 }; 7204 7205 clickRow(); 7206 7207 var hoverRow = function(){ 7208 var $postLists = $('.uncode-post-table.uncode-post-table-hover'); 7209 7210 $postLists.on('mouseenter', function(){ 7211 $(this).addClass('post-table-hover'); 7212 }); 7213 $postLists.on('mouseleave', function(){ 7214 $(this).removeClass('post-table-hover'); 7215 }); 7216 } 7217 7218 hoverRow(); 7219 7220 var drop_wp_animation = function() { 7221 var $postLists = $('.uncode-post-table'); 7222 $postLists.each(function(){ 7223 $.each($('.t-inside.animate_when_almost_visible', $postLists), function(index, val) { 7224 new Waypoint({ 7225 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 7226 element: val, 7227 handler: function() { 7228 var element = $(this.element), 7229 parent = element.closest('.tmb'), 7230 currentIndex = parent.index(), 7231 delay = currentIndex, 7232 delayAttr = parseInt(element.attr('data-delay')); 7233 if (isNaN(delayAttr)) delayAttr = 100; 7234 var objTimeout = requestTimeout(function() { 7235 element.addClass('start_animation'); 7236 }, delay * delayAttr); 7237 if (!UNCODE.isUnmodalOpen) { 7238 this.destroy(); 7239 } 7240 }, 7241 offset: UNCODE.isFullPage ? '100%' : '90%' 7242 }) 7243 }); 7244 }); 7245 } 7246 7247 var runWaypoints_TO, 7248 runWaypoints_delay = 0; 7249 7250 var runWaypoints = function(){ 7251 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 7252 runWaypoints_delay = 400; 7253 } 7254 clearRequestTimeout(runWaypoints_TO); 7255 runWaypoints_TO = requestTimeout(function() { 7256 drop_wp_animation(); 7257 }, runWaypoints_delay); 7258 }; 7259 runWaypoints(); 7260 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 7261 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 7262 window.parent.vc.events.on( 'shortcodeView:ready shortcodeView:updated', function(){ 7263 runWaypoints(); 7264 // clickRow(); 7265 }); 7266 } 7267}; 7268 7269UNCODE.rotatingTxt = function($ctxt) { 7270 7271 if ( $('body').hasClass('compose-mode') ) { 7272 return; 7273 } 7274 7275 $ctxt = typeof $ctxt == 'undefined' ? $('body') : $ctxt; 7276 var setCTA; 7277 7278 $('.el-text', $ctxt).has('.uncode-rotating-text-start[data-text]').each(function(){ 7279 var $heading = $(this), 7280 // debug = 0, 7281 cycle = 0, 7282 $trgt, 7283 $toMove, 7284 $highl, 7285 $col = $heading.closest('.uncont'), 7286 txt, 7287 arrTxt, 7288 textFadeIn, textFadeOut, 7289 removeWraps; 7290 7291 var defineObjs = function() { 7292 $('.uncode-rotating-text-start[data-text]', $heading).each(function(){ 7293 var $rtx = $(this), 7294 fx = $rtx.attr('data-fx'), 7295 wait = $rtx.attr('data-wait'), 7296 $prev = $(this).prev().addClass('prev-rotating-start'), 7297 splitToMove = [], 7298 splitArray = [], 7299 lineArray = [], 7300 lineIndex = 0, 7301 lineStart = true, 7302 lineEnd = false, 7303 startSplit = false, 7304 $line_wrap = $rtx.closest('.heading-line-wrap'), 7305 same_line = true, 7306 $splits = $rtx.closest('.el-text').find('.split-word').removeClass('empty-span-hidden'), 7307 indexRtx = $splits.index($rtx); 7308 7309 fx = typeof fx === 'undefined' ? '' : fx;
7310 wait = typeof wait === 'undefined' ? '' : wait; 7311 7312 $splits.each(function(key, val){ 7313 var $split = $(this), 7314 $new_line_wrap = $split.closest('.heading-line-wrap'); 7315 7316 if ( $split.text() == '' && !$split.hasClass('uncode-rotating-text-end') && !$split.hasClass('uncode-rotating-text-start') && !splitArray.length ) { 7317 splitArray.push( $split ); 7318 } 7319 7320 if ( $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 7321 startSplit = false; 7322 } 7323 7324 if ( ! $split.hasClass('uncode-rotating-text-end') && startSplit === true ) { 7325 splitArray.push( $split ); 7326 7327 if ( same_line && ( !$new_line_wrap.length || $line_wrap[0] == $new_line_wrap[0] ) ) { 7328 same_line = true; 7329 } else { 7330 same_line = false; 7331 } 7332 } 7333 7334 if ( key == indexRtx ) { 7335 if ( /\S/.test($split.text()) ) { 7336 startSplit = true; 7337 $line_wrap = $split.closest('.heading-line-wrap'); 7338 splitArray.push( $split ); 7339 } else { 7340 indexRtx++; 7341 } 7342 } 7343 7344 $line_wrap = $new_line_wrap; 7345 }); 7346 7347 $toMove = $($.map(splitToMove, function(el){return el.get();})); 7348 $trgt = $($.map(splitArray, function(el){return el.get();})); 7349 7350 if ( same_line ) { 7351 $trgt.wrapAll('<span class="uncode-rotating-wrap" data-fx="' + fx + '" data-wait="' + wait + '" />'); 7352 $trgt.wrapAll('<span class="uncode-rotating-wrap-inner" />'); 7353 } 7354 7355 if ( $prev.hasClass('split-word-empty') && $rtx.is(':last-child') ) { 7356 $prev.addClass('empty-span-hidden'); 7357 } 7358 7359 $highl = $('.heading-text-highlight-inner', $trgt); 7360 7361 $rtx.attr('data-animated', 'true'); 7362 if ( cycle == 0 ) { 7363 $( document.body ).trigger('defer-highlights'); 7364 cycle++; 7365 defineObjs(); 7366 return; 7367 } 7368 cycle++; 7369 7370 txt = $rtx.attr('data-text'); 7371 arrTxt = txt.split("|"); 7372 7373 textFadeOut($trgt); 7374 7375 }); 7376 }; 7377 7378 removeWraps = function(){ 7379 7380 // if ( debug == 1 ) return; 7381 var $wraps = $heading[0].querySelectorAll('.uncode-rotating-wrap, .uncode-rotating-wrap-inner'); 7382 for (var wrap_k = 0; wrap_k < $wraps.length; wrap_k++) { 7383 7384 7385 var $temp_highl = $($wraps[wrap_k]).find('> .heading-text-highlight-inner').clone(), 7386 $splitFlow = $($wraps[wrap_k]).find('.split-word-flow'); 7387 7388 $($wraps[wrap_k]).find('> .heading-text-highlight-inner').remove(); 7389 7390 $splitFlow.each(function(){ 7391 $(this).append($temp_highl); 7392 }); 7393 7394 var $line_wrap = $wraps[wrap_k]; 7395 var $parent_wrap = $line_wrap.parentNode; 7396 if ( $parent_wrap !== null ) { 7397 while ( $line_wrap.firstChild ) { 7398 $parent_wrap.insertBefore($line_wrap.firstChild, $line_wrap); 7399 } 7400 $parent_wrap.removeChild($line_wrap); 7401 } 7402 } 7403 // debug++; 7404 defineObjs(); 7405 }; 7406 7407 var loop = 0; 7408 textFadeIn = function($trgt){ 7409 var word = arrTxt[loop].split(" "), 7410 worsSpan = '', 7411 $wrap = $trgt.closest('.uncode-rotating-wrap'), 7412 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 7413 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'); 7414 7415 for (var w = 0; w < word.length; w++) { 7416 var highl; 7417 if ( $highl.length ) { 7418 highl = $highl[0].outerHTML; 7419 } else { 7420 highl = ''; 7421 } 7422 7423 if ( w > 0 ) { 7424 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner split-empty-inner"> </span>' + highl + '</span></span>'; 7425 } 7426 var charachters = word[w].split(''); 7427 worsSpan += '<span class="split-word"><span class="split-word-flow"><span class="split-word-inner">'; 7428 for (var c = 0; c < charachters.length; c++) { 7429 worsSpan += '<span class="split-char">' + charachters[c] + '</span>'; 7430 } 7431 worsSpan += '</span>' + highl + '</span></span>'; 7432 } 7433 7434 if ( $wrap.length && $wrap_inner.length ) { 7435 var words_w = $wrap_inner.outerWidth(); 7436 $wrap.css({ 7437 width: words_w 7438 }); 7439 7440 $highl = $('.heading-text-highlight-inner', $wrap); 7441 $highl.prependTo($wrap); 7442 7443 $wrap_inner.css({ 7444 opacity: 0 7445 }); 7446 7447 $wrap_inner.html(worsSpan); 7448 $('.heading-text-highlight-inner', $wrap_inner).remove(); 7449 words_w = $wrap_inner.innerWidth(); 7450 7451 var duration = 0.45; 7452 7453 $heading.removeClass('auto-width'); 7454 if ( words_w > $col.width() ) { 7455 $heading.addClass('auto-width'); 7456 words_w = 'auto'; 7457 duration = 0; 7458 } 7459 7460 $wrap.css({ 7461 'width': words_w, 7462 'transition': 'width ' + (duration*1000) + 'ms cubic-bezier(0.16, 1, 0.3, 1)', 7463 }); 7464 7465 var $word_inner = $('.split-word-inner', $wrap_inner), 7466 $extra_wrap_inner = $wrap_inner.closest('.uncode-rotating-wrap-inner'); 7467 7468 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 7469 7470 if ( !$target_fx.length ) { 7471 return; 7472 } 7473 7474 gsap.killTweensOf($target_fx); 7475 7476 if ( fx !== 'zoom' ) { 7477 gsap.fromTo( $target_fx, { 7478 y: fx === 'opacity' ? '0%' : '-10%' 7479 },{ 7480 delay: duration, 7481 duration: 0.25, 7482 y: '0%', 7483 ease: Circ.easeOut, 7484 }); 7485 7486 if ( !$wrap_inner.length ) { 7487 return; 7488 } 7489 7490 gsap.fromTo( $wrap_inner, { 7491 opacity: 0, 7492 },{ 7493 delay: duration, 7494 duration: 0.25, 7495 opacity: 1, 7496 ease: Circ.easeOut, 7497 onComplete: function(){ 7498 $('> .heading-text-highlight-inner', $wrap).remove(); 7499 $wrap_inner.html(worsSpan); 7500 removeWraps(); 7501 } 7502 }) 7503 7504 } else { 7505 gsap.fromTo( $target_fx, { 7506 transformOrigin: '50%', 7507 opacity: 0, 7508 scale: 0.875, 7509 },{ 7510 opacity: 1, 7511 delay: duration, 7512 duration: 0.25, 7513 scale: 1, 7514 ease: Circ.easeOut, 7515 onComplete: function(){ 7516 $('> .heading-text-highlight-inner', $wrap).remove(); 7517 $wrap_inner.html(worsSpan); 7518 removeWraps(); 7519 } 7520 }); 7521 } 7522 7523 } else { 7524 7525 if ( !$wrap_inner.length ) { 7526 return; 7527 } 7528 7529 gsap.to( $wrap_inner, { 7530 duration: 0.4, 7531 opacity: 0, 7532 ease: Power1.easeOut, 7533 onComplete: function(){ 7534 $wrap_inner.html(worsSpan); 7535 words_w = $wrap_inner.innerWidth(); 7536 7537 gsap.to( $wrap_inner, { 7538 duration: 0.2, 7539 opacity: 1, 7540 ease: Power1.easeOut, 7541 onComplete: function(){ 7542 $('> .heading-text-highlight-inner', $wrap).remove(); 7543 $wrap_inner.html(worsSpan); 7544 removeWraps(); 7545 } 7546 }) 7547 } 7548 }); 7549 } 7550 7551 if ( loop < arrTxt.length-1 ) { 7552 loop++; 7553 } else { 7554 loop = 0; 7555 } 7556 7557 }; 7558 7559 textFadeOut = function($trgt){ 7560 var $word_inner = $('.split-word-inner', $trgt), 7561 $wrap = $trgt.closest('.uncode-rotating-wrap'), 7562 $wrap_inner = $trgt.closest('.uncode-rotating-wrap-inner'), 7563 fx = $trgt.closest('.uncode-rotating-wrap').attr('data-fx'), 7564 wait = $trgt.closest('.uncode-rotating-wrap').attr('data-wait'); 7565 7566 wait = typeof wait === 'undefined' || wait === '' ? 3 : parseFloat(wait)/1000; 7567 7568 var gsap_param = { 7569 delay: wait, 7570 duration: 0.25, 7571 y: fx === '' ? '10%' : '0%', 7572 opacity: 0, 7573 ease: Circ.easeOut, 7574 onStart: function(){ 7575 if ( $wrap.length && $wrap_inner.length && fx === 'zoom' ) { 7576 $highl = $('.heading-text-highlight-inner', $wrap); 7577 $highl.prependTo($wrap); 7578 } 7579 }, 7580 onComplete: textFadeIn, 7581 onCompleteParams: [$trgt] 7582 }; 7583 7584 var $target_fx = fx === 'zoom' ? $wrap_inner : $word_inner; 7585 7586 if ( fx === '' ) { 7587 gsap_param.y = '10%'; 7588 } else if ( fx === 'zoom' ) { 7589 gsap_param.scale = '1.045'; 7590 } 7591 7592 if ( !$target_fx.length ) { 7593 return; 7594 } 7595 7596 if ( $heading.data('waypoint') !== true ) { 7597 var textInView = new Waypoint.Inview({ 7598 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 7599 element: $heading[0], 7600 enter: function(direction) { 7601 $heading.data('waypoint',true); 7602 gsap.fromTo( $target_fx, { 7603 transformOrigin: '50%' 7604 }, gsap_param ); 7605 } 7606 }); 7607 } else { 7608 gsap.fromTo( $target_fx, { 7609 transformOrigin: '50%' 7610 }, gsap_param ); 7611 } 7612 }; 7613 7614 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 7615 window.parent.vc.events.on( 'shortcodeView:updated shortcodeView:ready', function(model){ 7616 var $el = model.view.$el, 7617 shortcode = model.attributes.shortcode; 7618 7619 UNCODE.rotatingTxt($el); 7620 }); 7621 } else { 7622 if ( $heading.hasClass('animate_inner_when_almost_visible') ) { 7623 $heading.on('already-animated', function(){ 7624 removeWraps(); 7625 window.addEventListener('removeOldLines', function(){ 7626 clearRequestTimeout(setCTA); 7627 setCTA = requestTimeout( removeWraps, 150 ); 7628 }); 7629 }); 7630 } else { 7631 $(window).on('load', function(){ 7632 removeWraps(); 7633 window.addEventListener('removeOldLines', function(){ 7634 clearRequestTimeout(setCTA); 7635 setCTA = requestTimeout( removeWraps, 150 ); 7636 }); 7637 }); 7638 } 7639 } 7640 }); 7641 7642}; 7643 7644UNCODE.verticalText = function() { 7645 $(window).on('menuCanvasOpen', function(){ 7646 $('.vertical-text--fixed').fadeOut(500); 7647 }).on('menuCanvasClose', function(){ 7648 $('.vertical-text--fixed').fadeIn(500); 7649 }); 7650 7651 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 7652 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 7653 7654 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0) { 7655 window.addEventListener('scroll', function(e) { 7656 var totalPageHeight = document.body.scrollHeight; 7657 var scrollPoint = window.scrollY + window.innerHeight; 7658 7659 if (window.scrollY > 0) { 7660 showOnTopVerticalTexts.fadeOut(); 7661 } else { 7662 showOnTopVerticalTexts.fadeIn(); 7663 } 7664 7665 if (scrollPoint >= totalPageHeight) { 7666 hideOnBottomVerticalTexts.fadeOut(); 7667 } else { 7668 hideOnBottomVerticalTexts.fadeIn(); 7669 } 7670 }, false); 7671 } 7672}; 7673 7674UNCODE.revslider = function() { 7675 $(window).on("load", function() { 7676 $('.rev_slider_wrapper, rs-module-wrap').each(function(){ 7677 var $this = jQuery(this), 7678 id_array = $this.attr("id").split("_"), 7679 id = id_array[2]; 7680 if (id != undefined && id != '') { 7681 $.globalEval('revapi'+id+'.bind("revolution.slide.onloaded",function (e, data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(0).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})'); 7682 $.globalEval('revapi'+id+'.bind("revolution.slide.onchange",function (e,data) { if (jQuery(e.currentTarget).closest(".header-revslider").length) { var style = jQuery(e.currentTarget).find("li, rs-slide").eq(data.slideIndex - 1).attr("data-skin"), scrolltop = jQuery(document).scrollTop(); if (style != undefined) UNCODE.switchColorsMenu(scrolltop, style);}})'); 7683 } 7684 }); 7685 }); 7686}; 7687 7688UNCODE.layerslider = function() { 7689 $(window).on("load", function() { 7690 7691 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 7692 7693 var slideData = slider.slides.current.data, 7694 scrolltop = $(document).scrollTop(); 7695 if( slideData && slideData.skin ) { 7696 7697 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 7698 7699 } 7700 }); 7701 7702 }); 7703}; 7704 7705 UNCODE.init = function() { 7706 var wfl_check = false, wfl_request, waypoint_request; 7707 UNCODE.preventDoubleTransition(); 7708 UNCODE.utils(); 7709 if (typeof UNCODE.share !== 'undefined') { 7710 UNCODE.share(); 7711 } 7712 if (typeof UNCODE.tooltip !== 'undefined') { 7713 UNCODE.tooltip(); 7714 } 7715 if (typeof UNCODE.counters !== 'undefined') { 7716 UNCODE.counters(); 7717 } 7718 if (typeof UNCODE.countdowns !== 'undefined') { 7719 UNCODE.countdowns(); 7720 } 7721 if (typeof UNCODE.tabs !== 'undefined') { 7722 UNCODE.tabs(); 7723 } 7724 if (typeof UNCODE.collapse !== 'undefined') { 7725 UNCODE.collapse(); 7726 } 7727 if (typeof UNCODE.bigText !== 'undefined') { 7728 UNCODE.bigText(); 7729 } 7730 UNCODE.menuSystem(); 7731 if (typeof UNCODE.bgChanger !== 'undefined') { 7732 UNCODE.bgChanger(); 7733 } 7734 if (typeof UNCODE.magicCursor !== 'undefined') { 7735 UNCODE.magicCursor(); 7736 } 7737 if (typeof UNCODE.magneticCursor !== 'undefined') { 7738 UNCODE.magneticCursor(); 7739 } 7740 if (typeof UNCODE.dropImage !== 'undefined') { 7741 UNCODE.dropImage(); 7742 } 7743 if (typeof UNCODE.postTable !== 'undefined') { 7744 UNCODE.postTable(); 7745 } 7746 if (typeof UNCODE.rotatingTxt !== 'undefined') { 7747 UNCODE.rotatingTxt(); 7748 } 7749 if (typeof UNCODE.okvideo !== 'undefined') { 7750 UNCODE.okvideo(); 7751 } 7752 if (typeof UNCODE.backgroundSelfVideos !== 'undefined') { 7753 UNCODE.backgroundSelfVideos(); 7754 } 7755 UNCODE.tapHover(); 7756 if (typeof UNCODE.isotopeLayout !== 'undefined') { 7757 UNCODE.isotopeLayout(); 7758 } 7759 if (typeof UNCODE.justifiedGallery !== 'undefined') { 7760 UNCODE.justifiedGallery(); 7761 } 7762 if (typeof UNCODE.lightbox !== 'undefined') { 7763 UNCODE.lightbox(); 7764 } 7765 if (typeof UNCODE.carousel !== 'undefined') { 7766 UNCODE.carousel($('body')); 7767 } 7768 if (typeof UNCODE.lettering !== 'undefined') { 7769 UNCODE.lettering(); 7770 } 7771 UNCODE.animations(); 7772 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 7773 UNCODE.stickyElements(); 7774 } 7775 if (typeof UNCODE.twentytwenty !== 'undefined') { 7776 UNCODE.twentytwenty(); 7777 } 7778 UNCODE.disableHoverScroll(); 7779 UNCODE.printScreen(); 7780 if (typeof UNCODE.particles !== 'undefined') { 7781 UNCODE.particles(); 7782 } 7783 if (typeof UNCODE.filters !== 'undefined') { 7784 UNCODE.filters(); 7785 } 7786 if (typeof UNCODE.widgets !== 'undefined') { 7787 UNCODE.widgets(); 7788 } 7789 if (typeof UNCODE.unmodal !== 'undefined') { 7790 UNCODE.unmodal(); 7791 } 7792 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 7793 if ( !UNCODE.isFullPage ) { 7794 UNCODE.checkScrollForTabs(); 7795 } 7796 } 7797 if (typeof UNCODE.onePage !== 'undefined') { 7798 UNCODE.onePage(UNCODE.isMobile); 7799 } 7800 if (typeof UNCODE.fullPage !== 'undefined') { 7801 $(document).ready(function(){ 7802 UNCODE.fullPage(); 7803 }); 7804 } 7805 if (typeof UNCODE.skewIt !== 'undefined') { 7806 UNCODE.skewIt(); 7807 } 7808 if (typeof UNCODE.rotateIt !== 'undefined') { 7809 UNCODE.rotateIt(); 7810 } 7811 if (typeof UNCODE.textMarquee !== 'undefined') { 7812 UNCODE.textMarquee(); 7813 } 7814 if (typeof UNCODE.verticalText !== 'undefined') { 7815 UNCODE.verticalText(); 7816 } 7817 if (typeof UNCODE.revslider !== 'undefined') { 7818 UNCODE.revslider(); 7819 } 7820 if (typeof UNCODE.layerslider !== 'undefined') { 7821 UNCODE.layerslider(); 7822 } 7823 $(window).on('load',function(){ 7824 clearRequestTimeout(waypoint_request);
7825 waypoint_request = requestTimeout( function(){ 7826 Waypoint.refreshAll(); 7827 }, 1000); 7828 7829 if (typeof UNCODE.parallax !== 'undefined') { 7830 UNCODE.parallax(); 7831 } 7832 }); 7833 } 7834 7835 if ( ! SiteParameters.is_frontend_editor ) { 7836 UNCODE.init(); 7837 } 7838 7839 7840})(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.