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