/* ---------------------------------------------------------- * 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); } }; if ( SiteParameters.smoothScroll === 'on' && ! SiteParameters.is_frontend_editor ) { window.lenis = new Lenis({ duration: 1 }) UNCODE.hDoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); function raf(time) { window.lenis.raf(time) requestAnimationFrame(raf) window.dispatchEvent(new CustomEvent('lenis-scroll')); if ( SiteParameters.uncode_smooth_scroll_safe ) { var newHdoc = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ); if ( UNCODE.hDoc !== newHdoc ) { UNCODE.hDoc = newHdoc; window.lenis.resize(); //window.dispatchEvent(new CustomEvent('boxResized')); } } } requestAnimationFrame(raf) $(window).on('unmodal-open', function(){ window.lenis.stop(); }); $(document).on('unmodal-close', function(){ window.lenis.start(); }); } UNCODE.checkImgLoad = function( src, cb, err, el ) { var img = new Image(); img.onload = function () { var result = (img.width > 0) && (img.height > 0); cb(el); }; img.onerror = function () { err(); }; img.src = src }; UNCODE.betterResize = function() { var setResize, doubleResize = true, oldW = UNCODE.wwidth, oldH = UNCODE.wheight, setCTA; $(window).on( 'resize orientationchange', function(){ if ( oldW === UNCODE.wwidth ) { return; } else { oldW = UNCODE.wwidth; $(window).trigger('wwResize'); } if ( oldH === UNCODE.wheight ) { return; } else { oldH = UNCODE.wheight; $(window).trigger('whResize'); } }); $(window).on( 'resize orientationchange', function(){ clearRequestTimeout(setCTA); setCTA = requestTimeout( function(){ $(window).trigger('resize-int'); }, 100 ); }); }; UNCODE.shuffle = function(array) { var currentIndex = array.length, randomIndex; while (currentIndex > 0) { randomIndex = Math.floor(Math.random() * currentIndex); currentIndex--; [array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]]; } return array; }; Number.isInteger = Number.isInteger || function(value) { return typeof value === "number" && isFinite(value) && Math.floor(value) === value; }; UNCODE.utils = function() { $(document).on('mouseover', 'a', function () { if (!$(this).hasClass('star')) { $(this).attr('data-title', $(this).attr('title')); $(this).removeAttr('title'); } }); $(document).on('mouseout', 'a', function () { if (!$(this).hasClass('star')) { $(this).attr('title', $(this).attr('data-title')); $(this).removeAttr('data-title'); } }); this.get_scroll_offset = function(e) { var scroll_offset = 0, target, trigger; if ( Number.isInteger(e) !== true && typeof e !== 'undefined' && typeof e.target !== 'undefined' && typeof e.currentTarget !== 'undefined' ) { target = e.target; trigger = e.currentTarget; } if ($('.menu-hide').length || $('.menu-hide-vertical').length) { if (UNCODE.bodyTop > UNCODE.wheight / 2) { UNCODE.hideMenu(100); } } if ( ! $('body').hasClass('vmenu') || UNCODE.wwidth < UNCODE.mediaQuery ) { // if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) ) { if ( ( $('.menu-sticky').length && !$('.menu-hide').length && !UNCODE.isMobile ) || ( $('.menu-sticky-mobile').length && UNCODE.isMobile ) ) { if ( !$('.menu-hided').length ) { if ( $('body').hasClass('hmenu-center') ) { scroll_offset += $('.menu-sticky .menu-container').outerHeight(); } else { scroll_offset += $('.logo-container:visible').outerHeight(); } } } else if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length ) { var shrink = typeof $('.navbar-brand').data('padding-shrink') !== 'undefined' ? $('.navbar-brand').data('padding-shrink')*2 : 36; scroll_offset += $('.menu-sticky .menu-container').outerHeight() - ( $('.navbar-brand').data('minheight') + shrink ); } else { if ( ($('.menu-sticky').length && !$('.menu-hide').length) || ($('.menu-sticky-vertical').length && !$('.menu-hide-vertical').length) ) { scroll_offset += UNCODE.menuMobileHeight; } else { if ( typeof target !== 'undefined' && target.closest('.main-menu-container') != null && UNCODE.wwidth < UNCODE.mediaQuery && ! $('body').hasClass('vmenu') && ! $('body').hasClass('menu-mobile-transparent') && ! $('.menu-sticky').length ) { //scroll_offset += $('.main-menu-container > div:first-child()').height() - 2; } else { if ( $(trigger)[0] !== $(document)[0] && $(trigger).length && typeof $(trigger).offset() !== 'undefined' && window.scrollY > ($(trigger).offset().top + UNCODE.menuMobileHeight) ) { scroll_offset += UNCODE.menuMobileHeight; } } } } } } scroll_offset += UNCODE.bodyBorder; return scroll_offset; } if ( !UNCODE.isFullPage ) { $(document).on('click', 'a[href*="#"]:not(.woocommerce-review-link):not(.one-dot-link)', 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') && $('.wootabs .tab-content').length) { 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); if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 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').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 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').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: 0 }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 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'); $('.mmb-container .trigger-overlay.close')[0].dispatchEvent(new Event("click"));; } } var calc_scroll = scrollSection.offset().top, getOffset = UNCODE.get_scroll_offset(e), $logo = $('.logo-container:visible'), logoH, $menu = $('#masthead .menu-container'), menuH; calc_scroll -= isNaN(getOffset) ? 0 : 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-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { if ( $('.menu-sticky .menu-container:not(.menu-hide)').length && ! $('.menu-shrink').length && ! $('body').hasClass('vmenu') && UNCODE.wwidth > UNCODE.mediaQuery ) { logoH = $logo.outerHeight(), menuH = $menu.outerHeight(); if ( calc_scroll < ( logoH + menuH ) ) { calc_scroll = 0; } } } if ( UNCODE.menuStickyMobileOverlay === false && UNCODE.isMobile ) { calc_scroll = calc_scroll - parseFloat( $('.overlay.overlay-menu').outerHeight() ); } if (scrollSpeed == 0) { $('html, body').scrollTop(calc_scroll); UNCODE.scrolling = false; } else { $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); UNCODE.scrolling = false; if ( ( getOffset != UNCODE.get_scroll_offset(e) && !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) || $('.menu-hided').length ) { calc_scroll = scrollSection.offset().top; getOffset = UNCODE.get_scroll_offset(e); calc_scroll -= getOffset; $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: (delta > 0) ? calc_scroll - 0.1 : calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); 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); calc_scroll -= getOffset; if ( !( $('.menu-desktop-transparent').length && UNCODE.wwidth > UNCODE.mediaQuery ) && !( $('.menu-mobile-transparent').length && UNCODE.wwidth <= UNCODE.mediaQueryMobile ) ) { 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').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); UNCODE.scrolling = false; if (getOffset != UNCODE.get_scroll_offset(event) || $('.menu-hided').length) { calc_scroll = pageHeaderTop + pageHeaderHeight; getOffset = UNCODE.get_scroll_offset(event); calc_scroll -= getOffset; $('html, body').on("scroll wheel DOMMouseScroll mousewheel touchmove", function(){ $(this).stop(); }).animate({ scrollTop: calc_scroll }, scrollSpeed, 'easeInOutCubic', function() { $(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"); UNCODE.scrolling = false; } ); } } ); } }); } // 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).addClass('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).removeClass('active'); if (el) { var elOverlay = $(el[0]).find('.block-bg-overlay'); if (elOverlay.length) { var getOpacity = $(elOverlay).data('data-opacity'); $(elOverlay).css('opacity', getOpacity); } } }); // Admin bar // ============ var fixAdminBar = function() { if ($('html').hasClass('admin-mode') && !SiteParameters.is_frontend_editor ) { 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'}); } } } } }; window.addEventListener('load', fixAdminBar); window.addEventListener('resize', fixAdminBar); // 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; // Safari srcset var safariSrcSet = function(){ if ( !SiteParameters.is_frontend_editor ) { $('html.safari img[sizes]').each(function(){ var $img = $(this), sizeImg = parseInt($img.attr('sizes')); if ( typeof(sizeImg) === 'number' ) { $img.attr('sizes', (sizeImg) + 'px'); } }); } }; window.addEventListener('load', safariSrcSet); } 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; } if (UNCODE.isUnmodalOpen && !el.closest('#unmodal-content')) { return; } var waypoint = new Waypoint({ context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, 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.isUnmodalOpen = false; var manageVideoSize = function(){ var setVideoFit; $('.wp-block-embed').each(function(){ var $this = $(this); if ( $('iframe', $this).length ) { var $iframe = $('> iframe, > a > iframe', $this), w = parseFloat($iframe.attr('width')), h = parseFloat($iframe.attr('height')), url = $iframe.attr('src'), ratio, frW; if ( typeof url != 'undefined' && url.indexOf('soundcloud') == -1 && h !== 0 ) { ratio = h / w; var setResizeiFto, resizeiFrame = function(){ frW = $iframe.width(); $iframe.css({ height: frW * ratio }); }; resizeiFrame(); $(window).on( 'resize load', function(){ clearRequestTimeout(setResizeiFto); setResizeiFto = requestTimeout( function() { resizeiFrame(); }, 10 ); }); } } }); }; manageVideoSize(); UNCODE.vivus = function(icon, time, delay, file) { if (typeof Vivus !== 'undefined') { var icon_options = { type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: time, } if (delay) { icon_options.delayStart = delay; } if (file) { icon_options.file = file; } new Vivus(icon, icon_options); } }; UNCODE.lastURL = ''; UNCODE.getURLParams = function(current_location, is_string) { var params = {}; if (is_string) { var url = current_location.split('?')[1]; } else { var url = current_location.search; url = url.substring(1); } if (url) { var parts = url.split('&'); for (var i = 0; i < parts.length; i++) { var nv = parts[i].split('='); if (!nv[0]) { continue; } params[nv[0]] = nv[1] || true; } } return params; } UNCODE.hasEqualURLParams = function(obj1, obj2) { for (var i in obj1) { if (obj1.hasOwnProperty(i)) { if (!obj2.hasOwnProperty(i)) { return false; } if (obj1[i] != obj2[i]) { return false; } } } for (var i in obj2) { if (obj2.hasOwnProperty(i)) { if (!obj1.hasOwnProperty(i)) { return false; } if (obj1[i] != obj2[i]) { return false; } } } return true; } UNCODE.magnetic = function(){ $(document).on('mousemove', '.un-magnetic-zone', function(e){ var $zone = $(this), zoneOff = $zone.offset(), $mgntcEl = $('.un-magnetic-el', this), elBound = this.getBoundingClientRect(), maxSize = Math.max($zone.outerWidth(), $zone.outerHeight()); var Xvalue = e.pageX - (zoneOff.left + maxSize / 2), Yvalue = e.pageY - (zoneOff.top + maxSize / 2); $mgntcEl.each(function(key, val){ var magneticValue = $(val).attr('data-mgntc') || 0.5; val.animate({ transform: 'translate(' + (Xvalue * magneticValue) + '%, ' + (Yvalue * magneticValue) + '%)', },{ duration: 500, fill: 'forwards', }) }); }) $(document).on('mouseleave', '.un-magnetic-zone', function(e){ var $mgntcEl = $('.un-magnetic-el', this); $mgntcEl.each(function(key, val){ val.animate({ transform: 'translate(0)', },{ duration: 500, fill: 'forwards', }) }); }) }; UNCODE.rowParallax = function(){ if ( SiteParameters.is_frontend_editor || SiteParameters.smoothScroll !== 'on' ) { return; } var $rows = $('.parallax-move'), stableHeight = UNCODE.wheight; $rows.each(function(){ var $row = $(this), _row = $row[0], dataMove = $row.attr('data-parallax-move'), dataSafe = $row.attr('data-parallax-safe'), rowInViewport = false, trans; if ( $row.find('.parallax-move').length ) { return; } dataSafe = typeof dataSafe === 'undefined' ? '' : dataSafe; dataMove = typeof dataMove === 'undefined' || dataMove === '' ? 3 : dataMove; dataMove = dataMove / 10; if ( 'IntersectionObserver' in window ) { var observer = new IntersectionObserver(function(entries) { entries.forEach(function(entry){ if ( entry.isIntersecting ) { rowInViewport = true; } else { rowInViewport = false; } }); }, { root: document, }); observer.observe(_row); } else { rowInViewport = true; } var loopRAF = function() { if( rowInViewport ) { var bound = _row.getBoundingClientRect(), bound_top = bound.top, bound_height = bound.height, move = true, scrolled = window.pageYOffset || window.document.documentElement.scrollTop, docH = Math.max( document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight ), fromBottom = docH - (scrolled + bound_top + bound_height); if ( bound_height > stableHeight && dataSafe === 'yes' ) { $row.find('>div').css({ 'transform':'none' }); move = false; } if ( UNCODE.wwidth < SiteParameters.smoothScrollQuery ) { $row.find('>div').css({ 'transform':'none' }); move = false; } if ( move ) { if ( fromBottom < stableHeight ) { //maybe Footer trans = (stableHeight - (bound_top + bound_height + fromBottom))*(dataMove); } else if ( scrolled + bound_top < stableHeight ) { //maybe Header trans = scrolled*(dataMove); } else { trans = (((stableHeight/2) - (bound_top + (bound_height/2)))*dataMove); } $row.find('>div').css({ 'transform':'translateY(' + (trans) + 'px) translateZ(0)', }); } } requestAnimationFrame(loopRAF); }; requestAnimationFrame(loopRAF); }); $(window).on( 'load resize', function(e) { if ( ! UNCODE.isMobile ) { stableHeight = UNCODE.wheight; } }); $(window).on( 'load wwResize', function(e) { if ( UNCODE.isMobile ) { stableHeight = UNCODE.wheight; } }); } UNCODE.changeSkinOnScroll = function(){ if ( UNCODE.isFullPage && ! UNCODE.isFullPageSnap ) { return; } var $masthead = $('#masthead'), transDesktop, transMobile, changeSkin, checkTransparencyAndChange = function( $col ){ transDesktop = $masthead.hasClass('menu-desktop-transparent') && UNCODE.wwidth >= UNCODE.mediaQuery; transMobile = $masthead.hasClass('menu-mobile-transparent') && UNCODE.wwidth < UNCODE.mediaQuery; changeSkin = $masthead.hasClass('menu-change-skin'); if ( ! transDesktop && ! transMobile ) { return false; } if ( ! changeSkin ) { return false; } if ( $col.hasClass('style-light') ){ $masthead.removeClass('style-dark-override').addClass('style-light-override'); return false; } else if ( $col.hasClass('style-dark') ) { $masthead.removeClass('style-light-override').addClass('style-dark-override'); return false; } }; var prev_row = 'normal', odd = true, $rows = $('.vc_row[data-parent]:visible'); $.each($rows, function(index, row){ var $row = $(row), $col = $('.uncol', $row).first(), $slider = $('.uncode-slider', $row); var wayDown = new Waypoint({ context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, element: row, handler: function(direction) { if ( direction == 'down' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { if ( $slider.length ) { $col = $('.owl-item.index-active .uncol', $slider).first(); } checkTransparencyAndChange($col); } if ( odd === false ) { if ( row.hasAttribute('data-bg-changer') ) { prev_row = 'bg-changer'; } else { prev_row = 'normal'; } odd = true; } else { odd = false; } }, offset: function() { return UNCODE.menuHeight / 2 } }); var wayUp = new Waypoint({ context: UNCODE.isUnmodalOpen ? document.getElementById('unmodal-content') : window, element: row, handler: function(direction) { if ( direction == 'up' && ( prev_row !== 'normal' || !row.hasAttribute('data-bg-changer') ) ) { if ( $slider.length ) { $col = $('.owl-item.index-active .uncol', $slider).first(); } checkTransparencyAndChange($col); } if ( odd === false ) { if ( row.hasAttribute('data-bg-changer') ) { prev_row = 'bg-changer'; } else { prev_row = 'normal'; } odd = true; } else { odd = false; } }, offset: function() { return -row.clientHeight + ( UNCODE.menuHeight / 2 ) } }); }); }; UNCODE.share = function() { if (typeof Share !== 'undefined') { var share_button_element = $('.share-button'); var share_button_url = share_button_element.data('url'); var share_button_config = { ui: { flyout: "top center", button_font: false, button_text: '', icon_font: false } }; if (share_button_url) { share_button_config.url = share_button_url.replace("&", "%26"); } var share_button_top = new Share('.share-button', share_button_config); } }; UNCODE.tooltip = function() { if (typeof jQuery.fn.tooltip !== 'undefined') { $('.btn-tooltip').tooltip(); } }; UNCODE.counters = function() { var $counters = $('.uncode-counter:not(.counter-init)'); $counters.each(function(){ var $counter = $(this).addClass('counter-init'); if ( SiteParameters.is_frontend_editor ) { $counter.addClass('started'); } if ( $counter.closest( '.owl-carousel' ).length ) { return; } $counter.addClass('started').counterUp({ delay: 10, time: 1500 }); }); }; UNCODE.countdowns = function() { var $countdowns = $('[data-uncode-countdown]:not(.counter-init)'); $countdowns.each(function() { var $this = $(this).addClass('counter-init'), finalDate = $(this).data('uncode-countdown'); $this.countdown(finalDate, function(event) { $this.html(event.strftime('%D ' + SiteParameters.days + ' %H ' + SiteParameters.hours + ' %M ' + SiteParameters.minutes + ' %S ' + SiteParameters.seconds + '')); }); }); }; UNCODE.tabs = function() { var tabSwitcher = function($el){ $('.tab-switch, .tab-active-anim, .nav-tabs.tab-no-border:not(.tabs-vertical):not(.tab-switch)', $el).each(function(key, value){ var $navs = $(value), $active = $('li.active', $navs), $active_a = $('> a', $active), $active_span = $('> span', $active_a), vertical = $navs.closest('.vertical-tab-menu').length; if ( ! $('.switcher-cursor', $navs).length && ! vertical ) { $navs.append(''); } var $cursor = $('.switcher-cursor', $navs), active_w = $('a', $active).outerWidth(), span_w = $active_span.outerWidth(), active_pos = $active.position(), active_a_pos = $active_a.position(), span_pos = $active_span.position(), cursor_w = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? span_w : active_w, cursor_left = $navs.hasClass('tab-no-border') && !$navs.hasClass('tab-switch') ? active_pos.left + span_pos.left : active_pos.left; cursor_left = cursor_left + active_a_pos.left + parseInt($active_a.css('marginLeft'), 10); if ( ! vertical ) { $cursor.css({ left: cursor_left, width: cursor_w }); } $navs.addClass('switch-init'); }); }; var $body = $('body'); tabSwitcher($body); var tabHoverIntent = function(){ var setHover; $('.tab-hover [data-toggle="tab"], .tab-hover [data-toggle="pill"]') .on('mouseover', function(e){ var $this = $(e.target); setHover = requestTimeout(function() { $this.trigger('hover-int'); }, 50); }) .on('mouseout', function(){ clearRequestTimeout(setHover); }); }; tabHoverIntent(); var tabInit = function(){ $('[data-toggle="tab"], [data-toggle="pill"]').on('click.bs.tab.data-api hover-int', function(e) { e.preventDefault() var $el = $(this); $el.tab('show'); var $container = $el.closest('.uncode-tabs'); tabSwitcher($container); requestTimeout(function() { window.dispatchEvent(UNCODE.boxEvent); var $tabs = $(e.currentTarget).closest('.uncode-tabs'); if ( $tabs.hasClass('tabs-trigger-box-resized') ) { window.dispatchEvent(new CustomEvent('boxResized')); } else if ( $tabs.hasClass('tabs-trigger-window-resize') ) { window.dispatchEvent(new Event('resize')); $(window).trigger('uncode.re-layout'); } var $active_panel = $('.tab-pane.active', $tabs); $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { var element = $(val), delayAttr = element.attr('data-delay'); if (delayAttr == undefined) delayAttr = 0; requestTimeout(function() { element.addClass('start_animation'); }, delayAttr); }); }, 300); var $li = $el.closest('li'), mQuery = $el.closest('.tab-tablet-bp').length ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; $('li', $container).not($li).find('.tab-pane').slideUp(250) $('.tab-pane', $li).slideDown(250); var completeSlideDown = requestTimeout(function(){ if ( UNCODE.wwidth <= mQuery && typeof e.originalEvent !== 'undefined' ) { var pos = $el.offset(), rect = $el[0].getBoundingClientRect(), $masthead = $('#masthead > .menu-container'), considerMenu = $('.menu-wrapper .is_stuck').length && $('.menu-wrapper .is_stuck > div').offset().top > 50 ? UNCODE.menuMobileHeight : 0; if ( ( ( rect.top ) - considerMenu ) < 0 || ( rect.bottom ) > (window.innerHeight || document.documentElement.clientHeight) ) { $('html, body').animate({ scrollTop: ( pos.top ) - considerMenu },{ easing: 'easeInOutQuad', duration: 250 }); } } }, 260); }); } tabInit(); var tabResponsive = function(){ if ( SiteParameters.is_frontend_editor ) { return true; } var $tabContainers = $('.tab-container.tabs-breakpoint'); $tabContainers.each(function(){ var $tabContainer = $(this), $tabContent = $('.tab-content', $tabContainer), $nav = $('.nav-tabs', $tabContainer), mQuery = $tabContainer.hasClass('tab-tablet-bp') ? UNCODE.mediaQuery : UNCODE.mediaQueryMobile; $('> li', $nav).each(function(){ var $li = $(this), dataID = $li.attr('data-tab-id'); if ( UNCODE.wwidth <= mQuery ) { if ( ! $('.tab-pane', $li ).length ) { var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $tabContent); $tabContainer.addClass('tabs-appended'); $li.append($append_pane); } if ( $li.hasClass('active') ) { $('> a', $li).click(); } } else { if ( ! $('[data-id="' + dataID + '"]', $tabContent ).length ) { var $append_pane = $('[data-id="' + dataID + '"], #' + dataID, $nav); $tabContainer.removeClass('tabs-appended'); $tabContent.prepend($append_pane.removeAttr('style')); } } }); }); } tabResponsive(); $(window).on('wwResize', function(){ tabHoverIntent(); tabSwitcher($body); }); var setCTA; $(window).on( 'resize', function(){ clearRequestTimeout(setCTA); setCTA = requestTimeout( tabResponsive, 100 ); }); $('.nav-tabs').each(function(){ var $nav = $(this), $lis = $('> li:not(.active)', $nav), $links = $('.tab-excerpt-link', $nav); $('.tab-excerpt', $lis).slideUp(400, function(){ $(this).addClass('init'); }); $links.each(function(){ var $link = $(this), $par_a = $link.closest('a'), href = $link.attr('data-href'), target = $link.attr('data-target'); $par_a.addClass('inner-link'); $link.on('click', function(){ var _link = document.createElement('a'); _link.href = href; _link.target = typeof target === 'undefined' || target === '' ? '_self' : target; _link.click(); }); }); $nav.addClass('tab-init'); }); $('.uncode-tabs.tabs-no-lazy').each(function(){ var $tabs = $(this), $panes = $('.tab-pane:not(.active)', $tabs); $panes.each(function(){ var $pane = $(this), $imgs = $('img[loading="lazy"]', $pane); $imgs.removeAttr('loading'); $imgs.removeAttr('decoding'); }); }); }; UNCODE.collapse = function() { $(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 parent = $this.attr('data-parent') var $parent = parent && $(parent) var $title = $(this).parent() var $accordion = $(e.target).closest('.uncode-accordion') var $group = $this.closest('.group') var $panel_group = $this.closest('.panel-group') if ($parent) { $parent.find('[data-toggle="collapse"][data-parent="' + parent + '"]').not($this).addClass('collapsed') if ($title.hasClass('active') && ( $panel_group.attr('data-no-toggle') != true || e.type === 'click' ) ) { $title.removeClass('active'); $group.removeClass('active-group'); } else { if ( $panel_group.attr('data-no-toggle') != true ) { $parent.find('.panel-title').removeClass('active') $parent.find('.group').removeClass('active-group') } $title[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active') $group[!$target.hasClass('in') ? 'addClass' : ( $panel_group.attr('data-no-toggle') != true ) && 'removeClass']('active-group') } } $this[$target.hasClass('in') ? 'addClass' : 'removeClass']('collapsed') requestTimeout(function() { var $accordion = $(e.target).closest('.uncode-accordion'); if ( $accordion.hasClass('tabs-trigger-box-resized') ) { window.dispatchEvent(new CustomEvent('boxResized')); } else if ( $accordion.hasClass('tabs-trigger-window-resize') ) { window.dispatchEvent(new Event('resize')); $(window).trigger('uncode.re-layout'); } var $active_panel = $('.panel.active-group', $parent); $.each($('.animate_when_almost_visible:not(.start_animation):not(.t-inside):not(.drop-image-separator), .index-scroll .animate_when_almost_visible, .tmb-media .animate_when_almost_visible:not(.start_animation), .animate_when_almost_visible.has-rotating-text, .custom-grid-container .animate_when_almost_visible:not(.start_animation)', $active_panel), function(index, val) { var element = $(val), delayAttr = element.attr('data-delay'); if (delayAttr == undefined) delayAttr = 0; requestTimeout(function() { element.addClass('start_animation'); }, delayAttr); }); }, 500); }); $('.uncode-accordion.tabs-no-lazy').each(function(){ var $accordion = $(this), $panes = $('.panel:not(.active-group)', $accordion); $panes.each(function(){ var $pane = $(this), $imgs = $('img[loading="lazy"]', $pane); $imgs.removeAttr('loading'); $imgs.removeAttr('decoding'); }); }); }; UNCODE.bigText = function(el) { var bigTextLaunch = function(){ 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); }); }; if ( UNCODE.wwidth > UNCODE.mediaQuery ) { bigTextLaunch(); } $(window).on( 'load', bigTextLaunch ); }; UNCODE.process_shortpixel_image = function(image) { var data = { action: 'shortpixel_manual_optimization', image_id: image, cleanup: true }; $.get(SiteParameters.ajax_url, data); }; UNCODE.menuSystem = function() { function menuMobile() { var $body = $('body'), scrolltop, $mobileToggleButton = $('.mobile-menu-button, .uncode-close-offcanvas-mobile'), $masthead = $('#masthead'), $box, $el, $el_transp, elHeight, offCanvasAnim, check, animating = false, stickyMobile = false, menuClose = new CustomEvent('menuMobileClose'), menuOpen = new CustomEvent('menuMobileOpen'); UNCODE.menuOpened = false; $mobileToggleButton.on('click', function(event) { event.stopPropagation(); var btn = this; if ($(btn).hasClass('overlay-close')) return; event.preventDefault(); $('.overlay-search.open .menu-close-dd', $masthead).trigger('click'); 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) { if ( $('.menu-wrapper.menu-sticky, .menu-wrapper.menu-hide-only, .main-header .menu-sticky-vertical, .main-header .menu-hide-only-vertical, .menu-mobile-centered, .menu-sticky-mobile').length ) { stickyMobile = true; elHeight = window.innerHeight - UNCODE.menuMobileHeight - (UNCODE.bodyBorder * 2) - UNCODE.adminBarHeight + 1; } else { elHeight = 0; $.each($box.find('> div'), function(index, val) { elHeight += $(val).outerHeight(); }); } } else { elHeight = 0; $.each($el, function(index, val) { elHeight += $(val).outerHeight(); }); } var open = function() { clearTimeout(offCanvasAnim); if (!animating) { $body.addClass('open-overlay-menu').addClass('opening-overlay-menu'); scrolltop = $(window).scrollTop(); window.dispatchEvent(menuOpen); animating = true; UNCODE.menuOpened = true; if ($('body[class*="vmenu-"], body.hmenu-center').length && ($('.menu-hide, .menu-sticky, .menu-transparent').length)) { if ( $body.hasClass('menu-sticky-mobile') || ( $('#masthead.menu-transparent').length && !UNCODE.isMobile ) ) { $('.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(.grid-filters)').css({position:'fixed'}); $('.vmenu-container.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); } else { if ( $('.menu-hide, .menu-sticky').length ) { if ( UNCODE.wwidth >= 960 && $('.menu-sticky').length ) { $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed'}); } } } } if ($('body.hmenu-center').length && ( (!UNCODE.isMobile && $('.menu-hide, .menu-sticky').length) || (UNCODE.isMobile && $('.menu-sticky-mobile').length) )) { //$("#masthead")[0].scrollIntoView(); $('.menu-container:not(.sticky-element):not(.grid-filters)').css({position:'fixed', top: (UNCODE.menuMobileHeight + UNCODE.bodyBorder + UNCODE.adminBarHeight) + 'px'}); } $box.addClass('open-items'); if ($el_transp.length && $('body.menu-mobile-transparent').length) { $el_transp.addClass('is_mobile_open'); } if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { btn.classList.add('close'); $box.animate({ height: elHeight }, 600, "easeInOutCirc", function() { animating = false; if (!stickyMobile) $box.css('height', 'auto'); }); } else { animating = false; } } }; var close = function() { clearTimeout(offCanvasAnim); if (!animating) { window.dispatchEvent(menuClose); animating = true; UNCODE.menuOpened = false; if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { 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); $body.removeClass('opening-overlay-menu'); if ( ! $('body').hasClass('menu-mobile-off-canvas') ) { $box.animate({ height: 0 }, { duration: 600, easing: "easeInOutCirc", complete: function(elements) { $(elements).css('height', ''); animating = false; if ($('body[class*="vmenu-"]').length && UNCODE.wwidth >= 960) { $('.main-header > .vmenu-container').add('.menu-container:not(.sticky-element):not(.grid-filters)').css('position','relative'); } $body.removeClass('open-overlay-menu'); } }); } else { animating = false; offCanvasAnim = setTimeout(function(){ $body.removeClass('open-overlay-menu'); }, 1000); } } }; check = (!UNCODE.menuOpened) ? open() : close(); } }); $('html').on('click', function(event){ if ( $('body').hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 && UNCODE.menuOpened && event.clientX < SiteParameters.menu_mobile_offcanvas_gap ) { $('.uncode-close-offcanvas-mobile').trigger('click'); } }); window.addEventListener('menuMobileTrigged', function(e) { $('.mobile-menu-button.close, .opening-overlay-menu .uncode-close-offcanvas-mobile').trigger('click'); }); window.addEventListener('orientationchange', function(e) { $('#logo-container-mobile .mobile-menu-button.close').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' && ! $('body').hasClass('menu-mobile-off-canvas') ) { 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'); } }); $(window).on('scroll', function(){ if ( $body.hasClass('opening-overlay-menu') && $body.hasClass('menu-mobile-off-canvas') && UNCODE.wwidth < 960 ) { $(window).scrollTop(scrolltop); return false; } }); }; function menuOffCanvas() { var menuClose = new CustomEvent('menuCanvasClose'), menuOpen = new CustomEvent('menuCanvasOpen'); $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').on('click', function(event) { if ($(window).width() > UNCODE.mediaQuery) { if ( $('body.vmenu-offcanvas-overlay').length ) { if ($(event.currentTarget).hasClass('off-close')) { $(event.currentTarget).removeClass('off-close'); requestTimeout(function() { window.dispatchEvent(menuClose); }, 500); } else { $(event.currentTarget).addClass('off-close'); window.dispatchEvent(menuOpen); } } else { 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'); }); $('body').off('click.menu-off-canvas-mobile').on('click.menu-off-canvas-mobile', function(e){ if ( $(window).width() > UNCODE.mediaQuery && $('body.menu-offcanvas.vmenu-offcanvas-overlay.off-opened').length ) { var $vMenuCont = $('#masthead .vmenu-container'), $close_menu = $('.uncode-close-offcanvas-overlay', $vMenuCont), vmenu_h = parseFloat( $vMenuCont.outerHeight() ), vmenu_w = parseFloat( $vMenuCont.outerWidth() ), vmenu_off = $vMenuCont.offset(), vmenu_l = parseFloat(vmenu_off.left), vmenu_t = parseFloat(vmenu_off.top), vmenu_r = vmenu_l + vmenu_w, vmenu_b = vmenu_t + vmenu_h, close_h = parseFloat( $close_menu.outerHeight() ), close_w = parseFloat( $close_menu.outerWidth() ), close_off = $close_menu.offset(), close_l = parseFloat(close_off.left), close_t = parseFloat(close_off.top), close_r = close_l + close_w, close_b = close_t + close_h; if ( !( e.clientX > vmenu_l && e.clientX < vmenu_r && e.clientY > vmenu_t && e.clientY < vmenu_b ) || ( e.clientX > close_l && e.clientX < close_r && e.clientY > close_t && e.clientY < close_b ) ) { $('.menu-primary .menu-button-offcanvas:not(.menu-close-search)').trigger('click'); } } }); }; function menuOverlay() { if ( $('.overlay').length ) { $('.overlay').removeClass('hidden'); } if ( ($('.overlay-sequential').length > 0 && UNCODE.wwidth >= UNCODE.mediaQuery) || ($('.menu-mobile-animated').length > 0 && UNCODE.wwidth < UNCODE.mediaQuery) ) { $('.overlay-sequential .menu-smart > li, .menu-sticky .menu-container .menu-smart > li, .menu-hide.menu-container .menu-smart > li, .vmenu-container .menu-smart > li, .uncode-menu-additional-text').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'); }); } }; var $secondary_parent; function menuAppend() { var $body = $('body'), $menuCont = $('.menu-container:not(.vmenu-container)'), $vMenuCont = $('.menu-container.vmenu-container'), $cta = $('.navbar-cta'), $socials = $('.navbar-social:not(.appended-navbar)'), $ul = $('.navbar-main ul.menu-primary-inner'), $ulCta, $ulSocials, $navLast, $firstMenu = $('.main-menu-container:first-child', $menuCont), $secondMenu = $('.main-menu-container:last-child', $menuCont), $firstNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $firstMenu), $secondNav = $('.navbar-nav:not(.uncode-close-offcanvas-mobile):first-child', $secondMenu), $ulFirst = $('> ul', $firstNav), $ulSecond = $('> ul', $secondNav), setCTA, appendCTA = function(){ return true; }, appendSocials = function(){ return true; }, appendSplit = function(){ return true; }; if ( ( $body.hasClass('menu-offcanvas') || $body.hasClass('menu-overlay') || $body.hasClass('hmenu-center-split') ) && $cta.length ) { $ulCta = $('> ul', $cta); $ulCta.parent().addClass('mobile-hidden').addClass('tablet-hidden'); appendCTA = function(){ if (UNCODE.wwidth < UNCODE.mediaQuery) { $ul.after($ulCta); } else { $cta.append($ulCta); } } } if ( ! $body.hasClass('cta-not-appended') ) { appendCTA(); } var $smartSocial = $menuCont.add($vMenuCont).find('.menu-smart-social'); $smartSocial.each(function(){ var $_smartSocial = $(this); $('> li', $_smartSocial).each(function(){ var $li = $(this); if ( $li.hasClass('mobile-hidden') ) { $_smartSocial.addClass('mobile-hidden'); } else { $_smartSocial.removeClass('mobile-hidden'); return false; } }); $('> li', $_smartSocial).each(function(){ var $li = $(this); if ( $li.hasClass('tablet-hidden') ) { $_smartSocial.addClass('tablet-hidden'); } else { $_smartSocial.removeClass('tablet-hidden'); return false; } }); }); if ( ( $body.hasClass('hmenu-center-split') || $body.hasClass('menu-overlay-center') || $body.hasClass('menu-offcanvas') || $body.hasClass('vmenu') ) && $socials.length ) { $ulSocials = $('> ul', $socials).addClass('menu-smart-social'); if ( $body.hasClass('hmenu-center-split') ) { $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); } else { $navLast = $('.navbar-nav-last', $vMenuCont); } if ( ! $navLast.length ) { var _navLast = $('
'); if ( $body.hasClass('hmenu-center-split') ) { $('.menu-horizontal-inner', $menuCont).append(_navLast); $navLast = $('.menu-horizontal-inner .navbar-nav-last', $menuCont); } else { $('.menu-sidebar-inner', $vMenuCont).last().append(_navLast); $navLast = $('.navbar-nav-last', $vMenuCont); } } appendSocials = function(){ if ( !$body.hasClass('menu-overlay-center') ) { // if ( !$navLast.find('ul.menu-smart-social').length ) { // $ulSocials = $('.menu-smart-social li.social-icon', $vMenuCont); // $navLast.append(' '); // $ulSocials.each(function(){ // var $li_social = $(this); // $navLast.find('ul.menu-smart-social').append($li_social); // }); // } // } else { if (UNCODE.wwidth < UNCODE.mediaQuery) { $socials.addClass('mobile-hidden').addClass('tablet-hidden') if ( ! $('> ul.menu-smart-social li', $socials).length ) { $('> ul.menu-smart-social li', $socials).remove(); } $navLast.append($ulSocials); } else { if ( ! $('> ul.menu-smart-social li', $navLast).length ) { $('> ul.menu-smart-social li', $navLast).remove(); } $socials.append($ulSocials); } } } appendSocials(); } if ( $vMenuCont.length ) { var $accordion_secondary = $('.menu-accordion-secondary', $vMenuCont); } else { var $accordion_secondary = $('.menu-accordion-secondary', $menuCont); } if ( $accordion_secondary.length ) { var $accordion_secondary_ph = $vMenuCont.add($menuCont).find('.accordion-secondary-ph'); if (UNCODE.wwidth < UNCODE.mediaQuery) { if ( !$accordion_secondary_ph.length ) { $accordion_secondary.after(''); } if ( $vMenuCont.length ) { $('.menu-sidebar-inner', $vMenuCont).first().find('.menu-accordion:not(.menu-accordion-secondary):not(.menu-accordion-extra-icons)').last().after($accordion_secondary); } else { if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { $('.navbar-nav.navbar-cta', $menuCont).after($accordion_secondary); } else { $('.navbar-nav.navbar-main', $menuCont).after($accordion_secondary); } } } else { if ( typeof $accordion_secondary_ph !== 'undefined' && $accordion_secondary_ph.length ) { $accordion_secondary_ph.before($accordion_secondary); } } } if ( $vMenuCont.length ) { var $extra_icons = $('.menu-accordion-extra-icons', $vMenuCont); } else { var $extra_icons = $('.navbar-extra-icons', $menuCont); } if ( $extra_icons.length ) { if ( $vMenuCont.length ) { if ( $('li:not(.social-icon)', $extra_icons).length ) { if (UNCODE.wwidth < UNCODE.mediaQuery) { var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), $primary_after = $('.menu-accordion-primary-after', $vMenuCont); $not_social.each(function(){ if ( ! $primary_after.length ) { $('.menu-accordion-primary', $vMenuCont).after(''); $primary_after = $('.menu-accordion-primary-after', $vMenuCont); $primary_after.append(' '); } var $extra_li = $(this); $primary_after.find('> ul').append($extra_li); }); } else { var $primary_after = $('.menu-accordion-primary-after', $vMenuCont), $not_social = $('> ul > li:not(.social-icon)', $primary_after); $not_social.each(function(){ var $extra_li = $(this); $extra_icons.find('> ul').append($extra_li); }); } } /*else { var $extra_icons_ph = $vMenuCont.add($menuCont).find('.extra-icons-ph'); if (UNCODE.wwidth < UNCODE.mediaQuery) { if ( !$extra_icons_ph.length ) { $extra_icons.after(''); } if ( $('.navbar-accordion-cta', $vMenuCont).length ) { $('.navbar-accordion-cta', $vMenuCont).after($extra_icons); } else { $('.menu-accordion-primary', $vMenuCont).after($extra_icons); } } else { if ( typeof $extra_icons_ph !== 'undefined' && $extra_icons_ph.length ) { $extra_icons_ph.before($extra_icons); } } }*/ } else { if ( ! $body.hasClass('hmenu-center-double') ) { if (UNCODE.wwidth < UNCODE.mediaQuery) { var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), $primary_after = $('.nav.navbar-main-after', $menuCont); if ( ! $primary_after.length && $not_social.length ) { if ( $('.navbar-nav.navbar-cta:not(.mobile-hidden)', $menuCont).length ) { $('.navbar-nav.navbar-cta', $menuCont).after(''); } else { $('.navbar-nav.navbar-main', $menuCont).after(''); } $primary_after = $('.nav.navbar-main-after', $menuCont); $primary_after.append(' '); } var tablet_hidden = true, mobile_hidden = true; $not_social.each(function(){ var $extra_li = $(this); $primary_after.find('> ul').append($extra_li); if ( ! $extra_li.hasClass('tablet-hidden') ) { tablet_hidden = false; } if ( ! $extra_li.hasClass('mobile-hidden') ) { mobile_hidden = false; } }); if ( tablet_hidden === true && $not_social.length ) { $primary_after.addClass('tablet-hidden'); } if ( mobile_hidden === true && $not_social.length ) { $primary_after.addClass('mobile-hidden'); } } else { var $primary_after = $('.nav.navbar-main-after', $menuCont); if ( $primary_after.length ) { var $not_social = $('> ul > li:not(.social-icon)', $primary_after); $not_social.each(function(){ var $extra_li = $(this); $extra_icons.find('> ul').append($extra_li); }); $primary_after.remove(); } } } } } if ( ( $body.hasClass('hmenu-center-double') ) ) { appendSplit = function(){ if (UNCODE.wwidth < UNCODE.mediaQuery) { if ( $extra_icons.length ) { if ( $('li:not(.social-icon):not(.tablet-hidden):not(.mobile-hidden)', $extra_icons).length ) { var $not_social = $('> ul > li:not(.social-icon)', $extra_icons), $append_ul = $(' '); $not_social.each(function(){ var $extra_li = $(this); $append_ul.append($extra_li); }); if ( $secondNav.length ) { $secondNav.append($append_ul); } else { $('.menu-horizontal-inner', $menuCont).prepend($append_ul); } } } if ( $secondNav.length ) { $secondNav.prepend($ulFirst); } else { $('.menu-horizontal-inner', $menuCont).prepend($ulFirst); } $firstMenu.hide(); } else { $firstNav.append($ulFirst); var $append_ul = $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).eq(0); if ( $append_ul.length ) { var $not_social = $('> li:not(.social-icon)', $append_ul); $not_social.each(function(){ var $extra_li = $(this); $extra_icons.find('> ul').append($extra_li); }); } $('.menu-horizontal-inner ul.append-extra-icons', $menuCont).remove(); $('.menu-horizontal-inner > .menu-primary-inner', $menuCont).remove(); $firstMenu.css({ 'display': 'table-cell' }); } } } appendSplit(); $(window).on( 'resize', function(){ clearRequestTimeout(setCTA); setCTA = requestTimeout( function() { appendCTA(); appendSocials(); appendSplit(); }, 10 ); }); } //menuMobileButton(); menuMobile(); menuOffCanvas(); menuAppend(); menuOverlay(); var stickyDropdownSearch = function(){ var $masthead = $('#masthead'), $ddSearch = $('.overlay.overlay-search', $masthead), $styles = $('#stickyDropdownSearch').remove(); if ( $('body.hmenu-center.menu-sticky-mobile').length && $ddSearch.length ) { var $menuWrapper = $('.menu-wrapper'), $navbar = $('.menu-container-mobile', $menuWrapper), navbarH = $navbar.outerHeight(), //$topbar = $('.top-menu', $menuWrapper), //topbarH = $topbar.outerHeight(), _css; _css = ''; $(_css).appendTo($('head')); } } stickyDropdownSearch(); var setMenuOverlay; $(window).on( 'resize', function(){ if ( $('.overlay').length && $(window).width() > 1024 ) { $('.overlay').addClass('hidden'); } clearRequestTimeout(setMenuOverlay); setMenuOverlay = requestTimeout( function(){ menuOverlay(); menuAppend(); stickyDropdownSearch(); }, 150 ); }); UNCODE.menuSmartInit(); }; UNCODE.menuSmartInit = function() { var $menusmart = $('[class*="menu-smart"]'), $masthead = $('#masthead'), $hMenu = $('.menu-horizontal-inner', $masthead), $focus = $('.overlay-menu-focus'), showTimeout = 50, hideTimeout = 50, showTimeoutFunc, hideTimeoutFunc; $('> li.menu-item-has-children', $menusmart).hover(function(){ $(this).data('hover', true); }, function(){ $(this).data('hover', false); }); $('> li.menu-item a[href="#"]', $menusmart).on('click', function(e){ e.preventDefault(); }); if ( $(window).width() >= UNCODE.mediaQuery && $('.overlay-menu-focus').length ) { var $notLis = $('> .nav > ul > li a', $hMenu), $menuA = $('a', $masthead).not($notLis), $hoverSelector = $('> .nav > ul > li', $hMenu).has('> ul'), showFuncCond = function() { return true }; if ( $('body').hasClass('focus-megamenu') ) { $hoverSelector = $('> .nav > ul > li', $hMenu).has('.mega-menu-inner'); showFuncCond = function($ul) { return $ul.hasClass('mega-menu-inner') }; } else if ( $('body').hasClass('focus-links') ) { $hoverSelector = $('> .nav > ul > li', $hMenu).add($menuA); } $hoverSelector.hover(function(){ clearRequestTimeout(hideTimeoutFunc); showTimeoutFunc = requestTimeout(function(){ $('body').addClass('navbar-hover'); }, showTimeout*2); }, function(){ hideTimeoutFunc = requestTimeout(function(){ if ( ! $('.overlay-search.open', $masthead).length ) { $('body').removeClass('navbar-hover'); } }, hideTimeout*2); }); } else { showFuncCond = function() { return false }; } if ($menusmart.length > 0) { $menusmart.smartmenus({ subIndicators: false, subIndicatorsPos: 'append', //subMenusMinWidth: '13em', subIndicatorsText: '', showTimeout: showTimeout, hideTimeout: hideTimeout, scrollStep: 8, showFunction: function($ul, complete) { clearRequestTimeout(showTimeoutFunc); $ul.fadeIn(0, 'linear', function(){ complete(); if ( $ul.hasClass('vc_row') ) { $ul.css({ 'display': 'table' }); } if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') ) { $('body').addClass('open-megamenu'); } if ( $('.overlay-menu-focus').length && showFuncCond($ul) && $(window).width() >= UNCODE.mediaQuery && $ul.closest('.main-menu-container').length ) { $('body').addClass('navbar-hover'); } }).addClass('open-animated'); }, hideFunction: function($ul, complete) { if ( $('.overlay-menu-focus').length && $ul.hasClass('mega-menu-inner') && ! $('.overlay-search.open', $masthead).length ) { $('body').removeClass('open-megamenu'); } var fixIE = $('html.ie').length; if (fixIE) { var $rowParent = $($ul).closest('.main-menu-container'); $rowParent.height('auto'); } $ul.fadeOut(0, 'linear', function(){ complete(); $ul.removeClass('open-animated'); if ( $ul.closest('li.menu-item-has-children').data('hover') === false ) { $('body').removeClass('open-submenu'); } }); }, collapsibleShowFunction: function($ul, complete) { $ul.slideDown(400, 'easeInOutCirc', complete); }, collapsibleHideFunction: function($ul, complete) { $ul.slideUp(200, 'easeInOutCirc', complete); }, hideOnClick: SiteParameters.menuHideOnClick, }); if ( $('body').hasClass('menu-accordion-active') ) { $menusmart.each(function(key, menu){ $(menu).addClass('menu-smart-init'); $(menu).smartmenus( 'itemActivate', $(menu).find( '.current-menu-item > a' ).eq( -1 ) ); }); } $(document).on( 'uncode.smartmenu-appended', function(){ requestTimeout(function(){ $menusmart.smartmenus( 'refresh' ); }, 1000); }); } $('.main-menu-container').each(function(){ var $main_cont = $(this), $uls = $('ul', $main_cont); $uls.each(function(){ var $ul = $(this), mobile_hidden = true, tablet_hidden = true; $('> li:not(.hidden)', $ul).each(function(){ if ( !$(this).hasClass('mobile-hidden') ) { mobile_hidden = false; return false; } }); $('> li:not(.hidden)', $ul).each(function(){ if ( !$(this).hasClass('tablet-hidden') ) { tablet_hidden = false; return false; } }); if ( mobile_hidden ) { $ul.addClass('mobile-hidden'); } if ( tablet_hidden ) { $ul.addClass('tablet-hidden'); } }); var $divUlsMB = $('div:has(>ul.mobile-hidden)'); $divUlsMB.each(function(){ var $divUlMB = $(this), div_mobile_hidden = true, div_tablet_hidden = true; $('> ul:not(.hidden)', $divUlMB).each(function(){ if ( !$(this).hasClass('mobile-hidden') ) { div_mobile_hidden = false; return false; } }); $('> ul:not(.hidden)', $divUlMB).each(function(){ if ( !$(this).hasClass('tablet-hidden') ) { div_tablet_hidden = false; return false; } }); if ( div_mobile_hidden ) { $divUlMB.addClass('mobile-hidden'); } if ( div_tablet_hidden ) { $divUlMB.addClass('tablet-hidden'); } }); }); var overlaySearchButton = function(){ var $search_wrap = $('.overlay.overlay-search, .widget_search'); $search_wrap.each(function(){ var $form = $('form', this), $icon = $('i', $form); $icon.on('click', function(){ $form.submit(); }); }); }; overlaySearchButton(); } UNCODE.okvideo = function(ev) { 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, provider){ var tag; if ( ev === 'uncode-more-items-loaded' && provider !== 'youtube' ) { delete UNCODE.insertedSripts[src]; var tags = document.getElementsByTagName('script'); for (var i = tags.length; i >= 0; i--){ if (tags[i] && tags[i].getAttribute('src') != null && tags[i].getAttribute('src').indexOf(src) != -1) { tags[i].parentNode.removeChild(tags[i]); } } } else { if (UNCODE.insertedSripts && UNCODE.insertedSripts[src]) { tag = UNCODE.insertedSripts[src]; if (callback){ if (tag.readyState){ //IE tag.onreadystatechange = function(){ if (tag.readyState === "loaded" || tag.readyState === "complete"){ tag.onreadystatechange = null; callback(); } }; } else { $(tag).on('load', callback); } } return; } } 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); if ( ! UNCODE.insertedSripts ) { UNCODE.insertedSripts = []; } UNCODE.insertedSripts[src] = tag; }; // load the youtube api base.loadYouTubeAPI = function(callback) { if ( ev === 'uncode-more-items-loaded' ) { onYouTubeIframeAPIReady(); } else { base.insertJS('https://www.youtube.com/player_api', false, 'youtube'); } }; 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 + '&autopause=0', jIframe = $('