D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
raptqcnr
/
www
/
wp-content
/
themes
/
woodmart
/
js
/
scripts
/
wc
/
Filename :
productReviews.min.js
back
Copy
!function(r){woodmartThemeModule.singleProdReviews=function(){let n=r("#reviews");function s(){var e=r(".wd-rating-summary-cont").find(".wd-active");return 0<e.length?e.find(".wd-rating-label").data("rating").toString():""}function i(e=!1,i=!1){var o=r(".commentlist"),o=0<o.length?o.data("reviews-columns"):{};let t={action:"woodmart_filter_review",rating:s(),product_id:n.data("product-id"),order_by:0<n.find(".wd-reviews-sorting-select :checked").length?n.find(".wd-reviews-sorting-select :checked").val():"newest",only_images:r("#wd-with-image-checkbox").is(":checked"),summary_criteria_ids:woodmart_settings.summary_criteria_ids};o.hasOwnProperty("reviews_columns")&&(t.reviews_columns=o.reviews_columns),o.hasOwnProperty("reviews_columns_tablet")&&(t.reviews_columns_tablet=o.reviews_columns_tablet),o.hasOwnProperty("reviews_columns_mobile")&&(t.reviews_columns_mobile=o.reviews_columns_mobile),e&&(t.rating="",t.only_images=!1),r.ajax({url:woodmart_settings.ajaxurl,method:"GET",data:t,beforeSend:function(){var e=n.find("#comments .commentlist");n.find("#comments .wd-loader-overlay").addClass("wd-loading"),i&&n.find(".wd-rating-summary-wrap .wd-loader-overlay").addClass("wd-loading"),e.removeClass("wd-active"),e.removeClass("wd-in")},complete:function(){n.find("#comments .wd-loader-overlay").removeClass("wd-loading"),i&&n.find(".wd-rating-summary-wrap .wd-loader-overlay").removeClass("wd-loading"),setTimeout(function(){n.find("#comments .commentlist").addClass("wd-active")},50),setTimeout(function(){n.find("#comments .commentlist").addClass("wd-in")},100)},success:function(e){(!t.rating??!t.only_images)&&r(".wd-reviews-sorting-clear").addClass("wd-hide"),e.title&&n.find(".woocommerce-Reviews-title").html(e.title),r(document).trigger("woodmart_reviews_sorting_clear",t),e.content&&n.find("#comments .wd-reviews-content").html(e.content),woodmartThemeModule.hasOwnProperty("photoswipeImages")&&"function"==typeof woodmartThemeModule.photoswipeImages&&woodmartThemeModule.photoswipeImages()},error:function(e){console.error(e)}})}n.off("click",".wd-rating-summary-item").on("click",".wd-rating-summary-item",function(){if(woodmart_settings.is_rating_summary_filter_enabled&&!r(this).hasClass("wd-empty")){r(this).siblings().removeClass("wd-active"),r(this).toggleClass("wd-active");let o=s();r(document).on("woodmart_reviews_sorting_clear",function(e,i){o?r(".wd-reviews-sorting-clear").removeClass("wd-hide"):r(".wd-reviews-sorting-clear").addClass("wd-hide")}),i(!1,!0)}}).off("click",".wd-reviews-sorting-clear").on("click",".wd-reviews-sorting-clear",function(e){e.preventDefault(),r(".wd-rating-summary-item").each(function(){r(this).removeClass("wd-active")}),r(document).on("woodmart_reviews_sorting_clear",function(e,i){r(".wd-reviews-sorting-clear").addClass("wd-hide")}),r("#wd-with-image-checkbox").prop("checked",!1),i(!0,!0)}).off("click","#wd-with-image-checkbox").on("click","#wd-with-image-checkbox",function(){let o=r(this).is(":checked");r(document).on("woodmart_reviews_sorting_clear",function(e,i){o?r(".wd-reviews-sorting-clear").removeClass("wd-hide"):0===i.rating.length&&r(".wd-reviews-sorting-clear").addClass("wd-hide")}),i()}).off("change",".wd-reviews-sorting-select").on("change",".wd-reviews-sorting-select",function(){i()})},r(document).ready(function(){woodmartThemeModule.singleProdReviews()}),window.addEventListener("wdOpenDescHiddenTab",function(e){woodmartThemeModule.hasOwnProperty("singleProdReviews")&&woodmartThemeModule.singleProdReviews()})}(jQuery);