1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
jQuery(function(a){var b=a.parseJSON(wc_setup_params.locale_info);a('select[name="store_location"]').change(function(){var c=a(this).val().split(":"),d=c[0],e=c[1]||!1,f=b[d],g=["thousand_sep","decimal_sep","num_decimals","currency_pos"];if(f){if(a.each(f,function(b,c){a(':input[name="'+b+'"]').val(c).change(),-1!==a.inArray(b,g)&&a(':input[name="'+b+'"]').closest("tr").hide()}),!a.isArray(f.tax_rates)){var h=[];if(e&&f.tax_rates[e]?h=h.concat(f.tax_rates[e]):f.tax_rates[""]&&(h=h.concat(f.tax_rates[""])),h=h.concat(f.tax_rates["*"]||[]),h.length){var i=a("table.tax-rates tbody").empty();a.each(h,function(b,c){a("<tr>",{html:[a("<td>",{class:"readonly",text:c.country||""}),a("<td>",{class:"readonly",text:c.state||"*"}),a("<td>",{class:"readonly",text:c.rate||""}),a("<td>",{class:"readonly",text:c.name||""})]}).appendTo(i)}),a(".tax-rates").show()}else a(".tax-rates").hide()}}else a(':input[name="currency_pos"]').closest("tr").show(),a(':input[name="thousand_sep"]').closest("tr").show(),a(':input[name="decimal_sep"]').closest("tr").show(),a(':input[name="num_decimals"]').closest("tr").show(),a(".tax-rates").hide()}).change(),a('input[name="woocommerce_calc_taxes"]').change(function(){a(this).is(":checked")?(a(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").show(),a("tr.tax-rates").show()):(a(':input[name="woocommerce_prices_include_tax"], :input[name="woocommerce_import_tax_rates"]').closest("tr").hide(),a("tr.tax-rates").hide())}).change(),a(".button-next").on("click",function(){return a(".wc-setup-content").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),!0}),a(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("change",".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input",function(){a(this).is(":checked")?a(this).closest("li").addClass("checked"):a(this).closest("li").removeClass("checked")}),a(".wc-wizard-payment-gateways, .wc-wizard-shipping-methods").on("click","li.wc-wizard-gateway, li.wc-wizard-shipping",function(){var b=a(this).find(".wc-wizard-gateway-enable input, .wc-wizard-shipping-enable input");b.prop("checked",!b.prop("checked")).change()}),a(".wc-wizard-payment-gateways li, .wc-wizard-shipping-methods li").on("click","table, a",function(a){a.stopPropagation()})}); |