2015-01-23 15:45:57 +00:00
|
|
|
jQuery(function(e){function t(){var t=e("select#product-type").val();var n=e("input#_virtual:checked").size();var r=e("input#_downloadable:checked").size();var i=".hide_if_downloadable, .hide_if_virtual";var s=".show_if_downloadable, .show_if_virtual, .show_if_external";e.each(woocommerce_admin_meta_boxes.product_types,function(e,t){i=i+", .hide_if_"+t;s=s+", .show_if_"+t});e(i).show();e(s).hide();if(r){e(".show_if_downloadable").show()}if(n){e(".show_if_virtual").show()}e(".show_if_"+t).show();if(r){e(".hide_if_downloadable").hide()}if(n){e(".hide_if_virtual").hide()}e(".hide_if_"+t).hide();e("input#_manage_stock").change()}function i(){e(".product_attributes .woocommerce_attribute").each(function(t,n){e(".attribute_position",n).val(parseInt(e(n).index(".product_attributes .woocommerce_attribute")))})}e(function(){e('[id$="-all"] > ul.categorychecklist').each(function(){var t=e(this);var n=t.find(":checked").first();if(!n.length)return;var r=t.find("input").position().top;var i=n.position().top;t.closest(".tabs-panel").scrollTop(i-r+5)})});e("#upsell_product_data").bind("keypress",function(e){if(e.keyCode==13)return false});e(".type_box").appendTo("#woocommerce-product-data h3.hndle span");e(function(){e("#woocommerce-product-data h3.hndle").unbind("click.postboxes");jQuery("#woocommerce-product-data").on("click","h3.hndle",function(t){if(e(t.target).filter("input, option, label, select").length)return;e("#woocommerce-product-data").toggleClass("closed")})});e("#catalog-visibility .edit-catalog-visibility").click(function(){if(e("#catalog-visibility-select").is(":hidden")){e("#catalog-visibility-select").slideDown("fast");e(this).hide()}return false});e("#catalog-visibility .save-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("input[name=_visibility]:checked").val();var n=e("input[name=_visibility]:checked").attr("data-label");if(e("input[name=_featured]").is(":checked")){n=n+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}e("#catalog-visibility-display").text(n);return false});e("#catalog-visibility .cancel-post-visibility").click(function(){e("#catalog-visibility-select").slideUp("fast");e("#catalog-visibility .edit-catalog-visibility").show();var t=e("#current_visibility").val();var n=e("#current_featured").val();e("input[name=_visibility]").removeAttr("checked");e("input[name=_visibility][value="+t+"]").attr("checked","checked");var r=e("input[name=_visibility]:checked").attr("data-label");if(n=="yes"){r=r+", "+woocommerce_admin_meta_boxes.featured_label;e("input[name=_featured]").attr("checked","checked")}else{e("input[name=_featured]").removeAttr("checked")}e("#catalog-visibility-display").text(r);return false});e("select#product-type").change(function(){var n=e(this).val();if("variable"===n){e("input#_manage_stock").change();e("input#_downloadable").prop("checked",false);e("input#_virtual").removeAttr("checked")}else if("grouped"===n){e("input#_downloadable").prop("checked",false);e("input#_virtual").removeAttr("checked")}else if("external"===n){e("input#_downloadable").prop("checked",false);e("input#_virtual").removeAttr("checked")}t();e("ul.wc-tabs li:visible").eq(0).find("a").click();e("body").trigger("woocommerce-product-type-change",n,e(this))}).change();e("body").on("woocommerce-product-type-change",function(t,n){if("variable"!==n&&0<e("#variable_product_options input[name^=variable_sku]").length&&e("body").triggerHandler("woocommerce-display-product-type-alert",n)!==false){window.alert(woocommerce_admin_meta_boxes.i18n_product_type_alert)}});e("input#_downloadable, input#_virtual").change(function(){t()});e(".sale_price_dates_fields").each(function(){var t=e(this);var n=false;var r=t.closest("div, table");t.find("input").each(function(){if(e(this).val()!="")n=true});if(n){r.find(".sale_schedule").hide();r.find(".sale_price_dates_fields").show()}else{r.find(".sale_schedule").show();r.find(".sale_price_dates_fields").hide()}});e("#woocommerce-product-data
|