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