/* ---------------------------------------------------------- * Uncode App * ---------------------------------------------------------- */ (function($) { "use strict"; var UNCODE = window.UNCODE || {}; window.UNCODE = UNCODE; window.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(/* function */ callback, /* DOMElement */ element){ window.setTimeout(callback, 1000 / 60); }; })(); window.requestTimeout = function(fn, delay) { if( !window.requestAnimationFrame && !window.webkitRequestAnimationFrame && !(window.mozRequestAnimationFrame && window.mozCancelRequestAnimationFrame) && // Firefox 5 ships without cancel support !window.oRequestAnimationFrame && !window.msRequestAnimationFrame) return window.setTimeout(fn, delay); var start = new Date().getTime(), handle = new Object(); function loop(){ var current = new Date().getTime(), delta = current - start; delta >= delay ? fn.call() : handle.value = requestAnimFrame(loop); }; handle.value = requestAnimFrame(loop); return handle; }; window.clearRequestTimeout = function(handle) { if ( typeof handle !== 'undefined' ) { window.cancelAnimationFrame ? window.cancelAnimationFrame(handle.value) : window.webkitCancelAnimationFrame ? window.webkitCancelAnimationFrame(handle.value) : window.webkitCancelRequestAnimationFrame ? window.webkitCancelRequestAnimationFrame(handle.value) : /* Support for legacy API */ window.mozCancelRequestAnimationFrame ? window.mozCancelRequestAnimationFrame(handle.value) : window.oCancelRequestAnimationFrame ? window.oCancelRequestAnimationFrame(handle.value) : window.msCancelRequestAnimationFrame ? window.msCancelRequestAnimationFrame(handle.value) : clearTimeout(handle); } }; UNCODE.utils = function() { $('.btn-tooltip').tooltip(); $('a').hover(function() { $(this).attr('data-title', $(this).attr('title')); $(this).removeAttr('title'); }, function() { $(this).attr('title', $(this).attr('data-title')); }); $('.counter').each(function(){ var $counter = $(this); if ( $counter.closest( '.owl-carousel' ).length ) { return; } $counter.addClass('started').counterUp({ delay: 10, time: 1500 }); }) $('[data-countdown]').each(function() { var $this = $(this), finalDate = $(this).data('countdown'); $this.countdown(finalDate, function(event) { $this.html(event.strftime('%D ' + SiteParameters.days + ' %H ' + SiteParameters.hours + ' %M ' + SiteParameters.minutes + ' %S ' + SiteParameters.seconds + '')); }); }); var share_button_top = new Share(".share-button", { ui: { flyout: "top center", button_font: false, button_text: '', icon_font: false } }); this.get_scroll_offset = function(target) { var scroll_offset = 0, is_first_link = false; if ($('.menu-hide').length || $('.menu-hide-vertical').length) { if (UNCODE.bodyTop > UNCODE.wheight / 2) { UNCODE.hideMenu(100); } } if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { scroll_offset += $('.menu-sticky .menu-container').outerHeight(); } else { if (($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length)) { scroll_offset += UNCODE.menuMobileHeight; } else { if (UNCODE.wwidth < UNCODE.mediaQuery) { scroll_offset += $('.main-menu-container.open-items').height(); } } } scroll_offset += UNCODE.bodyBorder; return scroll_offset; } if ( !UNCODE.isFullPage ) { $('a[href*="#"]').click(function(e) { var hash = (e.currentTarget).hash, is_scrolltop = $(e.currentTarget).hasClass('scroll-top') ? true : false, anchor = ''; if ($(e.currentTarget).data('toggle') == 'tab' || $(e.currentTarget).data('toggle') == 'collapse') return; if ($(e.currentTarget).hasClass('woocommerce-review-link')) { e.preventDefault(); if (!$('#tab-reviews').is(':visible')) { $('a[href="#tab-reviews"]').trigger('click'); } var calc_scroll = $('.wootabs .tab-content').offset().top; calc_scroll -= UNCODE.get_scroll_offset(e.target); var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); } var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], delta = bodyTop - calc_scroll, scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; requestTimeout(function(){ if (scrollSpeed == 0) { $('html, body').scrollTop(calc_scroll); UNCODE.scrolling = false; } else { $('html, body').animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; } ); } }, 200); return; } if (hash != undefined) { var specialFormat = /[ !@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/; var anchor = this.hash.slice(1); if ( !specialFormat.test(hash) && location.pathname.replace(/^\//g,'') == this.pathname.replace(/^\//g,'') && location.hostname == this.hostname) { if ( !specialFormat.test(hash) ) { if ( $(hash).length ) anchor = $(hash); } } } if (is_scrolltop || anchor != '') { if (is_scrolltop) { e.preventDefault(); var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(bodyTop) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; if (scrollSpeed == 0) { $('html, body').scrollTop(0); UNCODE.scrolling = false; } else { $('html, body').animate({ scrollTop: 0 }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; }); } } else { var scrollSection = (typeof anchor === 'string') ? $('[data-name=' + anchor + ']') : anchor; $.each($('.menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a'), function(index, val) { var get_href = $(val).attr('href'); if (get_href != undefined) { if (get_href.substring(get_href.indexOf('#')+1) == anchor) $(val).parent().addClass('active'); else $(val).parent().removeClass('active'); } }); if (scrollSection.length) { if ( $('body').hasClass('uncode-scroll-no-history') ) { e.preventDefault(); } if (UNCODE.menuOpened) { if (UNCODE.wwidth < UNCODE.mediaQuery) window.dispatchEvent(UNCODE.menuMobileTriggerEvent); else $('.mmb-container-overlay .overlay-close').trigger('click'); } var calc_scroll = scrollSection.offset().top, getOffset = UNCODE.get_scroll_offset(), $logo = $('#logo-container-mobile'), logoH, $menu = $('#masthead .menu-container'), menuH; calc_scroll -= getOffset; var bodyTop = document.documentElement['scrollTop'] || document.body['scrollTop'], delta = bodyTop - calc_scroll, scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(delta) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { logoH = $logo.outerHeight(), menuH = $menu.outerHeight(); if ( calc_scroll < ( logoH + menuH ) ) { calc_scroll = 0; } } if (scrollSpeed == 0) { $('html, body').scrollTop(calc_scroll); UNCODE.scrolling = false; } else { $('html, body').animate({ scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; if (getOffset != UNCODE.get_scroll_offset(e.target)) { calc_scroll = scrollSection.offset().top; getOffset = UNCODE.get_scroll_offset(e.target); calc_scroll -= getOffset; $('html, body').animate({ scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; } ); } }); } } } } }); $('.header-scrolldown').on('click', function(event) { event.preventDefault(); var pageHeader = $(event.target).closest('#page-header'), pageHeaderTop = pageHeader.offset().top, pageHeaderHeight = pageHeader.outerHeight(), scrollSpeed = (SiteParameters.constant_scroll == 'on') ? Math.abs(pageHeaderTop + pageHeaderHeight) / parseFloat(SiteParameters.scroll_speed) : SiteParameters.scroll_speed; if (scrollSpeed < 1000 && SiteParameters.constant_scroll == 'on') scrollSpeed = 1000; var calc_scroll = pageHeaderTop + pageHeaderHeight, getOffset = UNCODE.get_scroll_offset(event.target); calc_scroll -= getOffset; var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && $('.menu-shrink').length ) { scrollTo += UNCODE.menuHeight - ( $('.navbar-brand').data('minheight') + shrink ); } if (scrollSpeed == 0) { $('html, body').scrollTop(calc_scroll); UNCODE.scrolling = false; } else { $('html, body').animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; if (getOffset != UNCODE.get_scroll_offset(event.target)) { calc_scroll = pageHeaderTop + pageHeaderHeight; getOffset = UNCODE.get_scroll_offset(e.target); calc_scroll -= getOffset; $('html, body').animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { UNCODE.scrolling = false; } ); } } ); } }); } // TAB DATA-API // ============ $(document).on('click.bs.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function(e) { e.preventDefault() $(this).tab('show'); requestTimeout(function() { window.dispatchEvent(UNCODE.boxEvent); }, 300); }); // COLLAPSE DATA-API // ================= $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function(e) { var $this = $(this), href var target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 var $target = $(target) var data = $target.data('bs.collapse') var option = data ? 'toggle' : $this.data() var parent = $this.attr('data-parent') var $parent = parent && $(parent) var $title = $(this).parent() if ($parent) { $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') if ($title.hasClass('active')) { $title.removeClass('active'); } else { $parent.find('.panel-title').removeClass('active') $title[!$target.hasClass('in') ? 'addClass' : 'removeClass']('active') } } $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') }); // FitText // ================= window.uncode_textfill = function(el, loaded) { if (el == undefined) el = $('body'); $.each($('.bigtext', el), function(index, val) { $(val).bigtext({ minfontsize: 24 }); if (!$(val).parent().hasClass('blocks-animation') && !$(val).hasClass('animate_when_almost_visible')) $(val).css({ opacity: 1 }); requestTimeout(function() { if ($(val).find('.animate_when_almost_visible').length != 0) { $(val).css({opacity: 1}); } }, 400); }); } window.uncode_textfill(); // Colomun hover effect // ================= $(document).on('mouseenter', '.col-link', function(e) { var uncol = $(e.target).prev('.uncol'), el = uncol.find('.column-background'); if (el) { $('.btn-container .btn', uncol).toggleClass('active'); var elOverlay = $(el[0]).find('.block-bg-overlay'); if (elOverlay.length) { var getOpacity = $(elOverlay).css('opacity'); if (getOpacity != 1) { getOpacity = Math.round(getOpacity * 100) / 100; var newOpacity = getOpacity + .1; $(elOverlay).data('data-opacity', getOpacity); $(elOverlay).css('opacity', newOpacity); } } } }).on('mouseleave', '.col-link', function(e) { var uncol = $(e.target).prev('.uncol'), el = uncol.find('.column-background'); $('.btn-container .btn', uncol).toggleClass('active'); if (el) { var elOverlay = $(el[0]).find('.block-bg-overlay'); if (elOverlay.length) { var getOpacity = $(elOverlay).data('data-opacity'); $(elOverlay).css('opacity', getOpacity); } } }); // REVSLIDER API // ============ $(window).on("load", function() { $('.rev_slider_wrapper').each(function(){ var $this = jQuery(this), id_array = $this.attr("id").split("_"), id = id_array[2]; if (id != undefined && id != '') { $.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);}})'); $.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);}})'); } }); }); // LAYERSLIDE API // ============ $(window).on("load", function() { $('.ls-wp-container').on('slideTimelineDidStart', function( event, slider ) { var slideData = slider.slides.current.data, scrolltop = $(document).scrollTop(); if( slideData && slideData.skin ) { UNCODE.switchColorsMenu(scrolltop, slideData.skin); } }); }); // Admin bar // ============ $(window).resize(function() { if ($('html').hasClass('admin-mode')) { var getAdminBar = $('#wpadminbar'); if (getAdminBar.length) { if (getAdminBar.css('position') !== 'hidden') { var getAdminBarHeight = getAdminBar.height(); if (getAdminBar.css('position') === 'fixed') { $('html').css({'margin-top':getAdminBarHeight + 'px','padding-top': UNCODE.bodyBorder+'px'}); $('.body-borders .top-border').css({'margin-top':getAdminBarHeight+'px'}); } else { $('html').css({'padding-top':UNCODE.bodyBorder + 'px','margin-top':'0px'}); $('.body-borders .top-border').css({'margin-top':'0px'}); } } } } }); // Facebook // =========== this.fb_timeout = undefined; $(window).resize(function() { $('.facebook-object').each(function(index, el) { var el = $(el), parentWidth = el.closest('.tmb').width(); el.width(parentWidth); }); if (this.fb_timeout == undefined) { if ($('.facebook-object').length) { window.clearTimeout(this.fb_timeout); this.fb_timeout = window.setTimeout(function(msg) { window.dispatchEvent(UNCODE.boxEvent); }, 1000); } } }); // Print // =========== var beforePrint = function() { window.dispatchEvent(new CustomEvent('resize')); window.dispatchEvent(UNCODE.boxEvent); }; if (window.matchMedia) { var mediaQueryList = window.matchMedia('print'); mediaQueryList.addListener(function(mql) { if (mql.matches) { beforePrint(); } }); } window.onbeforeprint = beforePrint; } UNCODE.lettering = function() { var setCTA; var highlightStill = function(){ var $heading_texts = $('.heading-text:not(.animate_inner_when_almost_visible)'); $.each($heading_texts, function(key, el) { var $heading = $(el); if ( ! $('.heading-text-highlight-inner[data-animated="yes"]', $heading).length ) { return; } var waypoint = new Waypoint({ element: el, handler: function() { var $anims = $('.heading-text-highlight-inner[data-animated="yes"]', this.element), anims_l = $anims.length; $anims.each(function(_key_, _el_){ var $anim = $(_el_); if ( ! $anim.hasClass('heading-text-highlight-animated') ) { $anim.addClass('heading-text-highlight-animated'); if ( $heading.data('animate') === true ) { $anim.css({ '-webkit-transition-duration': '0ms', '-moz-transition-duration': '0ms', '-o-transition-duration': '0ms', 'transition-duration': '0ms', }); } else { $anim.css({ '-webkit-transition-delay': ((_key_ + 2) * 200) + 'ms', '-moz-transition-delay': ((_key_ + 2) * 200) + 'ms', '-o-transition-delay': ((_key_ + 2) * 200) + 'ms', 'transition-delay': ((_key_ + 2) * 200) + 'ms', }); } } }); $anims.last().one('webkitTransitionEnd oTransitionEnd mozTransitionEnd msTransitionEnd transitionEnd', function(e) { $heading.data('animate', true); }); $anims.removeAttr('data-animated'); }, offset: '100%' }); }); Waypoint.refreshAll(); $( document.body ).trigger('uncode_waypoints'); } requestTimeout(function(){ highlightStill(); $(window).on( 'resize', function(){ clearRequestTimeout(setCTA); setCTA = requestTimeout( highlightStill, 100 ); }); }, 400); }; UNCODE.menuSystem = function() { function menuMobile() { var $body = $('body'), $mobileToggleButton = $('.mobile-menu-button'), $box, $el, $el_transp, elHeight, check, animating = false, stickyMobile = false, menuClose = new CustomEvent('menuMobileClose'), menuOpen = new CustomEvent('menuMobileOpen'); UNCODE.menuOpened = false; $mobileToggleButton.on('click', function(event) { var btn = this; if ($(btn).hasClass('overlay-close')) return; event.preventDefault(); if (UNCODE.wwidth < UNCODE.mediaQuery) { $box = $(this).closest('.box-container').find('.main-menu-container'); $el = $(this).closest('.box-container').find('.menu-horizontal-inner:not(.row-brand), .menu-sidebar-inner'); $el_transp = $('.menu-absolute.menu-transparent'); if (UNCODE.isMobile && $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical').length) { stickyMobile = true; elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; } else { elHeight = 0; $.each($el, function(index, val) { elHeight += $(val).outerHeight(); }); } var open = function() { if (!animating) { $body.addClass('open-overlay-menu'); window.dispatchEvent(menuOpen); animating = true; UNCODE.menuOpened = true; if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { $('.main-header > .vmenu-container').css({position:'fixed', top: ($('.menu-container').outerHeight() + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); if ($('body.menu-offcanvas').length) { $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); $('.vmenu-container.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); } else $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed'}); } if ($('body.hmenu-center').length && ($('.menu-hide, .menu-sticky').length)) { $('.menu-container:not(.sticky-element):not(.isotope-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); } btn.classList.add('close'); $box.addClass('open-items'); if ($el_transp.length && $('body.menu-mobile-transparent').length) { $el_transp.addClass('is_mobile_open'); } $box.animate({ height: elHeight }, 600, "easeInOutCirc", function() { animating = false; if (!stickyMobile) $box.css('height', 'auto'); }); } }; var close = function() { if (!animating) { window.dispatchEvent(menuClose); animating = true; UNCODE.menuOpened = false; btn.classList.remove('close'); btn.classList.add('closing'); $box.addClass('close'); requestTimeout(function() { $box.removeClass('close'); $box.removeClass('open-items'); btn.classList.remove('closing'); if ($el_transp.length) { $el_transp.removeClass('is_mobile_open'); } }, 500); $box.animate({ height: 0 }, { duration: 600, easing: "easeInOutCirc", complete: function(elements) { $(elements).css('height', ''); animating = false; if ($('body[class*="vmenu-"]').length) $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.isotope-filters)').css('position','relative'); $body.removeClass('open-overlay-menu'); } }); } }; check = (!UNCODE.menuOpened) ? open() : close(); } }); window.addEventListener('menuMobileTrigged', function(e) { $mobileToggleButton.trigger('click'); }); window.addEventListener("resize", function() { if ($(window).width() < UNCODE.mediaQuery) { if (UNCODE.isMobile) { var $box = $('.box-container .main-menu-container'), $el = $('.box-container .menu-horizontal-inner, .box-container .menu-sidebar-inner'); if ($($box).length && $($box).hasClass('open-items') && $($box).css('height') != 'auto') { if ($('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only').length) { elHeight = 0; $.each($el, function(index, val) { elHeight += $(val).outerHeight(); }); elHeight = window.innerHeight - $('.menu-wrapper.menu-sticky .menu-container .row-menu-inner, .menu-wrapper.menu-hide-only .menu-container .row-menu-inner').height() - (UNCODE.bodyBorder * 2) + 1; $($box).css('height', elHeight + 'px'); } } } } else { $('.menu-hide-vertical').removeAttr('style'); $('.menu-container-mobile').removeAttr('style'); $('.vmenu-container.menu-container').removeAttr('style'); } }); }; function menuOffCanvas() { var menuClose = new CustomEvent('menuCanvasClose'), menuOpen = new CustomEvent('menuCanvasOpen'); $('.menu-primary .menu-button-offcanvas').click(function(event) { if ($(window).width() > UNCODE.mediaQuery) { if ($(event.currentTarget).hasClass('close')) { $(event.currentTarget).removeClass('close'); $(event.currentTarget).addClass('closing'); requestTimeout(function() { $(event.currentTarget).removeClass('closing'); window.dispatchEvent(menuClose); }, 500); } else { $(event.currentTarget).addClass('close'); window.dispatchEvent(menuOpen); } } $('body').toggleClass('off-opened'); }); }; function menuSmart() { var $menusmart = $('[class*="menu-smart"]'); if ($menusmart.length > 0) { $menusmart.smartmenus({ subIndicators: false, subIndicatorsPos: 'append', subMenusMinWidth: '13em', subIndicatorsText: '', showTimeout: 50, hideTimeout: 50, showFunction: function($ul, complete) { $ul.fadeIn(0, 'linear', complete); $ul.addClass('open-animated'); }, hideFunction: function($ul, complete) { var fixIE = $('html.ie').length; if (fixIE) { var $rowParent = $($ul).closest('.main-menu-container'); $rowParent.height('auto'); } $ul.fadeOut(0, 'linear', complete); $ul.removeClass('open-animated'); }, collapsibleShowFunction: function($ul, complete) { $ul.slideDown(400, 'easeInOutCirc', function() { 12}); }, collapsibleHideFunction: function($ul, complete) { $ul.slideUp(200, 'easeInOutCirc', complete); }, hideOnClick: true }); if ( $('body').hasClass('menu-accordion-active') ) { requestTimeout(function(){ $menusmart.smartmenus( 'itemActivate', $menusmart.find( '.current-menu-item > a' ).eq( -1 ) ); $menusmart.addClass('menu-smart-init'); }, 1000); } } }; function menuOverlay() { if ( $('.overlay').length ) { $('.overlay').removeClass('hidden'); } if ($('.overlay-sequential, .menu-mobile-animated').length > 0) { $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li').each(function(index, el) { var transDelay = (index / 20) + 0.1; if ( $('body').hasClass('menu-mobile-centered') && $(window).width() < UNCODE.mediaQuery ) transDelay = transDelay + 0.3; $(this)[0].setAttribute('style', '-webkit-transition-delay:' + transDelay + 's; -moz-transition-delay:' + transDelay + 's; -ms-transition-delay:' + transDelay + 's; -o-transition-delay:' + transDelay + 's; transition-delay:' + transDelay + 's'); }); } }; function menuAppend() { var $body = $('body'), $menuCont = $('.menu-container'), $cta = $('.navbar-cta'), $ul = $('.navbar-main ul.menu-primary-inner'), $ulCta, $firstMenu = $('.main-menu-container:first-child', $menuCont), $secondMenu = $('.main-menu-container:last-child', $menuCont), $firstNav = $('.navbar-nav:first-child', $firstMenu), $secondNav = $('.navbar-nav:first-child', $secondMenu), $ulFirst = $('> ul', $firstNav), $ulSecond = $('> ul', $secondNav), setCTA, appendCTA = function(){ return true; }, appendSplit = function(){ return true; }; if ( $body.hasClass('cta-not-appended') ) return false; if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { $ulCta = $('> ul', $cta); appendCTA = function(){ if (UNCODE.wwidth < UNCODE.mediaQuery) { $ul.after($ulCta); } else { $cta.append($ulCta); } } } appendCTA(); if ( ( $body.hasClass('hmenu-center-double') ) ) { appendSplit = function(){ if (UNCODE.wwidth < UNCODE.mediaQuery) { if ( $ulSecond.length ) { $ulSecond.before($ulFirst); } $firstMenu.hide(); } else { $firstNav.append($ulFirst); $firstMenu.css({ 'display': 'table-cell' }); } } } appendSplit(); $(window).on( 'resize', function(){ clearRequestTimeout(setCTA); setCTA = requestTimeout( function() { appendCTA(); appendSplit(); }, 10 ); }); } //menuMobileButton(); menuMobile(); menuOffCanvas(); menuSmart(); menuOverlay(); menuAppend(); var setMenuOverlay; $(window).on( 'resize', function(){ if ( $('.overlay').length ) { $('.overlay').addClass('hidden'); } clearRequestTimeout(setMenuOverlay); setMenuOverlay = requestTimeout( menuOverlay, 150 ); }); }; UNCODE.okvideo = function() { var BLANK_GIF = "data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw%3D%3D"; $.okvideo = function(options) { // if the option var was just a string, turn it into an object if (typeof options !== 'object') options = { 'video': options }; var base = this; // kick things off base.init = function() { base.options = $.extend({}, $.okvideo.options, options); // support older versions of okvideo if (base.options.video === null) base.options.video = base.options.source; base.setOptions(); var target = base.options.target || $('body'); var position = target[0] == $('body')[0] ? 'fixed' : 'absolute'; var zIndex = base.options.controls === 3 ? -999 : "auto"; if ($('#okplayer-' + base.options.id).length == 0) { //base.options.id = String(Math.round(Math.random() * 100000)); var mask = '
'; if (OKEvents.utils.isMobile()) { target.append('
'); } else { if (base.options.controls === 3) { target.append(mask) } if (base.options.adproof === 1) { target.append('
'); } else { target.append('
'); } } $("#okplayer-mask-" + base.options.id).css("background-image", "url(" + BLANK_GIF + ")"); if (base.options.playlist.list === null) { if (base.options.video.provider === 'youtube') { base.loadYouTubeAPI(); } else if (base.options.video.provider === 'vimeo') { base.options.volume /= 100; base.loadVimeoAPI(); } } else { base.loadYouTubeAPI(); } } }; // clean the options base.setOptions = function() { // exchange 'true' for '1' and 'false' for 3 for (var key in this.options) { if (this.options[key] === true) this.options[key] = 1; if (this.options[key] === false) this.options[key] = 3; } if (base.options.playlist.list === null) { base.options.video = base.determineProvider(); } // pass options to the window $(window).data('okoptions-' + base.options.id, base.options); }; // insert js into the head and exectue a callback function base.insertJS = function(src, callback){ var tag = document.createElement('script'); if (callback){ if (tag.readyState){ //IE tag.onreadystatechange = function(){ if (tag.readyState === "loaded" || tag.readyState === "complete"){ tag.onreadystatechange = null; callback(); } }; } else { tag.onload = function() { callback(); }; } } tag.src = src; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); }; // load the youtube api base.loadYouTubeAPI = function(callback) { base.insertJS('https://www.youtube.com/player_api'); }; base.loadYouTubePlaylist = function() { player.loadPlaylist(base.options.playlist.list, base.options.playlist.index, base.options.playlist.startSeconds, base.options.playlist.suggestedQuality); }; // load the vimeo api by replacing the div with an iframe and loading js base.loadVimeoAPI = function() { var source = '//player.vimeo.com/video/' + base.options.video.id + '?background=1&api=1&title=0&byline=0&portrait=0&playbar=0&loop=' + base.options.loop + '&autoplay=' + (base.options.autoplay === 1 ? 1 : 0) + '&player_id=okplayer-' + base.options.id, jIframe = $('