/** * Alpha FrameWork Async JS Library * * @author D-THEMES * @package WP Alpha Framework * @subpackage Theme * @since 1.0 * @version 1.0 */ 'use strict'; ( function( $ ) { /** * jQuery easing * * @since 1.0 */ $.extend( $.easing, { def: 'easeOutQuad', swing: function( x, t, b, c, d ) { return $.easing[$.easing.def]( x, t, b, c, d ); }, easeOutQuad: function( x, t, b, c, d ) { return -c * ( t /= d ) * ( t - 2 ) + b; }, easeInOutQuart: function( x, t, b, c, d ) { if ( ( t /= d / 2 ) < 1 ) return c / 2 * t * t * t * t + b; return -c / 2 * ( ( t -= 2 ) * t * t * t - 2 ) + b; }, easeOutQuint: function( x, t, b, c, d ) { return c * ( ( t = t / d - 1 ) * t * t * t * t + 1 ) + b; } } ); theme.defaults.popup = { fixedContentPos: true, closeOnBgClick: false, removalDelay: 350, callbacks: { beforeOpen: function() { if ( this.fixedContentPos ) { var scrollBarWidth = window.innerWidth - document.body.clientWidth; $( '.sticky-content.fixed' ).css( 'padding-right', scrollBarWidth ); $( '.mfp-wrap' ).css( 'overflow', 'hidden auto' ); } }, close: function() { if ( this.fixedContentPos ) { $( '.mfp-wrap' ).css( 'overflow', '' ); $( '.sticky-content.fixed' ).css( 'padding-right', '' ); } } }, } theme.defaults.isotope = { itemSelector: '.grid-item', layoutMode: 'masonry', percentPosition: true, masonry: { columnWidth: '.grid-space' }, getSortData: { order: '[data-creative-order] parseInt', order_xxl: '[data-creative-order-xxl] parseInt', order_xlg: '[data-creative-order-xlg] parseInt', order_xl: '[data-creative-order-xl] parseInt', order_lg: '[data-creative-order-lg] parseInt', order_md: '[data-creative-order-md] parseInt', order_sm: '[data-creative-order-sm] parseInt', }, } theme.defaults.popupPresets = { login: { type: 'ajax', mainClass: "mfp-login mfp-fade", tLoading: '
', preloader: true, items: { src: alpha_vars.ajax_url, }, ajax: { settings: { method: 'post', data: { action: 'alpha_account_form', nonce: alpha_vars.nonce } }, cursor: 'mfp-ajax-cur' // CSS class that will be added to body during the loading (adds "progress" cursor) } }, video: { type: 'iframe', mainClass: "mfp-fade", preloader: false, closeBtnInside: false }, firstpopup: { type: 'inline', mainClass: 'mfp-popup-template mfp-newsletter-popup mfp-flip-popup', callbacks: { beforeClose: function() { // if "do not show" is checked $( '.mfp-alpha .popup .hide-popup input[type="checkbox"]' ).prop( 'checked' ) && theme.setCookie( 'hideNewsletterPopup', true, 7 ); } } }, popup_template: { type: 'ajax', mainClass: "mfp-popup-template mfp-flip-popup", tLoading: '', preloader: true, items: { src: alpha_vars.ajax_url, }, ajax: { settings: { method: 'post', }, cursor: 'mfp-ajax-cur' // CSS class that will be added to body during the loading (adds "progress" cursor) } }, } theme.defaults.slider = { a11y: false, containerModifierClass: 'slider-container-', // NEW slideClass: 'slider-slide', wrapperClass: 'slider-wrapper', slideActiveClass: 'slider-slide-active', slideDuplicateClass: 'slider-slide-duplicate', } theme.defaults.sliderPresets = { 'compare-slider': { spaceBetween: 10, slidesPerView: 2, breakpoints: { 992: { spaceBetween: 30, slidesPerView: 4, }, 768: { spaceBetween: 20, slidesPerView: 3, } } }, 'products-flipbook': { onInitialized: function() { function stopDrag( e ) { $( e.target ).closest( '.product-single-carousel, .product-gallery-carousel, .product-thumbs' ).length && e.stopPropagation(); } this.wrapperEl.addEventListener( 'mousedown', stopDrag ); if ( 'ontouchstart' in document ) { this.wrapperEl.addEventListener( 'touchstart', stopDrag, { passive: true } ); } } } } /** * Prevent default handler * * @since 1.0 * @param {Event} e * @return {void} */ theme.preventDefault = function( e ) { e.preventDefault() } /** * Initialize template's content. * * @since 1.0 * @param {jQuery} $template * @return {void} */ theme.initTemplate = function( $template ) { theme.lazyload( $template ); theme.slider( $template.find( '.slider-wrapper' ) ); theme.isotopes( $template.find( '.grid' ) ); theme.woocommerce.initProducts( $template ); if ( typeof theme.countdown == 'function' ) { theme.countdown( $template.find( '.countdown' ) ); } theme.call( function() { theme.$window.trigger( 'alpha_loadmore' ); }, 300 ); theme.$body.trigger( 'alpha_init_tab_template' ); } /** * Load template's content. * * @since 1.0 * @param {jQuery} $template * @return {void} */ theme.loadTemplate = function( $template ) { var html = ''; var orignal_split = alpha_vars.resource_split_tasks; // To run carousel immediately alpha_vars.resource_split_tasks = 0; $template.children( '.load-template' ).each( function() { html += this.text; } ); if ( html ) { $template.html( html ); if ( theme.skeleton ) { theme.skeleton( $( '.skeleton-body' ), function() { theme.initTemplate( $template ); } ); } else { theme.initTemplate( $template ); } } alpha_vars.resource_split_tasks = orignal_split; } /** * Check if window's width is really resized. * * @since 1.0 * @param {number} timeStamp * @return {boolean} */ theme.windowResized = function( timeStamp ) { if ( timeStamp == theme.resizeTimeStamp ) { return theme.resizeChanged; } theme.resizeChanged = theme.canvasWidth != window.innerWidth; theme.canvasWidth = window.innerWidth; theme.resizeTimeStamp = timeStamp; return theme.resizeChanged; } /** * Set cookie * * @since 1.0 * @param {string} name Cookie name * @param {string} value Cookie value * @param {number} exdays Expire period * @return {void} */ theme.setCookie = function( name, value, exdays ) { var date = new Date(); date.setTime( date.getTime() + ( exdays * 24 * 60 * 60 * 1000 ) ); document.cookie = name + "=" + value + ";expires=" + date.toUTCString() + ";path=/"; } /** * Get cookie * * @since 1.0 * @param {string} name Cookie name * @return {string} Cookie value */ theme.getCookie = function( name ) { var n = name + "="; var ca = document.cookie.split( ';' ); for ( var i = 0; i < ca.length; ++i ) { var c = ca[i]; while ( c.charAt( 0 ) == ' ' ) { c = c.substring( 1 ); } if ( c.indexOf( n ) == 0 ) { return c.substring( n.length, c.length ); } } return ""; } /** * Scroll to given target in given duration. * * @since 1.0 * @param {mixed} target This can be number or string seletor or jQuery object. * @param {number} duration This can be omitted. * @return {void} */ theme.scrollTo = function( target, duration ) { var _duration = typeof duration == 'undefined' ? 0 : duration; var offset; if ( typeof target == 'number' ) { offset = target; } else { var $target = theme.$( target ).closest( ':visible' ); if ( $target.length ) { var offset = $target.offset().top; var $wpToolbar = $( '#wp-toolbar' ); window.innerWidth > 600 && $wpToolbar.length && ( offset -= $wpToolbar.parent().outerHeight() ); $( '.sticky-content.fix-top.fixed' ).each( function() { offset -= this.offsetHeight; } ) } } $( 'html,body' ).stop().animate( { scrollTop: offset }, _duration ); } /** * Scroll to fixed content * * @since 1.0 * @param {number} arg * @param {number} duration * @return {void} */ theme.scrollToFixedContent = function( arg, duration ) { var stickyTop = 0, toolbarHeight = window.innerWidth > 600 && $( '#wp-toolbar' ).parent().length ? $( '#wp-toolbar' ).parent().outerHeight() : 0; $( '.sticky-content.fix-top' ).each( function() { if ( $( this ).hasClass( 'toolbox-top' ) ) { var pt = $( this ).css( 'padding-top' ).slice(); if ( pt.length > 2 ) { stickyTop -= Number( pt.slice( 0, -2 ) ); } return; } var fixed = $( this ).hasClass( 'fixed' ); stickyTop += $( this ).addClass( 'fixed' ).outerHeight(); fixed || $( this ).removeClass( 'fixed' ); } ) theme.scrollTo( arg - stickyTop - toolbarHeight, duration ); } /** * Get value by given param from url * * @since 1.0 * @param {string} href * @param {string} name * @return {string} value */ theme.getUrlParam = function( href, name ) { var url = document.createElement( 'a' ), s, r; url.href = decodeURIComponent( decodeURI( href ) ); s = url.search; if ( s.startsWith( '?' ) ) { s = s.substr( 1 ); } var params = {}; s.split( '&' ).forEach( function( v ) { var i = v.indexOf( '=' ); if ( i >= 0 ) { params[v.substr( 0, i )] = v.substr( i + 1 ); } } ); return params[name] ? params[name] : ''; } /** * Add param to url * * @since 1.0 * @param {string} href * @param {string} name * @param {mixed} value * @return {string} */ theme.addUrlParam = function( href, name, value ) { var url = document.createElement( 'a' ), s, r; href = decodeURIComponent( decodeURI( href ) ); url.href = href; s = url.search; if ( 0 <= s.indexOf( name + '=' ) ) { r = s.replace( new RegExp( name + '=[^&]*' ), name + '=' + value ); } else { r = ( s.length && 0 <= s.indexOf( '?' ) ) ? s : '?'; r.endsWith( '?' ) || ( r += '&' ); r += name + '=' + value; } return encodeURI( href.replace( s, '' ) + r.replace( /&+/, '&' ) ); } /** * Remove param from url * * @since 1.0 * @param {string} href * @param {string} name * @return {string} */ theme.removeUrlParam = function( href, name ) { var url = document.createElement( 'a' ), s, r; href = decodeURIComponent( decodeURI( href ) ); url.href = href; s = url.search; if ( 0 <= s.indexOf( name + '=' ) ) { r = s.replace( new RegExp( name + '=[^&]*' ), '' ).replace( /&+/, '&' ).replace( '?&', '?' ); r.endsWith( '&' ) && ( r = r.substr( 0, r.length - 1 ) ); r.endsWith( '?' ) && ( r = r.substr( 0, r.length - 1 ) ); r = r.replace( '&&', '&' ); } else { r = s; } return encodeURI( href.replace( s, '' ) + r ); } /** * Show More * * @since 1.0 * @param {string} selector */ theme.showMore = function( selector ) { theme.$( selector ).after( '
' ); theme.$window.trigger( 'scroll.loadingPosition' ); } /** * Hide more * * @since 1.0 * @param {string} selector * @return {void} */ theme.hideMore = function( selector ) { theme.$( selector ).children( '.d-loading-stick, .d-loading' ).remove(); } /** * Start count to number * * @since 1.0 * @param {string} selector * @return {void} */ theme.countTo = function( selector, runAsSoon = false ) { if ( $.fn.countTo ) { theme.$( selector ).each( function() { var el = this; var $this = $( this ); function runProgress() { setTimeout( function() { var options = { onComplete: function() { $this.addClass( 'complete' ); } }; $this.data( 'duration' ) && ( options.speed = $this.data( 'duration' ) ); $this.data( 'from-value' ) && ( options.from = $this.data( 'from-value' ) ); $this.data( 'to-value' ) && ( options.to = $this.data( 'to-value' ) ); options.decimals = options.to && typeof options.to === 'string' && options.to.indexOf( '.' ) >= 0 ? ( options.to.length - options.to.indexOf( '.' ) - 1 ) : 0; $this.countTo( options ); }, 300 ); } runAsSoon ? runProgress() : theme.appear( el, runProgress ); } ); } } /** * Initialize Parallax Background * * @since 1.0 * @param {string} selector * @return {void} */ theme.parallax = ( function() { function Parallax( $el, opts ) { return this.init( $el, opts ); }; Parallax.prototype.init = function( $el, opts ) { if ( $el.data( '__parallax' ) ) { return this; } this.$el = $el; this .setData() .setOptions( opts ) .build(); return this; } Parallax.prototype.setData = function() { this.$el.data( '__parallax', this ); return this; } Parallax.prototype.setOptions = function( opts ) { this.options = $.extend( true, {}, Parallax.defaults, opts, { wrapper: this.$el } ); return this; } Parallax.prototype.build = function() { var self = this, background; // Create Parallax Element background = $( '
' ); // Set Style for Parallax Element var bg = self.options.wrapper.attr( 'data-parallax-image' ) ? 'url(' + self.options.wrapper.attr( 'data-parallax-image' ) + ')' : self.options.wrapper.css( 'background-image' ); background.css( { 'background-image': bg, 'background-size': 'cover', 'background-position': '50% 0%', 'position': 'absolute', 'width': '100%', 'height': self.options.speed * 100 + '%' } ); // Add Parallax Element on DOM self.options.wrapper.prepend( background ); // Set Overlfow Hidden and Position Relative to Parallax Wrapper self.options.wrapper.css( { 'position': 'relative', 'overflow': 'hidden' } ); if ( self.options.direction == 'left' || self.options.direction == 'right' ) { // horizontal background.css( { 'background-position': '0% 50%', 'width': self.options.speed * 100 + '%', 'height': '100%', } ); } // Parallax Effect on Scroll & Resize var parallaxEffectOnScrollResize = function() { var skrollr_size = 100 * self.options.speed, skrollr_start = -( skrollr_size - 100 ); if ( self.options.direction == 'up' ) { background.attr( "data-bottom-top", "bottom: " + skrollr_start + "%;" ).attr( "data-top-bottom", "bottom: 0%;" ); } else if ( self.options.direction == 'down' ) { background.attr( "data-bottom-top", "top: " + skrollr_start + "%;" ).attr( "data-top-bottom", "top: 0%;" ); } else if ( self.options.direction == 'left' ) { background.attr( "data-bottom-top", "right: " + skrollr_start + "%;" ).attr( "data-top-bottom", "right: 0%;" ); } else { background.attr( "data-bottom-top", "left: " + skrollr_start + "%;" ).attr( "data-top-bottom", "left: 0%;" ); } } if ( !theme.isMobile ) { parallaxEffectOnScrollResize(); } else { if ( self.options.enableOnMobile == true ) { parallaxEffectOnScrollResize(); } else { self.options.wrapper.addClass( 'parallax-disabled' ); } } return this; } // jquery plugin $.fn.themeParallax = function( opts ) { if ( theme.isMobile ) { return; } if ( typeof skrollr == 'undefined' ) { return this; } var obj = this.map( function() { var $this = $( this ); if ( $this.data( '__parallax' ) ) { return $this.data( '__parallax' ); } else { return new Parallax( $this, opts ); } } ); if ( theme.parallaxSkrollr && skrollr.get() ) { theme.parallaxSkrollr.refresh(); } else if ( !theme.isMobile ) { theme.parallaxSkrollr = skrollr.init( { forceHeight: false, smoothScrolling: true } ); theme.parallaxSkrollr.refresh(); } return obj; } } )() // Show loading overlay when $.fn.block is called var funcBlock = $.fn.block; $.fn.block = function( opts ) { if ( theme.status == 'complete' ) { // To prevent single product widget's found variation blocking while page loading this.append( '
' ); funcBlock.call( this, opts ); } return this; } // Hide loading overlay when $.fn.block is called var funcUnblock = $.fn.unblock; $.fn.unblock = function( opts ) { if ( theme.status == 'complete' ) { // To prevent single product widget's found variation blocking while page loading funcUnblock.call( this, opts ); this.hasClass( 'processing' ) || this.parents( '.processing' ).length || this.children( '.d-loading' ).remove(); if ( theme.woocommerce && typeof theme.woocommerce.initAlertAction == 'function' ) { theme.woocommerce.initAlertAction(); } } return this; } /** * Initialize Sticky Content * * @class StickyContent * @since 1.0 * @param {string, Object} selector * @param {Object} options * @return {void} */ theme.stickyContent = ( function() { function StickyContent( $el, options ) { return this.init( $el, options ); } function refreshAll() { theme.$window.trigger( 'sticky_refresh.alpha', { index: 0, offsetTop: window.innerWidth > 600 && $( '#wp-toolbar' ).length && $( '#wp-toolbar' ).parent().is( ':visible' ) ? $( '#wp-toolbar' ).parent().outerHeight() : 0 } ); } function refreshAllSize( e ) { if ( !e || theme.windowResized( e.timeStamp ) ) { theme.$window.trigger( 'sticky_refresh_size.alpha' ); theme.requestFrame( refreshAll ); } } StickyContent.prototype.init = function( $el, options ) { this.$el = $el; this.options = $.extend( true, {}, theme.defaults.sticky, options, theme.parseOptions( $el.attr( 'data-sticky-options' ) ) ); this.scrollPos = window.pageYOffset; // issue: heavy js performance : 30.7ms this.originalHeight = this.$el.outerHeight(); theme.$window .on( 'sticky_refresh.alpha', this.refresh.bind( this ) ) .on( 'sticky_refresh_size.alpha', this.refreshSize.bind( this ) ); } StickyContent.prototype.refreshSize = function( e ) { var beWrap = window.innerWidth >= this.options.minWidth && window.innerWidth <= this.options.maxWidth; if ( typeof this.top == 'undefined' ) { this.top = this.options.top; } if ( window.innerWidth >= 768 && this.getTop ) { this.top = this.getTop(); } else if ( !this.options.top ) { this.top = this.isWrap ? this.$el.parent().offset().top : this.$el.offset().top + this.$el[0].offsetHeight; // if sticky header has toggle dropdown menu, increase top if ( this.$el.find( '.toggle-menu.show-home' ).length ) { this.top += this.$el.find( '.toggle-menu .dropdown-box' )[0].offsetHeight; } } if ( !this.isWrap ) { beWrap && this.wrap(); } else { beWrap || this.unwrap(); } e && theme.requestTimeout( this.refreshSize.bind( this ), 50 ); } StickyContent.prototype.wrap = function() { this.$el.wrap( '
' ); this.$el.closest( '.toolbox-horizontal' ).addClass( 'horizontal-fixed' ); this.isWrap = true; } StickyContent.prototype.unwrap = function() { this.$el.unwrap( '.sticky-content-wrapper' ); this.$el.closest( '.toolbox-horizontal' ).removeClass( 'horizontal-fixed' ); this.isWrap = false; } StickyContent.prototype.refresh = function( e, data ) { var pageYOffset = window.pageYOffset /* + data.offsetTop*/; // issue: heavy js performance, 6.7ms var $el = this.$el; this.refreshSize(); $( '.fixed.fix-top' ).each( function() { pageYOffset += $( this ).outerHeight(); } ); // Make sticky if ( ( pageYOffset >= this.top + this.originalHeight ) && this.isWrap ) { // calculate height this.height = $el[0].offsetHeight; $el.hasClass( 'fixed' ) || $el.parent().css( 'height', this.height + 'px' ); // update sticky status if ( this.options.scrollMode ) { if ( ( this.scrollPos >= window.pageYOffset && $el.hasClass( 'fix-top' ) ) || this.scrollPos <= window.pageYOffset && $el.hasClass( 'fix-bottom' ) ) { $el.addClass( 'fixed' ); this.onFixed && this.onFixed(); } else { $el.removeClass( 'fixed' ).css( { 'margin-top': '', 'margin-bottom': '', 'z-index': '' } ); this.onUnfixed && this.onUnfixed(); } this.scrollPos = window.pageYOffset; } else { $el.addClass( 'fixed' ); this.onFixed && this.onFixed(); } // update sticky order if ( $el.hasClass( 'fixed' ) && $el.hasClass( 'fix-top' ) ) { // this.zIndex = this.options.max_index - data.index; this.zIndex = this.options.max_index - $( '.fix-top' ).index( $el ); $el.css( { 'margin-top': data.offsetTop + 'px', 'z-index': this.zIndex } ); } else if ( $el.hasClass( 'fixed' ) && $el.hasClass( 'fix-bottom' ) ) { this.zIndex = this.options.max_index - data.index; $el.css( { 'margin-bottom': data.offsetBottom + 'px', 'z-index': this.zIndex } ); } else { $el.css( { 'transition': 'opacity .5s' } ); } // stack offset if ( $el.hasClass( 'fixed' ) ) { if ( $el.hasClass( 'fix-top' ) ) { data.offsetTop += $el[0].offsetHeight; } else if ( $el.hasClass( 'fix-bottom' ) ) { data.offsetBottom += $el[0].offsetHeight; } } } else { $el.parent().css( 'height', '' ); $el.removeClass( 'fixed' ).css( { 'margin-top': '', 'margin-bottom': '', 'z-index': '' } ); this.onUnfixed && this.onUnfixed(); } theme.$window.trigger( 'alpha_finish_sticky' ); } theme.$window.on( 'alpha_complete', function() { window.addEventListener( 'scroll', refreshAll, { passive: true } ); theme.$window.on( 'resize', refreshAllSize ); setTimeout( function() { refreshAllSize(); }, 1000 ); } ) return function( selector, options ) { theme.$( selector ).each( function() { var $this = $( this ); $this.data( 'sticky-content' ) || $this.data( 'sticky-content', new StickyContent( $this, options ) ); } ) } } )() /** * Register events for alert * * @since 1.0 * @param {string} selector * @return {void} */ theme.alert = function( selector ) { theme.$body.on( 'click', selector + ' .btn-close', function( e ) { e.preventDefault(); if ( $( this ).closest( '.elementor-widget-' + alpha_vars.theme + '_widget_alert' ).length ) { selector = '.elementor-widget-' + alpha_vars.theme + '_widget_alert'; } $( this ).closest( selector ).fadeOut( function() { $( this ).remove(); } ); } ); } /** * Run isotopes * * @since 1.0 * @param {string} selector * @param {Object} options * @return {void} */ theme.isotopes = ( function() { function _isotopeSort( e, $selector ) { var $grid = $selector ? $selector : $( '.grid' ); if ( !$grid.length ) { return; } $grid.each( function( e ) { var $this = $( this ); if ( !$this.attr( 'data-creative-breaks' ) || $this.hasClass( 'float-grid' ) ) { return; } $this.children( '.grid-item' ).css( { 'animation-fill-mode': 'none', '-webkit-animation-fill-mode': 'none' } ); var width = window.innerWidth, breaks = JSON.parse( $this.attr( 'data-creative-breaks' ) ), cur_break = $this.attr( 'data-current-break' ); if ( width >= breaks['xlg'] ) { width = ''; } else if ( width >= breaks['xlg'] && width < breaks['xxl'] ) { width = 'xxl'; } else if ( width >= breaks['xl'] && width < breaks['xlg'] ) { width = 'xlg'; } else if ( width >= breaks['lg'] && width < breaks['xl'] ) { width = 'xl'; } else if ( width >= breaks['md'] && width < breaks['lg'] ) { width = 'lg'; } else if ( width >= breaks['sm'] && width < breaks['md'] ) { width = 'md'; } else if ( width < breaks['sm'] ) { width = 'sm'; } if ( width == cur_break ) { return; } if ( $this.data( 'isotope' ) ) { $this.isotope( { sortBy: 'order' + ( width ? '_' + width : '' ), } ).isotope( 'layout' ); } else { var options = theme.parseOptions( $this.attr( 'data-grid-options' ) ); options.sortBy = 'order' + ( width ? '_' + width : '' ); $this.attr( 'data-grid-options', JSON.stringify( options ) ); } $this.attr( 'data-current-break', width ); } ); } return function( selector, options ) { if ( !$.fn.imagesLoaded || !$.fn.isotope ) { return; } theme.$( selector ).each( function() { var $this = $( this ); if ( $this.hasClass( 'grid-float' ) ) { return; } var settings = $.extend( true, {}, theme.defaults.isotope, theme.parseOptions( this.getAttribute( 'data-grid-options' ) ), options ? options : {}, $this.hasClass( 'masonry' ) ? { horizontalOrder: true } : {} ); _isotopeSort( '', $this ); if ( settings.masonry.columnWidth && !$this.children( settings.masonry.columnWidth ).length ) { delete settings.masonry.columnWidth; } Object.setPrototypeOf( this, HTMLElement.prototype ); $this.children().each( function() { Object.setPrototypeOf( this, HTMLElement.prototype ); } ); if ( $this.attr( 'data-creative-breaks' ) ) { var width = window.innerWidth, breaks = JSON.parse( $this.attr( 'data-creative-breaks' ) ); if ( width >= breaks['xlg'] ) { width = ''; } else if ( width >= breaks['xlg'] && width < breaks['xxl'] ) { width = 'xxl'; } else if ( width >= breaks['xl'] && width < breaks['xlg'] ) { width = 'xlg'; } else if ( width >= breaks['lg'] && width < breaks['xl'] ) { width = 'xl'; } else if ( width >= breaks['md'] && width < breaks['lg'] ) { width = 'lg'; } else if ( width >= breaks['sm'] && width < breaks['md'] ) { width = 'md'; } else if ( width < breaks['sm'] ) { width = 'sm'; } $.extend( settings, { sortBy: 'order' + ( width ? '_' + width : '' ), } ); } $this.imagesLoaded( function() { $this.addClass( 'isotope-loaded' ).isotope( settings ); 'undefined' != typeof elementorFrontend && $this.trigger( 'resize.waypoints' ); } ); } ); theme.$window.on( 'resize', _isotopeSort ); } } )(); /** * Register events for accordion * * @since 1.0 * @param {string} selector * @return {void} */ theme.accordion = function( selector ) { theme.$body.on( 'click', selector, function( e ) { var $this = $( this ), $body = $this.closest( '.card' ), $parent = $this.closest( '.accordion' ); var link = $this.attr( 'href' ); if ( '#' == link ) { $body = $body.children( ".card-body" ); } else { $body = $body.find( '#' == link[0] ? $this.attr( 'href' ) : '#' + $this.attr( 'href' ) ); } if ( !$body.length ) { return; } e.preventDefault(); if ( !$parent.find( ".collapsing" ).length && !$parent.find( ".expanding" ).length ) { if ( $body.hasClass( 'expanded' ) ) { $parent.hasClass( 'radio-type' ) || slideToggle( $body ); } else if ( $body.hasClass( 'collapsed' ) ) { if ( $parent.find( '.expanded' ).length > 0 ) { if ( theme.isIE ) { slideToggle( $parent.find( '.expanded' ), function() { slideToggle( $body ); } ); } else { slideToggle( $parent.find( '.expanded' ) ); slideToggle( $body ); } } else { slideToggle( $body ); } } } } ); // define slideToggle method var slideToggle = function( $wrap, callback ) { var $card = $wrap.closest( '.card' ), $header = $card.find( selector ); if ( $wrap.hasClass( "expanded" ) ) { $header.removeClass( "collapse" ).addClass( "expand" ); $card.removeClass( "collapse" ).addClass( "expand" ); $wrap.addClass( "collapsing" ).slideUp( 300, function() { $wrap.removeClass( "expanded collapsing" ).addClass( "collapsed" ); callback && callback(); } ); } else if ( $wrap.hasClass( "collapsed" ) ) { $header.removeClass( "expand" ).addClass( "collapse" ); $card.removeClass( "expand" ).addClass( "collapse" ); $wrap.addClass( "expanding" ).slideDown( 300, function() { $wrap.removeClass( "collapsed expanding" ).addClass( "expanded" ); callback && callback(); } ); } }; } /** * Register events for tab * * @since 1.0 * @param string selector * @return {void} */ theme.tab = function( selector ) { if ( selector == '' ) { return; } var initTab = function( self, e ) { var $link = $( self ); // if tab is loading, return if ( $link.closest( selector ).hasClass( 'loading' ) ) { return; } // get href var href = 'SPAN' == self.tagName ? $link.data( 'href' ) : $link.attr( 'href' ); // get panel var $panel; if ( '#' == href ) { $panel = $link.closest( '.nav' ).siblings( '.tab-content' ).children( '.tab-pane' ).eq( $link.parent().index() ); } else { $panel = $( ( '#' == href.substring( 0, 1 ) ? '' : '#' ) + href ); } if ( $( '.elementor-element[data-id=' + href + ']' ).length ) { $panel = $( '.elementor-element[data-id=' + href + ']' ); } if ( !$panel.length ) { return; } e.preventDefault(); var $activePanel = $panel.parent().children( '.active' ); if ( $link.hasClass( "active" ) || !href ) { return; } // change active link $link.parent().parent().find( '.active' ).removeClass( 'active' ); $link.addClass( 'active' ); theme.loadTemplate( $panel ); theme.slider( $panel.find( '.slider-wrapper' ) ); $activePanel.removeClass( 'in active' ); $panel.addClass( 'active in' ); theme.refreshLayouts(); } if ( typeof selector == 'object' ) { selector.find( '.nav-link' ).on( 'click', function( e ) { initTab( this, e ) } ); } else { theme.$body.on( 'click', selector + ' .nav-link', function( e ) { initTab( this, e ) } ); } } /** * Playable video * * @since 1.0 * @param {string} selector * @return {void} */ theme.playableVideo = function( selector ) { $( selector + ' .video-play' ).on( 'click', function( e ) { var $video = $( this ).closest( selector ); if ( $video.hasClass( 'playing' ) ) { $video.removeClass( 'playing' ) .addClass( 'paused' ) .find( 'video' )[0].pause(); } else { $video.removeClass( 'paused' ) .addClass( 'playing' ) .find( 'video' )[0].play(); } e.preventDefault(); } ); $( selector + ' video' ).on( 'ended', function() { $( this ).closest( '.post-video' ).removeClass( 'playing' ); } ); } /** * Run appear animation * * @since 1.0 * @param {string} selector * @return {void} */ theme.appearAnimate = function( selector ) { var appearClass = typeof selector == 'string' && selector.indexOf( 'elementor-invisible' ) > 0 ? 'elementor-invisible' : 'appear-animate'; theme.$( selector ).each( function() { var el = this; theme.appear( el, function() { if ( el.classList.contains( appearClass ) && !el.classList.contains( 'appear-animation-visible' ) ) { var settings = theme.parseOptions( el.getAttribute( 'data-settings' ) ), duration = 1000; if ( el.classList.contains( 'animated-slow' ) ) { duration = 2000; } else if ( el.classList.contains( 'animated-fast' ) ) { duration = 750; } theme.call( function() { el.style['animation-duration'] = duration + 'ms'; el.style['animation-delay'] = settings._animation_delay + 'ms'; el.style['transition-property'] = 'visibility, opacity'; el.style['transition-duration'] = '0s'; el.style['transition-delay'] = settings._animation_delay + 'ms'; var animation_name = settings.animation || settings._animation || settings._animation_name; animation_name && el.classList.add( animation_name ); el.classList.add( 'appear-animation-visible' ); setTimeout( function() { el.style['transition-property'] = ''; el.style['transition-duration'] = ''; el.style['transition-delay'] = ''; el.classList.add( 'animating' ); setTimeout( function() { el.classList.add( 'animated-done' ); }, duration ); }, settings._animation_delay ? settings._animation_delay + 500 : 500 ); } ); } } ); } ); if ( typeof elementorFrontend == 'object' ) { theme.$window.trigger( 'resize.waypoints' ); } } var videoIndex = { youtube: 'youtube.com', vimeo: 'vimeo.com/', gmaps: '//maps.google.', hosted: '' } /** * Initialize popups * * @since 1.0 * @return {void} */ theme.initPopups = function() { // Register "Play Video" Popup theme.$body.on( 'click', '.btn-video-iframe', function( e ) { e.preventDefault(); theme.popup( { items: { src: '