woocommerce/assets/js/admin/meta-boxes-product.min.js

1 line
12 KiB
JavaScript
Raw Normal View History

2017-08-10 15:32:24 +00:00
jQuery(function(t){function e(){var e=t("select#product-type").val(),i=t("input#_virtual:checked").length,o=t("input#_downloadable:checked").length,a=".hide_if_downloadable, .hide_if_virtual",c=".show_if_downloadable, .show_if_virtual";t.each(woocommerce_admin_meta_boxes.product_types,function(t,e){a=a+", .hide_if_"+e,c=c+", .show_if_"+e}),t(a).show(),t(c).hide(),o&&t(".show_if_downloadable").show(),i&&t(".show_if_virtual").show(),t(".show_if_"+e).show(),o&&t(".hide_if_downloadable").hide(),i&&t(".hide_if_virtual").hide(),t(".hide_if_"+e).hide(),t("input#_manage_stock").change(),t(".woocommerce_options_panel").each(function(){var e=t(this).children(".options_group");if(0!==e.length&&e.filter(function(){return"none"===t(this).css("display")}).length===e.length){var i=t(this).prop("id");t(".product_data_tabs").find('li a[href="#'+i+'"]').parent().hide()}})}function i(e){var i=t(e).next().is(".hasDatepicker")?"minDate":"maxDate",o="minDate"===i?t(e).next():t(e).prev(),a=t(e).datepicker("getDate");t(o).datepicker("option",i,a),t(e).change()}function o(){t(".product_attributes .woocommerce_attribute").each(function(e,i){t(".attribute_position",i).val(parseInt(t(i).index(".product_attributes .woocommerce_attribute"),10))})}t(function(){t('[id$="-all"] > ul.categorychecklist').each(function(){var e=t(this),i=e.find(":checked").first();if(i.length){var o=e.find("input").position().top,a=i.position().top;e.closest(".tabs-panel").scrollTop(a-o+5)}})}),t("#upsell_product_data").bind("keypress",function(t){if(13===t.keyCode)return!1}),t(".type_box").appendTo("#woocommerce-product-data .hndle span"),t(function(){t("#woocommerce-product-data").find(".hndle").unbind("click.postboxes"),t("#woocommerce-product-data").on("click",".hndle",function(e){t(e.target).filter("input, option, label, select").length||t("#woocommerce-product-data").toggleClass("closed")})}),t("#catalog-visibility").find(".edit-catalog-visibility").click(function(){return t("#catalog-visibility-select").is(":hidden")&&(t("#catalog-visibility-select").slideDown("fast"),t(this).hide()),!1}),t("#catalog-visibility").find(".save-post-visibility").click(function(){t("#catalog-visibility-select").slideUp("fast"),t("#catalog-visibility").find(".edit-catalog-visibility").show();var e=t("input[name=_visibility]:checked").attr("data-label");return t("input[name=_featured]").is(":checked")&&(e=e+", "+woocommerce_admin_meta_boxes.featured_label,t("input[name=_featured]").attr("checked","checked")),t("#catalog-visibility-display").text(e),!1}),t("#catalog-visibility").find(".cancel-post-visibility").click(function(){t("#catalog-visibility-select").slideUp("fast"),t("#catalog-visibility").find(".edit-catalog-visibility").show();var e=t("#current_visibility").val(),i=t("#current_featured").val();t("input[name=_visibility]").removeAttr("checked"),t("input[name=_visibility][value="+e+"]").attr("checked","checked");var o=t("input[name=_visibility]:checked").attr("data-label");return"yes"===i?(o=o+", "+woocommerce_admin_meta_boxes.featured_label,t("input[name=_featured]").attr("checked","checked")):t("input[name=_featured]").removeAttr("checked"),t("#catalog-visibility-display").text(o),!1}),t("select#product-type").change(function(){var i=t(this).val();"variable"===i?(t("input#_manage_stock").change(),t("input#_downloadable").prop("checked",!1),t("input#_virtual").removeAttr("checked")):"grouped"===i?(t("input#_downloadable").prop("checked",!1),t("input#_virtual").removeAttr("checked")):"external"===i&&(t("input#_downloadable").prop("checked",!1),t("input#_virtual").removeAttr("checked")),e(),t("ul.wc-tabs li:visible").eq(0).find("a").click(),t(document.body).trigger("woocommerce-product-type-change",i,t(this))}).change(),t("input#_downloadable, input#_virtual").change(function(){e()}),t(".sale_price_dates_fields").each(function(){var e=t(this),i=!1,o=e.closest("div, table");e.find("input").each(function(){""!==t(this).val()&&(i=!0)}),i?(o.find(".sale_schedule").hide(),o.find(".sale_price_dates_fields").show()):(o.find(".sale_schedule").show(),o.find(".sale_price_dates_fields").hide(