2017-06-19 11:49:34 +00:00
|
|
|
jQuery(function(t){function e(){var e=t("select#product-type").val(),i=t("input#_virtual:checked").length,a=t("input#_downloadable:checked").length,o=".hide_if_downloadable, .hide_if_virtual",c=".show_if_downloadable, .show_if_virtual";t.each(woocommerce_admin_meta_boxes.product_types,function(t,e){o=o+", .hide_if_"+e,c=c+", .show_if_"+e}),t(o).show(),t(c).hide(),a&&t(".show_if_downloadable").show(),i&&t(".show_if_virtual").show(),t(".show_if_"+e).show(),a&&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(){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 a=e.find("input").position().top,o=i.position().top;e.closest(".tabs-panel").scrollTop(o-a+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 a=t("input[name=_visibility]:checked").attr("data-label");return"yes"===i?(a=a+", "+woocommerce_admin_meta_boxes.featured_label,t("input[name=_featured]").attr("checked","checked")):t("input[name=_featured]").removeAttr("checked"),t("#catalog-visibility-display").text(a),!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,a=e.closest("div, table");e.find("input").each(function(){""!==t(this).val()&&(i=!0)}),i?(a.find(".sale_schedule").hide(),a.find(".sale_price_dates_fields").show()):(a.find(".sale_schedule").show(),a.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(".sale_
|