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