From 66e4dd84b977532945e82007edae0128a8f70880 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Sun, 5 Jul 2015 23:58:37 -0300 Subject: [PATCH] Removed variations drag and drop --- .../js/admin/meta-boxes-product-variation.js | 32 ------------------- .../admin/meta-boxes-product-variation.min.js | 2 +- 2 files changed, 1 insertion(+), 33 deletions(-) diff --git a/assets/js/admin/meta-boxes-product-variation.js b/assets/js/admin/meta-boxes-product-variation.js index a15be9c6f7f..913bf54d481 100644 --- a/assets/js/admin/meta-boxes-product-variation.js +++ b/assets/js/admin/meta-boxes-product-variation.js @@ -2,25 +2,6 @@ /*jshint devel: true */ jQuery( function ( $ ) { - var variation_sortable_options = { - items: '.woocommerce_variation', - cursor: 'move', - axis: 'y', - handle: 'h3', - scrollSensitivity: 40, - forcePlaceholderSize: true, - helper: 'clone', - opacity: 0.65, - placeholder: 'wc-metabox-sortable-placeholder', - start: function( event, ui ) { - ui.item.css( 'background-color', '#f6f6f6' ); - }, - stop: function ( event, ui ) { - ui.item.removeAttr( 'style' ); - variation_row_indexes(); - } - }; - $( '.wc-metaboxes-wrapper' ).on( 'click', 'a.bulk_edit', function () { var bulk_edit = $( 'select#field_to_edit' ).val(), checkbox, @@ -199,19 +180,6 @@ jQuery( function ( $ ) { $( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock' ).change(); - // Ordering - $( '#variable_product_options' ).on( 'woocommerce_variations_added', function () { - $( '.woocommerce_variations' ).sortable( variation_sortable_options ); - } ); - - $( '.woocommerce_variations' ).sortable( variation_sortable_options ); - - function variation_row_indexes() { - $( '.woocommerce_variations .woocommerce_variation' ).each( function ( index, el ) { - $( '.variation_menu_order', el ).val( parseInt( $( el ).index( '.woocommerce_variations .woocommerce_variation' ), 10 ) ); - }); - } - // Uploader var variable_image_frame; var setting_variation_image_id; diff --git a/assets/js/admin/meta-boxes-product-variation.min.js b/assets/js/admin/meta-boxes-product-variation.min.js index 4ee904ae830..83427db1a26 100644 --- a/assets/js/admin/meta-boxes-product-variation.min.js +++ b/assets/js/admin/meta-boxes-product-variation.min.js @@ -1 +1 @@ -jQuery(function(a){function b(){a(".woocommerce_variations .woocommerce_variation").each(function(b,c){a(".variation_menu_order",c).val(parseInt(a(c).index(".woocommerce_variations .woocommerce_variation"),10))})}var c={items:".woocommerce_variation",cursor:"move",axis:"y",handle:"h3",scrollSensitivity:40,forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"wc-metabox-sortable-placeholder",start:function(a,b){b.item.css("background-color","#f6f6f6")},stop:function(a,c){c.item.removeAttr("style"),b()}};a(".wc-metaboxes-wrapper").on("click","a.bulk_edit",function(){var b,c,d,e=a("select#field_to_edit").val();switch(e){case"toggle_enabled":b=a('input[name^="variable_enabled"]'),b.attr("checked",!b.attr("checked"));break;case"toggle_downloadable":b=a('input[name^="variable_is_downloadable"]'),b.attr("checked",!b.attr("checked")),a("input.variable_is_downloadable").change();break;case"toggle_virtual":b=a('input[name^="variable_is_virtual"]'),b.attr("checked",!b.attr("checked")),a("input.variable_is_virtual").change();break;case"toggle_manage_stock":b=a('input[name^="variable_manage_stock"]'),b.attr("checked",!b.attr("checked")),a("input.variable_manage_stock").change();break;case"delete_all":if(c=window.confirm(woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations),c&&(c=window.confirm(woocommerce_admin_meta_boxes_variations.i18n_last_warning))){var f=[];a(".woocommerce_variations .woocommerce_variation").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),a(".woocommerce_variations .woocommerce_variation .remove_variation").each(function(){var b=a(this).attr("rel");b>0&&f.push(b)});var g={action:"woocommerce_remove_variations",variation_ids:f,security:woocommerce_admin_meta_boxes_variations.delete_variations_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,g,function(){a(".woocommerce_variations .woocommerce_variation").fadeOut("300",function(){a(".woocommerce_variations .woocommerce_variation").remove()})})}break;case"variable_regular_price_increase":case"variable_regular_price_decrease":case"variable_sale_price_increase":case"variable_sale_price_decrease":var h;if(h=0===e.lastIndexOf("variable_regular_price",0)?"variable_regular_price":"variable_sale_price",d=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value_fixed_or_percent),null==d)return;d=d.toString(),a(':input[name^="'+h+'"]').not('[name*="dates"]').each(function(){var b,c,f=accounting.unformat(a(this).val(),woocommerce_admin.mon_decimal_point);c=d.indexOf("%")>=0?f/100*accounting.unformat(d.replace(/\%/,""),woocommerce_admin.mon_decimal_point):accounting.unformat(d,woocommerce_admin.mon_decimal_point),b=-1!==e.indexOf("increase")?f+c:f-c,a(this).val(accounting.formatNumber(b,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.currency_format_thousand_sep,woocommerce_admin_meta_boxes.currency_format_decimal_sep)).change()});break;case"variable_regular_price":case"variable_sale_price":case"variable_stock":case"variable_weight":case"variable_length":case"variable_width":case"variable_height":case"variable_download_limit":case"variable_download_expiry":d=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value),null!=d&&a(':input[name^="'+e+'"]').not('[name*="dates"]').val(d).change();break;case"variable_sale_schedule":var i=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_start),j=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_end),k=!1;null!=i&&""!==i&&(a(".woocommerce_variable_attributes .sale_schedule").click(),a(':input[name^="variable_sale_price_dates_from"]').val(i).change(),k=!0),null!=j&&""!==j&&(a(".woocommerce_variable_attributes .sale_schedule").click(),a(':input[name^="variable_sale_price_dates_to"]').val(j).change(),k=!0),k||a(".woocommerce_variable_attributes .cancel_sale_schedule").click();break;default:a("select#field_to_edit").trigger(e)}}),a("#variable_product_options").on("change","input.variable_is_downloadable",function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").show()}),a("#variable_product_options").on("change","input.variable_is_virtual",function(){a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").show(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").hide()}),a("#variable_product_options").on("change","input.variable_manage_stock",function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").show()}),a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock").change(),a("#variable_product_options").on("woocommerce_variations_added",function(){a(".woocommerce_variations").sortable(c)}),a(".woocommerce_variations").sortable(c);var d,e,f,g=wp.media.model.settings.post.id;a("#variable_product_options").on("click",".upload_image_button",function(b){var c=a(this),h=c.attr("rel"),i=c.closest(".upload_image");if(f=i,e=h,b.preventDefault(),c.is(".remove"))f.find(".upload_image_id").val(""),f.find("img").eq(0).attr("src",woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src),f.find(".upload_image_button").removeClass("remove");else{if(d)return d.uploader.uploader.param("post_id",e),void d.open();wp.media.model.settings.post.id=e,d=wp.media.frames.variable_image=wp.media({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,button:{text:woocommerce_admin_meta_boxes_variations.i18n_set_image},states:[new wp.media.controller.Library({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,filterable:"all"})]}),d.on("select",function(){var a=d.state().get("selection").first().toJSON(),b=a.sizes.thumbnail?a.sizes.thumbnail.url:a.url;f.find(".upload_image_id").val(a.id),f.find(".upload_image_button").addClass("remove"),f.find("img").eq(0).attr("src",b),wp.media.model.settings.post.id=g}),d.open()}}),a("a.add_media").on("click",function(){wp.media.model.settings.post.id=g});var h={init:function(){a("li.variations_tab a").on("click",this.initial_load),a("#variable_product_options").on("click","button.add_variation",this.add_variation).on("click","button.remove_variation",this.remove_variation).on("click","button.link_all_variations",this.link_all_variations),a("body").on("change","#variable_product_options_inner .woocommerce_variations :input",this.input_changed)},check_for_editions:function(){var b=a("#variable_product_options_inner .woocommerce_variations");if("true"===b.attr("data-edited")){if(!window.confirm(woocommerce_admin_meta_boxes_variations.i18n_edited_variations))return!1;b.attr("data-edited",!1)}return!0},initial_load:function(){0===a("#variable_product_options_inner .woocommerce_variations .woocommerce_variation").length&&h.load_variations()},load_variations:function(b,c){b=b||1,c=c||woocommerce_admin_meta_boxes_variations.variations_per_page;var d=a("#variable_product_options_inner .woocommerce_variations");a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),a.ajax({url:woocommerce_admin_meta_boxes_variations.ajax_url,data:{action:"woocommerce_load_variations",security:woocommerce_admin_meta_boxes_variations.load_variations_nonce,product_id:d.data("product_id"),attributes:d.data("attributes"),page:b,per_page:c},type:"POST",success:function(c){d.empty().append(c).attr("data-page",b),a("#woocommerce-product-data").unblock()}})},add_variation:function(){if(!h.check_for_editions())return!1;a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var b={action:"woocommerce_add_variation",post_id:woocommerce_admin_meta_boxes_variations.post_id,loop:a(".woocommerce_variation").size(),security:woocommerce_admin_meta_boxes_variations.add_variation_nonce};return a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(){i.set_page(1),a("#woocommerce-product-data").unblock(),a("#variable_product_options").trigger("woocommerce_variations_added")}),!1},remove_variation:function(){if(!h.check_for_editions())return!1;if(window.confirm(woocommerce_admin_meta_boxes_variations.i18n_remove_variation)){var b=a(this).attr("rel"),c=[],d={action:"woocommerce_remove_variations"};a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),b>0?(c.push(b),d.variation_ids=c,d.security=woocommerce_admin_meta_boxes_variations.delete_variations_nonce,a.post(woocommerce_admin_meta_boxes_variations.ajax_url,d,function(){var b=parseInt(a("#variable_product_options_inner .woocommerce_variations").attr("data-page"),10);console.log(b),i.set_page(b)})):a("#woocommerce-product-data").unblock()}return!1},link_all_variations:function(){if(!h.check_for_editions())return!1;if(window.confirm(woocommerce_admin_meta_boxes_variations.i18n_link_all_variations)){a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var b={action:"woocommerce_link_all_variations",post_id:woocommerce_admin_meta_boxes_variations.post_id,security:woocommerce_admin_meta_boxes_variations.link_variation_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(b){var c=parseInt(b,10);window.alert(1===c?c+" "+woocommerce_admin_meta_boxes_variations.i18n_variation_added:0===c||c>1?c+" "+woocommerce_admin_meta_boxes_variations.i18n_variations_added:woocommerce_admin_meta_boxes_variations.i18n_no_variations_added),c>0?(i.set_page(1),a("#variable_product_options").trigger("woocommerce_variations_added")):a("#woocommerce-product-data").unblock()})}return!1},input_changed:function(){a("#variable_product_options_inner .woocommerce_variations").attr("data-edited",!0)}},i={init:function(){a(".variations-pagenav .page-selector").on("change",this.page_selector),a(".variations-pagenav .first-page").on("click",this.first_page),a(".variations-pagenav .prev-page").on("click",this.prev_page),a(".variations-pagenav .next-page").on("click",this.next_page),a(".variations-pagenav .last-page").on("click",this.last_page)},check_is_enabled:function(b){return!a(b).hasClass("disabled")&&h.check_for_editions()},change_classes:function(b,c){1===b?(a(".variations-pagenav .first-page").addClass("disabled"),a(".variations-pagenav .prev-page").addClass("disabled")):(a(".variations-pagenav .first-page").removeClass("disabled"),a(".variations-pagenav .prev-page").removeClass("disabled")),c===b?(a(".variations-pagenav .next-page").addClass("disabled"),a(".variations-pagenav .last-page").addClass("disabled")):(a(".variations-pagenav .next-page").removeClass("disabled"),a(".variations-pagenav .last-page").removeClass("disabled"))},set_page:function(b){a(".variations-pagenav .page-selector").val(b).change()},page_selector:function(){var b=parseInt(a(this).val(),10),c=a("#variable_product_options_inner .woocommerce_variations");h.check_for_editions()?(i.change_classes(),h.load_variations(b)):a(this).val(parseInt(c.data("page"),10))},first_page:function(){return i.check_is_enabled(this)&&i.set_page(1),!1},prev_page:function(){if(i.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations"),c=parseInt(b.data("page"),10)-1,d=c>0?c:1;i.set_page(d)}return!1},next_page:function(){if(i.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations"),c=b.data("total_pages"),d=parseInt(b.data("page"),10)+1,e=c>=d?d:c;i.set_page(e)}return!1},last_page:function(){if(i.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations").data("total_pages");i.set_page(b)}return!1}};h.init(),i.init()}); \ No newline at end of file +jQuery(function(a){a(".wc-metaboxes-wrapper").on("click","a.bulk_edit",function(){var b,c,d,e=a("select#field_to_edit").val();switch(e){case"toggle_enabled":b=a('input[name^="variable_enabled"]'),b.attr("checked",!b.attr("checked"));break;case"toggle_downloadable":b=a('input[name^="variable_is_downloadable"]'),b.attr("checked",!b.attr("checked")),a("input.variable_is_downloadable").change();break;case"toggle_virtual":b=a('input[name^="variable_is_virtual"]'),b.attr("checked",!b.attr("checked")),a("input.variable_is_virtual").change();break;case"toggle_manage_stock":b=a('input[name^="variable_manage_stock"]'),b.attr("checked",!b.attr("checked")),a("input.variable_manage_stock").change();break;case"delete_all":if(c=window.confirm(woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations),c&&(c=window.confirm(woocommerce_admin_meta_boxes_variations.i18n_last_warning))){var f=[];a(".woocommerce_variations .woocommerce_variation").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),a(".woocommerce_variations .woocommerce_variation .remove_variation").each(function(){var b=a(this).attr("rel");b>0&&f.push(b)});var g={action:"woocommerce_remove_variations",variation_ids:f,security:woocommerce_admin_meta_boxes_variations.delete_variations_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,g,function(){a(".woocommerce_variations .woocommerce_variation").fadeOut("300",function(){a(".woocommerce_variations .woocommerce_variation").remove()})})}break;case"variable_regular_price_increase":case"variable_regular_price_decrease":case"variable_sale_price_increase":case"variable_sale_price_decrease":var h;if(h=0===e.lastIndexOf("variable_regular_price",0)?"variable_regular_price":"variable_sale_price",d=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value_fixed_or_percent),null==d)return;d=d.toString(),a(':input[name^="'+h+'"]').not('[name*="dates"]').each(function(){var b,c,f=accounting.unformat(a(this).val(),woocommerce_admin.mon_decimal_point);c=d.indexOf("%")>=0?f/100*accounting.unformat(d.replace(/\%/,""),woocommerce_admin.mon_decimal_point):accounting.unformat(d,woocommerce_admin.mon_decimal_point),b=-1!==e.indexOf("increase")?f+c:f-c,a(this).val(accounting.formatNumber(b,woocommerce_admin_meta_boxes.currency_format_num_decimals,woocommerce_admin_meta_boxes.currency_format_thousand_sep,woocommerce_admin_meta_boxes.currency_format_decimal_sep)).change()});break;case"variable_regular_price":case"variable_sale_price":case"variable_stock":case"variable_weight":case"variable_length":case"variable_width":case"variable_height":case"variable_download_limit":case"variable_download_expiry":d=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_enter_a_value),null!=d&&a(':input[name^="'+e+'"]').not('[name*="dates"]').val(d).change();break;case"variable_sale_schedule":var i=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_start),j=window.prompt(woocommerce_admin_meta_boxes_variations.i18n_scheduled_sale_end),k=!1;null!=i&&""!==i&&(a(".woocommerce_variable_attributes .sale_schedule").click(),a(':input[name^="variable_sale_price_dates_from"]').val(i).change(),k=!0),null!=j&&""!==j&&(a(".woocommerce_variable_attributes .sale_schedule").click(),a(':input[name^="variable_sale_price_dates_to"]').val(j).change(),k=!0),k||a(".woocommerce_variable_attributes .cancel_sale_schedule").click();break;default:a("select#field_to_edit").trigger(e)}}),a("#variable_product_options").on("change","input.variable_is_downloadable",function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_downloadable").show()}),a("#variable_product_options").on("change","input.variable_is_virtual",function(){a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").show(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".hide_if_variation_virtual").hide()}),a("#variable_product_options").on("change","input.variable_manage_stock",function(){a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").hide(),a(this).is(":checked")&&a(this).closest(".woocommerce_variation").find(".show_if_variation_manage_stock").show()}),a("input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock").change();var b,c,d,e=wp.media.model.settings.post.id;a("#variable_product_options").on("click",".upload_image_button",function(f){var g=a(this),h=g.attr("rel"),i=g.closest(".upload_image");if(d=i,c=h,f.preventDefault(),g.is(".remove"))d.find(".upload_image_id").val(""),d.find("img").eq(0).attr("src",woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src),d.find(".upload_image_button").removeClass("remove");else{if(b)return b.uploader.uploader.param("post_id",c),void b.open();wp.media.model.settings.post.id=c,b=wp.media.frames.variable_image=wp.media({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,button:{text:woocommerce_admin_meta_boxes_variations.i18n_set_image},states:[new wp.media.controller.Library({title:woocommerce_admin_meta_boxes_variations.i18n_choose_image,filterable:"all"})]}),b.on("select",function(){var a=b.state().get("selection").first().toJSON(),c=a.sizes.thumbnail?a.sizes.thumbnail.url:a.url;d.find(".upload_image_id").val(a.id),d.find(".upload_image_button").addClass("remove"),d.find("img").eq(0).attr("src",c),wp.media.model.settings.post.id=e}),b.open()}}),a("a.add_media").on("click",function(){wp.media.model.settings.post.id=e});var f={init:function(){a("li.variations_tab a").on("click",this.initial_load),a("#variable_product_options").on("click","button.add_variation",this.add_variation).on("click","button.remove_variation",this.remove_variation).on("click","button.link_all_variations",this.link_all_variations),a("body").on("change","#variable_product_options_inner .woocommerce_variations :input",this.input_changed)},check_for_editions:function(){var b=a("#variable_product_options_inner .woocommerce_variations");if("true"===b.attr("data-edited")){if(!window.confirm(woocommerce_admin_meta_boxes_variations.i18n_edited_variations))return!1;b.attr("data-edited",!1)}return!0},initial_load:function(){0===a("#variable_product_options_inner .woocommerce_variations .woocommerce_variation").length&&f.load_variations()},load_variations:function(b,c){b=b||1,c=c||woocommerce_admin_meta_boxes_variations.variations_per_page;var d=a("#variable_product_options_inner .woocommerce_variations");a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),a.ajax({url:woocommerce_admin_meta_boxes_variations.ajax_url,data:{action:"woocommerce_load_variations",security:woocommerce_admin_meta_boxes_variations.load_variations_nonce,product_id:d.data("product_id"),attributes:d.data("attributes"),page:b,per_page:c},type:"POST",success:function(c){d.empty().append(c).attr("data-page",b),a("#woocommerce-product-data").unblock()}})},add_variation:function(){if(!f.check_for_editions())return!1;a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var b={action:"woocommerce_add_variation",post_id:woocommerce_admin_meta_boxes_variations.post_id,loop:a(".woocommerce_variation").size(),security:woocommerce_admin_meta_boxes_variations.add_variation_nonce};return a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(){g.set_page(1),a("#woocommerce-product-data").unblock(),a("#variable_product_options").trigger("woocommerce_variations_added")}),!1},remove_variation:function(){if(!f.check_for_editions())return!1;if(window.confirm(woocommerce_admin_meta_boxes_variations.i18n_remove_variation)){var b=a(this).attr("rel"),c=[],d={action:"woocommerce_remove_variations"};a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}}),b>0?(c.push(b),d.variation_ids=c,d.security=woocommerce_admin_meta_boxes_variations.delete_variations_nonce,a.post(woocommerce_admin_meta_boxes_variations.ajax_url,d,function(){var b=parseInt(a("#variable_product_options_inner .woocommerce_variations").attr("data-page"),10);console.log(b),g.set_page(b)})):a("#woocommerce-product-data").unblock()}return!1},link_all_variations:function(){if(!f.check_for_editions())return!1;if(window.confirm(woocommerce_admin_meta_boxes_variations.i18n_link_all_variations)){a("#woocommerce-product-data").block({message:null,overlayCSS:{background:"#fff",opacity:.6}});var b={action:"woocommerce_link_all_variations",post_id:woocommerce_admin_meta_boxes_variations.post_id,security:woocommerce_admin_meta_boxes_variations.link_variation_nonce};a.post(woocommerce_admin_meta_boxes_variations.ajax_url,b,function(b){var c=parseInt(b,10);window.alert(1===c?c+" "+woocommerce_admin_meta_boxes_variations.i18n_variation_added:0===c||c>1?c+" "+woocommerce_admin_meta_boxes_variations.i18n_variations_added:woocommerce_admin_meta_boxes_variations.i18n_no_variations_added),c>0?(g.set_page(1),a("#variable_product_options").trigger("woocommerce_variations_added")):a("#woocommerce-product-data").unblock()})}return!1},input_changed:function(){a("#variable_product_options_inner .woocommerce_variations").attr("data-edited",!0)}},g={init:function(){a(".variations-pagenav .page-selector").on("change",this.page_selector),a(".variations-pagenav .first-page").on("click",this.first_page),a(".variations-pagenav .prev-page").on("click",this.prev_page),a(".variations-pagenav .next-page").on("click",this.next_page),a(".variations-pagenav .last-page").on("click",this.last_page)},check_is_enabled:function(b){return!a(b).hasClass("disabled")&&f.check_for_editions()},change_classes:function(b,c){1===b?(a(".variations-pagenav .first-page").addClass("disabled"),a(".variations-pagenav .prev-page").addClass("disabled")):(a(".variations-pagenav .first-page").removeClass("disabled"),a(".variations-pagenav .prev-page").removeClass("disabled")),c===b?(a(".variations-pagenav .next-page").addClass("disabled"),a(".variations-pagenav .last-page").addClass("disabled")):(a(".variations-pagenav .next-page").removeClass("disabled"),a(".variations-pagenav .last-page").removeClass("disabled"))},set_page:function(b){a(".variations-pagenav .page-selector").val(b).change()},page_selector:function(){var b=parseInt(a(this).val(),10),c=a("#variable_product_options_inner .woocommerce_variations");f.check_for_editions()?(g.change_classes(),f.load_variations(b)):a(this).val(parseInt(c.data("page"),10))},first_page:function(){return g.check_is_enabled(this)&&g.set_page(1),!1},prev_page:function(){if(g.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations"),c=parseInt(b.data("page"),10)-1,d=c>0?c:1;g.set_page(d)}return!1},next_page:function(){if(g.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations"),c=b.data("total_pages"),d=parseInt(b.data("page"),10)+1,e=c>=d?d:c;g.set_page(e)}return!1},last_page:function(){if(g.check_is_enabled(this)){var b=a("#variable_product_options_inner .woocommerce_variations").data("total_pages");g.set_page(b)}return!1}};f.init(),g.init()}); \ No newline at end of file