(function(){
jQuery(document).ready(function($){
crResizeAllGridItems();
crResizeTrustBadges();
jQuery("form#commentform").attr("enctype", "multipart/form-data").attr("encoding", "multipart/form-data");
jQuery("#commentform").on("submit", function(event){
if(cr_ajax_object.ivole_recaptcha==='1'){
var recaptcha=jQuery("#g-recaptcha-response").val();
if(recaptcha===""){
event.preventDefault();
alert("Please confirm that you are not a robot");
}}
});
jQuery("ol.commentlist").on("click", ".cr-comment-a", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
if(0 < oo.length){
const o=oo[0];
var pics=jQuery(this).parent().parent().find(".cr-comment-a img");
var this_pic=jQuery(this).find("img");
var inx=0;
if(pics.length > 0&&this_pic.length > 0){
var a=[];
for (i=0; i < pics.length; i++){
a.push({
src: pics[i].src,
w: pics[i].naturalWidth,
h: pics[i].naturalHeight,
title: pics[i].alt
});
if(this_pic[0].src==pics[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
}});
jQuery(".cr-reviews-grid").on("click", ".image-row-vid, .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".image-row").hasClass("cr-vid-playing") ){
jQuery(this).closest(".image-row").addClass("cr-vid-playing");
jQuery(this).closest(".image-row").find(".image-row-vid").prop("controls", true);
jQuery(this).closest(".image-row").find(".image-row-vid").get(0).play();
}else{
jQuery(this).closest(".image-row").find(".image-row-vid").get(0).pause();
jQuery(this).closest(".image-row").find(".image-row-vid").prop("controls", false);
jQuery(this).closest(".image-row").removeClass("cr-vid-playing");
}
return false;
});
jQuery(".cr-ajax-reviews-cus-images-modal").on("click", ".cr-ajax-reviews-video, .cr-ajax-reviews-video .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".cr-ajax-reviews-video").hasClass("cr-vid-playing") ){
jQuery(this).closest(".cr-ajax-reviews-video").addClass("cr-vid-playing");
jQuery(this).closest(".cr-ajax-reviews-video").find("video").prop("controls", true);
jQuery(this).closest(".cr-ajax-reviews-video").find("video").get(0).play();
}else{
jQuery(this).closest(".cr-ajax-reviews-video").find("video").get(0).pause();
jQuery(this).closest(".cr-ajax-reviews-video").find("video").prop("controls", false);
jQuery(this).closest(".cr-ajax-reviews-video").removeClass("cr-vid-playing");
}
return false;
});
jQuery(".cr-reviews-grid").on("click", ".media-row-count", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
let media=jQuery(this).parent().find(".image-row-vid,.image-row-img"),
this_media=jQuery(this),
inx=0;
if(media.length > 0&&this_media.length > 0){
const o=oo[0];
var a=[];
for (i=0; i < media.length; i++){
if("vid"===media[i].dataset.crmedia){
a.push({
html: '<div class="cr-video-wrapper"><video class="cr-media-video" src="' + media[i].src + '" controls></video></div>',
title: media[i].dataset.crtitle
});
}else{
a.push({
src: media[i].src,
w: media[i].naturalWidth,
h: media[i].naturalHeight,
title: media[i].alt
});
}
if(this_media[0].src==media[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
});
jQuery(document).on("click", ".cr-video-wrapper .cr-media-video", function(t){
const vid=jQuery(this).get(0);
if(vid){
const isVideoPlaying = !!(vid.currentTime > 0&&!vid.paused&&!vid.ended&&vid.readyState > 2);
if(isVideoPlaying){
vid.pause();
}else{
vid.play();
}}
return false;
});
jQuery(".cr-reviews-grid").on("click", ".image-row-img, .image-row-count", function(t){
if(cr_ajax_object.disable_lightbox==='0'){
t.preventDefault();
const oo=jQuery(".pswp");
if(0 < oo.length){
const o=oo[0];
var pics=jQuery(this).parent().find("img.image-row-img");
var this_pic=jQuery(this);
var inx=0;
if(pics.length > 0&&this_pic.length > 0){
var a=[];
for (i=0; i < pics.length; i++){
a.push({
src: pics[i].src,
w: pics[i].naturalWidth,
h: pics[i].naturalHeight,
title: pics[i].alt
});
if(this_pic[0].src==pics[i].src){
inx=i;
}}
var r={
index: inx
};
new PhotoSwipe(o, PhotoSwipeUI_Default, a, r).init();
}}
}});
initVoteClick("ol.commentlist", ".cr-voting-a", "cr_vote_review");
initVoteClick(".cr-ajax-reviews-cus-images-modal", ".cr-voting-a", "cr_vote_review");
initVoteClick(".cr-qna-block .cr-qna-list-block", ".cr-voting-a", "cr_vote_question");
jQuery("ol.commentlist").on("click", ".cr-video-a, .cr-comment-videoicon", function(t){
if(! jQuery(this).closest(".cr-comment-videos").hasClass("cr-comment-videos-modal") ){
let tt=jQuery(this).closest("[class*='cr-comment-video-']");
jQuery(this).closest(".cr-comment-videos").addClass("cr-comment-videos-modal");
tt.addClass("cr-comment-video-modal");
tt.find("video").prop("controls", true);
tt.find(".cr-comment-videoicon").hide();
tt.find("video").get(0).play();
return false;
}
return false;
});
jQuery("ol.commentlist").on("click", ".cr-comment-videos", function(t){
if(jQuery(this).hasClass("cr-comment-videos-modal") ){
jQuery(this).removeClass("cr-comment-videos-modal");
jQuery(this).find("[class*='cr-comment-video-']").each(function(index, element){
if(jQuery(element).hasClass("cr-comment-video-modal") ){
jQuery(element).removeClass("cr-comment-video-modal");
jQuery(element).find("video").get(0).pause();
jQuery(element).find("video").prop("controls", false);
jQuery(element).find(".cr-comment-videoicon").show();
jQuery(element).removeAttr("style");
}});
return false;
}});
jQuery(".cr-show-more-reviews-prd").on("click", function(t){
t.preventDefault();
crShowMoreReviewsPrd(jQuery(this));
});
jQuery(".cr-ajax-reviews-sort").on("change", function(t){
t.preventDefault();
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
var cr_product_id=jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").attr("data-product");
var cr_sort=jQuery(this).children("option:selected").val();
var cr_rating=jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax tr.ivole-histogramRow.ivole-histogramRow-s .ivole-histogram-a").attr("data-rating");
if(!cr_rating){
cr_rating=0;
}
var cr_data={
"action": "cr_sort_reviews",
"productID": cr_product_id,
"sort": cr_sort,
"rating": cr_rating
};
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find('.cr-ajax-search input').val("").trigger("change");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").show();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
jQuery(this).addClass("cr-sort-updating");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: this,
success: function(response){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
jQuery(this).removeClass("cr-sort-updating");
if(response.page > 0){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").empty();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").append(response.html);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").show();
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page",response.page);
if(response.show_more_label){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(!response.last_page){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").show();
}}
},
dataType: "json"
});
}});
jQuery(".cr-noAjax").on("click", ".ivole-histogram-a", function (t){
t.preventDefault();
const parser=new URL(window.location);
parser.searchParams.set(cr_ajax_object.rating_filter, jQuery(this).data("rating"));
parser.hash=cr_ajax_object.reviews_tab;
window.location=parser.href;
});
jQuery(".cr-reviews-ajax-comments").on("click", ".ivole-histogram-a, .cr-seeAllReviews", function(t){
t.preventDefault();
let tmpParent=jQuery(this).parents(".cr-reviews-ajax-comments");
let cr_product_id=tmpParent.find(".commentlist.cr-ajax-reviews-list").attr("data-product");
let cr_nonce=tmpParent.find(".cr-summaryBox-ajax").attr("data-nonce");
let cr_rating=jQuery(this).attr("data-rating");
let cr_sort=tmpParent.find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_data={
"action": "cr_filter_reviews",
"productID": cr_product_id,
"rating": cr_rating,
"sort": cr_sort,
"security": cr_nonce
};
tmpParent.find(".cr-summaryBox-ajax tr.ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
jQuery(this).closest("tr.ivole-histogramRow").addClass("ivole-histogramRow-s");
}
tmpParent.find(".cr-search-no-reviews").hide();
tmpParent.find('.cr-ajax-search input').val("").trigger("change");
tmpParent.find(".cr-show-more-reviews-prd").hide();
tmpParent.find(".commentlist.cr-ajax-reviews-list").hide();
tmpParent.find(".cr-show-more-review-spinner").show();
tmpParent.find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
tmpParent.find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: tmpParent,
success: function(response){
this.find(".cr-show-more-review-spinner").hide();
this.find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
this.find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
if(response.page > 0){
this.find(".commentlist.cr-ajax-reviews-list").empty();
this.find(".commentlist.cr-ajax-reviews-list").append(response.html);
this.find(".commentlist.cr-ajax-reviews-list").show();
this.attr("data-page",response.page);
if(response.show_more_label){
this.find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
this.find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(!response.last_page){
this.find(".cr-show-more-reviews-prd").show();
}}
},
dataType: "json"
});
});
jQuery('.cr-ajax-search input').on("keyup", function(e){
if(e.keyCode==13){
jQuery(this).parents(".cr-ajax-search").find("button").trigger("click");
}
if(jQuery(this).val()!==""){
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").css("display", "inline-block");
}else{
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").css("display", "none");
}}).on("change", function(){
if(jQuery(this).val()==="") jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").hide();
});
jQuery('.cr-reviews-ajax-reviews .cr-ajax-search input').on('keyup', crDebounce(
(ref)=> {
jQuery(ref.target).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(ref.target).parents(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(ref.target));
},
1000
));
jQuery(".cr-ajax-search .cr-clear-input").on("click", function (){
jQuery(this).prev("input").val("");
jQuery(this).parents(".cr-ajax-search").find(".cr-clear-input").hide();
jQuery(this).parents(".cr-ajax-search").find("button").trigger("click");
if(jQuery(this).parents(".cr-reviews-ajax-reviews").length){
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-ajax-search button").on("click", function (e){
e.preventDefault();
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-ajax-reviews-add-review, .cr-nosummary-add").on("click", function(t){
t.preventDefault();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").hide();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").show();
});
jQuery(".cr-review-tags-filter span.cr-tags-filter").on("click", function (e){
e.preventDefault();
if(jQuery(this).hasClass("cr-tag-selected")){
jQuery(this).removeClass("cr-tag-selected");
}else{
jQuery(this).addClass("cr-tag-selected");
}
if(jQuery(this).parents(".cr-all-reviews-shortcode").length){
cr_filter_all_reviews(jQuery(this));
}else{
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page", 0);
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-list").empty();
crShowMoreReviewsPrd(jQuery(this));
}});
jQuery(".cr-comment-image-top .cr-comment-image-top-item").on("click", function(t){
t.preventDefault();
jQuery("body").addClass("cr-noscroll");
let slide_no=jQuery(this).data("slide");
let imgParent=jQuery(this).closest(".cr-ajax-reviews-cus-images-div").parent();
imgParent.find(".cr-ajax-reviews-cus-images-modal-cont").addClass("cr-mask-active");
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('setPosition');
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('setPosition');
if(typeof slide_no!=='undefined'){
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('slickGoTo', slide_no, true);
imgParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('slickGoTo', slide_no, true);
}});
jQuery(".cr-comment-image-top .cr-comment-videoicon").on("click", function(t){
jQuery(this).closest(".cr-comment-image-top").find(".cr-comment-image-top-item").trigger("click");
});
jQuery(".cr-ajax-reviews-cus-images-modal-cont, .cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-close").on("click", function(t){
t.preventDefault();
let closeParent=jQuery(this).closest(".cr-ajax-reviews-cus-images-modal-cont.cr-mask-active");
closeParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-main").slickk('slickGoTo',0,true);
closeParent.find(".cr-ajax-reviews-cus-images-modal .cr-ajax-reviews-cus-images-slider-nav").slickk('slickGoTo',0,true);
closeParent.removeClass("cr-mask-active");
jQuery("body").removeClass("cr-noscroll");
});
jQuery(".cr-ajax-reviews-cus-images-modal-cont .cr-ajax-reviews-cus-images-modal").on("click", function(t){
t.stopPropagation();
});
jQuery(".single_variation_wrap").on("show_variation", function(event, variation){
if(jQuery(".cr_gtin").length){
jQuery(".cr_gtin_val").text(variation._cr_gtin);
}
if(jQuery(".cr_mpn").length){
jQuery(".cr_mpn_val").text(variation._cr_mpn);
}
if(jQuery(".cr_brand").length){
jQuery(".cr_brand_val").text(variation._cr_brand);
}});
jQuery(document).on('reset_data', function (){
var cr_gtin=jQuery(".cr_gtin"),
cr_mpn=jQuery(".cr_mpn"),
cr_brand=jQuery(".cr_brand");
if(cr_gtin.length){
jQuery(".cr_gtin_val").text(cr_gtin.data("o_content"));
}
if(cr_mpn.length){
jQuery(".cr_mpn_val").text(cr_mpn.data("o_content"));
}
if(cr_brand.length){
jQuery(".cr_brand_val").text(cr_brand.data("o_content"));
}});
jQuery('.cr-all-reviews-shortcode .cr-show-more-button').on("click", function (e){
e.preventDefault();
cr_filter_all_reviews(jQuery(this), true);
});
jQuery('.cr-all-reviews-shortcode').on("click", ".cr-page-numbers-a", function (e){
e.preventDefault();
cr_filter_all_reviews(jQuery(this), true);
});
jQuery(".cr-all-reviews-shortcode").on("click", ".cr-histogram-a, .cr-seeAllReviews", function(t){
t.preventDefault();
let cr_rating=jQuery(this).data("rating");
jQuery("div.ivole-summaryBox tr.ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
jQuery(this).closest("tr.ivole-histogramRow").addClass("ivole-histogramRow-s");
}
jQuery(this).parents(".cr-all-reviews-shortcode").find(".cr-review-tags-filter .cr-tag-selected").removeClass("cr-tag-selected");
cr_filter_all_reviews(jQuery(this));
});
jQuery(".cr-reviews-grid .cr-show-more-button").on("click", function (e){
e.preventDefault();
let $this=jQuery(this),
$spinner=$this.next(".cr-show-more-spinner"),
cr_rating=$this.parents(".cr-reviews-grid").find(".ivole-summaryBox.cr-grid-reviews-ajax tr.ivole-histogramRow.ivole-histogramRow-s .cr-histogram-a").attr("data-rating"),
attributes=$this.parents(".cr-reviews-grid").data("attributes");
attributes.comment__not_in=$this.parents(".cr-reviews-grid").find(".cr-review-card.cr-card-product").map(function(){
return jQuery(this).data("reviewid");
}).get();
attributes.comment__not_in=attributes.comment__not_in.concat($this.parents(".cr-reviews-grid").find(".cr-review-card.cr-card-shop").map(function(){
return jQuery(this).data("reviewid");
}).get());
var grid_data={
'action': "ivole_show_more_grid_reviews",
'rating': cr_rating,
'attributes': attributes
};
$this.hide();
$spinner.show();
jQuery.post(cr_ajax_object.ajax_url, grid_data, function(response){
$spinner.hide();
$reviews=jQuery(response.html).find(".cr-review-card");
let showMoreBtn=jQuery(response.html).find(".cr-show-more-button");
if($reviews.length){
$this.parents(".cr-reviews-grid").find(".cr-reviews-grid-inner").colcade("append", $reviews);
if(showMoreBtn.length){
$this.text(showMoreBtn.text());
$this.show();
}else{
$this.hide();
}}else{
$this.hide();
}}).fail(function(response){
$spinner.hide();
$this.show();
$this.parent().append('<div style="color:#cd2653;text-align:center;display:block;">'+response.responseText+'</div>');
});
});
jQuery(".cr-reviews-grid .cr-summaryBox-wrap").on("click", ".cr-histogram-a, .cr-seeAllReviews", function(e){
e.preventDefault();
let $this=jQuery(this),
$grid=$this.parents(".cr-reviews-grid"),
$spinner=$grid.find(".cr-show-more-spinner"),
cr_rating=$this.attr("data-rating"),
attributes=$grid.data("attributes");
attributes.show_more=attributes.count + attributes.count_shop_reviews;
attributes.comment__not_in=[];
if(!cr_rating) cr_rating=0;
var grid_data={
'action': "ivole_show_more_grid_reviews",
'rating': cr_rating,
'attributes': attributes
};
$grid.find("div.ivole-summaryBox tr.ivole-histogramRow.ivole-histogramRow-s").removeClass("ivole-histogramRow-s");
if(cr_rating > 0){
$this.closest("tr.ivole-histogramRow").addClass("ivole-histogramRow-s");
}
$grid.find(".cr-reviews-grid-inner").hide();
$grid.find(".cr-show-more-button").hide();
$spinner.show();
$grid.find("div.ivole-summaryBox").addClass("cr-summaryBar-updating");
jQuery.post(cr_ajax_object.ajax_url, grid_data, function(response){
$spinner.hide();
$grid.find(".cr-show-more-button").show();
$grid.find(".cr-summaryBox-wrap .cr-count-filtered-reviews").empty();
$reviews=jQuery(response.html).find(".cr-review-card");
if($reviews.length){
$grid.find(".cr-reviews-grid-inner").colcade("empty");
$grid.find(".cr-reviews-grid-inner").show();
$grid.find(".cr-reviews-grid-inner").colcade("append", $reviews);
$grid.find("div.ivole-summaryBox").removeClass("cr-summaryBar-updating");
$grid.find(".cr-summaryBox-wrap .cr-count-filtered-reviews").append(jQuery(response.html).find(".cr-count-filtered-reviews").html());
}}).fail(function(response){
$spinner.hide();
$this.parent().append('<div style="color: #cd2653;text-align: center;display: block;">'+response.responseText+'</div>');
});
});
jQuery('#cr_floatingtrustbadge').on("click", function(){
if(!jQuery(this).hasClass('cr-floatingbadge-big') ){
jQuery(this).find('div.cr-badge.badge_size_compact').hide();
jQuery(this).find('div.cr-badge.badge--wide-mobile').css('display', 'block');
jQuery(this).find('div.cr-floatingbadge-close').css('display', 'block');
jQuery(this).addClass('cr-floatingbadge-big');
var crcolors=jQuery(this).data('crcolors');
if(typeof crcolors!=='undefined'){
jQuery(this).css('border-color', crcolors['big']['border']);
jQuery(this).find('div.cr-floatingbadge-background-top').css('background-color', crcolors['big']['top']);
jQuery(this).find('div.cr-floatingbadge-background-middle').css('background-color', crcolors['big']['middle']);
jQuery(this).find('div.cr-floatingbadge-background-bottom').css('background-color', crcolors['big']['bottom']);
jQuery(this).find('div.cr-floatingbadge-background-bottom').css('border-color', crcolors['big']['border']);
}}
});
jQuery('#cr_floatingtrustbadge .cr-floatingbadge-close').on("click", function(event){
if(jQuery('#cr_floatingtrustbadge').hasClass('cr-floatingbadge-big') ){
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-badge.badge--wide-mobile').hide();
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-badge.badge_size_compact').css('display', 'block');
jQuery(this).closest('#cr_floatingtrustbadge').removeClass('cr-floatingbadge-big');
var crcolors=jQuery(this).closest('#cr_floatingtrustbadge').data('crcolors');
if(typeof crcolors!=='undefined'){
jQuery(this).closest('#cr_floatingtrustbadge').css('border-color', crcolors['small']['border']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-top').css('background-color', crcolors['small']['top']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-middle').css('background-color', crcolors['small']['middle']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-bottom').css('background-color', crcolors['small']['bottom']);
jQuery(this).closest('#cr_floatingtrustbadge').find('div.cr-floatingbadge-background-bottom').css('border-color', crcolors['small']['border']);
}}else{
jQuery('#cr_floatingtrustbadge').hide();
document.cookie='cr_hide_trustbadge=true; path=/; max-age='+60*60*24+';';
}
event.stopPropagation();
});
jQuery('.cr-reviews-slider').on('click', '.cr-slider-read-more a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-text");
parent.find(".cr-slider-read-more").hide();
parent.find(".cr-slider-details").css("display", "inline");
jQuery(this).parents(".cr-reviews-slider").slickk('setPosition');
});
jQuery('.cr-reviews-slider').on('click', '.cr-slider-read-less a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-text");
parent.find(".cr-slider-details").hide();
parent.find(".cr-slider-read-more").css("display", "inline");
jQuery(this).parents(".cr-reviews-slider").slickk('setPosition');
});
jQuery('.cr-reviews-grid').on('click', '.cr-grid-read-more a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-content");
if(0===parent.length){
parent=jQuery(this).parents(".cr-grid-reply-content");
}
parent.find(".cr-grid-read-more").hide();
parent.find(".cr-grid-details").css("display", "inline");
});
jQuery('.cr-reviews-grid').on('click', '.cr-grid-read-less a', function (e){
e.preventDefault();
let parent=jQuery(this).parents(".review-content");
if(0===parent.length){
parent=jQuery(this).parents(".cr-grid-reply-content");
}
parent.find(".cr-grid-details").hide();
parent.find(".cr-grid-read-more").css("display", "inline");
});
jQuery('.cr-qna-block .cr-qna-search-block .cr-qna-ask-button').on('click', function (e){
e.preventDefault();
jQuery(this).closest('.cr-qna-block').addClass('cr-qna-new-q-form-open');
});
jQuery(".cr-qna-block .cr-qna-list-block").on("click", ".cr-qna-ans-button", function (e){
e.preventDefault();
let nameField=jQuery(this).closest('.cr-qna-block').find(".cr-qna-new-q-form .cr-review-form-name");
let nameValue=nameField.find(".cr-review-form-txt").data("defval");
jQuery(this).closest('.cr-qna-list-q-b').find(".cr-qna-list-inl-answ .cr-review-form-name .cr-review-form-txt").val(nameValue);
let emailField=jQuery(this).closest('.cr-qna-block').find(".cr-qna-new-q-form .cr-review-form-email");
let emailValue=emailField.find(".cr-review-form-txt").data("defval");
jQuery(this).closest('.cr-qna-list-q-b').find(".cr-qna-list-inl-answ .cr-review-form-email .cr-review-form-txt").val(emailValue);
jQuery(this).closest('.cr-qna-list-q-b').addClass('cr-qna-ans-form-open');
});
jQuery(".cr-qna-block").on("click", ".cr-show-more-que", function(t){
t.preventDefault();
let qna_block=jQuery(this).parents(".cr-qna-block").eq(0);
let cr_product_id=jQuery(this).attr("data-product");
let cr_page=jQuery(this).attr("data-page");
let cr_attributes=qna_block.data("attributes");
let cr_search=qna_block.find(".cr-ajax-qna-search input").val();
let cr_permalink=jQuery(this).attr("data-permalink");
let cr_data={
"action": "cr_show_more_qna",
"productID": cr_product_id,
"page": cr_page,
"permalink": cr_permalink,
"search": cr_search,
"cr_attributes": cr_attributes
};
qna_block.find(".cr-search-no-qna").hide();
jQuery(this).hide();
qna_block.find("#cr-show-more-q-spinner").show();
jQuery.post(cr_ajax_object.ajax_url, cr_data, function(response){
jQuery(".cr-qna-block #cr-show-more-q-spinner").hide();
if(response.page >=0){
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").append(response.html);
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page",response.page);
if(!response.last_page){
jQuery(".cr-qna-block #cr-show-more-q-id").show();
}}
if(response.html===""&&response.page===0){
jQuery(".cr-qna-block .cr-search-no-qna").show();
}}, "json");
});
jQuery(".cr-qna-block .cr-ajax-qna-search input").on("keyup", cr_keyup_delay(function(e){
var code=(e.keyCode||e.which);
if(code==37||code==38||code==39||code==40){
return;
}
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page", -1);
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").empty();
jQuery(".cr-qna-block #cr-show-more-q-id").trigger("click");
}, 500));
jQuery(".cr-qna-block .cr-ajax-qna-search input").on("keyup", function(e){
if(jQuery(this).val()!==""){
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").css("display", "inline-block");
}else{
if(jQuery(this).val()==="") jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
}}).on("change", function(){
if(jQuery(this).val()==="") jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
});
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").on("click", function (){
jQuery(this).prev("input").val("");
jQuery(".cr-qna-block .cr-ajax-qna-search .cr-clear-input").hide();
jQuery(".cr-qna-block #cr-show-more-q-id").attr("data-page", -1);
jQuery(".cr-qna-block .cr-qna-list-block .cr-qna-list-block-inner").empty();
jQuery(".cr-qna-block #cr-show-more-q-id").trigger("click");
});
jQuery("body").on("click", "a.cr-qna-link", function (){
const cr_qna_tab=jQuery('.cr_qna_tab a');
if(cr_qna_tab.length){
cr_qna_tab.trigger("click");
}else{
jQuery('.cr-qna-block').parents(':hidden').show();
}
return true;
});
jQuery("body").on("click", ".cr-review-link", function (){
const wc_reviews_tab=jQuery('.reviews_tab a');
if(wc_reviews_tab.length){
wc_reviews_tab.trigger("click");
return true;
}});
jQuery("#cr_review_image").on("change", function (){
jQuery(".cr-upload-images-status").removeClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_initial);
let allowedTypes=['image/jpeg', 'image/png', 'image/jpg', 'image/gif', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/quicktime', 'video/x-msvideo'];
let uploadFiles=jQuery("#cr_review_image");
let countFiles=uploadFiles[0].files.length;
let countUploaded=jQuery(".cr-upload-images-preview .cr-upload-images-containers").length;
let lastIndex=1;
let cr_captcha="";
if(jQuery(this).attr("data-lastindex")){
lastIndex=parseInt(jQuery(this).attr("data-lastindex"));
}
if(countFiles + countUploaded > cr_ajax_object.cr_images_upload_limit){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_too_many);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}
for(let i=0; i < countFiles; i++){
if(!allowedTypes.includes(uploadFiles[0].files[i].type)){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_file_type);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}else if(uploadFiles[0].files[i].size&&uploadFiles[0].files[i].size > cr_ajax_object.cr_images_upload_max_size){
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_error_file_size);
jQuery(".cr-upload-images-preview .cr-upload-images-containers").not(".cr-upload-ok").remove();
uploadFiles.val("");
return;
}else{
let container=jQuery("<div/>", {class:"cr-upload-images-containers cr-upload-images-container-" + (lastIndex + i)});
let progressBar=jQuery("<div/>", {class:"cr-upload-images-pbar"});
progressBar.append(jQuery("<div/>", {class:"cr-upload-images-pbarin"})
);
if(-1===uploadFiles[0].files[i].type.indexOf('image') ){
container.append(jQuery("<svg class='cr-upload-video-thumbnail' viewBox='0 0 576 512'><path d='M336.2 64H47.8C21.4 64 0 85.4 0 111.8v288.4C0 426.6 21.4 448 47.8 448h288.4c26.4 0 47.8-21.4 47.8-47.8V111.8c0-26.4-21.4-47.8-47.8-47.8zm189.4 37.7L416 177.3v157.4l109.6 75.5c21.2 14.6 50.4-.3 50.4-25.8V127.5c0-25.4-29.1-40.4-50.4-25.8z'></path></svg>")
);
}else{
container.append(jQuery("<img>", {class:"cr-upload-images-thumbnail",src:URL.createObjectURL(uploadFiles[0].files[i])})
);
}
container.append(progressBar
);
let removeButton=jQuery("<button/>", {class:"cr-upload-images-delete"});
removeButton.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path class="cr-no-icon" d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"/></g></svg>'
);
container.append(removeButton
);
container.append(jQuery("<input>", {name:"cr-upload-images-ids[]",type:"hidden",value:""})
);
container.append(jQuery("<span/>", {class:"cr-upload-images-delete-spinner"})
);
jQuery(".cr-upload-images-preview").append(container);
}}
for(let i=0; i < countFiles; i++){
let formData=new FormData();
formData.append("action", "cr_upload_local_images_frontend");
formData.append("cr_nonce", jQuery(this).attr("data-nonce"));
formData.append("cr_postid", jQuery(this).attr("data-postid"));
formData.append("cr_file", uploadFiles[0].files[i]);
if(typeof grecaptcha!=="undefined"&&cr_ajax_object.ivole_recaptcha==='1'){
cr_captcha=grecaptcha.getResponse();
grecaptcha.reset();
}
formData.append("cr_captcha", cr_captcha);
jQuery.ajax({
url: cr_ajax_object.ajax_url,
data: formData,
processData: false,
contentType: false,
dataType: "json",
type: "POST",
beforeSend: function(){
},
xhr: function(){
var myXhr=jQuery.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress', function(e){
if(e.lengthComputable){
let perc=(e.loaded / e.total) * 100;
perc=perc.toFixed(0);
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " .cr-upload-images-pbar .cr-upload-images-pbarin").width(perc + "%");
}}, false);
}
return myXhr;
},
success: function(response){
if(200===response["code"]){
let idkey=JSON.stringify({ id: response["attachment"]["id"], key: response["attachment"]["key"] });
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " input").val(idkey);
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).addClass("cr-upload-ok");
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " button").attr("data-delnonce",response["attachment"]["nonce"]);
}else if(500 <=response["code"]){
jQuery(".cr-upload-images-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).remove();
jQuery(".cr-upload-images-status").addClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(response["message"]);
}}
});
}
jQuery(this).attr("data-lastindex", lastIndex + countFiles);
uploadFiles.val("");
});
jQuery(".cr-upload-images-preview").on("click", ".cr-upload-images-delete", function (e){
e.preventDefault();
jQuery(".cr-upload-images-status").removeClass("cr-upload-images-status-error");
jQuery(".cr-upload-images-status").text(cr_ajax_object.cr_upload_initial);
let classList=jQuery(this).parent().eq(0).attr("class").split(/\s+/);
let classes="";
jQuery.each(classList, function(index, item){
classes +="." + item;
});
let ajaxData={
"action": "cr_delete_local_images_frontend",
"cr_nonce": jQuery(this).attr("data-delnonce"),
"image": jQuery(this).parent().children("input").eq(0).val(),
"class": classes
}
jQuery(this).parent().addClass("cr-upload-delete-pending");
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
if(200===response["code"]&&response["class"]){
jQuery(".cr-upload-images-preview " + response["class"]).remove();
}
jQuery(".cr-upload-images-preview " + response["class"]).removeClass("cr-upload-delete-pending");
}, "json");
});
jQuery(".cr-review-form-rating .cr-review-form-rating-inner").on("mouseenter",
function(){
let rating=parseInt(jQuery(this).data("rating") );
let ratingActv=parseInt(jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-actv").data("rating") );
if(isNaN(ratingActv) ){
ratingActv=0;
}
for(r=1; r < 6; r++){
if(r > rating&&r > ratingActv){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(rating + "/5");
}
).on("mouseleave",
function(){
let ratingActv=parseInt(jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-actv").data("rating") );
if(isNaN(ratingActv) ){
ratingActv=0;
}
for(r=1; r < 6; r++){
if(r > ratingActv){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(ratingActv + "/5");
}
);
jQuery(".cr-review-form-rating .cr-review-form-rating-inner").on("click", function(e){
e.preventDefault();
let rating=parseInt(jQuery(this).data("rating") );
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner").removeClass("cr-review-form-rating-actv");
jQuery(this).addClass("cr-review-form-rating-actv");
for(r=1; r < 6; r++){
if(r > rating){
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").show();
}else{
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-deact").hide();
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-inner[data-rating=" + r + "] .cr-rating-act").show();
}}
jQuery(this).closest(".cr-review-form-rating-cont").find(".cr-review-form-rating-nbr").text(rating + "/5");
jQuery(this).closest(".cr-review-form-rating").find(".cr-review-form-rating-inp").val(rating);
jQuery(this).closest(".cr-review-form-rating").removeClass("cr-review-form-error");
});
jQuery(".cr-all-reviews-shortcode .cr-nav-left svg, .cr-all-reviews-shortcode .cr-nav-right svg, .cr-all-reviews-shortcode .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-all-reviews-shortcode").removeClass("cr-all-reviews-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-all-reviews-shortcode .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-all-reviews-shortcode").removeClass("cr-all-reviews-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
window.location.reload();
});
jQuery(".cr-review-form-wrap").on("click", ".cr-review-form-error", function(e){
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
});
jQuery(".cr-ajax-reviews-review-form .cr-nav-left svg, .cr-ajax-reviews-review-form .cr-nav-right svg, .cr-ajax-reviews-review-form .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").show();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").hide();
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-ajax-reviews-review-form .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-reviews-ajax-comments").show();
jQuery(this).closest(".cr-reviews-ajax-reviews").find(".cr-ajax-reviews-review-form").hide();
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
if(window.location.hash!=='#reviews'){
window.location.href=window.location.pathname + '#reviews';
}
window.location.reload();
});
jQuery(".cr-reviews-grid .cr-nav-left svg, .cr-reviews-grid .cr-nav-right svg, .cr-reviews-grid .cr-review-form-cancel").on("click", function(e){
jQuery(this).closest(".cr-reviews-grid").removeClass("cr-reviews-grid-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
});
jQuery(".cr-reviews-grid .cr-review-form-wrap").on("click", ".cr-review-form-success", function(e){
jQuery(this).closest(".cr-reviews-grid").removeClass("cr-reviews-grid-new-review");
jQuery(this).closest(".cr-review-form-wrap").removeClass("cr-review-form-res");
cr_reset_review_form(jQuery(this) );
window.location.reload();
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-nav-left svg, .cr-qna-new-q-form .cr-nav-right svg, .cr-qna-new-q-form .cr-review-form-cancel", function(e){
jQuery(this).closest(".cr-qna-block").removeClass("cr-qna-new-q-form-open");
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
cr_reset_qna_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-review-form-success", function(e){
jQuery(this).closest(".cr-qna-block").removeClass("cr-qna-new-q-form-open");
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
cr_reset_qna_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-new-q-form .cr-review-form-error", function(e){
jQuery(this).closest(".cr-qna-new-q-form").removeClass("cr-review-form-res");
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-nav-left svg, .cr-qna-list-inl-answ .cr-nav-right svg, .cr-qna-list-inl-answ .cr-review-form-cancel", function(e){
jQuery(this).closest(".cr-qna-list-q-b").removeClass("cr-qna-ans-form-open");
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
cr_reset_ans_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-success", function(e){
jQuery(this).closest(".cr-qna-list-q-b").removeClass("cr-qna-ans-form-open");
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
cr_reset_ans_form(jQuery(this) );
});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-error", function(e){
jQuery(this).closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-res");
});
jQuery(".cr-review-form-wrap .cr-review-form-submit").on("click", function(e){
if(0 < jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media-preview .cr-upload-images-containers:not(.cr-upload-ok)").length){
return false;
}
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-onsite-question").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-captcha").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_review_form(jQuery(this) )){
let onsiteQuestions={};
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating input[type='hidden']").each(function(){
onsiteQuestions[jQuery(this).attr('name')]=jQuery(this).val();
}
)
jQuery(this).closest(".cr-review-form-wrap").find(".cr-onsite-question input").each(function(){
onsiteQuestions[jQuery(this).attr('name')]=jQuery(this).val();
}
)
let captchaResponse='';
if(0 < jQuery(this).closest(".cr-review-form-wrap").find('.cr-review-form-captcha .cr-recaptcha').length){
if(grecaptcha){
captchaResponse=grecaptcha.getResponse();
}}
let cr_data={
"action": "cr_submit_review",
"rating": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-rating-overall .cr-review-form-rating-inp").val(),
"review": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"id": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-item-id").val(),
"email": jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val().trim(),
"onsiteQuestions": onsiteQuestions,
"cr-upload-images-ids": jQuery(this).closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-upload-images-containers input").map(function(){
return jQuery(this).val();
}).get(),
'g-recaptcha-response': captchaResponse
};
jQuery(this).closest(".cr-review-form-wrap").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-continue").removeClass("cr-review-form-error");
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: jQuery(this),
success: function(response){
if(! Object.hasOwn(response, 'button') ){
response.button='OK';
}
if(! Object.hasOwn(response, 'description') ){
response.description='An unexpected error that could be caused by a third-party plugin';
}
this.closest(".cr-review-form-wrap").removeClass("cr-review-form-submitting");
this.closest(".cr-review-form-wrap").addClass("cr-review-form-res");
this.closest(".cr-review-form-wrap").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-review-form-wrap").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};});
jQuery(".cr-qna-block .cr-qna-new-q-form").on("click", ".cr-review-form-submit", function(e){
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_qna(jQuery(this) )){
let cr_data={
"action": "cr_new_qna",
"crNonce": jQuery(this).closest(".cr-qna-block").data("nonce"),
"currentPostID": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-item-id").val(),
"text": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"email": jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-email .cr-review-form-txt").val().trim()
};
jQuery(this).closest(".cr-qna-new-q-form").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-qna-new-q-form").find(".cr-review-form-continue").removeClass("cr-review-form-error");
const postQuestion=(token, data, ref)=> {
data.cptcha=token;
jQuery.post({
url: cr_ajax_object.ajax_url,
data: data,
context: jQuery(ref),
success: function(response){
this.closest(".cr-qna-new-q-form").removeClass("cr-review-form-submitting");
this.closest(".cr-qna-new-q-form").addClass("cr-review-form-res");
this.closest(".cr-qna-new-q-form").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-qna-new-q-form").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};
let cr_cptcha=jQuery(this).attr("data-crcptcha");
var rf=this;
if(cr_cptcha&&cr_cptcha.length > 0){
grecaptcha.ready(function(){
grecaptcha.execute(cr_cptcha, {action: 'submit'}).then(function(token){
postQuestion(token, cr_data, rf)
});
});
}else{
postQuestion('', cr_data, rf);
}};});
jQuery(".cr-qna-block").on("click", ".cr-qna-list-inl-answ .cr-review-form-submit", function(e){
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-name").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-email").removeClass("cr-review-form-error");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").removeClass("cr-review-form-error");
if(cr_validate_ans(jQuery(this) )){
let cr_data={
"action": "cr_new_qna",
"crNonce": jQuery(this).closest(".cr-qna-block").data("nonce"),
"currentPostID": jQuery(this).closest(".cr-qna-block").find(".cr-review-form-item-id").val(),
"questionID": jQuery(this).closest(".cr-qna-list-q-b").data("question"),
"productID": jQuery(this).closest(".cr-qna-list-q-b").data("post"),
"text": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val().trim(),
"name": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-name .cr-review-form-txt").val().trim(),
"email": jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-email .cr-review-form-txt").val().trim()
};
jQuery(this).closest(".cr-qna-list-inl-answ").addClass("cr-review-form-submitting");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").removeClass("cr-review-form-success");
jQuery(this).closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").removeClass("cr-review-form-error");
const postQuestion=(token, data, ref)=> {
data.cptcha=token;
jQuery.post({
url: cr_ajax_object.ajax_url,
data: data,
context: jQuery(ref),
success: function(response){
this.closest(".cr-qna-list-inl-answ").removeClass("cr-review-form-submitting");
this.closest(".cr-qna-list-inl-answ").addClass("cr-review-form-res");
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-result span").html(response.description);
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").html(response.button);
if(0===response.code){
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").addClass("cr-review-form-success");
}else{
this.closest(".cr-qna-list-inl-answ").find(".cr-review-form-continue").addClass("cr-review-form-error");
}},
dataType: "json"
}
);
};
let cr_cptcha=jQuery(this).attr("data-crcptcha");
var rf=this;
if(cr_cptcha&&cr_cptcha.length > 0&&grecaptcha){
grecaptcha.ready(function(){
grecaptcha.execute(cr_cptcha, {action: 'submit'}).then(function(token){
postQuestion(token, cr_data, rf)
});
});
}else{
postQuestion('', cr_data, rf);
}};});
jQuery(".cr-single-product-review").on("click", ".cr-single-product-rev-submit", function(t){
let validationResult=true;
let reviewForm=jQuery(this).closest(".cr-single-product-review");
reviewForm.find(".cr-review-form-rating-cont.cr-review-form-rating-req").each(function(index){
if(1 > jQuery(this).find(".cr-review-form-rating-actv").length){
jQuery(this).closest(".cr-review-form-rating").addClass("cr-review-form-error");
validationResult=false;
}});
reviewForm.find(".cr-onsite-question.cr-review-form-que-req").each(function(index){
if(1 > jQuery(this).find("input[type=text]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}});
reviewForm.find(".cr-review-form-textbox").each(function(index){
if(1 > jQuery(this).val().trim().length){
jQuery(this).addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).removeClass("cr-review-form-error");
}});
if(0 < reviewForm.find('.cr-review-form-terms').length){
if(! reviewForm.find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
alert('Please tick the checkbox to proceed');
validationResult=false;
}}
if(! validationResult){
t.preventDefault();
}});
jQuery(".cr-all-reviews-add-review").on("click", function(t){
t.preventDefault();
if(0 < jQuery(this).closest(".cr-all-reviews-shortcode").length){
jQuery(this).closest(".cr-all-reviews-shortcode").addClass("cr-all-reviews-new-review");
}
if(0 < jQuery(this).closest(".cr-reviews-grid").length){
jQuery(this).closest(".cr-reviews-grid").addClass("cr-reviews-grid-new-review");
}});
jQuery(".cr-review-form-wrap .cr-form-item-media-none").on("click", function(t){
jQuery(this).parent().find("input.cr-form-item-media-file").trigger("click");
});
jQuery(".cr-review-form-wrap .cr-form-item-media-preview").on("click", ".cr-form-item-media-add", function(t){
jQuery(this).parents(".cr-form-item-media").find("input.cr-form-item-media-file").trigger("click");
});
jQuery(".cr-review-form-wrap .cr-form-item-media .cr-form-item-media-file").on("change", function (){
let allowedTypes=['image/jpeg', 'image/png', 'image/jpg', 'image/gif', 'video/mp4', 'video/mpeg', 'video/ogg', 'video/webm', 'video/quicktime', 'video/x-msvideo'],
uploadFiles=jQuery(this),
countFiles=uploadFiles[0].files.length,
lastIndex=1,
mediaPreview=jQuery(this).parent().find(".cr-form-item-media-preview"),
countUploaded=mediaPreview.children(".cr-upload-images-containers").length;
jQuery(this).closest(".cr-form-item-media").removeClass("cr-review-form-error");
if(jQuery(this).attr("data-lastindex")){
lastIndex=parseInt(jQuery(this).attr("data-lastindex") );
}
if(countFiles + countUploaded > cr_ajax_object.cr_images_upload_limit){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_too_many);
uploadFiles.val("");
return;
}
for(let i=0; i < countFiles; i++){
if(!allowedTypes.includes(uploadFiles[0].files[i].type)){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_file_type);
uploadFiles.val("");
return;
}else if(uploadFiles[0].files[i].size&&uploadFiles[0].files[i].size > cr_ajax_object.cr_images_upload_max_size * 100){
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(cr_ajax_object.cr_upload_error_file_size);
uploadFiles.val("");
return;
}else{
let container=jQuery("<div/>", {class:"cr-upload-images-containers cr-upload-images-container-" + (lastIndex + i)});
let progressBar=jQuery("<div/>", {class:"cr-upload-images-pbar"});
progressBar.append(jQuery("<div/>", {class:"cr-upload-images-pbarin"})
);
if(-1===uploadFiles[0].files[i].type.indexOf('image') ){
container.append(jQuery("<svg class='cr-upload-video-thumbnail' viewBox='0 0 576 512'><path d='M336.2 64H47.8C21.4 64 0 85.4 0 111.8v288.4C0 426.6 21.4 448 47.8 448h288.4c26.4 0 47.8-21.4 47.8-47.8V111.8c0-26.4-21.4-47.8-47.8-47.8zm189.4 37.7L416 177.3v157.4l109.6 75.5c21.2 14.6 50.4-.3 50.4-25.8V127.5c0-25.4-29.1-40.4-50.4-25.8z'></path></svg>")
);
}else{
container.append(jQuery("<img>", {class:"cr-upload-images-thumbnail", src:URL.createObjectURL(uploadFiles[0].files[i])})
);
}
container.append(progressBar
);
let removeButton=jQuery("<button/>", {class:"cr-upload-images-delete"});
removeButton.append('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><rect x="0" fill="none" width="20" height="20"/><g><path class="cr-no-icon" d="M12.12 10l3.53 3.53-2.12 2.12L10 12.12l-3.54 3.54-2.12-2.12L7.88 10 4.34 6.46l2.12-2.12L10 7.88l3.54-3.53 2.12 2.12z"/></g></svg>'
);
container.append(removeButton
);
container.append(jQuery("<input>", {name:"cr-upload-images-ids[]",type:"hidden",value:""})
);
container.append(jQuery("<span/>", {class:"cr-upload-images-delete-spinner"})
);
mediaPreview.find(".cr-form-item-media-add").remove();
mediaPreview.append(container);
if(countFiles + countUploaded < cr_ajax_object.cr_images_upload_limit){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}
}
if(0 < mediaPreview.children(".cr-upload-images-containers").length&&! mediaPreview.hasClass("cr-form-visible") ){
mediaPreview.parents(".cr-form-item-subcontainer").addClass("cr-form-visible");
}
for(let i=0; i < countFiles; i++){
let formData=new FormData();
formData.append("action", "cr_upload_media");
formData.append("cr_file", uploadFiles[0].files[i]);
formData.append("cr_item", jQuery(this).closest(".cr-review-form-wrap").find(".cr-review-form-item-id").val());
formData.append("cr_nonce", jQuery(this).closest(".cr-review-form-wrap").data("nonce") );
var currentFileInput=jQuery(this);
jQuery.ajax({
url: cr_ajax_object.ajax_url,
data: formData,
processData: false,
contentType: false,
dataType: "json",
type: "POST",
context: this,
beforeSend: function(){
},
xhr: function(){
var myXhr=jQuery.ajaxSettings.xhr();
if(myXhr.upload){
myXhr.upload.addEventListener('progress', function(e){
if(e.lengthComputable){
let perc=(e.loaded / e.total) * 100;
perc=perc.toFixed(0);
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " .cr-upload-images-pbar .cr-upload-images-pbarin").width(perc + "%");
}}, false);
}
return myXhr;
},
success: function(response){
if(200===response["code"]){
let idkey=JSON.stringify({ "id": response["attachment"]["id"], "key": response["attachment"]["key"] });
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i) + " input").val(idkey);
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).addClass("cr-upload-ok");
}else if(500 <=response["code"]){
currentFileInput.parent().find(".cr-form-item-media-preview .cr-upload-images-containers.cr-upload-images-container-" + (lastIndex + i)).remove();
let mediaPreview=jQuery(this).closest(".cr-form-item-media").find(".cr-form-item-media-preview");
let countUploaded=mediaPreview.find(".cr-upload-images-containers").length;
if(0 < countUploaded){
if(0===mediaPreview.children(".cr-form-item-media-add").length){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}else{
mediaPreview.removeClass("cr-form-visible");
mediaPreview.parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
}
jQuery(this).closest(".cr-form-item-media").addClass("cr-review-form-error");
jQuery(this).closest(".cr-form-item-media").find(".cr-review-form-field-error").text(response["message"]);
}}
});
}
jQuery(this).attr("data-lastindex", lastIndex + countFiles);
uploadFiles.val("");
});
jQuery(".cr-review-form-wrap .cr-form-item-media-preview").on("click", ".cr-upload-images-delete", function (e){
e.preventDefault();
let imgContainer=jQuery(this).parent(),
mediaPreview=imgContainer.parent();
let ajaxData={
"action": "cr_delete_media",
"image": jQuery(this).parent().children("input").eq(0).val()
}
imgContainer.addClass("cr-upload-delete-pending");
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
imgContainer.removeClass("cr-upload-delete-pending");
if(200===response["code"]){
imgContainer.remove();
let countUploaded=mediaPreview.children(".cr-upload-images-containers").length;
if(0 < countUploaded){
if(0===mediaPreview.children(".cr-form-item-media-add").length){
mediaPreview.append(jQuery("<div class='cr-form-item-media-add'>+</div>")
);
}}else{
mediaPreview.removeClass("cr-form-visible");
mediaPreview.parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
}}
}, "json");
});
cr_maybe_download_media_frontend();
if("object"===typeof elementorFrontend&&"hooks" in elementorFrontend){
elementorFrontend.hooks.addAction("frontend/element_ready/widget", function($scope){
if(-1!==$scope.data("widget_type").indexOf("shortcode") ){
if(0 < $scope.find(".cr-reviews-grid-inner").length){
crResizeAllGridItems();
}}
});
}});
const crValidateEmail=(email)=> {
return email.match(/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
);
};
function initVoteClick(sel1, sel2, action){
jQuery(sel1).on("click", sel2, function(e){
e.preventDefault();
let reviewIDhtml=jQuery(this).data("vote");
let parent=jQuery(this).parents(".cr-voting-cont-uni");
if(reviewIDhtml!=null){
let reviewID=reviewIDhtml;
let data={
"action": action,
"reviewID": reviewID,
"upvote": jQuery(this).data("upvote")
};
parent.find(".cr-voting-a").removeClass("cr-voting-active");
parent.find(".cr-voting-a").addClass("cr-voting-update");
jQuery.post(cr_ajax_object.ajax_url, data, function(response){
parent.find(".cr-voting-a").removeClass("cr-voting-update");
if(response.code===0){
if(response.votes){
parent.find(".cr-voting-upvote-count").text("(" +  response.votes.upvotes + ")");
parent.find(".cr-voting-downvote-count").text("(" +  response.votes.downvotes + ")");
}
if(0!==response.votes.current){
if(0 < response.votes.current){
parent.find(".cr-voting-upvote").addClass("cr-voting-active");
}else{
parent.find(".cr-voting-downvote").addClass("cr-voting-active");
}}
}}, "json");
}});
}
function cr_keyup_delay(fn, ms){
let timer=0;
return function(...args){
clearTimeout(timer);
timer=setTimeout(fn.bind(this, ...args), ms||0);
};}
function cr_filter_all_reviews(refElement, show_more=false){
let attributes=refElement.parents(".cr-all-reviews-shortcode").data("attributes"),
cr_rating=refElement.parents(".cr-all-reviews-shortcode").find(".ivole-summaryBox .ivole-histogramRow.ivole-histogramRow-s .cr-histogram-a").attr("data-rating"),
cr_search=refElement.parents(".cr-all-reviews-shortcode").find(".cr-ajax-search input").val(),
cr_sort=refElement.parents(".cr-all-reviews-shortcode").find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_tags=[];
refElement.parents(".cr-all-reviews-shortcode").find(".cr-review-tags-filter .cr-tags-filter.cr-tag-selected").each(function(){
cr_tags.push(jQuery(this).attr("data-crtagid"));
}
);
let cr_data={
"action": "cr_show_more_all_reviews",
"attributes": attributes,
"rating": cr_rating,
"page": 0,
"search": cr_search,
"sort": cr_sort,
"tags": cr_tags
};
if(show_more){
cr_data.page=refElement.data("page");
jQuery(".cr-search-no-reviews").hide();
jQuery('.cr-show-more-button').hide();
if(refElement.hasClass("cr-page-numbers-a") ){
refElement.closest(".cr-all-reviews-shortcode").find(".commentlist").addClass("cr-pagination-load");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-all-reviews-pagination").addClass("cr-pagination-load");
}else{
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-review-spinner").show();
}
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
let shcode=jQuery(this).closest(".cr-all-reviews-shortcode");
shcode.find(".cr-show-more-review-spinner").hide();
if(response.html!==""){
if(jQuery(this).hasClass("cr-page-numbers-a") ){
shcode.find(".commentlist").find("*").not(".cr-pagination-review-spinner").remove();
shcode.find(".commentlist").prepend(response.html);
}else{
shcode.find(".commentlist").append(response.html);
}
if(! response.last_page){
shcode.find(".cr-show-more-button").text(response.show_more_label);
shcode.find(".cr-show-more-button").show();
}
shcode.find(".cr-show-more-button").data("page", response.page);
shcode.find(".cr-count-row .cr-count-row-count").html(response.count_row);
if(response.pagination!==""){
shcode.find(".cr-all-reviews-pagination").html(response.pagination);
}}else{
shcode.find(".cr-show-more-button").hide();
}
if(response.html==""&&response.page===1){
shcode.find(".cr-search-no-reviews").show();
}
shcode.find(".commentlist").removeClass("cr-pagination-load");
shcode.find(".cr-all-reviews-pagination").removeClass("cr-pagination-load");
},
dataType: "json"
}
);
}else{
refElement.closest(".cr-all-reviews-shortcode").find(".cr-search-no-reviews").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-button").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".commentlist").hide();
refElement.closest(".cr-all-reviews-shortcode").find(".cr-show-more-review-spinner").show();
refElement.closest(".cr-all-reviews-shortcode").find(".ivole-summaryBox").addClass("cr-summaryBar-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-seeAllReviews").addClass("cr-seeAll-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-review-tags-filter").addClass("cr-tags-updating");
refElement.closest(".cr-all-reviews-shortcode").find(".cr-all-reviews-pagination").hide();
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
let shcode=jQuery(this).closest(".cr-all-reviews-shortcode");
shcode.find(".cr-show-more-review-spinner").hide();
shcode.find(".ivole-summaryBox").removeClass("cr-summaryBar-updating");
shcode.find(".cr-seeAllReviews").removeClass("cr-seeAll-updating");
shcode.find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
shcode.find(".cr-review-tags-filter").removeClass("cr-tags-updating");
if(response.html!==""){
shcode.find(".commentlist").empty();
shcode.find(".commentlist").append(response.html);
shcode.find(".commentlist").show();
shcode.find(".cr-show-more-button").data("page",response.page);
if(!response.last_page){
shcode.find(".cr-show-more-button").text(response.show_more_label);
shcode.find(".cr-show-more-button").show();
}}else{
shcode.find(".cr-search-no-reviews").show();
}
shcode.find(".cr-count-row .cr-count-row-count").html(response.count_row);
shcode.find(".cr-all-reviews-pagination").html(response.pagination);
shcode.find(".cr-all-reviews-pagination").show();
},
dataType: "json"
}
);
}}
function cr_maybe_download_media_frontend(){
jQuery(".cr-comment-image-ext,.cr-comment-video-ext").each(function(){
let ajaxData={
"action": "cr_auto_download_media_frontend",
"reviewID": jQuery(this).data("reviewid")
}
jQuery.post(cr_ajax_object.ajax_url, ajaxData, function(response){
}, "json");
return false;
});
}
function cr_validate_review_form(submitBtn){
let validationResult=true;
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont.cr-review-form-rating-req").each(function(index){
if(1 > jQuery(this).find(".cr-review-form-rating-actv").length){
jQuery(this).closest(".cr-review-form-rating").addClass("cr-review-form-error");
validationResult=false;
}});
if(1 > submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
submitBtn.closest(".cr-review-form-wrap").find(".cr-onsite-question.cr-review-form-que-req").each(function(index){
if(0 < jQuery(this).find("input[type=text]").length){
if(1 > jQuery(this).find("input[type=text]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}}
if(0 < jQuery(this).find("input[type=number]").length){
if(1 > jQuery(this).find("input[type=number]").val().trim().length){
jQuery(this).closest(".cr-onsite-question").addClass("cr-review-form-error");
validationResult=false;
}else{
jQuery(this).closest(".cr-onsite-question").removeClass("cr-review-form-error");
}}
});
if(0 < submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
if(0 < submitBtn.closest(".cr-review-form-wrap").find('.cr-review-form-captcha .cr-recaptcha').length){
if(grecaptcha){
let widgetId=0;
if(0 < jQuery(".cr-review-form-captcha .cr-recaptcha").length){
jQuery(".cr-review-form-captcha .cr-recaptcha").each(function(index){
if(submitBtn.closest('.cr-review-form-wrap').find('.cr-review-form-captcha .cr-recaptcha').data('crcaptchaid')===jQuery(this).data('crcaptchaid')
){
widgetId=index;
}}
);
}
let captchaCheck="";
if(0 < widgetId){
captchaCheck=grecaptcha.getResponse(widgetId);
}else{
captchaCheck=grecaptcha.getResponse();
}
if(! captchaCheck.length > 0){
submitBtn.closest(".cr-review-form-wrap").find(".cr-review-form-captcha").addClass("cr-review-form-error");
validationResult=false;
}}
}
return validationResult;
}
function cr_validate_qna(submitBtn){
let validationResult=true;
if(1 > submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
if(0 < submitBtn.closest(".cr-qna-new-q-form").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-qna-new-q-form").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-qna-new-q-form").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
return validationResult;
}
function cr_validate_ans(submitBtn){
let validationResult=true;
if(1 > submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val().trim().length){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").addClass("cr-review-form-error");
validationResult=false;
}
if(1 > submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name .cr-review-form-txt").val().trim().length){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name").addClass("cr-review-form-error");
validationResult=false;
}
if(! crValidateEmail(submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email .cr-review-form-txt").val().trim()) ){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email").addClass("cr-review-form-error");
validationResult=false;
}
if(0 < submitBtn.closest(".cr-qna-list-inl-answ").find('.cr-review-form-terms').length){
if(! submitBtn.closest(".cr-qna-list-inl-answ").find('.cr-review-form-terms .cr-review-form-checkbox').is(':checked')){
submitBtn.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").addClass("cr-review-form-error");
validationResult=false;
}}
return validationResult;
}
function cr_reset_review_form(refElement){
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner").removeClass("cr-review-form-rating-actv");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner .cr-rating-act").hide();
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-inner .cr-rating-deact").show();
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating-cont .cr-review-form-rating-nbr").text("0/5");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-rating").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-comment-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-comment").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-name .cr-review-form-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-name").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-email .cr-review-form-txt").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-email").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question input[type='text']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-questions .cr-onsite-question input[type='number']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question input[type='text']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-onsite-key-question input[type='number']").val('');
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-upload-images-containers").remove();
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-form-item-media-preview").removeClass("cr-form-visible");
refElement.closest(".cr-review-form-wrap").find(".cr-form-item-media .cr-form-item-media-preview").parents(".cr-form-item-subcontainer").removeClass("cr-form-visible");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-terms").removeClass("cr-review-form-error");
refElement.closest(".cr-review-form-wrap").find(".cr-review-form-captcha").removeClass("cr-review-form-error");
}
function cr_reset_qna_form(refElement){
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-comment-txt").val('');
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-comment").removeClass("cr-review-form-error");
const nameField=refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-name");
nameField.find(".cr-review-form-txt").val(nameField.find(".cr-review-form-txt").data('defval'));
nameField.removeClass("cr-review-form-error");
const emailField=refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-email");
emailField.find(".cr-review-form-txt").val(emailField.find(".cr-review-form-txt").data('defval'));
emailField.removeClass("cr-review-form-error");
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-qna-new-q-form").find(".cr-review-form-terms").removeClass("cr-review-form-error");
}
function cr_reset_ans_form(refElement){
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment-txt").val("");
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-comment").removeClass("cr-review-form-error");
const nameField=refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-name");
nameField.find(".cr-review-form-txt").val("");
nameField.removeClass("cr-review-form-error");
const emailField=refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-email");
emailField.find(".cr-review-form-txt").val("");
emailField.removeClass("cr-review-form-error");
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms .cr-review-form-checkbox").prop('checked', false);
refElement.closest(".cr-qna-list-inl-answ").find(".cr-review-form-terms").removeClass("cr-review-form-error");
}
function crDebounce(callback, wait){
let timeout;
return (...args)=> {
clearTimeout(timeout);
if(0 < args.length&&13===args[0].keyCode){
wait=0;
}else{
wait=1000;
}
timeout=setTimeout(function (){ callback.apply(this, args); }, wait);
};}
function crShowMoreReviewsPrd(refElement){
let cr_product_id=refElement.parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").attr("data-product");
let cr_nonce=refElement.parents(".cr-reviews-ajax-comments").attr("data-nonce");
let cr_page=refElement.parents(".cr-reviews-ajax-comments").attr("data-page");
let cr_sort=refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").children("option:selected").val();
let cr_rating=refElement.parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax tr.ivole-histogramRow.ivole-histogramRow-s a.ivole-histogram-a").attr("data-rating");
let cr_search=refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-search input").val();
let cr_tags=[];
refElement.parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter .cr-tags-filter.cr-tag-selected").each(function(){
cr_tags.push(jQuery(this).attr("data-crtagid"));
}
);
if(! cr_rating){
cr_rating=0;
}
let cr_data={
"action": "cr_show_more_reviews",
"productID": cr_product_id,
"page": cr_page,
"sort": cr_sort,
"rating": cr_rating,
"search": cr_search,
"tags": cr_tags,
"security": cr_nonce
};
refElement.parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").addClass("cr-summaryBar-updating");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").addClass("cr-sort-updating");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter").addClass("cr-review-tags-filter-disabled");
refElement.parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").hide();
refElement.parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").hide();
refElement.parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").show();
jQuery.post({
url: cr_ajax_object.ajax_url,
data: cr_data,
context: refElement,
success: function(response){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-review-spinner").hide();
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-summaryBox-ajax").removeClass("cr-summaryBar-updating");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-ajax-reviews-sort").removeClass("cr-sort-updating");
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-review-tags-filter").removeClass("cr-review-tags-filter-disabled");
if(response.page > 0){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".commentlist.cr-ajax-reviews-list").append(response.html);
jQuery(this).parents(".cr-reviews-ajax-comments").attr("data-page",response.page);
if(response.show_more_label){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").text(response.show_more_label);
}
if(response.count_row){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-count-row .cr-count-row-count").html(response.count_row);
}
if(! response.last_page){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-show-more-reviews-prd").show();
}
cr_maybe_download_media_frontend();
}
if(response.html==null&&response.page===1){
jQuery(this).parents(".cr-reviews-ajax-comments").find(".cr-search-no-reviews").show();
}},
dataType: "json"
});
}})();
function crResizeAllGridItemsUtil(grids){
jQuery(grids).each(function(){
if(800 > jQuery(this).width()){
jQuery(this).find(".cr-reviews-grid-col3").addClass("cr-reviews-grid-col-none");
}
if(550 > jQuery(this).width()){
jQuery(this).find(".cr-reviews-grid-col2").addClass("cr-reviews-grid-col-none");
}
jQuery(this).colcade({
columns: ".cr-reviews-grid-col",
items: ".cr-review-card"
});
});
}
function crResizeAllGridItems(){
if(typeof Colcade!=="undefined" &&
typeof Colcade.makeJQueryPlugin!=="undefined" &&
typeof Colcade.makeJQueryPlugin==="function"
){
if(! typeof jQuery.fn.colcade==="function" ||
typeof jQuery.fn.colcade==="undefined"
){
Colcade.makeJQueryPlugin();
}}
crResizeAllGridItemsUtil(jQuery(".cr-reviews-grid-inner"));
}
function crResizeTrustBadges(){
jQuery(".cr-trustbadgef").each(function(){
let badge=jQuery(this).find(".cr-badge").eq(0);
let scale=jQuery(this).width() / badge.outerWidth();
if(1 > scale){
badge.css("transform", "scale(" + scale + ")");
}
badge.css("visibility", "visible");
});
};
(function(window, factory){
if(typeof define=='function'&&define.amd){
define(factory);
}else if(typeof module=='object'&&module.exports){
module.exports=factory();
}else{
window.Colcade=factory();
}}(window, function factory(){
function Colcade(element, options){
element=getQueryElement(element);
if(element&&element.colcadeGUID){
var instance=instances[ element.colcadeGUID ];
instance.option(options);
return instance;
}
this.element=element;
this.options={};
this.option(options);
this.lastAppend=[];
this.lastColumnHeights=[];
this.create();
element.classList.add('cr-colcade-loaded');
}
var proto=Colcade.prototype;
proto.option=function(options){
this.options=extend(this.options, options);
};
var GUID=0;
var instances={};
proto.create=function(){
this.errorCheck();
var guid=this.guid=++GUID;
this.element.colcadeGUID=guid;
instances[ guid ]=this;
this.reload();
this._windowResizeHandler=this.onWindowResize.bind(this);
this._loadHandler=this.onLoad.bind(this);
window.addEventListener('resize', this._windowResizeHandler);
this.element.addEventListener('load', this._loadHandler, true);
};
proto.errorCheck=function(){
var errors=[];
if(!this.element){
errors.push('Bad element: ' + this.element);
}
if(!this.options.columns){
errors.push('columns option required: ' + this.options.columns);
}
if(!this.options.items){
errors.push('items option required: ' + this.options.items);
}
if(errors.length){
throw new Error('[Colcade error] ' + errors.join('. '));
}};
proto.reload=function(){
this.updateColumns();
this.updateItems();
this.layout();
};
proto.updateColumns=function(){
this.columns=querySelect(this.options.columns, this.element);
};
proto.updateItems=function(){
this.items=querySelect(this.options.items, this.element);
};
proto.getActiveColumns=function(){
return this.columns.filter(function(column){
var style=getComputedStyle(column);
return style.display!='none';
});
};
proto.layout=function(){
this.activeColumns=this.getActiveColumns();
this._layout();
};
proto._layout=function(){
this.columnHeights=this.activeColumns.map(function(){
return 0;
});
this.layoutItems(this.items);
};
proto.layoutItems=function(items){
items.forEach(this.layoutItem, this);
};
proto.layoutItem=function(item){
var minHeight=Math.min.apply(Math, this.columnHeights);
var index=this.columnHeights.indexOf(minHeight);
this.activeColumns[ index ].appendChild(item);
this.columnHeights[ index ] +=item.offsetHeight||1;
};
proto.append=function(elems){
var items=this.getQueryItems(elems);
this.items=this.items.concat(items);
this.lastAppend.length=0;
this.lastAppend=items.slice();
this.lastColumnHeights.length=0;
this.lastColumnHeights=this.columnHeights.slice();
this.layoutItems(items);
};
proto.prepend=function(elems){
var items=this.getQueryItems(elems);
this.items=items.concat(this.items);
this._layout();
};
proto.getQueryItems=function(elems){
elems=makeArray(elems);
var fragment=document.createDocumentFragment();
elems.forEach(function(elem){
fragment.appendChild(elem);
});
return querySelect(this.options.items, fragment);
};
proto.empty=function(){
this.lastAppend.length=0;
this.lastColumnHeights.length=0;
this.items.forEach(function(item){
item.remove();
}, this);
this.items.length=0;
this._layout();
};
proto.measureColumnHeight=function(elem){
var boundingRect=this.element.getBoundingClientRect();
this.activeColumns.forEach(function(column, i){
if(!elem||column.contains(elem) ){
var lastChildRect=column.lastElementChild.getBoundingClientRect();
this.columnHeights[ i ]=lastChildRect.bottom - boundingRect.top;
}}, this);
};
proto.onWindowResize=function(){
clearTimeout(this.resizeTimeout);
this.resizeTimeout=setTimeout(function(){
this.onDebouncedResize();
}.bind(this), 100);
};
proto.onDebouncedResize=function(){
var activeColumns=this.getActiveColumns();
var isSameLength=activeColumns.length==this.activeColumns.length;
var isSameColumns=true;
this.activeColumns.forEach(function(column, i){
isSameColumns=isSameColumns&&column==activeColumns[i];
});
if(isSameLength&&isSameColumns){
return;
}
this.activeColumns=activeColumns;
this._layout();
};
proto.onLoad=function(event){
this.measureColumnHeight(event.target);
if(0 < this.lastColumnHeights.length&&0 < this.lastAppend.length){
this.columnHeights.length=0;
this.columnHeights=this.lastColumnHeights.slice();
this.layoutItems(this.lastAppend);
}};
proto.destroy=function(){
this.items.forEach(function(item){
this.element.appendChild(item);
}, this);
window.removeEventListener('resize', this._windowResizeHandler);
this.element.removeEventListener('load', this._loadHandler, true);
delete this.element.colcadeGUID;
delete instances[ this.guid ];
};
docReady(function(){
var dataElems=querySelect('[data-colcade]');
dataElems.forEach(htmlInit);
});
function htmlInit(elem){
var attr=elem.getAttribute('data-colcade');
var attrParts=attr.split(',');
var options={};
attrParts.forEach(function(part){
var pair=part.split(':');
var key=pair[0].trim();
var value=pair[1].trim();
options[ key ]=value;
});
new Colcade(elem, options);
}
Colcade.data=function(elem){
elem=getQueryElement(elem);
var id=elem&&elem.colcadeGUID;
return id&&instances[ id ];
};
Colcade.makeJQueryPlugin=function($){
$=$||window.jQuery;
if(!$){
return;
}
$.fn.colcade=function(arg0 ){
if(typeof arg0=='string'){
var args=Array.prototype.slice.call(arguments, 1);
return methodCall(this, arg0, args);
}
plainCall(this, arg0);
return this;
};
function methodCall($elems, methodName, args){
var returnValue;
$elems.each(function(i, elem){
var colcade=$.data(elem, 'colcade');
if(!colcade){
return;
}
var value=colcade[ methodName ].apply(colcade, args);
returnValue=returnValue===undefined ? value:returnValue;
});
return returnValue!==undefined ? returnValue:$elems;
}
function plainCall($elems, options){
$elems.each(function(i, elem){
var colcade=$.data(elem, 'colcade');
if(colcade){
colcade.option(options);
colcade.layout();
}else{
colcade=new Colcade(elem, options);
$.data(elem, 'colcade', colcade);
}});
}};
Colcade.makeJQueryPlugin();
function extend(a, b){
for(var prop in b){
a[ prop ]=b[ prop ];
}
return a;
}
function makeArray(obj){
var ary=[];
if(Array.isArray(obj) ){
ary=obj;
}else if(obj&&typeof obj.length=='number'){
for(var i=0; i < obj.length; i++){
ary.push(obj[i]);
}}else{
ary.push(obj);
}
return ary;
}
function querySelect(selector, elem){
elem=elem||document;
var elems=elem.querySelectorAll(selector);
return makeArray(elems);
}
function getQueryElement(elem){
if(typeof elem=='string'){
elem=document.querySelector(elem);
}
return elem;
}
function docReady(onReady){
if(document.readyState=='complete'){
onReady();
return;
}
document.addEventListener('DOMContentLoaded', onReady);
}
return Colcade;
}));
!function(){"use strict";function e(e){e.fn._fadeIn=e.fn.fadeIn;var t=e.noop||function(){},o=/MSIE/.test(navigator.userAgent),n=/MSIE 6.0/.test(navigator.userAgent)&&!/MSIE 8.0/.test(navigator.userAgent),i=(document.documentMode,"function"==typeof document.createElement("div").style.setExpression&&document.createElement("div").style.setExpression);e.blockUI=function(e){d(window,e)},e.unblockUI=function(e){a(window,e)},e.growlUI=function(t,o,n,i){var s=e('<div class="growlUI"></div>');t&&s.append("<h1>"+t+"</h1>"),o&&s.append("<h2>"+o+"</h2>"),n===undefined&&(n=3e3);var l=function(t){t=t||{},e.blockUI({message:s,fadeIn:"undefined"!=typeof t.fadeIn?t.fadeIn:700,fadeOut:"undefined"!=typeof t.fadeOut?t.fadeOut:1e3,timeout:"undefined"!=typeof t.timeout?t.timeout:n,centerY:!1,showOverlay:!1,onUnblock:i,css:e.blockUI.defaults.growlCSS})};l();s.css("opacity");s.on("mouseover",function(){l({fadeIn:0,timeout:3e4});var t=e(".blockMsg");t.stop(),t.fadeTo(300,1)}).on("mouseout",function(){e(".blockMsg").fadeOut(1e3)})},e.fn.block=function(t){if(this[0]===window)return e.blockUI(t),this;var o=e.extend({},e.blockUI.defaults,t||{});return this.each(function(){var t=e(this);o.ignoreIfBlocked&&t.data("blockUI.isBlocked")||t.unblock({fadeOut:0})}),this.each(function(){"static"==e.css(this,"position")&&(this.style.position="relative",e(this).data("blockUI.static",!0)),this.style.zoom=1,d(this,t)})},e.fn.unblock=function(t){return this[0]===window?(e.unblockUI(t),this):this.each(function(){a(this,t)})},e.blockUI.version=2.7,e.blockUI.defaults={message:"<h1>Please wait...</h1>",title:null,draggable:!0,theme:!1,css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},themedCSS:{width:"30%",top:"40%",left:"35%"},overlayCSS:{backgroundColor:"#000",opacity:.6,cursor:"wait"},cursorReset:"default",growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:.6,cursor:"default",color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px","border-radius":"10px"},iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank",forceIframe:!1,baseZ:1e3,centerX:!0,centerY:!0,allowBodyStretch:!0,bindEvents:!0,constrainTabKey:!0,fadeIn:200,fadeOut:400,timeout:0,showOverlay:!0,focusInput:!0,focusableElements:":input:enabled:visible",onBlock:null,onUnblock:null,onOverlayClick:null,quirksmodeOffsetHack:4,blockMsgClass:"blockMsg",ignoreIfBlocked:!1};var s=null,l=[];function d(d,c){var u,b,h=d==window,k=c&&c.message!==undefined?c.message:undefined;if(!(c=e.extend({},e.blockUI.defaults,c||{})).ignoreIfBlocked||!e(d).data("blockUI.isBlocked")){if(c.overlayCSS=e.extend({},e.blockUI.defaults.overlayCSS,c.overlayCSS||{}),u=e.extend({},e.blockUI.defaults.css,c.css||{}),c.onOverlayClick&&(c.overlayCSS.cursor="pointer"),b=e.extend({},e.blockUI.defaults.themedCSS,c.themedCSS||{}),k=k===undefined?c.message:k,h&&s&&a(window,{fadeOut:0}),k&&"string"!=typeof k&&(k.parentNode||k.jquery)){var y=k.jquery?k[0]:k,m={};e(d).data("blockUI.history",m),m.el=y,m.parent=y.parentNode,m.display=y.style.display,m.position=y.style.position,m.parent&&m.parent.removeChild(y)}e(d).data("blockUI.onUnblock",c.onUnblock);var g,v,I,w,U=c.baseZ;g=o||c.forceIframe?e('<iframe class="blockUI" style="z-index:'+U+++';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="'+c.iframeSrc+'"></iframe>'):e('<div class="blockUI" style="display:none"></div>'),v=c.theme?e('<div class="blockUI blockOverlay ui-widget-overlay" style="z-index:'+U+++';display:none"></div>'):e('<div class="blockUI blockOverlay" style="z-index:'+U+++';display:none;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>'),c.theme&&h?(w='<div class="blockUI '+c.blockMsgClass+' blockPage ui-dialog ui-widget ui-corner-all" style="z-index:'+(U+10)+';display:none;position:fixed">',c.title&&(w+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(c.title||"&nbsp;")+"</div>"),w+='<div class="ui-widget-content ui-dialog-content"></div>',w+="</div>"):c.theme?(w='<div class="blockUI '+c.blockMsgClass+' blockElement ui-dialog ui-widget ui-corner-all" style="z-index:'+(U+10)+';display:none;position:absolute">',c.title&&(w+='<div class="ui-widget-header ui-dialog-titlebar ui-corner-all blockTitle">'+(c.title||"&nbsp;")+"</div>"),w+='<div class="ui-widget-content ui-dialog-content"></div>',w+="</div>"):w=h?'<div class="blockUI '+c.blockMsgClass+' blockPage" style="z-index:'+(U+10)+';display:none;position:fixed"></div>':'<div class="blockUI '+c.blockMsgClass+' blockElement" style="z-index:'+(U+10)+';display:none;position:absolute"></div>',I=e(w),k&&(c.theme?(I.css(b),I.addClass("ui-widget-content")):I.css(u)),c.theme||v.css(c.overlayCSS),v.css("position",h?"fixed":"absolute"),(o||c.forceIframe)&&g.css("opacity",0);var x=[g,v,I],C=e(h?"body":d);e.each(x,function(){this.appendTo(C)}),c.theme&&c.draggable&&e.fn.draggable&&I.draggable({handle:".ui-dialog-titlebar",cancel:"li"});var S=i&&(!e.support.boxModel||e("object,embed",h?null:d).length>0);if(n||S){if(h&&c.allowBodyStretch&&e.support.boxModel&&e("html,body").css("height","100%"),(n||!e.support.boxModel)&&!h)var E=p(d,"borderTopWidth"),O=p(d,"borderLeftWidth"),T=E?"(0 - "+E+")":0,M=O?"(0 - "+O+")":0;e.each(x,function(e,t){var o=t[0].style;if(o.position="absolute",e<2)h?o.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.support.boxModel?0:"+c.quirksmodeOffsetHack+') + "px"'):o.setExpression("height",'this.parentNode.offsetHeight + "px"'),h?o.setExpression("width",'jQuery.support.boxModel&&document.documentElement.clientWidth||document.body.clientWidth + "px"'):o.setExpression("width",'this.parentNode.offsetWidth + "px"'),M&&o.setExpression("left",M),T&&o.setExpression("top",T);else if(c.centerY)h&&o.setExpression("top",'(document.documentElement.clientHeight||document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah=document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "px"'),o.marginTop=0;else if(!c.centerY&&h){var n="((document.documentElement.scrollTop ? document.documentElement.scrollTop:document.body.scrollTop) + "+(c.css&&c.css.top?parseInt(c.css.top,10):0)+') + "px"';o.setExpression("top",n)}})}if(k&&(c.theme?I.find(".ui-widget-content").append(k):I.append(k),(k.jquery||k.nodeType)&&e(k).show()),(o||c.forceIframe)&&c.showOverlay&&g.show(),c.fadeIn){var B=c.onBlock?c.onBlock:t,j=c.showOverlay&&!k?B:t,H=k?B:t;c.showOverlay&&v._fadeIn(c.fadeIn,j),k&&I._fadeIn(c.fadeIn,H)}else c.showOverlay&&v.show(),k&&I.show(),c.onBlock&&c.onBlock.bind(I)();if(r(1,d,c),h?(s=I[0],l=e(c.focusableElements,s),c.focusInput&&setTimeout(f,20)):function(e,t,o){var n=e.parentNode,i=e.style,s=(n.offsetWidth-e.offsetWidth)/2-p(n,"borderLeftWidth"),l=(n.offsetHeight-e.offsetHeight)/2-p(n,"borderTopWidth");t&&(i.left=s>0?s+"px":"0");o&&(i.top=l>0?l+"px":"0")}(I[0],c.centerX,c.centerY),c.timeout){var z=setTimeout(function(){h?e.unblockUI(c):e(d).unblock(c)},c.timeout);e(d).data("blockUI.timeout",z)}}}function a(t,o){var n,i,d=t==window,a=e(t),u=a.data("blockUI.history"),f=a.data("blockUI.timeout");f&&(clearTimeout(f),a.removeData("blockUI.timeout")),o=e.extend({},e.blockUI.defaults,o||{}),r(0,t,o),null===o.onUnblock&&(o.onUnblock=a.data("blockUI.onUnblock"),a.removeData("blockUI.onUnblock")),i=d?e(document.body).children().filter(".blockUI").add("body > .blockUI"):a.find(">.blockUI"),o.cursorReset&&(i.length>1&&(i[1].style.cursor=o.cursorReset),i.length>2&&(i[2].style.cursor=o.cursorReset)),d&&(s=l=null),o.fadeOut?(n=i.length,i.stop().fadeOut(o.fadeOut,function(){0==--n&&c(i,u,o,t)})):c(i,u,o,t)}function c(t,o,n,i){var s=e(i);if(!s.data("blockUI.isBlocked")){t.each(function(e,t){this.parentNode&&this.parentNode.removeChild(this)}),o&&o.el&&(o.el.style.display=o.display,o.el.style.position=o.position,o.el.style.cursor="default",o.parent&&o.parent.appendChild(o.el),s.removeData("blockUI.history")),s.data("blockUI.static")&&s.css("position","static"),"function"==typeof n.onUnblock&&n.onUnblock(i,n);var l=e(document.body),d=l.width(),a=l[0].style.width;l.width(d-1).width(d),l[0].style.width=a}}function r(t,o,n){var i=o==window,l=e(o);if((t||(!i||s)&&(i||l.data("blockUI.isBlocked")))&&(l.data("blockUI.isBlocked",t),i&&n.bindEvents&&(!t||n.showOverlay))){var d="mousedown mouseup keydown keypress keyup touchstart touchend touchmove";t?e(document).on(d,n,u):e(document).off(d,u)}}function u(t){if("keydown"===t.type&&t.keyCode&&9==t.keyCode&&s&&t.data.constrainTabKey){var o=l,n=!t.shiftKey&&t.target===o[o.length-1],i=t.shiftKey&&t.target===o[0];if(n||i)return setTimeout(function(){f(i)},10),!1}var d=t.data,a=e(t.target);return a.hasClass("blockOverlay")&&d.onOverlayClick&&d.onOverlayClick(t),a.parents("div."+d.blockMsgClass).length>0||0===a.parents().children().filter("div.blockUI").length}function f(e){if(l){var t=l[!0===e?l.length-1:0];t&&t.trigger("focus")}}function p(t,o){return parseInt(e.css(t,o),10)||0}}"function"==typeof define&&define.amd&&define.amd.jQuery?define(["jquery"],e):e(jQuery)}();
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(o){var t={url:!1,callback:!1,target:!1,duration:120,on:"mouseover",touch:!0,onZoomIn:!1,onZoomOut:!1,magnify:1};o.zoom=function(t,e,n,i){var u,a,c,r,l,m,f,s=o(t),h=s.css("position"),d=o(e);return t.style.position=/(absolute|fixed)/.test(h)?h:"relative",t.style.overflow="hidden",n.style.width=n.style.height="",o(n).addClass("zoomImg").css({position:"absolute",top:0,left:0,opacity:0,width:n.width*i,height:n.height*i,border:"none",maxWidth:"none",maxHeight:"none"}).appendTo(t),{init:function(){a=s.outerWidth(),u=s.outerHeight(),e===t?(r=a,c=u):(r=d.outerWidth(),c=d.outerHeight()),l=(n.width-a)/r,m=(n.height-u)/c,f=d.offset()},move:function(o){var t=o.pageX-f.left,e=o.pageY-f.top;e=Math.max(Math.min(e,c),0),t=Math.max(Math.min(t,r),0),n.style.left=t*-l+"px",n.style.top=e*-m+"px"}}},o.fn.zoom=function(e){return this.each(function(){var n=o.extend({},t,e||{}),i=n.target&&o(n.target)[0]||this,u=this,a=o(u),c=document.createElement("img"),r=o(c),l="mousemove.zoom",m=!1,f=!1;if(!n.url){var s=u.querySelector("img");if(s&&(n.url=s.getAttribute("data-src")||s.currentSrc||s.src,n.alt=s.getAttribute("data-alt")||s.alt),!n.url)return}a.one("zoom.destroy",function(o,t){a.off(".zoom"),i.style.position=o,i.style.overflow=t,c.onload=null,r.remove()}.bind(this,i.style.position,i.style.overflow)),c.onload=function(){var t=o.zoom(i,u,c,n.magnify);function e(e){t.init(),t.move(e),r.stop().fadeTo(o.support.opacity?n.duration:0,1,"function"==typeof n.onZoomIn&&n.onZoomIn.call(c))}function s(){r.stop().fadeTo(n.duration,0,"function"==typeof n.onZoomOut&&n.onZoomOut.call(c))}"grab"===n.on?a.on("mousedown.zoom",function(n){1===n.which&&(o(document).one("mouseup.zoom",function(){s(),o(document).off(l,t.move)}),e(n),o(document).on(l,t.move),n.preventDefault())}):"click"===n.on?a.on("click.zoom",function(n){return m?void 0:(m=!0,e(n),o(document).on(l,t.move),o(document).one("click.zoom",function(){s(),m=!1,o(document).off(l,t.move)}),!1)}):"toggle"===n.on?a.on("click.zoom",function(o){m?s():e(o),m=!m}):"mouseover"===n.on&&(t.init(),a.on("mouseenter.zoom",e).on("mouseleave.zoom",s).on(l,t.move)),n.touch&&a.on("touchstart.zoom",function(o){o.preventDefault(),f?(f=!1,s()):(f=!0,e(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0]))}).on("touchmove.zoom",function(o){o.preventDefault(),t.move(o.originalEvent.touches[0]||o.originalEvent.changedTouches[0])}).on("touchend.zoom",function(o){o.preventDefault(),f&&(f=!1,s())}),"function"==typeof n.callback&&n.callback.call(c)},c.setAttribute("role","presentation"),c.alt=n.alt||"",c.src=n.url})},o.fn.zoom.defaults=t}(window.jQuery);
!function(e){var t=!0,a={swing:"cubic-bezier(.02, .01, .47, 1)",linear:"linear",easeInQuad:"cubic-bezier(0.11, 0, 0.5, 0)",easeOutQuad:"cubic-bezier(0.5, 1, 0.89, 1)",easeInOutQuad:"cubic-bezier(0.45, 0, 0.55, 1)",easeInCubic:"cubic-bezier(0.32, 0, 0.67, 0)",easeOutCubic:"cubic-bezier(0.33, 1, 0.68, 1)",easeInOutCubic:"cubic-bezier(0.65, 0, 0.35, 1)",easeInQuart:"cubic-bezier(0.5, 0, 0.75, 0)",easeOutQuart:"cubic-bezier(0.25, 1, 0.5, 1)",easeInOutQuart:"cubic-bezier(0.76, 0, 0.24, 1)",easeInQuint:"cubic-bezier(0.64, 0, 0.78, 0)",easeOutQuint:"cubic-bezier(0.22, 1, 0.36, 1)",easeInOutQuint:"cubic-bezier(0.83, 0, 0.17, 1)",easeInSine:"cubic-bezier(0.12, 0, 0.39, 0)",easeOutSine:"cubic-bezier(0.61, 1, 0.88, 1)",easeInOutSine:"cubic-bezier(0.37, 0, 0.63, 1)",easeInExpo:"cubic-bezier(0.7, 0, 0.84, 0)",easeOutExpo:"cubic-bezier(0.16, 1, 0.3, 1)",easeInOutExpo:"cubic-bezier(0.87, 0, 0.13, 1)",easeInCirc:"cubic-bezier(0.55, 0, 1, 0.45)",easeOutCirc:"cubic-bezier(0, 0.55, 0.45, 1)",easeInOutCirc:"cubic-bezier(0.85, 0, 0.15, 1)",easeInBack:"cubic-bezier(0.36, 0, 0.66, -0.56)",easeOutBack:"cubic-bezier(0.34, 1.56, 0.64, 1)",easeInOutBack:"cubic-bezier(0.68, -0.6, 0.32, 1.6)"};a.jswing=a.swing,e.flexslider=function(i,n){var s=e(i);"undefined"==typeof n.rtl&&"rtl"==e("html").attr("dir")&&(n.rtl=!0),s.vars=e.extend({},e.flexslider.defaults,n);var r,o=s.vars.namespace,l=("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)&&s.vars.touch,c="click touchend keyup flexslider-click",u="",d=a[s.vars.easing]||"ease",v="vertical"===s.vars.direction,p=s.vars.reverse,m=s.vars.itemWidth>0,f="fade"===s.vars.animation,h=""!==s.vars.asNavFor,g={};e.data(i,"flexslider",s),g={init:function(){s.animating=!1,s.currentSlide=parseInt(s.vars.startAt?s.vars.startAt:0,10),isNaN(s.currentSlide)&&(s.currentSlide=0),s.animatingTo=s.currentSlide,s.atEnd=0===s.currentSlide||s.currentSlide===s.last,s.containerSelector=s.vars.selector.substr(0,s.vars.selector.search(" ")),s.slides=e(s.vars.selector,s),s.container=e(s.containerSelector,s),s.count=s.slides.length,s.syncExists=e(s.vars.sync).length>0,"slide"===s.vars.animation&&(s.vars.animation="swing"),s.prop=v?"top":s.vars.rtl?"marginRight":"marginLeft",s.args={},s.manualPause=!1,s.stopped=!1,s.started=!1,s.startTimeout=null,s.transforms=s.transitions=!s.vars.video&&!f&&s.vars.useCSS,s.transforms&&(s.prop="transform"),s.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,s.ensureAnimationEnd="",""!==s.vars.controlsContainer&&(s.controlsContainer=e(s.vars.controlsContainer).length>0&&e(s.vars.controlsContainer)),""!==s.vars.manualControls&&(s.manualControls=e(s.vars.manualControls).length>0&&e(s.vars.manualControls)),""!==s.vars.customDirectionNav&&(s.customDirectionNav=2===e(s.vars.customDirectionNav).length&&e(s.vars.customDirectionNav)),s.vars.randomize&&(s.slides.sort(function(){return Math.round(Math.random())-.5}),s.container.empty().append(s.slides)),s.doMath(),s.setup("init"),s.vars.controlNav&&g.controlNav.setup(),s.vars.directionNav&&g.directionNav.setup(),s.vars.keyboard&&(1===e(s.containerSelector).length||s.vars.multipleKeyboard)&&e(document).on("keyup",function(e){var t=e.keyCode;if(!s.animating&&(39===t||37===t)){var a=s.vars.rtl?37===t?s.getTarget("next"):39===t&&s.getTarget("prev"):39===t?s.getTarget("next"):37===t&&s.getTarget("prev");s.flexAnimate(a,s.vars.pauseOnAction)}}),s.vars.mousewheel&&s.on("mousewheel",function(e,t,a,i){e.preventDefault();var n=t<0?s.getTarget("next"):s.getTarget("prev");s.flexAnimate(n,s.vars.pauseOnAction)}),s.vars.pausePlay&&g.pausePlay.setup(),s.vars.slideshow&&s.vars.pauseInvisible&&g.pauseInvisible(),s.vars.slideshow&&(s.vars.pauseOnHover&&s.on("mouseenter",function(){s.manualPlay||s.manualPause||s.pause()}).on("mouseleave",function(){s.manualPause||s.manualPlay||s.stopped||s.play()}),s.vars.pauseInvisible&&"visible"!==document.visibilityState||(s.vars.initDelay>0?s.startTimeout=setTimeout(s.play,s.vars.initDelay):s.play())),h&&g.asNav.setup(),l&&s.vars.touch&&g.touch(),(!f||f&&s.vars.smoothHeight)&&e(window).on("resize orientationchange focus",g.resize),s.find("img").attr("draggable","false"),setTimeout(function(){s.vars.start(s)},200)},asNav:{setup:function(){s.asNav=!0,s.animatingTo=Math.floor(s.currentSlide/s.move),s.currentItem=s.currentSlide,s.slides.removeClass(o+"active-slide").eq(s.currentItem).addClass(o+"active-slide"),s.slides.on(c,function(t){t.preventDefault();var a=e(this),i=a.index();(s.vars.rtl?-1*(a.offset().right-e(s).scrollLeft()):a.offset().left-e(s).scrollLeft())<=0&&a.hasClass(o+"active-slide")?s.flexAnimate(s.getTarget("prev"),!0):e(s.vars.asNavFor).data("flexslider").animating||a.hasClass(o+"active-slide")||(s.direction=s.currentItem<i?"next":"prev",s.flexAnimate(i,s.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){s.manualControls?g.controlNav.setupManual():g.controlNav.setupPaging()},setupPaging:function(){var t,a,i="thumbnails"===s.vars.controlNav?"control-thumbs":"control-paging",n=1;if(s.controlNavScaffold=e('<ol class="'+o+"control-nav "+o+i+'"></ol>'),s.pagingCount>1)for(var r=0;r<s.pagingCount;r++){if(a=s.slides.eq(r),undefined===a.attr("data-thumb-alt")&&a.attr("data-thumb-alt",""),t=e("<a></a>").attr("href","#").text(n),"thumbnails"===s.vars.controlNav&&(t=e("<img/>",{onload:"this.width=this.naturalWidth; this.height=this.naturalHeight",src:a.attr("data-thumb"),srcset:a.attr("data-thumb-srcset"),sizes:a.attr("data-thumb-sizes"),alt:a.attr("alt")})),""!==a.attr("data-thumb-alt")&&t.attr("alt",a.attr("data-thumb-alt")),"thumbnails"===s.vars.controlNav&&!0===s.vars.thumbCaptions){var l=a.attr("data-thumbcaption");if(""!==l&&undefined!==l){var d=e("<span></span>").addClass(o+"caption").text(l);t.append(d)}}var v=e("<li>");t.appendTo(v),v.append("</li>"),s.controlNavScaffold.append(v),n++}s.controlsContainer?e(s.controlsContainer).append(s.controlNavScaffold):s.append(s.controlNavScaffold),g.controlNav.set(),g.controlNav.active(),s.controlNavScaffold.on(c,"a, img",function(t){if(t.preventDefault(),""===u||u===t.type||"flexslider-click"===t.type){var a=e(this),i=s.controlNav.index(a);a.hasClass(o+"active")||(s.direction=i>s.currentSlide?"next":"prev",s.flexAnimate(i,s.vars.pauseOnAction))}""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},setupManual:function(){s.controlNav=s.manualControls,g.controlNav.active(),s.controlNav.on(c,function(t){if(t.preventDefault(),""===u||u===t.type||"flexslider-click"===t.type){var a=e(this),i=s.controlNav.index(a);a.hasClass(o+"active")||(i>s.currentSlide?s.direction="next":s.direction="prev",s.flexAnimate(i,s.vars.pauseOnAction))}""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},set:function(){var t="thumbnails"===s.vars.controlNav?"img":"a";s.controlNav=e("."+o+"control-nav li "+t,s.controlsContainer?s.controlsContainer:s)},active:function(){s.controlNav.removeClass(o+"active").eq(s.animatingTo).addClass(o+"active")},update:function(t,a){s.pagingCount>1&&"add"===t?s.controlNavScaffold.append(e('<li><a href="#">'+s.count+"</a></li>")):1===s.pagingCount?s.controlNavScaffold.find("li").remove():s.controlNav.eq(a).closest("li").remove(),g.controlNav.set(),s.pagingCount>1&&s.pagingCount!==s.controlNav.length?s.update(a,t):g.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+o+'direction-nav"><li class="'+o+'nav-prev"><a class="'+o+'prev" href="#">'+s.vars.prevText+'</a></li><li class="'+o+'nav-next"><a class="'+o+'next" href="#">'+s.vars.nextText+"</a></li></ul>");s.customDirectionNav?s.directionNav=s.customDirectionNav:s.controlsContainer?(e(s.controlsContainer).append(t),s.directionNav=e("."+o+"direction-nav li a",s.controlsContainer)):(s.append(t),s.directionNav=e("."+o+"direction-nav li a",s)),g.directionNav.update(),s.directionNav.on(c,function(t){var a;t.preventDefault(),""!==u&&u!==t.type&&"flexslider-click"!==t.type||(a=e(this).hasClass(o+"next")?s.getTarget("next"):s.getTarget("prev"),s.flexAnimate(a,s.vars.pauseOnAction)),""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},update:function(){var e=o+"disabled";1===s.pagingCount?s.directionNav.addClass(e).attr("tabindex","-1"):s.vars.animationLoop?s.directionNav.removeClass(e).prop("tabindex","-1"):0===s.animatingTo?s.directionNav.removeClass(e).filter("."+o+"prev").addClass(e).attr("tabindex","-1"):s.animatingTo===s.last?s.directionNav.removeClass(e).filter("."+o+"next").addClass(e).attr("tabindex","-1"):s.directionNav.removeClass(e).prop("tabindex","-1")}},pausePlay:{setup:function(){var t=e('<div class="'+o+'pauseplay"><a href="#"></a></div>');s.controlsContainer?(s.controlsContainer.append(t),s.pausePlay=e("."+o+"pauseplay a",s.controlsContainer)):(s.append(t),s.pausePlay=e("."+o+"pauseplay a",s)),g.pausePlay.update(s.vars.slideshow?o+"pause":o+"play"),s.pausePlay.on(c,function(t){t.preventDefault(),""!==u&&u!==t.type&&"flexslider-click"!==t.type||(e(this).hasClass(o+"pause")?(s.manualPause=!0,s.manualPlay=!1,s.pause()):(s.manualPause=!1,s.manualPlay=!0,s.play())),""===u&&"flexslider-click"!==t.type&&(u=t.type),g.setToClearWatchedEvent()})},update:function(e){"play"===e?s.pausePlay.removeClass(o+"pause").addClass(o+"play").html(s.vars.playText):s.pausePlay.removeClass(o+"play").addClass(o+"pause").html(s.vars.pauseText)}},touch:function(){var e,t,a,n,r,o,l,c,u,d=!1,h=0,g=0;l=function(r){s.animating?r.preventDefault():1===r.touches.length&&(s.pause(),n=v?s.h:s.w,o=Number(new Date),h=r.touches[0].pageX,g=r.touches[0].pageY,a=m&&p&&s.animatingTo===s.last?0:m&&p?s.limit-(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo:m&&s.currentSlide===s.last?s.limit:m?(s.itemW+s.vars.itemMargin)*s.move*s.currentSlide:p?(s.last-s.currentSlide+s.cloneOffset)*n:(s.currentSlide+s.cloneOffset)*n,e=v?g:h,t=v?h:g,i.addEventListener("touchmove",c,!1),i.addEventListener("touchend",u,!1))},c=function(i){h=i.touches[0].pageX,g=i.touches[0].pageY,r=v?e-g:(s.vars.rtl?-1:1)*(e-h);(!(d=v?Math.abs(r)<Math.abs(h-t):Math.abs(r)<Math.abs(g-t))||Number(new Date)-o>500)&&(i.preventDefault(),f||(s.vars.animationLoop||(r/=0===s.currentSlide&&r<0||s.currentSlide===s.last&&r>0?Math.abs(r)/n+2:1),s.setProps(a+r,"setTouch")))},u=function(l){if(i.removeEventListener("touchmove",c,!1),s.animatingTo===s.currentSlide&&!d&&null!==r){var v=p?-r:r,m=v>0?s.getTarget("next"):s.getTarget("prev");s.canAdvance(m)&&(Number(new Date)-o<550&&Math.abs(v)>50||Math.abs(v)>n/2)?s.flexAnimate(m,s.vars.pauseOnAction):f||s.flexAnimate(s.currentSlide,s.vars.pauseOnAction,!0)}i.removeEventListener("touchend",u,!1),e=null,t=null,r=null,a=null},i.addEventListener("touchstart",l,!1)},resize:function(){!s.animating&&s.is(":visible")&&(m||s.doMath(),f?g.smoothHeight():m?(s.slides.width(s.computedW),s.update(s.pagingCount),s.setProps()):v?(s.viewport.height(s.h),s.setProps(s.h,"setTotal")):(s.setProps(s.computedW,"setTotal"),s.newSlides.width(s.computedW),s.vars.smoothHeight&&g.smoothHeight()))},smoothHeight:function(e){v&&!f||(f?s:s.viewport).css({height:s.slides.eq(s.animatingTo).innerHeight(),transition:e?"height "+e+"ms":"none"})},sync:function(t){var a=e(s.vars.sync).data("flexslider"),i=s.animatingTo;switch(t){case"animate":a.flexAnimate(i,s.vars.pauseOnAction,!1,!0);break;case"play":a.playing||a.asNav||a.play();break;case"pause":a.pause()}},uniqueID:function(t){return t.filter("[id]").add(t.find("[id]")).each(function(){var t=e(this);t.attr("id",t.attr("id")+"_clone")}),t},pauseInvisible:function(){document.addEventListener("visibilitychange",function(){"hidden"===document.visibilityState?s.startTimeout?clearTimeout(s.startTimeout):s.pause():s.started?s.play():s.vars.initDelay>0?setTimeout(s.play,s.vars.initDelay):s.play()})},setToClearWatchedEvent:function(){clearTimeout(r),r=setTimeout(function(){u=""},3e3)}},s.flexAnimate=function(t,a,i,n,r){if(s.vars.animationLoop||t===s.currentSlide||(s.direction=t>s.currentSlide?"next":"prev"),h&&1===s.pagingCount&&(s.direction=s.currentItem<t?"next":"prev"),!s.animating&&(s.canAdvance(t,r)||i)&&s.is(":visible")){if(h&&n){var c=e(s.vars.asNavFor).data("flexslider");if(s.atEnd=0===t||t===s.count-1,c.flexAnimate(t,!0,!1,!0,r),s.direction=s.currentItem<t?"next":"prev",c.direction=s.direction,Math.ceil((t+1)/s.visible)-1===s.currentSlide||0===t)return s.currentItem=t,s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),!1;s.currentItem=t,s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),t=Math.floor(t/s.visible)}if(s.animating=!0,s.animatingTo=t,a&&s.pause(),s.vars.before(s),s.syncExists&&!r&&g.sync("animate"),s.vars.controlNav&&g.controlNav.active(),m||s.slides.removeClass(o+"active-slide").eq(t).addClass(o+"active-slide"),s.atEnd=0===t||t===s.last,s.vars.directionNav&&g.directionNav.update(),t===s.last&&(s.vars.end(s),s.vars.animationLoop||s.pause()),f)l||(s.slides.eq(s.currentSlide).off("transitionend"),s.slides.eq(t).off("transitionend").on("transitionend",s.wrapup)),s.slides.eq(s.currentSlide).css({opacity:0,zIndex:1}),s.slides.eq(t).css({opacity:1,zIndex:2}),l&&s.wrapup(y);else{var u,d,b,y=v?s.slides.filter(":first").height():s.computedW;m?(u=s.vars.itemMargin,d=(b=(s.itemW+u)*s.move*s.animatingTo)>s.limit&&1!==s.visible?s.limit:b):d=0===s.currentSlide&&t===s.count-1&&s.vars.animationLoop&&"next"!==s.direction?p?(s.count+s.cloneOffset)*y:0:s.currentSlide===s.last&&0===t&&s.vars.animationLoop&&"prev"!==s.direction?p?0:(s.count+1)*y:p?(s.count-1-t+s.cloneOffset)*y:(t+s.cloneOffset)*y,s.setProps(d,"",s.vars.animationSpeed),s.vars.animationLoop&&s.atEnd||(s.animating=!1,s.currentSlide=s.animatingTo),s.container.off("transitionend"),s.container.on("transitionend",function(){clearTimeout(s.ensureAnimationEnd),s.wrapup(y)}),clearTimeout(s.ensureAnimationEnd),s.ensureAnimationEnd=setTimeout(function(){s.wrapup(y)},s.vars.animationSpeed+100)}s.vars.smoothHeight&&g.smoothHeight(s.vars.animationSpeed)}},s.wrapup=function(e){f||m||(0===s.currentSlide&&s.animatingTo===s.last&&s.vars.animationLoop?s.setProps(e,"jumpEnd"):s.currentSlide===s.last&&0===s.animatingTo&&s.vars.animationLoop&&s.setProps(e,"jumpStart")),s.animating=!1,s.currentSlide=s.animatingTo,s.vars.after(s)},s.animateSlides=function(){!s.animating&&t&&s.flexAnimate(s.getTarget("next"))},s.pause=function(){clearInterval(s.animatedSlides),s.animatedSlides=null,s.playing=!1,s.vars.pausePlay&&g.pausePlay.update("play"),s.syncExists&&g.sync("pause")},s.play=function(){s.playing&&clearInterval(s.animatedSlides),s.animatedSlides=s.animatedSlides||setInterval(s.animateSlides,s.vars.slideshowSpeed),s.started=s.playing=!0,s.vars.pausePlay&&g.pausePlay.update("pause"),s.syncExists&&g.sync("play")},s.stop=function(){s.pause(),s.stopped=!0},s.canAdvance=function(e,t){var a=h?s.pagingCount-1:s.last;return!!t||(!(!h||s.currentItem!==s.count-1||0!==e||"prev"!==s.direction)||(!h||0!==s.currentItem||e!==s.pagingCount-1||"next"===s.direction)&&(!(e===s.currentSlide&&!h)&&(!!s.vars.animationLoop||(!s.atEnd||0!==s.currentSlide||e!==a||"next"===s.direction)&&(!s.atEnd||s.currentSlide!==a||0!==e||"next"!==s.direction))))},s.getTarget=function(e){return s.direction=e,"next"===e?s.currentSlide===s.last?0:s.currentSlide+1:0===s.currentSlide?s.last:s.currentSlide-1},s.setProps=function(e,t,a){var i,n=(i=e||(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo,function(){if(m)return"setTouch"===t?e:p&&s.animatingTo===s.last?0:p?s.limit-(s.itemW+s.vars.itemMargin)*s.move*s.animatingTo:s.animatingTo===s.last?s.limit:i;switch(t){case"setTotal":return p?(s.count-1-s.currentSlide+s.cloneOffset)*e:(s.currentSlide+s.cloneOffset)*e;case"setTouch":return e;case"jumpEnd":return p?e:s.count*e;case"jumpStart":return p?s.count*e:e;default:return e}}()*(s.vars.rtl?1:-1)+"px");a=a!==undefined?a/1e3+"s":"0s",s.container.css("transition-duration",a),s.transforms?n=v?"translate3d(0,"+n+",0)":"translate3d("+parseInt(n)+"px,0,0)":s.container.css("transition-timing-function",d),s.args[s.prop]=n,s.container.css(s.args)},s.setup=function(t){var a,i;f?(s.vars.rtl?s.slides.css({width:"100%",float:"right",marginLeft:"-100%",position:"relative"}):s.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===t&&(l?s.slides.css({opacity:0,display:"block",transition:"opacity "+s.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(s.currentSlide).css({opacity:1,zIndex:2}):(0==s.vars.fadeFirstSlide?(s.slides.css({opacity:0,display:"block",zIndex:1}).eq(s.currentSlide).css({opacity:1,zIndex:2}),s.slides.outerWidth()):(s.slides.css({opacity:0,display:"block",zIndex:1}).outerWidth(),s.slides.eq(s.currentSlide).css({opacity:1,zIndex:2})),s.slides.css({transition:"opacity "+s.vars.animationSpeed/1e3+"s "+d}))),s.vars.smoothHeight&&g.smoothHeight()):("init"===t&&(s.viewport=e('<div class="'+o+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(s).append(s.container),s.cloneCount=0,s.cloneOffset=0,p&&(i=e.makeArray(s.slides).reverse(),s.slides=e(i),s.container.empty().append(s.slides))),s.vars.animationLoop&&!m&&(s.cloneCount=2,s.cloneOffset=1,"init"!==t&&s.container.find(".clone").remove(),s.container.append(g.uniqueID(s.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(g.uniqueID(s.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),s.newSlides=e(s.vars.selector,s),a=p?s.count-1-s.currentSlide+s.cloneOffset:s.currentSlide+s.cloneOffset,v&&!m?(s.container.height(200*(s.count+s.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){s.newSlides.css({display:"block"}),s.doMath(),s.viewport.height(s.h),s.setProps(a*s.h,"init")},"init"===t?100:0)):(s.container.width(200*(s.count+s.cloneCount)+"%"),s.setProps(a*s.computedW,"init"),setTimeout(function(){s.doMath(),s.vars.rtl?s.newSlides.css({width:s.computedW,marginRight:s.computedM,float:"right",display:"block"}):s.newSlides.css({width:s.computedW,marginRight:s.computedM,float:"left",display:"block"}),s.vars.smoothHeight&&g.smoothHeight()},"init"===t?100:0)));m||s.slides.removeClass(o+"active-slide").eq(s.currentSlide).addClass(o+"active-slide"),s.vars.init(s)},s.doMath=function(){var e=s.slides.first(),t=s.vars.itemMargin,a=s.vars.minItems,i=s.vars.maxItems;s.w=s.viewport===undefined?s.width():s.viewport.width(),s.isFirefox&&(s.w=s.width()),s.h=e.height(),s.boxPadding=e.outerWidth()-e.width(),m?(s.itemT=s.vars.itemWidth+t,s.itemM=t,s.minW=a?a*s.itemT:s.w,s.maxW=i?i*s.itemT-t:s.w,s.itemW=s.minW>s.w?(s.w-t*(a-1))/a:s.maxW<s.w?(s.w-t*(i-1))/i:s.vars.itemWidth>s.w?s.w:s.vars.itemWidth,s.visible=Math.floor(s.w/s.itemW),s.move=s.vars.move>0&&s.vars.move<s.visible?s.vars.move:s.visible,s.pagingCount=Math.ceil((s.count-s.visible)/s.move+1),s.last=s.pagingCount-1,s.limit=1===s.pagingCount?0:s.vars.itemWidth>s.w?s.itemW*(s.count-1)+t*(s.count-1):(s.itemW+t)*s.count-s.w-t):(s.itemW=s.w,s.itemM=t,s.pagingCount=s.count,s.last=s.count-1),s.computedW=s.itemW-s.boxPadding,s.computedM=s.itemM},s.update=function(e,t){s.doMath(),m||(e<s.currentSlide?s.currentSlide+=1:e<=s.currentSlide&&0!==e&&(s.currentSlide-=1),s.animatingTo=s.currentSlide),s.vars.controlNav&&!s.manualControls&&("add"===t&&!m||s.pagingCount>s.controlNav.length?g.controlNav.update("add"):("remove"===t&&!m||s.pagingCount<s.controlNav.length)&&(m&&s.currentSlide>s.last&&(s.currentSlide-=1,s.animatingTo-=1),g.controlNav.update("remove",s.last))),s.vars.directionNav&&g.directionNav.update()},s.addSlide=function(t,a){var i=e(t);s.count+=1,s.last=s.count-1,v&&p?a!==undefined?s.slides.eq(s.count-a).after(i):s.container.prepend(i):a!==undefined?s.slides.eq(a).before(i):s.container.append(i),s.update(a,"add"),s.slides=e(s.vars.selector+":not(.clone)",s),s.setup(),s.vars.added(s)},s.removeSlide=function(t){var a=isNaN(t)?s.slides.index(e(t)):t;s.count-=1,s.last=s.count-1,isNaN(t)?e(t,s.slides).remove():v&&p?s.slides.eq(s.last).remove():s.slides.eq(t).remove(),s.doMath(),s.update(a,"remove"),s.slides=e(s.vars.selector+":not(.clone)",s),s.setup(),s.vars.removed(s)},g.init()},e(window).on("blur",function(e){t=!1}).on("focus",function(e){t=!0}),e.flexslider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,isFirefox:!1,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){},rtl:!1},e.fn.flexslider=function(t){if(t===undefined&&(t={}),"object"==typeof t)return this.each(function(){var a=e(this),i=t.selector?t.selector:".slides > li",n=a.find(i);if(1===n.length&&!1===t.allowOneSlide||0===n.length){n.length&&n[0].animate([{opacity:0},{opacity:1}],400),t.start&&t.start(a)}else a.data("flexslider")===undefined&&new e.flexslider(this,t)});var a=e(this).data("flexslider");switch(t){case"play":a.play();break;case"pause":a.pause();break;case"stop":a.stop();break;case"next":a.flexAnimate(a.getTarget("next"),!0);break;case"prev":case"previous":a.flexAnimate(a.getTarget("prev"),!0);break;default:"number"==typeof t&&a.flexAnimate(t,!0)}}}(jQuery);
jQuery(function(t){if("undefined"==typeof wc_single_product_params)return!1;t("body").on("init",".wc-tabs-wrapper, .woocommerce-tabs",function(){t(this).find(".wc-tab, .woocommerce-tabs .panel:not(.panel .panel)").hide();var e=window.location.hash,i=window.location.href,o=t(this).find(".wc-tabs, ul.tabs").first();e.toLowerCase().indexOf("comment-")>=0||"#reviews"===e||"#tab-reviews"===e?o.find("li.reviews_tab a").trigger("click"):i.indexOf("comment-page-")>0||i.indexOf("cpage=")>0?o.find("li.reviews_tab a").trigger("click"):"#tab-additional_information"===e?o.find("li.additional_information_tab a").trigger("click"):o.find("li:first a").trigger("click")}).on("click",".wc-tabs li a, ul.tabs li a",function(e){e.preventDefault();var i=t(this),o=i.closest(".wc-tabs-wrapper, .woocommerce-tabs"),a=o.find(".wc-tabs, ul.tabs");a.find("li").removeClass("active"),a.find('a[role="tab"]').attr("aria-selected","false").attr("tabindex","-1"),o.find(".wc-tab, .panel:not(.panel .panel)").hide(),i.closest("li").addClass("active"),i.attr("aria-selected","true").attr("tabindex","0"),o.find("#"+i.attr("href").split("#")[1]).show()}).on("keydown",".wc-tabs li a, ul.tabs li a",function(e){var i="rtl"===document.documentElement.dir,o=e.key,a=i?"ArrowLeft":"ArrowRight",r=i?"ArrowRight":"ArrowLeft",n="ArrowDown",s="ArrowUp",l="Home",c="End";if([a,r,n,s,c,l].includes(o)){var d=t(this),p=d.closest(".wc-tabs-wrapper, .woocommerce-tabs").find(".wc-tabs, ul.tabs").find('a[role="tab"]'),h=p.length-1,g=p.index(d),u=o===r||o===s?g-1:g+1,m="horizontal";if(p.length>=2){var _=p[0].getBoundingClientRect(),f=p[1].getBoundingClientRect();m=Math.abs(f.top-_.top)>Math.abs(f.left-_.left)?"vertical":"horizontal"}("vertical"!==m||o!==r&&o!==a)&&("horizontal"!==m||o!==s&&o!==n)&&(e.preventDefault(),o===r&&0===g&&"horizontal"===m||o===s&&0===g&&"vertical"===m||o===c?u=h:(a===o&&g===h&&"horizontal"===m||n===o&&g===h&&"vertical"===m||o===l)&&(u=0),p.eq(u).focus())}}).on("click","a.woocommerce-review-link",function(){return t(".reviews_tab a").trigger("click"),!0}).on("init","#rating",function(){t(this).hide().before('<p class="stars">\t\t\t\t\t\t<span role="group" aria-labelledby="comment-form-rating-label">\t\t\t\t\t\t\t<a role="radio" tabindex="0" aria-checked="false" class="star-1" href="#">'+wc_single_product_params.i18n_rating_options[0]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-2" href="#">'+wc_single_product_params.i18n_rating_options[1]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-3" href="#">'+wc_single_product_params.i18n_rating_options[2]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-4" href="#">'+wc_single_product_params.i18n_rating_options[3]+'</a>\t\t\t\t\t\t\t<a role="radio" tabindex="-1" aria-checked="false" class="star-5" href="#">'+wc_single_product_params.i18n_rating_options[4]+"</a>\t\t\t\t\t\t</span>\t\t\t\t\t</p>")}).on("click","#respond p.stars a",function(){var e=t(this),i=e.closest("p.stars").find("a").index(e)+1,o=t(this).closest("#respond").find("#rating"),a=t(this).closest(".stars");return o.val(i),e.siblings("a").removeClass("active").attr("aria-checked","false").attr("tabindex","-1"),e.addClass("active").attr("aria-checked","true").attr("tabindex","0"),a.addClass("selected"),!1}).on("click","#respond #submit",function(){var e=t(this).closest("#respond").find("#rating"),i=e.val();if(e.length>0&&!i&&"yes"===wc_single_product_params.review_rating_required)return window.alert(wc_single_product_params.i18n_required_rating_text),!1}).on("keyup",".wc-tabs li a, ul.tabs li a, #respond p.stars a",function(e){var i=e.key,o=["ArrowRight","ArrowDown"];o.concat(["ArrowLeft","ArrowUp"]).includes(i)&&(e.preventDefault(),e.stopPropagation(),o.includes(i)?t(this).next().focus().click():t(this).prev().focus().click())}),t(".wc-tabs-wrapper, .woocommerce-tabs, #rating").trigger("init");var e=function(e,i){this.$target=e,this.$images=t(".woocommerce-product-gallery__image",e),0!==this.$images.length?(e.data("product_gallery",this),this.flexslider_enabled="function"==typeof t.fn.flexslider&&wc_single_product_params.flexslider_enabled,this.zoom_enabled="function"==typeof t.fn.zoom&&wc_single_product_params.zoom_enabled,this.photoswipe_enabled="undefined"!=typeof PhotoSwipe&&wc_single_product_params.photoswipe_enabled,i&&(this.flexslider_enabled=!1!==i.flexslider_enabled&&this.flexslider_enabled,this.zoom_enabled=!1!==i.zoom_enabled&&this.zoom_enabled,this.photoswipe_enabled=!1!==i.photoswipe_enabled&&this.photoswipe_enabled),1===this.$images.length&&(this.flexslider_enabled=!1),this.initFlexslider=this.initFlexslider.bind(this),this.initZoom=this.initZoom.bind(this),this.initZoomForTarget=this.initZoomForTarget.bind(this),this.initPhotoswipe=this.initPhotoswipe.bind(this),this.onResetSlidePosition=this.onResetSlidePosition.bind(this),this.getGalleryItems=this.getGalleryItems.bind(this),this.openPhotoswipe=this.openPhotoswipe.bind(this),this.trapFocusPhotoswipe=this.trapFocusPhotoswipe.bind(this),this.handlePswpTrapFocus=this.handlePswpTrapFocus.bind(this),this.flexslider_enabled?(this.initFlexslider(i.flexslider),e.on("woocommerce_gallery_reset_slide_position",this.onResetSlidePosition)):this.$target.css("opacity",1),this.zoom_enabled&&(this.initZoom(),e.on("woocommerce_gallery_init_zoom",this.initZoom)),this.photoswipe_enabled&&this.initPhotoswipe()):this.$target.css("opacity",1)};e.prototype.initFlexslider=function(e){var i=this.$target,o=this,a=t.extend({selector:".woocommerce-product-gallery__wrapper > .woocommerce-product-gallery__image",start:function(){i.css("opacity",1)},after:function(t){o.initZoomForTarget(o.$images.eq(t.currentSlide))}},e);i.flexslider(a),t(".woocommerce-product-gallery__wrapper .woocommerce-product-gallery__image:eq(0) .wp-post-image").one("load",function(){var e=t(this);e&&setTimeout(function(){var t=e.closest(".woocommerce-product-gallery__image").height(),i=e.closest(".flex-viewport");t&&i&&i.height(t)},100)}).each(function(){this.complete&&t(this).trigger("load")})},e.prototype.initZoom=function(){"complete"===document.readyState?this.initZoomForTarget(this.$images.first()):t(window).on("load",()=>{this.initZoomForTarget(this.$images.first())})},e.prototype.initZoomForTarget=function(e){if(!this.zoom_enabled)return!1;var i=this.$target.width(),o=!1;if(t(e).each(function(e,a){if(t(a).find("img").data("large_image_width")>i)return o=!0,!1}),o){var a=t.extend({touch:!1,callback:function(){var t=this;setTimeout(function(){t.removeAttribute("role"),t.setAttribute("alt",""),t.setAttribute("aria-hidden","true")},100)}},wc_single_product_params.zoom_options);"ontouchstart"in document.documentElement&&(a.on="click"),e.trigger("zoom.destroy"),e.zoom(a),setTimeout(function(){e.find(":hover").length&&e.trigger("mouseover")},100)}},e.prototype.initPhotoswipe=function(){this.zoom_enabled&&this.$images.length>0?(this.$target.prepend('<a href="#" role="button" class="woocommerce-product-gallery__trigger" aria-haspopup="dialog" aria-controls="photoswipe-fullscreen-dialog" aria-label="'+wc_single_product_params.i18n_product_gallery_trigger_text+'"><span aria-hidden="true">🔍</span></a>'),this.$target.on("click",".woocommerce-product-gallery__trigger",this.openPhotoswipe),this.$target.on("keydown",".woocommerce-product-gallery__trigger",t=>{" "===t.key&&this.openPhotoswipe(t)}),this.$target.on("click",".woocommerce-product-gallery__image a",function(t){t.preventDefault()}),this.flexslider_enabled||this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)):this.$target.on("click",".woocommerce-product-gallery__image a",this.openPhotoswipe)},e.prototype.onResetSlidePosition=function(){this.$target.flexslider(0)},e.prototype.getGalleryItems=function(){var e=this.$images,i=[];return e.length>0&&e.each(function(e,o){var a=t(o).find("img");if(a.length){var r=a.attr("data-large_image"),n=a.attr("data-large_image_width"),s=a.attr("data-large_image_height"),l={alt:a.attr("alt"),src:r,w:n,h:s,title:a.attr("data-caption")?a.attr("data-caption"):a.attr("title")};i.push(l)}}),i},e.prototype.openPhotoswipe=function(e){e.preventDefault();var i,o=t(".pswp")[0],a=this.getGalleryItems(),r=t(e.target),n=e.currentTarget,s=this;i=0<r.closest(".woocommerce-product-gallery__trigger").length?this.$target.find(".flex-active-slide"):r.closest(".woocommerce-product-gallery__image");var l=t.extend({index:t(i).index(),addCaptionHTMLFn:function(t,e){return t.title?(e.children[0].textContent=t.title,!0):(e.children[0].textContent="",!1)},timeToIdle:0},wc_single_product_params.photoswipe_options),c=new PhotoSwipe(o,PhotoSwipeUI_Default,a,l);c.listen("afterInit",function(){s.trapFocusPhotoswipe(!0)}),c.listen("close",function(){s.trapFocusPhotoswipe(!1),n.focus()}),c.init()},e.prototype.trapFocusPhotoswipe=function(t){var e=document.querySelector(".pswp");e&&(t?e.addEventListener("keydown",this.handlePswpTrapFocus):e.removeEventListener("keydown",this.handlePswpTrapFocus))},e.prototype.handlePswpTrapFocus=function(t){var e=t.currentTarget.querySelectorAll("button:not([disabled])"),i=Array.from(e).filter(function(t){return"none"!==t.style.display&&"none"!==window.getComputedStyle(t).display});if(!(1>=i.length)){var o=i[0],a=i[i.length-1];"Tab"===t.key&&(t.shiftKey?document.activeElement===o&&(t.preventDefault(),a.focus()):document.activeElement===a&&(t.preventDefault(),o.focus()))}},t.fn.wc_product_gallery=function(t){return new e(this,t||wc_single_product_params),this},t(".woocommerce-product-gallery").each(function(){t(this).trigger("wc-product-gallery-before-init",[this,wc_single_product_params]),t(this).wc_product_gallery(wc_single_product_params),t(this).trigger("wc-product-gallery-after-init",[this,wc_single_product_params])})});
!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:"/"})});
function on_keydown_remove_from_cart(e){" "===e.key&&(e.preventDefault(),e.currentTarget.click())}function focus_populate_live_region(){var e=["woocommerce-message","woocommerce-error","wc-block-components-notice-banner"].map(function(e){return"."+e+'[role="alert"]'}).join(", "),o=document.querySelectorAll(e);if(0!==o.length){var t=o[0];t.setAttribute("tabindex","-1");var n=setTimeout(function(){t.focus(),clearTimeout(n)},500)}}function refresh_sorted_by_live_region(){var e=document.querySelector(".woocommerce-result-count"),o=document.querySelector('[data-wp-interactive="woocommerce/product-filters"]');if(e&&window.location.search&&!o){var t=e.innerHTML;e.setAttribute("role","alert"),e.setAttribute("aria-hidden","true");var n=setTimeout(function(){e.setAttribute("aria-hidden","false"),e.innerHTML="",e.innerHTML=t,clearTimeout(n)},2e3)}}function on_document_ready(){focus_populate_live_region(),refresh_sorted_by_live_region()}jQuery(function(e){e(".woocommerce-ordering").on("change","select.orderby",function(){e(this).closest("form").trigger("submit")}),e("input.qty:not(.product-quantity input.qty)").each(function(){var o=parseFloat(e(this).attr("min"));o>=0&&parseFloat(e(this).val())<o&&e(this).val(o)});var o="store_notice"+(e(".woocommerce-store-notice").data("noticeId")||"");if("hidden"===Cookies.get(o))e(".woocommerce-store-notice").hide();else{function t(o){["Enter"," "].includes(o.key)&&(o.preventDefault(),e(".woocommerce-store-notice__dismiss-link").click())}e(".woocommerce-store-notice").show(),e(".woocommerce-store-notice__dismiss-link").on("click",function n(r){Cookies.set(o,"hidden",{path:"/"}),e(".woocommerce-store-notice").hide(),r.preventDefault(),e(".woocommerce-store-notice__dismiss-link").off("click",n).off("keydown",t)}).on("keydown",t)}e(".woocommerce-input-wrapper span.description").length&&e(document.body).on("click",function(){e(".woocommerce-input-wrapper span.description:visible").prop("aria-hidden",!0).slideUp(250)}),e(".woocommerce-input-wrapper").on("click",function(e){e.stopPropagation()}),e(".woocommerce-input-wrapper :input").on("keydown",function(o){var t=e(this).parent().find("span.description");if(27===o.which&&t.length&&t.is(":visible"))return t.prop("aria-hidden",!0).slideUp(250),o.preventDefault(),!1}).on("click focus",function(){var o=e(this).parent(),t=o.find("span.description");o.addClass("currentTarget"),e(".woocommerce-input-wrapper:not(.currentTarget) span.description:visible").prop("aria-hidden",!0).slideUp(250),t.length&&t.is(":hidden")&&t.prop("aria-hidden",!1).slideDown(250),o.removeClass("currentTarget")}),e.scroll_to_notices=function(o){o.length&&e("html, body").animate({scrollTop:o.offset().top-100},1e3)},e('.woocommerce form .woocommerce-Input[type="password"]').wrap('<span class="password-input"></span>'),e(".woocommerce form input").filter(":password").parent("span").addClass("password-input"),e(".password-input").each(function(){const o=e(this).find("input").attr("id");e(this).append('<button type="button" class="show-password-input" aria-label="'+woocommerce_params.i18n_password_show+'" aria-describedBy="'+o+'"></button>')}),e(".show-password-input").on("click",function(o){o.preventDefault(),e(this).hasClass("display-password")?(e(this).removeClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_show)):(e(this).addClass("display-password"),e(this).attr("aria-label",woocommerce_params.i18n_password_hide)),e(this).hasClass("display-password")?e(this).siblings(['input[type="password"]']).prop("type","text"):e(this).siblings('input[type="text"]').prop("type","password"),e(this).siblings("input").focus()}),e("a.coming-soon-footer-banner-dismiss").on("click",function(o){var t=e(o.target);e.ajax({type:"post",url:t.data("rest-url"),data:{woocommerce_meta:{coming_soon_banner_dismissed:"yes"}},beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",t.data("rest-nonce"))},complete:function(){e("#coming-soon-footer-banner").hide()}})}),"undefined"==typeof wc_add_to_cart_params&&e(document.body).on("keydown",".remove_from_cart_button",on_keydown_remove_from_cart),e(document.body).on("item_removed_from_classic_cart updated_wc_div",focus_populate_live_region)}),document.addEventListener("DOMContentLoaded",on_document_ready);
(function ($){
if(awdr_params.refresh_order_review=='1'){
$(document).on('change', 'input[name="payment_method"],input[name="billing_city"],input[name="billing_postcode"]', function (){
refreshCart();
});
$(document).on('blur', 'input[name="billing_email"], select#billing_state', function (){
refreshCart();
});
}
function refreshCart(){
$('body').trigger('update_checkout');
}
$(document).ready(function ($){
function init_events(){
if(awdr_params.enable_update_price_with_qty=='show_dynamically'){
function getWDRDPTarget(form, target, is_variable){
let $price_place='';
if(form.find(target).length){
$price_place=form.find(target).first();
if(is_variable===true){
if(!form.find(target+' .price').length){
$price_place.html("<div class='price'></div>");
}
$price_place=form.find(target+' .price').first();
}}else{
$price_place=$(target).first();
if(is_variable===true){
if(!$(target+' .price').length){
$price_place.html("<div class='price'></div>");
}
$price_place=$(target+' .price').first();
}}
return $price_place;
}
$(document).on('change', '[name="quantity"]', function (){
var awdr_qty_object=$(this);
setTimeout(function(){
var $qty=awdr_qty_object.val();
var $product_id=0;
var $price_place="";
var form=awdr_qty_object.closest("form");
if(form.find('button[name="add-to-cart"]').length){
$product_id=form.find('button[name="add-to-cart"]').first().val();
var target='div.product p.price';
if(awdr_params.custom_target_simple_product!=undefined){
if(awdr_params.custom_target_simple_product!=""){
target=awdr_params.custom_target_simple_product;
}}
$price_place=getWDRDPTarget(form, target, false);
}else if(form.find('input[name="variation_id"]').length){
$product_id=form.find('input[name="variation_id"]').val();
var target='div.product .woocommerce-variation-price';
if(awdr_params.custom_target_variable_product!=undefined){
if(awdr_params.custom_target_variable_product!=""){
target=awdr_params.custom_target_variable_product;
}}
$price_place=getWDRDPTarget(form, target, true);
}else if(form.find('input[name="add-to-cart"]').length){
$product_id=form.find('input[name="add-to-cart"]').first().val();
var target='div.product p.price';
if(awdr_params.custom_target_simple_product!=undefined){
if(awdr_params.custom_target_simple_product!=""){
target=awdr_params.custom_target_simple_product;
}}
$price_place=getWDRDPTarget(form, target, false);
}
if(!$product_id||$product_id==0){
if(awdr_params.custom_simple_product_id_selector!=undefined){
if(awdr_params.custom_simple_product_id_selector!=""){
let simple_product_id_selector=awdr_params.custom_simple_product_id_selector;
$product_id=$(simple_product_id_selector).val();
let target='div.product p.price';
if(awdr_params.custom_target_simple_product!=undefined){
if(awdr_params.custom_target_simple_product!=""){
target=awdr_params.custom_target_simple_product;
}}
$price_place=getWDRDPTarget(form, target, false);
}}
if(awdr_params.custom_variable_product_id_selector!=undefined){
if(awdr_params.custom_variable_product_id_selector!=""){
let variable_product_id_selector=awdr_params.custom_variable_product_id_selector;
$product_id=$(variable_product_id_selector).val();
let target='div.product .woocommerce-variation-price';
if(awdr_params.custom_target_variable_product!=undefined){
if(awdr_params.custom_target_variable_product!=""){
target=awdr_params.custom_target_variable_product;
}}
$price_place=getWDRDPTarget(form, target, true);
}}
}
if(!$product_id||!$price_place||$product_id==0){
return;
}
var data={
action: 'wdr_ajax',
method: 'get_price_html',
product_id: $product_id,
qty: $qty,
awdr_nonce: awdr_params.nonce,
};
$.ajax({
url: awdr_params.ajaxurl,
data: data,
type: 'POST',
success: function (response){
if(response.price_html){
$price_place.html(response.price_html)
}else{
if(response.original_price_html!=undefined){
$price_place.html(response.original_price_html)
}}
$(document).trigger('wdr_dynamic_price_update', [response]);
},
error: function (response){
$price_place.html("")
}});
}, 0);
});
}}
if(awdr_params.js_init_trigger){
$(document).on(awdr_params.js_init_trigger, function (){
init_events();
});
}
init_events();
if(awdr_params.awdr_dynamic_bulk_table_status=="1"){
if(awdr_params.awdr_dynamic_bulk_table_off=="on"){
function awdr_load_variation_table(variation_id){
setTimeout(function(){
if(variation_id!=''&&variation_id!='0'){
var data={
action: 'wdr_ajax',
method: 'get_variable_product_bulk_table',
product_id: variation_id,
awdr_nonce: awdr_params.nonce,
};
let awdr_opacity='div.awdr-bulk-customizable-table';
if(awdr_params.awdr_opacity_to_bulk_table!=undefined){
if(awdr_params.awdr_opacity_to_bulk_table!=""){
awdr_opacity=awdr_params.awdr_opacity_to_bulk_table;
}}
$.ajax({
url: awdr_params.ajaxurl,
data: data,
type: 'POST',
beforeSend: function (){
$(awdr_opacity).css('opacity','0.5');
},
complete: function (){
$(awdr_opacity).css('opacity','1');
},
success: function (response){
if(response.bulk_table){
$('.awdr-bulk-customizable-table').html(response.bulk_table);
}},
error: function (response){
$('.awdr-bulk-customizable-table').html("")
}});
}}, 100);
}
$(".single_variation_wrap").on("hide_variation", function(event){
let variation_id=$(this).closest('form').find('input[name="product_id"]').val();
awdr_load_variation_table(variation_id);
});
$(".single_variation_wrap").on("show_variation", function(event, variation, purchasable){
let variation_id=variation.variation_id;
if(variation.is_bundled!=undefined){
if(variation.is_bundled==true){
return;
}}
awdr_load_variation_table(variation_id);
});
}}
});
})(jQuery);
(function ($){
$.extend({
AdvanceWooDiscountRules: {
form: null,
product_id: null,
quantity: 0,
options: [],
target: null,
getDynamicDiscountPriceFromCartForm: function($form, $target, $options){
if(typeof $options!=='undefined'){
this.options=$options;
}
if(typeof $target!=='undefined'){
this.target=$target;
}
if(typeof $form!=='undefined'&&$form.is('form')){
this.form=$form;
}else{
this.logError("Incorrect form provided");
}
this.product_id=this.getProductIdFromForm();
this.quantity=this.getProductQuantityFromForm();
this.getDiscountPriceForProduct();
},
getDiscountPriceForProduct: function (){
if(this.product_id===null||this.product_id==0){
this.logError("Invalid product");
return [];
}
var data={
action: 'awdr_get_product_discount',
product_id: this.product_id,
qty: this.quantity,
awdr_nonce: awdr_params.nonce,
};
if(typeof this.options.custom_price!=='undefined'){
data.custom_price=this.options.custom_price;
}
var $target=this.target;
var $options=this.options;
$.ajax({
url: awdr_params.ajaxurl,
data: data,
type: 'POST',
success: function (response){
$(document.body).trigger("advanced_woo_discount_rules_on_get_response_for_dynamic_discount", [ response, $target, $options ]);
},
error: function (response){
}});
},
getProductIdFromForm: function (){
var variationIdEl=this.form.find('[name="variation_id"]');
var productIdEl=this.form.find('[name="add-to-cart"]');
if(variationIdEl.length){
return parseInt(variationIdEl.val());
}else if(productIdEl.length){
return parseInt(productIdEl.val());
}
return false;
},
getProductQuantityFromForm: function (){
var $input=this.form.find('input[name="quantity"]');
if($input.length===0){
return 0;
}
return $input.val();
},
logError: function($text){
console.error("Advance discount rule error: %s", $text);
}}
});
})(jQuery);