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