(function($, elementor){
"use strict";
var WprPopups={
init: function(){
$(document).ready(function(){
if(! $('.wpr-template-popup').length||WprPopups.editorCheck()){
return;
}
WprPopups.openPopupInit();
WprPopups.closePopupInit();
});
},
openPopupInit: function(){
$('.wpr-template-popup').each(function(){
var popup=$(this),
popupID=WprPopups.getID(popup);
if(! WprPopups.checkAvailability(popupID) ){
return;
}
if(! WprPopups.checkStopShowingAfterDate(popup) ){
return;
}
WprPopups.setLocalStorage(popup, 'show');
var getLocalStorage=JSON.parse(localStorage.getItem('WprPopupSettings') ),
settings=getLocalStorage[ popupID ];
if(! WprPopups.checkAvailableDevice(popup, settings) ){
return false;
}
WprPopups.popupTriggerInit(popup);
if('load'===settings.popup_trigger){
var loadDelay=settings.popup_load_delay * 1000;
$(window).on('load', function(){
setTimeout(function(){
WprPopups.openPopup(popup, settings);
}, loadDelay);
});
}else if('scroll'===settings.popup_trigger){
$(window).on('scroll', function(){
var scrollPercent=$(window).scrollTop() / ($(document).height() - $(window).height()),
scrollPercent=Math.round(scrollPercent * 100);
if(scrollPercent >=settings.popup_scroll_progress&&! popup.hasClass('wpr-popup-open') ){
WprPopups.openPopup(popup, settings);
}});
}else if('element-scroll'===settings.popup_trigger){
$(window).on('scroll', function(){
var element=$(settings.popup_element_scroll),
ScrollBottom=$(window).scrollTop() + $(window).height();
if(! element.length){
return;
}
if(element.offset().top < ScrollBottom&&! popup.hasClass('wpr-popup-open') ){
WprPopups.openPopup(popup, settings);
}});
}else if('date'===settings.popup_trigger){
var nowDate=Date.now(),
startDate=Date.parse(settings.popup_specific_date);
if(startDate < nowDate){
setTimeout(function(){
WprPopups.openPopup(popup, settings);
}, 1000);
}}else if('inactivity'===settings.popup_trigger){
var idleTimer=null,
inactivityTime=settings.popup_inactivity_time * 1000;
$('*').bind('mousemove click keyup scroll resize', function (){
if(popup.hasClass('wpr-popup-open') ){
return;
}
clearTimeout(idleTimer);
idleTimer=setTimeout(function(){
WprPopups.openPopup(popup, settings);
}, inactivityTime);
});
$('body').trigger('mousemove');
}else if('exit'===settings.popup_trigger){
$(document).on('mouseleave', 'body', function(event){
if(! popup.hasClass('wpr-popup-open') ){
WprPopups.openPopup(popup, settings);
}});
}else if('custom'===settings.popup_trigger){
$(settings.popup_custom_trigger).on('click', function(){
WprPopups.openPopup(popup, settings);
});
$(settings.popup_custom_trigger).css('cursor', 'pointer');
}
if('0px'!==popup.find('.wpr-popup-container-inner').css('height')){
const ps=new PerfectScrollbar(popup.find('.wpr-popup-container-inner')[0], {
suppressScrollX: true
});
}});
},
openPopup: function(popup, settings){
if('notification'===settings.popup_display_as){
popup.addClass('wpr-popup-notification');
setTimeout(function(){
$('body').animate({
'padding-top':popup.find('.wpr-popup-container').outerHeight() +'px'
}, settings.popup_animation_duration * 1000, 'linear');
}, 10);
}
if(settings.popup_disable_page_scroll&&'modal'===settings.popup_display_as){
$('body').css('overflow', 'hidden');
}
popup.addClass('wpr-popup-open').show();
popup.find('.wpr-popup-container').addClass('animated '+ settings.popup_animation);
$(window).trigger('resize');
$('.wpr-popup-overlay').hide().fadeIn();
popup.find('.wpr-popup-close-btn').css('opacity', '0');
setTimeout(function(){
popup.find('.wpr-popup-close-btn').animate({
'opacity':'1'
}, 500);
}, settings.popup_close_button_display_delay * 1000);
if(false!==settings.popup_automatic_close_switch){
setTimeout(function(){
WprPopups.closePopup(popup);
}, settings.popup_automatic_close_delay * 1000);
}},
closePopupInit: function(){
$('.wpr-popup-close-btn').on('click', function(){
WprPopups.closePopup($(this).closest('.wpr-template-popup') );
});
$('.wpr-popup-overlay').on('click', function(){
var popup=$(this).closest('.wpr-template-popup'),
popupID=WprPopups.getID(popup),
settings=WprPopups.getLocalStorage(popupID);
if(false==settings.popup_overlay_disable_close){
WprPopups.closePopup(popup);
}});
$(document).on('keyup', function(event){
var popup=$('.wpr-popup-open');
if(popup.length){
var	popupID=WprPopups.getID(popup),
settings=WprPopups.getLocalStorage(popupID);
if(27==event.keyCode&&false==settings.popup_disable_esc_key){
WprPopups.closePopup(popup);
}}
});
},
closePopup: function(popup,){
var popupID=WprPopups.getID(popup),
settings=WprPopups.getLocalStorage(popupID);
if('notification'===settings.popup_display_as){
$('body').css('padding-top', 0);
}
WprPopups.setLocalStorage(popup, 'hide');
if('modal'===settings.popup_display_as){
popup.fadeOut();
}else{
popup.hide();
}
$('body').css('overflow', 'visible');
$(window).trigger('resize');
},
popupTriggerInit: function(popup){
var popupTrigger=popup.find('.wpr-popup-trigger-button');
if(! popupTrigger.length){
return;
}
popupTrigger.on('click', function(){
var settings=JSON.parse(localStorage.getItem('WprPopupSettings'))||{};
var popupTriggerType=$(this).attr('data-trigger'),
popupShowDelay=$(this).attr('data-show-delay'),
popupRedirect=$(this).attr('data-redirect'),
popupRedirectURL=$(this).attr('data-redirect-url'),
popupID=WprPopups.getID(popup);
if('close'===popupTriggerType){
settings[popupID].popup_show_again_delay=parseInt(popupShowDelay, 10);
settings[popupID].popup_close_time=Date.now();
}else if('close-permanently'===popupTriggerType){
settings[popupID].popup_show_again_delay=parseInt(popupShowDelay, 10);
settings[popupID].popup_close_time=Date.now();
}else if('back'===popupTriggerType){
window.history.back();
}
WprPopups.closePopup(popup);
localStorage.setItem('WprPopupSettings', JSON.stringify(settings) );
if('back'!==popupTriggerType&&'yes'===popupRedirect){
setTimeout(function(){
window.location.href=popupRedirectURL;
}, 100);
}});
},
getLocalStorage: function(id){
var getLocalStorage=JSON.parse(localStorage.getItem('WprPopupSettings') );
if(null==getLocalStorage){
return false;
}
var settings=getLocalStorage[ id ];
if(null==settings){
return false;
}
return settings;
},
setLocalStorage: function(popup, display){
var popupID=WprPopups.getID(popup);
var dataSettings=JSON.parse(popup.attr('data-settings') ),
settings=JSON.parse(localStorage.getItem('WprPopupSettings'))||{};
settings[popupID]=dataSettings;
if('hide'===display){
settings[popupID].popup_close_time=Date.now();
}else{
settings[popupID].popup_close_time=false;
}
localStorage.setItem('WprPopupSettings', JSON.stringify(settings) );
},
checkStopShowingAfterDate: function(popup){
var settings=JSON.parse(popup.attr('data-settings') );
var currentDate=Date.now();
if('yes'===settings.popup_stop_after_date){
if(currentDate >=Date.parse(settings.popup_stop_after_date_select) ){
return false;
}}
return true;
},
checkAvailability: function(id){
var popup=$('#wpr-popup-id-'+ id),
dataSettings=JSON.parse(popup.attr('data-settings') ),
currentURL=window.location.href;
if('yes'===dataSettings.popup_show_via_referral&&-1===currentURL.indexOf('wpr_templates=user-popup')){
if(currentURL.indexOf(dataSettings.popup_referral_keyword)==-1){
return;
}}
if(false===WprPopups.getLocalStorage(id) ){
return true;
}
var trigger=popup.find('.wpr-popup-trigger-button'),
triggerShowDelay=trigger.attr('data-show-delay');
var currentDate=Date.now();
var settings=WprPopups.getLocalStorage(id);
if(triggerShowDelay){
var permanent=true;
trigger.each(function(){
var delay=$(this).attr('data-show-delay');
if(settings.popup_show_again_delay==parseInt(delay, 10) ){
permanent=false;
}});
if(true===permanent){
return true;
}}else{
if(settings.popup_show_again_delay!=dataSettings.popup_show_again_delay){
return true;
}}
var closeDate=settings.popup_close_time||0,
showDelay=parseInt(settings.popup_show_again_delay, 10);
if(closeDate + showDelay >=currentDate){
return false;
}else{
return true;
}},
checkAvailableDevice: function(popup, settings){
var viewport=$('body').prop('clientWidth');
if(viewport > 1024){
return Boolean(settings.popup_show_on_device);
}else if(viewport > 768){
return Boolean(settings.popup_show_on_device_tablet);
}else{
return Boolean(settings.popup_show_on_device_mobile);
}},
getID: function(popup){
var id=popup.attr('id');
return id.replace('wpr-popup-id-', '');
},
editorCheck: function(){
return $('body').hasClass('elementor-editor-active') ? true:false;
}}
WprPopups.init();
}(jQuery, window.elementorFrontend) );
(()=>{"use strict";var e={};e.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}();const t="email",n="phone",r="name",i={[t]:["email","e-mail","mail","email address"],[n]:["phone","tel","mobile","cell","telephone","phone number"],[r]:["name","full-name","full name","full_name","fullname","first-name","first name","first_name","firstname","last-name","last name","last_name","lastname","given-name","given name","given_name","givenname","family-name","family name","family_name","familyname","fname","lname","first","last","your-name","your name"]};function l(e){return e&&"string"==typeof e?e.trim().toLowerCase():""}function a(e){const t=l(e),n=t.lastIndexOf("@");if(-1===n)return t;const r=t.slice(n+1);return["gmail.com","googlemail.com"].includes(r)?`${t.slice(0,n).replace(/\./g,"")}@${r}`:t}function u(e){const t=l(e),n=t.replace(/\D/g,"");return t.startsWith("+")?`+${n}`:n}function s(e){const t=e.filter(e=>{let{type:t}=e;return t===r}).map(e=>{let{value:t}=e;return l(t)}).filter(Boolean);if(!t.length)return;const[n,...i]=1===t.length?t[0].split(" "):t;return{first_name:n,...i?.length>0?{last_name:i.join(" ")}:{}}}function o(e){return e.find(e=>{let{type:n}=e;return n===t})?.value}function m(e){return e.find(e=>{let{type:t}=e;return t===n})?.value}var c;(c=e.g.jQuery)&&c(e.g.document.body).on("wpformsAjaxSubmitSuccess",c=>{const f=e.g._googlesitekit?.gtagUserData,g=f?function(e){if(!(e&&e instanceof HTMLFormElement))return;const c=new FormData(e);return function(e){const t=[["address",s(e)],["email",o(e)],["phone_number",m(e)]].filter(e=>{let[,t]=e;return t});if(0!==t.length)return Object.fromEntries(t)}(Array.from(c.entries()).map(s=>{let[o,m]=s,c=e.querySelector(`[name='${o}']`);"hidden"===c?.type&&"hidden"!==c?.previousSibling?.type&&(c=c.previousSibling);const f=c?.type;return"hidden"===f||"submit"===f?null:function(e){let{type:s,name:o,value:m,label:c}=e||{};switch(s=l(s),o=l(o),m=l(m),c=function(e){return e&&"string"==typeof e?e.trim().toLowerCase().replace(/\s*\*+\s*$/,"").replace(/\s*\(required\)\s*$/i,"").replace(/\s*:\s*$/,"").trim():""}(c),s){case"email":return{type:t,value:a(m)};case"tel":return{type:n,value:u(m)}}return function(e){if(!e)return!1;const t=a(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)}(m)||i[t].includes(o)||i[t].includes(c)?{type:t,value:a(m)}:i[n].includes(o)||i[n].includes(c)?{type:n,value:u(m)}:i[r].includes(o)||i[r].includes(c)?{type:r,value:l(m)}:function(e){if(!e)return!1;if(!function(e){const t=e.replace(/\D/g,"");return!(t.length<7||t.length<e.length/2)&&/^[\s\-()+.\d]*$/.test(e)}(e))return!1;const t=u(e);if(!/^\+?\d{7,}$/.test(t))return!1;const n=/[\s\-()+.]/.test(e),r=e.trim().startsWith("+");return!(!n&&!r)}(m)?{type:n,value:u(m)}:null}({type:f,label:c?.id?e.querySelector(`label[for='${c?.id}']`)?.textContent:void 0,name:o,value:m})}).filter(Boolean))}(c.target):null;e.g._googlesitekit?.gtagEvent?.("submit_lead_form",g?{user_data:g}:void 0)})})();
(function($){
$.fn.zhf_stickypart=function(options){
var rcstickyhelp={
sticky_stat: function(st, header_top, sticky_outer, t_header_h, top_offset){
if(st > lastScrollTop){
if(st > header_top){
$(sticky_outer).children('.zhf-sticky-head').addClass('zhf-header-sticky');
$(sticky_outer).children('.zhf-sticky-head').css({ 'top': top_offset + 'px' });
}}else{
if(st >(header_top - t_header_h) ){
$(sticky_outer).children('.zhf-sticky-head').addClass('zhf-header-sticky');
$(sticky_outer).children('.zhf-sticky-head').css({ 'top': top_offset + 'px' });
}else{
$(sticky_outer).children('.zhf-sticky-head').removeClass('zhf-header-sticky');
}}
},
sticky_scroll_stat: function(st, lastScrollTop, header_top, sticky_outer, t_header_h){
if(st > lastScrollTop){
$(sticky_outer).children('.zhf-sticky-head').addClass("hide-up");
}else{
if(st >(header_top - t_header_h) ){
if(st > header_top) $(sticky_outer).children('.zhf-sticky-head').addClass('zhf-header-sticky').removeClass("hide-up");
}else{
$(sticky_outer).children('.zhf-sticky-head').removeClass('zhf-header-sticky').removeClass("hide-up");
}}
}}
var sticky_outer=this;
var lastScrollTop=0;
var header_top=st=0;
var sticky_up=$(sticky_outer).data("stickyup");
$(sticky_outer).css('height', 'auto');
$(sticky_outer).children('.zhf-sticky-head').removeClass('zhf-header-sticky');
var t_header_h=$(sticky_outer).outerHeight();
$(sticky_outer).css('height', t_header_h);
header_top=$(sticky_outer).offset().top;
header_top +=t_header_h;
var win_width=$(window).width();
var top_offset=0;
if($("#wpadminbar").length&&win_width > 600){
top_offset=$("#wpadminbar").outerHeight();
t_header_h +=top_offset;
}else{
}
if(sticky_up){
$(window).scroll(function(event){
st=$(this).scrollTop();
rcstickyhelp.sticky_scroll_stat(st, lastScrollTop, header_top, sticky_outer, t_header_h, top_offset);
if(st==0){
$(sticky_outer).children('.zhf-sticky-head').removeClass('zhf-header-sticky');
$(sticky_outer).children('.zhf-sticky-head').css({ "top": 0 });
}
lastScrollTop=st;
});
}else{
$(window).scroll(function(event){
st=$(this).scrollTop();
rcstickyhelp.sticky_stat(st, header_top, sticky_outer, t_header_h, top_offset);
if(st==0){
$(sticky_outer).children('.zhf-sticky-head').removeClass('zhf-header-sticky');
$(sticky_outer).children('.zhf-sticky-head').css({ "top": 0 });
}
lastScrollTop=st;
});
}};
var WidgetZozoHFSearch=function($scope, $){
WidgetZozoHFSearchFun($scope);
};
var WidgetZozoHFSecondaryBar=function($scope, $){
WidgetZozoHFSecondaryBarFun($scope);
};
var WidgetZozoHFMenu=function($scope, $){
WidgetZozoHFMenuFun($scope);
};
var WidgetZozoHFUserRegistration=function($scope, $){
if($scope.find('.login-form-trigger').length){
WidgetZozoHFUserRegistrationFun($scope);
};};
var WidgetZozoHFMinicart=function($scope, $){
if($scope.find('.zozo-sticky-cart-wrap').length){
WidgetZozoHFUserRegistrationFun($scope);
};};
$(window).on('elementor/frontend/init', function(){
elementorFrontend.hooks.addAction('frontend/element_ready/zozo_hf_search.default', WidgetZozoHFSearch);
elementorFrontend.hooks.addAction('frontend/element_ready/zozo_hf_secondary_bar.default', WidgetZozoHFSecondaryBar);elementorFrontend.hooks.addAction('frontend/element_ready/zozo_hf_menu.default', WidgetZozoHFMenu);
elementorFrontend.hooks.addAction('frontend/element_ready/zozo_hf_registration.default', WidgetZozoHFUserRegistration);
elementorFrontend.hooks.addAction('frontend/element_ready/zozo_hf_minicart.default', WidgetZozoHFMinicart);
});
$(window).load(function(){
if($(".zhf-sticky-obj").length){
$(".zhf-sticky-obj").each(function(){
var _sticky_ele=$(this);
_sticky_ele.children("div").addClass("zhf-sticky-head");
_sticky_ele.zhf_stickypart();
var sticky_on_time;
$(window).resize(function(event){
clearTimeout(sticky_on_time);
sticky_on_time=setTimeout(function(){ _sticky_ele.zhf_stickypart(); }, 300);
});
});
}});
function WidgetZozoHFMinicartFun(){
if(typeof(Storage)!=="undefined"){
localStorage.removeItem('mini_wishlist_count');
localStorage.removeItem('mini_wishlist');
$(window).on('storage onstorage', function(e){
var mini_wishlist=localStorage.getItem('mini_wishlist');
var mini_wishlist_count=localStorage.getItem('mini_wishlist_count');
if(mini_wishlist_count) $(document).find("span.zhf-wishlist-items-count").text(mini_wishlist_count);
if(mini_wishlist)  $(document).find("ul.wishlist-dropdown-menu, ul.zhf-sticky-wishlist").html(mini_wishlist);
localStorage.removeItem('mini_wishlist');
localStorage.removeItem('mini_wishlist_count');
});
}
$(document).find("body .zhf-sticky-cart-wrap .zhf-sticky-cart-close").on("click", function(e){
$(document).find(".zhf-sticky-cart-wrap").toggleClass("active");
$(window).trigger("resize");
return false;
});
if($(document).find('.mini-cart-item').length||$(document).find(".zhf-sticky-cart").length){
$(document).on('click', '.remove-cart-item', function(){
var cur_ele=$(this);
cur_ele.addClass("loading");
var product_id=cur_ele.attr("data-product_id");
$.ajax({
type: 'post',
dataType: 'json',
url: zhfwoobase_ajax_var.admin_ajax_url,
data: {
action: "zhf_product_remove",
nonce: zhfwoobase_ajax_var.remove_from_cart,
product_id: product_id
},
success: function(data){
if(data['status']==1){
if(data['mini_cart']){
$(document).find('.mini-cart-dropdown li.cart-item[data-product-id="'+ product_id +'"]').fadeOut(350, function(){
$(document).find(".mini-cart-dropdown ul.cart-dropdown-menu").html(data['mini_cart']);
$(document).find(".mini-cart-dropdown .woo-icon-count").text(data['cart_count']);
});
}
if(data['sticky_cart']){
$(document).find('.zhf-sticky-cart li.cart-item[data-product-id="'+ product_id +'"]').fadeOut(350, function(){
$(document).find(".zhf-sticky-cart-wrap ul.zhf-sticky-cart").html(data['sticky_cart']);
$(document).find(".zhf-sticky-cart-wrap .woo-icon-count").text(data['cart_count']);
});
}
if($(document).find(".mobile-footer-sticky-bar .cart-items-count").length){
$(document).find(".mobile-footer-sticky-bar .cart-items-count").text(data['cart_count']);
}
$(document.body).trigger('wc_fragment_refresh');
}
cur_ele.removeClass("loading");
},
error: function(xhr, status, error){
cur_ele.removeClass("loading");
}});
return false;
});
}
$(document).on('click', "a.zhf-ajax-add-to-cart", function(event){
if($(this).parents(".zhf-wishlist-table").length){
$(this).parents("tr").find("a.zhf-wishlist-remove").trigger("click");
}
var cur_ele=$(this);
cur_ele.addClass("loading");
var product_id=$(this).attr("data-product_id");
var variations=cur_ele.data("variations") ? cur_ele.data("variations"):'';
$.ajax({
type: 'post',
dataType: 'json',
url: zhfwoobase_ajax_var.admin_ajax_url,
data: {
action: "zhf_add_to_cart",
product_id: product_id,
variation: variations,
nonce: zhfwoobase_ajax_var.add_to_cart
},success: function(data){
cur_ele.removeClass("loading");
if(data['error']==true){
var not_avail_msg=zhfwoobase_ajax_var.product_not_available;
if(cur_ele.parents("li.product").hasClass("product-type-variable")){
not_avail_msg=zhfwoobase_ajax_var.variation_not_available;
}
var err_html='<div class="variation-not-available-wrap"><span class="ti-close"></span><div class="variation-not-inner">'+ not_avail_msg +'</div></div>';
cur_ele.parents("li.product").append(err_html);
}else{
if(data['status']==1){
if(data['mini_cart']){
$(document).find(".mini-cart-dropdown ul.cart-dropdown-menu").html(data['mini_cart']);
$(document).find(".mini-cart-item .woo-icon-count").text(data['cart_count']);
}
if(data['sticky_cart']){
$(document).find(".zhf-sticky-cart-wrap ul.zhf-sticky-cart").html(data['sticky_cart']);
$(document).find(".zhf-sticky-cart-wrap .woo-icon-count").text(data['cart_count']);
if(!$(document).find(".zhf-sticky-cart-wrap").hasClass("active")) $(document).find(".zhf-sticky-cart-wrap").addClass("active");
}
if($(document).find(".mobile-footer-sticky-bar .cart-items-count").length){
$(document).find(".mobile-footer-sticky-bar .cart-items-count").text(data['cart_count']);
}
$(document.body).trigger('wc_fragment_refresh');
}}
},error: function(xhr, status, error){
cur_ele.removeClass("loading");
}});
return false;
});
$(document).find("body .zhf-sticky-wishlist-close").on("click", function(e){
$(document).find(".zhf-sticky-wishlist-wrap").toggleClass("active");
$(window).trigger("resize");
return false;
});
$(document).on('click', ".zhf-woo-favourite-trigger", function(event){
var cur_a=$(this);
var product_id=cur_a.attr("data-product-id");
if(zhfwoobase_ajax_var.user_logged==0){
if($('.zhf-login-parent').length){
$('.zhf-login-parent').toggleClass('login-open');
}else{
window.location.href=zhfwoobase_ajax_var.woo_user_page;
}
return false;
}
if(product_id){
cur_a.addClass("loading");
$.ajax({
type: "post",
dataType: "json",
url: zhfwoobase_ajax_var.admin_ajax_url,
data: "action=woo_fav_act&nonce="+ zhfwoobase_ajax_var.wishlist_nonce +"&post_id="+product_id,
success: function(res){
if(res==0){
if($('.zhf-login-parent').length) $('.zhf-login-parent').toggleClass('login-open');
}else{
if(res['stat']=='fav'){
cur_a.addClass("theme-color");
if(!cur_a.parents("li.product").find(".zhf-product-favoured").length){
cur_a.parents("li.product").prepend('<span class="zhf-product-favoured"><i class="ti-heart"></i></span>');
}}else{
cur_a.removeClass("theme-color");
if(cur_a.parents("li.product").find(".zhf-product-favoured").length){
cur_a.parents("li.product").find(".zhf-product-favoured").remove();
}}
if($.isNumeric(res['count']) ){
if($(document).find("a.mini-wishlist-item").length){
if($(document).find("span.zhf-wishlist-items-count").length){
$(document).find("span.zhf-wishlist-items-count").text(res['count']);
}else{
$(document).find("a.mini-wishlist-item").append('<span class="span.zhf-wishlist-items-count">'+ res['count'] +'</span>');
}}
localStorage.setItem('mini_wishlist_count', res['mini_wishlist_count']);
}
if(res['mini_wishlist']){
if(!$(document).find(".zhf-sticky-wishlist-wrap").hasClass("active")) $(document).find(".zhf-sticky-wishlist-wrap").addClass("active");
$(document).find("ul.wishlist-dropdown-menu, ul.zhf-sticky-wishlist").html(res['mini_wishlist']);
if(typeof(Storage)!=="undefined"){
localStorage.setItem('mini_wishlist', res['mini_wishlist']);
}}
}
cur_a.removeClass("loading");
},
error: function (jqXHR, exception){
cur_a.removeClass("loading");
console.log(jqXHR);
}});
}
return false;
});
$(document).on('click', "a.zhf-wishlist-remove, a.remove-wishlist-item", function(event){
var cur_a=$(this);
var product_id=cur_a.attr("data-product-id");
if(product_id){
cur_a.addClass("loading");
$.ajax({
type: "post",
dataType: 'json',
url: zhfwoobase_ajax_var.admin_ajax_url,
data: "action=zhf_wishlist_remove&nonce="+zhfwoobase_ajax_var.wishlist_remove+"&product_id="+product_id,
success: function(res){
if($(document).find("li.post-" + product_id).length) $(document).find("li.post-" + product_id + " span.zhf-product-favoured").remove();
if(cur_a.hasClass("remove-wishlist-item")){
cur_a.parents("li.wishlist-item").fadeOut(350, function(){
cur_a.parents("li.wishlist-item").remove();
});
}else{
cur_a.parents("tr").fadeOut(350, function(){
cur_a.parents("tr").remove();
});
}
if($.isNumeric(res['mini_wishlist_count']) ){
if($(document).find("span.zhf-wishlist-items-count").length){
$(document).find("span.zhf-wishlist-items-count").text(res['mini_wishlist_count']);
}else{
$(document).find("a.mini-wishlist-item").append('<span class="span.zhf-wishlist-items-count">'+ res['mini_wishlist_count'] +'</span>');
}
localStorage.setItem('mini_wishlist_count', res['mini_wishlist_count']);
}
if(res['mini_wishlist']){
setTimeout(function(){
$(document).find("ul.wishlist-dropdown-menu, ul.zhf-sticky-wishlist").html(res['mini_wishlist']);
if(typeof(Storage)!=="undefined"){
localStorage.setItem('mini_wishlist', res['mini_wishlist']);
}}, 350);
}},
error: function (jqXHR, exception){
console.log(jqXHR);
}});
}
return false;
});
}
function WidgetZozoHFUserRegistrationFun($scope){
$(document).find(".login-form-trigger, .zhf-login-close").click(function(){
$('.zhf-login-parent').toggleClass('login-open');
return false;
});
$(document).find(".move-to-prev-form").click(function(){
$('.zhf-login-parent .lost-password-form, .zhf-login-parent .registration-form').removeClass('form-state-show').addClass('form-state-hide');
$('.zhf-login-parent .login-form').removeClass('form-state-hide').addClass('form-state-show');
return false;
});
$(document).find(".register-trigger").click(function(){
$('.zhf-login-parent .lost-password-form, .zhf-login-parent .login-form').removeClass('form-state-show').addClass('form-state-hide');
$('.zhf-login-parent .registration-form').removeClass('form-state-hide').addClass('form-state-show');
return false;
});
$(document).find(".lost-password-trigger").click(function(){
$('.zhf-login-parent .registration-form, .zhf-login-parent .login-form').removeClass('form-state-show').addClass('form-state-hide');
$('.zhf-login-parent .lost-password-form').removeClass('form-state-hide').addClass('form-state-show');
return false;
});
$(document).on('submit', 'form#login', function(e){
if($('form#login #lusername').val()!=''&&$('form#login #lpassword').val()!=''){
$('form#login p.status').show().text(zhf_ajax_var.loadingmessage);
($).ajax({
type: 'post',
dataType: 'json',
url: zhf_ajax_var.ajax_url,
data: {
'action': 'ajaxlogin',
'username': $('form#login #lusername').val(),
'password': $('form#login #lpassword').val(),
'security': $('form#login #lsecurity').val() },
success: function(data){
$('form#login p.status').text(data.message);
if(data.loggedin==true){
if(data.redirect_url){
window.location.href=data.redirect_url;
}else{
window.location.reload();
}}
}});
e.preventDefault();
}else{
$('form#login p.status').text(zhf_ajax_var.valid_login);
return false;
}});
$(document).on('submit', 'form#registration', function(e){
if($('form#registration #uemail').val()!=''&&$('form#registration #username').val()!=''&&$('form#registration #password').val()!=''){
$('form#registration p.status').show().text(zhf_ajax_var.loadingmessage);
($).ajax({
type: 'post',
dataType: 'json',
url: zhf_ajax_var.ajax_url,
data: {
'action': 'ajaxregister',
'name': $('form#registration #name').val(),
'email': $('form#registration #uemail').val(),
'nick_name': $('form#registration #nick_name').val(),
'username': $('form#registration #username').val(),
'password': $('form#registration #password').val(),
'usertype': $('form#registration #usertype').val(),
'security': $('form#registration #security').val() },
success: function(data){
$('form#registration p.status').text(data.message);
if(data.register==true){
$('form#registration p.status').text(data.message);
setTimeout(function(){
$('.zhf-login-parent .lost-password-form, .zhf-login-parent .registration-form').removeClass('form-state-show').addClass('form-state-hide');
$('.zhf-login-parent .login-form').removeClass('form-state-hide').addClass('form-state-show');
}, 1000);
}else{
$('form#registration p.status').text(data.message);
}}
});
e.preventDefault();
}else{
$('form#registration p.status').text(zhf_ajax_var.req_reg);
return false;
}});
$(document).on('submit', 'form#forgot_password', function(e){
if($('#user_login').val()!=''){
$('p.status', this).show().text(zhf_ajax_var.loadingmessage);
($).ajax({
type: 'post',
dataType: 'json',
url: zhf_ajax_var.ajax_url,
data: {
'action': 'lost_pass',
'user_login': $('#user_login').val(),
'security': $('#forgotsecurity').val(),
},
success: function(data){
$('form#forgot_password p.status').text(data.message);
}});
e.preventDefault();
return false;
}else{
$('form#forgot_password p.status').text(zhf_ajax_var.valid_email);
return false;
}});
}
function WidgetZozoHFMenuFun($scope){
var _hmenu_stat=1;
if($scope.hasClass("zhf-vertical-enabled") ){
_hmenu_stat=0;
ZHFVerticalMenu($scope);
}
ZHFWindowResize($scope, _hmenu_stat);
$(window).on("resize", function(){
ZHFWindowResize($scope, _hmenu_stat);
});
ZHFMobileMenu($scope);
}
function ZHFVerticalMenu($scope){
$(document).on("click", ".zhf-vertical-enabled .dropdown-icon", function(){
let _ele=$(this);
_ele.toggleClass("opened");
_ele.parent("a").next("ul.sub-menu").toggleClass("opened");
return false;
});
}
function ZHFMobileMenu($scope){
$(document).on("click", ".zhf-menu-toggle", function(){
let _ele=$(this);
$scope.find(".zhf-menu-toggle-wrap .zhf-menu-toggle").toggleClass("opened");
$scope.find(".zhf-menu-wrap").toggleClass("mobile-menu-active");
if($scope.hasClass("zhf-fly-layout-push")&&$scope.find(".zhf-menu-wrap").hasClass("mobile-menu-active")){
$("body").addClass("zhf-transition-350");
if($scope.hasClass("zhf-fly-left")){
$("body").css({"margin-left":'350px', "margin-right": '-350px', "overflow-x": 'hidden'});
}else{
$("body").css({"margin-right":'350px', "margin-left": '-350px', "overflow-x": 'hidden'});
}}else if($scope.hasClass("zhf-fly-layout-push")&&$scope.find(".zhf-menu-wrap").hasClass("mobile-menu-deactive")){
$("body").css({"margin-left":'', "margin-right":''});
}
return false;
});
}
function ZHFWindowResize($scope, _hmenu_stat){
let _mobile_from=$scope.find(".elementor-widget-container").data("responsive");
let _win_width=$(window).width();
$scope.find(".zhf-menu-wrap").addClass("mobile-menu-deactive");
if(_win_width < parseInt(_mobile_from) ){
$scope.find(".zhf-menu-toggle-wrap").addClass("active");
if(_hmenu_stat){
$scope.addClass("zhf-vertical-enabled");
ZHFVerticalMenu($scope);
}
$scope.find(".zhf-menu-wrap").removeClass("mobile-menu-active").addClass("mobile-menu-deactive");
$scope.find(".zhf-menu-toggle-wrap .zhf-menu-toggle").removeClass("opened");
}else{
$scope.find(".zhf-menu-toggle-wrap").removeClass("active");
if(_hmenu_stat){
$scope.removeClass("zhf-vertical-enabled");
}
$scope.find(".zhf-menu-wrap").removeClass("mobile-menu-deactive mobile-menu-active");
}}
function WidgetZozoHFSecondaryBarFun($scope){
if($scope.find(".zhf-secondary-area-wrap").length){
var _ele_class=$scope.find(".zhf-secondary-area-wrap").attr("class");
var _area_width=$scope.find(".zhf-secondary-area-wrap").data("width");
var _push_type=$scope.find(".zhf-secondary-area-wrap").data("type");
var _push_stat=_ele_class.search("push");
$(document).on("click", ".zhf-secondar-bar-toggle", function(){
if(_push_stat!=-1){
if(_push_type=='left') $("body").css({"margin-left":_area_width+'px', "margin-right": '-'+_area_width+'px', "overflow": "hidden"});
else if(_push_type=='right') $("body").css({"margin-right":_area_width+'px', "margin-left": '-'+_area_width+'px', "overflow": "hidden"});
}
$(".zhf-secondary-area-wrap").addClass("active");
$("body").addClass("zhf-transition-area");
});
$(document).on("click", ".zhf-close", function(){
if(_push_stat!=-1){
if(_push_type=='left') $("body").css({"margin-left":'', "margin-right":''});
else if(_push_type=='right') $("body").css({"margin-right":'', "margin-right":''});
setTimeout(function(){ $("body").css({"overflow": ""});}, 350);
}
$(".zhf-secondary-area-wrap").removeClass("active");
$("body").removeClass("zhf-transition-area");
});
}}
function WidgetZozoHFSearchFun($scope){
if($scope.find(".zhf-full-search-toggle").length){
$(document).on("click", ".zhf-full-search-toggle", function(){
$('.zhf-full-search-wrapper').addClass("search-wrapper-opened");
$('.zhf-full-search-wrapper').fadeToggle(500);
var search_in=$('.search-wrapper-opened').find("input.form-control");
search_in.focus();
return false;
});
}else if($scope.find(".zhf-textbox-search-toggle").length){
$(document).on('click', '.zhf-textbox-search-toggle', function(){
var _cur_parent=$(this).parents('.zhf-search-toggle-wrap');
_cur_parent.toggleClass('active');
var search_in=_cur_parent.find("input.zhf-form-control");
setTimeout(function(){
if(_cur_parent.hasClass("active")){
search_in.focus();
}}, 350);
return false;
});
}else if($scope.find(".zhf-full-bar-search-toggle").length){
$(document).on('click', '.zhf-full-bar-search-toggle', function(){
let _full_bar_html=$('.zhf-full-bar-search-wrap');
$('.zhf-full-bar-search-wrap').remove;
$scope.parents(".elementor-container").append(_full_bar_html);
$(document).find('.zhf-full-bar-search-wrap').toggleClass('active');
var search_in=$(document).find('.zhf-full-bar-search-wrap').find("input.zhf-form-control");
setTimeout(function(){
if($(document).find(".zhf-full-bar-search-wrap").hasClass("active")){
search_in.focus();
}}, 350);
return false;
});
}else if($scope.find(".zhf-bottom-search-toggle").length){
$(document).on('click', '.zhf-bottom-search-toggle', function(){
var _cur_parent=$(this).parents('.zhf-search-toggle-wrap');
_cur_parent.toggleClass('active');
var search_in=_cur_parent.find("input.form-control");
setTimeout(function(){
if(_cur_parent.hasClass("active")){
search_in.focus();
}}, 350);
return false;
});
}
/*var cur_ele=$(cur_ele);
var typing_text=cur_ele.attr("data-typing") ? cur_ele.attr("data-typing"):[];
if(typing_text){
typing_text=typing_text.split(",");
var type_speed=cur_ele.data("typespeed") ? cur_ele.data("typespeed"):100;
var back_speed=cur_ele.data("backspeed") ? cur_ele.data("backspeed"):100;
var back_delay=cur_ele.data("backdelay") ? cur_ele.data("backdelay"):1000;
var start_delay=cur_ele.data("startdelay") ? cur_ele.data("startdelay"):1000;
var cur_char=cur_ele.data("char") ? cur_ele.data("char"):'|';
var loop=cur_ele.data("loop") ? cur_ele.data("loop"):false;
var typed=new Typed(cur_ele[index], {
typeSpeed: type_speed,
backSpeed: back_speed,
backDelay: back_delay,
startDelay: start_delay,
strings: typing_text,
loop: loop,
cursorChar: cur_char
});
}*/
}})(jQuery);