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