woocommerce/assets/js/admin/wc-setup.min.js

1 line
1.7 KiB
JavaScript
Raw Normal View History

jQuery(function(e){function i(){e(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}function c(){e("form.activate-jetpack").submit()}function t(){wp.ajax.post("setup_wizard_check_jetpack").then(function(e){if(!e||!e.is_active||"yes"===e.is_active)return c();setTimeout(t,3e3)}).fail(function(){c()})}e(".button-next").on("click",function(){var c=e(this).parents("form").get(0);return("function"!=typeof c.checkValidity||c.checkValidity())&&i(),!0}),e(".wc-wizard-services").on("change",".wc-wizard-service-enable input",function(){e(this).is(":checked")?(e(this).closest(".wc-wizard-service-toggle").removeClass("disabled"),e(this).closest(".wc-wizard-service-item").addClass("checked")):(e(this).closest(".wc-wizard-service-toggle").addClass("disabled"),e(this).closest(".wc-wizard-service-item").removeClass("checked"))}),e(".wc-wizard-services").on("click",".wc-wizard-service-enable",function(i){i.stopPropagation();var c=e(this).find(".wc-wizard-service-toggle input");c.prop("checked",!c.prop("checked")).change()}),e(".wc-wizard-services-list-toggle").on("change",".wc-wizard-service-enable input",function(){e(this).closest(".wc-wizard-services").find(".wc-wizard-service-item").slideToggle().css("display","flex")}),e(".wc-wizard-services").on("change",".wc-wizard-shipping-method-select .method",function(i){var c=e(this).parent("div"),t=i.target.value,s=c.find(".shipping-method-description");s.find("p").hide(),s.find("p."+t).show();var n=c.find(".shipping-method-settings");n.find("div").hide(),n.find("div."+t).show()}),e(".activate-jetpack").on("click",".button-primary",function(e){if(i(),"no"===wc_setup_params.pending_jetpack_install)return!0;e.preventDefault(),t()})});