2013-09-03 16:35:20 +00:00
|
|
|
jQuery(function(e){function n(){e(".woocommerce_variations .woocommerce_variation").each(function(t,n){e(".variation_menu_order",n).val(parseInt(e(n).index(".woocommerce_variations .woocommerce_variation")))})}var t={items:".woocommerce_variation",cursor:"move",axis:"y",handle:"h3",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(e,t){t.item.css("background-color","#f6f6f6")},stop:function(e,t){t.item.removeAttr("style");n()}};jQuery("#variable_product_options").on("click","button.add_variation",function(){jQuery(".woocommerce_variations").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes_variations.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var e=jQuery(".woocommerce_variation").size(),t={action:"woocommerce_add_variation",post_id:woocommerce_admin_meta_boxes_variations.post_id,loop:e,security:woocommerce_admin_meta_boxes_variations.add_variation_nonce};jQuery.post(woocommerce_admin_meta_boxes_variations.ajax_url,t,function(e){jQuery(".woocommerce_variations").append(e);jQuery(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50});jQuery("input.variable_is_downloadable, input.variable_is_virtual").change();jQuery(".woocommerce_variations").unblock();jQuery("#variable_product_options").trigger("woocommerce_variations_added")});return!1});jQuery("#variable_product_options").on("click","button.link_all_variations",function(){var t=confirm(woocommerce_admin_meta_boxes_variations.i18n_link_all_variations);if(t){jQuery("#variable_product_options").block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes_variations.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var n={action:"woocommerce_link_all_variations",post_id:woocommerce_admin_meta_boxes_variations.post_id,security:woocommerce_admin_meta_boxes_variations.link_variation_nonce};jQuery.post(woocommerce_admin_meta_boxes_variations.ajax_url,n,function(t){var n=parseInt(t);n==1?alert(n+" "+woocommerce_admin_meta_boxes_variations.i18n_variation_added):n==0||n>1?alert(n+" "+woocommerce_admin_meta_boxes_variations.i18n_variations_added):alert(woocommerce_admin_meta_boxes_variations.i18n_no_variations_added);if(n>0){var r=window.location.toString();r=r.replace("post-new.php?","post.php?post="+woocommerce_admin_meta_boxes_variations.post_id+"&action=edit&");e("#variable_product_options").load(r+" #variable_product_options_inner",function(){e("#variable_product_options").unblock();jQuery("#variable_product_options").trigger("woocommerce_variations_added")})}else e("#variable_product_options").unblock()})}return!1});jQuery("#variable_product_options").on("click","button.remove_variation",function(e){e.preventDefault();var t=confirm(woocommerce_admin_meta_boxes_variations.i18n_remove_variation);if(t){var n=jQuery(this).parent().parent(),r=jQuery(this).attr("rel");if(r>0){jQuery(n).block({message:null,overlayCSS:{background:"#fff url("+woocommerce_admin_meta_boxes_variations.plugin_url+"/assets/images/ajax-loader.gif) no-repeat center",opacity:.6}});var i={action:"woocommerce_remove_variation",variation_id:r,security:woocommerce_admin_meta_boxes_variations.delete_variation_nonce};jQuery.post(woocommerce_admin_meta_boxes_variations.ajax_url,i,function(e){jQuery(n).fadeOut("300",function(){jQuery(n).remove()})})}else jQuery(n).fadeOut("300",function(){jQuery(n).remove()})}return!1});jQuery(".wc-metaboxes-wrapper").on("click","a.bulk_edit",function(e){var t=jQuery("select#field_to_edit").val();switch(t){case"toggle_enabled":var n=jQuery('input[name^="variable_enabled"]');n.attr("checked",!n.attr("checked"));break;case"toggle_downloadable":var n=jQuery('input[name^="variable_is_downloadable"]');n.attr("checked",!n.attr("checked"));jQuery("input.variable_is_downloadable").change();break;case"toggle_virtual":var n=jQuery('input[name^="variable_is_virtual"]');n.attr("checked",!n.attr("checked"));jQuery("input.variable_is_virtual").change();break;case"delete_all":var r=confirm(wooco
|