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 if (typeof jQuery.fn.tooltip !== 'undefined') { 63 $('.btn-tooltip').tooltip(); 64 } 65 $(document).on('mouseover', 'a', function() { 66 $(this).attr('data-title', $(this).attr('title')); 67 $(this).removeAttr('title'); 68 }); 69 $(document).on('mouseout', 'a', function() { 70 $(this).attr('title', $(this).attr('data-title')); 71 $(this).removeAttr('data-title'); 72 }); 73 var $counters = $('.counter:not(.counter-init)'); 74 $counters.each(function(){ 75 var $counter = $(this).addClass('counter-init'); 76 if ( $counter.closest( '.owl-carousel' ).length ) { 77 return; 78 } 79 $counter.addClass('started').counterUp({ 80 delay: 10, 81 time: 1500 82 }); 83 }); 84 var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); 85 $countdowns.each(function() { 86 var $this = $(this).addClass('counter-init'), 87 finalDate = $(this).data('uncode-countdown'); 88 $this.countdown(finalDate, function(event) { 89 $this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>')); 90 }); 91 }); 92 93 if (typeof Share !== 'undefined') { 94 var share_button_element = $('.share-button'); 95 var share_button_url = share_button_element.data('url'); 96 97 var share_button_config = { 98 ui: { 99 flyout: "top center", 100 button_font: false, 101 button_text: '', 102 icon_font: false 103 } 104 }; 105 106 if (share_button_url) { 107 share_button_config.url = share_button_url.replace("&", "%26"); 108 } 109 110 var share_button_top = new Share('.share-button', share_button_config); 111 } 112 113 this.get_scroll_offset = function(e) { 114 115 var scroll_offset = 0, 116 is_first_link = false, 117 target, 118 trigger; 119 120 if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { 121 target = e.target; 122 trigger = e.currentTarget; 123 } 124 125 if ($('.menu-hide').length || $('.menu-hide-vertical').length) { 126 if (UNCODE.bodyTop > UNCODE.wheight / 2) { 127 UNCODE.hideMenu(100); 128 } 129 } 130 131 if ( UNCODE.wwidth < UNCODE.mediaQuery && $('body').hasClass('menu-mobile-transparent') ) { 132 if ( $('.menu-sticky').length && !$('.menu-hide').length ) { 133 scroll_offset += $('#logo-container-mobile').outerHeight(); 134 } 135 } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 136 scroll_offset += $('.menu-sticky .menu-container').outerHeight(); 137 } else { 138 if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { 139 scroll_offset += UNCODE.menuMobileHeight; 140 } else { 141 if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) { 142 scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; 143 } else { 144 if ( $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { 145 scroll_offset += UNCODE.menuMobileHeight; 146 } 147 } 148 } 149 } 150 151 scroll_offset += UNCODE.bodyBorder; 152 153 return scroll_offset; 154 } 155 156 if ( !UNCODE.isFullPage ) { 157 $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link)', function(e) { 158 159 var hash = (e.currentTarget).hash, 160 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 161 anchor = ''; 162 if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; 163 if ($(e.currentTarget).hasClass('woocommerce-review-link') && $('.wootabs .tab-content').length) { 164 e.preventDefault(); 165 if (!$('#tab-reviews').is(':visible')) { 166 $('a[href="#tab-reviews"]').trigger('click'); 167 } 168 var calc_scroll = $('.wootabs .tab-content').offset().top; 169 calc_scroll -= UNCODE.get_scroll_offset(e); 170 171 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 172 173 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 174 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 175 } 176 177 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 178 delta = bodyTop - calc_scroll, 179 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 180 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 181 182 requestTimeout(function(){ 183 if (scrollSpeed == 0) { 184 $('html, body').scrollTop(calc_scroll); 185 UNCODE.scrolling = false;
186 } else { 187 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 188 $(this).stop(); 189 }).animate({ 190 scrollTop: calc_scroll 191 }, scrollSpeed, 'easeInOutCubic', function() { 192 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 193 UNCODE.scrolling = false; 194 } 195 ); 196 } 197 }, 200); 198 return; 199 } 200 if (hash != undefined) { 201 var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; 202 var anchor = this.hash.slice(1); 203 if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { 204 if ( !specialFormat.test(hash) ) { 205 if ( $(hash).length ) 206 anchor = $(hash); 207 } 208 } 209 } 210 211 if (is_scrolltop || anchor != '') { 212 if (is_scrolltop) { 213 e.preventDefault(); 214 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 215 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 216 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 217 218 if (scrollSpeed == 0) { 219 $('html, body').scrollTop(0); 220 UNCODE.scrolling = false; 221 } else { 222 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 223 $(this).stop(); 224 }).animate({ 225 scrollTop: 0 226 }, scrollSpeed, 'easeInOutCubic', function() { 227 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 228 UNCODE.scrolling = false; 229 }); 230 } 231 } else { 232 var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor; 233 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 234 var get_href = $(val).attr('href'); 235 if (get_href != undefined) { 236 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 237 else $(val).parent().removeClass('active'); 238 } 239 }); 240 if (scrollSection.length) { 241 if ( $('body').hasClass('uncode-scroll-no-history') ) { 242 e.preventDefault(); 243 } 244 245 if (UNCODE.menuOpened) { 246 if (UNCODE.wwidth < UNCODE.mediaQuery) { 247 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 248 } else { 249 $('.mmb-container-overlay .overlay-close').trigger('click'); 250 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 251 } 252 } 253 254 var calc_scroll = scrollSection.offset().top, 255 getOffset = UNCODE.get_scroll_offset(e), 256 $logo = $('#logo-container-mobile'), 257 logoH, 258 $menu = $('#masthead .menu-container'), 259 menuH; 260 261 calc_scroll -= getOffset; 262 263 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 264 delta = bodyTop - calc_scroll, 265 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 266 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 267 268 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 269 logoH = $logo.outerHeight(), 270 menuH = $menu.outerHeight(); 271 if ( calc_scroll < ( logoH + menuH ) ) { 272 calc_scroll = 0; 273 } 274 } 275 276 if (scrollSpeed == 0) { 277 $('html, body').scrollTop(calc_scroll); 278 UNCODE.scrolling = false; 279 } else { 280 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 281 $(this).stop(); 282 }).animate({ 283 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 284 }, scrollSpeed, 'easeInOutCubic', function() { 285 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 286 UNCODE.scrolling = false; 287 if (getOffset != UNCODE.get_scroll_offset(e)) { 288 calc_scroll = scrollSection.offset().top; 289 getOffset = UNCODE.get_scroll_offset(e); 290 calc_scroll -= getOffset; 291 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 292 $(this).stop(); 293 }).animate({ 294 scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll 295 }, scrollSpeed, 'easeInOutCubic', function() { 296 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 297 UNCODE.scrolling = false;
298 } 299 ); 300 } 301 }); 302 } 303 } 304 } 305 } 306 }); 307 $('.header-scrolldown').on('click', function(event) { 308 309 event.preventDefault(); 310 311 var pageHeader = $(event.target).closest('#page-header'), 312 pageHeaderTop = pageHeader.offset().top, 313 pageHeaderHeight = pageHeader.outerHeight(), 314 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 315 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 316 317 var calc_scroll = pageHeaderTop + pageHeaderHeight, 318 getOffset = UNCODE.get_scroll_offset(event); 319 calc_scroll -= getOffset; 320 321 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 322 323 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 324 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 325 } 326 327 if (scrollSpeed == 0) { 328 $('html, body').scrollTop(calc_scroll); 329 UNCODE.scrolling = false; 330 } else { 331 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 332 $(this).stop(); 333 }).animate({ 334 scrollTop: calc_scroll 335 }, scrollSpeed, 'easeInOutCubic', function() { 336 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 337 UNCODE.scrolling = false; 338 if (getOffset != UNCODE.get_scroll_offset(event)) { 339 calc_scroll = pageHeaderTop + pageHeaderHeight; 340 getOffset = UNCODE.get_scroll_offset(event); 341 calc_scroll -= getOffset; 342 $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ 343 $(this).stop(); 344 }).animate({ 345 scrollTop: calc_scroll 346 }, scrollSpeed, 'easeInOutCubic', function() { 347 $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 348 UNCODE.scrolling = false; 349 } 350 ); 351 } 352 } 353 ); 354 } 355 }); 356 } 357 // TAB DATA-API 358 // ============ 359 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { 360 e.preventDefault() 361 $(this).tab('show'); 362 requestTimeout(function() { 363 window.dispatchEvent(UNCODE.boxEvent); 364 }, 300); 365 }); 366 // COLLAPSE DATA-API 367 // ================= 368 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 369 var $this = $(this), 370 href 371 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 372 var $target = $(target) 373 var data = $target.data('bs.collapse') 374 var option = data ? 'toggle' : $this.data() 375 var parent = $this.attr('data-parent') 376 var $parent = parent && $(parent) 377 var $title = $(this).parent() 378 if ($parent) { 379 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 380 if ($title.hasClass('active')) { 381 $title.removeClass('active'); 382 } else { 383 $parent.find('.panel-title').removeClass('active') 384 $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') 385 } 386 } 387 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 388 }); 389 // FitText 390 // ================= 391 window.uncode_textfill = function(el, loaded) { 392 if (el == undefined) el = $('body'); 393 $.each($('.bigtext', el), function(index, val) { 394 $(val).bigtext({ 395 minfontsize: 24 396 }); 397 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 398 opacity: 1 399 }); 400 requestTimeout(function() { 401 if ($(val).find('.animate_when_almost_visible').length != 0) { 402 $(val).css({opacity: 1}); 403 } 404 }, 400); 405 }); 406 } 407 window.uncode_textfill(); 408 409 // Colomun hover effect 410 // ================= 411 $(document).on('mouseenter', '.col-link', function(e) { 412 var uncol = $(e.target).prev('.uncol'), 413 el = uncol.find('.column-background'); 414 if (el) { 415 $('.btn-container .btn', uncol).toggleClass('active'); 416 var elOverlay = $(el[0]).find('.block-bg-overlay'); 417 if (elOverlay.length) { 418 var getOpacity = $(elOverlay).css('opacity'); 419 if (getOpacity != 1) { 420 getOpacity = Math.round(getOpacity * 100) / 100; 421 var newOpacity = getOpacity + .1; 422 $(elOverlay).data('data-opacity', getOpacity); 423 $(elOverlay).css('opacity', newOpacity); 424 } 425 } 426 } 427 }).on('mouseleave', '.col-link', function(e) { 428 var uncol = $(e.target).prev('.uncol'), 429 el = uncol.find('.column-background'); 430 $('.btn-container .btn', uncol).toggleClass('active'); 431 if (el) { 432 var elOverlay = $(el[0]).find('.block-bg-overlay'); 433 if (elOverlay.length) { 434 var getOpacity = $(elOverlay).data('data-opacity'); 435 $(elOverlay).css('opacity', getOpacity); 436 } 437 } 438 }); 439 440 // REVSLIDER API 441 // ============ 442 $(window).on("load", function() { 443 $('.rev_slider_wrapper, rs-module-wrap').each(function(){ 444 var $this = jQuery(this), 445 id_array = $this.attr("id").split("_"), 446 id = id_array[2]; 447 if (id != undefined && id != '') { 448 $.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);}})'); 449 $.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);}})'); 450 } 451 }); 452 }); 453 454 // LAYERSLIDE API 455 // ============ 456 $(window).on("load", function() { 457 458 $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { 459 460 var slideData = slider.slides.current.data, 461 scrolltop = $(document).scrollTop(); 462 if( slideData && slideData.skin ) { 463 464 UNCODE.switchColorsMenu(scrolltop, slideData.skin); 465 466 } 467 }); 468 469 }); 470 // Admin bar 471 // ============ 472 var fixAdminBar = function() { 473 if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 474 var getAdminBar = $('#wpadminbar'); 475 if (getAdminBar.length) { 476 if (getAdminBar.css('position') !== 'hidden') { 477 var getAdminBarHeight = getAdminBar.height(); 478 if (getAdminBar.css('position') === 'fixed') { 479 $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); 480 $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); 481 } else { 482 $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); 483 $('.body-borders .top-border').css({'margin-top':'0px'}); 484 } 485 } 486 } 487 } 488 }; 489 window.addEventListener('load', fixAdminBar); 490 window.addEventListener('resize', fixAdminBar); 491 // Print 492 // =========== 493 var beforePrint = function() { 494 window.dispatchEvent(new CustomEvent('resize')); 495 window.dispatchEvent(UNCODE.boxEvent); 496 }; 497 498 if (window.matchMedia) { 499 var mediaQueryList = window.matchMedia('print'); 500 mediaQueryList.addListener(function(mql) { 501 if (mql.matches) { 502 beforePrint(); 503 } 504 }); 505 } 506 507 window.onbeforeprint = beforePrint; 508} 509 510UNCODE.lettering = function() { 511 512 var setCTA; 513 var highlightStill = function(){ 514 515 var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); 516 517 $.each($heading_texts, function(key, el) { 518 var $heading = $(el); 519 520 if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { 521 return; 522 } 523 524 if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { 525 return; 526 } 527 528 var waypoint = new Waypoint({ 529 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 530 element: el, 531 handler: function() { 532 var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), 533 anims_l = $anims.length; 534 $anims.each(function(_key_, _el_){ 535 var $anim = $(_el_); 536 537 if ( ! $anim.hasClass('heading-text-highlight-animated') ) { 538 $anim.addClass('heading-text-highlight-animated'); 539 540 if ( $heading.data('animate') === true ) { 541 $anim.css({ 542 '-webkit-transition-duration': '0ms', 543 '-moz-transition-duration': '0ms', 544 '-o-transition-duration': '0ms', 545 'transition-duration': '0ms', 546 }); 547 } else { 548 $anim.css({ 549 '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', 550 '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', 551 '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 552 'transition-delay': ((_key_ + 2) * 200) + 'ms', 553 }); 554 } 555 } 556 557 }); 558 $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { 559 $heading.data('animate', true); 560 }); 561 $anims.removeAttr('data-animated'); 562 }, 563 offset: '100%' 564 }); 565 566 }); 567 568 Waypoint.refreshAll(); 569 $( document.body ).trigger('uncode_waypoints'); 570 571 } 572 573 requestTimeout(function(){ 574 highlightStill(); 575 $(window).on( 'resize', function(){ 576 clearRequestTimeout(setCTA); 577 setCTA = requestTimeout( highlightStill, 100 ); 578 }); 579 }, 400); 580 581}; 582 583UNCODE.isUnmodalOpen = false;
584 585UNCODE.process_shortpixel_image = function(image) { 586 var data = { 587 action: 'shortpixel_manual_optimization', 588 image_id: image, 589 cleanup: true 590 }; 591 592 $.get(SiteParameters.ajax_url, data); 593}; 594 595UNCODE.menuSystem = function() { 596 597 function menuMobile() { 598 var $body = $('body'), 599 $mobileToggleButton = $('.mobile-menu-button'), 600 $box, 601 $el, 602 $el_transp, 603 elHeight, 604 check, 605 animating = false, 606 stickyMobile = false, 607 menuClose = new CustomEvent('menuMobileClose'), 608 menuOpen = new CustomEvent('menuMobileOpen'); 609 UNCODE.menuOpened = false; 610 $mobileToggleButton.on('click', function(event) { 611 var btn = this; 612 if ($(btn).hasClass('overlay-close')) return; 613 event.preventDefault(); 614 if (UNCODE.wwidth <= UNCODE.mediaQuery) { 615 $box = $(this).closest('.box-container').find('.main-menu-container'); 616 $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); 617 $el_transp = $('.menu-absolute.menu-transparent'); 618 if (UNCODE.isMobile) { 619 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 ) { 620 stickyMobile = true; 621 elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; 622 } else { 623 elHeight = 0; 624 $.each($box.find('> div'), function(index, val) { 625 elHeight += $(val).outerHeight(); 626 }); 627 } 628 } else { 629 elHeight = 0; 630 $.each($el, function(index, val) { 631 elHeight += $(val).outerHeight(); 632 }); 633 } 634 var open = function() { 635 if (!animating) { 636 $body.addClass('open-overlay-menu'); 637 window.dispatchEvent(menuOpen); 638 animating = true; 639 UNCODE.menuOpened = true; 640 if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { 641 $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 642 if ($('body.menu-offcanvas').length) { 643 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); 644 $('.vmenu-container.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 645 } else { 646 if ( $('.menu-hide, .menu-sticky').length ) { 647 if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { 648 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); 649 } 650 } 651 } 652 } 653 if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) { 654 $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); 655 } 656 btn.classList.add('close'); 657 $box.addClass('open-items'); 658 if ($el_transp.length && $('body.menu-mobile-transparent').length) { 659 $el_transp.addClass('is_mobile_open'); 660 } 661 $box.animate({ 662 height: elHeight 663 }, 600, "easeInOutCirc", function() { 664 animating = false; 665 if (!stickyMobile) $box.css('height', 'auto'); 666 }); 667 } 668 }; 669 670 var close = function() { 671 if (!animating) { 672 window.dispatchEvent(menuClose); 673 animating = true; 674 UNCODE.menuOpened = false; 675 btn.classList.remove('close'); 676 btn.classList.add('closing'); 677 $box.addClass('close'); 678 requestTimeout(function() { 679 $box.removeClass('close'); 680 $box.removeClass('open-items'); 681 btn.classList.remove('closing'); 682 if ($el_transp.length) { 683 $el_transp.removeClass('is_mobile_open'); 684 } 685 }, 500); 686 $box.animate({ 687 height: 0 688 }, { 689 duration: 600, 690 easing: "easeInOutCirc", 691 complete: function(elements) { 692 $(elements).css('height', ''); 693 animating = false; 694 if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { 695 $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.isotope-filters)').css('position','relative'); 696 } 697 $body.removeClass('open-overlay-menu'); 698 } 699 }); 700 } 701 }; 702 check = (!UNCODE.menuOpened) ? open() : close(); 703 } 704 }); 705 window.addEventListener('menuMobileTrigged', function(e) { 706 $('.mobile-menu-button.close').trigger('click'); 707 }); 708 window.addEventListener('orientationchange', function(e) { 709 $('#logo-container-mobile .mobile-menu-button.close').trigger('click'); 710 }); 711 window.addEventListener("resize", function() { 712 if ($(window).width() < UNCODE.mediaQuery) { 713 if (UNCODE.isMobile) { 714 var $box = $('.box-container .main-menu-container'), 715 $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); 716 if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') { 717 if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { 718 elHeight = 0; 719 $.each($el, function(index, val) { 720 elHeight += $(val).outerHeight(); 721 }); 722 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; 723 $($box).css('height', elHeight + 'px'); 724 } 725 } 726 } 727 } else { 728 $('.menu-hide-vertical').removeAttr('style'); 729 $('.menu-container-mobile').removeAttr('style'); 730 $('.vmenu-container.menu-container').removeAttr('style'); 731 } 732 }); 733 }; 734 735 function menuOffCanvas() { 736 var menuClose = new CustomEvent('menuCanvasClose'), 737 menuOpen = new CustomEvent('menuCanvasOpen'); 738 $('.menu-primary .menu-button-offcanvas').click(function(event) { 739 if ($(window).width() > UNCODE.mediaQuery) { 740 if ($(event.currentTarget).hasClass('close')) { 741 $(event.currentTarget).removeClass('close'); 742 $(event.currentTarget).addClass('closing'); 743 requestTimeout(function() { 744 $(event.currentTarget).removeClass('closing'); 745 window.dispatchEvent(menuClose); 746 }, 500); 747 748 } else { 749 $(event.currentTarget).addClass('close'); 750 window.dispatchEvent(menuOpen); 751 } 752 } 753 754 $('body').toggleClass('off-opened'); 755 }); 756 }; 757 function menuSmart() { 758 var $menusmart = $('[class*="menu-smart"]'), 759 $masthead = $('#masthead'), 760 $hMenu = $('.menu-horizontal-inner', $masthead),
761 $focus = $('.overlay-menu-focus'), 762 showTimeout = 50, 763 hideTimeout = 50, 764 showTimeoutFunc, hideTimeoutFunc; 765 766 $('> li.menu-item-has-children', $menusmart).hover(function(){ 767 $(this).data('hover', true); 768 }, function(){ 769 $(this).data('hover', false); 770 }); 771 772 if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { 773 var $notLis = $('> .nav > ul > li a', $hMenu), 774 $menuA = $('a', $masthead).not($notLis), 775 $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), 776 showFuncCond = function() { return true }; 777 778 if ( $('body').hasClass('focus-megamenu') ) { 779 $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); 780 showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; 781 } else if ( $('body').hasClass('focus-links') ) { 782 $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); 783 } 784 785 $hoverSelector.hover(function(){ 786 clearRequestTimeout(hideTimeoutFunc); 787 showTimeoutFunc = requestTimeout(function(){ 788 $('body').addClass('navbar-hover'); 789 }, showTimeout*2); 790 }, function(){ 791 hideTimeoutFunc = requestTimeout(function(){ 792 $('body').removeClass('navbar-hover'); 793 }, hideTimeout*2); 794 }); 795 } 796 797 if ($menusmart.length > 0) { 798 $menusmart.smartmenus({ 799 subIndicators: false, 800 subIndicatorsPos: 'append', 801 subMenusMinWidth: '13em', 802 subIndicatorsText: '', 803 showTimeout: showTimeout, 804 hideTimeout: hideTimeout, 805 showFunction: function($ul, complete) { 806 clearRequestTimeout(showTimeoutFunc); 807 $ul.fadeIn(0, 'linear', function(){ 808 complete(); 809 if ( $ul.hasClass('vc_row') ) { 810 $ul.css({ 811 'display': 'table' 812 }); 813 } 814 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 815 $('body').addClass('open-megamenu'); 816 } 817 if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery ) { 818 $('body').addClass('navbar-hover'); 819 } 820 }).addClass('open-animated'); 821 }, 822 hideFunction: function($ul, complete) { 823 if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { 824 $('body').removeClass('open-megamenu'); 825 } 826 var fixIE = $('html.ie').length; 827 if (fixIE) { 828 var $rowParent = $($ul).closest('.main-menu-container'); 829 $rowParent.height('auto'); 830 } 831 $ul.fadeOut(0, 'linear', function(){ 832 complete(); 833 $ul.removeClass('open-animated'); 834 if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { 835 $('body').removeClass('open-submenu'); 836 } 837 }); 838 }, 839 collapsibleShowFunction: function($ul, complete) { 840 $ul.slideDown(400, 'easeInOutCirc', complete); 841 }, 842 collapsibleHideFunction: function($ul, complete) { 843 $ul.slideUp(200, 'easeInOutCirc', complete); 844 }, 845 hideOnClick: true 846 }); 847 848 if ( $('body').hasClass('menu-accordion-active') ) { 849 requestTimeout(function(){ 850 $menusmart.addClass('menu-smart-init'); 851 $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); 852 }, 1000); 853 } 854 } 855 856 }; 857 function menuOverlay() { 858 if ( $('.overlay').length ) { 859 $('.overlay').removeClass('hidden'); 860 } 861 if ($('.overlay-sequential, .menu-mobile-animated').length > 0) { 862 $('.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) { 863 var transDelay = (index / 20) + 0.1; 864 if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) 865 transDelay = transDelay + 0.3; 866 $(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'); 867 }); 868 } 869 }; 870 function menuAppend() { 871 var $body = $('body'), 872 $menuCont = $('.menu-container'), 873 $cta = $('.navbar-cta'), 874 $socials = $('.navbar-social'), 875 $ul = $('.navbar-main ul.menu-primary-inner'), 876 $ulCta, 877 $ulSocials, 878 $firstMenu = $('.main-menu-container:first-child', $menuCont), 879 $secondMenu = $('.main-menu-container:last-child', $menuCont), 880 $firstNav = $('.navbar-nav:first-child', $firstMenu), 881 $secondNav = $('.navbar-nav:first-child', $secondMenu), 882 $ulFirst = $('> ul', $firstNav), 883 $ulSecond = $('> ul', $secondNav), 884 setCTA, 885 appendCTA = function(){ 886 return true; 887 }, 888 appendSocials = function(){ 889 return true; 890 }, 891 appendSplit = function(){ 892 return true; 893 }; 894 895 if ( $body.hasClass('cta-not-appended') ) 896 return false;
897 898 if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { 899 $ulCta = $('> ul', $cta); 900 901 appendCTA = function(){ 902 if (UNCODE.wwidth < UNCODE.mediaQuery) { 903 $ul.after($ulCta); 904 } else { 905 $cta.append($ulCta); 906 } 907 } 908 } 909 appendCTA(); 910 911 if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') ) && $socials.length ) { 912 $ulSocials = $('> ul', $socials); 913 914 appendSocials = function(){ 915 if (UNCODE.wwidth < UNCODE.mediaQuery) { 916 $ul.after($ulSocials); 917 } else { 918 $socials.append($ulSocials); 919 } 920 } 921 } 922 appendSocials(); 923 924 if ( ( $body.hasClass('hmenu-center-double') ) ) { 925 appendSplit = function(){ 926 if (UNCODE.wwidth < UNCODE.mediaQuery) { 927 if ( $secondNav.length ) { 928 $secondNav.prepend($ulFirst); 929 } 930 $firstMenu.hide(); 931 } else { 932 $firstNav.append($ulFirst); 933 $firstMenu.css({ 934 'display': 'table-cell' 935 }); 936 } 937 } 938 } 939 appendSplit(); 940 941 $(window).on( 'resize', function(){ 942 clearRequestTimeout(setCTA); 943 setCTA = requestTimeout( function() { 944 appendCTA(); 945 appendSocials(); 946 appendSplit(); 947 }, 10 ); 948 }); 949 } 950 //menuMobileButton(); 951 menuMobile(); 952 menuOffCanvas(); 953 menuSmart(); 954 menuAppend(); 955 menuOverlay(); 956 var setMenuOverlay; 957 $(window).on( 'resize', function(){ 958 if ( $('.overlay').length && $(window).width() > 1024 ) { 959 $('.overlay').addClass('hidden'); 960 } 961 clearRequestTimeout(setMenuOverlay); 962 setMenuOverlay = requestTimeout( menuOverlay, 150 ); 963 }); 964}; 965 966UNCODE.okvideo = function() { 967 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 968 $.okvideo = function(options) { 969 // if the option var was just a string, turn it into an object 970 if (typeof options !== 'object') options = { 971 'video': options 972 }; 973 var base = this; 974 // kick things off 975 base.init = function() { 976 base.options = $.extend({}, $.okvideo.options, options); 977 // support older versions of okvideo 978 if (base.options.video === null) base.options.video = base.options.source; 979 base.setOptions(); 980 var target = base.options.target || $('body'); 981 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 982 var zIndex = base.options.controls === 3 ? -999 : "auto"; 983 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 984 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>'; 985 if (OKEvents.utils.isMobile()) { 986 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>'); 987 } else { 988 if (base.options.controls === 3) { 989 target.append(mask) 990 } 991 if (base.options.adproof === 1) { 992 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>'); 993 } else { 994 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>'); 995 } 996 } 997 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 998 if (base.options.playlist.list === null) { 999 if (base.options.video.provider === 'youtube') { 1000 base.loadYouTubeAPI(); 1001 } else if (base.options.video.provider === 'vimeo') { 1002 base.options.volume /= 100; 1003 base.loadVimeoAPI(); 1004 } 1005 } else { 1006 base.loadYouTubeAPI(); 1007 } 1008 } 1009 }; 1010 // clean the options 1011 base.setOptions = function() { 1012 // exchange 'true' for '1' and 'false' for 3 1013 for (var key in this.options) { 1014 if (this.options[key] === true) this.options[key] = 1; 1015 if (this.options[key] === false) this.options[key] = 3; 1016 } 1017 if (base.options.playlist.list === null) { 1018 base.options.video = base.determineProvider(); 1019 } 1020 // pass options to the window 1021 $(window).data('okoptions-' + base.options.id, base.options); 1022 };
1023 // insert js into the head and exectue a callback function 1024 base.insertJS = function(src, callback){ 1025 var tag; 1026 if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { 1027 tag = UNCODE.insertedSripts[src]; 1028 if (callback){ 1029 if (tag.readyState){ //IE 1030 tag.onreadystatechange = function(){ 1031 if (tag.readyState === "loaded" || 1032 tag.readyState === "complete"){ 1033 tag.onreadystatechange = null; 1034 callback(); 1035 } 1036 }; 1037 } else { 1038 $(tag).load(callback); 1039 } 1040 } 1041 return; 1042 } 1043 tag = document.createElement('script'); 1044 if (callback){ 1045 if (tag.readyState){ //IE 1046 tag.onreadystatechange = function(){ 1047 if (tag.readyState === "loaded" || tag.readyState === "complete"){ 1048 tag.onreadystatechange = null; 1049 callback(); 1050 } 1051 }; 1052 } else { 1053 tag.onload = function() { 1054 callback(); 1055 }; 1056 } 1057 } 1058 tag.src = src; 1059 var firstScriptTag = document.getElementsByTagName('script')[0]; 1060 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 1061 if ( ! UNCODE.insertedSripts ) { 1062 UNCODE.insertedSripts = []; 1063 } 1064 UNCODE.insertedSripts[src] = tag; 1065 }; 1066 // load the youtube api 1067 base.loadYouTubeAPI = function(callback) { 1068 base.insertJS('https://www.youtube.com/player_api'); 1069 }; 1070 base.loadYouTubePlaylist = function() { 1071 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 1072 }; 1073 // load the vimeo api by replacing the div with an iframe and loading js 1074 base.loadVimeoAPI = function() { 1075 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, 1076 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />'); 1077 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 1078 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 1079 base.insertJS('//f.vimeocdn.com/js/froogaloop2.min.js', function() { 1080 vimeoPlayerReady(base.options.id); 1081 }); 1082 }; 1083 // is it from youtube or vimeo? 1084 base.determineProvider = function() { 1085 var a = document.createElement('a'); 1086 a.href = base.options.video; 1087 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 1088 var videoid = a.href.split('/')[3].toString(); 1089 var query = videoid.substring(videoid.indexOf('?') + 1); 1090 if (query != '') { 1091 var vars = query.split('&'); 1092 for (var i = 0; i < vars.length; i++) { 1093 var pair = vars[i].split('='); 1094 if (pair[0] == 'v') { 1095 videoid = pair[1]; 1096 } 1097 } 1098 } 1099 return { 1100 "provider": "youtube", 1101 "id": videoid 1102 }; 1103 } else if (/vimeo.com/.test(base.options.video)) { 1104 return { 1105 "provider": "vimeo", 1106 "id": (a.href.split('/')[3].toString()).split('#')[0], 1107 }; 1108 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 1109 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 1110 if (id.length == 11) { 1111 return { 1112 "provider": "youtube", 1113 "id": id.toString() 1114 }; 1115 } else { 1116 for (var i = 0; i < base.options.video.length; i++) { 1117 if (typeof parseInt(base.options.video[i]) !== "number") { 1118 throw 'not vimeo but thought it was for a sec'; 1119 } 1120 } 1121 return { 1122 "provider": "vimeo", 1123 "id": base.options.video 1124 }; 1125 } 1126 } else { 1127 throw "OKVideo: Invalid video source"; 1128 } 1129 }; 1130 base.init(); 1131 }; 1132 $.okvideo.options = { 1133 id: null, 1134 source: null, // Deprecate dis l8r 1135 video: null, 1136 playlist: { // eat ur heart out @brokyo 1137 list: null, 1138 index: 0, 1139 startSeconds: 0, 1140 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 1141 }, 1142 disableKeyControl: 1, 1143 captions: 0, 1144 loop: 1, 1145 hd: 1, 1146 volume: 0, 1147 adproof: false, 1148 unstarted: null, 1149 onFinished: null, 1150 onReady: null, 1151 onPlay: null, 1152 onPause: null, 1153 buffering: null, 1154 controls: false, 1155 autoplay: true, 1156 annotations: true, 1157 cued: null 1158 }; 1159 $.fn.okvideo = function(options) { 1160 options.target = this; 1161 return this.each(function() { 1162 (new $.okvideo(options)); 1163 }); 1164 }; 1165 1166 $(".no-touch .uncode-video-container.video").each(function(index, el) { 1167 var $this = $(this), 1168 url = $this.attr('data-video'), 1169 id = $this.attr('data-id'), 1170 cloned = $this.closest('.owl-item'); 1171 if (!cloned.hasClass('cloned') || cloned.length == 0) { 1172 $this.okvideo({ 1173 id: id, 1174 source: url.split('#')[0], 1175 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 1176 autoplay: 1, 1177 controls: 0, 1178 volume: 0, 1179 adproof: 0, 1180 caller: $this, 1181 hd: 1, 1182 onReady: function(player) { 1183 var getPlayer = player.c || player, 1184 getContainer = $(getPlayer).closest('.background-element'); 1185 if (getContainer.length) { 1186 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video'); 1187 } 1188 } 1189 }); 1190 } 1191 }); 1192 $(".background-video-shortcode").each(function(index, el) { 1193 if ( SiteParameters.block_mobile_videos === true ) { 1194 return false;
1195 } 1196 if ( $(this).closest('mediaelementwrapper').length ) { 1197 return true; 1198 } 1199 var $video_el = $(this), 1200 $parent_carousel = $video_el.parents('.uncode-slider').eq(0), 1201 video_id = $video_el.attr('id'); 1202 1203 if ( SiteParameters.is_frontend_editor ) { 1204 video_id = video_id + '_' + index; 1205 $video_el.attr('id', video_id); 1206 } 1207 1208 if (typeof MediaElement === "function") { 1209 var media = new MediaElement(video_id, { 1210 startVolume: 0, 1211 loop: true, 1212 success: function(mediaElement, domObject) { 1213 domObject.volume = 0; 1214 $(mediaElement).data('started', false); 1215 mediaElement.addEventListener('timeupdate', function(e) { 1216 if (!$(e.target).data('started')) { 1217 $(mediaElement).data('started', true); 1218 } 1219 }); 1220 mediaElement.addEventListener('loadedmetadata', function(e) { 1221 mediaElement.play(); 1222 }); 1223 if (!UNCODE.isMobile) { 1224 requestTimeout(function() { 1225 UNCODE.initVideoComponent(document.body, '.uncode-video-container.video, .uncode-video-container.self-video'); 1226 }, 100); 1227 } 1228 if ( ($('html.firefox').length) && !$parent_carousel.length ) { 1229 mediaElement.play(); 1230 } 1231 1232 mediaElement.addEventListener('play', function() { 1233 $(mediaElement).closest('.uncode-video-container').css('opacity', '1'); 1234 $(mediaElement).closest('#page-header').addClass('video-started'); 1235 $(mediaElement).closest('.background-wrapper').find('.block-bg-blend-mode.not-ie').css('opacity', '1'); 1236 }, true); 1237 1238 }, 1239 // fires when a problem is detected 1240 error: function() {} 1241 }); 1242 1243 } 1244 }); 1245 1246 var manageVideoSize = function(){ 1247 1248 var setVideoFit; 1249 $('.wp-block-embed').each(function(){ 1250 1251 var $this = $(this); 1252 1253 if ( $('iframe', $this).length ) { 1254 1255 var $iframe = $('> iframe, > a > iframe', $this), 1256 w = parseFloat($iframe.attr('width')), 1257 h = parseFloat($iframe.attr('height')), 1258 url = $iframe.attr('src'), 1259 ratio, frW; 1260 1261 if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { 1262 1263 ratio = h / w; 1264 var resizeiFrame = function(){ 1265 frW = $iframe.width(); 1266 $iframe.css({ 1267 height: frW * ratio 1268 }); 1269 }; 1270 resizeiFrame(); 1271 $(window).on('resize load', resizeiFrame); 1272 1273 } 1274 1275 } 1276 1277 }); 1278 1279 }; 1280 1281 manageVideoSize(); 1282}; 1283 1284UNCODE.disableHoverScroll = function() { 1285 1286 if (!UNCODE.isMobile && !UNCODE.isFullPage) { 1287 var body = document.body, 1288 timer; 1289 1290 window.addEventListener('scroll', function() { 1291 var delay = ( body.classList.contains('bg-changer-init') ) ? SiteParameters.bg_changer_time : 300; 1292 clearRequestTimeout(timer); 1293 if (body.classList) { 1294 if (!body.classList.contains('disable-hover')) { 1295 body.classList.add('disable-hover'); 1296 window.dispatchEvent(new CustomEvent('disable-hover')); 1297 } 1298 1299 timer = requestTimeout(function() { 1300 body.classList.remove('disable-hover'); 1301 window.dispatchEvent(new CustomEvent('enable-hover')); 1302 }, delay); 1303 } 1304 }, false); 1305 } 1306}; 1307 1308UNCODE.isotopeLayout = function() { 1309 if ($('.isotope-layout').length > 0) { 1310 var isotopeContainersArray = [], 1311 typeGridArray = [], 1312 layoutGridArray = [], 1313 screenLgArray = [], 1314 screenMdArray = [], 1315 screenSmArray = [], 1316 transitionDuration = [], 1317 $filterItems = [], 1318 $filters = $('.isotope-system .isotope-filters'), 1319 $itemSelector = '.tmb-iso', 1320 $items, 1321 itemMargin, 1322 correctionFactor = 0, 1323 firstLoad = true, 1324 isOriginLeft = $('body').hasClass('rtl') ? false : true; 1325 $('[class*="isotope-container"]').each(function(index) { 1326 var _this = $(this); 1327 var isoData = _this.data(), 1328 $data_lg, 1329 $data_md, 1330 $data_sm; 1331 _this.children('.tmb').addClass('tmb-iso'); 1332 if (isoData.lg !== undefined) $data_lg = _this.attr('data-lg'); 1333 else $data_lg = '1000'; 1334 if (isoData.md !== undefined) $data_md = _this.attr('data-md'); 1335 else $data_md = '600'; 1336 if (isoData.sm !== undefined) $data_sm = _this.attr('data-sm'); 1337 else $data_sm = '480'; 1338 screenLgArray.push($data_lg); 1339 screenMdArray.push($data_md); 1340 screenSmArray.push($data_sm); 1341 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 1342 if (isoData.type == 'metro') typeGridArray.push(true);
1343 else typeGridArray.push(false); 1344 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 1345 else layoutGridArray.push('masonry'); 1346 isotopeContainersArray.push(_this); 1347 _this.attr('data-iso-index', index); 1348 }); 1349 var colWidth = function(index) { 1350 $(isotopeContainersArray[index]).width(''); 1351 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 1352 widthAvailable = $(isotopeContainersArray[index]).width(), 1353 columnNum = 12, 1354 columnWidth = 0, 1355 data_vp_height = $(isotopeContainersArray[index]).attr('data-vp-height'), 1356 consider_menu = $(isotopeContainersArray[index]).attr('data-vp-menu'), 1357 winHeight = UNCODE.wheight - UNCODE.adminBarHeight, 1358 $rowContainer, 1359 paddingRow, 1360 $colContainer, 1361 paddingCol; 1362 1363 if ( consider_menu ) 1364 winHeight = winHeight - UNCODE.menuHeight; 1365 1366 if ( data_vp_height === '1' ) { 1367 $rowContainer = $(isotopeContainersArray[index]).parents('.row-parent').eq(0), 1368 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 1369 $colContainer = $(isotopeContainersArray[index]).parents('.uncell').eq(0), 1370 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')); 1371 winHeight = winHeight - ( paddingRow + paddingCol ); 1372 } 1373 1374 if (isPx) { 1375 columnWidth = Math.ceil(widthAvailable / columnNum); 1376 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 1377 } else { 1378 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 1379 } 1380 $items = $(isotopeContainersArray[index]).find('.tmb-iso:not(.tmb-carousel)'); 1381 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 1382 for (var i = 0, len = $items.length; i < len; i++) { 1383 var $item = $($items[i]), 1384 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 1385 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,3})/), 1386 multiplier_fixed = multiplier_h !== null ? multiplier_h[1] : 1; 1387 1388 1389 if (multiplier_w != null && multiplier_w[1] !== undefined && multiplier_w[1] == 15) { 1390 multiplier_w[1] = 2.4; // 20/(100/12) - 5 columns 1391 } 1392 1393 if (multiplier_h != null && multiplier_h[1] !== undefined && multiplier_h[1] == 15) { 1394 multiplier_h[1] = 2.4; // 20/(100/12) - 5 columns 1395 } 1396 1397 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 1398 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1399 switch (parseInt(multiplier_w[1])) { 1400 case (5): 1401 case (4): 1402 case (3): 1403 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1404 multiplier_w[1] = 6; 1405 break; 1406 case (2): 1407 case (1): 1408 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 1409 multiplier_w[1] = 3; 1410 break; 1411 default: 1412 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1413 multiplier_w[1] = 12; 1414 break; 1415 } 1416 1417 if (multiplier_w[1] == 2.4) { // 5 columns 1418 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1419 multiplier_w[1] = 6; 1420 } 1421 } 1422 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 1423 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1424 switch (parseInt(multiplier_w[1])) { 1425 case (5): 1426 case (4): 1427 case (3): 1428 case (2): 1429 case (1): 1430 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1431 multiplier_w[1] = 6; 1432 break; 1433 default: 1434 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1435 multiplier_w[1] = 12; 1436 break; 1437 } 1438 1439 if (multiplier_w[1] == 2.4) { // 5 columns 1440 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 1441 multiplier_w[1] = 6; 1442 } 1443 } 1444 } else if (widthAvailable < screenSmArray[index]) { 1445 if (multiplier_w != null && multiplier_w[1] !== undefined) { 1446 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 1447 multiplier_w[1] = 12; 1448 if (typeGridArray[index]) multiplier_h[1] = 12; 1449 } 1450 } 1451 var width = multiplier_w ? Math.floor(columnWidth * multiplier_w[1]) : columnWidth, 1452 height; 1453 1454 if ( data_vp_height === '1' && typeof multiplier_h[1] !== 'undefined' ) { 1455 height = multiplier_h ? Math['ceil'](winHeight / (100 / multiplier_fixed) ) - itemMargin : columnWidth; 1456 if ( widthAvailable < screenSmArray[index] ) { 1457 height = Math['ceil']((2 * Math.ceil(columnWidth / 2)) * 12) - itemMargin; 1458 } 1459 } else { 1460 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 1461 } 1462 1463 if (width >= widthAvailable) { 1464 $item.css({ 1465 width: widthAvailable 1466 }); 1467 if (typeGridArray[index]) { 1468 $item.children().add($item.find('.backimg')).css({ 1469 height: height 1470 }); 1471 } 1472 } else { 1473 $item.css({ 1474 width: width 1475 }); 1476 if (typeGridArray[index]) { 1477 $item.children().add($item.find('.backimg')).css({ 1478 height: height 1479 }); 1480 } 1481 } 1482 } 1483 return columnWidth / 60; // least common multiple for 12 (regular columns) and 10 (5 columns) 1484 }, 1485 init_isotope = function() { 1486 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 1487 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 1488 isotopeId = isotopeSystem.attr('id'), 1489 $layoutMode = layoutGridArray[i], 1490 setIsotopeFirstRowTimeOut, 1491 setIsotopeFirstRow = function(items){ 1492 var firstRow = true; 1493 $(items).each(function(index, val){ 1494 var el = items[index].element, 1495 el_top = items[index].position.y, 1496 $el = $(el); 1497 if ( index > 0 && el_top > 0 && firstRow ) { 1498 firstRow = false;
1499 } else if ( index == 0 && el_top == 0 ) { 1500 firstRow = true; 1501 } 1502 if ( firstRow ) { 1503 $el.removeClass('tmb-isotope-further-row'); 1504 } else { 1505 $el.addClass('tmb-isotope-further-row'); 1506 } 1507 }); 1508 }; 1509 $(isotopeContainersArray[i]).not('.un-isotope-init').addClass('un-isotope-init').isotope({ 1510 //resizable: true, 1511 itemSelector: $itemSelector, 1512 layoutMode: $layoutMode, 1513 transitionDuration: transitionDuration[i], 1514 masonry: { 1515 columnWidth: colWidth(i) 1516 }, 1517 vertical: { 1518 horizontalAlignment: 0.5, 1519 }, 1520 sortBy: 'original-order', 1521 isOriginLeft: isOriginLeft 1522 }) 1523 .on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)) 1524 .on('layoutComplete', function( event, items ){ 1525 if ( typeof items[0] !== 'undefined' ) { 1526 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1527 setIsotopeFirstRow(items); 1528 } 1529 } 1530 }) 1531 .on('arrangeComplete', function( event, items ){ 1532 if ( typeof items[0] !== 'undefined' ) { 1533 if ( $(items[0].element).closest('.off-grid-layout:not(.off-grid-forced)').length ) { 1534 clearRequestTimeout(setIsotopeFirstRowTimeOut); 1535 setIsotopeFirstRowTimeOut = requestTimeout(function(){ 1536 setIsotopeFirstRow(items); 1537 }, 100); 1538 } 1539 } 1540 }); 1541 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite')) { 1542 $(isotopeContainersArray[i]).infinitescroll({ 1543 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 1544 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 1545 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items you'll retrieve 1546 animate: false, 1547 behavior: 'local', 1548 debug: false, 1549 loading: { 1550 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 1551 speed: 0, 1552 finished: undefined, 1553 msg: $('#' + isotopeId + ' .loadmore-button'), 1554 }, 1555 errorCallback: function() { 1556 var isotope_system = $(this).closest('.isotope-system'); 1557 $('.loading-button', isotope_system).hide(); 1558 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 1559 } 1560 }, 1561 // append the new items to isotope on the infinitescroll callback function. 1562 function(newElements, opts) { 1563 var $isotope = $(this), 1564 isotopeId = $isotope.closest('.isotope-system').attr('id'), 1565 filters = new Array(), 1566 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 1567 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 1568 $numPages = $('a', $infinite_button).data('pages'), 1569 delay = 300; 1570 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 1571 $infinite_button.show(); 1572 $loading_button.hide(); 1573 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 1574 $('> li', $isotope).remove(); 1575 $.each($(newElements), function(index, val) { 1576 $(val).addClass('tmb-iso'); 1577 if ($(val).is("li")) { 1578 filters.push($(val)[0]); 1579 } 1580 }); 1581 newElements = newElements.filter(function(x) { 1582 return filters.indexOf(x) < 0 1583 }); 1584 $.each($(filters), function(index, val) { 1585 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 1586 }); 1587 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 1588 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeId]; 1589 if (typeof getLightbox === 'object') getLightbox.refresh(); 1590 if ( typeof twttr !== 'undefined' ) 1591 twttr.widgets.load(isotopeContainersArray[i]); 1592 1593 }); 1594 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 1595 var $infinite_isotope = $(isotopeContainersArray[i]), 1596 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 1597 $infinite_isotope.infinitescroll('pause'); 1598 $infinite_button.on('click', function(event) { 1599 event.preventDefault(); 1600 var $infinite_system = $(event.target).closest('.isotope-system'), 1601 $infinite_isotope = $infinite_system.find('.isotope-container'), 1602 isotopeId = $infinite_system.attr('id'); 1603 $(event.currentTarget).html(SiteParameters.loading); 1604 $infinite_isotope.infinitescroll('resume'); 1605 $infinite_isotope.infinitescroll('retrieve'); 1606 $infinite_isotope.infinitescroll('pause'); 1607 }); 1608 } 1609 } 1610 } 1611 }, 1612 onLayout = function(isotopeObj, startIndex, needsReload) { 1613 var needsReload = needsReload ? true : false;
1614 1615 window.uncode_textfill(); 1616 isotopeObj.css('opacity', 1); 1617 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 1618 1619 requestTimeout(function() { 1620 if (startIndex > 0) { 1621 reloadIsotope(isotopeObj); 1622 if (SiteParameters.dynamic_srcset_active === '1') { 1623 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1624 UNCODE.adaptive_srcset(isotopeObj); 1625 } 1626 // window.dispatchEvent(UNCODE.boxEvent); 1627 } else if (needsReload) { 1628 reloadIsotope(isotopeObj); 1629 } 1630 1631 UNCODE.adaptive(); 1632 if (SiteParameters.dynamic_srcset_active === '1' && startIndex === 0) { 1633 UNCODE.refresh_dynamic_srcset_size(isotopeObj); 1634 } 1635 $(isotopeObj).find('audio,video').each(function() { 1636 $(this).mediaelementplayer({ 1637 pauseOtherPlayers: false, 1638 }); 1639 }); 1640 if ($(isotopeObj).find('.nested-carousel').length) { 1641 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 1642 requestTimeout(function() { 1643 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1644 }, 200); 1645 } else { 1646 boxAnimation($('.tmb-iso', isotopeObj), startIndex, true, isotopeObj); 1647 } 1648 isotopeObj.trigger('isotope-layout-complete'); 1649 1650 }, 100); 1651 1652 }, 1653 boxAnimation = function(items, startIndex, sequential, container) { 1654 var $allItems = items.length - startIndex, 1655 showed = 0, 1656 index = 0; 1657 if (container.closest('.owl-item').length == 1) return false; 1658 $.each(items, function(index, val) { 1659 var $this = $(val), 1660 elInner = $('> .t-inside', val); 1661 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 1662 return; 1663 } 1664 if (val[0]) val = val[0]; 1665 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 1666 new Waypoint({ 1667 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 1668 element: val, 1669 handler: function() { 1670 var element = $('> .t-inside', this.element), 1671 parent = $(this.element), 1672 currentIndex = parent.index(); 1673 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 1674 delayAttr = parseInt(element.attr('data-delay')); 1675 if (isNaN(delayAttr)) delayAttr = 100; 1676 delay -= showed; 1677 var objTimeout = requestTimeout(function() { 1678 element.removeClass('zoom-reverse').addClass('start_animation'); 1679 showed = parent.index(); 1680 container.isotope('layout'); 1681 }, delay * delayAttr) 1682 parent.data('objTimeout', objTimeout); 1683 if (!UNCODE.isUnmodalOpen) { 1684 this.destroy(); 1685 } 1686 }, 1687 offset: '100%' 1688 }) 1689 } else { 1690 if (elInner.hasClass('force-anim')) { 1691 elInner.addClass('start_animation'); 1692 } else { 1693 elInner.css('opacity', 1); 1694 } 1695 container.isotope('layout'); 1696 } 1697 1698 index++; 1699 }); 1700 }, 1701 reloadIsotope = function(isotopeObj) { 1702 var isoIndex = $(isotopeObj).attr('data-iso-index'); 1703 var $layoutMode = ($(isotopeObj).data('layout')); 1704 if ($layoutMode === undefined) { 1705 $layoutMode = 'masonry'; 1706 } 1707 if (isotopeObj.data('isotope')) { 1708 isotopeObj.isotope({ 1709 itemSelector: $itemSelector, 1710 layoutMode: $layoutMode, 1711 transitionDuration: transitionDuration[isoIndex], 1712 masonry: { 1713 columnWidth: colWidth(isoIndex) 1714 }, 1715 vertical: { 1716 horizontalAlignment: 0.5, 1717 }, 1718 sortBy: 'original-order', 1719 isOriginLeft: isOriginLeft 1720 }); 1721 } 1722 } 1723 ; 1724 if ($('.isotope-pagination').length > 0) { 1725 $('.isotope-system').on('click', '.pagination a', function(evt) { 1726 evt.preventDefault(); 1727 1728 var filterContainer = $(this).closest('.isotope-system').find('.isotope-filters'), 1729 container = $(this).closest('.isotope-system'), 1730 calc_scroll = container.closest('.uncol').offset().top, 1731 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 1732 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 1733 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 1734 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 1735 1736 calc_scroll -= filterOffset - 1; 1737 calc_scroll -= UNCODE.get_scroll_offset(); 1738 1739 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 1740 delta = bodyTop - calc_scroll, 1741 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 1742 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 1743 1744 if ( !UNCODE.isFullPage ) { 1745 if (scrollSpeed == 0) { 1746 $('html, body').scrollTop(calc_scroll); 1747 } else { 1748 $('html, body').animate({ 1749 scrollTop: calc_scroll 1750 },{ 1751 easing: 'easeInOutQuad', 1752 duration: scrollSpeed, 1753 complete: function(){ 1754 UNCODE.scrolling = false;
1755 } 1756 }); 1757 } 1758 } 1759 1760 loadIsotope($(this)); 1761 evt.preventDefault(); 1762 }); 1763 } 1764 $filters.on('click', 'a.isotope-nav-link', function(evt) { 1765 if ($(this).hasClass('no-isotope-filter')) { 1766 return; 1767 } 1768 var $filter = $(this), 1769 filterContainer = $filter.closest('.isotope-filters'), 1770 filterValue = $filter.attr('data-filter'), 1771 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 1772 transitionDuration = container.data().isotope.options.transitionDuration, 1773 delay = 300, 1774 filterItems = []; 1775 if (!$filter.hasClass('active')) { 1776 /** Scroll top with filtering */ 1777 if (filterContainer.hasClass('filter-scroll')) { 1778 var calc_scroll = container.closest('.uncol').offset().top, 1779 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 1780 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 1781 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 1782 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 1783 1784 calc_scroll -= filterOffset - 1; 1785 calc_scroll -= UNCODE.get_scroll_offset(); 1786 1787 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 1788 delta = bodyTop - calc_scroll, 1789 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 1790 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 1791 1792 if ( !UNCODE.isFullPage ) { 1793 if (scrollSpeed == 0) { 1794 $('html, body').scrollTop(calc_scroll); 1795 UNCODE.scrolling = false; 1796 } else { 1797 $('html, body').animate({ 1798 scrollTop: calc_scroll 1799 },{ 1800 easing: 'easeInOutQuad', 1801 duration: scrollSpeed, 1802 complete: function(){ 1803 UNCODE.scrolling = false; 1804 } 1805 }); 1806 } 1807 } 1808 } 1809 if (filterValue !== undefined) { 1810 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 1811 var parent = $(val).parent(), 1812 objTimeout = parent.data('objTimeout'); 1813 if (objTimeout) { 1814 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1815 clearRequestTimeout(objTimeout); 1816 } 1817 if (transitionDuration == 0) { 1818 if ($(val).hasClass('animate_when_almost_visible')) { 1819 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1820 } else { 1821 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 1822 } 1823 } 1824 }); 1825 requestTimeout(function(){ 1826 if ( filterValue == '*' ) { 1827 container.removeClass('isotope-filtered'); 1828 } else { 1829 container.addClass('isotope-filtered'); 1830 } 1831 container.isotope({ 1832 filter: function() { 1833 var block = $(this), 1834 filterable = (filterValue == '*') || block.hasClass(filterValue), 1835 lightboxElements = $('[data-lbox^=ilightbox]', block); 1836 if (filterable) { 1837 if (lightboxElements.length) { 1838 lightboxElements.removeClass('lb-disabled'); 1839 container.data('lbox', $(lightboxElements[0]).data('lbox')); 1840 } 1841 filterItems.push(block); 1842 } else { 1843 if (lightboxElements.length) lightboxElements.addClass('lb-disabled'); 1844 } 1845 return filterable; 1846 } 1847 }); 1848 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 1849 }, delay); 1850 1851 /** once filtered - start **/ 1852 container.isotope('once', 'arrangeComplete', function() { 1853 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 1854 if (typeof getLightbox === 'object') getLightbox.refresh(); 1855 if (transitionDuration == 0) { 1856 requestTimeout(function() { 1857 boxAnimation(filterItems, 0, false, container); 1858 }, 100); 1859 } 1860 requestTimeout(function() { 1861 Waypoint.refreshAll(); 1862 }, 2000); 1863 }); 1864 /** once filtered - end **/ 1865 } else { 1866 $.each($('> .tmb-iso > .t-inside', container), function(index, val) { 1867 var parent = $(val).parent(), 1868 objTimeout = parent.data('objTimeout'); 1869 if (objTimeout) { 1870 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1871 clearRequestTimeout(objTimeout); 1872 } 1873 if (transitionDuration == 0) { 1874 if ($(val).hasClass('animate_when_almost_visible')) { 1875 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1876 } else { 1877 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 1878 } 1879 } 1880 }); 1881 container.parent().addClass('isotope-loading'); 1882 loadIsotope($filter); 1883 } 1884 } 1885 evt.preventDefault(); 1886 }); 1887 $(window).on("popstate", function(e) { 1888 if (e.originalEvent.state === null) return; 1889 var params = {}; 1890 if (location.search) { 1891 var parts = location.search.substring(1).split('&'); 1892 for (var i = 0; i < parts.length; i++) { 1893 var nv = parts[i].split('='); 1894 if (!nv[0]) continue; 1895 params[nv[0]] = nv[1] || true; 1896 } 1897 } 1898 if (params.id === undefined) { 1899 $.each($('.isotope-system'), function(index, val) { 1900 loadIsotope($(val)); 1901 }); 1902 } else loadIsotope($('#' + params.id)); 1903 }); 1904 1905 var loadIsotope = function($href) { 1906 var href = ($href.is("a") ? $href.attr('href') : location), 1907 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 1908 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 1909 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 1910 isotopeResultCount = isotopeSystem.find($('.woocommerce-result-count-wrapper')), 1911 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 1912 isotopeId = isotopeSystem.attr('id'); 1913 if ( $href.is("a") && ! isotopeSystem.hasClass('un-no-history') ) { 1914 history.pushState({ 1915 myIsotope: true 1916 }, document.title, href); 1917 } 1918 $.ajax({ 1919 url: href 1920 }).done(function(data) { 1921 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 1922 $resultPagination = $(data).find('#' + isotopeId + ' .pagination'), 1923 $resultCount = $(data).find('#' + isotopeId + ' .woocommerce-result-count'); 1924 isotopeWrapper.addClass('isotope-reloaded'); 1925 requestTimeout(function() { 1926 isotopeWrapper.removeClass('isotope-loading'); 1927 isotopeWrapper.removeClass('isotope-reloaded'); 1928 }, 500); 1929 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 1930 var parent = $(val).parent(), 1931 objTimeout = parent.data('objTimeout'); 1932 if (objTimeout) { 1933 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1934 clearRequestTimeout(objTimeout); 1935 } 1936 if ($(val).hasClass('animate_when_almost_visible')) { 1937 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1938 } else { 1939 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 1940 } 1941 }); 1942 requestTimeout(function() { 1943 if (isotopeContainer.data('isotope')) { 1944 isotopeContainer.html($resultItems).children('.tmb').addClass('tmb-iso'); 1945 isotopeContainer.isotope('reloadItems', onLayout(isotopeContainer, 0, true)); 1946 UNCODE.adaptive();
1947 if (SiteParameters.dynamic_srcset_active === '1') { 1948 UNCODE.adaptive_srcset(isotopeContainer); 1949 } 1950 var getLightbox = UNCODE.lightboxArray['ilightbox_' + isotopeContainer.closest('.isotope-system').attr('id')]; 1951 if (typeof getLightbox === 'object') getLightbox.refresh(); 1952 } 1953 }, 300); 1954 $('.pagination', isotopeFooter).remove(); 1955 isotopeFooter.append($resultPagination); 1956 1957 if (isotopeResultCount.length > 0) { 1958 $('.woocommerce-result-count', isotopeResultCount).remove(); 1959 isotopeResultCount.append($resultCount); 1960 } 1961 }); 1962 }; 1963 $filters.each(function(i, buttonGroup) { 1964 var $buttonGroup = $(buttonGroup); 1965 $buttonGroup.on('click', 'a:not(.no-isotope-filter)', function() { 1966 $buttonGroup.find('.active').removeClass('active'); 1967 $(this).addClass('active'); 1968 1969 }); 1970 1971 var $cats_mobile_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $buttonGroup), 1972 $cats_mobile_toggle = $('.menu-smart--filter-cats_mobile-toggle', $buttonGroup), 1973 $cats_filters = $('.menu-smart--filter-cats', $buttonGroup); 1974 $buttonGroup.on('click', 'a.menu-smart--filter-cats_mobile-toggle-trigger', function(e) { 1975 e.preventDefault(); 1976 $cats_filters.slideToggle(400, 'easeInOutCirc'); 1977 }); 1978 1979 }); 1980 window.addEventListener('boxResized', function(e) { 1981 $.each($('.isotope-layout'), function(index, val) { 1982 var $layoutMode = ($(this).data('layout')); 1983 if ($layoutMode === undefined) $layoutMode = 'masonry'; 1984 if ($(this).data('isotope')) { 1985 $(this).isotope({ 1986 itemSelector: $itemSelector, 1987 layoutMode: $layoutMode, 1988 transitionDuration: transitionDuration[index], 1989 masonry: { 1990 columnWidth: colWidth(index) 1991 }, 1992 vertical: { 1993 horizontalAlignment: 0.5, 1994 }, 1995 sortBy: 'original-order', 1996 isOriginLeft: isOriginLeft 1997 }); 1998 $(this).isotope('unbindResize'); 1999 if (SiteParameters.dynamic_srcset_active === '1') { 2000 UNCODE.refresh_dynamic_srcset_size($(this)); 2001 } 2002 } 2003 $(this).find('.mejs-video,.mejs-audio').each(function() { 2004 $(this).trigger('resize'); 2005 }); 2006 }); 2007 }, false); 2008 2009 init_isotope(); 2010 }; 2011} 2012 2013UNCODE.lightbox = function() { 2014 UNCODE.lightboxArray = {}; 2015 requestTimeout(function() { 2016 var groupsArr = {}; 2017 $('[data-lbox^=ilightbox]:not(.lb-disabled):not([data-lbox-init])').each(function() { 2018 var group = this.getAttribute("data-lbox"), 2019 values = $(this).data(); 2020 $(this).attr('data-lbox-init','true') 2021 groupsArr[group] = values; 2022 }); 2023 for (var i in groupsArr) { 2024 var skin = groupsArr[i].skin || 'black', 2025 path = groupsArr[i].dir || 'horizontal', 2026 thumbs = !groupsArr[i].notmb || false, 2027 arrows = !groupsArr[i].noarr || false, 2028 social = groupsArr[i].social || false, 2029 deeplink = groupsArr[i].deep || false, 2030 $els = $('[data-lbox="' + i + '"]:not(.lb-disabled)'), 2031 counter = $els.length, 2032 dataAlbum = $els.attr('data-album'); 2033 if (social) social = { 2034 facebook: true, 2035 twitter: true, 2036 reddit: true, 2037 digg: true 2038 }; 2039 UNCODE.lightboxArray[i] = $els.iLightBox({ 2040 selector: '[data-lbox="' + i + '"]:not(.lb-disabled)', 2041 skin: skin, 2042 path: path, 2043 linkId: deeplink, 2044 infinite: false, 2045 //fullViewPort: 'fit', 2046 smartRecognition: false, 2047 fullAlone: true, 2048 maxScale: 1, 2049 minScale: .02, 2050 //fullStretchTypes: 'flash, video', 2051 overlay: { 2052 opacity: .94 2053 }, 2054 controls: { 2055 arrows: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? arrows : false), 2056 fullscreen: true, 2057 thumbnail: thumbs, 2058 slideshow: (counter > 1 || ( typeof dataAlbum !== 'undefined' ) ? true : false) 2059 }, 2060 show: { 2061 speed: 200 2062 }, 2063 hide: { 2064 speed: 200 2065 }, 2066 social: { 2067 start: false, 2068 buttons: social 2069 }, 2070 caption: { 2071 start: false 2072 }, 2073 styles: { 2074 nextOpacity: 1, 2075 nextScale: 1, 2076 prevOpacity: 1, 2077 prevScale: 1 2078 }, 2079 effects: { 2080 switchSpeed: 400 2081 }, 2082 slideshow: { 2083 pauseTime: 5000 2084 }, 2085 thumbnails: { 2086 maxWidth: 60, 2087 maxHeight: 60, 2088 activeOpacity: .2 2089 }, 2090 html5video: { 2091 preload: true 2092 }, 2093 callback: { 2094 onOpen: function(){ 2095 $(window).trigger('uncode-custom-cursor'); 2096 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2097 iNoBounce.enable(); 2098 } 2099 }, 2100 onHide: function(){ 2101 if ( $('body').hasClass('ilb-no-bounce') && typeof iNoBounce !== 'undefined' ) { 2102 iNoBounce.disable() 2103 } 2104 }, 2105 } 2106 }); 2107 2108 $(document).on('infinite-loaded', function(){ 2109 UNCODE.lightboxArray[i].refresh(); 2110 }); 2111 }; 2112 }, 100); 2113 2114 $(document).on('click', '.lb-disabled', function(e){ 2115 e.preventDefault(); 2116 }); 2117}; 2118 2119/*UNCODE.backVideo = function() { 2120 $(function() { 2121 $.each($('.background-video-shortcode'), function() { 2122 var video_id = $(this).attr('id'); 2123 if (typeof MediaElement === "function") { 2124 new MediaElement(video_id, { 2125 startVolume: 0, 2126 loop: true, 2127 success: function(mediaElement, domObject) { 2128 mediaElement.play(); 2129 $(mediaElement).closest('.uncode-video-container').css('opacity','1'); 2130 domObject.volume = 0; 2131 }, 2132 // fires when a problem is detected 2133 error: function() {} 2134 }); 2135 } 2136 }); 2137 }); 2138};*/ 2139UNCODE.carousel = function(container) { 2140 var $owlContainers = $('.owl-carousel-container', container); 2141 $owlContainers.each(function() { 2142 var $owlContainer = $(this), 2143 $owlWrapper = $owlContainer.closest('.owl-carousel-wrapper'), 2144 $owlSelector = $('> [class*="owl-carousel"]', $owlContainer), 2145 values = {}, 2146 tempTimeStamp, 2147 currentIndex, 2148 $owlInsideEqual = []; 2149 $owlSelector.each(function() { 2150 var itemID = $(this).attr('id'), 2151 $elSelector = $(('#' + itemID).toString()); 2152 values['id'] = itemID; 2153 values['items'] = 1;
2154 values['columns'] = 3; 2155 values['fade'] = false; 2156 values['nav'] = false; 2157 values['navmobile'] = false; 2158 values['navskin'] = 'light'; 2159 values['navspeed'] = 400; 2160 values['dots'] = false; 2161 values['dotsmobile'] = false; 2162 values['loop'] = false; 2163 values['autoplay'] = false; 2164 values['timeout'] = 3000; 2165 values['autoheight'] = false; 2166 values['stagepadding'] = 0; 2167 values['margin'] = 0; 2168 values['lg'] = 1; 2169 values['md'] = 1; 2170 values['sm'] = 1; 2171 $.each($(this).data(), function(i, v) { 2172 values[i] = v; 2173 }); 2174 2175 if ($(this).closest('.uncode-slider').length) { 2176 values['navskin'] = ''; 2177 values['navmobile'] = false; 2178 //values['dotsmobile'] = true; 2179 } else { 2180 values['navskin'] = ' style-'+values['navskin']+' style-override'; 2181 } 2182 2183 var setIndexActive = function(event, init){ 2184 var init = typeof init === 'undefined' ? false : init, 2185 thiis = $(event.currentTarget); 2186 if (tempTimeStamp != event.timeStamp && ( init || ( !UNCODE.isFullPage || ( UNCODE.isFullPage && thiis.closest('.fp-section').hasClass('uncode-scroll-active') ) ) ) ) { 2187 var scrolltop = $(document).scrollTop(), 2188 size = event.page.size, 2189 i; 2190 var setIndex = requestTimeout(function() { 2191 for ( i = 0; i < size; i++ ) { 2192 var itemCont = event.item.index != null ? (event.item.index + i) : i; 2193 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[itemCont]; 2194 if (thiis.closest('.row-slider').length) { 2195 if (currentItem == undefined) { 2196 currentItem = thiis.children()[i]; 2197 } 2198 if ($(currentItem).closest('#page-header').length) { 2199 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 2200 UNCODE.switchColorsMenu(scrolltop, 'dark'); 2201 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 2202 UNCODE.switchColorsMenu(scrolltop, 'light'); 2203 } 2204 } 2205 } 2206 var itendIndex = $(currentItem).attr('data-index'); 2207 if ( isNaN(itendIndex) ) { 2208 itendIndex = 1; 2209 } 2210 $elSelector.find('.owl-item:not(.new-indexed)').removeClass('index-active'); 2211 $elSelector.find('.owl-item[data-index="' + itendIndex + '"]').addClass('index-active').addClass('new-indexed'); 2212 $elSelector.find('.owl-item[data-index="' + itendIndex + '"] .counter').each(function(){ 2213 var $counter = $(this); 2214 $counter.addClass('started').counterUp({ 2215 delay: 10, 2216 time: 1500 2217 }); 2218 }); 2219 } 2220 $elSelector.find('.owl-item.new-indexed').removeClass('new-indexed'); 2221 }, 200); 2222 } 2223 tempTimeStamp = event.timeStamp; 2224 } 2225 2226 /** Initialized */ 2227 $elSelector.on('initialized.owl.carousel', function(event) { 2228 2229 if ( $('.isotope-container', event.currentTarget).length ) { 2230 window.dispatchEvent(UNCODE.boxEvent); 2231 } 2232 2233 $('.owl-dot.active', $elSelector).on('click', function(){ 2234 return false; 2235 }); 2236 2237 var thiis = $(event.currentTarget), 2238 // get the time from the data method 2239 time = thiis.data("timer-id"), 2240 rowParent = thiis.closest('.row-parent'); 2241 2242 if ( typeof rowParent[0] !== 'undefined' ) { 2243 rowParent[0].dispatchEvent(new CustomEvent('owl-carousel-initialized')); 2244 } 2245 2246 if (time) { 2247 clearRequestTimeout(time); 2248 } 2249 2250 thiis.addClass('showControls'); 2251 var new_time = requestTimeout(function() { 2252 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 2253 if (thiis.hasClass('owl-height-viewport')) 2254 setItemsRelHeight(thiis); 2255 if (thiis.hasClass('owl-height-equal')) 2256 setItemsHeight(thiis); 2257 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 2258 if (thiis.closest('.unequal, .unexpand').length) { 2259 UNCODE.setRowHeight(rowParent[0], true); 2260 } 2261 if (SiteParameters.dynamic_srcset_active === '1') { 2262 UNCODE.refresh_dynamic_srcset_size(thiis); 2263 } 2264 }, 350); 2265 // save the new time 2266 thiis.data("timer-id", new_time); 2267 2268 var scrolltop = $(document).scrollTop(); 2269 thiis.closest('.uncode-slider').find('video').removeAttr('poster'); 2270 2271 //if (!UNCODE.isMobile) { 2272 /** fix autoplay when visible **/ 2273 $(window).on('load', function(){ 2274 if (thiis.data('autoplay')) { 2275 thiis.trigger('stop.autoplay.owl'); 2276 } 2277 if (UNCODE.isUnmodalOpen && !thiis.closest('#unmodal-content')) { 2278 return; 2279 } 2280 var carouselInView = new Waypoint.Inview({ 2281 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2282 element: thiis[0], 2283 exited: function() { 2284 var el = $(this.element); 2285 if (el.data('autoplay')) { 2286 el.trigger('stop.owl.autoplay'); 2287 el.data('stopped','true'); 2288 } 2289 }, 2290 enter: function(direction) { 2291 var el = $(this.element); 2292 requestTimeout(function() { 2293 if (el.data('autoplay')) { 2294 el.trigger('play.owl.autoplay'); 2295 el.data('stopped','false'); 2296 } 2297 }, 100); 2298 } 2299 }); 2300 }); 2301 //} 2302 2303 // $(window).on('frontend:carousel_updated', function(){ 2304 // Waypoint.refreshAll(); 2305 // }); 2306 2307 if (!thiis.closest('.isotope-system').length) { 2308 requestTimeout(function() { 2309 animate_thumb($('.t-inside', el), event); 2310 }, 400); 2311 } 2312 2313 var currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 2314 currentIndex = $(currentItem).attr('data-index'); 2315 2316 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 2317 if ($(val).closest('.uncode-slider').length) { 2318 $(val).removeClass('start_animation'); 2319 } 2320 }); 2321 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 2322 if ($(val).closest('.uncode-slider').length) { 2323 $(val).removeClass('already-animated'); 2324 } 2325 }); 2326 2327 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 2328 if ($(val).closest('.uncode-slider').length) { 2329 $(val).removeAttr('data-animated'); 2330 } 2331 }); 2332 2333 $.each($('.owl-item.cloned', thiis), function(index, val) {
2334 $('.t-entry-visual-cont > a', $(val)).attr('data-lbox-clone', true); 2335 }); 2336 2337 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 2338 if ($(val).attr('data-index') != currentIndex) { 2339 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 2340 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 2341 } 2342 if ($(val).attr('data-index') != currentIndex) { 2343 $('[data-animated="yes"]:not(.t-inside)', val).removeAttr('data-animated'); 2344 } 2345 if ($(val).attr('data-index') == currentIndex) { 2346 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 2347 } 2348 }); 2349 2350 if (thiis.closest('.uncode-slider').length) { 2351 var el = thiis.closest('.row-parent')[0]; 2352 if ($(el).data('imgready')) { 2353 firstLoaded(el, event); 2354 } else { 2355 el.addEventListener("imgLoaded", function(el) { 2356 firstLoaded(el.target, event); 2357 }, false); 2358 } 2359 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height() - UNCODE.bodyBorder; 2360 if (transHeight != null) { 2361 requestTimeout(function() { 2362 thiis.closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 2363 }, 100); 2364 } 2365 } else { 2366 var el = thiis; 2367 el.closest('.uncode-slider').addClass('slider-loaded'); 2368 } 2369 2370 requestTimeout(function() { 2371 window.uncode_textfill(thiis); 2372 if (thiis.closest('.uncode-slider').length) { 2373 if (thiis.data('autoplay')) pauseOnHover(thiis); 2374 } 2375 }, 500); 2376 2377 if (thiis.closest('.unequal').length) { 2378 $owlInsideEqual.push(thiis.closest('.row-parent')); 2379 } 2380 2381 var containerClasses = '', 2382 containerStyle = ''; 2383 if ( $('.owl-dots-classes', $owlContainer).length ) { 2384 containerClasses = $('.owl-dots-classes', $owlContainer).attr('class'); 2385 containerStyle = $('.owl-dots-classes', $owlContainer).attr('style'); 2386 $('.owl-dots-classes', $owlContainer).remove(); 2387 } 2388 2389 if ( containerClasses !== '' ) { 2390 requestTimeout(function() { 2391 if ( containerClasses !== '' ) 2392 $('.owl-dots', $owlContainer).attr('style', containerStyle); 2393 if ( containerStyle !== '' ) 2394 $('.owl-dots', $owlContainer).addClass(containerClasses); 2395 }, 100); 2396 } 2397 2398 $.each($('.column_child.pos-bottom', thiis), function(index, val) { 2399 $(val).closest('.row-inner').css({ 2400 'margin-top': '-1px' 2401 }); 2402 }); 2403 2404 if ( thiis.closest('.isotope-container').length ) { 2405 if (thiis.closest('.isotope-container').data('isotope')) { 2406 requestTimeout(function(){ 2407 thiis.closest('.isotope-container').isotope('layout'); 2408 }, 300); 2409 } 2410 $(window).on('load', function(){ 2411 if (thiis.closest('.isotope-container').data('isotope')) { 2412 thiis.closest('.isotope-container').isotope('layout'); 2413 } 2414 }); 2415 } 2416 2417 if (thiis.data('autoplay')) { 2418 $(window).on('menuOpen', function(){ 2419 thiis.trigger('stop.owl.autoplay'); 2420 thiis.data('stopped','true'); 2421 }).on('menuClose', function(){ 2422 2423 }); 2424 } 2425 $(window).on('menuClose', function(){ 2426 if (thiis.data('autoplay')) { 2427 thiis.trigger('play.owl.autoplay'); 2428 thiis.data('stopped','false'); 2429 } 2430 }); 2431 2432 setIndexActive(event, true); 2433 }); 2434 2435 $elSelector.on('resized.owl.carousel', function(event) { 2436 var thiis = $(event.currentTarget); 2437 // if ($(this).closest('.nested-carousel').length) { 2438 // requestTimeout(function() { 2439 // window.dispatchEvent(UNCODE.boxEvent); 2440 // }, 200); 2441 // } 2442 if ( thiis.hasClass('owl-height-equal') ) 2443 setItemsHeight(thiis); 2444 2445 setItemsRelHeight($elSelector); 2446 2447 setIndexActive(event); 2448 2449 if (SiteParameters.dynamic_srcset_active === '1') { 2450 UNCODE.refresh_dynamic_srcset_size(thiis); 2451 } 2452 2453 $(window).on('load', function(){ 2454 if ($(event.currentTarget).closest('.isotope-container').data('isotope')) { 2455 $(event.currentTarget).closest('.isotope-container').isotope('layout'); 2456 } 2457 }); 2458 }); 2459 2460 /** detect resize window for fluid height layout */ 2461 var setFluidResize;
2462 function manageFluidCarouseHeight() { 2463 clearRequestTimeout(setFluidResize); 2464 setFluidResize = requestTimeout(function(){ 2465 setItemsRelHeight($elSelector); 2466 }, 100); 2467 } 2468 window.addEventListener('resize', manageFluidCarouseHeight); 2469 2470 /** Change */ 2471 $elSelector.on('change.owl.carousel', function(event) { 2472 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 2473 }); 2474 2475 /** Changed */ 2476 $elSelector.on('changed.owl.carousel', function(event) { 2477 var $row = $elSelector.parents('.row')[0]; 2478 if ( typeof $row !== 'undefined' ) { 2479 $row.dispatchEvent(new CustomEvent('owl-carousel-changed')); 2480 } 2481 setIndexActive(event); 2482 }); 2483 2484 $elSelector.on('translate.owl.carousel', function(event) { 2485 if (UNCODE.isMobile) { 2486 $(event.currentTarget).addClass('owl-translating'); 2487 } 2488 }); 2489 2490 /** Translated */ 2491 $elSelector.on('translated.owl.carousel', function(event) { 2492 2493 var thiis = $(event.currentTarget), 2494 currentItem = thiis.find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 2495 currentIndex = $(currentItem).attr('data-index'), 2496 stagePadding = thiis.data('stagepadding'); 2497 2498 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 2499 2500 if (!UNCODE.isMobile) { 2501 UNCODE.owlPlayVideo(thiis); 2502 } 2503 2504 requestTimeout(function(){ 2505 var lastDelayElems = animate_elems($('.owl-item.index-active', thiis)); 2506 var lastDelayThumb = animate_thumb($('.owl-item' + (stagePadding ? '' : '.active') + ' .t-inside', thiis), event); 2507 if (thiis.closest('.uncode-slider').length && thiis.data('autoplay')) { 2508 if (lastDelayElems == undefined) lastDelayElems = 0; 2509 if (lastDelayThumb == undefined) lastDelayThumb = 0; 2510 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 2511 thiis.trigger('stop.owl.autoplay'); 2512 requestTimeout(function() { 2513 if (!thiis.hasClass('owl-mouseenter') && thiis.data('stopped') != 'true') thiis.trigger('play.owl.autoplay'); 2514 }, maxDelay); 2515 } 2516 }, 200); 2517 2518 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 2519 if ($(val).closest('.uncode-slider').length) { 2520 $(val).removeClass('start_animation'); 2521 } 2522 }); 2523 2524 $.each($('.owl-item:not(.active) .already-animated', $(event.target)), function(index, val) { 2525 if ($(val).closest('.uncode-slider').length) { 2526 $(val).removeClass('already-animated'); 2527 } 2528 }); 2529 2530 $.each($('.owl-item:not(.active) [data-animated="yes"]', $(event.target)), function(index, val) { 2531 if ($(val).closest('.uncode-slider').length) { 2532 $(val).removeAttr('data-animated'); 2533 } 2534 }); 2535 2536 $.each($('.owl-item:not(.active)', thiis), function(index, val) { 2537 if ($(val).attr('data-index') != currentIndex) { 2538 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 2539 $('.already-animated:not(.t-inside)', val).removeClass('already-animated'); 2540 } 2541 if ($(val).attr('data-index') != currentIndex) { 2542 $('[data-animated="yes"]:not(.t-inside)', val).removeClass('start_animation'); 2543 } 2544 if ($(val).attr('data-index') == currentIndex) { 2545 $('.animate_when_almost_visible:not(.t-inside), .animate_inner_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 2546 } 2547 }); 2548 2549 if (UNCODE.isMobile) { 2550 thiis.removeClass('owl-translating'); 2551 } 2552 2553 setIndexActive(event); 2554 }); 2555 2556 if (UNCODE.wwidth < UNCODE.mediaQuery && $(this).data('stagepadding') > 25) values['stagepadding'] = 25; 2557 2558 /** Init carousel */ 2559 $elSelector.not('.showControls').owlCarousel({ 2560 items: values['items'], 2561 animateIn: (values['fade'] == true) ? 'fadeIn' : null, 2562 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 2563 nav: values['nav'], 2564 dots: values['dots'], 2565 loop: values['loop'], 2566 stagePadding: values['stagepadding'], 2567 margin: 0, 2568 video: true, 2569 autoWidth: false, 2570 autoplay: false, 2571 autoplayTimeout: values['timeout'], 2572 autoplaySpeed: values['navspeed'], 2573 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 2574 autoHeight: ( $(this).hasClass('owl-height-equal') ? false : ( $(this).hasClass('owl-height-auto') ? true : values['autoheight'] ) ), 2575 rtl: $('body').hasClass('rtl') ? true : false, 2576 fluidSpeed: true, 2577 navSpeed: values['navspeed'], 2578 dotsSpeed: values['navspeed'] / values['items'], 2579 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 2580 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>'], 2581 navContainer: values['nav'] && ! SiteParameters.is_frontend_editor ? $elSelector : false, 2582 responsiveClass: true, 2583 responsiveBaseElement: '.box-container', 2584 responsive: { 2585 0: { 2586 items: values['sm'], 2587 nav: values['navmobile'], 2588 dots: values['dotsmobile'], 2589 dotsSpeed: values['navspeed'] / values['sm'], 2590 }, 2591 480: { 2592 items: values['sm'], 2593 nav: values['navmobile'], 2594 dots: values['dotsmobile'], 2595 dotsSpeed: values['navspeed'] / values['sm'], 2596 }, 2597 570: { 2598 items: values['md'], 2599 nav: values['navmobile'], 2600 dots: values['dotsmobile'], 2601 dotsSpeed: values['navspeed'] / values['md'], 2602 }, 2603 960: { 2604 items: values['lg'], 2605 dotsSpeed: values['navspeed'] / values['lg'], 2606 } 2607 } 2608 }); 2609 2610 var transDuration = parseFloat(values['navspeed']) * 0.3; 2611 var transDuration2 = parseFloat(values['navspeed']) * 0.8; 2612 2613 $('.owl-item .tmb', $elSelector).css({ 2614 '-webkit-transition-delay': transDuration + 'ms', 2615 '-moz-transition-delay': transDuration + 'ms', 2616 '-o-transition-delay': transDuration + 'ms', 2617 'transition-delay': transDuration + 'ms', 2618 '-webkit-transition-duration': transDuration2 + 'ms', 2619 '-moz-transition-duration': transDuration2 + 'ms', 2620 '-o-transition-duration': transDuration2 + 'ms', 2621 'transition-duration': transDuration2 + 'ms', 2622 }); 2623 2624 requestTimeout(function() { 2625 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 2626 UNCODE.setRowHeight($owlInsideEqual[i]); 2627 }; 2628 }, 300); 2629 2630 $(window).on('load', function(){ 2631 var $elCarousel = $elSelector.data('owl.carousel'); 2632 if ( typeof $elCarousel !== 'undefined' ) { 2633 $elCarousel.trigger('refreshed'); 2634 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 2635 UNCODE.setRowHeight($owlInsideEqual[i]); 2636 }; 2637 } 2638 }); 2639 2640 $( document.body ).on( 'added-owl-item', function( e, carousel_id, $new_slide, randId ) { 2641 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 2642 $('#' + carousel_id).data( 'added-id', randId ).trigger( 'add.owl.carousel', $new_slide ).trigger('refresh.owl.carousel'); 2643 $('#' + carousel_id).find('.owl-item').each( function() { 2644 var $item = $(this), 2645 index = ( $item.index() + 1 ); 2646 $item.attr('data-index', index); 2647 }); 2648 } 2649 }); 2650 2651 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 2652 window.parent.vc.events.on( 'removed-owl-item', function( carousel_id, item_index, randId ) { 2653 if ( $('#' + carousel_id).data( 'added-id' ) != randId ) { 2654 $('#' + carousel_id).data( 'added-id', randId ).trigger('remove.owl.carousel', [ (item_index-1) ]).trigger('refresh.owl.carousel'); 2655 $('#' + carousel_id).find('.owl-item').each( function() { 2656 var $item = $(this), 2657 index = ( $item.index() + 1 ); 2658 $item.attr('data-index', index); 2659 }); 2660 } 2661 }); 2662 } 2663 2664 }); 2665 2666 function firstLoaded(el, event) { 2667 var el = $(el), 2668 uncode_slider = el.find('.uncode-slider'); 2669 el.find('.owl-carousel').css('opacity', 1); 2670 uncode_slider.addClass('slider-loaded'); 2671 window.uncode_textfill(el.find('.owl-item.active')); 2672 //if (!UNCODE.isMobile) { 2673 requestTimeout(function() { 2674 var lastDelayElems = animate_elems(el.find('.owl-item.index-active')); 2675 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 2676 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 2677 if (lastDelayElems == undefined) lastDelayElems = 0; 2678 if (lastDelayThumb == undefined) lastDelayThumb = 0; 2679 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 2680 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 2681 requestTimeout(function() { 2682 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 2683 }, maxDelay); 2684 } 2685 }, 500); 2686 2687 //} 2688 } 2689 2690 function navHover(el) { 2691 var $owlCont = el, 2692 $owlPrev = $owlCont.find('.owl-prev'), 2693 $owlNext = $owlCont.find('.owl-next'), 2694 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 2695 $owlPagination = $owlCont.next(), 2696 owlPrevW = $owlPrev.outerWidth(), 2697 owlNextW = $owlNext.outerWidth(), 2698 owlDotsH = $owlDots.innerHeight(), 2699 owlTime = 400, 2700 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2701 if ( $('body').hasClass('rtl') ) { 2702 $owlPrev.css("margin-right", -owlPrevW); 2703 $owlNext.css("margin-left", -owlNextW); 2704 } else { 2705 $owlPrev.css("margin-left", -owlPrevW); 2706 $owlNext.css("margin-right", -owlNextW); 2707 } 2708 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 2709 $owlCont.mouseenter(function() { 2710 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2711 $owlPrev.add($owlNext).css({ 2712 marginLeft: 0, 2713 marginRight: 0 2714 }); 2715 if (!owlNested) { 2716 $owlDots.css({ 2717 opacity: 1, 2718 bottom: 0 2719 }); 2720 } 2721 }).mouseleave(function() { 2722 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 2723 if ( $('body').hasClass('rtl') ) { 2724 $owlPrev.css("margin-right", -owlPrevW); 2725 $owlNext.css("margin-left", -owlNextW); 2726 } else { 2727 $owlPrev.css("margin-left", -owlPrevW); 2728 $owlNext.css("margin-right", -owlNextW); 2729 } 2730 if (!owlNested) { 2731 $owlDots.css({ 2732 opacity: 1, 2733 bottom: -owlDotsH 2734 }); 2735 } 2736 }); 2737 }; 2738 2739 function animate_elems($this) { 2740 var lastDelay; 2741 $.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) { 2742 var element = $(val), 2743 delayAttr = element.attr('data-delay'), 2744 $first_item = element.closest('.owl-item[data-index="1"]'); 2745 2746 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' && !$first_item.closest('#page-header').length ) { 2747 return false;
2748 } 2749 2750 if (delayAttr == undefined) delayAttr = 0; 2751 requestTimeout(function() { 2752 element.addClass('start_animation'); 2753 }, delayAttr); 2754 lastDelay = delayAttr; 2755 }); 2756 return lastDelay; 2757 } 2758 2759 function animate_thumb(items, event) { 2760 var lastDelay, 2761 itemIndex, 2762 thiis = $(event.currentTarget), 2763 tempIndex = (thiis.data('tempIndex') == undefined) ? $('.owl-item.active', thiis).first().index() : thiis.data('tempIndex'), 2764 numActives = $('.owl-item.active', thiis).length, 2765 stagePadding = thiis.data('stagepadding'); 2766 2767 stagePadding = (stagePadding == undefined || stagePadding == 0) ? false : true; 2768 2769 thiis.data('tempIndex', event.item.index); 2770 $.each(items, function(index, val) { 2771 var parent = $(val).closest('.owl-item'); 2772 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 2773 return; 2774 } 2775 if (!$(val).hasClass('start_animation')) { 2776 if (parent.hasClass('active') || stagePadding || $owlWrapper.hasClass('carousel-animation-first')) { 2777 var thumbInView = new Waypoint.Inview({ 2778 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 2779 element: val, 2780 enter: function(direction) { 2781 var element = $(this.element), 2782 delayAttr = parseInt(element.attr('data-delay')), 2783 itemIndex = element.closest('.owl-item').index() + 1, 2784 diffItem = Math.abs(itemIndex - tempIndex) - 1; 2785 if (itemIndex > tempIndex) { 2786 thiis.data('tempIndex', itemIndex); 2787 } 2788 if (isNaN(delayAttr)) delayAttr = 100; 2789 if (stagePadding) { 2790 var objTimeout = requestTimeout(function() { 2791 element.addClass('start_animation'); 2792 }, index * delayAttr); 2793 lastDelay = index * delayAttr; 2794 } else { 2795 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', thiis).addClass('start_animation'); 2796 var objTimeout = requestTimeout(function() { 2797 element.addClass('start_animation'); 2798 }, diffItem * delayAttr); 2799 lastDelay = diffItem * delayAttr; 2800 } 2801 parent.data('objTimeout', objTimeout); 2802 if (!UNCODE.isUnmodalOpen) { 2803 this.destroy(); 2804 } 2805 } 2806 }); 2807 } 2808 } 2809 }); 2810 return lastDelay; 2811 } 2812 2813 function setItemsHeight(item) { 2814 $.each($('.owl-item', item), function(index, val) { 2815 var availableThumbHeight = $('.t-inside', $(val)).height(), 2816 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 2817 difference = availableThumbHeight - innerThumbHeight; 2818 if ($('.tmb-content-under', val).length) { 2819 var visualPart = $('.t-entry-visual', val); 2820 if (visualPart.length) { 2821 difference -= $('.t-entry-visual', val).height(); 2822 } 2823 } 2824 if (! $('.tmb-content-lateral', val).length) 2825 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 2826 }); 2827 } 2828 2829 function setItemsRelHeight(item) { 2830 $.each($('.owl-item', item), function(index, val) { 2831 var $rowContainer = $(item).parents('.row-parent').eq(0), 2832 paddingRow = parseInt($rowContainer.css('padding-top')) + parseInt($rowContainer.css('padding-bottom')), 2833 $colContainer = $(item).parents('.uncell').eq(0), 2834 paddingCol = parseInt($colContainer.css('padding-top')) + parseInt($colContainer.css('padding-bottom')), 2835 winHeight = UNCODE.wheight, 2836 multiplier_h = parseInt($(item).attr('data-vp-height')), 2837 data_viewport_h, 2838 consider_menu = $(item).data('vp-menu'); 2839 2840 if ( consider_menu ) { 2841 winHeight = winHeight - UNCODE.menuHeight; 2842 } 2843 2844 data_viewport_h = Math.ceil(winHeight / (100 / multiplier_h) ) - ( paddingRow + paddingCol ); 2845 $('.t-inside', val).css( 'height', data_viewport_h ); 2846 }); 2847 } 2848 2849 function pauseOnHover(slider) { 2850 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 2851 mouseenter: function () { 2852 $(slider).addClass('owl-mouseenter'); 2853 $(slider).trigger('stop.owl.autoplay'); 2854 }, 2855 mouseleave: function () { 2856 $(slider).removeClass('owl-mouseenter'); 2857 $(slider).trigger('play.owl.autoplay'); 2858 } 2859 }); 2860 } 2861 }); 2862}; 2863 2864UNCODE.owlPlayVideo = function(carousel) { 2865 var player, iframe; 2866 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 2867 var content = $(val).html(); 2868 if (content == '') { 2869 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 2870 $(val).append(getCloned); 2871 } 2872 if ($(this).attr('data-provider') == 'vimeo') { 2873 iframe = $(this).find('iframe'); 2874 player = $f(iframe[0]); 2875 player.api('play'); 2876 } else if ($(this).attr('data-provider') == 'youtube') { 2877 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 2878 } else { 2879 var player = $(this).find('video'); 2880 if (player.length) { 2881 $(this).find('video')[0].volume = 0; 2882 $(this).find('video')[0].play(); 2883 $(val).css('opacity', 1); 2884 } 2885 } 2886 }); 2887}; 2888 2889UNCODE.owlStopVideo = function(carousel) { 2890 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 2891 var player, iframe; 2892 if ($(this).attr('data-provider') == 'vimeo') { 2893 iframe = $(this).find('iframe'); 2894 player = $f(iframe[0]); 2895 player.api('pause'); 2896 } else if ($(this).attr('data-provider') == 'youtube') { 2897 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 2898 } else { 2899 var player = $(this).find('video'); 2900 if (player.length) { 2901 $(this).find('video')[0].volume = 0; 2902 $(this).find('video')[0].play(); 2903 } 2904 } 2905 }); 2906}; 2907 2908UNCODE.animations = function() { 2909 2910 var runWaypoints_TO, 2911 runWaypoints_carousel_TO, 2912 runWaypoints_delay = 0, 2913 highlightComplexFunc = function($wrap){ 2914 2915 var $lines = $('.heading-line-wrap', $wrap), 2916 not_animate = false;
2917 2918 if ( $wrap.data('animate') === true ) { 2919 not_animate = true; 2920 } 2921 $lines.each(function(_key, _value){ 2922 var $line = $(_value), 2923 $inners = $('.split-word-inner', $line), 2924 $highlights = $('.heading-text-highlight-inner', $line); 2925 2926 if ( $('.heading-text-highlight-inner[data-animated="yes"]', $line).length ) { 2927 if ( not_animate ) { 2928 $highlights.each(function(h_key, high){ 2929 var $highlight = $(high); 2930 $highlight.css({ 2931 '-webkit-transition-duration': '0ms', 2932 '-moz-transition-duration': '0ms', 2933 '-o-transition-duration': '0ms', 2934 'transition-duration': '0ms', 2935 }); 2936 }); 2937 $highlights.removeAttr('data-animated'); 2938 } else { 2939 $inners.last().one('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 2940 var delay = 0; 2941 $highlights.each(function(h_key, high){ 2942 var $highlight = $(high), 2943 $split = $highlight.closest('.split-word'), 2944 $nextSplit = $split.next(), 2945 $next = $('.heading-text-highlight-inner', $nextSplit), 2946 countCh = $split.text().length; 2947 2948 $highlight.css({ 2949 '-webkit-transition-duration': (30 * countCh) + 'ms', 2950 '-moz-transition-duration': (30 * countCh) + 'ms', 2951 '-o-transition-duration': (30 * countCh) + 'ms', 2952 'transition-duration': (30 * countCh) + 'ms', 2953 }); 2954 2955 delay += (30 * countCh); 2956 2957 $next.css({ 2958 '-webkit-transition-delay': delay + 'ms', 2959 '-moz-transition-delay': delay + 'ms', 2960 '-o-transition-delay': delay + 'ms', 2961 'transition-delay': delay + 'ms', 2962 }); 2963 }); 2964 $highlights.removeAttr('data-animated'); 2965 if ( _key+1 === $lines.length ) { 2966 $wrap.data('animate', true); 2967 } 2968 }); 2969 } 2970 } 2971 }); 2972 }; 2973 2974 $.each($('.header-content-inner'), function(index, val) { 2975 var element = $(val), 2976 transition = ''; 2977 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 2978 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 2979 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 2980 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 2981 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 2982 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 2983 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 2984 if (transition != '') { 2985 $(val).removeClass(transition); 2986 var container = element, 2987 containerDelay = container.attr('data-delay'), 2988 containerSpeed = container.attr('data-speed'), 2989 items = $('.header-title > *, .post-info', container); 2990 $.each(items, function(index, val) { 2991 var element = $(val), 2992 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 2993 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 2994 if (!element.hasClass('animate_when_almost_visible')) { 2995 delayAttr = Number(delayAttr) + (400 * index); 2996 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 2997 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 2998 } 2999 }); 3000 container.css('opacity', 1); 3001 } 3002 }); 3003 3004 window.waypoint_animation = function() { 3005 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) { 3006 if ( $(val).hasClass('el-text-split') ) { 3007 return true; 3008 } 3009 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3010 return; 3011 } 3012 var run = true, 3013 $carousel = $(val).closest('.owl-carousel'); 3014 if ( $carousel.length ) { 3015 run = false; 3016 } 3017 if (run) { 3018 new Waypoint({ 3019 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3020 element: val, 3021 handler: function() { 3022 var element = $(this.element), 3023 index = element.index(), 3024 delayAttr = element.attr('data-delay'); 3025 if (delayAttr == undefined) delayAttr = 0; 3026 requestTimeout(function() { 3027 element.addClass('start_animation'); 3028 }, delayAttr); 3029 if (!UNCODE.isUnmodalOpen) { 3030 this.destroy(); 3031 } 3032 }, 3033 offset: UNCODE.isFullPage ? '100%' : '90%' 3034 }); 3035 } 3036 }); 3037 $.each($('.animate_inner_when_almost_visible'), function(index, val) { 3038 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3039 return; 3040 } 3041 var run = true, 3042 $carousel = $(val).closest('.owl-carousel'); 3043 if ( $carousel.length ) { 3044 run = false;
3045 } 3046 if (run) { 3047 new Waypoint({ 3048 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3049 element: val, 3050 handler: function() { 3051 var $element = $(this.element), 3052 $childs = $('.animate_when_parent_almost_visible', $element); 3053 $childs.each(function(key,el){ 3054 var $child = $(el), 3055 delaySpeed = $child.attr('data-speed'), 3056 delayAttr = $child.attr('data-delay'), 3057 intervalAttr = $child.attr('data-interval'); 3058 if (delayAttr == undefined) { 3059 delayAttr = 50*key; 3060 } 3061 requestTimeout(function() { 3062 $child.addClass('start_animation'); 3063 if ( $child.hasClass('anim-line-checker') ) { 3064 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3065 var $line = $child.closest('.heading-line-wrap'); 3066 }); 3067 } 3068 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3069 highlightComplexFunc($wrapText); 3070 if ( $child.hasClass('anim-tot-checker') ) { 3071 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3072 if ( $child.hasClass('anim-tot-checker') ) { 3073 $wrapText.addClass('already-animated'); 3074 } 3075 }); 3076 } 3077 }, delayAttr ); 3078 }); 3079 $element.addClass('start_animation'); 3080 if (!UNCODE.isUnmodalOpen) { 3081 this.destroy(); 3082 } 3083 }, 3084 offset: UNCODE.isFullPage ? '100%' : '90%' 3085 }); 3086 } 3087 }); 3088 } 3089 window.waypoint_carousel_animation = function() { 3090 $.each($('.owl-carousel').find('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) { 3091 if ( $(val).hasClass('el-text-split') ) { 3092 return true; 3093 } 3094 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3095 return; 3096 } 3097 var run = true, 3098 $carousel = $(val).closest('.owl-carousel'), 3099 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3100 $all_first = $('.owl-item[data-index="1"]', $carousel); 3101 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3102 run = false; 3103 } 3104 if (run) { 3105 new Waypoint({ 3106 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3107 element: val, 3108 handler: function() { 3109 var element = $(this.element), 3110 index = element.index(), 3111 delayAttr = element.attr('data-delay'); 3112 if (delayAttr == undefined) delayAttr = 0; 3113 requestTimeout(function() { 3114 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3115 $all_first.attr('data-already-reached', 'true'); 3116 } 3117 element.addClass('start_animation'); 3118 }, delayAttr); 3119 if (!UNCODE.isUnmodalOpen) { 3120 this.destroy(); 3121 } 3122 }, 3123 offset: UNCODE.isFullPage ? '100%' : '90%' 3124 }); 3125 } 3126 }); 3127 $.each($('.owl-carousel').find('.animate_inner_when_almost_visible'), function(index, val) { 3128 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3129 return; 3130 } 3131 var run = true, 3132 $carousel = $(val).closest('.owl-carousel'), 3133 $first_item = $(val).closest('.owl-item[data-index="1"]'), 3134 $all_first = $('.owl-item[data-index="1"]', $carousel); 3135 if ( ! ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) && $carousel.attr('data-front-edited') !== 'true' ) { 3136 run = false; 3137 } 3138 if (run) { 3139 new Waypoint({ 3140 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3141 element: val, 3142 handler: function() { 3143 var $element = $(this.element), 3144 $childs = $('.animate_when_parent_almost_visible', $element); 3145 $childs.each(function(key,el){ 3146 var $child = $(el), 3147 delaySpeed = $child.attr('data-speed'), 3148 delayAttr = $child.attr('data-delay'), 3149 intervalAttr = $child.attr('data-interval'); 3150 if (delayAttr == undefined) { 3151 delayAttr = 50*key; 3152 } 3153 requestTimeout(function() { 3154 if ( $first_item.length && $first_item.attr('data-already-reached') !== 'true' ) { 3155 $all_first.attr('data-already-reached', 'true'); 3156 } 3157 $child.addClass('start_animation'); 3158 if ( $child.hasClass('anim-line-checker') ) { 3159 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3160 var $line = $child.closest('.heading-line-wrap'); 3161 }); 3162 } 3163 var $wrapText = $child.closest('.animate_inner_when_almost_visible'); 3164 highlightComplexFunc($wrapText); 3165 if ( $child.hasClass('anim-tot-checker') ) { 3166 $child.on('webkitAnimationEnd oanimationend mozAnimationEnd msAnimationEnd animationEnd', function(e) { 3167 if ( $child.hasClass('anim-tot-checker') ) { 3168 $wrapText.addClass('already-animated'); 3169 } 3170 }); 3171 } 3172 }, delayAttr ); 3173 }); 3174 $element.addClass('start_animation'); 3175 if (!UNCODE.isUnmodalOpen) { 3176 this.destroy(); 3177 } 3178 }, 3179 offset: UNCODE.isFullPage ? '100%' : '90%' 3180 }); 3181 } 3182 }); 3183 } 3184 3185 var runWaypoints = function(){ 3186 if ( typeof runWaypoints_TO !== 'undefined' && runWaypoints_TO !== '' ) { 3187 runWaypoints_delay = 400; 3188 } 3189 clearRequestTimeout(runWaypoints_TO); 3190 runWaypoints_TO = requestTimeout(function() { 3191 window.waypoint_animation(); 3192 }, runWaypoints_delay); 3193 3194 clearRequestTimeout(runWaypoints_carousel_TO); 3195 runWaypoints_carousel_TO = requestTimeout(function() { 3196 window.waypoint_carousel_animation(); 3197 }, 400); 3198 }; 3199 runWaypoints(); 3200 $( document.body ).on( 'uncode_waypoints', runWaypoints ); 3201 if ( $('body').hasClass('compose-mode') && typeof window.parent.vc !== 'undefined' ) { 3202 window.parent.vc.events.on( 'shortcodeView:updated', runWaypoints ); 3203 } 3204}; 3205 3206UNCODE.tapHover = function() { 3207 3208 var $el = $('html.touch .tmb:not(.tmb-no-double-tap) .t-entry-v
3208isual-cont > a'), //.length //html.touch a.btn 3209 elClass = "hover"; 3210 3211 $(window).on('click', function() { 3212 $el.removeClass(elClass); 3213 }); 3214 3215 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 3216 e.stopPropagation(); 3217 var link = $(this); 3218 if ( ! link.hasClass(elClass)) { 3219 e.preventDefault(); 3220 link.addClass("hover"); 3221 $el.not(this).removeClass(elClass); 3222 return false; 3223 } 3224 }); 3225}; 3226 3227UNCODE.onePage = function(isMobile) { 3228 var current = 0, 3229 last = 0, 3230 lastScrollTop = 0, 3231 forceScroll = false, 3232 lastScrolled = 0, 3233 isSectionscroller = ($('.main-onepage').length) ? true : false, 3234 isOnePage = false, 3235 getOffset = function () { 3236 var calculateOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0); 3237 return calculateOffset; 3238 } 3239 3240 // if ( UNCODE.isFullPage || UNCODE.isFullPageSnap ) 3241 // return false; 3242 3243 function init_onepage() { 3244 if (isSectionscroller && !isMobile && !$('body').hasClass('uncode-scroll-no-dots') && !UNCODE.isFullPageSnap) { 3245 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 3246 } 3247 last = $('.onepage-pagination li').last().find('a').data('index'); 3248 $.each($('div[data-parent=true]'), function(index, val) { 3249 $(this).attr('data-section', index); 3250 if (isMobile) return; 3251 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 3252 return; 3253 } 3254 var sectionDown = new Waypoint({ 3255 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3256 element: val, 3257 handler: function(direction) { 3258 if (direction == 'down') { 3259 changeMenuActive(this.element, index); 3260 } 3261 }, 3262 offset: function() { 3263 return 5 + getOffset() 3264 } 3265 }); 3266 var sectionUp = new Waypoint({ 3267 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 3268 element: val, 3269 handler: function(direction) { 3270 if (direction == 'up') { 3271 changeMenuActive(this.element, index); 3272 } 3273 }, 3274 offset: function() { 3275 return -5 - getOffset() 3276 } 3277 }); 3278 3279 if (isSectionscroller) { 3280 var label; 3281 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 3282 else label = ''; 3283 var getName = $(this).attr('data-name'); 3284 if (getName == undefined) getName = index; 3285 if (label != '') { 3286 isOnePage = true; 3287 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 3288 $('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>"); 3289 } 3290 } 3291 }); 3292 3293 if (isSectionscroller) { 3294 $.each($('ul.onepage-pagination li'), function(index, val) { 3295 var $this = $(val); 3296 $this.on('click', function(evt) { 3297 if ( $('body').hasClass('uncode-scroll-no-history') ) 3298 evt.preventDefault(); 3299 Waypoint.refreshAll(); 3300 var el = $('a', evt.currentTarget); 3301 current = lastScrolled = parseInt(el.attr('data-index')); 3302 lastScrolled += 1; 3303 scrollBody(current); 3304 }); 3305 }); 3306 } 3307 3308 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 3309 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '' ) { 3310 goToSection = String(window.location.hash).replace(/^#/, ""); 3311 goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section')); 3312 } 3313 3314 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 3315 current = lastScrolled = goToSection; 3316 $(window).on('load', function(){ 3317 if ( $('.owl-carousel').length ) { 3318 requestTimeout(function(){ 3319 scrollBody(goToSection); 3320 }, 400); 3321 } else { 3322 scrollBody(goToSection); 3323 } 3324 }); 3325 } 3326 3327 } 3328 3329 function changeMenuActive(section, index) { 3330 current = lastScrolled = parseInt($(section).attr('data-section')); 3331 if (isOnePage) { 3332 var newSection = $('.onepage-pagination li a[data-index=' + index + ']'); 3333 if (newSection.length) { 3334 $('ul.onepage-pagination li a').removeClass('is-selected'); 3335 newSection.addClass('is-selected'); 3336 } 3337 var getName = $('[data-section=' + index + ']').attr('data-name'); 3338 if (getName != undefined && getName !== '') { 3339 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 3340 var get_href = $(val).attr('href'); 3341 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 3342 $(val).closest('.menu-smart').find('.active').removeClass('active'); 3343 $(val).parent().addClass('active'); 3344 } 3345 }); 3346 } 3347 } 3348 } 3349 3350 if (isOnePage) { 3351 $(window).on('scroll', function() { 3352 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 3353 if (bodyTop == 0) { 3354 $('ul.onepage-pagination li a').removeClass('is-selected'); 3355 $('.onepage-pagination li a[data-index=0]').addClass('is-selected'); 3356 var getName = $('[data-section=0]').attr('data-name'); 3357 if (getName != undefined && getName !== '') { 3358 $.each($('.menu-container .menu-item > a'), function(i, val) { 3359 var get_href = $(val).attr('href'); 3360 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 3361 $(val).closest('ul').find('.active').removeClass('active'); 3362 $(val).parent().addClass('active'); 3363 } 3364 }); 3365 } 3366 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 3367 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 3368 if (lastSection.length) { 3369 $('ul.onepage-pagination li a').removeClass('is-selected'); 3370 lastSection.addClass('is-selected'); 3371 } 3372 } 3373 }); 3374 } 3375 3376 var scrollBody = function(index) { 3377 $('ul.onepage-pagination li a').removeClass('is-selected'); 3378 $('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected'); 3379 3380 var getSection = $('[data-section=' + index + ']'), 3381 scrollTo; 3382 3383 if (getSection == undefined) return; 3384 3385 var body = $("html, body"), 3386 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 3387 delta = bodyTop - ($('[data-section=' + index + ']').length ? $('[data-section=' + index + ']').offset().top : 0), 3388 getOffset = UNCODE.get_scroll_offset(index); 3389 if ( typeof getSection.offset() === 'undefined' ) 3390 return; 3391 scrollTo = getSection.offset().top; 3392 3393 3394 3395 var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; 3396 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { 3397 scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); 3398 } 3399 3400 if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { 3401 if ( index === 0 ) { 3402 scrollTo = 0; 3403 } else { 3404 scrollTo -= $('.menu-sticky .menu-container').outerHeight(); 3405 } 3406 } else { 3407 scrollTo -= getOffset; 3408 } 3409 3410 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 3411 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 3412 3413 if (index != 0) { 3414 UNCODE.scrolling = true; 3415 } 3416 3417 if (scrollSpeed == 0) { 3418 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 3419 UNCODE.scrolling = false;
3420 } else { 3421 body.animate({ 3422 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 3423 }, scrollSpeed, 'easeInOutQuad', function() { 3424 requestTimeout(function(){ 3425 UNCODE.scrolling = false; 3426 if (getOffset != UNCODE.get_scroll_offset(index)) { 3427 scrollBody(index); 3428 } 3429 }, 100); 3430 }); 3431 } 3432 3433 }; 3434 3435 init_onepage(); 3436}; 3437 3438UNCODE.stickyElements = function() { 3439 var isMobile_wide = UNCODE.isMobile && UNCODE.wwidth < 1024; 3440 if (!isMobile_wide) { 3441 3442 var $pageHeader = $('#page-header'), 3443 $headerRow = $('.vc_row', $pageHeader), 3444 startSticky = false; 3445 3446 if ( $headerRow.hasClass('sticky-element') ) { 3447 $headerRow.removeClass('sticky-element'); 3448 $pageHeader.addClass('sticky-element'); 3449 startSticky = true; 3450 } 3451 3452 var calculateOffset = function(el) { 3453 var getRowPadding = (!$(el).hasClass('with-bg')) ? $(el).closest('.row-parent').css("padding-top") : 0, 3454 sideOffset = (getRowPadding != undefined && getRowPadding != 0) ? parseInt(getRowPadding.replace("px", "")) : 0, 3455 shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 0; 3456 3457 sideOffset += UNCODE.bodyBorder; 3458 3459 if (UNCODE.adminBarHeight > 0) sideOffset += UNCODE.adminBarHeight; 3460 if ($('.menu-sticky .menu-container:not(.menu-hide)').length && !$('.menu-wrapper .menu-transparent').length) { 3461 if ($('.menu-shrink').length) { 3462 sideOffset += parseFloat( $('.navbar-brand').data('minheight') ) + shrink; 3463 } else { 3464 sideOffset += ($('body.hmenu-center').length ? $('#masthead .menu-container').outerHeight() : parseInt(UNCODE.menuMobileHeight)); 3465 } 3466 } 3467 3468 return sideOffset; 3469 3470 }, 3471 3472 initStickyElement = function() { 3473 $.each($('.sticky-element'), function(index, element) { 3474 $(element).stick_in_parent({ 3475 sticky_class: 'is_stucked', 3476 offset_top: calculateOffset(element), 3477 bottoming: true, 3478 inner_scrolling: SiteParameters.sticky_elements === 'on' 3479 }); 3480 }); 3481 }; 3482 3483 requestTimeout(function() { 3484 if ($('.sticky-element').length) { 3485 3486 if ($(window).width() > UNCODE.mediaQuery) { 3487 initStickyElement(); 3488 3489 if ( startSticky === true ) { 3490 $('#page-header').trigger('sticky_kit:recalc'); 3491 } 3492 } 3493 3494 $(window).on('resize', function(event) { 3495 if ($(window).width() > UNCODE.mediaQuery) { 3496 initStickyElement(); 3497 } else { 3498 $(".sticky-element").trigger("sticky_kit:detach"); 3499 } 3500 }); 3501 } 3502 }, 1000); 3503 3504 var $panels = $('.panel-collapse'); 3505 if ( $panels.length ) { 3506 $panels.each(function(){ 3507 var $panel = $(this); 3508 $panel.on('shown.bs.collapse hidden.bs.collapse', function(){ 3509 $(document.body).trigger("sticky_kit:recalc"); 3510 }); 3511 }); 3512 } 3513 } 3514}; 3515 3516UNCODE.twentytwenty = function() { 3517 3518 if (!$('.twentytwenty-container').length) return; 3519 3520 // jquery.event.move 3521 // 3522 // 1.3.6 3523 // 3524 // Stephen Band 3525 // 3526 // Triggers 'movestart', 'move' and 'moveend' events after 3527 // mousemoves following a mousedown cross a distance threshold, 3528 // similar to the native 'dragstart', 'drag' and 'dragend' events. 3529 // Move events are throttled to animation frames. Move event objects 3530 // have the properties: 3531 // 3532 // pageX: 3533 // pageY: Page coordinates of pointer. 3534 // startX: 3535 // startY: Page coordinates of pointer at movestart. 3536 // distX: 3537 // distY: Distance the pointer has moved since movestart. 3538 // deltaX: 3539 // deltaY: Distance the finger has moved since last event. 3540 // velocityX: 3541 // velocityY: Average velocity over last few events. 3542 3543 3544 (function (module) { 3545 if (typeof define === 'function' && define.amd) { 3546 // AMD. Register as an anonymous module. 3547 define(['jquery'], module); 3548 } else { 3549 // Browser globals 3550 module(jQuery); 3551 } 3552 })(function(jQuery, undefined){ 3553 3554 var // Number of pixels a pressed pointer travels before movestart 3555 // event is fired. 3556 threshold = 6, 3557 3558 add = jQuery.event.add, 3559 3560 remove = jQuery.event.remove, 3561 3562 // Just sugar, so we can have arguments in the same order as 3563 // add and remove. 3564 trigger = function(node, type, data) { 3565 jQuery.event.trigger(type, data, node); 3566 }, 3567 3568 // Shim for requestAnimationFrame, falling back to timer. See: 3569 // see http://paulirish.com/2011/requestanimationframe-for-smart-animating/ 3570 requestFrame = (function(){ 3571 return ( 3572 window.requestAnimationFrame || 3573 window.webkitRequestAnimationFrame || 3574 window.mozRequestAnimationFrame || 3575 window.oRequestAnimationFrame || 3576 window.msRequestAnimationFrame || 3577 function(fn, element){ 3578 return window.setTimeout(function(){ 3579 fn(); 3580 }, 25); 3581 } 3582 ); 3583 })(), 3584 3585 ignoreTags = { 3586 textarea: true, 3587 input: true, 3588 select: true, 3589 button: true 3590 }, 3591 3592 mouseevents = { 3593 move: 'mousemove', 3594 cancel: 'mouseup dragstart', 3595 end: 'mouseup' 3596 }, 3597 3598 touchevents = { 3599 move: 'touchmove', 3600 cancel: 'touchend', 3601 end: 'touchend' 3602 }; 3603 3604 3605 // Constructors 3606 3607 function Timer(fn){ 3608 var callback = fn, 3609 active = false, 3610 running = false;
3611 3612 function trigger(time) { 3613 if (active){ 3614 callback(); 3615 requestFrame(trigger); 3616 running = true; 3617 active = false; 3618 } 3619 else { 3620 running = false; 3621 } 3622 } 3623 3624 this.kick = function(fn) { 3625 active = true; 3626 if (!running) { trigger(); } 3627 }; 3628 3629 this.end = function(fn) { 3630 var cb = callback; 3631 3632 if (!fn) { return; } 3633 3634 // If the timer is not running, simply call the end callback. 3635 if (!running) { 3636 fn(); 3637 } 3638 // If the timer is running, and has been kicked lately, then 3639 // queue up the current callback and the end callback, otherwise 3640 // just the end callback. 3641 else { 3642 callback = active ? 3643 function(){ cb(); fn(); } : 3644 fn ; 3645 3646 active = true; 3647 } 3648 }; 3649 } 3650 3651 3652 // Functions 3653 3654 function returnTrue() { 3655 return true; 3656 } 3657 3658 function returnFalse() { 3659 return false; 3660 } 3661 3662 function preventDefault(e) { 3663 e.preventDefault(); 3664 } 3665 3666 function preventIgnoreTags(e) { 3667 // Don't prevent interaction with form elements. 3668 if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; } 3669 3670 e.preventDefault(); 3671 } 3672 3673 function isLeftButton(e) { 3674 // Ignore mousedowns on any button other than the left (or primary) 3675 // mouse button, or when a modifier key is pressed. 3676 return (e.which === 1 && !e.ctrlKey && !e.altKey); 3677 } 3678 3679 function identifiedTouch(touchList, id) { 3680 var i, l; 3681 3682 if (touchList.identifiedTouch) { 3683 return touchList.identifiedTouch(id); 3684 } 3685 3686 // touchList.identifiedTouch() does not exist in 3687 // webkit yet… we must do the search ourselves... 3688 3689 i = -1; 3690 l = touchList.length; 3691 3692 while (++i < l) { 3693 if (touchList[i].identifier === id) { 3694 return touchList[i]; 3695 } 3696 } 3697 } 3698 3699 function changedTouch(e, event) { 3700 var touch = identifiedTouch(e.changedTouches, event.identifier); 3701 3702 // This isn't the touch you're looking for. 3703 if (!touch) { return; } 3704 3705 // Chrome Android (at least) includes touches that have not 3706 // changed in e.changedTouches. That's a bit annoying. Check 3707 // that this touch has changed. 3708 if (touch.pageX === event.pageX && touch.pageY === event.pageY) { return; } 3709 3710 return touch; 3711 } 3712 3713 3714 // Handlers that decide when the first movestart is triggered 3715 3716 function mousedown(e){ 3717 var data; 3718 3719 if (!isLeftButton(e)) { return; } 3720 3721 data = { 3722 target: e.target, 3723 startX: e.pageX, 3724 startY: e.pageY, 3725 timeStamp: e.timeStamp 3726 }; 3727 3728 add(document, mouseevents.move, mousemove, data); 3729 add(document, mouseevents.cancel, mouseend, data); 3730 } 3731 3732 function mousemove(e){ 3733 var data = e.data; 3734 3735 checkThreshold(e, data, e, removeMouse); 3736 } 3737 3738 function mouseend(e) { 3739 removeMouse(); 3740 } 3741 3742 function removeMouse() { 3743 remove(document, mouseevents.move, mousemove); 3744 remove(document, mouseevents.cancel, mouseend); 3745 } 3746 3747 function touchstart(e) { 3748 var touch, template; 3749 3750 // Don't get in the way of interaction with form elements. 3751 if (ignoreTags[ e.target.tagName.toLowerCase() ]) { return; } 3752 3753 touch = e.changedTouches[0]; 3754 3755 // iOS live updates the touch objects whereas Android gives us copies. 3756 // That means we can't trust the touchstart object to stay the same, 3757 // so we must copy the data. This object acts as a template for 3758 // movestart, move and moveend event objects. 3759 template = { 3760 target: touch.target, 3761 startX: touch.pageX, 3762 startY: touch.pageY, 3763 timeStamp: e.timeStamp, 3764 identifier: touch.identifier 3765 }; 3766 3767 // Use the touch identifier as a namespace, so that we can later 3768 // remove handlers pertaining only to this touch. 3769 add(document, touchevents.move + '.' + touch.identifier, touchmove, template); 3770 add(document, touchevents.cancel + '.' + touch.identifier, touchend, template); 3771 } 3772 3773 function touchmove(e){ 3774 var data = e.data, 3775 touch = changedTouch(e, data); 3776 3777 if (!touch) { return; } 3778 3779 checkThreshold(e, data, touch, removeTouch); 3780 } 3781 3782 function touchend(e) { 3783 var template = e.data, 3784 touch = identifiedTouch(e.changedTouches, template.identifier); 3785 3786 if (!touch) { return; } 3787 3788 removeTouch(template.identifier); 3789 } 3790 3791 function removeTouch(identifier) { 3792 remove(document, '.' + identifier, touchmove); 3793 remove(document, '.' + identifier, touchend); 3794 } 3795 3796 3797 // Logic for deciding when to trigger a movestart. 3798 3799 function checkThreshold(e, template, touch, fn) { 3800 var distX = touch.pageX - template.startX, 3801 distY = touch.pageY - template.startY; 3802
3803 // Do nothing if the threshold has not been crossed. 3804 if ((distX * distX) + (distY * distY) < (threshold * threshold)) { return; } 3805 3806 triggerStart(e, template, touch, distX, distY, fn); 3807 } 3808 3809 function handled() { 3810 // this._handled should return false once, and after return true. 3811 this._handled = returnTrue; 3812 return false; 3813 } 3814 3815 function flagAsHandled(e) { 3816 e._handled(); 3817 } 3818 3819 function triggerStart(e, template, touch, distX, distY, fn) { 3820 var node = template.target, 3821 touches, time; 3822 3823 touches = e.targetTouches; 3824 time = e.timeStamp - template.timeStamp; 3825 3826 // Create a movestart object with some special properties that 3827 // are passed only to the movestart handlers. 3828 template.type = 'movestart'; 3829 template.distX = distX; 3830 template.distY = distY; 3831 template.deltaX = distX; 3832 template.deltaY = distY; 3833 template.pageX = touch.pageX; 3834 template.pageY = touch.pageY; 3835 template.velocityX = distX / time; 3836 template.velocityY = distY / time; 3837 template.targetTouches = touches; 3838 template.finger = touches ? 3839 touches.length : 3840 1 ; 3841 3842 // The _handled method is fired to tell the default movestart 3843 // handler that one of the move events is bound. 3844 template._handled = handled; 3845 3846 // Pass the touchmove event so it can be prevented if or when 3847 // movestart is handled. 3848 template._preventTouchmoveDefault = function() { 3849 e.preventDefault(); 3850 }; 3851 3852 // Trigger the movestart event. 3853 trigger(template.target, template); 3854 3855 // Unbind handlers that tracked the touch or mouse up till now. 3856 fn(template.identifier); 3857 } 3858 3859 3860 // Handlers that control what happens following a movestart 3861 3862 function activeMousemove(e) { 3863 var timer = e.data.timer; 3864 3865 e.data.touch = e; 3866 e.data.timeStamp = e.timeStamp; 3867 timer.kick(); 3868 } 3869 3870 function activeMouseend(e) { 3871 var event = e.data.event, 3872 timer = e.data.timer; 3873 3874 removeActiveMouse(); 3875 3876 endEvent(event, timer, function() { 3877 // Unbind the click suppressor, waiting until after mouseup 3878 // has been handled. 3879 setTimeout(function(){ 3880 remove(event.target, 'click', returnFalse); 3881 }, 0); 3882 }); 3883 } 3884 3885 function removeActiveMouse(event) { 3886 remove(document, mouseevents.move, activeMousemove); 3887 remove(document, mouseevents.end, activeMouseend); 3888 } 3889 3890 function activeTouchmove(e) { 3891 var event = e.data.event, 3892 timer = e.data.timer, 3893 touch = changedTouch(e, event); 3894 3895 if (!touch) { return; } 3896 3897 // Stop the interface from gesturing 3898 e.preventDefault(); 3899 3900 event.targetTouches = e.targetTouches; 3901 e.data.touch = touch; 3902 e.data.timeStamp = e.timeStamp; 3903 timer.kick(); 3904 } 3905 3906 function activeTouchend(e) { 3907 var event = e.data.event, 3908 timer = e.data.timer, 3909 touch = identifiedTouch(e.changedTouches, event.identifier); 3910 3911 // This isn't the touch you're looking for. 3912 if (!touch) { return; } 3913 3914 removeActiveTouch(event); 3915 endEvent(event, timer); 3916 } 3917 3918 function removeActiveTouch(event) { 3919 remove(document, '.' + event.identifier, activeTouchmove); 3920 remove(document, '.' + event.identifier, activeTouchend); 3921 } 3922 3923 3924 // Logic for triggering move and moveend events 3925 3926 function updateEvent(event, touch, timeStamp, timer) { 3927 var time = timeStamp - event.timeStamp; 3928 3929 event.type = 'move'; 3930 event.distX = touch.pageX - event.startX; 3931 event.distY = touch.pageY - event.startY; 3932 event.deltaX = touch.pageX - event.pageX; 3933 event.deltaY = touch.pageY - event.pageY; 3934 3935 // Average the velocity of the last few events using a decay 3936 // curve to even out spurious jumps in values. 3937 event.velocityX = 0.3 * event.velocityX + 0.7 * event.deltaX / time; 3938 event.velocityY = 0.3 * event.velocityY + 0.7 * event.deltaY / time; 3939 event.pageX = touch.pageX; 3940 event.pageY = touch.pageY; 3941 } 3942 3943 function endEvent(event, timer, fn) { 3944 timer.end(function(){ 3945 event.type = 'moveend'; 3946 3947 trigger(event.target, event); 3948 3949 return fn && fn(); 3950 }); 3951 } 3952 3953 3954 // jQuery special event definition 3955 3956 function setup(data, namespaces, eventHandle) { 3957 // Stop the node from being dragged 3958 //add(this, 'dragstart.move drag.move', preventDefault); 3959 3960 // Prevent text selection and touch interface scrolling 3961 //add(this, 'mousedown.move', preventIgnoreTags); 3962 3963 // Tell movestart default handler that we've handled this 3964 add(this, 'movestart.move', flagAsHandled); 3965 3966 // Don't bind to the DOM. For speed. 3967 return true; 3968 } 3969 3970 function teardown(namespaces) { 3971 remove(this, 'dragstart drag', preventDefault); 3972 remove(this, 'mousedown touchstart', preventIgnoreTags); 3973 remove(this, 'movestart', flagAsHandled); 3974 3975 // Don't bind to the DOM. For speed. 3976 return true; 3977 } 3978 3979 function addMethod(handleObj) { 3980 // We're not interested in preventing defaults for handlers that 3981 // come from internal move or moveend bindings 3982 if (handleObj.namespace === "move" || handleObj.namespace === "moveend") { 3983 return; 3984 } 3985 3986 // Stop the node from being dragged 3987 add(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid, preventDefault, undefined, handleObj.selector); 3988 3989 // Prevent text selection and touch interface scrolling 3990 add(this, 'mousedown.' + handleObj.guid, preventIgnoreTags, undefined, handleObj.selector); 3991 } 3992 3993 function removeMethod(handleObj) { 3994 if (handleObj.namespace === "move" || handleObj.namespace === "moveend") { 3995 return; 3996 } 3997 3998 remove(this, 'dragstart.' + handleObj.guid + ' drag.' + handleObj.guid); 3999 remove(this, 'mousedown.' + handleObj.guid); 4000 } 4001 4002 jQuery.event.special.movestart = { 4003 setup: setup, 4004 teardown: teardown, 4005 add: addMethod, 4006 remove: removeMethod, 4007 4008 _default: function(e) { 4009 var event, data; 4010 4011 // If no move events were bound to any ancestors of this 4012 // target, high tail it out of here. 4013 if (!e._handled()) { return; } 4014 4015 function update(time) { 4016 updateEvent(event, data.touch, data.timeStamp); 4017 trigger(e.target, event); 4018 } 4019 4020 event = { 4021 target: e.target, 4022 startX: e.startX, 4023 startY: e.startY, 4024 pageX: e.pageX, 4025 pageY: e.pageY, 4026 distX: e.distX, 4027 distY: e.distY, 4028 deltaX: e.deltaX, 4029 deltaY: e.deltaY, 4030 velocityX: e.velocityX, 4031 velocityY: e.velocityY, 4032 timeStamp: e.timeStamp, 4033 identifier: e.identifier, 4034 targetTouches: e.targetTouches, 4035 finger: e.finger 4036 }; 4037 4038 data = { 4039 event: event, 4040 timer: new Timer(update), 4041 touch: undefined, 4042 timeStamp: undefined 4043 }; 4044 4045 if (e.identifier === undefined) { 4046 // We're dealing with a mouse 4047 // Stop clicks from propagating during a move 4048 add(e.target, 'click', returnFalse); 4049 add(document, mouseevents.move, activeMousemove, data); 4050 add(document, mouseevents.end, activeMouseend, data); 4051 } 4052 else { 4053 // We're dealing with a touch. Stop touchmove doing 4054 // anything defaulty. 4055 e._preventTouchmoveDefault(); 4056 add(document, touchevents.move + '.' + e.identifier, activeTouchmove, data); 4057 add(document, touchevents.end + '.' + e.identifier, activeTouchend, data); 4058 } 4059 } 4060 }; 4061 4062 jQuery.event.special.move = { 4063 setup: function() { 4064 // Bind a noop to movestart. Why? It's the movestart 4065 // setup that decides whether other move events are fired. 4066 add(this, 'movestart.move', jQuery.noop); 4067 }, 4068 4069 teardown: function() { 4070 remove(this, 'movestart.move', jQuery.noop); 4071 } 4072 }; 4073 4074 jQuery.event.special.moveend = { 4075 setup: function() { 4076 // Bind a noop to movestart. Why? It's the movestart 4077 // setup that decides whether other move events are fired. 4078 add(this, 'movestart.moveend', jQuery.noop); 4079 }, 4080 4081 teardown: function() { 4082 remove(this, 'movestart.moveend', jQuery.noop); 4083 } 4084 }; 4085 4086 add(document, 'mousedown.move', mousedown); 4087 add(document, 'touchstart.move', touchstart); 4088 4089 // Make jQuery copy touch event properties over to the jQuery event 4090 // object, if they are not already listed. But only do the ones we 4091 // really need. IE7/8 do not have Array#indexOf(), but nor do they 4092 // have touch events, so let's assume we can ignore them. 4093 if (typeof Array.prototype.indexOf === 'function') { 4094 (function(jQuery, undefined){ 4095 var props = ["changedTouches", "targetTouches"], 4096 l = props.length; 4097 4098 while (l--) { 4099 if (jQuery.event.props.indexOf(props[l]) === -1) { 4100 jQuery.event.props.push(props[l]); 4101 } 4102 } 4103 })(jQuery); 4104 }; 4105 }); 4106 4107 $.fn.twentytwenty = function() { 4108 return this.each(function() { 4109 4110 var sliderPct = 0.5; 4111 var container = $(this); 4112 4113 container.wrap("<div class='twentytwenty-wrapper twentytwenty-horizontal'></div>"); 4114 container.append("<div class='twentytwenty-overlay'></div>"); 4115 var beforeImg = container.find("img:first"); 4116 var afterImg = container.find("img:last"); 4117 container.append("<div class='twentytwenty-handle style-accent-bg border-accent-color'></div>"); 4118 var slider = container.find(".twentytwenty-handle"); 4119 slider.append("<span class='twentytwenty-left-arrow'></span>"); 4120 slider.append("<span class='twentytwenty-right-arrow'></span>"); 4121 container.addClass("twentytwenty-container"); 4122 beforeImg.addClass("twentytwenty-before"); 4123 afterImg.addClass("twentytwenty-after"); 4124
4125 var overlay = container.find(".twentytwenty-overlay"); 4126 overlay.append("<div class='twentytwenty-before-label'></div>"); 4127 overlay.append("<div class='twentytwenty-after-label'></div>"); 4128 4129 var calcOffset = function(dimensionPct) { 4130 var w = beforeImg.width(); 4131 var h = beforeImg.height(); 4132 return { 4133 w: w+"px", 4134 h: h+"px", 4135 cw: (dimensionPct*w)+"px", 4136 ch: (dimensionPct*h)+"px" 4137 }; 4138 }; 4139 4140 var adjustContainer = function(offset) { 4141 beforeImg.css("clip", "rect(0,"+offset.cw+","+offset.h+",0)"); 4142 container.css("height", offset.h); 4143 }; 4144 4145 var adjustSlider = function(pct) { 4146 var offset = calcOffset(pct); 4147 slider.css("left", offset.cw); 4148 adjustContainer(offset); 4149 } 4150 4151 var offsetX = 0, 4152 offsetY = 0, 4153 imgWidth = 0, 4154 imgHeight = 0; 4155 4156 slider.on("movestart", function(e) { 4157 if (((e.distX > e.distY && e.distX < -e.distY) || (e.distX < e.distY && e.distX > -e.distY))) { 4158 e.preventDefault(); 4159 } 4160 container.addClass("active"); 4161 offsetX = container.offset().left; 4162 offsetY = container.offset().top; 4163 imgWidth = beforeImg.width(); 4164 imgHeight = beforeImg.height(); 4165 }); 4166 4167 slider.on("moveend", function(e) { 4168 container.removeClass("active"); 4169 }); 4170 4171 slider.on("move", function(e) { 4172 if (container.hasClass("active")) { 4173 sliderPct = (e.pageX-offsetX)/imgWidth; 4174 if (sliderPct < 0) { 4175 sliderPct = 0; 4176 } 4177 if (sliderPct > 1) { 4178 sliderPct = 1; 4179 } 4180 adjustSlider(sliderPct); 4181 } 4182 }); 4183 4184 container.find("img").on("mousedown", function(event) { 4185 event.preventDefault(); 4186 }); 4187 4188 adjustSlider(sliderPct); 4189 4190 $(window).on("resize", function(e) { 4191 adjustSlider(sliderPct); 4192 }); 4193 }); 4194 }; 4195 4196 $(window).on("load", function(e) { 4197 $('.twentytwenty-container').twentytwenty(); 4198 }); 4199} 4200 4201UNCODE.justifiedGallery = function() { 4202 4203 var breakPointMe = function( val ) { 4204 val = parseInt( val ); 4205 if ( isNaN(val) ) { 4206 return false; 4207 } 4208 if ( val >= 1500 ) { 4209 return 1; 4210 } else if ( val < 1500 && val >= 960 ) { 4211 return 2; 4212 } else if ( val < 960 && val >= 570 ) { 4213 return 3; 4214 } else if ( val < 570 ) { 4215 return 4; 4216 } 4217 } 4218 4219 var gutterByBreakpoint = function( bp, gutter ) { 4220 var ret; 4221 switch(gutter) { 4222 case 'no-gutter': 4223 ret = 0; 4224 break; 4225 case 'px-gutter': 4226 ret = 1; 4227 break; 4228 case 'half-gutter': 4229 ret = 18; 4230 break; 4231 case 'double-gutter': 4232 switch(bp) { 4233 case 3: 4234 case 4: 4235 ret = 36; 4236 break; 4237 default: 4238 ret = 72; 4239 break; 4240 } 4241 break; 4242 case 'triple-gutter': 4243 switch(bp) { 4244 case 3: 4245 case 4: 4246 ret = 36; 4247 break; 4248 default: 4249 ret = 108; 4250 break; 4251 } 4252 break; 4253 case 'quad-gutter': 4254 switch(bp) { 4255 case 2: 4256 ret = 108; 4257 break; 4258 case 3: 4259 ret = 72; 4260 break; 4261 case 4: 4262 ret = 36; 4263 break; 4264 default: 4265 ret = 144; 4266 break; 4267 } 4268 break; 4269 default: 4270 ret = 36;//single-gutter 4271 } 4272 return ret; 4273 } 4274 4275 if ($('.justified-layout').length > 0) { 4276 var justifiedContainersArray = [], 4277 typeGridArray = [], 4278 layoutGridArray = [], 4279 transitionDuration = [], 4280 $filterItems = [], 4281 $filters = $('.justified-system .isotope-filters'), 4282 $itemSelector = '.tmb', 4283 $items, 4284 itemMargin, 4285 correctionFactor = 0, 4286 firstLoad = true, 4287 isOriginLeft = $('body').hasClass('rtl') ? false : true, 4288 prevW = breakPointMe(UNCODE.wwidth); 4289 $('[class*="justified-container"]').each(function() { 4290 var isoData = $(this).data(); 4291 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 4292 if (isoData.type == 'metro') typeGridArray.push(true); 4293 else typeGridArray.push(false); 4294 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 4295 else layoutGridArray.push('justified'); 4296 justifiedContainersArray.push($(this)); 4297 }); 4298 var init_justifiedGallery = function() { 4299 for (var i = 0, len = justifiedContainersArray.length; i < len; i++) { 4300 var justifiedSystem = $(justifiedContainersArray[i]).closest($('.justified-system')), 4301 justifiedId = justifiedSystem.attr('id'), 4302 $layoutMode = layoutGridArray[i], 4303 gutter = $(justifiedContainersArray[i]).data('gutter'), 4304 rowHeight = $(justifiedContainersArray[i]).data('row-height'), 4305 maxRowHeight = $(justifiedContainersArray[i]).data('max-row-height'), 4306 lastRow = $(justifiedContainersArray[i]).data('last-row'), 4307 margins; 4308 4309 rowHeight = typeof rowHeight === 'undefined' || rowHeight === '' ? 250 : parseFloat(rowHeight); 4310 maxRowHeight = typeof maxRowHeight === 'undefined' || maxRowHeight === '' ? false : parseFloat(maxRowHeight); 4311 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 4312 4313 margins = gutterByBreakpoint(prevW, gutter); 4314 4315 $(justifiedContainersArray[i]).justifiedGallery({ 4316 rowHeight: rowHeight,
4317 maxRowHeight: maxRowHeight, 4318 margins: margins, 4319 cssAnimation: true, 4320 lastRow: lastRow, 4321 waitThumbnailsLoad: false 4322 }).one('jg.complete', function(){ onLayout($(this), 0); } ); 4323 } 4324 }, 4325 onLayout = function(justifiedObj, startIndex) { 4326 justifiedObj.css('opacity', 1); 4327 justifiedObj.closest('.justified-system').find('.justified-footer').css('opacity', 1); 4328 $('.tmb', justifiedObj).addClass('justified-object-loaded'); 4329 4330 requestTimeout(function() { 4331 // window.dispatchEvent(UNCODE.boxEvent); 4332 UNCODE.adaptive(); 4333 if (SiteParameters.dynamic_srcset_active === '1') { 4334 UNCODE.refresh_dynamic_srcset_size(justifiedObj); 4335 } 4336 $(justifiedObj).find('audio,video').each(function() { 4337 $(this).mediaelementplayer({ 4338 pauseOtherPlayers: false, 4339 }); 4340 }); 4341 if ($(justifiedObj).find('.nested-carousel').length) { 4342 UNCODE.carousel($(justifiedObj).find('.nested-carousel')); 4343 requestTimeout(function() { 4344 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 4345 justifiedObj.addClass('justified-gallery-finished') 4346 Waypoint.refreshAll(); 4347 }, 200); 4348 } else { 4349 requestTimeout(function() { 4350 boxAnimation($('.tmb', justifiedObj), startIndex, true, justifiedObj); 4351 justifiedObj.addClass('justified-gallery-finished') 4352 Waypoint.refreshAll(); 4353 }, 300); 4354 } 4355 }, 100); 4356 4357 }, 4358 boxAnimation = function(items, startIndex, sequential, container) { 4359 var $allItems = items.length - startIndex, 4360 showed = 0, 4361 index = 0; 4362 if (container.closest('.owl-item').length == 1) return false; 4363 $.each(items, function(index, val) { 4364 var elInner = $('> .t-inside', val); 4365 if (UNCODE.isUnmodalOpen && !val.closest('#unmodal-content')) { 4366 return; 4367 } 4368 if (val[0]) val = val[0]; 4369 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 4370 new Waypoint({ 4371 context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 4372 element: val, 4373 handler: function() { 4374 var element = $('> .t-inside', this.element), 4375 parent = $(this.element), 4376 currentIndex = parent.index(); 4377 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 4378 delayAttr = parseInt(element.attr('data-delay')); 4379 if (isNaN(delayAttr)) delayAttr = 100; 4380 delay -= showed; 4381 var objTimeout = requestTimeout(function() { 4382 element.removeClass('zoom-reverse').addClass('start_animation'); 4383 showed = parent.index(); 4384 }, delay * delayAttr); 4385 parent.data('objTimeout', objTimeout); 4386 if (!UNCODE.isUnmodalOpen) { 4387 this.destroy(); 4388 } 4389 }, 4390 offset: '100%' 4391 }) 4392 } else { 4393 elInner.removeClass('animate_when_almost_visible'); 4394 $(val).addClass('no-waypoint-animation'); 4395 /*if (elInner.hasClass('force-anim')) { 4396 elInner.addClass('start_animation'); 4397 } else { 4398 elInner.css('opacity', 1); 4399 }*/ 4400 } 4401 index++; 4402 }); 4403 }; 4404 $filters.on('click', 'a[data-filter]', function(evt) { 4405 var $filter = $(this), 4406 filterContainer = $filter.closest('.isotope-filters'), 4407 filterValue = $filter.attr('data-filter'), 4408 container = $filter.closest('.justified-system').find($('.justified-layout')), 4409 lastRow = container.data('last-row'), 4410 transitionDuration = 0, 4411 delay = 300, 4412 filterItems = []; 4413 4414 lastRow = typeof lastRow === 'undefined' || lastRow === '' ? 'nojustify' : lastRow; 4415 4416 if (!$filter.hasClass('active')) { 4417 /** Scroll top with filtering */ 4418 if (filterContainer.hasClass('filter-scroll')) { 4419 var calc_scroll = container.closest('.uncol').offset().top, 4420 getFilterSpanPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span', filterContainer).css("padding-bottom") : 0, 4421 getFilterPadding = (!filterContainer.hasClass('with-bg')) ? $('.filter-show-all span a', filterContainer).css("padding-bottom") : 0, 4422 filterOffset = (getFilterSpanPadding != undefined && getFilterSpanPadding != 0) ? parseInt(getFilterSpanPadding.replace("px", "")) : 0; 4423 filterOffset += (getFilterPadding != undefined && getFilterPadding != 0) ? parseInt(getFilterPadding.replace("px", "")) : 0; 4424 4425 calc_scroll -= filterOffset - 1; 4426 calc_scroll -= UNCODE.get_scroll_offset(); 4427 4428 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4429 delta = bodyTop - calc_scroll, 4430 scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4431 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4432 4433 if ( !UNCODE.isFullPage ) { 4434 if (scrollSpeed == 0) { 4435 $('html, body').scrollTop(calc_scroll); 4436 UNCODE.scrolling = false;
4437 } else { 4438 $('html, body').animate({ 4439 scrollTop: calc_scroll 4440 },{ 4441 easing: 'easeInOutQuad', 4442 duration: scrollSpeed, 4443 complete: function(){ 4444 UNCODE.scrolling = false; 4445 } 4446 }); 4447 } 4448 } 4449 } 4450 if (filterValue !== undefined) { 4451 $.each($('> .tmb > .t-inside', container), function(index, val) { 4452 var parent = $(val).parent(), 4453 objTimeout = parent.data('objTimeout'); 4454 if (objTimeout) { 4455 $(val).removeClass('zoom-reverse'); 4456 clearRequestTimeout(objTimeout); 4457 } 4458 if (transitionDuration == 0) { 4459 if ($(val).hasClass('animate_when_almost_visible')) { 4460 $(val).addClass('zoom-reverse').removeClass('start_animation'); 4461 } else { 4462 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 4463 } 4464 } 4465 }); 4466 4467 requestTimeout(function() { 4468 var $block, 4469 selector, 4470 lightboxElements, 4471 $boxes; 4472 4473 if ( filterValue !== '' && filterValue !== '*' ) { 4474 $('[data-lbox^=ilightbox]', container).addClass('lb-disabled'); 4475 selector = '.' + filterValue; 4476 $.each($(selector, container), function(index, block) { 4477 lightboxElements = $('[data-lbox^=ilightbox]', block); 4478 if (lightboxElements.length) { 4479 lightboxElements.removeClass('lb-disabled'); 4480 container.data('lbox', $(lightboxElements[0]).data('lbox')); 4481 } 4482 filterItems.push(block); 4483 }); 4484 container.justifiedGallery({ 4485 filter: selector, 4486 lastRow: 'nojustify' 4487 }); 4488 } else { 4489 container.justifiedGallery({ 4490 filter: false, 4491 lastRow: lastRow 4492 }); 4493 $('[data-lbox^=ilightbox]', $block).removeClass('lb-disabled'); 4494 filterItems = $('> .tmb', container); 4495 } 4496 4497 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 4498 4499 var getLightbox = UNCODE.lightboxArray[container.data('lbox')]; 4500 if (typeof getLightbox === 'object') getLightbox.refresh(); 4501 4502 if (transitionDuration == 0) { 4503 requestTimeout(function() { 4504 boxAnimation(filterItems, 0, false, container); 4505 }, 100); 4506 } 4507 requestTimeout(function() { 4508 Waypoint.refreshAll(); 4509 }, 2000); 4510 4511 }, delay); 4512 } else { 4513 $.each($('> .tmb > .t-inside', container), function(index, val) { 4514 var parent = $(val).parent(), 4515 objTimeout = parent.data('objTimeout'); 4516 if (objTimeout) { 4517 $(val).removeClass('zoom-reverse').removeClass('start_animation') 4518 clearRequestTimeout(objTimeout); 4519 } 4520 if (transitionDuration == 0) { 4521 if ($(val).hasClass('animate_when_almost_visible')) { 4522 $(val).addClass('zoom-reverse').removeClass('start_animation'); 4523 } else { 4524 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 4525 } 4526 } 4527 }); 4528 container.parent().addClass('justified-loading'); 4529 } 4530 } 4531 evt.preventDefault(); 4532 }); 4533 4534 $filters.each(function(i, buttonGroup) { 4535 var $buttonGroup = $(buttonGroup); 4536 $buttonGroup.on('click', 'a', function() { 4537 $buttonGroup.find('.active').removeClass('active'); 4538 $(this).addClass('active'); 4539 }); 4540 }); 4541 window.addEventListener('boxResized', function(e) { 4542 if ( prevW !== breakPointMe(UNCODE.wwidth) ) { 4543 prevW = breakPointMe(UNCODE.wwidth); 4544 $.each($('.justified-layout'), function(index, val) { 4545 var gutter = $(this).data('gutter'), 4546 margins = gutterByBreakpoint( prevW, gutter); 4547 $(this).justifiedGallery({ 4548 margins: margins 4549 }); 4550 $(this).find('.mejs-video,.mejs-audio').each(function() { 4551 $(this).trigger('resize'); 4552 }); 4553 }); 4554 } 4555 }, false); 4556 4557 init_justifiedGallery(); 4558 }; 4559}; 4560 4561UNCODE.preventDoubleTransition = function() { 4562 $('.sticky-element .animate_when_almost_visible').each(function(){ 4563 var $el = $(this).one('webkitAnimationEnd mozAnimationEnd oAnimationEnd animationEnd', function(e){ 4564 $el.addClass('do_not_reanimate'); 4565 }); 4566 }); 4567}; 4568 4569UNCODE.checkScrollForTabs = function(){ 4570 var goToSection = window.location.hash.replace('#', ''), 4571 $index; 4572 4573 goToSection = goToSection.replace(/[^-A-Za-z0-9+&@#/%?=~_]/g, ""); 4574 goToSection = encodeURIComponent(goToSection); 4575 $index = $('[data-id="' + goToSection + '"]').closest('.uncode-tabs, .uncode-accordion'); 4576 4577 $index.attr('data-parent', 'parent-' + goToSection); 4578 4579 if (window.location.hash != undefined && window.location.hash != '') { 4580 requestTimeout(function() { 4581 scrollBody('parent-' + goToSection); 4582 }, 500); 4583 } 4584 4585 $('.page-body a[href*="#"]').not('[data-tab-history]').not('.scroll-top').click(function(e) { 4586 var hash = (e.currentTarget).hash, 4587 index = (e.currentTarget).closest('.uncode-tabs'); 4588 if ( $('.uncode-tabs a[href="' + hash + '"][data-tab-history]').length ) { 4589 $('a[href="' + hash + '"][data-tab-history]').click(); 4590 scrollBody(index); 4591 } 4592 }); 4593 4594 var scrollBody = function(index) { 4595 4596 var getSection = $('a[href="' + index + '"][data-tab-history]'), 4597 scrollTo; 4598 4599 if ( ! getSection.length ) { 4600 getSection = $('div[data-parent="' + index + '"]'); 4601 4602 if ( getSection.attr('data-target') == 'row' ) { 4603 getSection = getSection.closest('.vc_row'); 4604 } 4605 } 4606 4607 if (typeof getSection === 'undefined' || ! getSection.length ) { 4608 return; 4609 } 4610 4611 var body = $("html, body"), 4612 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 4613 delta = bodyTop - (getSection.length ? getSection.offset().top : 0), 4614 getOffset = UNCODE.get_scroll_offset(); 4615 if ( typeof getSection.offset() === 'undefined' ) 4616 return; 4617 scrollTo = getSection.offset().top - 27; 4618 scrollTo -= getOffset; 4619 4620 var scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; 4621 if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; 4622 4623 if (index != 0) { 4624 UNCODE.scrolling = true; 4625 } 4626 4627 if (scrollSpeed == 0) { 4628 body.scrollTop((delta > 0) ? scrollTo - 0.1 : scrollTo); 4629 UNCODE.scrolling = false;
4630 } else { 4631 body.animate({ 4632 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 4633 }, scrollSpeed, 'easeInOutQuad', function() { 4634 requestTimeout(function() { 4635 UNCODE.scrolling = false; 4636 if (getOffset != UNCODE.get_scroll_offset()) { 4637 scrollBody(index); 4638 } 4639 }, 100); 4640 }); 4641 } 4642 4643 }; 4644}; 4645 4646UNCODE.printScreen = function() { 4647 var inlineMediaStyle = null, 4648 setResize; 4649 4650 function changeMediaStyle() { 4651 clearRequestTimeout(setResize); 4652 setResize = requestTimeout(function(){ 4653 var $head = document.getElementsByTagName('head')[0], 4654 $newStyle = document.createElement('style'), 4655 winW = window.innerWidth, 4656 printH = window.innerHeight; 4657 4658 $newStyle.setAttribute('type', 'text/css'); 4659 $newStyle.setAttribute('media', 'print'); 4660 $newStyle.appendChild(document.createTextNode('@page { size: ' + winW + 'px ' + printH + 'px; margin: 0; }')); 4661 4662 if (inlineMediaStyle != null) { 4663 $head.replaceChild($newStyle, inlineMediaStyle) 4664 } else { 4665 $head.appendChild($newStyle); 4666 } 4667 inlineMediaStyle = $newStyle; 4668 }, 1000); 4669 } 4670 4671 changeMediaStyle(); 4672 window.addEventListener('resize', changeMediaStyle); 4673}; 4674 4675UNCODE.fullPage = function() { 4676 if ( ( !UNCODE.isFullPage && !UNCODE.isFullPageSnap ) || SiteParameters.is_frontend_editor ) { 4677 $('body').removeClass('uncode-fullpage').removeClass('uncode-fullpage-slide').removeClass('fp-waiting'); 4678 return false; 4679 } else { 4680 requestTimeout(function() { 4681 window.scrollTo(0, 0); 4682 }, 10); 4683 } 4684 4685 var $masthead = $('#masthead'), 4686 $logo = $('#logo-container-mobile'), 4687 $logolink = $('[data-minheight]', $logo), 4688 logoMinScale = $logolink.data('minheight'), 4689 logoMaxScale = $('[data-maxheight]', $logo).data('maxheight'), 4690 $mainWrapper = $('.main-wrapper')[0], 4691 $container = $('.main-container .post-content'), 4692 $mobileMenuWrapper = $('.menu-wrapper'), 4693 mobMenuPos, 4694 $rows = $container.find('.vc_row[data-parent]').addClass('uncode-scroll-lock fp-auto-height'), 4695 $header = $('#page-header').addClass('uncode-scroll-lock fp-auto-height'), 4696 headerName = $('.vc_row[data-name]', $header).attr('data-name'), 4697 headerLabel = $('.vc_row[data-label]', $header).attr('data-label'), 4698 headerWithOpacity = $('.header-scroll-opacity', $header).length, 4699 menuHidden = ! $('body').hasClass('vmenu') && $('body').hasClass('uncode-fp-menu-hide') ? true : false, 4700 menuHeight = $masthead.hasClass('menu-transparent') || menuHidden ? 0 : UNCODE.menuHeight, 4701 footerAdd = ( $('body').hasClass('hmenu') && $('body').hasClass('uncode-fp-menu-shrink') && !$masthead.hasClass('menu-transparent') ) ? -18 : 0, 4702 $footer = $('#colophon').addClass('uncode-scroll-lock fp-auto-height'), 4703 $scrollTop = $('.scroll-top'), 4704 scrollBar = true, 4705 effect, 4706 animationEndTimeOut, 4707 fp_anim_time = 900, 4708 fp_easing = 'cubic-bezier(0.37, 0.31, 0.2, 0.85)', 4709 is_scrolling = false, 4710 dataNames = [], 4711 is_first = true, 4712 no_history = $('body').hasClass('uncode-scroll-no-history'), 4713 theres_footer = true; 4714 4715 if ( $('> div', $footer).outerHeight() < 2 || !$footer.length ) { 4716 $('> div', $footer).each(function(index, el){ 4717 if ( $(el).outerHeight() < 2 ) 4718 theres_footer = false; 4719 else 4720 theres_footer = true; 4721 }); 4722 } 4723 4724 if ( !$footer.length ) 4725 theres_footer = false; 4726 4727 if ( !UNCODE.isFullPageSnap ) { 4728 /*if ( theres_footer ) 4729 $footer.css({ marginTop: ( menuHeight + footerAdd + UNCODE.bodyBorder ) * -1 })*/ 4730 4731 if ( $('body').hasClass('uncode-fullpage-zoom') ) 4732 effect = 'scaleDown'; 4733 else if ( $('body').hasClass('uncode-fullpage-parallax') ) 4734 effect = 'moveparallax'; 4735 else 4736 effect = 'movecurtain'; 4737 } 4738 4739 if ( $('body').hasClass('uncode-fullpage-trid') ) 4740 fp_anim_time = fp_anim_time*2; 4741 4742 if ( $header.length ) { 4743 if ( headerName !== '' ) 4744 $header.attr('data-name', headerName); 4745 if ( headerLabel !== '' ) 4746 $header.attr('data-label', headerLabel); 4747 $container.prepend($header); 4748 } 4749 if ( theres_footer ) { 4750 $container.append($footer); 4751 $footer.attr('data-anchor', SiteParameters.slide_footer).data('name', SiteParameters.slide_footer); 4752 $('aside.widget ul', $footer).addClass('no-list'); 4753 } 4754 4755 var $all = $rows.add($header); 4756 4757 if ( theres_footer ) 4758 $all = $all.add($footer); 4759 4760 $all.each(function(index, row) { 4761 if( index === 0 ) 4762 $(row).addClass('uncode-scroll-active'); 4763 }); 4764 4765 if ( !UNCODE.isMobile && !$('body').hasClass('uncode-scroll-no-dots') ) 4766 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 4767 4768 $all.each(function(index, val) { 4769 var getName = $(val).data('name'), 4770 label; 4771 4772 if (typeof getName == 'undefined' || getName == 'undefined') 4773 getName = SiteParameters.slide_name + '-' + index; 4774 4775 //if ( dataNames.includes(getName) ) { 4776 if ( dataNames.indexOf(getName) > 0 ) { 4777 getName += '_' + index; 4778 $(val).data('name', getName); 4779 } 4780 4781 dataNames.push(getName); 4782 4783 $(val).attr('data-section', (index+1)).attr('data-anchor', getName); 4784 4785 if (typeof $(val).attr('data-label') !== 'undefined') 4786 label = $(val).attr('data-label'); 4787 else label = ''; 4788 4789 if ( $(val).is($footer) ) 4790 return; 4791 4792 if (label != '' ) { 4793 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 4794 $('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>"); 4795 } else if ( label == '' && $('body').hasClass('uncode-empty-dots') ) { 4796 $('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>"); 4797 } 4798 4799 }); 4800 4801 var checkVisible = function( el, off ) { 4802 if (typeof jQuery === "function" && el instanceof jQuery) { 4803 el = el[0]; 4804 } 4805 4806 off = typeof off=='undefined' ? 50 : off; 4807 4808 var rect = el.getBoundingClientRect(); 4809 4810 return ( 4811 ( 4812 ( rect.top >= 0 && (rect.top + off) <= (window.innerHeight || document.documentElement.clientHeight) ) || 4813 ( rect.bottom >= off && (rect.bottom) <= (window.innerHeight || document.documentElement.clientHeight) ) || 4814 ( rect.top <= 0 && (rect.bottom) >= (window.innerHeight || document.documentElement.clientHeight) ) 4815 ) 4816 ); 4817 }; 4818 4819 var animationEndAction = function( index, nextIndex ) { 4820 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 4821 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 4822 player, iframe; 4823 4824 if ( !$nextSlide.is($footer) ) { 4825 $('.no-scrolloverflow').removeClass('no-scrolloverflow'); 4826 } 4827 4828 if ( !UNCODE.isFullPageSnap ) { 4829 activateKBurns( nextIndex ); 4830 } 4831 4832 $('body:not(.uncode-fullpage-zoom) .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 4833 if ($(this).attr('data-provider') == 'vimeo') { 4834 iframe = $(this).find('iframe'); 4835 player = $f(iframe[0]); 4836 player.api('pause'); 4837 } else if ($(this).attr('data-provider') == 'youtube') { 4838 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 4839 } else { 4840 if ($(this).is('video')) { 4841 $(this)[0].volume = 0; 4842 $(this)[0].pause(); 4843 } 4844 } 4845 }); 4846 4847 if ( ! UNCODE.isMobile && headerWithOpacity ) { 4848 if ( $nextSlide.is($header) ) 4849 $header.removeClass('header-scrolled'); 4850 } 4851 4852 var $otherEl = $('.uncode-scroll-lock:not(.hidden-scroll)', $container).not($nextSlide); 4853 $otherEl.each(function(){ 4854 var $otherThis = $(this), 4855 $bgwrapperOther = $('.background-inner', $otherThis); 4856 if ( !checkVisible($otherThis) ) 4857 $bgwrapperOther.removeClass('uncode-kburns').removeClass('uncode-zoomout'); 4858 4859 }); 4860 4861 if ( !checkVisible($currentSlide) ) { 4862 $currentSlide.removeClass('uncode-scroll-visible'); 4863 var currentScroll = $('.fp-scrollable', $currentSlide).data('iscrollInstance'); 4864 if ( typeof currentScroll != 'undefined' && !UNCODE.isFullPageSnap )
4865 currentScroll.scrollTo(0, 0, 0); 4866 } 4867 4868 clearRequestTimeout(animationEndTimeOut); 4869 animationEndTimeOut = requestTimeout(function(){ 4870 Waypoint.refreshAll(); 4871 $( document.body ).trigger('uncode_waypoints'); 4872 var eventFP = new CustomEvent('fp-slide-changed'); 4873 window.dispatchEvent(eventFP); 4874 is_scrolling = false; 4875 4876 if ( is_first ) { 4877 $('ul.onepage-pagination a').removeClass('is-selected'); 4878 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 4879 is_first = false; 4880 } 4881 4882 }, 500); 4883 }; 4884 4885 var postLeaveActions = function( nextIndex ){ 4886 if ( menuHidden && ! UNCODE.isMobile ) 4887 return false; 4888 4889 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 4890 $cols = $('.uncol', $el), 4891 anchor = $el.data('anchor'); 4892 4893 if ( ! UNCODE.isFullPageSnap ) { 4894 $.each($cols, function(index, val){ 4895 if ( $(val).hasClass('style-light') ){ 4896 $masthead.removeClass('style-dark-override').addClass('style-light-override'); 4897 return false; 4898 } else if ( $(val).hasClass('style-dark') ) { 4899 $masthead.removeClass('style-light-override').addClass('style-dark-override'); 4900 return false; 4901 } 4902 }); 4903 } 4904 4905 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href*="#' + anchor + '"]' ).length ) { 4906 $('.menu-item' ).removeClass('active'); 4907 $('.menu-item > a[href*="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 4908 } 4909 4910 if ( !UNCODE.isFullPageSnap ) { 4911 activateBackWash( nextIndex ); 4912 } 4913 }; 4914 4915 var activateBackWash = function( nextIndex ){ 4916 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 4917 $bgwrapper; 4918 4919 if ( $el.length ) { 4920 if ( $el.hasClass('with-zoomout') ) { 4921 $bgwrapper = $('.background-inner:nth-child(1)', $el); 4922 } else if ( $('.with-zoomout', $el).length ) { 4923 $bgwrapper = $('.with-zoomout .background-inner:nth-child(1)', $el); 4924 } else { 4925 return false; 4926 } 4927 } else { 4928 return false; 4929 } 4930 4931 $bgwrapper.addClass('uncode-zoomout'); 4932 4933 }; 4934 4935 var activateKBurns = function( nextIndex ){ 4936 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 4937 $bgwrapper; 4938 4939 if ( $el.length ) { 4940 if ( $el.hasClass('with-kburns') ) { 4941 $bgwrapper = $('.background-inner:nth-child(1)', $el); 4942 } else if ( $('.with-kburns', $el).length ) { 4943 $bgwrapper = $('.with-kburns .background-inner:nth-child(1)', $el); 4944 } else { 4945 return false; 4946 } 4947 } else { 4948 return false; 4949 } 4950 4951 $bgwrapper.addClass('uncode-kburns'); 4952 4953 }; 4954 4955 var activateParallax = function( nextIndex, direction ){ 4956 4957 var $el = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 4958 $cell = $('.fp-tableCell', $el), 4959 animationEnd = 'webkitAnimationEnd animationend', 4960 cellAnim; 4961 4962 switch( direction ) { 4963 case 'up': 4964 cellAnim = 'moveFromTopInner'; 4965 break; 4966 default: 4967 cellAnim = 'moveFromBottomInner'; 4968 } 4969 4970 $cell.css({ 4971 'animation-name': cellAnim, 4972 'animation-duration': fp_anim_time + 'ms', 4973 'animation-delay': '', 4974 'animation-timing-function': fp_easing, 4975 'animation-fill-mode': 'both', 4976 }).off(animationEnd) 4977 .on(animationEnd, function(event) { 4978 if ( event.originalEvent.animationName === cellAnim ) { 4979 $cell 4980 .css({ 4981 'animation-name': '', 4982 'animation-duration': '', 4983 'animation-delay': '', 4984 'animation-timing-function': '', 4985 'animation-fill-mode': '', 4986 }); 4987 } 4988 }); 4989 }; 4990 4991 var scrollHashes = function(){ 4992 var hash = window.location.hash.replace('#', '').split('/'), 4993 hashInd; 4994 if ( hash[0] !== '' && hash[0] !== SiteParameters.slide_footer ) { 4995 if ( $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').length ) { 4996 hashInd = $('.uncode-scroll-lock[data-anchor="' + hash[0] + '"]').index('[data-anchor]'); 4997 $.fn.fullpage.moveTo(hashInd+1); 4998 } 4999 } else if( hash[0] === '' ) { 5000 $.fn.fullpage.moveTo(1); 5001 } 5002 }; 5003 5004 var hideMenu = function( index, nextIndex ){ 5005 if ( $('body').hasClass('vmenu') || UNCODE.isFullPageSnap || !$('body').hasClass('uncode-fp-menu-hide') ) 5006 return false; 5007 5008 var hMenu = UNCODE.menuHeight, 5009 transTime = hMenu * 2; 5010 5011 if ( index === 1 && nextIndex > 1 ) { 5012 hMenu = hMenu * -1; 5013 } else if ( index !== 1 && nextIndex === 1 ) { 5014 hMenu = 0; 5015 } else { 5016 return false;
5017 } 5018 5019 $masthead.css({ 5020 '-webkit-transform': 'translate3d(0, ' + hMenu + 'px, 0)', 5021 'transform': 'translate3d(0, ' + hMenu + 'px, 0)', 5022 '-webkit-transition': 'transform 0.5s ease-in-out', 5023 'transition': 'transform 0.5s ease-in-out' 5024 }); 5025 }; 5026 5027 var shrinkMenu = function( index, nextIndex ){ 5028 if ( $('body').hasClass('vmenu') || !$('body').hasClass('uncode-fp-menu-shrink') ) 5029 return false; 5030 5031 if ( index === 1 && nextIndex > 1 ) { 5032 $logo.addClass('shrinked'); 5033 $('div', $logo).each(function(index, val){ 5034 $(val).css({ 5035 'height': logoMinScale, 5036 'line-height': logoMinScale 5037 }); 5038 if ($(val).hasClass('text-logo')) { 5039 $(val).css({ 5040 'font-size': logoMinScale + 'px' 5041 }); 5042 } 5043 }); 5044 requestTimeout(function() { 5045 UNCODE.menuMobileHeight = $masthead.outerHeight(); 5046 }, 300); 5047 } else if ( index !== 1 && nextIndex === 1 ) { 5048 $logo.removeClass('shrinked'); 5049 $('div', $logo).each(function(index, val){ 5050 $(val).css({ 5051 'height': logoMaxScale, 5052 'line-height': logoMaxScale 5053 }); 5054 if ($(val).hasClass('text-logo')) { 5055 $(val).css({ 5056 'font-size': logoMaxScale + 'px' 5057 }); 5058 } 5059 }); 5060 requestTimeout(function() { 5061 UNCODE.menuMobileHeight = $masthead.outerHeight(); 5062 }, 300); 5063 } else { 5064 return false; 5065 } 5066 5067 }; 5068 5069 var anchorLink = function(){ 5070 5071 $container.add('.menu-item').find('a[href*="#"]').click(function(e) { 5072 var $this = $(e.currentTarget), 5073 hash = e.currentTarget.href.split('#'), 5074 current = window.location.href.split('#'), 5075 ind, 5076 currentMenuOpened = UNCODE.menuOpened, 5077 go = false; 5078 5079 var hash_url = hash[0].replace(/\/?$/, '/'), 5080 current_url = current[0].replace(/\/?$/, '/'); 5081 5082 if ( ( hash_url == current_url || hash_url == '' ) && hash[1] != '' ) { 5083 hash = '#'+hash[1]; 5084 e.preventDefault(); 5085 go = true; 5086 } 5087 5088 if ( go ) { 5089 5090 if ( $(hash).length ) { 5091 ind = $(hash).closest('.fp-section').index(); 5092 } else { 5093 hash = hash.slice(1); 5094 ind = $('.fp-section[data-anchor="' + hash + '"]').index('.fp-section'); 5095 } 5096 5097 if ( typeof $this.attr('data-filter') !== 'undefined' && $this.attr('data-filter') != '' ) 5098 ind = $this.closest('.fp-section').index(); 5099 5100 UNCODE.menuOpened = false; 5101 5102 $.fn.fullpage.moveTo(ind+1); 5103 5104 UNCODE.menuOpened = currentMenuOpened; 5105 if (UNCODE.menuOpened) { 5106 if (UNCODE.wwidth < UNCODE.mediaQuery) { 5107 window.dispatchEvent(UNCODE.menuMobileTriggerEvent); 5108 } else { 5109 $('.mmb-container-overlay .overlay-close').trigger('click'); 5110 $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; 5111 } 5112 } 5113 5114 } 5115 5116 }); 5117 5118 $('.header-scrolldown').on('click', function(event) { 5119 event.preventDefault(); 5120 var scrollDown = $(this), 5121 ind = scrollDown.closest('.fp-section').index(); 5122 5123 $.fn.fullpage.moveTo(ind+2); 5124 }); 5125 5126 var anchor = $('.fp-section.active').data('anchor'); 5127 5128 if ( typeof anchor !== 'undefined' && anchor !== '' && $('.menu-item > a[href="#' + anchor + '"]' ).length ) { 5129 $('.menu-item').removeClass('active'); 5130 $('.menu-item > a[href="#' + anchor + '"]' ).closest('.menu-item').addClass('active'); 5131 } 5132 5133 }; 5134 5135 var slideLeave = function( index, nextIndex, direction ) { 5136 var $currentSlide = $('.uncode-scroll-lock[data-section="' + index + '"]', $container), 5137 $nextSlide = $('.uncode-scroll-lock[data-section="' + nextIndex + '"]', $container), 5138 animationEnd = 'webkitAnimationEnd animationend', 5139 transitionEnd = 'webkitTransitionEnd transitionend', 5140 animOut = effect != 'scaleDown' ? effect + direction : effect, 5141 animIn, 5142 animInDelay = effect == 'scaleDown' ? 0 : 0, 5143 isFooter = false, 5144 isFooterNext = false, 5145 isHeader = false, 5146 isHeaderNext = false, 5147 containerOff = $container.offset().top, 5148 footerH = $footer.outerHeight(), 5149 timeout, 5150 dataHash = $nextSlide.attr('data-anchor'), 5151 player, iframe, 5152 footerCoeff; 5153 switch( direction ) { 5154 case 'up': 5155 animIn = 'moveFromTop'; 5156 break; 5157 default: 5158 animIn = 'moveFromBottom'; 5159 } 5160 5161 if ( $('body').hasClass('uncode-fullpage-trid') ) { 5162 animOut = animIn + 'trid'; 5163 animIn = animOut + 'In'; 5164 } else if ( UNCODE.isFullPageSnap ) { 5165 animIn = animOut = 'none'; 5166 } 5167 5168 hideMenu(index, nextIndex); 5169 shrinkMenu(index, nextIndex); 5170 5171 $('.uncode-fullpage-zoom .background-video-shortcode, .uncode-video-container.video', $currentSlide).each(function(index, val) { 5172 if ($(this).attr('data-provider') == 'vimeo') { 5173 iframe = $(this).find('iframe'); 5174 player = $f(iframe[0]); 5175 player.api('pause'); 5176 } else if ($(this).attr('data-provider') == 'youtube') { 5177 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 5178 } else { 5179 if ($(this).is('video')) { 5180 $(this)[0].volume = 0; 5181 $(this)[0].pause(); 5182 } 5183 } 5184 }); 5185 5186 $('.background-video-shortcode, .uncode-video-container.video', $nextSlide).each(function(index, val) { 5187 if ($(this).attr('data-provider') == 'vimeo') { 5188 iframe = $(this).find('iframe'); 5189 player = $f(iframe[0]); 5190 player.api('play'); 5191 } else if ($(this).attr('data-provider') == 'youtube') { 5192 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 5193 } else { 5194 if ($(this).is('video')) { 5195 $(this)[0].volume = 0; 5196 $(this)[0].play(); 5197 } 5198 } 5199 }); 5200 5201 if ( $currentSlide.is($footer) ) 5202 isFooter = true; 5203 5204 if ( $nextSlide.is($footer) ) 5205 isFooterNext = true; 5206 5207 // if ( typeof dataHash && dataHash && !no_history && dataHash != SiteParameters.slide_footer ) 5208 // window.location.hash = '#' + dataHash; 5209 5210 if ( ! UNCODE.isMobile && headerWithOpacity ) { 5211 if ( $currentSlide.is($header) ) 5212 $header.addClass('header-scrolled'); 5213 } 5214 5215 footerCoeff = footerH; 5216 5217 if ( UNCODE.isFullPageSnap ) { 5218 postLeaveActions( nextIndex ); 5219 activateBackWash( nextIndex ); 5220 activateKBurns( nextIndex ); 5221 requestTimeout(function(){ 5222 animationEndAction( index, nextIndex ); 5223 }, fp_anim_time+150); 5224 } else { 5225 if ( isFooterNext ) { 5226 5227 var $iscrollWrapper = $currentSlide.find('.fp-scrollable'); 5228 $iscrollWrapper.addClass('no-scrolloverflow'); 5229 5230 $nextSlide 5231 .add($currentSlide) 5232 .addClass('uncode-scroll-front') 5233 .addClass('uncode-scroll-active') 5234 .addClass('uncode-scroll-visible'); 5235 $container.css({ 5236 '-webkit-transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 5237 'transform': 'translate3d(0, -' + ( footerCoeff ) + 'px, 0)', 5238 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5239 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5240 }).off(transitionEnd) 5241 .one(transitionEnd, function(){ 5242 animationEndAction( index, nextIndex ); 5243 }); 5244 5245 } else if ( isFooter ) { 5246 5247 $('.uncode-scroll-lock[data-section="' + (index-1) + '"]', $container) // so it is always the section above the footer to be animated first 5248 .add($currentSlide) 5249 .addClass('uncode-scroll-front') 5250 .addClass('uncode-scroll-active') 5251 .addClass('uncode-scroll-visible'); 5252 $container.css({ 5253 '-webkit-transform': 'translate3d(0, 0, 0)', 5254 'transform': 'translate3d(0, 0, 0)', 5255 '-webkit-transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5256 'transition': 'transform ' + (( footerCoeff )*2) + 'ms ' + fp_easing, 5257 }) 5258 .one(transitionEnd, function(){ 5259 if ( nextIndex !== index-1 ) { // if a bullet triggered a slide different than the one above the footer 5260 clearRequestTimeout(timeout); 5261 timeout = requestTimeout(function(){ 5262 $.fn.fullpage.moveTo(nextIndex); 5263 slideLeave( index-1, nextIndex, 'up' ); 5264 $container.off(transitionEnd); 5265 }, 50); 5266 } 5267 animationEndAction( index, nextIndex ); 5268 }); 5269 5270 } else { 5271 5272 postLeaveActions( nextIndex ); 5273 5274 if ( !$('body').hasClass('uncode-fullpage-trid') ) 5275 activateParallax( nextIndex, direction ); 5276 5277 var $outBg = $('.background-wrapper', $currentSlide); 5278 5279 $nextSlide 5280 .addClass('uncode-scroll-front') 5281 .addClass('uncode-scroll-active') 5282 .addClass('uncode-scroll-visible') 5283 .addClass('uncode-scroll-animating-in') 5284 .css({ 5285 'z-index':4, 5286 'animation-name': animIn, 5287 'animation-duration': fp_anim_time + 'ms', 5288 'animation-delay': '', 5289 'animation-timing-function': fp_easing, 5290 'animation-fill-mode': 'both', 5291 'transition': 'initial', 5292 }).off(animationEnd) 5293 .on(animationEnd, function(event) { 5294 if ( event.originalEvent.animationName === animIn ) { 5295 $(this) 5296 .addClass('uncode-scroll-already') 5297 .removeClass('uncode-scroll-front') 5298 .removeClass('uncode-scroll-animating-in') 5299 .css({ 5300 'animation-name': '', 5301 'animation-duration': '', 5302 'animation-delay': '', 5303 'animation-timing-function': '', 5304 'animation-fill-mode': '', 5305 'transition': 'initial', 5306 }); 5307 5308 $currentSlide 5309 .removeClass('uncode-scroll-active') 5310 .add($outBg) 5311 .css({ 5312 'animation-name': '', 5313 'animation-duration': '', 5314 'animation-delay': '', 5315 'animation-timing-function': '', 5316 'animation-fill-mode': '', 5317 'transition': 'initial', 5318 }); 5319 5320 animationEndAction( index, nextIndex ); 5321 5322 } 5323 5324 if ( nextIndex > 1 ) 5325 $('body').addClass('window-scrolled'); 5326 else 5327 $('body').removeClass('window-scrolled'); 5328 }); 5329 5330 $currentSlide 5331 .addClass('uncode-scroll-animating-out') 5332 .removeClass('uncode-scroll-front') 5333 .css({ 5334 'z-index':'1', 5335 'animation-name': animOut, 5336 'animation-duration': fp_anim_time + 'ms', 5337 'animation-delay': '', 5338 'animation-timing-function': fp_easing, 5339 'animation-fill-mode': 'both', 5340 'transition': 'initial', 5341 'will-change': 'auto' 5342 }).off(animationEnd) 5343 .on(animationEnd, function(event) { 5344 if ( event.originalEvent.animationName === animOut ) { 5345 $currentSlide.removeClass('uncode-scroll-animating-out'); 5346 } 5347 }); 5348 5349 if ( $('body').hasClass('uncode-fp-opacity') ) { 5350 $currentSlide.find('> div').css({ 5351 'animation-name': 'opacityout', 5352 'animation-duration': fp_anim_time + 'ms', 5353 'animation-delay': '', 5354 'animation-timing-function': fp_easing, 5355 'animation-fill-mode': 'both', 5356 'transition': 'initial', 5357 }).off(animationEnd) 5358 .on(animationEnd, function(event) { 5359 if ( event.originalEvent.animationName === 'opacityout' ) { 5360 $(event.currentTarget).css({ 5361 'animation-name': '', 5362 'animation-duration': '', 5363 'animation-delay': '', 5364 'animation-timing-function': '', 5365 'animation-fill-mode': '', 5366 'transition': '', 5367 }); 5368 } 5369 }); 5370 } 5371 } 5372 } 5373 5374 $('.scroll-top').on('click', function(e){ 5375 $.fn.fullpage.moveTo(1); 5376 return false;
5377 }); 5378 5379 }; 5380 5381 var setFPheight = function( height ){ 5382 var $body = document.body, 5383 $footer = document.getElementById('colophon'); 5384 $body.style.height = UNCODE.wheight + 'px'; 5385 if ( theres_footer ) { 5386 $footer.style.top = (height - menuHeight) + 'px'; 5387 } 5388 }; 5389 5390 var init_fullPage = function(mode){ 5391 5392 // if ( typeof mode !== 'undefined' && mode === 'mobile' ) { 5393 // scrollBar = false; 5394 // } 5395 5396 var checkFPeffects; 5397 5398 $container.fullpage({ 5399 sectionSelector: '.uncode-scroll-lock', 5400 scrollOverflow: true, 5401 scrollOverflowOptions: { 5402 click: false, 5403 preventDefaultException: { tagName:/.*/ } 5404 }, 5405 navigation: false, 5406 scrollBar: scrollBar, 5407 scrollingSpeed: fp_anim_time, 5408 verticalCentered: true, 5409 anchors: no_history ? false : dataNames, 5410 recordHistory: !no_history, 5411 afterRender: function( height ){ 5412 $('body').removeClass('fp-waiting'); 5413 $('.uncode-scroll-lock', $container).not(':visible').each(function(){ 5414 var $invisible = $(this).addClass('hidden-scroll');//, 5415 }); 5416 $('.uncode-scroll-lock.active', $container).filter(':visible').each(function(){ 5417 var $visible = $(this).addClass('uncode-scroll-visible'), 5418 visIndex = $visible.index('.uncode-scroll-lock:not(.hidden-scroll)'); 5419 $('ul.onepage-pagination a[data-index="' + visIndex + '"]').addClass('is-selected'); 5420 }); 5421 5422 $('ul.onepage-pagination a').on('click', function(e){ 5423 e.preventDefault(); 5424 var $a = $(this), 5425 toIndex = $a.data('index'); 5426 5427 $.fn.fullpage.moveTo(toIndex+1); 5428 }); 5429 5430 requestTimeout(function(){ 5431 scrollHashes(); 5432 }, 1000); 5433 5434 $(window).on('hashchange', function(e){ 5435 requestTimeout(function(){ 5436 scrollHashes(); 5437 }, 500); 5438 }); 5439 5440 anchorLink(); 5441 5442 if ( $('body').hasClass('uncode-fp-opacity') ) { 5443 $all.each(function(index, row) { 5444 var testmatch = $(row)[0].className.match(/\bstyle-.*?-bg\b/g, ''), 5445 classBg; 5446 5447 if ( typeof testmatch !== 'undefined' && testmatch !== null ) { 5448 classBg = testmatch[0]; 5449 $(row).removeClass(classBg).find('.fp-tableCell').addClass(classBg); 5450 } 5451 }); 5452 } 5453 5454 if ( !$('body').hasClass('vmenu') && !$('body').hasClass('menu-offcanvas') ) { 5455 $(window).on('menuOpen gdprOpen', function(){ 5456 $.fn.fullpage.setAutoScrolling(false); 5457 }).on('menuClose gdprClose', function(){ 5458 $.fn.fullpage.setAutoScrolling(true); 5459 }); 5460 } 5461 5462 $(window).on('menuMobileOpen menuCanvasOpen unmodal-open uncode-sidecart-open', function(){ 5463 requestTimeout(function(){ 5464 $.fn.fullpage.setAutoScrolling(false); 5465 }, 1000); 5466 }).on('menuMobileClose menuCanvasClose unmodal-close uncode-sidecart-closed', function(){ 5467 $.fn.fullpage.setAutoScrolling(true); 5468 }); 5469 5470 if ( !UNCODE.isFullPageSnap ) { 5471 clearRequestTimeout(checkFPeffects); 5472 checkFPeffects = requestTimeout(function(){ 5473 activateBackWash( 1 ); 5474 activateKBurns( 1 ); 5475 }, 100); 5476 } 5477 5478 setFPheight(height); 5479 }, 5480 onLeave: function( index, nextIndex, direction ){ 5481 5482 if ( UNCODE.menuOpened || is_scrolling ) 5483 return false; 5484 5485 is_scrolling = true; 5486 5487 var event = new CustomEvent('fp-slide-leave'); 5488 window.dispatchEvent(event); 5489 5490 slideLeave( index, nextIndex, direction ); 5491 5492 if ( $('.uncode-scroll-lock', $container).eq(nextIndex-1).hasClass('hidden-scroll') ) { 5493 if ( direction === 'up' ) { 5494 $.fn.fullpage.moveTo(nextIndex-1); 5495 } else { 5496 $.fn.fullpage.moveTo(nextIndex+1); 5497 } 5498 return false; 5499 } 5500 5501 $('ul.onepage-pagination a').removeClass('is-selected'); 5502 $('ul.onepage-pagination a[data-index="' + (nextIndex-1) + '"]').addClass('is-selected'); 5503 5504 }, 5505 afterResize: function( height ){ 5506 setFPheight(height); 5507 } 5508 }); 5509 }; 5510 5511 init_fullPage(); 5512 $(window).on('load', function(){ 5513 requestTimeout(function(){ 5514 $.fn.fullpage.reBuild(); 5515 }, 3000); 5516 }); 5517 5518 var addScrollingClass, 5519 removeScrollingClass; 5520 5521 window.addEventListener("fp-slide-scroll", function(){ 5522 addScrollingClass = requestTimeout( function(){ 5523 $('body').addClass('fp-slide-scrolling'); 5524 }, 10 ); 5525 5526 clearRequestTimeout(removeScrollingClass); 5527 removeScrollingClass = requestTimeout( function(){ 5528 $('body').removeClass('fp-slide-scrolling'); 5529 }, 150 ); 5530 5531 Waypoint.refreshAll(); 5532 }, false); 5533 5534}; 5535 5536UNCODE.particles = function() { 5537 $(".vc-particles-background").each(function() { 5538 var $particle = $(this); 5539 var $parent = $particle.closest('[data-parent]'); 5540
5541 $parent.prepend($particle); 5542 // $(window).trigger('resize'); 5543 }) 5544}; 5545 5546 5547UNCODE.filters = function() { 5548 var $isotopes = $('.isotope-system'); 5549 5550 $isotopes.each(function(index, val){ 5551 var $isotope = $(this), 5552 $widget_trgr = $('.uncode-woocommerce-toggle-widgetized-cb__link', $isotope), 5553 $widgets = $('.widgetized-cb-wrapper', $isotope), 5554 $sorting_trgr = $('.uncode-woocommerce-sorting__link', $isotope), 5555 $sorting_dd = $('.uncode-woocommerce-sorting-dropdown', $isotope), 5556 $cats_trigger = $('.menu-smart--filter-cats_mobile-toggle-trigger', $isotope), 5557 $cats_filters = $('.menu-smart--filter-cats-mobile-dropdown', $isotope); 5558 5559 if ($isotope.hasClass('isotope-processed')) { 5560 return; 5561 } 5562 5563 $cats_trigger.on('click', function(e) { 5564 if ( ! $('html').hasClass('screen-sm') ) { 5565 // $widgets.add($sorting_dd).slideUp(400); 5566 e.preventDefault(); 5567 $widgets.slideUp(400, 'easeInOutCirc'); 5568 } 5569 }); 5570 5571 $('.filters-toggle-trigger', $isotope).on('click', function(e) { 5572 e.preventDefault(); 5573 var $filters = $('.isotope-filters .menu-horizontal', $isotope); 5574 $filters.slideToggle(400, 'easeInOutCirc'); 5575 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 5576 }); 5577 5578 $widget_trgr.on('click', function(e) { 5579 e.preventDefault(); 5580 $widgets.slideToggle(400, 'easeInOutCirc'); 5581 if (!$('html').hasClass('screen-sm')) { 5582 $cats_filters.slideUp(400, 'easeInOutCirc'); 5583 } 5584 window.dispatchEvent(new CustomEvent('boxResized')); 5585 }); 5586 5587 $sorting_trgr.on('click', function(e) { 5588 e.preventDefault(); 5589 if (!$('html').hasClass('screen-sm')) { 5590 $widgets.add($cats_filters).slideUp(400, 'easeInOutCirc'); 5591 } 5592 }); 5593 5594 $isotope.addClass('isotope-processed'); 5595 }) 5596 5597}; 5598 5599UNCODE.widgets = function() { 5600 var widget_titles = $('.widget-mobile-collapse').find('.widget-title'); 5601 var widgets = widget_titles.closest('.widget'); 5602 5603 widgets.each(function() { 5604 var _this = $(this); 5605 var content = _this.children().not('.widget-title'); 5606 5607 if (_this.hasClass('widget-mobile-done')) { 5608 return; 5609 } 5610 5611 content.wrapAll( '<div class="widget-collapse-content"></div> '); 5612 _this.removeClass('collapse-init'); 5613 _this.addClass('widget-mobile-done'); 5614 }); 5615 5616 var widgets_without_title = $('.collapse-init'); 5617 5618 widgets_without_title.removeClass('collapse-init'); 5619 5620 widget_titles.on('click', function() { 5621 var _this = $(this); 5622 var content = _this.closest('.widget').find('.widget-collapse-content'); 5623 5624 // Get content of :after element (+ icon) to check the visibility 5625 var icon_content = window.getComputedStyle(_this[0], ':after').getPropertyValue('content'); 5626 5627 if (icon_content === 'none' || !icon_content) { 5628 return false; 5629 } 5630 5631 _this.toggleClass('open'); 5632 content.slideToggle(400, 'easeInOutCirc'); 5633 5634 return false; 5635 }); 5636}; 5637 5638UNCODE.unmodal = function() { 5639 $(document).off('click', '.open-unmodal').on('click', '.open-unmodal', function() { 5640 $('.unmodal-overlay').fadeIn(); 5641 $('.unmodal-overlay').addClass('loading'); 5642 $('body').addClass('uncode-unmodal-overlay-visible'); 5643 $(window).trigger('unmodal-open'); 5644 }); 5645 5646 $(document).off('click', '.unmodal-overlay').on('click', '.unmodal-overlay, .unmodal-close', function() { 5647 $('.unmodal-overlay').fadeOut(); 5648 $('.unmodal').fadeOut(); 5649 $('body').removeClass('uncode-unmodal-overlay-visible'); 5650 $('body').removeClass('uncode-unmodal-open'); 5651 $('html').removeClass('uncode-unmodal-body-disable-scroll'); 5652 $(document).trigger('unmodal-close'); 5653 UNCODE.isUnmodalOpen = false; 5654 }); 5655 5656 $(document).on('uncode-unmodal-show-content', function() { 5657 $('.unmodal-overlay').removeClass('loading'); 5658 $('.unmodal').show(); 5659 $('.unmodal').addClass('show-unmodal-with-animation'); 5660 $('.unmodal-content')[0].scrollTop = 0; 5661 $('body').addClass('uncode-unmodal-open'); 5662 UNCODE.isUnmodalOpen = true; 5663 5664 if ($('body').hasClass('qw-body-scroll-disabled')) { 5665 $('html').addClass('uncode-unmodal-body-disable-scroll'); 5666 } 5667 5668 if ($('.unmodal').hasClass('auto-height')) { 5669 set_modal_height(); 5670 } 5671 }); 5672 5673 var set_modal_height = function() { 5674 var modal = $('.unmodal'); 5675 var window_height = $(window).outerHeight(); 5676 var modal_height = modal.outerHeight(); 5677 5678 modal.css('height', 'auto'); 5679 5680 if (modal_height > window_height) { 5681 modal.outerHeight(window_height); 5682 } 5683 } 5684 5685 if ($('.unmodal').hasClass('auto-height')) { 5686 var setCTA; 5687 5688 $(window).on('resize', function() { 5689 clearRequestTimeout(setCTA); 5690 setCTA = requestTimeout(function() { 5691 set_modal_height(); 5692 }, 100); 5693 }); 5694 } 5695}; 5696 5697UNCODE.bgChanger = function() { 5698 var $bg_changers = $('.vc_row[data-bg-changer]:visible'), 5699 $bg_first = $('.vc_row[data-bg-remove]'), 5700 bg_remove = $bg_first.attr('data-bg-remove'), 5701 $first = $bg_changers.first(), 5702 $last = $bg_changers.last(), 5703 $bg_wrapper = $('#changer-back-color'), 5704 $bg_changings = $('div[data-bg-changing]', $bg_wrapper), 5705 setCTA, localH = UNCODE.wheight, 5706 isScrolling; 5707 5708 $bg_first.removeClass(bg_remove); 5709 5710 var bgChange = function($col, bgColor, skin, tmbskin){ 5711 $bg_wrapper.attr( 'class', bgColor ); 5712 var menuskin; 5713 if ( typeof skin !== 'undefined' ) { 5714 menuskin = skin.replace('style', 'menu') 5715 } 5716 5717 if ( $col.length ) { 5718 $('.uncol[data-skin-change]').each(function(){ 5719 var $isoFooter = $('.isotope-footer', this); 5720 $(this).add($isoFooter).removeClass('style-dark').removeClass('style-light').addClass(skin); 5721 if ( menuskin !== '' ) {
5722 $(this).find('.isotope-filters:not(.with-bg)').removeClass('menu-dark').removeClass('menu-light').addClass(menuskin); 5723 } 5724 }); 5725 5726 $('.tmb[data-skin-change]').each(function(){ 5727 $(this).removeClass('tmb-dark').removeClass('tmb-light').addClass(tmbskin); 5728 }); 5729 } 5730 }; 5731 5732 var bg_waypoints = function(){ 5733 if ( $bg_changers.length && !SiteParameters.is_frontend_editor ) { 5734 5735 $.each($bg_changers, function(index, row) { 5736 5737 var $row = $(row), 5738 $col = $('.uncol[data-skin-change]', $row).eq(0), 5739 skin, 5740 $tmbs, 5741 tmbskin, 5742 bgColor = $row.attr('data-bg-color'); 5743 5744 if ( ! $row.is(':visible') ) { 5745 return false; 5746 } 5747 5748 if ( $col.length ) { 5749 skin = $col.attr('data-skin-change'); 5750 $tmbs = $('.tmb[data-skin-change]', $row); 5751 tmbskin = skin.replace('style', 'tmb'); 5752 } 5753 5754 $row.waypoint(function( dir ) { 5755 if ( dir === 'down' ) { 5756 bgChange($col, bgColor, skin, tmbskin); 5757 } else { 5758 return; 5759 } 5760 }, { 5761 offset: '50%' 5762 }); 5763 5764 $row.waypoint(function( dir ) { 5765 if ( dir === 'up' ) { 5766 bgChange($col, bgColor, skin, tmbskin); 5767 } else { 5768 return; 5769 } 5770 }, { 5771 offset: function() { 5772 var clH = this.element.clientHeight, 5773 wH = window.innerHeight, 5774 ret = clH > 200 ? -100 : clH * -0.5; 5775 return ( wH / 2 ) - clH; 5776 } 5777 }); 5778 5779 }); 5780 5781 $('body').addClass('bg-changer-init'); 5782 5783 } 5784 }; 5785 5786 var body = document.body, 5787 edges = false; 5788 5789 var throttle = function(fn, wait) { 5790 var time = Date.now(); 5791 return function() { 5792 if ((time + wait - Date.now()) < 0) { 5793 fn(); 5794 time = Date.now(); 5795 } 5796 } 5797 } 5798 5799 window.addEventListener( 'scroll', throttle( function() { 5800 window.clearRequestTimeout( isScrolling ); 5801 5802 isScrolling = requestTimeout(function() { //trick to make understand Waypoints when it reaches a small first or last row 5803 5804 var scrolled = window.pageYOffset || window.document.documentElement.scrollTop, 5805 body = document.body, 5806 html = document.documentElement, 5807 docH = Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ), 5808 $row = false; 5809 5810 if ( scrolled < 100 ) { 5811 var $row = $first; 5812 } else if ( ( scrolled + UNCODE.wheight ) > ( docH - 100 ) ) { 5813 var $row = $last; 5814 } 5815 5816 if ( $row.length ) { 5817 var $col = $('.uncol[data-skin-change]', $row).eq(0), 5818 skin, 5819 $tmbs, 5820 tmbskin, 5821 bgColor = $row.attr('data-bg-color'); 5822 5823 if ( $col.length ) { 5824 skin = $col.attr('data-skin-change'); 5825 $tmbs = $('.tmb[data-skin-change]', $row); 5826 tmbskin = skin.replace('style', 'tmb'); 5827 } 5828 5829 bgChange($col, bgColor, skin, tmbskin); 5830 edges = true; 5831 } 5832 }, 150); 5833 5834 if ( edges === true ) { //trick to make understand Waypoints when, after reaching a small first or last row, it has to start detecting again 5835 bg_waypoints(); 5836 Waypoint.refreshAll(); 5837 edges = false; 5838 } 5839 }, 100), false); 5840 5841 $(window).on('resize', function() { 5842 clearRequestTimeout(setCTA); 5843 setCTA = requestTimeout(function() { 5844 if ( localH != UNCODE.wheight ) { 5845 localH = UNCODE.wheight; 5846 bg_waypoints(); 5847 Waypoint.refreshAll(); 5848 } 5849 }, 100); 5850 }); 5851 5852 bg_waypoints(); 5853 5854}; 5855 5856UNCODE.parallax = function() { 5857 if (!UNCODE.isFullPage && !UNCODE.isFullPageSnap && (UNCODE.wwidth > UNCODE.mediaQuery || SiteParameters.mobile_parallax_animation === '1')) { 5858 if ($('.parallax-el').length > 0) { 5859 var parallax_elements = new Rellax('.parallax-el'); 5860 } 5861 } 5862}; 5863 5864UNCODE.magicCursor = function(){ 5865 var $customCursor = $('#uncode-custom-cursor'), 5866 $customPilot = $('#uncode-custom-cursor-pilot'), 5867 currentCursor = 'auto', 5868 setTime, 5869 isScrolling, 5870 mouseEvent; 5871 5872 function delayChangeCursor(cursorType, delayt_time){ 5873 clearRequestTimeout(setTime); 5874 setTime = requestTimeout(function() { 5875 $customCursor.attr('data-cursor', cursorType); 5876 if ( $customPilot.length ) { 5877 $customPilot.attr('data-cursor', cursorType); 5878 } 5879 currentCursor = cursorType; 5880 }, delayt_time); 5881 } 5882 5883 function changeCursor($wrap){ 5884 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 5885 var href = SiteParameters.custom_cursor_selector != '' ? SiteParameters.custom_cursor_selector : '[href]', 5886 $href = $wrap.find(href), 5887 cursorType, 5888 setTime, set_delay; 5889 5890 $href.hover(function(e) { 5891 var $this = $(this), 5892 data_cursor = $this.closest('[data-cursor]').attr('data-cursor'), 5893 is_frontend_editor = $this.closest('.vc_controls').length, 5894 hasSrc = $('[src]', $this).length, 5895 $parent_cursor = $this.closest('[class*="custom-cursor"]'); 5896 if ( is_frontend_editor ) { 5897 cursorType = 'auto'; 5898 } else if ( typeof data_cursor !== 'undefined' && data_cursor !== '' && hasSrc ) { 5899 cursorType = data_cursor; 5900 } else if ( $parent_cursor.length ) { 5901 if ( $parent_cursor.hasClass('custom-cursor-light') ) { 5902 cursorType = 'icon-light';
5903 } else if ( $parent_cursor.hasClass('custom-cursor-diff') ) { 5904 cursorType = 'icon-diff'; 5905 } else if ( $parent_cursor.hasClass('custom-cursor-accent') ) { 5906 cursorType = 'icon-accent'; 5907 } else { 5908 cursorType = 'icon-dark'; 5909 } 5910 } else { 5911 cursorType = 'pointer'; 5912 } 5913 delayChangeCursor(cursorType, 0); 5914 }, function(){ 5915 delayChangeCursor('auto', 150); 5916 }); 5917 5918 $(window).on('disable-hover', function(event) { 5919 document.addEventListener("mousemove", function(e) { 5920 mouseEvent = e; 5921 }); 5922 delayChangeCursor('auto', 0); 5923 }); 5924 5925 $(window).on('enable-hover', function(event) { 5926 if ( typeof mouseEvent !== 'undefined' ) { 5927 var x = mouseEvent.clientX, 5928 y = mouseEvent.clientY; 5929 5930 var elements = document.elementsFromPoint(x, y), 5931 $element = $(elements[0]); 5932 5933 $element.closest(href).trigger('mouseenter'); 5934 } 5935 }); 5936 5937 } 5938 5939 /************** 5940 * Magnetic * 5941 *************/ 5942 5943 function magneticCursor($wrap){ 5944 $wrap = typeof $wrap === 'undefined' ? $('body') : $wrap; 5945 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')); 5946 5947 $magnetics.on('mousemove', function(e){ 5948 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this), 5949 bound = e.currentTarget.getBoundingClientRect(), 5950 coeff = 30, 5951 hor = (bound.width / 2) - (e.clientX - bound.left), 5952 ver = (bound.height / 2) - (e.clientY - bound.top), 5953 toX = hor / bound.width * coeff, 5954 toY = ver / bound.height * coeff, 5955 scaleX = ((bound.width + coeff + 5) / bound.width).toFixed(2), 5956 scaleY = ((bound.height + coeff + 5) / bound.height).toFixed(2), 5957 toScale = Math.max(scaleX, scaleY); 5958 5959 gsap.killTweensOf($el); 5960 gsap.to( $el, { 5961 duration: 0.75, 5962 x: toX, 5963 y: toY, 5964 scale: toScale, 5965 ease: Power1.easeOut, 5966 transformPerspective: 900, 5967 transformOrigin: 'center', 5968 force3D: true 5969 }); 5970 }).on('mouseout', function(e){ 5971 var $el = $('img:not(.avatar), .t-background-cover, .fluid-object, .dummy.secondary-dummy-image, .t-secondary-background-cover, .background-inner, .header-bg', this); 5972 gsap.killTweensOf($el); 5973 gsap.to( $el, { 5974 duration: 0.6, 5975 y: 0, 5976 x: 0, 5977 scale: 1, 5978 ease: Power1.easeOut, 5979 transformPerspective: 900, 5980 transformOrigin: 'center', 5981 force3D: true 5982 }); 5983 }); 5984 }; 5985 5986 $(window).on('load uncode-custom-cursor uncode-quick-view-loaded', function(event) { 5987 changeCursor(); 5988 magneticCursor(); 5989 }); 5990 5991 $(document).ajaxComplete(function( event, xhr, settings ) { 5992 changeCursor(); 5993 magneticCursor(); 5994 }); 5995 5996 $('.isotope-container').on('isotope-layout-complete', function() { 5997 var $this = $(this); 5998 changeCursor($this); 5999 magneticCursor($this); 6000 }); 6001 6002}; 6003 6004UNCODE.verticalText = function() { 6005 $(window).on('menuCanvasOpen', function(){ 6006 $('.vertical-text--fixed').fadeOut(500); 6007 }).on('menuCanvasClose', function(){ 6008 $('.vertical-text--fixed').fadeIn(500); 6009 }); 6010 6011 var hideOnBottomVerticalTexts = $('.vertical-text--vis-hide-bottom'); 6012 var showOnTopVerticalTexts = $('.vertical-text--vis-show-top'); 6013 6014 if (hideOnBottomVerticalTexts.length > 0 || showOnTopVerticalTexts.length > 0) { 6015 window.addEventListener('scroll', function(e) { 6016 var totalPageHeight = document.body.scrollHeight; 6017 var scrollPoint = window.scrollY + window.innerHeight; 6018 6019 if (window.scrollY > 0) { 6020 showOnTopVerticalTexts.fadeOut(); 6021 } else { 6022 showOnTopVerticalTexts.fadeIn(); 6023 } 6024 6025 if (scrollPoint >= totalPageHeight) { 6026 hideOnBottomVerticalTexts.fadeOut(); 6027 } else { 6028 hideOnBottomVerticalTexts.fadeIn(); 6029 } 6030 }, false); 6031 } 6032}; 6033 6034 UNCODE.init = function() { 6035 var wfl_check = false, wfl_request, waypoint_request; 6036 UNCODE.preventDoubleTransition(); 6037 UNCODE.utils(); 6038 UNCODE.menuSystem(); 6039 UNCODE.bgChanger(); 6040 UNCODE.magicCursor(); 6041 if (typeof UNCODE.okvideo !== 'undefined') { 6042 UNCODE.okvideo(); 6043 } 6044 UNCODE.tapHover(); 6045 if (typeof UNCODE.isotopeLayout !== 'undefined') { 6046 UNCODE.isotopeLayout(); 6047 } 6048 if (typeof UNCODE.justifiedGallery !== 'undefined') { 6049 UNCODE.justifiedGallery(); 6050 } 6051 if (typeof UNCODE.lightbox !== 'undefined') { 6052 UNCODE.lightbox(); 6053 } 6054 if (typeof UNCODE.carousel !== 'undefined') { 6055 UNCODE.carousel($('body')); 6056 } 6057 if (typeof UNCODE.lettering !== 'undefined') { 6058 UNCODE.lettering(); 6059 } 6060 UNCODE.animations(); 6061 if (typeof UNCODE.stickyElements !== 'undefined' && !SiteParameters.is_frontend_editor) { 6062 UNCODE.stickyElements(); 6063 } 6064 if (typeof UNCODE.twentytwenty !== 'undefined') { 6065 UNCODE.twentytwenty(); 6066 } 6067 UNCODE.disableHoverScroll(); 6068 UNCODE.printScreen(); 6069 if (typeof UNCODE.particles !== 'undefined') { 6070 UNCODE.particles(); 6071 } 6072 if (typeof UNCODE.filters !== 'undefined') { 6073 UNCODE.filters(); 6074 } 6075 if (typeof UNCODE.widgets !== 'undefined') { 6076 UNCODE.widgets(); 6077 } 6078 if (typeof UNCODE.unmodal !== 'undefined') { 6079 UNCODE.unmodal(); 6080 } 6081 if (typeof UNCODE.checkScrollForTabs !== 'undefined') { 6082 if ( !UNCODE.isFullPage ) { 6083 UNCODE.checkScrollForTabs(); 6084 } 6085 } 6086 if (typeof UNCODE.onePage !== 'undefined') { 6087 UNCODE.onePage(UNCODE.isMobile); 6088 } 6089 if (typeof UNCODE.fullPage !== 'undefined') { 6090 $(document).ready(function(){ 6091 UNCODE.fullPage(); 6092 }); 6093 } 6094 if (typeof UNCODE.verticalText !== 'undefined') { 6095 UNCODE.verticalText(); 6096 } 6097 $(window).on('load',function(){ 6098 clearRequestTimeout(waypoint_request);
6099 waypoint_request = requestTimeout( function(){ 6100 Waypoint.refreshAll(); 6101 }, 1000); 6102 6103 if (typeof UNCODE.parallax !== 'undefined') { 6104 UNCODE.parallax(); 6105 } 6106 }); 6107 } 6108 6109 if ( ! SiteParameters.is_frontend_editor ) { 6110 UNCODE.init(); 6111 } 6112 6113 6114})(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.