File manager - Edit - /home/antilam/web/antilam.ru/public_html/wp-content/themes/woodmart/js/scripts/wc/frequentlyBoughtTogether.min.js
Back
!function(t){woodmartThemeModule.frequentlyBoughtTogether=function(){function d(d){var e={};return d.find(".wd-fbt-product").each(function(){var a=t(this),o=t(this).find("input"),i=a.data("id"),n=d.parents(".wd-fbt");o.length?o.is(":checked")?(a.find(".wd-fbt-product-variation").length?e[i]=a.find(".wd-fbt-product-variation select").val():e[i]="",n.find(".product.post-"+i).removeClass("wd-disabled-fbt")):o.parents(".wd-fbt-form").hasClass("wd-checkbox-uncheck")||n.find(".product.post-"+i).addClass("wd-disabled-fbt"):a.find(".wd-fbt-product-variation").length?e[i]=a.find(".wd-fbt-product-variation select").val():e[i]=""}),e}t("form.wd-fbt-form").each(function(){var e="",a=t(this);a.on("change",".wd-fbt-product input, .wd-fbt-product select",function(){var o=t(this),i=d(a),n=a.find("input[name=wd-fbt-main-product]").val(),r=a.find(".wd-fbt-purchase-btn");if(i&&void 0!==i[n]){2>Object.keys(i).length?r.addClass("wd-disabled"):r.removeClass("wd-disabled");var s=a.parents(".wd-fbt").find(".wd-carousel"),c=o.parents(".wd-fbt-product").index();void 0===s[0].swiper||t(s.find(".wd-carousel-item")[c]).hasClass("wd-active")||(1===c&&1<s[0].swiper.slides.length&&(c=0),void 0!==s[0].swiper.slideTo&&s[0].swiper.slideTo(c,500)),clearTimeout(e),e=setTimeout(function(){!function(d,e){var a=d.find("input[name=wd-fbt-main-product]").val(),o=d.find("input[name=wd-fbt-bundle-id]").val();d.find(".wd-loader-overlay").addClass("wd-loading"),t.ajax({url:woodmart_settings.ajaxurl,data:{action:"woodmart_update_frequently_bought_price",products_id:e,main_product:a,bundle_id:o},method:"POST",success:function(d){d.fragments&&t.each(d.fragments,function(d,e){t(d).replaceWith(e)})},error:function(){console.log("ajax error")},complete:function(){d.find(".wd-loader-overlay").removeClass("wd-loading")}})}(a,i)},1e3)}}),a.on("change",".wd-fbt-product select",function(){var d=t(this),e=d.parents(".wd-fbt-product").data("id"),a=d.parents(".wd-fbt").find(".wd-product[data-id="+e+"]").find(".wd-product-img-link > img, .wd-product-img-link > picture > img"),o=d.find("option:selected").data("image-src"),i=d.find("option:selected").data("image-srcset");a.attr("srcset")&&(i||(i=o),a.attr("srcset",i)),a.attr("src",o)}),a.on("click",".wd-fbt-purchase-btn",function(o){o.preventDefault();var i=t(this);if(!i.hasClass("wd-disabled")){var n=d(a),r=a.find("input[name=wd-fbt-main-product]").val(),s=a.find("input[name=wd-fbt-bundle-id]").val();n&&void 0!==n[r]&&(clearTimeout(e),i.addClass("loading"),t.ajax({url:woodmart_settings.ajaxurl,data:{action:"woodmart_purchasable_fbt_products",products_id:n,main_product:r,bundle_id:s},method:"POST",success:function(d){var e=t(".woocommerce-notices-wrapper");if(e.empty(),d.notices&&d.notices.indexOf("error")>0){e.append(d.notices);var a=e.offset().top-woodmart_settings.ajax_scroll_offset;t("html, body").stop().animate({scrollTop:a},400)}else void 0!==d.fragments&&(void 0!==t.fn.magnificPopup&&"widget"===woodmart_settings.add_to_cart_action&&t.magnificPopup.close(),i.addClass("added"),woodmartThemeModule.$body.trigger("added_to_cart",[d.fragments,d.cart_hash,jQuery()]))},error:function(){console.log("ajax error")},complete:function(){i.removeClass("loading")}}))}})})},t(document).ready(function(){woodmartThemeModule.frequentlyBoughtTogether()})}(jQuery);
| ver. 1.4 |
Github
|
.
| PHP 8.4.22 | Generation time: 0.12 |
proxy
|
phpinfo
|
Settings