jQuery(document).ready(function($){
if('woodmart'==afpv_gallery_thumb_setting.active_theme){
setTimeout(()=> {
$('.af-pv-product-video').css({'position':'relative','z-index':'999'});
}, 500);
}
setTimeout(()=> {
if('twentytwentyfive'==afpv_gallery_thumb_setting.active_theme&&$('.slick-list').length > 0&&$('.flex-control-nav').length > 0){
$('.flex-control-nav').remove();
$('.flex-viewport').remove();
}}, 600);
if('twentytwentyfive'==afpv_gallery_thumb_setting.active_theme||'twentytwentyfour'==afpv_gallery_thumb_setting.active_theme||'twentytwentythree'==afpv_gallery_thumb_setting.active_theme){
let position_where_append='';
if($('.gl-product-slider-top').length > 0){
position_where_append='gl-product-slider-top';
}else if($('.gl-product-slider-bottom').length > 0){
position_where_append='gl-product-slider-bottom';
}else if($('.gl-product-slider-left').length > 0){
position_where_append='gl-product-slider-left';
}else{
position_where_append='gl-product-slider-right';
}
setTimeout(function(){
$('.'+position_where_append).appendTo('#wp--skip-link--target .woocommerce-product-gallery');
$('.woocommerce-product-gallery__wrapper').remove();
},500)
}
$('.variations_form').on('found_variation', function (event, variation){
if(variation&&variation.image&&variation.image.src){
let img_attch_id=variation.image_id;
let get_img_from_attch_id_current=$('.attach_id-'+img_attch_id);
let all_other_op_zero=get_img_from_attch_id_current.closest('.slick-track');
all_other_op_zero.find('.slick-slide').css('opacity', '0');
setTimeout(()=> {
get_img_from_attch_id_current.closest('.slick-slide').css('opacity','1');
}, 100);
}});
$('.variations_form').on('reset_data', function (){
const defaultImage=$('.woocommerce-product-gallery img.wp-post-image').data('default-src');
$('.woocommerce-product-gallery img.wp-post-image').attr('src', defaultImage);
});
for (let index=1; index < 3; index++){
setTimeout(()=> {
if('Avada'==afpv_gallery_thumb_setting.active_theme&&'woo_gallery_template'!==afpv_gallery_thumb_setting.lightbox_enb){
if($('.woocommerce-product-gallery iframe').length >0){
$('.woocommerce-product-gallery iframe').css('width', '100%');
}
if($('.af-pv-product-video').closest('li').find('.featured-image').length>0){
$('.af-pv-product-video').closest('li').find('.featured-image').remove();
}}
if('woodmart'==afpv_gallery_thumb_setting.active_theme&&'woo_gallery_template'!==afpv_gallery_thumb_setting.lightbox_enb){
if($('.woocommerce-product-gallery iframe').length >0){
$('.woocommerce-product-gallery iframe').css('width', '100%');
}
$('.af-pv-product-video').closest('.product-element-top').find('.af-pv-feature-image-of-product').remove()
}}, 1000 * index);
}
for (let index=1; index < 3; index++){
setTimeout(()=> {
if(($('.woocommerce-product-gallery iframe').length >0&&afpv_gallery_thumb_setting.current_page)&&('Avada'==afpv_gallery_thumb_setting.active_theme||'woodmart'==afpv_gallery_thumb_setting.active_theme||'twentytwentyfive'==afpv_gallery_thumb_setting.active_theme)){
$('.woocommerce-product-gallery iframe').css('width', '100%');
$('.af-pv-feature-image-of-product').remove();
}}, 1000 * index);
}
setTimeout(()=> {
var iframe=document.getElementById('vimeo-video');
if(iframe){
var player=new Vimeo.Player(iframe);
}
if(player){
if(1==afpv_gallery_thumb_setting.vimeo_mute){
player.setVolume(0);
}else{
player.setVolume(1);
}
player.on('play', function(){
if(1==afpv_gallery_thumb_setting.vimeo_mute){
player.setVolume(0);
}else{
player.setVolume(1);
}});
}}, 1000);
$(".variation_id").change(function(){
var value=$(this).val();
var varId="afpv_var_id_" + value;
var varIds="afpv_var_ids_" + value;
if(value==0){
return;
}else{
$("#" + varId).removeClass("afpv-var-hide-swatches");
$("#" + varId).addClass("afpv-var-show-swatches");
$("#" + varIds).removeClass("afpv-hide-swatches");
$("#" + varIds).addClass("afpv-show-swatches");
$('.attachment-post-thumbnail').hide();
}});
$(".reset_variations").click(function(){
$var=$(".variation_id").val();
var varIda="afpv_var_id_" + $var;
var varIdas="afpv_var_ids_" + $var;
$("#" + varIda).removeClass("afpv-var-show-swatches");
$("#" + varIda).addClass("afpv-var-hide-swatches");
$("#" + varIdas).removeClass("afpv-show-swatches");
$("#" + varIdas).addClass("afpv-hide-swatches");
$('.attachment-post-thumbnail').css("display", "block");
});
var dot_option_selected=true;
if('yes'==(afpv_gallery_thumb_setting.afpv_dots_gallery_controller)){
dot_option_selected=true;
}
if('yes'!=(afpv_gallery_thumb_setting.afpv_dots_gallery_controller)){
dot_option_selected=false;
}
var arrows_option_selected=true;
if('yes'==(afpv_gallery_thumb_setting.afpv_arrows_gallery_controller)){
arrows_option_selected=true;
}
if('yes'!=(afpv_gallery_thumb_setting.afpv_arrows_gallery_controller)){
arrows_option_selected=false;
}
if(afpv_gallery_thumb_setting.afpv_gallery_pos=='pv_gallery_thumbnail_left_position'){
$('.gl-product-slides').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 4000,
arrows: false,
dots: false,
fade:true,
asNavFor: '.gl-product-slider-left-nav'
});
$('.gl-product-slider-left-nav').slick({
slidesToShow: afpv_gallery_thumb_setting.afpv_gallery_thumbnail_to_show,
vertical: true,
verticalSwiping: true,
infinite: true,
slidesToScroll: 2,
asNavFor: '.gl-product-slides',
dots: dot_option_selected,
arrows:arrows_option_selected,
nextArrow: '<i class="fa fa-chevron-right next-arrow"></i>',
prevArrow: '<i class="fa fa-chevron-left prev-arrow"></i>',
focusOnSelect: true,
autoplay:false
});
}else if(afpv_gallery_thumb_setting.afpv_gallery_pos=='pv_gallery_thumbnail_right_position'){
jQuery('.gl-product-slides').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 4000,
arrows: false,
dots: false,
fade:true,
asNavFor: '.gl-product-slider-right-nav'
});
jQuery('.gl-product-slider-right-nav').slick({
slidesToShow: afpv_gallery_thumb_setting.afpv_gallery_thumbnail_to_show,
vertical: true,
verticalSwiping: true,
infinite: true,
slidesToScroll: 2,
asNavFor: '.gl-product-slides',
dots: dot_option_selected,
arrows:arrows_option_selected,
nextArrow: '<i class="fa fa-chevron-right next-arrow"></i>',
prevArrow: '<i class="fa fa-chevron-left prev-arrow"></i>',
focusOnSelect: true,
autoplay:false
});
}else if(afpv_gallery_thumb_setting.afpv_gallery_pos=='pv_gallery_thumbnail_top_position'){
jQuery('.gl-product-slides').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 4000,
arrows: false,
dots: false,
fade:true,
asNavFor: '.gl-product-slider-top-nav'
});
jQuery('.gl-product-slider-top-nav').slick({
slidesToShow: afpv_gallery_thumb_setting.afpv_gallery_thumbnail_to_show,
infinite: true,
slidesToScroll: 2,
asNavFor: '.gl-product-slides',
dots: dot_option_selected,
arrows:arrows_option_selected,
nextArrow: '<i class="fa fa-chevron-right next-arrow"></i>',
prevArrow: '<i class="fa fa-chevron-left prev-arrow"></i>',
focusOnSelect: true,
autoplay:false
});
}else{
jQuery('.gl-product-slides').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: false,
autoplaySpeed: 4000,
arrows: false,
dots: false,
fade:true,
asNavFor: '.gl-product-slider-bottom-nav'
});
jQuery('.gl-product-slider-bottom-nav').slick({
slidesToShow: afpv_gallery_thumb_setting.afpv_gallery_thumbnail_to_show,
infinite: true,
slidesToScroll: 1,
asNavFor: '.gl-product-slides',
dots: dot_option_selected,
arrows:arrows_option_selected,
nextArrow: '<i class="fa fa-chevron-right next-arrow"></i>',
prevArrow: '<i class="fa fa-chevron-left prev-arrow"></i>',
focusOnSelect: true,
autoplay:false
});
}
jQuery('.gl-product-slides').slickLightbox({
itemSelector:'a',
navigateByKeyboard:true
});
jQuery('.video-thumbnail iframe').fadeOut();
jQuery('.video-thumbnail video').fadeOut();
$('.afpv-product-video-play-icon img').click(function(event){
event.preventDefault();
$('.afpv-product-video-thumbnail-image').fadeOut();
$('.afpv-product-video-play-icon img').fadeOut();
$('.afpv-product-video-play-icon').fadeOut();
$('#gl-product-video iframe').fadeIn(2500);
$('#gl-product-video video').fadeIn(2500);
});
$('.afpv-rule-video-play-icon img').click(function(event){
event.preventDefault();
$('.afpv-rule-video-thumbnail-image').fadeOut();
$('.afpv-rule-video-play-icon img').fadeOut();
$('.afpv-rule-video-play-icon').fadeOut();
$('#gl-product-rule-video iframe').fadeIn(2500);
$('#gl-product-rule-video video').fadeIn(2500);
});
});
jQuery(function(){
if(typeof trigger=="undefined"){
var trigger=false;
jQuery('#billing_address_1').addClass('billing_address1');
jQuery('#billing_address_2').addClass('billing_address_2');
jQuery('#shipping_address_1').addClass('shipping_address_1');
jQuery('#shipping_address_2').addClass('shipping_address_2');
jQuery('#shipping_city').addClass('shipping_city');
jQuery('#billing_city').addClass('billing_city');
jQuery('#billing_postcode').addClass('billing_postcode');
jQuery('#shipping_postcode').addClass('shipping_postcode');
jQuery('.billing_address1 , .billing_address_2 , \n\
.shipping_address_1 , .shipping_address_2 , \n\
.shipping_city , .billing_city , .billing_postcode , \n\
.shipping_postcode').on('keydown' , function(event){
if(trigger==false){
event.stopImmediatePropagation();
}
trigger=false;
});
jQuery('.billing_address1 , .billing_address_2 , \n\
.shipping_address_1 , .shipping_address_2 , \n\
.shipping_city , .billing_city , .billing_postcode , \n\
.shipping_postcode').on('change' , function(event){
trigger=true;
jQuery('.billing_address1').trigger('keydown');
});
}});
jQuery(function(t){if("undefined"==typeof wc_add_to_cart_params)return!1;var a=function(){this.requests=[],this.addRequest=this.addRequest.bind(this),this.run=this.run.bind(this),this.$liveRegion=this.createLiveRegion(),t(document.body).on("click",".add_to_cart_button:not(.wc-interactive)",{addToCartHandler:this},this.onAddToCart).on("keydown",".add_to_cart_button:not(.wc-interactive)",{addToCartHandler:this},t=>{" "===t.key&&(t.preventDefault(),t.target.click())}).on("click",".remove_from_cart_button",{addToCartHandler:this},this.onRemoveFromCart).on("keydown",".remove_from_cart_button",this.onKeydownRemoveFromCart).on("added_to_cart",{addToCartHandler:this},this.onAddedToCart).on("removed_from_cart",{addToCartHandler:this},this.onRemovedFromCart).on("ajax_request_not_sent.adding_to_cart",this.updateButton)};a.prototype.addRequest=function(t){this.requests.push(t),1===this.requests.length&&this.run()},a.prototype.run=function(){var a=this,e=a.requests[0].complete;a.requests[0].complete=function(){"function"==typeof e&&e(),a.requests.shift(),a.requests.length>0&&a.run()},t.ajax(this.requests[0])},a.prototype.onAddToCart=function(a){var e=t(this);if(e.is(".ajax_add_to_cart")){if(!e.attr("data-product_id"))return!0;if(a.data.addToCartHandler.$liveRegion.text("").removeAttr("aria-relevant"),a.preventDefault(),e.removeClass("added"),e.addClass("loading"),!1===t(document.body).triggerHandler("should_send_ajax_request.adding_to_cart",[e]))return t(document.body).trigger("ajax_request_not_sent.adding_to_cart",[!1,!1,e]),!0;var r={};t.each(e.data(),function(t,a){r[t]=a}),t.each(e[0].dataset,function(t,a){r[t]=a}),t(document.body).trigger("adding_to_cart",[e,r]),a.data.addToCartHandler.addRequest({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),data:r,success:function(a){a&&(a.error&&a.product_url?window.location=a.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?t(document.body).trigger("added_to_cart",[a.fragments,a.cart_hash,e]):window.location=wc_add_to_cart_params.cart_url)},dataType:"json"})}},a.prototype.onRemoveFromCart=function(a){var e=t(this),r=e.closest(".woocommerce-mini-cart-item");a.data.addToCartHandler.$liveRegion.text("").removeAttr("aria-relevant"),a.preventDefault(),r.block({message:null,overlayCSS:{opacity:.6}}),a.data.addToCartHandler.addRequest({type:"POST",url:wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),data:{cart_item_key:e.data("cart_item_key")},success:function(a){a&&a.fragments?t(document.body).trigger("removed_from_cart",[a.fragments,a.cart_hash,e]):window.location=e.attr("href")},error:function(){window.location=e.attr("href")},dataType:"json"})},a.prototype.onKeydownRemoveFromCart=function(a){" "===a.key&&(a.preventDefault(),t(this).trigger("click"))},a.prototype.updateButton=function(a,e,r,o){if(o=void 0!==o&&o){if(o.removeClass("loading"),e&&o.addClass("added"),e&&!wc_add_to_cart_params.is_cart&&0===o.parent().find(".added_to_cart").length){var d=document.createElement("a");d.href=wc_add_to_cart_params.cart_url,d.className="added_to_cart wc-forward",d.title=wc_add_to_cart_params.i18n_view_cart,d.textContent=wc_add_to_cart_params.i18n_view_cart,o.after(d)}t(document.body).trigger("wc_cart_button_updated",[o])}},a.prototype.updateFragments=function(a,e){e&&(t.each(e,function(a){t(a).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),t.each(e,function(a,e){t(a).replaceWith(e),t(a).stop(!0).css("opacity","1").unblock()}),t(document.body).trigger("wc_fragments_loaded"))},a.prototype.alertCartUpdated=function(t,a,e,r){if(r=void 0!==r&&r){var o=r.data("success_message");if(!o)return;t.data.addToCartHandler.$liveRegion.delay(1e3).text(o).attr("aria-relevant","all")}},a.prototype.createLiveRegion=function(){var a=t(".widget_shopping_cart_live_region");return a.length?a:t('<div class="widget_shopping_cart_live_region screen-reader-text" role="status"></div>').appendTo("body")},a.prototype.onAddedToCart=function(t,a,e,r){t.data.addToCartHandler.updateButton(t,a,e,r),t.data.addToCartHandler.updateFragments(t,a),t.data.addToCartHandler.alertCartUpdated(t,a,e,r)},a.prototype.onRemovedFromCart=function(t,a,e,r){t.data.addToCartHandler.updateFragments(t,a),t.data.addToCartHandler.alertCartUpdated(t,a,e,r)},new a});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self,function(){var n=e.Cookies,o=e.Cookies=t();o.noConflict=function(){return e.Cookies=n,o}}())}(this,function(){"use strict";function e(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)e[o]=n[o]}return e}return function t(n,o){function r(t,r,i){if("undefined"!=typeof document){"number"==typeof(i=e({},o,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),t=encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var c="";for(var u in i)i[u]&&(c+="; "+u,!0!==i[u]&&(c+="="+i[u].split(";")[0]));return document.cookie=t+"="+n.write(r,t)+c}}return Object.create({set:r,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var t=document.cookie?document.cookie.split("; "):[],o={},r=0;r<t.length;r++){var i=t[r].split("="),c=i.slice(1).join("=");try{var u=decodeURIComponent(i[0]);if(o[u]=n.read(c,u),e===u)break}catch(f){}}return e?o[e]:o}},remove:function(t,n){r(t,"",e({},n,{expires:-1}))},withAttributes:function(n){return t(this.converter,e({},this.attributes,n))},withConverter:function(n){return t(e({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(o)},converter:{value:Object.freeze(n)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:"/"})});