1 2 3/* ---------------------------------------------------------- 4 * Uncode App 5 * ---------------------------------------------------------- */ 6 7(function($) { 8 "use strict"; 9 var UNCODE = window.UNCODE || {}; 10 window.UNCODE = UNCODE; 11 12UNCODE.utils = function() { 13 $('.btn-tooltip').tooltip(); 14 $('a').hover(function() { 15 $(this).attr('data-title', $(this).attr('title')); 16 $(this).removeAttr('title'); 17 }, function() { 18 $(this).attr('title', $(this).attr('data-title')); 19 }); 20 $('.counter').counterUp({ 21 delay: 10, 22 time: 1500 23 }); 24 $('[data-countdown]').each(function() { 25 var $this = $(this), 26 finalDate = $(this).data('countdown'); 27 $this.countdown(finalDate, function(event) { 28 $this.html(event.strftime('%D <small>' + SiteParameters.days + '</small> %H <small>' + SiteParameters.hours + '</small> %M <small>' + SiteParameters.minutes + '</small> %S <small>' + SiteParameters.seconds + '</small>')); 29 }); 30 }); 31 var share_button_top = new Share(".share-button", { 32 ui: { 33 flyout: "top center", 34 button_font: false, 35 button_text: '', 36 icon_font: false 37 }, 38 }); 39 $(document).on('click', '.uncode-dot-irecommendthis', function() { 40 var link = $(this), 41 linkCounter = link.find('span.likes-counter'); 42 if (link.hasClass('active')) return false; 43 var id = $(this).attr('id'), 44 suffix = link.find('.dot-irecommendthis-suffix').text(); 45 $.post(dot_irecommendthis.ajaxurl, { 46 action: 'uncode-dot-irecommendthis', 47 recommend_id: id, 48 suffix: suffix 49 }, function(data) { 50 var counter = $(data).text(); 51 linkCounter.html(counter); 52 link.addClass('active').attr('title', 'You already recommended this'); 53 }); 54 return false; 55 }); 56 $('a[href*="#"]').click(function(e) { 57 var hash = (e.currentTarget).hash, 58 is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, 59 anchor = ''; 60 if ($(e.currentTarget).data('toggle') == 'tab') return; 61 if ($(e.currentTarget).hasClass('woocommerce-review-link')) { 62 e.preventDefault(); 63 if (!$('#tab-reviews').is(':visible')) { 64 $('a[href="#tab-reviews"]').trigger('click'); 65 } 66 setTimeout(function(){ 67 $('html, body').animate({ 68 scrollTop: $('.wootabs .tab-content').offset().top - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0) 69 }, 1000, 'easeInOutCubic'); 70 }, 200); 71 return; 72 } 73 if (hash != undefined) { 74 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { 75 var anchor = $(hash); 76 anchor = anchor.length ? anchor : this.hash.slice(1); 77 } 78 } 79 if (is_scrolltop || anchor != '') { 80 if (is_scrolltop) { 81 e.preventDefault(); 82 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 83 scrollSpeed = Math.abs(bodyTop) / 2; 84 if (scrollSpeed < 1000) scrollSpeed = 1000; 85 $('html, body').animate({ 86 scrollTop: 0 87 }, scrollSpeed, 'easeInOutCubic', function() { 88 }); 89 } else { 90 var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor; 91 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { 92 var get_href = $(val).attr('href'); 93 if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); 94 else $(val).parent().removeClass('active'); 95 }); 96 if (scrollSection.length) { 97 e.preventDefault(); 98 UNCODE.scrolling = true; 99 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 100 delta = bodyTop - scrollSection.offset().top, 101 scrollSpeed = Math.abs(delta) / 2; 102 if (scrollSpeed < 1000) scrollSpeed = 1000; 103 $('html, body').animate({ 104 scrollTop: scrollSection.offset().top - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0) 105 }, scrollSpeed, 'easeInOutCubic', function() { 106 UNCODE.scrolling = false;
107 }); 108 } 109 } 110 } 111 }); 112 $('.header-scrolldown').on('click', function(event) { 113 event.preventDefault(); 114 var pageHeader = $(event.target).closest('#page-header'), 115 pageHeaderTop = pageHeader.offset().top, 116 pageHeaderHeight = pageHeader.outerHeight(), 117 scrollSpeed = Math.abs(pageHeaderTop + pageHeaderHeight) / 2; 118 if (scrollSpeed < 1000) scrollSpeed = 1000; 119 $('html, body').animate({ 120 scrollTop: pageHeaderTop + pageHeaderHeight - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0) 121 }, scrollSpeed, 'easeInOutCubic'); 122 123 }); 124 // TAB DATA-API 125 // ============ 126 $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { 127 e.preventDefault() 128 $(this).tab('show'); 129 setTimeout(function() { 130 window.dispatchEvent(UNCODE.boxEvent); 131 }, 300); 132 }); 133 // COLLAPSE DATA-API 134 // ================= 135 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { 136 var $this = $(this), 137 href 138 var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 139 var $target = $(target) 140 var data = $target.data('bs.collapse') 141 var option = data ? 'toggle' : $this.data() 142 var parent = $this.attr('data-parent') 143 var $parent = parent && $(parent) 144 var $title = $(this).parent() 145 if ($parent) { 146 $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') 147 if ($title.hasClass('active')) { 148 $title.removeClass('active'); 149 } else { 150 $parent.find('.panel-title').removeClass('active') 151 $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') 152 } 153 } 154 $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') 155 // } 156 $target.collapse(option) 157 }); 158 // FitText 159 // ================= 160 window.uncode_textfill = function(el, loaded) { 161 if (el == undefined) el = $('body'); 162 $.each($('.bigtext', el), function(index, val) { 163 $(val).bigtext({ 164 minfontsize: 24 165 }); 166 if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ 167 opacity: 1 168 }); 169 setTimeout(function() { 170 if ($(val).find('.animate_when_almost_visible').length != 0) { 171 $(val).css({opacity: 1}); 172 } 173 }, 400); 174 }); 175 } 176 window.uncode_textfill(); 177 178 // Colomun hover effect 179 // ================= 180 $(document).on('mouseenter', '.col-link', function(e) { 181 var uncol = $(e.target).prev('.uncol'), 182 el = uncol.find('.column-background'); 183 if (el) { 184 $('.btn-container .btn', uncol).toggleClass('active'); 185 var elOverlay = $(el[0]).find('.block-bg-overlay'); 186 if (elOverlay.length) { 187 var getOpacity = $(elOverlay).css('opacity'); 188 if (getOpacity != 1) { 189 getOpacity = Math.round(getOpacity * 100) / 100; 190 var newOpacity = getOpacity + .1; 191 $(elOverlay).data('data-opacity', getOpacity); 192 $(elOverlay).css('opacity', newOpacity); 193 } 194 } 195 } 196 }).on('mouseleave', '.col-link', function(e) { 197 var uncol = $(e.target).prev('.uncol'), 198 el = uncol.find('.column-background'); 199 $('.btn-container .btn', uncol).toggleClass('active'); 200 if (el) { 201 var elOverlay = $(el[0]).find('.block-bg-overlay'); 202 if (elOverlay.length) { 203 var getOpacity = $(elOverlay).data('data-opacity'); 204 $(elOverlay).css('opacity', getOpacity); 205 } 206 } 207 }); 208 209 // REVSLIDER API 210 // ============ 211 $(window).load(function() { 212 $('.rev_slider_wrapper').each(function(){ 213 var $this = jQuery(this), 214 id_array = $this.attr("id").split("_"), 215 id = id_array[2]; 216 if (id != undefined && id != '') { 217 $.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);}})'); 218 $.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);}})'); 219 } 220 }); 221 }); 222 // Admin bar 223 // ============ 224 $(window).resize(function() { 225 if ($('html').hasClass('admin-mode')) { 226 var getAdminBar = $('#wpadminbar'); 227 if (getAdminBar.length) { 228 if (getAdminBar.css('visibility') !== 'hidden') { 229 if (getAdminBar.css('top') === '0px') { 230 if ($(window).width() > 600) $('html').css({'margin-top':getAdminBar.height() + 'px','padding-top':'0'}); 231 else $('html').css({'padding-top':getAdminBar.height() + 'px','margin-top':'0'}); 232 } 233 } 234 } 235 } 236 }); 237} 238 239UNCODE.menuSystem = function() { 240 function menuMobileButton() { 241 var $mobileToggleButton = $('.mobile-menu-button') 242 var open = false;
243 $mobileToggleButton.on('click', function(event) { 244 var btn = this; 245 event.preventDefault(); 246 if ($(window).width() < 960) { 247 if (!open) { 248 btn.classList.add('close'); 249 open = true; 250 } else { 251 btn.classList.remove('close'); 252 btn.classList.add('closing'); 253 setTimeout(function() { 254 btn.classList.remove('closing'); 255 }, 500); 256 open = false; 257 } 258 } 259 }); 260 }; 261 262 function menuMobile() { 263 var $mobileToggleButton = $('.mobile-menu-button'), 264 $box, 265 $el, 266 elHeight, 267 check, 268 animating = false; 269 $mobileToggleButton.on('click', function(event) { 270 event.preventDefault(); 271 if ($(window).width() < UNCODE.mediaQuery) { 272 $box = $(this).closest('.box-container').find('.main-menu-container'), 273 $el = $(this).closest('.box-container').find('.menu-horizontal-inner, .menu-sidebar-inner'); 274 elHeight = 0; 275 $.each($el, function(index, val) { 276 elHeight += $(val).outerHeight(); 277 }); 278 var open = function() { 279 if (!animating) { 280 animating = true; 281 $box.animate({ 282 height: elHeight 283 }, 400, "easeInOutCirc", function() { 284 $box.css('height', 'auto'); 285 }); 286 } 287 }; 288 289 var close = function() { 290 $box.animate({ 291 height: 0 292 }, { 293 duration: 400, 294 easing: "easeInOutCirc", 295 complete: function(elements) { 296 $(elements).css('height', ''); 297 animating = false; 298 } 299 }); 300 }; 301 302 check = ($box.height() == 0) ? open() : close(); 303 } 304 }); 305 }; 306 307 function menuOffCanvas() { 308 $('.menu-primary .menu-button-offcanvas').click(function(event) { 309 if ($(window).width() > UNCODE.mediaQuery) { 310 if ($(event.currentTarget).hasClass('close')) { 311 $(event.currentTarget).removeClass('close'); 312 $(event.currentTarget).addClass('closing'); 313 setTimeout(function() { 314 $(event.currentTarget).removeClass('closing'); 315 }, 500); 316 } else $(event.currentTarget).addClass('close'); 317 } 318 $('body').toggleClass('off-opened'); 319 }); 320 }; 321 function menuSmart() { 322 if ($('[class*="menu-smart"]').length > 0) { 323 $('[class*="menu-smart"]').smartmenus({ 324 subIndicators: false, 325 subIndicatorsPos: 'append', 326 subMenusMinWidth: '13em', 327 subIndicatorsText: '', 328 showTimeout: 50, 329 hideTimeout: 50, 330 showFunction: function($ul, complete) { 331 $ul.fadeIn(0, 'linear', complete); 332 }, 333 hideFunction: function($ul, complete) { 334 var fixIE = $('html.ie').length; 335 if (fixIE) { 336 var $rowParent = $($ul).closest('.main-menu-container'); 337 $rowParent.height('auto'); 338 } 339 $ul.fadeOut(0, 'linear', complete); 340 }, 341 collapsibleShowFunction: function($ul, complete) { 342 $ul.slideDown(400, 'easeInOutCirc', function() { 343 12}); 344 }, 345 collapsibleHideFunction: function($ul, complete) { 346 $ul.slideUp(200, 'easeInOutCirc', complete); 347 }, 348 hideOnClick: false 349 }); 350 } 351 }; 352 function menuOverlay() { 353 if ($('.overlay-sequential').length > 0) { 354 $('.overlay-sequential .menu-smart > li').each(function(index, el) { 355 $(this).css('-webkit-transition-delay', (index / 12) + 's' ) 356 .css('-moz-transition-delay', (index / 12) + 's') 357 .css('-ms-transition-delay', (index / 12) + 's') 358 .css('-o-transition-delay', (index / 12) + 's') 359 .css('transition-delay', (index / 12) + 's'); 360 }); 361 } 362 }; 363 menuMobileButton(); 364 menuMobile(); 365 menuOffCanvas(); 366 menuSmart(); 367 menuOverlay(); 368}; 369 370UNCODE.okvideo = function() { 371 var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; 372 $.okvideo = function(options) { 373 // if the option var was just a string, turn it into an object 374 if (typeof options !== 'object') options = { 375 'video': options 376 }; 377 var base = this; 378 // kick things off 379 base.init = function() { 380 base.options = $.extend({}, $.okvideo.options, options); 381 // support older versions of okvideo 382 if (base.options.video === null) base.options.video = base.options.source; 383 base.setOptions(); 384 var target = base.options.target || $('body'); 385 var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; 386 var zIndex = base.options.controls === 3 ? -999 : "auto"; 387 if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); 388 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>'; 389 if (OKEvents.utils.isMobile()) { 390 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>'); 391 } else { 392 if (base.options.controls === 3) { 393 target.append(mask) 394 } 395 if (base.options.adproof === 1) { 396 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>'); 397 } else { 398 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>'); 399 } 400 } 401 $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); 402 if (base.options.playlist.list === null) { 403 if (base.options.video.provider === 'youtube') { 404 base.loadYouTubeAPI(); 405 } else if (base.options.video.provider === 'vimeo') { 406 base.options.volume /= 100; 407 base.loadVimeoAPI(); 408 } 409 } else { 410 base.loadYouTubeAPI(); 411 } 412 } 413 }; 414 // clean the options 415 base.setOptions = function() { 416 // exchange 'true' for '1' and 'false' for 3 417 for (var key in this.options) { 418 if (this.options[key] === true) this.options[key] = 1; 419 if (this.options[key] === false) this.options[key] = 3; 420 } 421 if (base.options.playlist.list === null) { 422 base.options.video = base.determineProvider(); 423 } 424 // pass options to the window 425 $(window).data('okoptions-' + base.options.id, base.options); 426 };
427 // insert js into the head and exectue a callback function 428 base.insertJS = function(src, callback){ 429 var tag = document.createElement('script'); 430 if (callback){ 431 if (tag.readyState){ //IE 432 tag.onreadystatechange = function(){ 433 if (tag.readyState === "loaded" || 434 tag.readyState === "complete"){ 435 tag.onreadystatechange = null; 436 callback(); 437 } 438 }; 439 } else { 440 tag.onload = function() { 441 callback(); 442 }; 443 } 444 } 445 tag.src = src; 446 var firstScriptTag = document.getElementsByTagName('script')[0]; 447 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 448 }; 449 // load the youtube api 450 base.loadYouTubeAPI = function(callback) { 451 base.insertJS('https://www.youtube.com/player_api'); 452 }; 453 base.loadYouTubePlaylist = function() { 454 player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); 455 }; 456 // load the vimeo api by replacing the div with an iframe and loading js 457 base.loadVimeoAPI = function() { 458 var source = '//player.vimeo.com/video/' + base.options.video.id + '?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, 459 jIframe = $('<iframe data-src="'+source+'" frameborder="0" id="okplayer-' + base.options.id +'" style="visibility: hidden;" class="vimeo-background" />'); 460 $(window).data('okoptions-' + base.options.id).jobject = jIframe; 461 $('#okplayer-' + base.options.id).replaceWith(jIframe[0]); 462 base.insertJS('//origin-assets.vimeo.com/js/froogaloop2.min.js', function() { 463 vimeoPlayerReady(base.options.id); 464 }); 465 }; 466 // is it from youtube or vimeo? 467 base.determineProvider = function() { 468 var a = document.createElement('a'); 469 a.href = base.options.video; 470 if (/youtube.com/.test(base.options.video) || /youtu.be/.test(base.options.video)) { 471 var videoid = a.href.split('/')[3].toString(); 472 var query = videoid.substring(videoid.indexOf('?') + 1); 473 if (query != '') { 474 var vars = query.split('&'); 475 for (var i = 0; i < vars.length; i++) { 476 var pair = vars[i].split('='); 477 if (pair[0] == 'v') { 478 videoid = pair[1]; 479 } 480 } 481 } 482 return { 483 "provider": "youtube", 484 "id": videoid 485 }; 486 } else if (/vimeo.com/.test(base.options.video)) { 487 return { 488 "provider": "vimeo", 489 "id": (a.href.split('/')[3].toString()).split('#')[0], 490 }; 491 } else if (/[-A-Za-z0-9_]+/.test(base.options.video)) { 492 var id = new String(base.options.video.match(/[-A-Za-z0-9_]+/)); 493 if (id.length == 11) { 494 return { 495 "provider": "youtube", 496 "id": id.toString() 497 }; 498 } else { 499 for (var i = 0; i < base.options.video.length; i++) { 500 if (typeof parseInt(base.options.video[i]) !== "number") { 501 throw 'not vimeo but thought it was for a sec'; 502 } 503 } 504 return { 505 "provider": "vimeo", 506 "id": base.options.video 507 }; 508 } 509 } else { 510 throw "OKVideo: Invalid video source"; 511 } 512 }; 513 base.init(); 514 }; 515 $.okvideo.options = { 516 id: null, 517 source: null, // Deprecate dis l8r 518 video: null, 519 playlist: { // eat ur heart out @brokyo 520 list: null, 521 index: 0, 522 startSeconds: 0, 523 suggestedQuality: "default" // options: small, medium, large, hd720, hd1080, highres, default 524 }, 525 disableKeyControl: 1, 526 captions: 0, 527 loop: 1, 528 hd: 1, 529 volume: 0, 530 adproof: false, 531 unstarted: null, 532 onFinished: null, 533 onReady: null, 534 onPlay: null, 535 onPause: null, 536 buffering: null, 537 controls: false, 538 autoplay: true, 539 annotations: true, 540 cued: null 541 }; 542 $.fn.okvideo = function(options) { 543 options.target = this; 544 return this.each(function() { 545 (new $.okvideo(options)); 546 }); 547 }; 548 549 $(".no-touch .uncode-video-container.video").each(function(index, el) { 550 var $this = $(this), 551 url = $this.attr('data-video'), 552 id = $this.attr('data-id'), 553 cloned = $this.closest('.owl-item'); 554 if (!cloned.hasClass('cloned') || cloned.length == 0) { 555 $this.okvideo({ 556 id: id, 557 source: url.split('#')[0], 558 time: ((url).indexOf("#") > -1) ? (url).substring((url).indexOf('#') + 1) : null, 559 autoplay: 1, 560 controls: 0, 561 volume: 0, 562 adproof: 0, 563 caller: $this, 564 hd: 1, 565 onReady: function(player) { 566 var getPlayer = player.c || player, 567 getContainer = $(getPlayer).closest('.background-element'); 568 if (getContainer.length) { 569 UNCODE.initVideoComponent(getContainer[0], '.uncode-video-container.video'); 570 } 571 } 572 }); 573 } 574 }); 575 $(".no-touch .background-video-shortcode").each(function(index, el) { 576 var video_id = $(this).attr('id'); 577 if (typeof MediaElement === "function") { 578 new MediaElement(video_id, { 579 startVolume: 0, 580 loop: true, 581 success: function(mediaElement, domObject) { 582 domObject.volume = 0; 583 $(mediaElement).data('started', false); 584 mediaElement.addEventListener('timeupdate', function(e) { 585 if (!$(e.target).data('started')) { 586 $(mediaElement).data('started', true); 587 $(mediaElement).closest('.uncode-video-container').css('opacity', '1'); 588 } 589 }); 590 mediaElement.play(); 591 }, 592 // fires when a problem is detected 593 error: function() {} 594 }); 595 } 596 }); 597}; 598 599UNCODE.disableHoverScroll = function() { 600 601 if (!UNCODE.isMobile) { 602 var body = document.body, 603 timer; 604 605 window.addEventListener('scroll', function() { 606 clearTimeout(timer); 607 if (body.classList) { 608 if (!body.classList.contains('disable-hover')) { 609 body.classList.add('disable-hover') 610 } 611 612 timer = setTimeout(function() { 613 body.classList.remove('disable-hover') 614 }, 300); 615 } 616 }, false); 617 } 618}; 619 620 621UNCODE.isotopeLayout = function() { 622 if ($('.isotope-layout').length > 0) { 623 var isotopeContainersArray = [], 624 typeGridArray = [], 625 layoutGridArray = [], 626 screenLgArray = [], 627 screenMdArray = [], 628 screenSmArray = [], 629 transitionDuration = [], 630 $filterItems = [], 631 $filters = $('.isotope-filters'), 632 $itemSelector = '.tmb', 633 $items, 634 itemMargin, 635 correctionFactor = 0, 636 firstLoad = true, 637 isOriginLeft = $('body').hasClass('rtl') ? false : true; 638 $('[class*="isotope-container"]').each(function() { 639 var isoData = $(this).data(), 640 $data_lg, 641 $data_md, 642 $data_sm; 643 if (isoData.lg !== undefined) $data_lg = $(this).attr('data-lg'); 644 else $data_lg = '1000'; 645 if (isoData.md !== undefined) $data_md = $(this).attr('data-md'); 646 else $data_md = '600'; 647 if (isoData.sm !== undefined) $data_sm = $(this).attr('data-sm'); 648 else $data_sm = '480'; 649 screenLgArray.push($data_lg); 650 screenMdArray.push($data_md); 651 screenSmArray.push($data_sm); 652 transitionDuration.push($('.t-inside.animate_when_almost_visible', this).length > 0 ? 0 : '0.5s'); 653 if (isoData.type == 'metro') typeGridArray.push(true);
654 else typeGridArray.push(false); 655 if (isoData.layout !== undefined) layoutGridArray.push(isoData.layout); 656 else layoutGridArray.push('masonry'); 657 isotopeContainersArray.push($(this)); 658 }); 659 var colWidth = function(index) { 660 $(isotopeContainersArray[index]).width(''); 661 var isPx = $(isotopeContainersArray[index]).parent().hasClass('px-gutter'), 662 widthAvailable = $(isotopeContainersArray[index]).width(), 663 columnNum = 12, 664 columnWidth = 0; 665 666 if (isPx) { 667 columnWidth = Math.ceil(widthAvailable / columnNum); 668 $(isotopeContainersArray[index]).width(columnNum * Math.ceil(columnWidth)); 669 } else { 670 columnWidth = ($('html.firefox').length) ? Math.floor(widthAvailable / columnNum) : widthAvailable / columnNum; 671 } 672 $items = $(isotopeContainersArray[index]).find('.tmb:not(.tmb-carousel)'); 673 itemMargin = parseInt($(isotopeContainersArray[index]).find('.t-inside').css("margin-top")); 674 for (var i = 0, len = $items.length; i < len; i++) { 675 var $item = $($items[i]), 676 multiplier_w = $item.attr('class').match(/tmb-iso-w(\d{0,2})/), 677 multiplier_h = $item.attr('class').match(/tmb-iso-h(\d{0,2})/); 678 if (widthAvailable >= screenMdArray[index] && widthAvailable < screenLgArray[index]) { 679 if (multiplier_w[1] !== undefined) { 680 switch (parseInt(multiplier_w[1])) { 681 case (5): 682 case (4): 683 case (3): 684 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 685 multiplier_w[1] = 6; 686 break; 687 case (2): 688 case (1): 689 if (typeGridArray[index]) multiplier_h[1] = (3 * multiplier_h[1]) / multiplier_w[1]; 690 multiplier_w[1] = 3; 691 break; 692 default: 693 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 694 multiplier_w[1] = 12; 695 break; 696 } 697 } 698 } else if (widthAvailable >= screenSmArray[index] && widthAvailable < screenMdArray[index]) { 699 if (multiplier_w[1] !== undefined) { 700 switch (parseInt(multiplier_w[1])) { 701 case (5): 702 case (4): 703 case (3): 704 case (2): 705 case (1): 706 if (typeGridArray[index]) multiplier_h[1] = (6 * multiplier_h[1]) / multiplier_w[1]; 707 multiplier_w[1] = 6; 708 break; 709 default: 710 if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 711 multiplier_w[1] = 12; 712 break; 713 } 714 } 715 } else if (widthAvailable < screenSmArray[index]) { 716 if (multiplier_w[1] !== undefined) { 717 //if (typeGridArray[index]) multiplier_h[1] = (12 * multiplier_h[1]) / multiplier_w[1]; 718 multiplier_w[1] = 12; 719 if (typeGridArray[index]) multiplier_h[1] = 12; 720 } 721 } 722 var width = multiplier_w ? (columnWidth * multiplier_w[1]) : columnWidth, 723 height = multiplier_h ? Math['ceil']((2 * Math.ceil(columnWidth / 2)) * multiplier_h[1]) - itemMargin : columnWidth; 724 725 if (width >= widthAvailable) { 726 $item.css({ 727 width: widthAvailable 728 }); 729 if (typeGridArray[index]) { 730 $item.children().add($item.find('.backimg')).css({ 731 height: height 732 }); 733 } 734 } else { 735 $item.css({ 736 width: width 737 }); 738 if (typeGridArray[index]) { 739 $item.children().add($item.find('.backimg')).css({ 740 height: height 741 }); 742 } 743 } 744 } 745 return columnWidth; 746 }, 747 init_isotope = function() { 748 for (var i = 0, len = isotopeContainersArray.length; i < len; i++) { 749 var isotopeSystem = $(isotopeContainersArray[i]).closest($('.isotope-system')), 750 isotopeId = isotopeSystem.attr('id'), 751 $layoutMode = layoutGridArray[i]; 752 $(isotopeContainersArray[i]).isotope({ 753 //resizable: true, 754 itemSelector: $itemSelector, 755 layoutMode: $layoutMode, 756 transitionDuration: transitionDuration[i], 757 masonry: { 758 columnWidth: colWidth(i) 759 }, 760 vertical: { 761 horizontalAlignment: 0.5, 762 }, 763 sortBy: 'original-order', 764 isOriginLeft: isOriginLeft 765 }).on('layoutComplete', onLayout($(isotopeContainersArray[i]), 0)); 766 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite')) { 767 $(isotopeContainersArray[i]).infinitescroll({ 768 navSelector: '#' + isotopeId + ' .loadmore-button', // selector for the pagination container 769 nextSelector: '#' + isotopeId + ' .loadmore-button a', // selector for the NEXT link (to page 2) 770 itemSelector: '#' + isotopeId + ' .isotope-layout .tmb, #' + isotopeId + ' .isotope-filters li', // selector for all items
770you'll retrieve 771 animate: false, 772 behavior: 'local', 773 debug: false, 774 loading: { 775 selector: '#' + isotopeId + '.isotope-system .isotope-footer-inner', 776 speed: 0, 777 finished: undefined, 778 msg: $('#' + isotopeId + ' .loadmore-button'), 779 }, 780 errorCallback: function() { 781 var isotope_system = $(this).closest('.isotope-system'); 782 $('.loading-button', isotope_system).hide(); 783 $('.loadmore-button', isotope_system).attr('style', 'display:none !important'); 784 } 785 }, 786 // append the new items to isotope on the infinitescroll callback function. 787 function(newElements, opts) { 788 var $isotope = $(this), 789 isotopeId = $isotope.closest('.isotope-system').attr('id'), 790 filters = new Array(), 791 $loading_button = $isotope.closest('.isotope-system').find('.loading-button'), 792 $infinite_button = $isotope.closest('.isotope-system').find('.loadmore-button'), 793 $numPages = $('a', $infinite_button).data('pages'), 794 delay = 300; 795 $('a', $infinite_button).html($('a', $infinite_button).data('label')); 796 $infinite_button.show(); 797 $loading_button.hide(); 798 if ( $numPages != undefined && opts.state.currPage == $numPages) $infinite_button.hide(); 799 $('> li', $isotope).remove(); 800 $.each($(newElements), function(index, val) { 801 if ($(val).is("li")) { 802 filters.push($(val)[0]); 803 } 804 }); 805 newElements = newElements.filter(function(x) { 806 return filters.indexOf(x) < 0 807 }); 808 $.each($(filters), function(index, val) { 809 if ($('#' + isotopeId + ' a[data-filter="' + $('a', val).attr('data-filter') + '"]').length == 0) $('#' + isotopeId + ' .isotope-filters ul').append($(val)); 810 }); 811 $isotope.isotope('reloadItems', onLayout($isotope, newElements.length)); 812 }); 813 if ($(isotopeContainersArray[i]).hasClass('isotope-infinite-button')) { 814 var $infinite_isotope = $(isotopeContainersArray[i]), 815 $infinite_button = $infinite_isotope.closest('.isotope-system').find('.loadmore-button a'); 816 $infinite_isotope.infinitescroll('pause'); 817 $infinite_button.on('click', function(event) { 818 event.preventDefault(); 819 var $infinite_system = $(event.target).closest('.isotope-system'), 820 $infinite_isotope = $infinite_system.find('.isotope-container'), 821 isotopeId = $infinite_system.attr('id'); 822 $(event.currentTarget).html('Loading…'); 823 $infinite_isotope.infinitescroll('resume'); 824 $infinite_isotope.infinitescroll('retrieve'); 825 $infinite_isotope.infinitescroll('pause'); 826 }); 827 } 828 } 829 } 830 }, 831 onLayout = function(isotopeObj, startIndex) { 832 isotopeObj.css('opacity', 1); 833 isotopeObj.closest('.isotope-system').find('.isotope-footer').css('opacity', 1); 834 setTimeout(function() { 835 window.dispatchEvent(UNCODE.boxEvent); 836 UNCODE.adaptive(); 837 $(isotopeObj).find('audio,video').each(function() { 838 $(this).mediaelementplayer({ 839 pauseOtherPlayers: false, 840 }); 841 }); 842 if ($(isotopeObj).find('.nested-carousel').length) { 843 UNCODE.carousel($(isotopeObj).find('.nested-carousel')); 844 setTimeout(function() { 845 boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj); 846 }, 200); 847 } else { 848 boxAnimation($('.tmb', isotopeObj), startIndex, true, isotopeObj); 849 } 850 }, 100); 851 }, 852 boxAnimation = function(items, startIndex, sequential, container) { 853 var $allItems = items.length - startIndex, 854 showed = 0, 855 index = 0; 856 if (container.closest('.owl-item').length == 1) return false; 857 $.each(items, function(index, val) { 858 var elInner = $('> .t-inside', val); 859 if (val[0]) val = val[0]; 860 if (elInner.hasClass('animate_when_almost_visible') && !elInner.hasClass('force-anim')) { 861 new Waypoint({ 862 element: val, 863 handler: function() { 864 var element = $('> .t-inside', this.element), 865 parent = $(this.element), 866 currentIndex = parent.index();
867 var delay = (!sequential) ? index : ((startIndex !== 0) ? currentIndex - $allItems : currentIndex), 868 delayAttr = parseInt(element.attr('data-delay')); 869 if (isNaN(delayAttr)) delayAttr = 100; 870 delay -= showed; 871 var objTimeout = setTimeout(function() { 872 element.removeClass('zoom-reverse').addClass('start_animation'); 873 showed = parent.index(); 874 }, delay * delayAttr) 875 parent.data('objTimeout', objTimeout); 876 this.destroy(); 877 }, 878 offset: '100%' 879 }) 880 } else { 881 if (elInner.hasClass('force-anim')) { 882 elInner.addClass('start_animation'); 883 } else { 884 elInner.css('opacity', 1); 885 } 886 } 887 index++; 888 }); 889 }; 890 if ($('.isotope-pagination').length > 0) { 891 var filterHeight = ($filters != undefined) ? $filters.outerHeight(true) - $('a', $filters).first().height() : 0; 892 $('.isotope-system').on('click', '.pagination a', function(evt) { 893 evt.preventDefault(); 894 var container = $(this).closest('.isotope-system'); 895 $('html, body').animate({ 896 scrollTop: container.offset().top - filterHeight - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0) 897 }, 1000, 'easeInOutQuad'); 898 loadIsotope($(this)); 899 evt.preventDefault(); 900 }); 901 } 902 $filters.on('click', 'a', function(evt) { 903 var $filter = $(this), 904 filterContainer = $filter.closest('.isotope-filters'), 905 filterValue = $filter.attr('data-filter'), 906 container = $filter.closest('.isotope-system').find($('.isotope-layout')), 907 transitionDuration = container.data().isotope.options.transitionDuration, 908 delay = 300, 909 filterItems = []; 910 if (!$filter.hasClass('active')) { 911 /** Scroll top with filtering */ 912 if (filterContainer.hasClass('filter-scroll')) { 913 $('html, body').animate({ 914 scrollTop: container.closest('.uncol').offset().top - (!filterContainer.hasClass('with-bg') ? filterContainer.outerHeight(true) - $filter.height() : 0) - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0) 915 }, 1000, 'easeInOutQuad'); 916 } 917 if (filterValue !== undefined) { 918 $.each($('> .tmb > .t-inside', container), function(index, val) { 919 var parent = $(val).parent(), 920 objTimeout = parent.data('objTimeout'); 921 if (objTimeout) { 922 $(val).removeClass('zoom-reverse').removeClass('start_animation') 923 clearTimeout(objTimeout); 924 } 925 if (transitionDuration == 0) { 926 if ($(val).hasClass('animate_when_almost_visible')) { 927 $(val).addClass('zoom-reverse').removeClass('start_animation'); 928 } else { 929 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 930 } 931 } 932 }); 933 setTimeout(function() { 934 container.isotope({ 935 filter: function() { 936 var block = $(this), 937 filterable = (filterValue == '*') || block.hasClass(filterValue); 938 if (filterable) { 939 filterItems.push(block); 940 } 941 return filterable; 942 } 943 }); 944 $('.t-inside.zoom-reverse', container).removeClass('zoom-reverse'); 945 }, delay); 946 /** once filtered - start **/ 947 if (transitionDuration == 0) { 948 container.isotope('once', 'arrangeComplete', function() { 949 setTimeout(function() { 950 boxAnimation(filterItems, 0, false, container); 951 }, 100); 952 }); 953 } 954 /** once filtered - end **/ 955 } else { 956 $.each($('> .tmb > .t-inside', container), function(index, val) { 957 var parent = $(val).parent(), 958 objTimeout = parent.data('objTimeout'); 959 if (objTimeout) { 960 $(val).removeClass('zoom-reverse').removeClass('start_animation') 961 clearTimeout(objTimeout); 962 } 963 if (transitionDuration == 0) { 964 if ($(val).hasClass('animate_when_almost_visible')) { 965 $(val).addClass('zoom-reverse').removeClass('start_animation'); 966 } else { 967 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-anim force-anim'); 968 } 969 } 970 }); 971 container.parent().addClass('isotope-loading'); 972 loadIsotope($filter); 973 } 974 } 975 evt.preventDefault(); 976 }); 977 $(window).on("popstate", function(e) { 978 if (e.originalEvent.state === null) return; 979 var params = {}; 980 if (location.search) { 981 var parts = location.search.substring(1).split('&'); 982 for (var i = 0; i < parts.length; i++) { 983 var nv = parts[i].split('='); 984 if (!nv[0]) continue; 985 params[nv[0]] = nv[1] || true; 986 } 987 } 988 if (params.id === undefined) { 989 $.each($('.isotope-system'), function(index, val) { 990 loadIsotope($(val)); 991 }); 992 } else loadIsotope($('#' + params.id)); 993 }); 994 995 var loadIsotope = function($href) { 996 var href = ($href.is("a") ? $href.attr('href') : location), 997 isotopeSystem = ($href.is("a") ? $href.closest($('.isotope-system')) : $href), 998 isotopeWrapper = isotopeSystem.find($('.isotope-wrapper')), 999 isotopeFooter = isotopeSystem.find($('.isotope-footer-inner')), 1000 isotopeContainer = isotopeSystem.find($('.isotope-layout')), 1001 isotopeId = isotopeSystem.attr('id'); 1002 if ($href.is("a")) history.pushState({ 1003 myIsotope: true 1004 }, document.title, href); 1005 $.ajax({ 1006 url: href 1007 }).done(function(data) { 1008 var $resultItems = $(data).find('#' + isotopeId + ' .isotope-layout').html(), 1009 $resultPagination = $(data).find('#' + isotopeId + ' .pagination'); 1010 isotopeWrapper.addClass('isotope-reloaded'); 1011 setTimeout(function() { 1012 isotopeWrapper.removeClass('isotope-loading'); 1013 isotopeWrapper.removeClass('isotope-reloaded'); 1014 }, 500); 1015 $.each($('> .tmb > .t-inside', isotopeContainer), function(index, val) { 1016 var parent = $(val).parent(), 1017 objTimeout = parent.data('objTimeout'); 1018 if (objTimeout) { 1019 $(val).removeClass('zoom-reverse').removeClass('start_animation') 1020 clearTimeout(objTimeout); 1021 } 1022 if ($(val).hasClass('animate_when_almost_visible')) { 1023 $(val).addClass('zoom-reverse').removeClass('start_animation'); 1024 } else { 1025 $(val).addClass('animate_when_almost_visible zoom-reverse zoom-in force-anim'); 1026 } 1027 }); 1028 setTimeout(function() { 1029 if (isotopeContainer.data('isotope')) { 1030 isotopeContainer.html($resultItems).isotope('reloadItems', onLayout(isotopeContainer, 0)); 1031 UNCODE.adaptive(); 1032 } 1033 }, 300); 1034 $('.pagination', isotopeFooter).remove(); 1035 isotopeFooter.append($resultPagination); 1036 }); 1037 }; 1038 $filters.each(function(i, buttonGroup) { 1039 var $buttonGroup = $(buttonGroup); 1040 $buttonGroup.on('click', 'a', function() { 1041 $buttonGroup.find('.active').removeClass('active'); 1042 $(this).addClass('active'); 1043 }); 1044 }); 1045 window.addEventListener('boxResized', function(e) { 1046 $.each($('.isotope-layout'), function(index, val) { 1047 var $layoutMode = ($(this).data('layout')); 1048 if ($layoutMode === undefined) $layoutMode = 'masonry'; 1049 if ($(this).data('isotope')) { 1050 $(this).isotope({ 1051 itemSelector: $itemSelector, 1052 layoutMode: $layoutMode, 1053 transitionDuration: transitionDuration[index], 1054 masonry: { 1055 columnWidth: colWidth(index) 1056 }, 1057 vertical: { 1058 horizontalAlignment: 0.5, 1059 }, 1060 sortBy: 'original-order', 1061 isOriginLeft: isOriginLeft 1062 }); 1063 $(this).isotope('unbindResize'); 1064 } 1065 $(this).find('.mejs-video,.mejs-audio').each(function() { 1066 $(this).trigger('resize'); 1067 }); 1068 }); 1069 }, false); 1070 init_isotope(); 1071 }; 1072} 1073 1074UNCODE.lightbox = function() { 1075 setTimeout(function() { 1076 var groupsArr = {}; 1077 $('[data-lbox^=ilightbox]').each(function() { 1078 var group = this.getAttribute("data-lbox"), 1079 values = $(this).data(); 1080 groupsArr[group] = values; 1081 }); 1082 for (var i in groupsArr) { 1083 var skin = groupsArr[i].skin || 'black', 1084 path = groupsArr[i].dir || 'horizontal', 1085 thumbs = !groupsArr[i].notmb || false,
1086 arrows = !groupsArr[i].noarr || false, 1087 social = groupsArr[i].social || false, 1088 deeplink = groupsArr[i].deep || false, 1089 counter = $('[data-lbox="' + i + '"]').length; 1090 if (social) social = { 1091 facebook: true, 1092 twitter: true, 1093 googleplus: true, 1094 reddit: true, 1095 digg: true, 1096 delicious: true 1097 }; 1098 $('[data-lbox="' + i + '"]').iLightBox({ 1099 skin: skin, 1100 path: path, 1101 linkId: deeplink, 1102 infinite: false, 1103 //fullViewPort: 'fit', 1104 smartRecognition: false, 1105 fullAlone: false, 1106 maxScale: 1, 1107 minScale: .02, 1108 //fullStretchTypes: 'flash, video', 1109 overlay: { 1110 opacity: .94 1111 }, 1112 controls: { 1113 arrows: (counter > 1 ? arrows : false), 1114 fullscreen: true, 1115 thumbnail: thumbs, 1116 slideshow: (counter > 1 ? true : false) 1117 }, 1118 show: { 1119 speed: 200 1120 }, 1121 hide: { 1122 speed: 200 1123 }, 1124 social: { 1125 start: false, 1126 buttons: social 1127 }, 1128 caption: { 1129 start: false 1130 }, 1131 styles: { 1132 nextOpacity: 1, 1133 nextScale: 1, 1134 prevOpacity: 1, 1135 prevScale: 1 1136 }, 1137 effects: { 1138 switchSpeed: 400 1139 }, 1140 slideshow: { 1141 pauseTime: 5000 1142 }, 1143 thumbnails: { 1144 maxWidth: 60, 1145 maxHeight: 60, 1146 activeOpacity: .2 1147 }, 1148 html5video: { 1149 preload: true 1150 } 1151 }); 1152 }; 1153 }, 100); 1154}; 1155 1156UNCODE.backVideo = function() { 1157 $(function() { 1158 $.each($('.background-video-shortcode'), function() { 1159 var video_id = $(this).attr('id'); 1160 if (typeof MediaElement === "function") { 1161 new MediaElement(video_id, { 1162 startVolume: 0, 1163 loop: true, 1164 success: function(mediaElement, domObject) { 1165 mediaElement.play(); 1166 $(mediaElement).closest('.uncode-video-container').css('opacity','1'); 1167 domObject.volume = 0; 1168 }, 1169 // fires when a problem is detected 1170 error: function() {} 1171 }); 1172 } 1173 }); 1174 }); 1175}; 1176 1177UNCODE.carousel = function(container) { 1178 var $owlSelector = $('.owl-carousel-container > [class*="owl-carousel"]', container), 1179 values = {}, 1180 tempTimeStamp, 1181 currentIndex, 1182 $owlInsideEqual = []; 1183 $owlSelector.each(function() { 1184 var itemID = $(this).attr('id'), 1185 $elSelector = $(('#' + itemID).toString()); 1186 values['id'] = itemID; 1187 values['items'] = 1;
1188 values['columns'] = 3; 1189 values['fade'] = false; 1190 values['nav'] = false; 1191 values['navmobile'] = false; 1192 values['navskin'] = 'light'; 1193 values['navspeed'] = 400; 1194 values['dots'] = false; 1195 values['dotsmobile'] = false; 1196 values['loop'] = false; 1197 values['autoplay'] = false; 1198 values['timeout'] = 3000; 1199 values['autoheight'] = false; 1200 values['margin'] = 0; 1201 values['lg'] = 1; 1202 values['md'] = 1; 1203 values['sm'] = 1; 1204 $.each($(this).data(), function(i, v) { 1205 values[i] = v; 1206 }); 1207 1208 if ($(this).closest('.uncode-slider').length) { 1209 values['navskin'] = ''; 1210 values['navmobile'] = false; 1211 values['dotsmobile'] = true; 1212 } else { 1213 values['navskin'] = ' style-'+values['navskin']+' style-override'; 1214 } 1215 1216 /** Initialized */ 1217 $elSelector.on('initialized.owl.carousel', function(event) { 1218 1219 var thiis = $(event.currentTarget), 1220 // get the time from the data method 1221 time = thiis.data("timer-id"); 1222 if (time) { 1223 clearTimeout(time); 1224 } 1225 thiis.addClass('showControls'); 1226 var new_time = setTimeout(function() { 1227 thiis.closest('.owl-carousel-container').removeClass('owl-carousel-loading'); 1228 if (thiis.hasClass('owl-height-equal')) setItemsHeight(event.currentTarget); 1229 if (!UNCODE.isMobile && !$elSelector.closest('.header-wrapper').length) navHover($elSelector.parent()); 1230 if (thiis.closest('.unequal, .unexpand').length) { 1231 var rowParent = thiis.closest('.row-parent'); 1232 UNCODE.setRowHeight(rowParent[0], true); 1233 } 1234 }, 350); 1235 // save the new time 1236 thiis.data("timer-id", new_time); 1237 1238 var scrolltop = $(document).scrollTop(); 1239 $(event.currentTarget).closest('.uncode-slider').find('video').removeAttr('poster'); 1240 1241 //if (!UNCODE.isMobile) { 1242 /** fix autoplay when visible **/ 1243 if ($(event.currentTarget).data('autoplay')) { 1244 $(event.currentTarget).trigger('stop.autoplay.owl'); 1245 } 1246 var carouselInView = new Waypoint.Inview({ 1247 element: $(event.currentTarget)[0], 1248 enter: function(direction) { 1249 var el = $(this.element); 1250 if (el.data('autoplay')) { 1251 if (!$(el).closest('.uncode-slider').length) { 1252 el.trigger('play.owl.autoplay'); 1253 } 1254 } 1255 }, 1256 exited: function() { 1257 if ($(this.element).data('autoplay')) { 1258 $(this.element).trigger('stop.owl.autoplay'); 1259 } 1260 } 1261 }); 1262 //} 1263 1264 if (!$(event.currentTarget).closest('.isotope-system').length) { 1265 setTimeout(function() { 1266 animate_thumb($('.t-inside', el), event); 1267 }, 400); 1268 } 1269 1270 var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 1271 currentIndex = $(currentItem).attr('data-index'); 1272 1273 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 1274 if ($(val).closest('.uncode-slider').length) { 1275 $(val).removeClass('start_animation'); 1276 } 1277 }); 1278 1279 $.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) { 1280 if ($(val).attr('data-index') != currentIndex) { 1281 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 1282 } 1283 if ($(val).attr('data-index') == currentIndex) { 1284 $('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 1285 } 1286 }); 1287 1288 if ($(event.currentTarget).closest('.uncode-slider').length) { 1289 var el = $(event.currentTarget).closest('.row-parent')[0]; 1290 if ($(el).data('imgready')) { 1291 firstLoaded(el, event); 1292 } else { 1293 el.addEventListener("imgLoaded", function(el) { 1294 firstLoaded(el.target, event); 1295 }, false); 1296 } 1297 var transHeight = $('.hmenu .menu-transparent.menu-primary .menu-container').height(); 1298 if (transHeight != null) { 1299 setTimeout(function() { 1300 $(event.currentTarget).closest('.uncode-slider').find('.owl-prev, .owl-next').css('paddingTop', transHeight / 2 + 'px'); 1301 }, 100); 1302 } 1303 } else { 1304 var el = $(event.currentTarget); 1305 el.closest('.uncode-slider').addClass('slider-loaded'); 1306 } 1307 1308 setTimeout(function() { 1309 window.uncode_textfill(thiis); 1310 if ($(event.currentTarget).closest('.uncode-slider').length) { 1311 if ($(event.currentTarget).data('autoplay')) pauseOnHover(event.currentTarget); 1312 } 1313 }, 500); 1314 1315 if ($(event.currentTarget).closest('.unequal').length) { 1316 $owlInsideEqual.push($(event.currentTarget).closest('.row-parent')); 1317 } 1318 1319 }); 1320 1321 /** Resizing */ 1322 $elSelector.on('resized.owl.carousel', function(event) { 1323 if ($(this).closest('.nested-carousel').length) { 1324 setTimeout(function() { 1325 window.dispatchEvent(UNCODE.boxEvent); 1326 }, 200); 1327 } 1328 if ($(event.currentTarget).hasClass('owl-height-equal')) setItemsHeight(event.currentTarget); 1329 }); 1330 1331 /** Change */ 1332 $elSelector.on('change.owl.carousel', function(event) { 1333 if (!UNCODE.isMobile) UNCODE.owlStopVideo(event.currentTarget); 1334 }); 1335 1336 /** Changed */ 1337 $elSelector.on('changed.owl.carousel', function(event) { 1338 if (tempTimeStamp != event.timeStamp) { 1339 var scrolltop = $(document).scrollTop(); 1340 var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[(event.item.index != null) ? event.item.index : 0]; 1341 if ($(event.currentTarget).closest('.row-slider').length) { 1342 if (currentItem == undefined) { 1343 currentItem = $(event.currentTarget).children()[0]; 1344 } 1345 if ($(currentItem).closest('#page-header').length) { 1346 if ($('.row-container > .row > .row-inner > div > .style-dark', currentItem).closest('.uncode-slider').length) { 1347 UNCODE.switchColorsMenu(scrolltop, 'dark'); 1348 } else if ($('.row-container > .row > .row-inner > div > .style-light', currentItem).closest('.uncode-slider').length) { 1349 UNCODE.switchColorsMenu(scrolltop, 'light'); 1350 } 1351 } 1352 } 1353 } 1354 tempTimeStamp = event.timeStamp; 1355 }); 1356 1357 $elSelector.on('translate.owl.carousel', function(event) { 1358 if (UNCODE.isMobile) { 1359 $(event.currentTarget).addClass('owl-translating'); 1360 } 1361 }); 1362 1363 /** Translated */ 1364 $elSelector.on('translated.owl.carousel', function(event) { 1365 1366 var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index], 1367 currentIndex = $(currentItem).attr('data-index'); 1368 1369 if (!UNCODE.isMobile) { 1370 UNCODE.owlPlayVideo(event.currentTarget); 1371 } 1372 1373 setTimeout(function() { 1374 var lastDelayElems = animate_elems($('.owl-item.active', event.currentTarget)); 1375 var lastDelayThumb = animate_thumb($('.owl-item.active .t-inside', event.currentTarget), event); 1376 if ($(event.currentTarget).closest('.uncode-slider').length && $(event.currentTarget).data('autoplay')) { 1377 if (lastDelayElems == undefined) lastDelayElems = 0; 1378 if (lastDelayThumb == undefined) lastDelayThumb = 0; 1379 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 1380 $(event.currentTarget).trigger('stop.owl.autoplay'); 1381 setTimeout(function() { 1382 if (!$(event.currentTarget).hasClass('owl-mouseenter')) $(event.currentTarget).trigger('play.owl.autoplay'); 1383 }, maxDelay); 1384 } 1385 }, 200); 1386 1387 $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function(index, val) { 1388 if ($(val).closest('.uncode-slider').length) { 1389 $(val).removeClass('start_animation'); 1390 } 1391 }); 1392 1393 $.each($('.owl-item:not(.active)', event.currentTarget), function(index, val) { 1394 if ($(val).attr('data-index') != currentIndex) { 1395 $('.start_animation:not(.t-inside)', val).removeClass('start_animation'); 1396 } 1397 if ($(val).attr('data-index') == currentIndex) { 1398 $('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation'); 1399 } 1400 }); 1401 1402 if (UNCODE.isMobile) { 1403 $(event.currentTarget).removeClass('owl-translating'); 1404 } 1405 1406 // } else { 1407 // $(event.currentTarget).removeClass('owl-translating'); 1408 // } 1409 }); 1410 1411 /** Init carousel */ 1412 $elSelector.owlCarousel({ 1413 items: values['items'], 1414 animateOut: (values['fade'] == true) ? 'fadeOut' : null, 1415 nav: values['nav'], 1416 dots: values['dots'], 1417 loop: values['loop'], 1418 margin: 0, 1419 video: true, 1420 autoWidth: false, 1421 autoplay: false, 1422 autoplayTimeout: values['timeout'], 1423 autoplaySpeed: values['navspeed'], 1424 autoplayHoverPause: $(this).closest('.uncode-slider').length ? false : true, 1425 autoHeight: ($(this).hasClass('owl-height-equal') || $(this).hasClass('owl-height-auto')) ? true : values['autoheight'], 1426 rtl: $('body').hasClass('rtl') ? true : false, 1427 fluidSpeed: true, 1428 navSpeed: values['navspeed'], 1429 navClass: [ 'owl-prev'+values['navskin'], 'owl-next'+values['navskin'] ], 1430 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>'], 1431 navContainer: values['nav'] ? $elSelector : false, 1432 responsiveClass: true, 1433 responsiveBaseElement: '.box-container', 1434 responsive: { 1435 0: { 1436 items: values['sm'], 1437 nav: values['navmobile'], 1438 dots: values['dotsmobile'] 1439 }, 1440 480: { 1441 items: values['sm'], 1442 nav: values['navmobile'], 1443 dots: values['dotsmobile'] 1444 }, 1445 570: { 1446 items: values['md'], 1447 nav: values['navmobile'], 1448 dots: values['dotsmobile'] 1449 }, 1450 960: { 1451 items: values['lg'] 1452 } 1453 }, 1454 }); 1455 1456 setTimeout(function() { 1457 for (var i = $owlInsideEqual.length - 1; i >= 0; i--) { 1458 UNCODE.setRowHeight($owlInsideEqual[i]); 1459 }; 1460 }, 300); 1461 }); 1462 1463 function firstLoaded(el, event) { 1464 var el = $(el), 1465 uncode_slider = el.find('.uncode-slider'); 1466 el.find('.owl-carousel').css('opacity', 1); 1467 uncode_slider.addClass('slider-loaded'); 1468 window.uncode_textfill(el.find('.owl-item.active')); 1469 //if (!UNCODE.isMobile) { 1470 setTimeout(function() { 1471 var lastDelayElems = animate_elems(el.find('.owl-item.active')); 1472 var lastDelayThumb = animate_thumb(el.find('.owl-item.active .t-inside'), event); 1473 if (uncode_slider.length && el.find('.owl-carousel').data('autoplay')) { 1474 if (lastDelayElems == undefined) lastDelayElems = 0; 1475 if (lastDelayThumb == undefined) lastDelayThumb = 0; 1476 var maxDelay = Math.max(lastDelayElems, lastDelayThumb); 1477 $('> .owl-carousel', uncode_slider).trigger('stop.owl.autoplay'); 1478 setTimeout(function() { 1479 $('> .owl-carousel', uncode_slider).trigger('play.owl.autoplay'); 1480 }, maxDelay); 1481 } 1482 }, 500); 1483 //} 1484 } 1485 1486 function navHover(el) { 1487 var $owlCont = el, 1488 $owlPrev = $owlCont.find('.owl-prev'), 1489 $owlNext = $owlCont.find('.owl-next'), 1490 $owlDots = $owlCont.find('.owl-dots-inside .owl-dots'), 1491 $owlPagination = $owlCont.next(), 1492 owlPrevW = $owlPrev.outerWidth(), 1493 owlNextW = $owlNext.outerWidth(), 1494 owlDotsH = $owlDots.innerHeight(), 1495 owlTime = 400, 1496 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 1497 $owlPrev.css("margin-left", -owlPrevW); 1498 $owlNext.css("margin-right", -owlNextW); 1499 if (!owlNested) $owlDots.css("bottom", -owlDotsH); 1500 $owlCont.mouseenter(function() { 1501 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 1502 $owlPrev.css({ 1503 marginLeft: 0 1504 }); 1505 $owlNext.css({ 1506 marginRight: 0 1507 }); 1508 if (!owlNested) { 1509 $owlDots.css({ 1510 opacity: 1, 1511 bottom: 0 1512 }); 1513 } 1514 }).mouseleave(function() { 1515 owlNested = $owlCont.parent().parent().hasClass('nested-carousel'); 1516 $owlPrev.css({ 1517 marginLeft: -owlPrevW 1518 }); 1519 $owlNext.css({ 1520 marginRight: -owlNextW 1521 }); 1522 if (!owlNested) { 1523 $owlDots.css({ 1524 opacity: 1, 1525 bottom: -owlDotsH 1526 }); 1527 } 1528 }); 1529 }; 1530 1531 function animate_elems($this) { 1532 var lastDelay; 1533 $.each($('.animate_when_almost_visible:not(.t-inside)', $this), function(index, val) { 1534 var element = $(val), 1535 delayAttr = element.attr('data-delay'); 1536 if (delayAttr == undefined) delayAttr = 0; 1537 setTimeout(function() { 1538 element.addClass('start_animation'); 1539 }, delayAttr); 1540 lastDelay = delayAttr; 1541 }); 1542 return lastDelay; 1543 } 1544 1545 function animate_thumb(items, event) { 1546 var lastDelay, 1547 itemIndex, 1548 tempIndex = ($(event.currentTarget).data('tempIndex') == undefined) ? $('.owl-item.active', event.currentTarget).first().index() : $(event.currentTarget).data('tempIndex'), 1549 numActives = $('.owl-item.active', event.currentTarget).length; 1550 $(event.currentTarget).data('tempIndex', event.item.index); 1551 $.each(items, function(index, val) { 1552 var parent = $(val).closest('.owl-item'); 1553 if (!$(val).hasClass('start_animation')) { 1554 if (parent.hasClass('active')) { 1555 var thumbInView = new Waypoint.Inview({ 1556 element: val, 1557 enter: function(direction) { 1558 var element = $(this.element), 1559 delayAttr = parseInt(element.attr('data-delay')), 1560 itemIndex = element.closest('.owl-item').index() + 1, 1561 diffItem = Math.abs(itemIndex - tempIndex) - 1; 1562 if (itemIndex > tempIndex) { 1563 $(event.currentTarget).data('tempIndex', itemIndex); 1564 } 1565 if (isNaN(delayAttr)) delayAttr = 100; 1566 $('.owl-item.cloned[data-index="'+(element.closest('.owl-item').data('index'))+'"] .t-inside', event.currentTarget).addClass('start_animation'); 1567 var objTimeout = setTimeout(function() { 1568 element.addClass('start_animation'); 1569 }, diffItem * delayAttr); 1570 lastDelay = diffItem * delayAttr; 1571 parent.data('objTimeout', objTimeout); 1572 this.destroy(); 1573 } 1574 }); 1575 } 1576 } 1577 }); 1578 return lastDelay; 1579 } 1580 1581 function setItemsHeight(item) { 1582 $.each($('.owl-item', item), function(index, val) { 1583 var availableThumbHeight = $('.t-inside', $(val)).height(), 1584 innerThumbHeight = $('.t-entry-text-tc', $(val)).outerHeight(), 1585 difference = availableThumbHeight - innerThumbHeight; 1586 if ($('.tmb-content-under', val).length) {
1587 var visualPart = $('.t-entry-visual', val); 1588 if (visualPart.length) { 1589 difference -= $('.t-entry-visual', val).height(); 1590 } 1591 } 1592 $('.t-entry > *:last-child', val).css( 'transform', 'translateY('+difference+'px)' ); 1593 }); 1594 } 1595 1596 function pauseOnHover(slider) { 1597 $('.owl-dots, .owl-prev, .owl-next', slider).on({ 1598 mouseenter: function () { 1599 $(slider).addClass('owl-mouseenter'); 1600 $(slider).trigger('stop.owl.autoplay'); 1601 }, 1602 mouseleave: function () { 1603 $(slider).removeClass('owl-mouseenter') 1604 $(slider).trigger('play.owl.autoplay'); 1605 } 1606 }); 1607 } 1608}; 1609 1610UNCODE.owlPlayVideo = function(carousel) { 1611 var player, iframe; 1612 $('.owl-item.active .uncode-video-container', carousel).each(function(index, val) { 1613 var content = $(val).html(); 1614 if (content == '') { 1615 var getCloned = $('.owl-item:not(.active) .uncode-video-container[data-id="'+$(this).attr('data-id')+'"]').children().first().clone(); 1616 $(val).append(getCloned); 1617 } 1618 if ($(this).attr('data-provider') == 'vimeo') { 1619 iframe = $(this).find('iframe'); 1620 player = $f(iframe[0]); 1621 player.api('play'); 1622 } else if ($(this).attr('data-provider') == 'youtube') { 1623 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].playVideo(); 1624 } else { 1625 var player = $(this).find('video'); 1626 if (player.length) { 1627 $(this).find('video')[0].volume = 0; 1628 $(this).find('video')[0].play(); 1629 $(val).css('opacity', 1); 1630 } 1631 } 1632 }); 1633}; 1634 1635UNCODE.owlStopVideo = function(carousel) { 1636 $('.owl-item .uncode-video-container', carousel).each(function(index, val) { 1637 var player, iframe; 1638 if ($(this).attr('data-provider') == 'vimeo') { 1639 iframe = $(this).find('iframe'); 1640 player = $f(iframe[0]); 1641 player.api('pause'); 1642 } else if ($(this).attr('data-provider') == 'youtube') { 1643 if (youtubePlayers[$(this).attr('data-id')] != undefined) youtubePlayers[$(this).attr('data-id')].pauseVideo(); 1644 } else { 1645 var player = $(this).find('video'); 1646 if (player.length) { 1647 $(this).find('video')[0].volume = 0; 1648 $(this).find('video')[0].play(); 1649 } 1650 } 1651 }); 1652}; 1653 1654UNCODE.animations = function() { 1655 //if (!UNCODE.isMobile) { 1656 $.each($('.header-content-inner'), function(index, val) { 1657 var element = $(val), 1658 transition = ''; 1659 if (element.hasClass('top-t-bottom')) transition = 'top-t-bottom'; 1660 if (element.hasClass('bottom-t-top')) transition = 'bottom-t-top'; 1661 if (element.hasClass('left-t-right')) transition = 'left-t-right'; 1662 if (element.hasClass('right-t-left')) transition = 'right-t-left'; 1663 if (element.hasClass('zoom-in')) transition = 'zoom-in'; 1664 if (element.hasClass('zoom-out')) transition = 'zoom-out'; 1665 if (element.hasClass('alpha-anim')) transition = 'alpha-anim'; 1666 if (transition != '') { 1667 $(val).removeClass(transition); 1668 var container = element, 1669 containerDelay = container.attr('data-delay'), 1670 containerSpeed = container.attr('data-speed'), 1671 items = $('.header-title > *, .post-info', container); 1672 $.each(items, function(index, val) { 1673 var element = $(val), 1674 //speedAttr = (containerSpeed == undefined) ? containerSpeed : '', 1675 delayAttr = (containerDelay != undefined) ? containerDelay : 400; 1676 if (!element.hasClass('animate_when_almost_visible')) { 1677 delayAttr = Number(delayAttr) + (400 * index); 1678 if (containerSpeed != undefined) element.attr('data-speed', containerSpeed); 1679 element.addClass(transition + ' animate_when_almost_visible').attr('data-delay', delayAttr); 1680 } 1681 }); 1682 container.css('opacity', 1); 1683 } 1684 }); 1685 //} 1686 1687 if (!window.waypoint_animation) { 1688 window.waypoint_animation = function() { 1689 $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside), .tmb-media .animate_when_almost_visible:not(.start_animation)'), function(index, val) { 1690 var run = true; 1691 if ($(val).closest('.owl-carousel').length > 0) run = false; 1692 if (run) { 1693 new Waypoint({ 1694 element: val, 1695 handler: function() { 1696 var element = $(this.element), 1697 index = element.index(), 1698 delayAttr = element.attr('data-delay'); 1699 if (delayAttr == undefined) delayAttr = 0; 1700 setTimeout(function() { 1701 element.addClass('start_animation'); 1702 }, delayAttr); 1703 this.destroy(); 1704 }, 1705 offset: '90%' 1706 }); 1707 } 1708 }); 1709 } 1710 } 1711 setTimeout(function() { 1712 window.waypoint_animation(); 1713 }, 100); 1714} 1715 1716UNCODE.tapHover = function() { 1717 1718 var $el = $('html.touch .tmb:not(.tmb-no-double-tap) .t-entry-v
1718isual-cont > a'), //.length //html.touch a.btn 1719 elClass = "hover"; 1720 1721 $el.on("click", function(e) { // cambia click con touch start 'touchstart' 1722 var link = $(this); 1723 if (link.hasClass(elClass)) { 1724 return true; 1725 } else { 1726 link.addClass("hover"); 1727 $el.not(this).removeClass(elClass); 1728 e.preventDefault(); 1729 return false; 1730 } 1731 }); 1732}; 1733 1734 1735UNCODE.onePage = function() { 1736 var current = 0, 1737 last = 0, 1738 lastScrollTop = 0, 1739 forceScroll = false, 1740 lastScrolled = 0, 1741 isSectionscroller = ($('.main-onepage').length) ? true : false, 1742 getOffset = (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0); 1743 1744 function init_onepage() { 1745 if (isSectionscroller) { 1746 $("<ul class='onepage-pagination'></ul>").prependTo("body"); 1747 } 1748 last = $('.onepage-section').length - 1; 1749 $.each($('div[data-parent=true]'), function(index, val) { 1750 $(this).attr('data-section', index); 1751 var sectionDown = new Waypoint({ 1752 element: val, 1753 handler: function(direction) { 1754 if (direction == 'down') { 1755 changeMenuActive(this.element, index); 1756 } 1757 }, 1758 offset: 1 + getOffset 1759 }); 1760 var sectionUp = new Waypoint({ 1761 element: val, 1762 handler: function(direction) { 1763 if (direction == 'up') { 1764 changeMenuActive(this.element, index); 1765 } 1766 }, 1767 offset: -1 + getOffset 1768 }); 1769 1770 if (isSectionscroller) { 1771 var label; 1772 if ($(this).attr('data-label') != undefined) label = $(this).attr('data-label'); 1773 else label = ''; 1774 var getName = $(this).attr('data-name'); 1775 if (getName == undefined) getName = index; 1776 if (label != '') { 1777 label = '<span class="cd-label style-accent-bg border-accent-color">' + label + '</span>'; 1778 $('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>"); 1779 } 1780 } 1781 }); 1782 1783 if (isSectionscroller) { 1784 $.each($('ul.onepage-pagination li'), function(index, val) { 1785 var $this = $(val); 1786 $this.on('click', function(evt) { 1787 var el = $('a', evt.currentTarget); 1788 current = lastScrolled = parseInt(el.attr('data-index')); 1789 lastScrolled += 1; 1790 scrollBody(current); 1791 }); 1792 }); 1793 var goToSection = parseInt((window.location.hash).replace(/[^\d.]/g, '')); 1794 if (isNaN(goToSection) && window.location.hash != undefined && window.location.hash != '') { 1795 goToSection = String(window.location.hash).replace(/^#/, ""); 1796 goToSection = Number($('[data-name=' + goToSection + ']').attr('data-section')); 1797 } 1798 if (typeof goToSection === 'number' && !isNaN(goToSection)) { 1799 current = lastScrolled = goToSection; 1800 setTimeout(function() { 1801 scrollBody(goToSection); 1802 }, 500); 1803 } 1804 } 1805 } 1806 1807 function changeMenuActive(section, index) { 1808 current = lastScrolled = parseInt($(section).attr('data-section')); 1809 if (isSectionscroller) { 1810 var newSection = $('.onepage-pagination li a[data-index=' + index + ']'); 1811 if (newSection.length) { 1812 $('ul.onepage-pagination li a').removeClass('is-selected'); 1813 newSection.addClass('is-selected'); 1814 } 1815 } 1816 var getName = $('[data-section=' + index + ']').attr('data-name'); 1817 if (getName != undefined) { 1818 $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(i, val) { 1819 var get_href = $(val).attr('href'); 1820 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 1821 $(val).closest('ul').find('.active').removeClass('active'); 1822 $(val).parent().addClass('active'); 1823 } 1824 }); 1825 } 1826 } 1827 1828 if (isSectionscroller) { 1829 $(window).on('scroll', function() { 1830 var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop']; 1831 if (bodyTop == 0) { 1832 $('ul.onepage-pagination li a').removeClass('is-selected'); 1833 $('.onepage-pagination li a[data-index=0]').addClass('is-selected'); 1834 var getName = $('[data-section=0]').attr('data-name'); 1835 if (getName != undefined) { 1836 $.each($('.menu-container .menu-item > a'), function(i, val) { 1837 var get_href = $(val).attr('href'); 1838 if (get_href != undefined && get_href.substring(get_href.indexOf('#')+1) == getName) { 1839 $(val).closest('ul').find('.active').removeClass('active'); 1840 $(val).parent().addClass('active'); 1841 } 1842 }); 1843 } 1844 } else if ((window.innerHeight + bodyTop) >= $('.box-container').height()) { 1845 var lastSection = $('.onepage-pagination li a[data-index="' + last +'"]'); 1846 if (lastSection.length) { 1847 $('ul.onepage-pagination li a').removeClass('is-selected'); 1848 lastSection.addClass('is-selected'); 1849 } 1850 } 1851 }); 1852 1853 var scrollBody = function(index) { 1854 $('ul.onepage-pagination li a').removeClass('is-selected'); 1855 $('.onepage-pagination li a[data-index=' + index + ']').addClass('is-selected'); 1856 var body = $("html, body"), 1857 bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], 1858 delta = bodyTop - $('[data-section=' + index + ']').offset().top, 1859 scrollTo = $('[data-section=' + index + ']').offset().top - (($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0); 1860 if (index != 0) { 1861 UNCODE.scrolling = true; 1862 } 1863 body.animate({ 1864 scrollTop: (delta > 0) ? scrollTo - 0.1 : scrollTo 1865 }, Math.abs(delta) / 2, 'easeInOutQuad', function() { 1866 setTimeout(function(){ 1867 UNCODE.scrolling = false;
1868 }, 100); 1869 }); 1870 }; 1871 } 1872 1873 init_onepage(); 1874}; 1875 1876UNCODE.stickyElements = function() { 1877 if (!UNCODE.isMobile) { 1878 setTimeout(function() { 1879 if ($('.sticky-element').length) { 1880 var getRowPadding = $('.sticky-element.sticky-sidebar').closest('.row-parent').css("padding-top"), 1881 sideOffset = (getRowPadding != undefined) ? parseInt(getRowPadding.replace("px", "")) : 0; 1882 sideOffset += ($('.menu-sticky .menu-container:not(.menu-hide)').length && ($(window).width() > UNCODE.mediaQuery)) ? $('.menu-sticky .menu-container:not(.menu-hide)').outerHeight() : 0; 1883 if ($('.menu-sticky').length) { 1884 if ($('.sticky-element').hasClass('uncont')) { 1885 if ($('.menu-shrink').length) { 1886 sideOffset += $('.navbar-brand').data('minheight'); 1887 } else sideOffset += parseInt(UNCODE.menuHeight); 1888 } 1889 } 1890 1891 if ($(window).width() > UNCODE.mediaQuery) { 1892 $(".sticky-element").stick_in_parent({ 1893 sticky_class: 'is_stucked', 1894 offset_top: sideOffset, 1895 bottoming: true, 1896 inner_scrolling: false 1897 }); 1898 } 1899 $(window).on('resize', function(event) { 1900 if ($(window).width() > UNCODE.mediaQuery) { 1901 $(".sticky-element").stick_in_parent({ 1902 sticky_class: 'is_stucked', 1903 offset_top: sideOffset, 1904 bottoming: true, 1905 inner_scrolling: false 1906 }); 1907 } else { 1908 $(".sticky-element").trigger("sticky_kit:detach"); 1909 } 1910 }); 1911 } 1912 }, 1000); 1913 } 1914}; 1915 1916UNCODE.scrollEnance = function() { 1917 // 1918 // SmoothScroll for websites v1.4.4 (Balazs Galambosi) 1919 // http://www.smoothscroll.net/ 1920 // 1921 // Licensed under the terms of the MIT license. 1922 // 1923 // You may use it in your theme if you credit me. 1924 // It is also free to use on any individual website. 1925 // 1926 // Exception: 1927 // The only restriction is to not publish any 1928 // extension for browsers or native application 1929 // without getting a written permission first. 1930 // 1931 1932 (function () { 1933 1934 // Scroll Variables (tweakable) 1935 var defaultOptions = { 1936 1937 // Scrolling Core 1938 frameRate : 150, // [Hz] 1939 animationTime : 500, // [ms] 1940 stepSize : 100, // [px] 1941 1942 // Pulse (less tweakable) 1943 // ratio of "tail" to "acceleration" 1944 pulseAlgorithm : true, 1945 pulseScale : 4, 1946 pulseNormalize : 1, 1947 1948 // Acceleration 1949 accelerationDelta : 50, // 50 1950 accelerationMax : 3, // 3 1951 1952 // Keyboard Settings 1953 keyboardSupport : true, // option 1954 arrowScroll : 50, // [px] 1955 1956 // Other 1957 touchpadSupport : false, // ignore touchpad by default 1958 fixedBackground : true, 1959 excluded : '' 1960 }; 1961 1962 var options = defaultOptions; 1963 1964 1965 // Other Variables 1966 var isExcluded = false; 1967 var isFrame = false; 1968 var direction = { x: 0, y: 0 }; 1969 var initDone = false; 1970 var root = document.documentElement; 1971 var activeElement; 1972 var observer; 1973 var refreshSize; 1974 var deltaBuffer = []; 1975 var isMac = /^Mac/.test(navigator.platform); 1976 1977 var key = { left: 37, up: 38, right: 39, down: 40, spacebar: 32, 1978 pageup: 33, pagedown: 34, end: 35, home: 36 }; 1979 var arrowKeys = { 37: 1, 38: 1, 39: 1, 40: 1 }; 1980 1981 /*********************************************** 1982 * INITIALIZE 1983 ***********************************************/ 1984 1985 /** 1986 * Tests if smooth scrolling is allowed. Shuts down everything if not. 1987 */ 1988 function initTest() { 1989 if (options.keyboardSupport) { 1990 addEvent('keydown', keydown); 1991 } 1992 } 1993 1994 /** 1995 * Sets up scrolls array, determines if frames are involved. 1996 */ 1997 function init() { 1998 1999 if (initDone || !document.body) return; 2000 2001 initDone = true; 2002 2003 var body = document.body; 2004 var html = document.documentElement; 2005 var windowHeight = window.innerHeight; 2006 var scrollHeight = body.scrollHeight; 2007 2008 // check compat mode for root element 2009 root = (document.compatMode.indexOf('CSS') >= 0) ? html : body; 2010 activeElement = body; 2011 2012 initTest(); 2013 2014 // Checks if this script is running in a frame 2015 if (top != self) { 2016 isFrame = true; 2017 } 2018 2019 /** 2020 * Please duplicate this radar for a Safari fix! 2021 * rdar://22376037 2022 * https://openradar.appspot.com/radar?id=4965070979203072 2023 * 2024 * Only applies to Safari now, Chrome fixed it in v45: 2025 * This fixes a bug where the areas left and right to 2026 * the content does not trigger the onmousewheel event 2027 * on some pages. e.g.: html, body { height: 100% } 2028 */ 2029 else if (scrollHeight > windowHeight && 2030 (body.offsetHeight <= windowHeight || 2031 html.offsetHeight <= windowHeight)) { 2032 2033 var fullPageElem = document.createElement('div'); 2034 fullPageElem.style.cssText = 'position:absolute; z-index:-10000; ' + 2035 'top:0; left:0; right:0; height:' + 2036 root.scrollHeight + 'px'; 2037 document.body.appendChild(fullPageElem); 2038 2039 // DOM changed (throttled) to fix height 2040 var pendingRefresh; 2041 refreshSize = function () { 2042 if (pendingRefresh) return; // could also be: clearTimeout(pendingRefresh); 2043 pendingRefresh = setTimeout(function () { 2044 if (isExcluded) return; // could be running after cleanup 2045 fullPageElem.style.height = '0'; 2046 fullPageElem.style.height = root.scrollHeight + 'px'; 2047 pendingRefresh = null; 2048 }, 500); // act rarely to stay fast 2049 }; 2050 2051 setTimeout(refreshSize, 10); 2052 2053 addEvent('resize', refreshSize); 2054 2055 // TODO: attributeFilter? 2056 var config = { 2057 attributes: true, 2058 childList: true, 2059 characterData: false 2060 // subtree: true 2061 }; 2062 2063 observer = new MutationObserver(refreshSize); 2064 observer.observe(body, config); 2065 2066 if (root.offsetHeight <= windowHeight) { 2067 var clearfix = document.createElement('div'); 2068 clearfix.style.clear = 'both'; 2069 body.appendChild(clearfix); 2070 } 2071 } 2072 2073 // disable fixed background
vendor: 5,544 bytes, lines 2074-2264
2074 if (!options.fixedBackground && !isExcluded) { 2075 body.style.backgroundAttachment = 'scroll'; 2076 html.style.backgroundAttachment = 'scroll'; 2077 } 2078 } 2079 2080 /** 2081 * Removes event listeners and other traces left on the page. 2082 */ 2083 function cleanup() { 2084 observer && observer.disconnect(); 2085 removeEvent(wheelEvent, wheel); 2086 removeEvent('mousedown', mousedown); 2087 removeEvent('keydown', keydown); 2088 removeEvent('resize', refreshSize); 2089 removeEvent('load', init); 2090 } 2091 2092 2093 /************************************************ 2094 * SCROLLING 2095 ************************************************/ 2096 2097 var que = []; 2098 var pending = false; 2099 var lastScroll = Date.now(); 2100 2101 /** 2102 * Pushes scroll actions to the scrolling queue. 2103 */ 2104 function scrollArray(elem, left, top) { 2105 2106 directionCheck(left, top); 2107 2108 if (options.accelerationMax != 1) { 2109 var now = Date.now(); 2110 var elapsed = now - lastScroll; 2111 if (elapsed < options.accelerationDelta) { 2112 var factor = (1 + (50 / elapsed)) / 2; 2113 if (factor > 1) { 2114 factor = Math.min(factor, options.accelerationMax); 2115 left *= factor; 2116 top *= factor; 2117 } 2118 } 2119 lastScroll = Date.now(); 2120 } 2121 2122 // push a scroll command 2123 que.push({ 2124 x: left, 2125 y: top, 2126 lastX: (left < 0) ? 0.99 : -0.99, 2127 lastY: (top < 0) ? 0.99 : -0.99, 2128 start: Date.now() 2129 }); 2130 2131 // don't act if there's a pending queue 2132 if (pending) { 2133 return; 2134 } 2135 2136 var scrollWindow = (elem === document.body); 2137 2138 var step = function (time) { 2139 2140 var now = Date.now(); 2141 var scrollX = 0; 2142 var scrollY = 0; 2143 2144 for (var i = 0; i < que.length; i++) { 2145 2146 var item = que[i]; 2147 var elapsed = now - item.start; 2148 var finished = (elapsed >= options.animationTime); 2149 2150 // scroll position: [0, 1] 2151 var position = (finished) ? 1 : elapsed / options.animationTime; 2152 2153 // easing [optional] 2154 if (options.pulseAlgorithm) { 2155 position = pulse(position); 2156 } 2157 2158 // only need the difference 2159 var x = (item.x * position - item.lastX) >> 0; 2160 var y = (item.y * position - item.lastY) >> 0; 2161 2162 // add this to the total scrolling 2163 scrollX += x; 2164 scrollY += y; 2165 2166 // update last values 2167 item.lastX += x; 2168 item.lastY += y; 2169 2170 // delete and step back if it's over 2171 if (finished) { 2172 que.splice(i, 1); i--; 2173 } 2174 } 2175 2176 // scroll left and top 2177 if (scrollWindow) { 2178 window.scrollBy(scrollX, scrollY); 2179 } 2180 else { 2181 if (scrollX) elem.scrollLeft += scrollX; 2182 if (scrollY) elem.scrollTop += scrollY; 2183 } 2184 2185 // clean up if there's nothing left to do 2186 if (!left && !top) { 2187 que = []; 2188 } 2189 2190 if (que.length) { 2191 requestFrame(step, elem, (1000 / options.frameRate + 1)); 2192 } else { 2193 pending = false; 2194 } 2195 }; 2196 2197 // start a new queue of actions 2198 requestFrame(step, elem, 0); 2199 pending = true; 2200 } 2201 2202 2203 /*********************************************** 2204 * EVENTS 2205 ***********************************************/ 2206 2207 /** 2208 * Mouse wheel handler. 2209 * @param {Object} event 2210 */ 2211 function wheel(event) { 2212 2213 if (!initDone) { 2214 init(); 2215 } 2216 2217 var target = event.target; 2218 var overflowing = overflowingAncestor(target); 2219 2220 // use default if there's no overflowing 2221 // element or default action is prevented 2222 // or it's a zooming event with CTRL 2223 if (!overflowing || event.defaultPrevented || event.ctrlKey) { 2224 return true; 2225 } 2226 2227 // leave embedded content alone (flash & pdf) 2228 if (isNodeName(activeElement, 'embed') || 2229 (isNodeName(target, 'embed') && /\.pdf/i.test(target.src)) || 2230 isNodeName(activeElement, 'object') || 2231 target.shadowRoot) { 2232 return true; 2233 } 2234 2235 var deltaX = -event.wheelDeltaX || event.deltaX || 0; 2236 var deltaY = -event.wheelDeltaY || event.deltaY || 0; 2237 2238 if (isMac) { 2239 if (event.wheelDeltaX && isDivisible(event.wheelDeltaX, 120)) { 2240 deltaX = -120 * (event.wheelDeltaX / Math.abs(event.wheelDeltaX)); 2241 } 2242 if (event.wheelDeltaY && isDivisible(event.wheelDeltaY, 120)) { 2243 deltaY = -120 * (event.wheelDeltaY / Math.abs(event.wheelDeltaY)); 2244 } 2245 } 2246 2247 // use wheelDelta if deltaX/Y is not available 2248 if (!deltaX && !deltaY) { 2249 deltaY = -event.wheelDelta || 0; 2250 } 2251 2252 // line based scrolling (Firefox mostly) 2253 if (event.deltaMode === 1) { 2254 deltaX *= 40; 2255 deltaY *= 40; 2256 } 2257 2258 // check if it's a touchpad scroll that should be ignored 2259 if (!options.touchpadSupport && isTouchpad(deltaY)) { 2260 return true; 2261 } 2262 2263 // scale by step size 2264 // delta is 120 most of the time
2265 // synaptics seems to send 1 sometimes 2266 if (Math.abs(deltaX) > 1.2) { 2267 deltaX *= options.stepSize / 120; 2268 } 2269 if (Math.abs(deltaY) > 1.2) { 2270 deltaY *= options.stepSize / 120; 2271 } 2272 2273 scrollArray(overflowing, deltaX, deltaY); 2274 event.preventDefault(); 2275 scheduleClearCache(); 2276 } 2277 2278 /** 2279 * Keydown event handler. 2280 * @param {Object} event 2281 */ 2282 function keydown(event) { 2283 2284 var target = event.target; 2285 var modifier = event.ctrlKey || event.altKey || event.metaKey || 2286 (event.shiftKey && event.keyCode !== key.spacebar); 2287 2288 // our own tracked active element could've been removed from the DOM 2289 if (!document.body.contains(activeElement)) { 2290 activeElement = document.activeElement; 2291 } 2292 2293 // do nothing if user is editing text 2294 // or using a modifier key (except shift) 2295 // or in a dropdown 2296 // or inside interactive elements 2297 var inputNodeNames = /^(textarea|select|embed|object)$/i; 2298 var buttonTypes = /^(button|submit|radio|checkbox|file|color|image)$/i; 2299 if ( event.defaultPrevented || 2300 inputNodeNames.test(target.nodeName) || 2301 isNodeName(target, 'input') && !buttonTypes.test(target.type) || 2302 isNodeName(activeElement, 'video') || 2303 isInsideYoutubeVideo(event) || 2304 target.isContentEditable || 2305 modifier ) { 2306 return true; 2307 } 2308 2309 // [spacebar] should trigger button press, leave it alone 2310 if ((isNodeName(target, 'button') || 2311 isNodeName(target, 'input') && buttonTypes.test(target.type)) && 2312 event.keyCode === key.spacebar) { 2313 return true; 2314 } 2315 2316 // [arrwow keys] on radio buttons should be left alone 2317 if (isNodeName(target, 'input') && target.type == 'radio' && 2318 arrowKeys[event.keyCode]) { 2319 return true; 2320 } 2321 2322 var shift, x = 0, y = 0; 2323 var elem = overflowingAncestor(activeElement); 2324 var clientHeight = elem.clientHeight; 2325 2326 if (elem == document.body) { 2327 clientHeight = window.innerHeight; 2328 } 2329 2330 switch (event.keyCode) { 2331 case key.up: 2332 y = -options.arrowScroll; 2333 break; 2334 case key.down: 2335 y = options.arrowScroll; 2336 break; 2337 case key.spacebar: // (+ shift) 2338 shift = event.shiftKey ? 1 : -1; 2339 y = -shift * clientHeight * 0.9; 2340 break; 2341 case key.pageup: 2342 y = -clientHeight * 0.9; 2343 break; 2344 case key.pagedown: 2345 y = clientHeight * 0.9; 2346 break; 2347 case key.home: 2348 y = -elem.scrollTop; 2349 break; 2350 case key.end: 2351 var damt = elem.scrollHeight - elem.scrollTop - clientHeight; 2352 y = (damt > 0) ? damt+10 : 0; 2353 break; 2354 case key.left: 2355 x = -options.arrowScroll; 2356 break; 2357 case key.right: 2358 x = options.arrowScroll; 2359 break; 2360 default: 2361 return true; // a key we don't care about 2362 } 2363 2364 scrollArray(elem, x, y); 2365 event.preventDefault(); 2366 scheduleClearCache(); 2367 } 2368 2369 /** 2370 * Mousedown event only for updating activeElement 2371 */ 2372 function mousedown(event) { 2373 activeElement = event.target; 2374 } 2375 2376 2377 /*********************************************** 2378 * OVERFLOW 2379 ***********************************************/ 2380 2381 var uniqueID = (function () { 2382 var i = 0; 2383 return function (el) { 2384 return el.uniqueID || (el.uniqueID = i++); 2385 }; 2386 })(); 2387 2388 var cache = {}; // cleared out after a scrolling session 2389 var clearCacheTimer; 2390 2391 //setInterval(function () { cache = {}; }, 10 * 1000); 2392 2393 function scheduleClearCache() { 2394 clearTimeout(clearCacheTimer); 2395 clearCacheTimer = setInterval(function () { cache = {}; }, 1*1000); 2396 } 2397 2398 function setCache(elems, overflowing) { 2399 for (var i = elems.length; i--;) 2400 cache[uniqueID(elems[i])] = overflowing; 2401 return overflowing; 2402 } 2403 2404 // (body) (root) 2405 // | hidden | visible | scroll | auto | 2406 // hidden | no | no | YES | YES | 2407 // visible | no | YES | YES | YES | 2408 // scroll | no | YES | YES | YES | 2409 // auto | no | YES | YES | YES | 2410 2411 function overflowingAncestor(el) { 2412 var elems = []; 2413 var body = document.body; 2414 var rootScrollHeight = root.scrollHeight; 2415 do {
2416 var cached = cache[uniqueID(el)]; 2417 if (cached) { 2418 return setCache(elems, cached); 2419 } 2420 elems.push(el); 2421 if (rootScrollHeight === el.scrollHeight) { 2422 var topOverflowsNotHidden = overflowNotHidden(root) && overflowNotHidden(body); 2423 var isOverflowCSS = topOverflowsNotHidden || overflowAutoOrScroll(root); 2424 if (isFrame && isContentOverflowing(root) || 2425 !isFrame && isOverflowCSS) { 2426 return setCache(elems, getScrollRoot()); 2427 } 2428 } else if (isContentOverflowing(el) && overflowAutoOrScroll(el)) { 2429 return setCache(elems, el); 2430 } 2431 } while (el = el.parentElement); 2432 } 2433 2434 function isContentOverflowing(el) { 2435 return (el.clientHeight + 10 < el.scrollHeight); 2436 } 2437 2438 // typically for <body> and <html> 2439 function overflowNotHidden(el) { 2440 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 2441 return (overflow !== 'hidden'); 2442 } 2443 2444 // for all other elements 2445 function overflowAutoOrScroll(el) { 2446 var overflow = getComputedStyle(el, '').getPropertyValue('overflow-y'); 2447 return (overflow === 'scroll' || overflow === 'auto'); 2448 } 2449 2450 2451 /*********************************************** 2452 * HELPERS 2453 ***********************************************/ 2454 2455 function addEvent(type, fn) { 2456 window.addEventListener(type, fn, false); 2457 } 2458 2459 function removeEvent(type, fn) { 2460 window.removeEventListener(type, fn, false); 2461 } 2462 2463 function isNodeName(el, tag) { 2464 return (el.nodeName||'').toLowerCase() === tag.toLowerCase(); 2465 } 2466 2467 function directionCheck(x, y) { 2468 x = (x > 0) ? 1 : -1; 2469 y = (y > 0) ? 1 : -1; 2470 if (direction.x !== x || direction.y !== y) { 2471 direction.x = x; 2472 direction.y = y; 2473 que = []; 2474 lastScroll = 0; 2475 } 2476 } 2477 2478 var deltaBufferTimer; 2479 2480 if (window.localStorage && localStorage.SS_deltaBuffer) { 2481 deltaBuffer = localStorage.SS_deltaBuffer.split(','); 2482 } 2483 2484 function isTouchpad(deltaY) { 2485 if (!deltaY) return; 2486 if (!deltaBuffer.length) { 2487 deltaBuffer = [deltaY, deltaY, deltaY]; 2488 } 2489 deltaY = Math.abs(deltaY); 2490 deltaBuffer.push(deltaY); 2491 deltaBuffer.shift(); 2492 clearTimeout(deltaBufferTimer); 2493 deltaBufferTimer = setTimeout(function () { 2494 if (window.localStorage) { 2495 localStorage.SS_deltaBuffer = deltaBuffer.join(','); 2496 } 2497 }, 1000); 2498 return !allDeltasDivisableBy(120) && !allDeltasDivisableBy(100); 2499 } 2500 2501 function isDivisible(n, divisor) { 2502 return (Math.floor(n / divisor) == n / divisor); 2503 } 2504 2505 function allDeltasDivisableBy(divisor) { 2506 return (isDivisible(deltaBuffer[0], divisor) && 2507 isDivisible(deltaBuffer[1], divisor) && 2508 isDivisible(deltaBuffer[2], divisor)); 2509 } 2510 2511 function isInsideYoutubeVideo(event) { 2512 var elem = event.target; 2513 var isControl = false; 2514 if (document.URL.indexOf ('www.youtube.com/watch') != -1) { 2515 do { 2516 isControl = (elem.classList && 2517 elem.classList.contains('html5-video-controls')); 2518 if (isControl) break; 2519 } while (elem = elem.parentNode); 2520 } 2521 return isControl; 2522 } 2523 2524 var requestFrame = (function () { 2525 return (window.requestAnimationFrame || 2526 window.webkitRequestAnimationFrame || 2527 window.mozRequestAnimationFrame || 2528 function (callback, element, delay) { 2529 window.setTimeout(callback, delay || (1000/60)); 2530 }); 2531 })(); 2532 2533 var MutationObserver = (window.MutationObserver || 2534 window.WebKitMutationObserver || 2535 window.MozMutationObserver); 2536 2537 var getScrollRoot = (function() { 2538 var SCROLL_ROOT; 2539 return function() { 2540 if (!SCROLL_ROOT) { 2541 var dummy = document.createElement('div'); 2542 dummy.style.cssText = 'height:10000px;width:1px;'; 2543 document.body.appendChild(dummy); 2544 var bodyScrollTop = document.body.scrollTop; 2545 var docElScrollTop = document.documentElement.scrollTop; 2546 window.scrollBy(0, 3); 2547 if (document.body.scrollTop != bodyScrollTop) 2548 (SCROLL_ROOT = document.body); 2549 else 2550 (SCROLL_ROOT = document.documentElement); 2551 window.scrollBy(0, -3); 2552 document.body.removeChild(dummy); 2553 } 2554 return SCROLL_ROOT; 2555 }; 2556 })(); 2557 2558 2559 /*********************************************** 2560 * PULSE (by Michael Herf) 2561 ***********************************************/ 2562 2563 /** 2564 * Viscous fluid with a pulse for part and decay for the rest. 2565 * - Applies a fixed force over an interval (a damped acceleration), and 2566 * - Lets the exponential bleed away the velocity over a longer interval 2567 * - Michael Herf, http://stereopsis.com/stopping/ 2568 */ 2569 function pulse_(x) { 2570 var val, start, expx; 2571 // test 2572 x = x * options.pulseScale; 2573 if (x < 1) { // acceleartion 2574 val = x - (1 - Math.exp(-x)); 2575 } else { // tail 2576 // the previous animation ended here: 2577 start = Math.exp(-1); 2578 // simple viscous drag 2579 x -= 1; 2580 expx = 1 - Math.exp(-x); 2581 val = start + (expx * (1 - start)); 2582 }
2583 return val * options.pulseNormalize; 2584 } 2585 2586 function pulse(x) { 2587 if (x >= 1) return 1; 2588 if (x <= 0) return 0; 2589 2590 if (options.pulseNormalize == 1) { 2591 options.pulseNormalize /= pulse_(1); 2592 } 2593 return pulse_(x); 2594 } 2595 2596 2597 /*********************************************** 2598 * FIRST RUN 2599 ***********************************************/ 2600 2601 var userAgent = window.navigator.userAgent; 2602 var isEdge = /Edge/.test(userAgent); // thank you MS 2603 var isChrome = /chrome/i.test(userAgent) && !isEdge; 2604 var isSafari = /safari/i.test(userAgent) && !isEdge; 2605 var isMobile = /mobile/i.test(userAgent); 2606 var isIEWin7 = /Windows NT 6.1/i.test(userAgent) && /rv:11/i.test(userAgent); 2607 var isEnabledForBrowser = (isChrome || isSafari || isIEWin7) && !isMobile; 2608 2609 var wheelEvent; 2610 if ('onwheel' in document.createElement('div')) 2611 wheelEvent = 'wheel'; 2612 else if ('onmousewheel' in document.createElement('div')) 2613 wheelEvent = 'mousewheel'; 2614 2615 if (wheelEvent && isEnabledForBrowser) { 2616 addEvent(wheelEvent, wheel); 2617 addEvent('mousedown', mousedown); 2618 addEvent('load', init); 2619 } 2620 2621 2622 /*********************************************** 2623 * PUBLIC INTERFACE 2624 ***********************************************/ 2625 2626 function SmoothScroll(optionsToSet) { 2627 for (var key in optionsToSet) 2628 if (defaultOptions.hasOwnProperty(key)) 2629 options[key] = optionsToSet[key]; 2630 } 2631 SmoothScroll.destroy = cleanup; 2632 2633 if (window.SmoothScrollOptions) // async API 2634 SmoothScroll(window.SmoothScrollOptions); 2635 2636 if (typeof define === 'function' && define.amd) 2637 define(function() { 2638 return SmoothScroll; 2639 }); 2640 else if ('object' == typeof exports) 2641 module.exports = SmoothScroll; 2642 else 2643 window.SmoothScroll = SmoothScroll; 2644 2645 })(); 2646}; 2647 2648 UNCODE.init = function() { 2649 UNCODE.utils(); 2650 UNCODE.menuSystem(); 2651 UNCODE.okvideo(); 2652 UNCODE.tapHover(); 2653 UNCODE.isotopeLayout(); 2654 UNCODE.lightbox(); 2655 UNCODE.backVideo(); 2656 UNCODE.carousel($('body')); 2657 UNCODE.animations(); 2658 UNCODE.stickyElements(); 2659 UNCODE.disableHoverScroll(); 2660 if (!UNCODE.isMobile) { 2661 UNCODE.onePage(); 2662 } 2663 if ($('body.smooth-scroller').length) { 2664 setTimeout(function(){ 2665 UNCODE.scrollEnance(); 2666 }, 300); 2667 } 2668 } 2669 UNCODE.init(); 2670})(jQuery); 2671
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.