?AlkantarClanX12
| Current Path : /home/r/a/n/rankinh/villavanille/wp-content/plugins/drew-core/assets/js/ |
| Current File : /home/r/a/n/rankinh/villavanille/wp-content/plugins/drew-core/assets/js/drew-core.js |
(function ( $ ) {
'use strict';
// This case is important when theme is not active
if ( typeof qodef !== 'object' ) {
window.qodef = {};
}
window.qodefCore = {};
qodefCore.shortcodes = {};
qodefCore.listShortcodesScripts = {
qodefSwiper: qodef.qodefSwiper,
qodefPagination: qodef.qodefPagination,
qodefFilter: qodef.qodefFilter,
qodefMasonryLayout: qodef.qodefMasonryLayout,
qodefJustifiedGallery: qodef.qodefJustifiedGallery,
};
qodefCore.body = $( 'body' );
qodefCore.html = $( 'html' );
qodefCore.windowWidth = $( window ).width();
qodefCore.windowHeight = $( window ).height();
qodefCore.scroll = 0;
$( document ).ready(
function () {
qodefCore.scroll = $( window ).scrollTop();
qodefInlinePageStyle.init();
}
);
$( window ).resize(
function () {
qodefCore.windowWidth = $( window ).width();
qodefCore.windowHeight = $( window ).height();
}
);
$( window ).scroll(
function () {
qodefCore.scroll = $( window ).scrollTop();
}
);
var qodefScroll = {
disable: function () {
if ( window.addEventListener ) {
window.addEventListener(
'wheel',
qodefScroll.preventDefaultValue,
{ passive: false }
);
}
// window.onmousewheel = document.onmousewheel = qodefScroll.preventDefaultValue;
document.onkeydown = qodefScroll.keyDown;
},
enable: function () {
if ( window.removeEventListener ) {
window.removeEventListener(
'wheel',
qodefScroll.preventDefaultValue,
{ passive: false }
);
}
window.onmousewheel = document.onmousewheel = document.onkeydown = null;
},
preventDefaultValue: function ( e ) {
e = e || window.event;
if ( e.preventDefault ) {
e.preventDefault();
}
e.returnValue = false;
},
keyDown: function ( e ) {
var keys = [37, 38, 39, 40];
for ( var i = keys.length; i--; ) {
if ( e.keyCode === keys[i] ) {
qodefScroll.preventDefaultValue( e );
return;
}
}
}
};
qodefCore.qodefScroll = qodefScroll;
var qodefPerfectScrollbar = {
init: function ( $holder ) {
if ( $holder.length ) {
qodefPerfectScrollbar.qodefInitScroll( $holder );
}
},
qodefInitScroll: function ( $holder ) {
var $defaultParams = {
wheelSpeed: 0.6,
suppressScrollX: true
};
var $ps = new PerfectScrollbar(
$holder[0],
$defaultParams
);
$( window ).resize(
function () {
$ps.update();
}
);
}
};
qodefCore.qodefPerfectScrollbar = qodefPerfectScrollbar;
var qodefInlinePageStyle = {
init: function () {
this.holder = $( '#drew-core-page-inline-style' );
if ( this.holder.length ) {
var style = this.holder.data( 'style' );
if ( style.length ) {
$( 'head' ).append( '<style type="text/css">' + style + '</style>' );
}
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefAgeVerificationModal.init();
}
);
var qodefAgeVerificationModal = {
init: function () {
this.holder = $( '#qodef-age-verification-modal' );
if ( this.holder.length ) {
var $preventHolder = this.holder.find( '.qodef-m-content-prevent' );
if ( $preventHolder.length ) {
var $preventYesButton = $preventHolder.find( '.qodef-prevent--yes' );
$preventYesButton.on(
'click',
function () {
var cname = 'disabledAgeVerification';
var cvalue = 'Yes';
var exdays = 7;
var d = new Date();
d.setTime( d.getTime() + (exdays * 24 * 60 * 60 * 1000) );
var expires = 'expires=' + d.toUTCString();
document.cookie = cname + '=' + cvalue + ';' + expires + ';path=/';
qodefAgeVerificationModal.handleClassAndScroll( 'remove' );
}
);
}
}
},
handleClassAndScroll: function ( option ) {
if ( option === 'remove' ) {
qodefCore.body.removeClass( 'qodef-age-verification--opened' );
qodefCore.qodefScroll.enable();
}
if ( option === 'add' ) {
qodefCore.body.addClass( 'qodef-age-verification--opened' );
qodefCore.qodefScroll.disable();
}
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefBackToTop.init();
}
);
var qodefBackToTop = {
init: function () {
this.holder = $( '#qodef-back-to-top' );
if ( this.holder.length ) {
// Scroll To Top
this.holder.on(
'click',
function ( e ) {
e.preventDefault();
qodefBackToTop.animateScrollToTop();
}
);
qodefBackToTop.showHideBackToTop();
}
},
animateScrollToTop: function () {
var startPos = qodef.scroll,
newPos = qodef.scroll,
step = .9,
animationFrameId;
var startAnimation = function () {
if ( newPos === 0 ) {
return;
}
newPos < 0.0001 ? newPos = 0 : null;
var ease = qodefBackToTop.easingFunction( (startPos - newPos) / startPos );
$( 'html, body' ).scrollTop( startPos - (startPos - newPos) * ease );
newPos = newPos * step;
animationFrameId = requestAnimationFrame( startAnimation );
};
startAnimation();
$( window ).one(
'wheel touchstart',
function () {
cancelAnimationFrame( animationFrameId );
}
);
},
easingFunction: function ( n ) {
return 0 == n ? 0 : Math.pow( 1024, n - 1 );
},
showHideBackToTop: function () {
$( window ).scroll(
function () {
var $thisItem = $( this ),
b = $thisItem.scrollTop(),
c = $thisItem.height(),
d;
if ( b > 0 ) {
d = b + c / 2;
} else {
d = 1;
}
if ( d < 1e3 ) {
qodefBackToTop.addClass( 'off' );
} else {
qodefBackToTop.addClass( 'on' );
}
}
);
},
addClass: function ( a ) {
this.holder.removeClass( 'qodef--off qodef--on' );
if ( a === 'on' ) {
this.holder.addClass( 'qodef--on' );
} else {
this.holder.addClass( 'qodef--off' );
}
}
};
})( jQuery );
(function ($) {
"use strict";
$( window ).on(
'load',
function () {
qodefBackgroundText.init();
qodefBackgroundText.appearAnimation()
}
);
$( window ).resize(
function () {
qodefBackgroundText.init();
}
);
var qodefBackgroundText = {
init: function () {
var $holder = $( '.qodef-background-text' );
if ($holder.length) {
$holder.each(
function () {
qodefBackgroundText.responsiveOutputHandler( $( this ) );
}
);
}
},
responsiveOutputHandler : function ($holder) {
var breakpoints = {
3840: 1441,
1440: 1367,
1366: 1025,
1024: 1
};
$.each(
breakpoints,
function (max, min) {
if (qodef.windowWidth <= max && qodef.windowWidth >= min) {
qodefBackgroundText.generateResponsiveOutput( $holder, max );
}
}
);
},
generateResponsiveOutput: function ($holder, width) {
var $textHolder = $holder.find( '.qodef-m-background-text' );
if ($textHolder.length) {
$textHolder.css(
{
'font-size': $textHolder.data( 'size-' + width ) + 'px',
'left': $textHolder.data( 'horizontal-offset-' + width ),
'top': $textHolder.data( 'vertical-offset-' + width ),
}
);
}
},
appearAnimation () {
let $textHolder = $('.qodef-m-background-text');
if ( $textHolder.length ) {
$textHolder.each(
function () {
let $thisTextHolder = $( this );
if ( $thisTextHolder.length ) {
$thisTextHolder.addClass('qodef--init');
let text = $thisTextHolder.text(),
chars = text.split("");
for ( let i = 0; i < chars.length; i++ ) {
chars[i] = '<span class="qodef-m-char">' + chars[i] + '</span>';
text = chars.join(" ");
}
$thisTextHolder.html(text);
}
setTimeout(
function () {
let $chars = $thisTextHolder.find('.qodef-m-char');
if ( $chars.length ) {
$chars.each(
function (i) {
var $thisChar = $( this );
$thisTextHolder.appear(
function () {
setTimeout(
function () {
$thisChar.addClass('qodef--appeared');
}, i * 160
);
}, { accX: 0, accY: -100 }
);
}
);
}
}, 100
);
}
);
}
}
};
window.qodefBackgroundText = qodefBackgroundText;
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefUncoverFooter.init();
}
);
var qodefUncoverFooter = {
holder: '',
init: function () {
this.holder = $( '#qodef-page-footer.qodef--uncover' );
if ( this.holder.length && ! qodefCore.html.hasClass( 'touchevents' ) ) {
qodefUncoverFooter.addClass();
qodefUncoverFooter.setHeight( this.holder );
$( window ).resize(
function () {
qodefUncoverFooter.setHeight( qodefUncoverFooter.holder );
}
);
}
},
setHeight: function ( $holder ) {
$holder.css( 'height', 'auto' );
var footerHeight = $holder.outerHeight();
if ( footerHeight > 0 ) {
$( '#qodef-page-outer' ).css(
{
'margin-bottom': footerHeight,
'background-color': qodefCore.body.css( 'backgroundColor' )
}
);
$holder.css( 'height', footerHeight );
}
},
addClass: function () {
qodefCore.body.addClass( 'qodef-page-footer--uncover' );
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefFullscreenMenu.init();
}
);
var qodefFullscreenMenu = {
init: function () {
var $fullscreenMenuOpener = $( 'a.qodef-fullscreen-menu-opener' ),
$menuItems = $( '#qodef-fullscreen-area nav ul li a' );
// Open popup menu
$fullscreenMenuOpener.on(
'click',
function ( e ) {
e.preventDefault();
var $thisOpener = $( this );
if ( ! qodefCore.body.hasClass( 'qodef-fullscreen-menu--opened' ) ) {
qodefFullscreenMenu.openFullscreen( $thisOpener );
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) {
qodefFullscreenMenu.closeFullscreen( $thisOpener );
}
}
);
} else {
qodefFullscreenMenu.closeFullscreen( $thisOpener );
}
}
);
//open dropdowns
$menuItems.on(
'tap click',
function ( e ) {
var $thisItem = $( this );
if ( $thisItem.parent().hasClass( 'menu-item-has-children' ) ) {
e.preventDefault();
qodefFullscreenMenu.clickItemWithChild( $thisItem );
} else if ( $thisItem.attr( 'href' ) !== 'http://#' && $thisItem.attr( 'href' ) !== '#' ) {
qodefFullscreenMenu.closeFullscreen( $fullscreenMenuOpener );
}
}
);
},
openFullscreen: function ( $opener ) {
$opener.addClass( 'qodef--opened' );
qodefCore.body.removeClass( 'qodef-fullscreen-menu-animate--out' ).addClass( 'qodef-fullscreen-menu--opened qodef-fullscreen-menu-animate--in' );
qodefCore.qodefScroll.disable();
},
closeFullscreen: function ( $opener ) {
$opener.removeClass( 'qodef--opened' );
qodefCore.body.removeClass( 'qodef-fullscreen-menu--opened qodef-fullscreen-menu-animate--in' ).addClass( 'qodef-fullscreen-menu-animate--out' );
qodefCore.qodefScroll.enable();
$( 'nav.qodef-fullscreen-menu ul.sub_menu' ).slideUp( 200 );
},
clickItemWithChild: function ( thisItem ) {
var $thisItemParent = thisItem.parent(),
$thisItemSubMenu = $thisItemParent.find( '.sub-menu' ).first();
if ( $thisItemSubMenu.is( ':visible' ) ) {
$thisItemSubMenu.slideUp( 300 );
$thisItemParent.removeClass( 'qodef--opened' );
} else {
$thisItemSubMenu.slideDown( 300 );
$thisItemParent.addClass( 'qodef--opened' ).siblings().find( '.sub-menu' ).slideUp( 400 );
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefHeaderScrollAppearance.init();
}
);
var qodefHeaderScrollAppearance = {
appearanceType: function () {
return qodefCore.body.attr( 'class' ).indexOf( 'qodef-header-appearance--' ) !== -1 ? qodefCore.body.attr( 'class' ).match( /qodef-header-appearance--([\w]+)/ )[1] : '';
},
init: function () {
var appearanceType = this.appearanceType();
if ( appearanceType !== '' && appearanceType !== 'none' ) {
qodefCore[appearanceType + 'HeaderAppearance']();
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefMobileHeaderAppearance.init();
}
);
/*
** Init mobile header functionality
*/
var qodefMobileHeaderAppearance = {
init: function () {
if ( qodefCore.body.hasClass( 'qodef-mobile-header-appearance--sticky' ) ) {
var docYScroll1 = qodefCore.scroll,
displayAmount = qodefGlobal.vars.mobileHeaderHeight + qodefGlobal.vars.adminBarHeight,
$pageOuter = $( '#qodef-page-outer' );
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
$( window ).scroll(
function () {
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
docYScroll1 = qodefCore.scroll;
}
);
$( window ).resize(
function () {
$pageOuter.css( 'padding-top', 0 );
qodefMobileHeaderAppearance.showHideMobileHeader( docYScroll1, displayAmount, $pageOuter );
}
);
}
},
showHideMobileHeader: function ( docYScroll1, displayAmount, $pageOuter ) {
if ( qodefCore.windowWidth <= 1024 ) {
if ( qodefCore.scroll > displayAmount * 2 ) {
//set header to be fixed
qodefCore.body.addClass( 'qodef-mobile-header--sticky' );
//add transition to it
setTimeout(
function () {
qodefCore.body.addClass( 'qodef-mobile-header--sticky-animation' );
},
300
); //300 is duration of sticky header animation
//add padding to content so there is no 'jumping'
$pageOuter.css( 'padding-top', qodefGlobal.vars.mobileHeaderHeight );
} else {
//unset fixed header
qodefCore.body.removeClass( 'qodef-mobile-header--sticky' );
//remove transition
setTimeout(
function () {
qodefCore.body.removeClass( 'qodef-mobile-header--sticky-animation' );
},
300
); //300 is duration of sticky header animation
//remove padding from content since header is not fixed anymore
$pageOuter.css( 'padding-top', 0 );
}
if ( (qodefCore.scroll > docYScroll1 && qodefCore.scroll > displayAmount) || (qodefCore.scroll < displayAmount * 3) ) {
//show sticky header
qodefCore.body.removeClass( 'qodef-mobile-header--sticky-display' );
} else {
//hide sticky header
qodefCore.body.addClass( 'qodef-mobile-header--sticky-display' );
}
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefNavMenu.init();
}
);
var qodefNavMenu = {
init: function () {
qodefNavMenu.dropdownBehavior();
qodefNavMenu.wideDropdownPosition();
qodefNavMenu.dropdownPosition();
},
dropdownBehavior: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li' );
$menuItems.each(
function () {
var $thisItem = $( this );
if ( $thisItem.find( '.qodef-drop-down-second' ).length ) {
$thisItem.waitForImages(
function () {
var $dropdownHolder = $thisItem.find( '.qodef-drop-down-second' ),
$dropdownMenuItem = $dropdownHolder.find( '.qodef-drop-down-second-inner ul' ),
dropDownHolderHeight = $dropdownMenuItem.outerHeight();
if ( navigator.userAgent.match( /(iPod|iPhone|iPad)/ ) ) {
$thisItem.on(
'touchstart mouseenter',
function () {
$dropdownHolder.css(
{
'height': dropDownHolderHeight,
'overflow': 'visible',
'visibility': 'visible',
'opacity': '1',
}
);
}
).on(
'mouseleave',
function () {
$dropdownHolder.css(
{
'height': '0px',
'overflow': 'hidden',
'visibility': 'hidden',
'opacity': '0',
}
);
}
);
} else {
if ( qodefCore.body.hasClass( 'qodef-drop-down-second--animate-height' ) ) {
var animateConfig = {
interval: 0,
over: function () {
setTimeout(
function () {
$dropdownHolder.addClass( 'qodef-drop-down--start' ).css(
{
'visibility': 'visible',
'height': '0',
'opacity': '1',
}
);
$dropdownHolder.stop().animate(
{
'height': dropDownHolderHeight,
},
400,
'linear',
function () {
$dropdownHolder.css( 'overflow', 'visible' );
}
);
},
100
);
},
timeout: 100,
out: function () {
$dropdownHolder.stop().animate(
{
'height': '0',
'opacity': 0,
},
100,
function () {
$dropdownHolder.css(
{
'overflow': 'hidden',
'visibility': 'hidden',
}
);
}
);
$dropdownHolder.removeClass( 'qodef-drop-down--start' );
}
};
$thisItem.hoverIntent( animateConfig );
} else {
var config = {
interval: 0,
over: function () {
setTimeout(
function () {
$dropdownHolder.addClass( 'qodef-drop-down--start' ).stop().css( { 'height': dropDownHolderHeight } );
},
150
);
},
timeout: 150,
out: function () {
$dropdownHolder.stop().css( { 'height': '0' } ).removeClass( 'qodef-drop-down--start' );
}
};
$thisItem.hoverIntent( config );
}
}
}
);
}
}
);
},
wideDropdownPosition: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li.qodef-menu-item--wide' );
if ( $menuItems.length ) {
$menuItems.each(
function () {
var $menuItem = $( this );
var $menuItemSubMenu = $menuItem.find( '.qodef-drop-down-second' );
if ( $menuItemSubMenu.length ) {
$menuItemSubMenu.css( 'left', 0 );
var leftPosition = $menuItemSubMenu.offset().left;
if ( qodefCore.body.hasClass( 'qodef--boxed' ) ) {
//boxed layout case
var boxedWidth = $( '.qodef--boxed #qodef-page-wrapper' ).outerWidth();
leftPosition = leftPosition - (qodefCore.windowWidth - boxedWidth) / 2;
$menuItemSubMenu.css( { 'left': -leftPosition, 'width': boxedWidth } );
} else if ( qodefCore.body.hasClass( 'qodef-drop-down-second--full-width' ) ) {
//wide dropdown full width case
$menuItemSubMenu.css( { 'left': -leftPosition, 'width': qodefCore.windowWidth } );
} else {
//wide dropdown in grid case
$menuItemSubMenu.css( { 'left': -leftPosition + (qodefCore.windowWidth - $menuItemSubMenu.width()) / 2 } );
}
}
}
);
}
},
dropdownPosition: function () {
var $menuItems = $( '.qodef-header-navigation > ul > li.qodef-menu-item--narrow.menu-item-has-children' );
if ( $menuItems.length ) {
$menuItems.each(
function () {
var $thisItem = $( this ),
menuItemPosition = $thisItem.offset().left,
$dropdownHolder = $thisItem.find( '.qodef-drop-down-second' ),
$dropdownMenuItem = $dropdownHolder.find( '.qodef-drop-down-second-inner ul' ),
dropdownMenuWidth = $dropdownMenuItem.outerWidth(),
menuItemFromLeft = $( window ).width() - menuItemPosition;
if ( qodef.body.hasClass( 'qodef--boxed' ) ) {
//boxed layout case
var boxedWidth = $( '.qodef--boxed #qodef-page-wrapper' ).outerWidth();
menuItemFromLeft = boxedWidth - menuItemPosition;
}
var dropDownMenuFromLeft;
if ( $thisItem.find( 'li.menu-item-has-children' ).length > 0 ) {
dropDownMenuFromLeft = menuItemFromLeft - dropdownMenuWidth;
}
$dropdownHolder.removeClass( 'qodef-drop-down--right' );
$dropdownMenuItem.removeClass( 'qodef-drop-down--right' );
if ( menuItemFromLeft < dropdownMenuWidth || dropDownMenuFromLeft < dropdownMenuWidth ) {
$dropdownHolder.addClass( 'qodef-drop-down--right' );
$dropdownMenuItem.addClass( 'qodef-drop-down--right' );
}
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefParallaxBackground.init();
}
);
/**
* Init global parallax background functionality
*/
var qodefParallaxBackground = {
init: function ( settings ) {
this.$sections = $( '.qodef-parallax' );
// Allow overriding the default config
$.extend( this.$sections, settings );
var isSupported = ! qodefCore.html.hasClass( 'touchevents' ) && ! qodefCore.body.hasClass( 'qodef-browser--edge' ) && ! qodefCore.body.hasClass( 'qodef-browser--ms-explorer' );
if ( this.$sections.length && isSupported ) {
this.$sections.each(
function () {
qodefParallaxBackground.ready( $( this ) );
}
);
}
},
ready: function ( $section ) {
$section.$imgHolder = $section.find( '.qodef-parallax-img-holder' );
$section.$imgWrapper = $section.find( '.qodef-parallax-img-wrapper' );
$section.$img = $section.find( 'img.qodef-parallax-img' );
var h = $section.height(),
imgWrapperH = $section.$imgWrapper.height();
$section.movement = 100 * (imgWrapperH - h) / h / 2; //percentage (divided by 2 due to absolute img centering in CSS)
$section.buffer = window.pageYOffset;
$section.scrollBuffer = null;
//calc and init loop
requestAnimationFrame(
function () {
$section.$imgHolder.animate( { opacity: 1 }, 100 );
qodefParallaxBackground.calc( $section );
qodefParallaxBackground.loop( $section );
}
);
//recalc
$( window ).on(
'resize',
function () {
qodefParallaxBackground.calc( $section );
}
);
},
calc: function ( $section ) {
var wH = $section.$imgWrapper.height(),
wW = $section.$imgWrapper.width();
if ( $section.$img.width() < wW ) {
$section.$img.css(
{
'width': '100%',
'height': 'auto',
}
);
}
if ( $section.$img.height() < wH ) {
$section.$img.css(
{
'height': '100%',
'width': 'auto',
'max-width': 'unset',
}
);
}
},
loop: function ( $section ) {
if ( $section.scrollBuffer === Math.round( window.pageYOffset ) ) {
requestAnimationFrame(
function () {
qodefParallaxBackground.loop( $section );
}
); //repeat loop
return false; //same scroll value, do nothing
} else {
$section.scrollBuffer = Math.round( window.pageYOffset );
}
var wH = window.outerHeight,
sTop = $section.offset().top,
sH = $section.height();
if ( $section.scrollBuffer + wH * 1.2 > sTop && $section.scrollBuffer < sTop + sH ) {
var delta = (Math.abs( $section.scrollBuffer + wH - sTop ) / (wH + sH)).toFixed( 4 ), //coeff between 0 and 1 based on scroll amount
yVal = (delta * $section.movement).toFixed( 4 );
if ( $section.buffer !== delta ) {
$section.$imgWrapper.css( 'transform', 'translate3d(0,' + yVal + '%, 0)' );
}
$section.buffer = delta;
}
requestAnimationFrame(
function () {
qodefParallaxBackground.loop( $section );
}
); //repeat loop
}
};
qodefCore.qodefParallaxBackground = qodefParallaxBackground;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefReview.init();
}
);
var qodefReview = {
init: function () {
var ratingHolder = $( '#qodef-page-comments-form .qodef-rating-inner' );
var addActive = function ( stars, ratingValue ) {
for ( var i = 0; i < stars.length; i++ ) {
var star = stars[i];
if ( i < ratingValue ) {
$( star ).addClass( 'active' );
} else {
$( star ).removeClass( 'active' );
}
}
};
ratingHolder.each(
function () {
var thisHolder = $( this ),
ratingInput = thisHolder.find( '.qodef-rating' ),
ratingValue = ratingInput.val(),
stars = thisHolder.find( '.qodef-star-rating' );
addActive( stars, ratingValue );
stars.on(
'click',
function () {
ratingInput.val( $( this ).data( 'value' ) ).trigger( 'change' );
}
);
ratingInput.change(
function () {
ratingValue = ratingInput.val();
addActive( stars, ratingValue );
}
);
}
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSideArea.init();
}
);
var qodefSideArea = {
init: function () {
var $sideAreaOpener = $( 'a.qodef-side-area-opener' ),
$sideAreaClose = $( '#qodef-side-area-close' ),
$sideArea = $( '#qodef-side-area' );
qodefSideArea.openerHoverColor( $sideAreaOpener );
// Open Side Area
$sideAreaOpener.on(
'click',
function ( e ) {
e.preventDefault();
if ( ! qodefCore.body.hasClass( 'qodef-side-area--opened' ) ) {
qodefSideArea.openSideArea();
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) {
qodefSideArea.closeSideArea();
}
}
);
} else {
qodefSideArea.closeSideArea();
}
}
);
$sideAreaClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSideArea.closeSideArea();
}
);
if ( $sideArea.length && typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
qodefCore.qodefPerfectScrollbar.init( $sideArea );
}
},
openSideArea: function () {
var $wrapper = $( '#qodef-page-wrapper' );
var currentScroll = $( window ).scrollTop();
$( '.qodef-side-area-cover' ).remove();
$wrapper.prepend( '<div class="qodef-side-area-cover"/>' );
qodefCore.body.removeClass( 'qodef-side-area-animate--out' ).addClass( 'qodef-side-area--opened qodef-side-area-animate--in' );
$( '.qodef-side-area-cover' ).on(
'click',
function ( e ) {
e.preventDefault();
qodefSideArea.closeSideArea();
}
);
$( window ).scroll(
function () {
if ( Math.abs( qodefCore.scroll - currentScroll ) > 400 ) {
qodefSideArea.closeSideArea();
}
}
);
},
closeSideArea: function () {
qodefCore.body.removeClass( 'qodef-side-area--opened qodef-side-area-animate--in' ).addClass( 'qodef-side-area-animate--out' );
},
openerHoverColor: function ( $opener ) {
if ( typeof $opener.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $opener.data( 'hover-color' );
var originalColor = $opener.css( 'color' );
$opener.on(
'mouseenter',
function () {
$opener.css( 'color', hoverColor );
}
).on(
'mouseleave',
function () {
$opener.css( 'color', originalColor );
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSpinner.init();
}
);
$( window ).on(
'elementor/frontend/init',
function () {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefSpinner.init( isEditMode );
}
}
);
var qodefSpinner = {
init: function ( isEditMode ) {
this.holder = $( '#qodef-page-spinner:not(.qodef-layout--drew)' );
if ( this.holder.length ) {
qodefSpinner.animateSpinner( this.holder, isEditMode );
qodefSpinner.fadeOutAnimation();
}
},
animateSpinner: function ( $holder, isEditMode ) {
$( window ).on(
'load',
function () {
qodefSpinner.fadeOutLoader( $holder );
}
);
if ( isEditMode ) {
qodefSpinner.fadeOutLoader( $holder );
}
},
fadeOutLoader: function ( $holder, speed, delay, easing ) {
speed = speed ? speed : 600;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
$holder.delay( delay ).fadeOut( speed, easing );
$( window ).on(
'bind',
'pageshow',
function ( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut( speed, easing );
}
}
);
},
fadeOutAnimation: function () {
// Check for fade out animation
if ( qodefCore.body.hasClass( 'qodef-spinner--fade-out' ) ) {
var $pageHolder = $( '#qodef-page-wrapper' ),
$linkItems = $( 'a' );
// If back button is pressed, than show content to avoid state where content is on display:none
window.addEventListener(
'pageshow',
function ( event ) {
var historyPath = event.persisted || (typeof window.performance !== 'undefined' && window.performance.navigation.type === 2);
if ( historyPath && ! $pageHolder.is( ':visible' ) ) {
$pageHolder.show();
}
}
);
$linkItems.on(
'click',
function ( e ) {
var $clickedLink = $( this );
if (
e.which === 1 && // check if the left mouse button has been pressed
$clickedLink.attr( 'href' ).indexOf( window.location.host ) >= 0 && // check if the link is to the same domain
! $clickedLink.hasClass( 'remove' ) && // check is WooCommerce remove link
$clickedLink.parent( '.product-remove' ).length <= 0 && // check is WooCommerce remove link
$clickedLink.parents( '.woocommerce-product-gallery__image' ).length <= 0 && // check is product gallery link
typeof $clickedLink.data( 'rel' ) === 'undefined' && // check pretty photo link
typeof $clickedLink.attr( 'rel' ) === 'undefined' && // check VC pretty photo link
! $clickedLink.hasClass( 'lightbox-active' ) && // check is lightbox plugin active
(typeof $clickedLink.attr( 'target' ) === 'undefined' || $clickedLink.attr( 'target' ) === '_self') && // check if the link opens in the same window
$clickedLink.attr( 'href' ).split( '#' )[0] !== window.location.href.split( '#' )[0] // check if it is an anchor aiming for a different page
) {
e.preventDefault();
$pageHolder.fadeOut(
600,
'easeOutSine',
function () {
window.location = $clickedLink.attr( 'href' );
}
);
}
}
);
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefSubscribeModal.init();
}
);
var qodefSubscribeModal = {
init: function () {
this.holder = $( '#qodef-subscribe-popup-modal' );
if ( this.holder.length ) {
var $preventHolder = this.holder.find( '.qodef-sp-prevent' ),
$modalClose = $( '.qodef-sp-close' ),
disabledPopup = 'no';
if ( $preventHolder.length ) {
var isLocalStorage = this.holder.hasClass( 'qodef-sp-prevent-cookies' ),
$preventInput = $preventHolder.find( '.qodef-sp-prevent-input' ),
preventValue = $preventInput.data( 'value' );
if ( isLocalStorage ) {
disabledPopup = localStorage.getItem( 'disabledPopup' );
sessionStorage.removeItem( 'disabledPopup' );
} else {
disabledPopup = sessionStorage.getItem( 'disabledPopup' );
localStorage.removeItem( 'disabledPopup' );
}
$preventHolder.children().on(
'click',
function ( e ) {
if ( preventValue !== 'yes' ) {
preventValue = 'yes';
$preventInput.addClass( 'qodef-sp-prevent-clicked' ).data( 'value', 'yes' );
} else {
preventValue = 'no';
$preventInput.removeClass( 'qodef-sp-prevent-clicked' ).data( 'value', 'no' );
}
if ( preventValue === 'yes' ) {
if ( isLocalStorage ) {
localStorage.setItem( 'disabledPopup', 'yes' );
} else {
sessionStorage.setItem( 'disabledPopup', 'yes' );
}
} else {
if ( isLocalStorage ) {
localStorage.setItem( 'disabledPopup', 'no' );
} else {
sessionStorage.setItem( 'disabledPopup', 'no' );
}
}
}
);
}
if ( disabledPopup !== 'yes' ) {
if ( qodefCore.body.hasClass( 'qodef-sp-opened' ) ) {
qodefSubscribeModal.handleClassAndScroll( 'remove' );
} else {
qodefSubscribeModal.handleClassAndScroll( 'add' );
}
$modalClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSubscribeModal.handleClassAndScroll( 'remove' );
}
);
// Close on escape
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 ) { // KeyCode for ESC button is 27
qodefSubscribeModal.handleClassAndScroll( 'remove' );
}
}
);
}
}
},
handleClassAndScroll: function ( option ) {
if ( option === 'remove' ) {
qodefCore.body.removeClass( 'qodef-sp-opened' );
qodefCore.qodefScroll.enable();
}
if ( option === 'add' ) {
qodefCore.body.addClass( 'qodef-sp-opened' );
qodefCore.qodefScroll.disable();
}
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefWishlist.init();
}
);
/**
* Function object that represents wishlist area popup.
* @returns {{init: Function}}
*/
var qodefWishlist = {
init: function () {
var $wishlistLink = $( '.qodef-wishlist .qodef-m-link' );
if ( $wishlistLink.length ) {
$wishlistLink.each(
function () {
var $thisWishlistLink = $( this ),
wishlistIconHTML = $thisWishlistLink.html(),
$responseMessage = $thisWishlistLink.siblings( '.qodef-m-response' );
$thisWishlistLink.off().on(
'click',
function ( e ) {
e.preventDefault();
if ( qodefCore.body.hasClass( 'logged-in' ) ) {
var itemID = $thisWishlistLink.data( 'id' );
if ( itemID !== 'undefined' && ! $thisWishlistLink.hasClass( 'qodef--added' ) ) {
$thisWishlistLink.html( '<span class="fa fa-spinner fa-spin" aria-hidden="true"></span>' );
var wishlistData = {
type: 'add',
itemID: itemID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
$thisWishlistLink.addClass( 'qodef--added' );
$responseMessage.html( response.message ).addClass( 'qodef--show' ).fadeIn( 200 );
$( document ).trigger(
'drew_core_wishlist_item_is_added',
[itemID, response.data.user_id]
);
} else {
$responseMessage.html( response.message ).addClass( 'qodef--show' ).fadeIn( 200 );
}
setTimeout(
function () {
$thisWishlistLink.html( wishlistIconHTML );
var $wishlistTitle = $thisWishlistLink.find( '.qodef-m-link-label' );
if ( $wishlistTitle.length ) {
$wishlistTitle.text( $wishlistTitle.data( 'added-title' ) );
}
$responseMessage.fadeOut( 300 ).removeClass( 'qodef--show' ).empty();
},
800
);
}
}
);
}
} else {
// Trigger event.
$( document.body ).trigger( 'drew_membership_trigger_login_modal' );
}
}
);
}
);
}
}
};
$( document ).on(
'drew_core_wishlist_item_is_removed',
function ( e, removedItemID ) {
var $wishlistLink = $( '.qodef-wishlist .qodef-m-link' );
if ( $wishlistLink.length ) {
$wishlistLink.each(
function () {
var $thisWishlistLink = $( this ),
$wishlistTitle = $thisWishlistLink.find( '.qodef-m-link-label' );
if ( $thisWishlistLink.data( 'id' ) === removedItemID && $thisWishlistLink.hasClass( 'qodef--added' ) ) {
$thisWishlistLink.removeClass( 'qodef--added' );
if ( $wishlistTitle.length ) {
$wishlistTitle.text( $wishlistTitle.data( 'title' ) );
}
}
}
);
}
}
);
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefAuthorListPagination.init();
}
);
$( window ).scroll(
function () {
qodefAuthorListPagination.scroll();
}
);
$( document ).on(
'drew_core_trigger_author_load_more',
function ( e, $holder, nextPage ) {
qodefAuthorListPagination.triggerLoadMore( $holder, nextPage );
}
);
/*
** Init pagination functionality
*/
var qodefAuthorListPagination = {
init: function ( settings ) {
this.holder = $( '.qodef-author-pagination--on' );
// Allow overriding the default config
$.extend( this.holder, settings );
if ( this.holder.length ) {
this.holder.each(
function () {
var $holder = $( this );
qodefAuthorListPagination.initPaginationType( $holder );
}
);
}
},
scroll: function ( settings ) {
this.holder = $( '.qodef-author-pagination--on' );
// Allow overriding the default config
$.extend( this.holder, settings );
if ( this.holder.length ) {
this.holder.each(
function () {
var $holder = $( this );
if ( $holder.hasClass( 'qodef-pagination-type--infinite-scroll' ) ) {
qodefAuthorListPagination.initInfiniteScroll( $holder );
}
}
);
}
},
initPaginationType: function ( $holder ) {
if ( $holder.hasClass( 'qodef-pagination-type--standard' ) ) {
qodefAuthorListPagination.initStandard( $holder );
} else if ( $holder.hasClass( 'qodef-pagination-type--load-more' ) ) {
qodefAuthorListPagination.initLoadMore( $holder );
} else if ( $holder.hasClass( 'qodef-pagination-type--infinite-scroll' ) ) {
qodefAuthorListPagination.initInfiniteScroll( $holder );
}
},
initStandard: function ( $holder ) {
var $paginationItems = $holder.find( '.qodef-m-pagination-items' );
if ( $paginationItems.length ) {
var options = $holder.data( 'options' );
$paginationItems.children().each( function () {
var $thisItem = $( this ),
$itemLink = $thisItem.children( 'a' );
qodefAuthorListPagination.changeStandardState( $holder, options.max_num_pages, 1 );
$itemLink.on(
'click',
function ( e ) {
e.preventDefault();
if ( ! $thisItem.hasClass( 'qodef--active' ) ) {
qodefAuthorListPagination.getNewPosts( $holder, $itemLink.data( 'paged' ) );
}
}
);
} );
}
},
changeStandardState: function ( $holder, max_num_pages, nextPage ) {
if ( $holder.hasClass( 'qodef-pagination-type--standard' ) ) {
var $paginationNav = $holder.find( '.qodef-m-pagination-items' ),
$numericItem = $paginationNav.children( '.qodef--number' ),
$prevItem = $paginationNav.children( '.qodef--prev' ),
$nextItem = $paginationNav.children( '.qodef--next' );
$numericItem.removeClass( 'qodef--active' ).eq( nextPage - 1 ).addClass( 'qodef--active' );
$prevItem.children().data( 'paged', nextPage - 1 );
if ( nextPage > 1 ) {
$prevItem.show();
} else {
$prevItem.hide();
}
$nextItem.children().data( 'paged', nextPage + 1 );
if ( nextPage === max_num_pages ) {
$nextItem.hide();
} else {
$nextItem.show();
}
}
},
initLoadMore: function ( $holder ) {
var $loadMoreButton = $holder.find( '.qodef-load-more-button' );
$loadMoreButton.on(
'click',
function ( e ) {
e.preventDefault();
qodefAuthorListPagination.getNewPosts( $holder );
}
);
},
triggerLoadMore: function ( $holder, nextPage ) {
qodefAuthorListPagination.getNewPosts( $holder, nextPage );
},
hideLoadMoreButton: function ( $holder, options ) {
if ( $holder.hasClass( 'qodef-pagination-type--load-more' ) && options.next_page > options.max_num_pages ) {
$holder.find( '.qodef-load-more-button' ).hide();
}
},
initInfiniteScroll: function ( $holder ) {
var holderEndPosition = $holder.outerHeight() + $holder.offset().top,
scrollPosition = qodefCore.scroll + qodefCore.windowHeight,
options = $holder.data( 'options' );
if ( ! $holder.hasClass( 'qodef--loading' ) && scrollPosition > holderEndPosition && options.max_num_pages >= options.next_page ) {
qodefAuthorListPagination.getNewPosts( $holder );
}
},
getNewPosts: function ( $holder, nextPage ) {
$holder.addClass( 'qodef--loading' );
var $itemsHolder = $holder.children( '.qodef-grid-inner' );
var options = $holder.data( 'options' );
qodefAuthorListPagination.setNextPageValue( options, nextPage, false );
$.ajax(
{
type: 'GET',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.authorPaginationRestRoute,
data: {
options: options,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
qodefAuthorListPagination.setNextPageValue( options, nextPage, true );
qodefAuthorListPagination.changeStandardState( $holder, options.max_num_pages, nextPage );
$itemsHolder.waitForImages(
function () {
qodefAuthorListPagination.addPosts( $itemsHolder, response.data, nextPage );
qodefCore.body.trigger(
'drew_core_trigger_get_new_authors',
[$holder]
);
}
);
qodefAuthorListPagination.hideLoadMoreButton( $holder, options );
} else {
console.log( response.message );
}
},
complete: function () {
$holder.removeClass( 'qodef--loading' );
}
}
);
},
setNextPageValue: function ( options, nextPage, ajaxTrigger ) {
if ( typeof nextPage !== 'undefined' && nextPage !== '' && ! ajaxTrigger ) {
options.next_page = nextPage;
} else if ( ajaxTrigger ) {
options.next_page = parseInt( options.next_page, 10 ) + 1;
}
},
addPosts: function ( $itemsHolder, newItems, nextPage ) {
if ( typeof nextPage !== 'undefined' && nextPage !== '' ) {
$itemsHolder.html( newItems );
} else {
$itemsHolder.append( newItems );
}
}
};
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_button = {};
$( document ).ready(
function () {
qodefButton.init();
}
);
var qodefButton = {
init: function () {
this.buttons = $( '.qodef-button' );
if ( this.buttons.length ) {
this.buttons.each(
function () {
qodefButton.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
qodefButton.buttonHoverColor( $currentItem );
qodefButton.buttonHoverBgColor( $currentItem );
qodefButton.buttonHoverBorderColor( $currentItem );
},
buttonHoverColor: function ( $button ) {
if ( typeof $button.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $button.data( 'hover-color' );
var originalColor = $button.css( 'color' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'color', hoverColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'color', originalColor );
}
);
}
},
buttonHoverBgColor: function ( $button ) {
if ( typeof $button.data( 'hover-background-color' ) !== 'undefined' ) {
var hoverBackgroundColor = $button.data( 'hover-background-color' );
var originalBackgroundColor = $button.css( 'background-color' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'background-color', hoverBackgroundColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'background-color', originalBackgroundColor );
}
);
}
},
buttonHoverBorderColor: function ( $button ) {
if ( typeof $button.data( 'hover-border-color' ) !== 'undefined' ) {
var hoverBorderColor = $button.data( 'hover-border-color' );
var originalBorderColor = $button.css( 'borderTopColor' );
$button.on(
'mouseenter touchstart',
function () {
qodefButton.changeColor( $button, 'border-color', hoverBorderColor );
}
);
$button.on(
'mouseleave touchend',
function () {
qodefButton.changeColor( $button, 'border-color', originalBorderColor );
}
);
}
},
changeColor: function ( $button, cssProperty, color ) {
$button.css( cssProperty, color );
}
};
qodefCore.shortcodes.drew_core_button.qodefButton = qodefButton;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_countdown = {};
$( document ).ready(
function () {
qodefCountdown.init();
}
);
var qodefCountdown = {
init: function () {
this.countdowns = $( '.qodef-countdown' );
if ( this.countdowns.length ) {
this.countdowns.each(
function () {
qodefCountdown.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $countdownElement = $currentItem.find( '.qodef-m-date' ),
options = qodefCountdown.generateOptions( $currentItem );
qodefCountdown.initCountdown( $countdownElement, options );
},
generateOptions: function ( $countdown ) {
var options = {};
options.date = typeof $countdown.data( 'date' ) !== 'undefined' ? $countdown.data( 'date' ) : null;
options.dayLabel = typeof $countdown.data( 'day-label' ) !== 'undefined' ? $countdown.data( 'day-label' ) : '';
options.dayLabelPlural = typeof $countdown.data( 'day-label-plural' ) !== 'undefined' ? $countdown.data( 'day-label-plural' ) : '';
options.hourLabel = typeof $countdown.data( 'hour-label' ) !== 'undefined' ? $countdown.data( 'hour-label' ) : '';
options.hourLabelPlural = typeof $countdown.data( 'hour-label-plural' ) !== 'undefined' ? $countdown.data( 'hour-label-plural' ) : '';
options.minuteLabel = typeof $countdown.data( 'minute-label' ) !== 'undefined' ? $countdown.data( 'minute-label' ) : '';
options.minuteLabelPlural = typeof $countdown.data( 'minute-label-plural' ) !== 'undefined' ? $countdown.data( 'minute-label-plural' ) : '';
options.secondLabel = typeof $countdown.data( 'second-label' ) !== 'undefined' ? $countdown.data( 'second-label' ) : '';
options.secondLabelPlural = typeof $countdown.data( 'second-label-plural' ) !== 'undefined' ? $countdown.data( 'second-label-plural' ) : '';
return options;
},
initCountdown: function ( $countdownElement, options ) {
var $dayHTML = '<span class="qodef-digit-wrapper"><span class="qodef-digit">%D</span><span class="qodef-label">' + '%!D:' + options.dayLabel + ',' + options.dayLabelPlural + ';</span></span>';
var $hourHTML = '<span class="qodef-digit-wrapper"><span class="qodef-digit">%H</span><span class="qodef-label">' + '%!H:' + options.hourLabel + ',' + options.hourLabelPlural + ';</span></span>';
var $minuteHTML = '<span class="qodef-digit-wrapper"><span class="qodef-digit">%M</span><span class="qodef-label">' + '%!M:' + options.minuteLabel + ',' + options.minuteLabelPlural + ';</span></span>';
var $secondHTML = '<span class="qodef-digit-wrapper"><span class="qodef-digit">%S</span><span class="qodef-label">' + '%!S:' + options.secondLabel + ',' + options.secondLabelPlural + ';</span></span>';
$countdownElement.countdown(
options.date,
function ( event ) {
$( this ).html( event.strftime( $dayHTML + $hourHTML + $minuteHTML + $secondHTML ) );
}
);
}
};
qodefCore.shortcodes.drew_core_countdown.qodefCountdown = qodefCountdown;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_counter = {};
$( document ).ready(
function () {
qodefCounter.init();
}
);
var qodefCounter = {
init: function () {
this.counters = $( '.qodef-counter' );
if ( this.counters.length ) {
this.counters.each(
function () {
qodefCounter.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var $counterElement = $currentItem.find( '.qodef-m-digit' ),
options = qodefCounter.generateOptions( $currentItem );
qodefCounter.counterScript( $counterElement, options );
},
generateOptions: function ( $counter ) {
var options = {};
options.start = typeof $counter.data( 'start-digit' ) !== 'undefined' && $counter.data( 'start-digit' ) !== '' ? $counter.data( 'start-digit' ) : 0;
options.end = typeof $counter.data( 'end-digit' ) !== 'undefined' && $counter.data( 'end-digit' ) !== '' ? $counter.data( 'end-digit' ) : null;
options.step = typeof $counter.data( 'step-digit' ) !== 'undefined' && $counter.data( 'step-digit' ) !== '' ? $counter.data( 'step-digit' ) : 1;
options.delay = typeof $counter.data( 'step-delay' ) !== 'undefined' && $counter.data( 'step-delay' ) !== '' ? parseInt( $counter.data( 'step-delay' ), 10 ) : 100;
options.txt = typeof $counter.data( 'digit-label' ) !== 'undefined' && $counter.data( 'digit-label' ) !== '' ? $counter.data( 'digit-label' ) : '';
return options;
},
counterScript: function ( $counterElement, options ) {
var defaults = {
start: 0,
end: null,
step: 1,
delay: 50,
txt: '',
};
var settings = $.extend( defaults, options || {} );
var nb_start = settings.start;
var nb_end = settings.end;
$counterElement.text( nb_start + settings.txt );
var counter = function () {
// Definition of conditions of arrest
if ( nb_end !== null && nb_start >= nb_end ) {
return;
}
// incrementation
nb_start = nb_start + settings.step;
if ( nb_start >= nb_end ) {
nb_start = nb_end;
}
// display
$counterElement.text( nb_start + settings.txt );
};
// Timer
// Launches every "settings.delay"
$counterElement.appear(
function () {
setInterval( counter, settings.delay );
},
{ accX: 0, accY: 0 }
);
}
};
qodefCore.shortcodes.drew_core_counter.qodefCounter = qodefCounter;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_google_map = {};
$( document ).ready(
function () {
qodefGoogleMap.init();
}
);
var qodefGoogleMap = {
init: function () {
this.holder = $( '.qodef-google-map' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefGoogleMap.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
if ( typeof window.qodefGoogleMap !== 'undefined' ) {
window.qodefGoogleMap.init( $currentItem.find( '.qodef-m-map' ) );
}
},
};
qodefCore.shortcodes.drew_core_google_map.qodefGoogleMap = qodefGoogleMap;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_icon = {};
$( document ).ready(
function () {
qodefIcon.init();
}
);
var qodefIcon = {
init: function () {
this.icons = $( '.qodef-icon-holder' );
if ( this.icons.length ) {
this.icons.each(
function () {
qodefIcon.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
qodefIcon.iconHoverColor( $currentItem );
qodefIcon.iconHoverBgColor( $currentItem );
qodefIcon.iconHoverBorderColor( $currentItem );
},
iconHoverColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-color' ) !== 'undefined' ) {
var spanHolder = $iconHolder.find( 'span' ).length ? $iconHolder.find( 'span' ) : $iconHolder;
var originalColor = spanHolder.css( 'color' );
var hoverColor = $iconHolder.data( 'hover-color' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
spanHolder,
'color',
hoverColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
spanHolder,
'color',
originalColor
);
}
);
}
},
iconHoverBgColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-background-color' ) !== 'undefined' ) {
var hoverBackgroundColor = $iconHolder.data( 'hover-background-color' );
var originalBackgroundColor = $iconHolder.css( 'background-color' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
$iconHolder,
'background-color',
hoverBackgroundColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
$iconHolder,
'background-color',
originalBackgroundColor
);
}
);
}
},
iconHoverBorderColor: function ( $iconHolder ) {
if ( typeof $iconHolder.data( 'hover-border-color' ) !== 'undefined' ) {
var hoverBorderColor = $iconHolder.data( 'hover-border-color' );
var originalBorderColor = $iconHolder.css( 'borderTopColor' );
$iconHolder.on(
'mouseenter',
function () {
qodefIcon.changeColor(
$iconHolder,
'border-color',
hoverBorderColor
);
}
);
$iconHolder.on(
'mouseleave',
function () {
qodefIcon.changeColor(
$iconHolder,
'border-color',
originalBorderColor
);
}
);
}
},
changeColor: function ( iconElement, cssProperty, color ) {
iconElement.css(
cssProperty,
color
);
}
};
qodefCore.shortcodes.drew_core_icon.qodefIcon = qodefIcon;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_image_gallery = {};
qodefCore.shortcodes.drew_core_image_gallery.qodefSwiper = qodef.qodefSwiper;
qodefCore.shortcodes.drew_core_image_gallery.qodefMasonryLayout = qodef.qodefMasonryLayout;
qodefCore.shortcodes.drew_core_image_gallery.qodefMagnificPopup = qodef.qodefMagnificPopup;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_image_showcase = {};
qodefCore.shortcodes.drew_core_image_showcase.qodefSwiper = qodef.qodefSwiper;
$( document ).ready(
function () {
qodefImageShowcase.init();
}
);
$( window ).resize(
function () {
qodefImageShowcase.init();
}
);
var qodefImageShowcase = {
init: function () {
var $holder = $( '.qodef-image-showcase.qodef-predefined-layout--dynamic-fullscreen' ),
$content = $( '#qodef-page-outer' ),
contentTopOffset = $content.length ? $content.offset().top : 0,
$title = $( '.qodef-page-title' ),
titleHeight = $title.length ? $title.outerHeight() : 0;
if ( $holder.length ) {
$holder.each( function () {
var $currentHolder = $( this );
$currentHolder.height( qodef.windowHeight - contentTopOffset - titleHeight );
} );
}
},
};
qodefCore.shortcodes.drew_core_image_showcase.qodefImageShowcase = qodefImageShowcase;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_image_with_text = {};
qodefCore.shortcodes.drew_core_image_with_text.qodefMagnificPopup = qodef.qodefMagnificPopup;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_progress_bar = {};
$( document ).ready(
function () {
qodefProgressBar.init();
}
);
/**
* Init progress bar shortcode functionality
*/
var qodefProgressBar = {
init: function () {
this.holder = $( '.qodef-progress-bar' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefProgressBar.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
var layout = $currentItem.data( 'layout' );
$currentItem.appear(
function () {
$currentItem.addClass( 'qodef--init' );
var $container = $currentItem.find( '.qodef-m-canvas' ),
data = qodefProgressBar.generateBarData( $currentItem, layout ),
number = $currentItem.data( 'number' ) / 100;
switch (layout) {
case 'circle':
qodefProgressBar.initCircleBar( $container, data, number );
break;
case 'semi-circle':
qodefProgressBar.initSemiCircleBar( $container, data, number );
break;
case 'line':
data = qodefProgressBar.generateLineData( $currentItem, number );
qodefProgressBar.initLineBar( $container, data );
break;
case 'custom':
qodefProgressBar.initCustomBar( $container, data, number );
break;
}
}
);
},
generateBarData: function ( thisBar, layout ) {
var activeWidth = thisBar.data( 'active-line-width' );
var activeColor = thisBar.data( 'active-line-color' );
var inactiveWidth = thisBar.data( 'inactive-line-width' );
var inactiveColor = thisBar.data( 'inactive-line-color' );
var easing = 'linear';
var duration = typeof thisBar.data( 'duration' ) !== 'undefined' && thisBar.data( 'duration' ) !== '' ? parseInt( thisBar.data( 'duration' ), 10 ) : 1600;
var textColor = thisBar.data( 'text-color' );
return {
strokeWidth: activeWidth,
color: activeColor,
trailWidth: inactiveWidth,
trailColor: inactiveColor,
easing: easing,
duration: duration,
svgStyle: {
width: '100%',
height: '100%'
},
text: {
style: {
color: textColor
},
autoStyleContainer: false
},
from: {
color: inactiveColor
},
to: {
color: activeColor
},
step: function ( state, bar ) {
if ( layout !== 'custom' ) {
bar.setText( Math.round( bar.value() * 100 ) + '%' );
}
},
};
},
generateLineData: function ( thisBar, number ) {
var height = thisBar.data( 'active-line-width' );
var activeColor = thisBar.data( 'active-line-color' );
var inactiveHeight = thisBar.data( 'inactive-line-width' );
var inactiveColor = thisBar.data( 'inactive-line-color' );
var duration = typeof thisBar.data( 'duration' ) !== 'undefined' && thisBar.data( 'duration' ) !== '' ? parseInt( thisBar.data( 'duration' ), 10 ) : 1600;
var textColor = thisBar.data( 'text-color' );
return {
percentage: number * 100,
duration: duration,
fillBackgroundColor: activeColor,
backgroundColor: inactiveColor,
height: height,
inactiveHeight: inactiveHeight,
followText: thisBar.hasClass( 'qodef-percentage--floating' ),
textColor: textColor,
};
},
initCircleBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.Circle( $container[0], data );
$bar.animate( number );
}
},
initSemiCircleBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.SemiCircle( $container[0], data );
$bar.animate( number );
}
},
initCustomBar: function ( $container, data, number ) {
if ( qodefProgressBar.checkBar( $container ) ) {
var $bar = new ProgressBar.Path( $container[0], data );
$bar.set( 0 );
$bar.animate( number );
}
},
initLineBar: function ( $container, data ) {
$container
.LineProgressbar(data)
.find('.percentCount').css({
'color': data.textColor
});
},
checkBar: function ( $container ) {
// check if svg is already in container, elementor fix
if ( $container.find( 'svg' ).length ) {
return false;
}
return true;
}
};
qodefCore.shortcodes.drew_core_progress_bar.qodefProgressBar = qodefProgressBar;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_single_image = {};
qodefCore.shortcodes.drew_core_single_image.qodefMagnificPopup = qodef.qodefMagnificPopup;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_tabs = {};
$( document ).ready(
function () {
qodefTabs.init();
}
);
var qodefTabs = {
init: function () {
this.holder = $( '.qodef-tabs' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefTabs.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
$currentItem.children( '.qodef-tabs-content' ).each(
function ( index ) {
index = index + 1;
var $that = $( this ),
link = $that.attr( 'id' ),
$navItem = $that.parent().find( '.qodef-tabs-navigation li:nth-child(' + index + ') a' ),
navLink = $navItem.attr( 'href' );
link = '#' + link;
if ( link.indexOf( navLink ) > -1 ) {
$navItem.attr(
'href',
link
);
}
}
);
$currentItem.addClass( 'qodef--init' ).tabs();
}
};
qodefCore.shortcodes.drew_core_tabs.qodefTabs = qodefTabs;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_vertical_split_slider = {};
$( document ).ready(
function () {
qodefVerticalSplitSlider.init();
}
);
var qodefVerticalSplitSlider = {
init: function () {
var $holder = $( '.qodef-vertical-split-slider' ),
$headerInner = $( '#qodef-page-header-inner' ),
breakpoint = qodefVerticalSplitSlider.getBreakpoint( $holder ),
initialHeaderStyle = '';
if ( $headerInner.hasClass( 'qodef-skin--light' ) ) {
initialHeaderStyle = 'light';
} else if ( $headerInner.hasClass( 'qodef-skin--dark' ) ) {
initialHeaderStyle = 'dark';
}
if ( $holder.length ) {
$holder.multiscroll(
{
navigation: true,
navigationPosition: 'right',
afterRender: function () {
qodefCore.body.addClass( 'qodef-vertical-split-slider--initialized' );
qodefVerticalSplitSlider.headerClassHandler( $( '.ms-left .ms-section:first-child' ).data( 'header-skin' ), initialHeaderStyle, $headerInner );
},
onLeave: function ( index, nextIndex ) {
qodefVerticalSplitSlider.headerClassHandler( $( $( '.ms-left .ms-section' )[nextIndex - 1] ).data( 'header-skin' ), initialHeaderStyle, $headerInner );
},
}
);
$holder.height( qodefCore.windowHeight );
qodefVerticalSplitSlider.buildAndDestroy( breakpoint );
$( window ).resize(
function () {
qodefVerticalSplitSlider.buildAndDestroy( breakpoint );
}
);
}
},
getBreakpoint: function ( $holder ) {
if ( $holder.hasClass( 'qodef-disable-below--768' ) ) {
return 768;
} else {
return 1024;
}
},
buildAndDestroy: function ( breakpoint ) {
if ( qodefCore.windowWidth <= breakpoint ) {
$.fn.multiscroll.destroy();
$('html, body').css('overflow', 'initial');
qodefCore.body.removeClass( 'qodef-vertical-split-slider--initialized' );
} else {
$.fn.multiscroll.build();
qodefCore.body.addClass( 'qodef-vertical-split-slider--initialized' );
}
},
headerClassHandler: function ( slideHeaderStyle, initialHeaderStyle, $headerInner ) {
var $controls = $( '#multiscroll-nav' );
if ( slideHeaderStyle !== undefined && slideHeaderStyle !== '' ) {
$headerInner.removeClass( 'qodef-skin--light qodef-skin--dark' ).addClass( 'qodef-skin--' + slideHeaderStyle );
if ( $controls.length ) {
$controls.removeClass( 'qodef-skin--light qodef-skin--dark' ).addClass( 'qodef-skin--' + slideHeaderStyle );
}
} else if ( initialHeaderStyle !== '' ) {
$headerInner.removeClass( 'qodef-skin--light qodef-skin--dark' ).addClass( 'qodef-skin--' + slideHeaderStyle );
if ( $controls.length ) {
$controls.removeClass( 'qodef-skin--light qodef-skin--dark' ).addClass( 'qodef-skin--' + slideHeaderStyle );
}
} else {
$headerInner.removeClass( 'qodef-skin--light qodef-skin--dark' );
if ( $controls.length ) {
$controls.removeClass( 'qodef-skin--light qodef-skin--dark' );
}
}
}
};
qodefCore.shortcodes.drew_vertical_split_slider.qodefVerticalSplitSlider = qodefVerticalSplitSlider;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_video_button = {};
qodefCore.shortcodes.drew_core_video_button.qodefMagnificPopup = qodef.qodefMagnificPopup;
})( jQuery );
(function ( $ ) {
'use strict';
$( window ).on(
'load',
function () {
qodefStickySidebar.init();
}
);
var qodefStickySidebar = {
init: function () {
var info = $( '.widget_drew_core_sticky_sidebar' );
if ( info.length && qodefCore.windowWidth > 1024 ) {
info.wrapper = info.parents( '#qodef-page-sidebar' );
info.offsetM = info.offset().top - info.wrapper.offset().top;
info.adj = 15;
qodefStickySidebar.callStack( info );
$( window ).on(
'resize',
function () {
if ( qodefCore.windowWidth > 1024 ) {
qodefStickySidebar.callStack( info );
}
}
);
$( window ).on(
'scroll',
function () {
if ( qodefCore.windowWidth > 1024 ) {
qodefStickySidebar.infoPosition( info );
}
}
);
}
},
calc: function ( info ) {
var content = $( '.qodef-page-content-section' ),
headerH = qodefCore.body.hasClass( 'qodef-header-appearance--none' ) ? 0 : parseInt( qodefGlobal.vars.headerHeight, 10 );
// If posts not found set content to have the same height as the sidebar
if ( qodefCore.windowWidth > 1024 && content.height() < 100 ) {
content.css( 'height', info.wrapper.height() - content.height() );
}
info.start = content.offset().top;
info.end = content.outerHeight();
info.h = info.wrapper.height();
info.w = info.outerWidth();
info.left = info.offset().left;
info.top = headerH + qodefGlobal.vars.adminBarHeight - info.offsetM;
info.data( 'state', 'top' );
},
infoPosition: function ( info ) {
if ( qodefCore.scroll < info.start - info.top && qodefCore.scroll + info.h && info.data( 'state' ) !== 'top' ) {
gsap.to(
info.wrapper,
.1,
{
y: 5,
}
);
gsap.to(
info.wrapper,
.3,
{
y: 0,
delay: .1,
}
);
info.data( 'state', 'top' );
info.wrapper.css(
{
'position': 'static',
}
);
} else if ( qodefCore.scroll >= info.start - info.top && qodefCore.scroll + info.h + info.adj <= info.start + info.end &&
info.data( 'state' ) !== 'fixed' ) {
var c = info.data( 'state' ) === 'top' ? 1 : -1;
info.data( 'state', 'fixed' );
info.wrapper.css(
{
'position': 'fixed',
'top': info.top,
'left': info.left,
'width': info.w,
}
);
gsap.fromTo(
info.wrapper,
.2,
{
y: 0
},
{
y: c * 10,
ease: Power4.easeInOut
}
);
gsap.to(
info.wrapper,
.2,
{
y: 0,
delay: .2,
}
);
} else if ( qodefCore.scroll + info.h + info.adj > info.start + info.end && info.data( 'state' ) !== 'bottom' ) {
info.data( 'state', 'bottom' );
info.wrapper.css(
{
'position': 'absolute',
'top': info.end - info.h - info.adj,
'left': 'auto',
'width': info.w,
}
);
gsap.fromTo(
info.wrapper,
.1,
{
y: 0
},
{
y: -5,
}
);
gsap.to(
info.wrapper,
.3,
{
y: 0,
delay: .1,
}
);
}
},
callStack: function ( info ) {
this.calc( info );
this.infoPosition( info );
}
};
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'drew_core_blog_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
$( window ).on(
'load',
function () {
qodefBlogList.init();
}
);
var qodefBlogList = {
init: function () {
this.blog = $('.qodef-blog');
if ( this.blog.length ) {
this.blog.each(
function () {
let $thisBlogList = $( this );
if ( $thisBlogList.hasClass('qodef-hover-animation--enabled') ) {
qodefBlogList.linkHover( $thisBlogList );
}
}
)
}
},
linkHover: function ( $holder ) {
let $items = $holder.find('.qodef-blog-item');
$items.each( function() {
let $thisItem = $(this),
$itemMedia = $thisItem.find('.qodef-e-media-image'),
$titleLink = $thisItem.find('.qodef-e-title-link');
$itemMedia.on(
'mouseenter',
function () {
$thisItem.addClass('qodef--active');
}
);
$itemMedia.on(
'mouseleave',
function () {
$thisItem.removeClass('qodef--active');
}
);
$titleLink.on(
'mouseenter',
function () {
$thisItem.addClass('qodef--active');
}
);
$titleLink.on(
'mouseleave',
function () {
$thisItem.removeClass('qodef--active');
}
);
});
}
}
qodefCore.shortcodes[shortcode].qodefResizeIframes = qodef.qodefResizeIframes;
qodefCore.shortcodes[shortcode].qodefBlogList = qodefBlogList;
})( jQuery );
(function ( $ ) {
'use strict';
var fixedHeaderAppearance = {
showHideHeader: function ( $pageOuter, $header ) {
if ( qodefCore.windowWidth > 1024 ) {
if ( qodefCore.scroll <= 0 ) {
qodefCore.body.removeClass( 'qodef-header--fixed-display' );
$pageOuter.css( 'padding-top', '0' );
$header.css( 'margin-top', '0' );
} else {
qodefCore.body.addClass( 'qodef-header--fixed-display' );
$pageOuter.css( 'padding-top', parseInt( qodefGlobal.vars.headerHeight + qodefGlobal.vars.topAreaHeight ) + 'px' );
$header.css( 'margin-top', parseInt( qodefGlobal.vars.topAreaHeight ) + 'px' );
}
}
},
init: function () {
if ( ! qodefCore.body.hasClass( 'qodef-header--vertical' ) ) {
var $pageOuter = $( '#qodef-page-outer' ),
$header = $( '#qodef-page-header' );
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
$( window ).scroll(
function () {
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
}
);
$( window ).resize(
function () {
$pageOuter.css( 'padding-top', '0' );
fixedHeaderAppearance.showHideHeader( $pageOuter, $header );
}
);
}
}
};
qodefCore.fixedHeaderAppearance = fixedHeaderAppearance.init;
})( jQuery );
(function ( $ ) {
'use strict';
var stickyHeaderAppearance = {
header: '',
docYScroll: 0,
init: function () {
var displayAmount = stickyHeaderAppearance.displayAmount();
// Set variables
stickyHeaderAppearance.header = $( '.qodef-header-sticky' );
stickyHeaderAppearance.docYScroll = $( document ).scrollTop();
// Set sticky visibility
stickyHeaderAppearance.setVisibility( displayAmount );
$( window ).scroll(
function () {
stickyHeaderAppearance.setVisibility( displayAmount );
}
);
},
displayAmount: function () {
if ( qodefGlobal.vars.qodefStickyHeaderScrollAmount !== 0 ) {
return parseInt( qodefGlobal.vars.qodefStickyHeaderScrollAmount, 10 );
} else {
return parseInt( qodefGlobal.vars.headerHeight + qodefGlobal.vars.adminBarHeight, 10 );
}
},
setVisibility: function ( displayAmount ) {
var isStickyHidden = qodefCore.scroll < displayAmount;
if ( stickyHeaderAppearance.header.hasClass( 'qodef-appearance--up' ) ) {
var currentDocYScroll = $( document ).scrollTop();
isStickyHidden = (currentDocYScroll > stickyHeaderAppearance.docYScroll && currentDocYScroll > displayAmount) || (currentDocYScroll < displayAmount);
stickyHeaderAppearance.docYScroll = $( document ).scrollTop();
}
stickyHeaderAppearance.showHideHeader( isStickyHidden );
},
showHideHeader: function ( isStickyHidden ) {
if ( isStickyHidden ) {
qodefCore.body.removeClass( 'qodef-header--sticky-display' );
} else {
qodefCore.body.addClass( 'qodef-header--sticky-display' );
}
},
};
qodefCore.stickyHeaderAppearance = stickyHeaderAppearance.init;
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSideAreaMobileHeader.init();
}
);
var qodefSideAreaMobileHeader = {
init: function () {
var $holder = $( '#qodef-side-area-mobile-header' );
if ( $holder.length && qodefCore.body.hasClass( 'qodef-mobile-header--side-area' ) ) {
var $navigation = $holder.find( '.qodef-m-navigation' );
qodefSideAreaMobileHeader.initOpenerTrigger( $holder, $navigation );
qodefSideAreaMobileHeader.initNavigationClickToggle( $navigation );
if ( typeof qodefCore.qodefPerfectScrollbar === 'object' ) {
qodefCore.qodefPerfectScrollbar.init( $holder );
}
}
},
initOpenerTrigger: function ( $holder, $navigation ) {
var $openerIcon = $( '.qodef-side-area-mobile-header-opener' ),
$closeIcon = $holder.children( '.qodef-m-close' );
if ( $openerIcon.length && $navigation.length ) {
$openerIcon.on(
'tap click',
function ( e ) {
e.stopPropagation();
e.preventDefault();
if ( $holder.hasClass( 'qodef--opened' ) ) {
$holder.removeClass( 'qodef--opened' );
} else {
$holder.addClass( 'qodef--opened' );
}
}
);
}
$closeIcon.on(
'tap click',
function ( e ) {
e.stopPropagation();
e.preventDefault();
if ( $holder.hasClass( 'qodef--opened' ) ) {
$holder.removeClass( 'qodef--opened' );
}
}
);
},
initNavigationClickToggle: function ( $navigation ) {
var $menuItems = $navigation.find( 'ul li.menu-item-has-children' );
$menuItems.each(
function () {
var $thisItem = $( this ),
$elementToExpand = $thisItem.find( ' > .qodef-drop-down-second, > ul' ),
$dropdownOpener = $thisItem.find( '> .qodef-menu-item-arrow' ),
slideUpSpeed = 'fast',
slideDownSpeed = 'slow';
$dropdownOpener.on(
'click tap',
function ( e ) {
e.preventDefault();
e.stopPropagation();
if ( $elementToExpand.is( ':visible' ) ) {
$thisItem.removeClass( 'qodef-menu-item--open' );
$elementToExpand.slideUp( slideUpSpeed );
} else if ( $dropdownOpener.parent().parent().children().hasClass( 'qodef-menu-item--open' ) && $dropdownOpener.parent().parent().parent().hasClass( 'qodef-vertical-menu' ) ) {
$thisItem.parent().parent().children().removeClass( 'qodef-menu-item--open' );
$thisItem.parent().parent().children().find( ' > .qodef-drop-down-second' ).slideUp( slideUpSpeed );
$thisItem.addClass( 'qodef-menu-item--open' );
$elementToExpand.slideDown( slideDownSpeed );
} else {
if ( ! $thisItem.parents( 'li' ).hasClass( 'qodef-menu-item--open' ) ) {
$menuItems.removeClass( 'qodef-menu-item--open' );
$menuItems.find( ' > .qodef-drop-down-second, > ul' ).slideUp( slideUpSpeed );
}
if ( $thisItem.parent().parent().children().hasClass( 'qodef-menu-item--open' ) ) {
$thisItem.parent().parent().children().removeClass( 'qodef-menu-item--open' );
$thisItem.parent().parent().children().find( ' > .qodef-drop-down-second, > ul' ).slideUp( slideUpSpeed );
}
$thisItem.addClass( 'qodef-menu-item--open' );
$elementToExpand.slideDown( slideDownSpeed );
}
}
);
}
);
},
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearchCoversHeader.init();
}
);
var qodefSearchCoversHeader = {
init: function () {
var $searchOpener = $( 'a.qodef-search-opener' ),
$searchForm = $( '.qodef-search-cover-form' ),
$searchClose = $searchForm.find( '.qodef-m-close' );
if ( $searchOpener.length && $searchForm.length ) {
$searchOpener.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchCoversHeader.openCoversHeader( $searchForm );
}
);
$searchClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchCoversHeader.closeCoversHeader( $searchForm );
}
);
}
},
openCoversHeader: function ( $searchForm ) {
qodefCore.body.addClass( 'qodef-covers-search--opened qodef-covers-search--fadein' );
qodefCore.body.removeClass( 'qodef-covers-search--fadeout' );
setTimeout(
function () {
$searchForm.find( '.qodef-m-form-field' ).focus();
},
600
);
},
closeCoversHeader: function ( $searchForm ) {
qodefCore.body.removeClass( 'qodef-covers-search--opened qodef-covers-search--fadein' );
qodefCore.body.addClass( 'qodef-covers-search--fadeout' );
setTimeout(
function () {
$searchForm.find( '.qodef-m-form-field' ).val( '' );
$searchForm.find( '.qodef-m-form-field' ).blur();
qodefCore.body.removeClass( 'qodef-covers-search--fadeout' );
},
300
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearchFullscreen.init();
}
);
var qodefSearchFullscreen = {
init: function () {
var $searchOpener = $( 'a.qodef-search-opener' ),
$searchHolder = $( '.qodef-fullscreen-search-holder' ),
$searchClose = $searchHolder.find( '.qodef-m-close' );
if ( $searchOpener.length && $searchHolder.length ) {
$searchOpener.on(
'click',
function ( e ) {
e.preventDefault();
if ( qodefCore.body.hasClass( 'qodef-fullscreen-search--opened' ) ) {
qodefSearchFullscreen.closeFullscreen( $searchHolder );
} else {
qodefSearchFullscreen.openFullscreen( $searchHolder );
}
}
);
$searchClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchFullscreen.closeFullscreen( $searchHolder );
}
);
//Close on escape
$( document ).keyup(
function ( e ) {
if ( e.keyCode === 27 && qodefCore.body.hasClass( 'qodef-fullscreen-search--opened' ) ) { //KeyCode for ESC button is 27
qodefSearchFullscreen.closeFullscreen( $searchHolder );
}
}
);
}
},
openFullscreen: function ( $searchHolder ) {
qodefCore.body.removeClass( 'qodef-fullscreen-search--fadeout' );
qodefCore.body.addClass( 'qodef-fullscreen-search--opened qodef-fullscreen-search--fadein' );
setTimeout(
function () {
$searchHolder.find( '.qodef-m-form-field' ).focus();
},
900
);
qodefCore.qodefScroll.disable();
},
closeFullscreen: function ( $searchHolder ) {
qodefCore.body.removeClass( 'qodef-fullscreen-search--opened qodef-fullscreen-search--fadein' );
qodefCore.body.addClass( 'qodef-fullscreen-search--fadeout' );
setTimeout(
function () {
$searchHolder.find( '.qodef-m-form-field' ).val( '' );
$searchHolder.find( '.qodef-m-form-field' ).blur();
qodefCore.body.removeClass( 'qodef-fullscreen-search--fadeout' );
},
300
);
qodefCore.qodefScroll.enable();
}
};
})( jQuery );
(function ($) {
"use strict";
$(document).ready(function () {
qodefSearchMinimal.init();
});
var qodefSearchMinimal = {
init: function () {
var $searchOpener = $('a.qodef-search-opener'),
$searchHolder = $searchOpener.closest('.widget_drew_core_search_opener'),
$searchForm = $searchHolder.find('.qodef-search-minimal-form'),
$searchClose = $searchForm.find('.qodef-m-close');
if ($searchOpener.length && $searchForm.length) {
$searchOpener.each(function () {
var $thisSearchOpener = $( this ),
$thisSearchHolder = $thisSearchOpener.closest('.widget_drew_core_search_opener'),
$thisSearchForm = $thisSearchHolder.find('.qodef-search-minimal-form'),
$thisSearchClose = $thisSearchForm.find('.qodef-m-close');
if ( $thisSearchForm.length ) {
$thisSearchOpener.on(
'click',
function ( e ) {
e.preventDefault();
if ( ! $thisSearchForm.hasClass( 'qodef--opened' ) ) {
e.stopPropagation();
}
qodefSearchMinimal.openMinimal( $thisSearchForm );
$thisSearchHolder.addClass( 'qodef--opened' );
}
);
$thisSearchClose.on(
'click',
function ( e ) {
e.preventDefault();
qodefSearchMinimal.closeMinimal( $thisSearchForm );
$thisSearchHolder.removeClass( 'qodef--opened' );
}
);
$( document ).on(
'click',
function ( e ) {
if ( $thisSearchForm.hasClass( 'qodef--opened' ) && $thisSearchForm.find('.qodef-m-form-field')[0] !== $(e.target)[0] ) {
e.preventDefault();
qodefSearchMinimal.closeMinimal( $thisSearchForm );
$thisSearchHolder.removeClass( 'qodef--opened' );
}
}
);
}
});
}
},
openMinimal: function ($searchForm) {
qodefCore.body.addClass('qodef-minimal-search--opened');
$searchForm.addClass('qodef--opened').find('.qodef-m-form-field');
},
closeMinimal: function ($searchForm) {
qodefCore.body.removeClass('qodef-minimal-search--opened');
$searchForm.find('.qodef-m-form-field').val('');
$searchForm.removeClass('qodef--opened');
}
};
})(jQuery);
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefSearch.init();
}
);
var qodefSearch = {
init: function () {
this.search = $( 'a.qodef-search-opener' );
if ( this.search.length ) {
this.search.each(
function () {
var $thisSearch = $( this );
qodefSearch.searchHoverColor( $thisSearch );
}
);
}
},
searchHoverColor: function ( $searchHolder ) {
if ( typeof $searchHolder.data( 'hover-color' ) !== 'undefined' ) {
var hoverColor = $searchHolder.data( 'hover-color' ),
originalColor = $searchHolder.css( 'color' );
$searchHolder.on(
'mouseenter',
function () {
$searchHolder.css( 'color', hoverColor );
}
).on(
'mouseleave',
function () {
$searchHolder.css( 'color', originalColor );
}
);
}
}
};
})( jQuery );
(function ($) {
"use strict";
$( document ).ready(
function () {
qodefDrewSpinner.init();
}
);
$( window ).on(
'load',
function () {
qodefDrewSpinner.windowLoaded = true;
}
);
$( window ).on(
'elementor/frontend/init',
function() {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefDrewSpinner.init( isEditMode );
}
}
);
var qodefDrewSpinner = {
init: function ( isEditMode ) {
var $holder = $('#qodef-page-spinner.qodef-layout--drew');
if ( $holder.length ) {
if ( isEditMode ) {
qodefDrewSpinner.fadeOutLoader( $holder );
} else {
qodefDrewSpinner.animateSpinner( $holder );
}
}
},
animateSpinner: function ( $holder ) {
$holder.addClass('qodef--init');
function animationLoop () {
let $elements = $holder.find('.qodef-leaf');
if ( $elements.length ) {
$elements.each(
function (i) {
let $thisElement = $( this );
setTimeout(
function () {
$thisElement.addClass('qodef--on');
}, i * 162
);
setTimeout(
function () {
$elements.removeClass('qodef--on');
}, 2000
);
}
);
}
}
let spinnerInterval = setInterval(
function () {
animationLoop();
}, 3000
)
setTimeout(animationLoop, 400);
setTimeout(
function () {
if ( qodefDrewSpinner.windowLoaded ) {
qodefDrewSpinner.fadeOutLoader( $holder );
qodef.body.addClass('qodef-spinner--end');
clearInterval(spinnerInterval);
} else {
var interval = setInterval(
function() {
if ( qodefDrewSpinner.windowLoaded ) {
clearInterval(interval);
qodefDrewSpinner.fadeOutLoader( $holder );
qodef.body.addClass('qodef-spinner--end');
clearInterval(spinnerInterval);
}
}, 100
);
}
}, 4800
);
},
fadeOutLoader: function ( $holder, speed, delay, easing ) {
speed = speed ? speed : 500;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
if ( $holder.length ) {
$holder.delay(delay).fadeOut(speed, easing);
$(window).on(
'bind', 'pageshow',
function ( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut(speed, easing);
}
}
);
}
}
};
})(jQuery);
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefProgressBarSpinner.init();
}
);
$( window ).on(
'load',
function () {
qodefProgressBarSpinner.windowLoaded = true;
qodefProgressBarSpinner.completeAnimation();
}
);
$( window ).on(
'elementor/frontend/init',
function () {
var isEditMode = Boolean( elementorFrontend.isEditMode() );
if ( isEditMode ) {
qodefProgressBarSpinner.init( isEditMode );
}
}
);
var qodefProgressBarSpinner = {
holder: '',
windowLoaded: false,
percentNumber: 0,
init: function ( isEditMode ) {
this.holder = $( '#qodef-page-spinner.qodef-layout--progress-bar' );
if ( this.holder.length ) {
qodefProgressBarSpinner.animateSpinner( this.holder, isEditMode );
}
},
animateSpinner: function ( $holder, isEditMode ) {
var $numberHolder = $holder.find( '.qodef-m-spinner-number-label' ),
$spinnerLine = $holder.find( '.qodef-m-spinner-line-front' );
$spinnerLine.animate(
{ 'width': '100%' },
10000,
'linear'
);
var numberInterval = setInterval(
function () {
qodefProgressBarSpinner.animatePercent( $numberHolder, qodefProgressBarSpinner.percentNumber );
if ( qodefProgressBarSpinner.windowLoaded ) {
clearInterval( numberInterval );
}
},
100
);
if ( isEditMode ) {
qodefProgressBarSpinner.fadeOutLoader( $holder );
}
},
completeAnimation: function () {
var $holder = qodefProgressBarSpinner.holder.length ? qodefProgressBarSpinner.holder : $( '#qodef-page-spinner.qodef-layout--progress-bar' );
var numberIntervalFastest = setInterval(
function () {
if ( qodefProgressBarSpinner.percentNumber >= 100 ) {
clearInterval( numberIntervalFastest );
$holder.find( '.qodef-m-spinner-line-front' ).stop().animate(
{ 'width': '100%' },
500
);
$holder.addClass( 'qodef--finished' );
setTimeout(
function () {
qodefProgressBarSpinner.fadeOutLoader( $holder );
},
600
);
} else {
qodefProgressBarSpinner.animatePercent(
$holder.find( '.qodef-m-spinner-number-label' ),
qodefProgressBarSpinner.percentNumber
);
}
},
6
);
},
animatePercent: function ( $numberHolder, percentNumber ) {
if ( percentNumber < 100 ) {
percentNumber += 5;
$numberHolder.text( percentNumber );
qodefProgressBarSpinner.percentNumber = percentNumber;
}
},
fadeOutLoader: function ( $holder, speed, delay, easing ) {
speed = speed ? speed : 600;
delay = delay ? delay : 0;
easing = easing ? easing : 'swing';
$holder.delay( delay ).fadeOut( speed, easing );
$( window ).on(
'bind',
'pageshow',
function ( event ) {
if ( event.originalEvent.persisted ) {
$holder.fadeOut( speed, easing );
}
}
);
}
};
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefWishlistDropdown.init();
}
);
/**
* Function object that represents wishlist dropdown.
* @returns {{init: Function}}
*/
var qodefWishlistDropdown = {
init: function () {
var $holder = $( '.qodef-wishlist-dropdown' );
if ( $holder.length ) {
$holder.each(
function () {
var $thisHolder = $( this ),
$link = $thisHolder.find( '.qodef-m-link' );
$link.on(
'click',
function ( e ) {
e.preventDefault();
}
);
qodefWishlistDropdown.removeItem( $thisHolder );
}
);
}
},
removeItem: function ( $holder ) {
var $removeLink = $holder.find( '.qodef-e-remove' );
$removeLink.off().on(
'click',
function ( e ) {
e.preventDefault();
var $thisRemoveLink = $( this ),
removeLinkHTML = $thisRemoveLink.html(),
removeItemID = $thisRemoveLink.data( 'id' );
$thisRemoveLink.html( '<span class="fa fa-spinner fa-spin" aria-hidden="true"></span>' );
var wishlistData = {
type: 'remove',
itemID: removeItemID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
var newNumberOfItemsValue = parseInt( response.data['count'], 10 );
$holder.find( '.qodef-m-link-count' ).html( newNumberOfItemsValue );
if ( newNumberOfItemsValue === 0 ) {
$holder.removeClass( 'qodef-items--has' ).addClass( 'qodef-items--no' );
}
$thisRemoveLink.closest( '.qodef-m-item' ).fadeOut( 200 ).remove();
$( document ).trigger(
'drew_core_wishlist_item_is_removed',
[removeItemID]
);
} else {
$thisRemoveLink.html( removeLinkHTML );
}
}
}
);
}
);
}
};
$( document ).on(
'drew_core_wishlist_item_is_added',
function ( e, addedItemID, addedUserID ) {
var $holder = $( '.qodef-wishlist-dropdown' );
if ( $holder.length ) {
$holder.each(
function () {
var $thisHolder = $( this ),
$link = $thisHolder.find( '.qodef-m-link' ),
numberOfItemsValue = $link.find( '.qodef-m-link-count' ),
$itemsHolder = $thisHolder.find( '.qodef-m-items' );
var wishlistData = {
itemID: addedItemID,
userID: addedUserID,
};
$.ajax(
{
type: 'POST',
url: qodefGlobal.vars.restUrl + qodefGlobal.vars.wishlistDropdownRestRoute,
data: {
options: wishlistData,
},
beforeSend: function ( request ) {
request.setRequestHeader( 'X-WP-Nonce', qodefGlobal.vars.restNonce );
},
success: function ( response ) {
if ( response.status === 'success' ) {
numberOfItemsValue.html( parseInt( response.data['count'], 10 ) );
if ( $thisHolder.hasClass( 'qodef-items--no' ) ) {
$thisHolder.removeClass( 'qodef-items--no' ).addClass( 'qodef-items--has' );
}
$itemsHolder.append( response.data['new_html'] );
}
},
complete: function () {
qodefWishlistDropdown.init();
}
}
);
}
);
}
}
);
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_instagram_list = {};
$( document ).ready(
function () {
qodefInstagram.init();
}
);
var qodefInstagram = {
init: function () {
this.holder = $( '.sbi.qodef-instagram-swiper-container' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefInstagram.initSlider( $( this ) );
}
);
}
},
initSlider: function ( $currentItem, $initAllItems ) {
var sliderOptions = $currentItem.parent().attr( 'data-options' ),
$instagramImage = $currentItem.find( '.sbi_item.sbi_type_image' ),
$imageHolder = $currentItem.find( '#sbi_images' );
$currentItem.attr( 'data-options', sliderOptions );
$imageHolder.addClass( 'swiper-wrapper' );
if ( $instagramImage.length ) {
$instagramImage.each(
function () {
$( this ).addClass( 'qodef-e qodef-image-wrapper swiper-slide' );
}
);
}
if ( typeof qodef.qodefSwiper === 'object' ) {
if ( false === $initAllItems ) {
qodef.qodefSwiper.initSlider( $currentItem );
} else {
qodef.qodefSwiper.init( $currentItem );
}
}
}
};
qodefCore.shortcodes.drew_core_instagram_list.qodefInstagram = qodefInstagram;
qodefCore.shortcodes.drew_core_instagram_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
/*
** Re-init scripts on gallery loaded
*/
$( document ).on(
'yith_wccl_product_gallery_loaded',
function () {
if ( typeof qodefCore.qodefWooMagnificPopup === 'function' ) {
qodefCore.qodefWooMagnificPopup.init();
}
}
);
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_product_category_list = {};
qodefCore.shortcodes.drew_core_product_category_list.qodefMasonryLayout = qodef.qodefMasonryLayout;
qodefCore.shortcodes.drew_core_product_category_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'drew_core_product_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
})( jQuery );
(function ( $ ) {
'use strict';
$( document ).ready(
function () {
qodefDropDownCart.init();
}
);
var qodefDropDownCart = {
init: function () {
var $holder = $( '.qodef-woo-dropdown-cart' );
if ( $holder.length ) {
$holder.each(
function () {
var $thisHolder = $( this ),
$items = $thisHolder.find( '.qodef-woo-dropdown-items' );
qodefDropDownCart.addItemsClass( $items );
qodefCore.body.on(
'added_to_cart',
function () {
qodefDropDownCart.addItemsClass( $thisHolder.find( '.qodef-woo-dropdown-items' ) );
}
);
}
);
}
},
addItemsClass: function ( $items ) {
if ( $items.length && $items.children().length > 4 ) {
$items.addClass( 'qodef--scrollable' );
} else if ( $items.hasClass( 'qodef--scrollable' ) ) {
$items.removeClass( 'qodef--scrollable' );
}
},
};
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_clients_list = {};
qodefCore.shortcodes.drew_core_clients_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_reservation_form = {};
$( document ).ready(
function () {
qodefReservationForm.init();
}
);
$( document ).on(
'qodefAjaxPageLoad',
function () {
qodefReservationForm.init();
}
);
var qodefReservationForm = {
init: function () {
this.holder = $( '.qodef-reservation-form' );
if ( this.holder.length ) {
this.holder.each(
function () {
qodefReservationForm.initItem( $( this ) );
}
);
}
},
initItem: function ( $currentItem ) {
qodefReservationForm.initDatePicker( $currentItem );
qodefReservationForm.initSelect2( $currentItem );
qodefReservationForm.trigger( $currentItem );
},
initDatePicker: function ( $holder ) {
var $datepicker = $holder.find( '.qodef-m-date' );
if ( $datepicker.length ) {
$datepicker.each(
function () {
$( this ).datepicker(
{
prevText: '<span class="arrow_carrot-left"></span>',
nextText: '<span class="arrow_carrot-right"></span>',
dateFormat: 'M d, yy',
}
);
}
);
}
},
initSelect2: function ( $holder ) {
var $select = $holder.find( '.qodef-m-field select' );
if ( $select.length && typeof $select.select2 === 'function' ) {
$select.select2(
{
minimumResultsForSearch: Infinity,
}
);
}
},
trigger: function ( $holder ) {
var $form = $holder.find( 'form' );
$form.on(
'submit',
function ( e ) {
e.preventDefault();
var inputValues = $form.serializeArray(),
datetime = '';
$.each(
inputValues,
function () {
var $input = $( this )[0],
inputName = $input.name;
if ( inputName === 'date' || inputName === 'time' ) {
datetime += ' ' + $input.value;
}
}
);
if ( datetime.length ) {
var date = new Date( datetime ),
hours = parseInt( date.getHours(), 10 ),
formattedHours = hours < 10 ? '0' + hours : hours,
formattedDate = date.getFullYear() + '-' + (parseInt( date.getMonth(), 10 ) < 10 ? '0' : '') + (parseInt( date.getMonth(), 10 ) + 1) + '-' + (parseInt( date.getDate(), 10 ) < 10 ? '0' : '') + date.getDate() + 'T' + formattedHours + ':' + date.getMinutes() + (parseInt( date.getMinutes(), 10 ) == 30 ? '' : '0');
$form.find( '[name="datetime"]' ).val( formattedDate );
}
window.open(
$form.attr( 'action' ) + '?' + $form.serialize(),
'_blank'
);
}
);
}
};
qodefCore.shortcodes.drew_core_reservation_form.qodefReservationForm = qodefReservationForm;
})( jQuery );
(function ( $ ) {
'use strict';
var shortcode = 'drew_core_team_list';
qodefCore.shortcodes[shortcode] = {};
if ( typeof qodefCore.listShortcodesScripts === 'object' ) {
$.each(
qodefCore.listShortcodesScripts,
function ( key, value ) {
qodefCore.shortcodes[shortcode][key] = value;
}
);
}
})( jQuery );
(function ( $ ) {
'use strict';
qodefCore.shortcodes.drew_core_testimonials_list = {};
qodefCore.shortcodes.drew_core_testimonials_list.qodefSwiper = qodef.qodefSwiper;
})( jQuery );