2015-07-27 17:21:58 +00:00
|
|
|
jQuery(function(t){function e(){var e=t("select#product-type").val(),i=t("input#_virtual:checked").size(),o=t("input#_downloadable:checked").size(),a=".hide_if_downloadable, .hide_if_virtual",c=".show_if_downloadable, .show_if_virtual, .show_if_external";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()}function i(){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){return 13===t.keyCode?!1:void 0}),t(".type_box").appendTo("#woocommerce-product-data h3.hndle span"),t(function(){t("#woocommerce-product-data h3.hndle").unbind("click.postboxes"),jQuery("#woocommerce-product-data").on("click","h3.hndle",function(e){t(e.target).filter("input, option, label, select").length||t("#woocommerce-product-data").toggleClass("closed")})}),t("#catalog-visibility .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 .save-post-visibility").click(function(){t("#catalog-visibility-select").slideUp("fast"),t("#catalog-visibility .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 .cancel-post-visibility").click(function(){t("#catalog-visibility-select").slideUp("fast"),t("#catalog-visibility .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(document.body).on("woocommerce-product-type-change",function(e,i){"variable"!==i&&0<t("#variable_product_options input[name^=variable_sku]").length&&t(document.body).triggerHandler("woocommerce-display-product-type-alert",i)!==!1&&window.alert(woocommerce_admin_meta_boxes.i18n_product_type_alert)}),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())}),t("#woocommerce-product-data").on("click",".sale_schedule",function(){var e=t(this).closest("div, table");return t(this).hide(),e.find(".cancel_sale_schedule").show(),e.find
|