rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -1 +1 @@
!function(r){new(Backbone.View.extend({el:r("#key-fields"),events:{"click input#update_api_key":"saveKey"},initialize:function(){_.bindAll(this,"saveKey")},block:function(){r(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){r(this.el).unblock()},initTipTip:function(i){r(document.body).on("click",i,function(e){e.preventDefault(),document.queryCommandSupported("copy")?(r("#copy-error").text(""),wcClearClipboard(),wcSetClipboard(r(this).prev("input").val().trim(),r(i))):(r(i).parent().find("input").trigger("focus").trigger("select"),r("#copy-error").text(woocommerce_admin_api_keys.clipboard_failed))}).on("aftercopy",i,function(){r("#copy-error").text(""),r(i).tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).trigger("focus")}).on("aftercopyerror",i,function(){r(i).parent().find("input").trigger("focus").trigger("select"),r("#copy-error").text(woocommerce_admin_api_keys.clipboard_failed)})},createQRCode:function(e,i){r("#keys-qrcode").qrcode({text:e+"|"+i,width:120,height:120})},saveKey:function(e){e.preventDefault();var o=this;o.block(),Backbone.ajax({method:"POST",dataType:"json",url:woocommerce_admin_api_keys.ajax_url,data:{action:"woocommerce_update_api_key",security:woocommerce_admin_api_keys.update_api_nonce,key_id:r("#key_id",o.el).val(),description:r("#key_description",o.el).val(),user:r("#key_user",o.el).val(),permissions:r("#key_permissions",o.el).val()},success:function(e){var i,t;r(".wc-api-message",o.el).remove(),e.success?(i=e.data,r("h2, h3",o.el).first().append('<div class="wc-api-message updated"><p>'+i.message+"</p></div>"),0<i.consumer_key.length&&0<i.consumer_secret.length?(r("#api-keys-options",o.el).remove(),r("p.submit",o.el).empty().append(i.revoke_url),t=wp.template("api-keys-template"),r("p.submit",o.el).before(t({consumer_key:i.consumer_key,consumer_secret:i.consumer_secret})),o.createQRCode(i.consumer_key,i.consumer_secret),o.initTipTip(".copy-key"),o.initTipTip(".copy-secret")):(r("#key_description",o.el).val(i.description),r("#key_user",o.el).val(i.user_id),r("#key_permissions",o.el).val(i.permissions))):r("h2, h3",o.el).first().append('<div class="wc-api-message error"><p>'+e.data.message+"</p></div>"),o.unblock()}})}}))}(jQuery);
!function(e){new(Backbone.View.extend({el:e("#key-fields"),events:{"click input#update_api_key":"saveKey"},initialize:function(){_.bindAll(this,"saveKey")},block:function(){e(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){e(this.el).unblock()},initTipTip:function(i){e(document.body).on("click",i,function(t){t.preventDefault(),document.queryCommandSupported("copy")?(e("#copy-error").text(""),wcClearClipboard(),wcSetClipboard(e(this).prev("input").val().trim(),e(i))):(e(i).parent().find("input").trigger("focus").trigger("select"),e("#copy-error").text(woocommerce_admin_api_keys.clipboard_failed))}).on("aftercopy",i,function(){e("#copy-error").text(""),e(i).tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).trigger("focus")}).on("aftercopyerror",i,function(){e(i).parent().find("input").trigger("focus").trigger("select"),e("#copy-error").text(woocommerce_admin_api_keys.clipboard_failed)})},createQRCode:function(i,t){e("#keys-qrcode").qrcode({text:i+"|"+t,width:120,height:120})},saveKey:function(i){i.preventDefault();var t=this;t.block(),Backbone.ajax({method:"POST",dataType:"json",url:woocommerce_admin_api_keys.ajax_url,data:{action:"woocommerce_update_api_key",security:woocommerce_admin_api_keys.update_api_nonce,key_id:e("#key_id",t.el).val(),description:e("#key_description",t.el).val(),user:e("#key_user",t.el).val(),permissions:e("#key_permissions",t.el).val()},success:function(i){if(e(".wc-api-message",t.el).remove(),i.success){var o=i.data;if(e("h2, h3",t.el).first().append('<div class="wc-api-message updated"><p>'+o.message+"</p></div>"),0<o.consumer_key.length&&0<o.consumer_secret.length){e("#api-keys-options",t.el).remove(),e("p.submit",t.el).empty().append(o.revoke_url);var r=wp.template("api-keys-template");e("p.submit",t.el).before(r({consumer_key:o.consumer_key,consumer_secret:o.consumer_secret})),t.createQRCode(o.consumer_key,o.consumer_secret),t.initTipTip(".copy-key"),t.initTipTip(".copy-secret")}else e("#key_description",t.el).val(o.description),e("#key_user",t.el).val(o.user_id),e("#key_permissions",t.el).val(o.permissions)}else e("h2, h3",t.el).first().append('<div class="wc-api-message error"><p>'+i.data.message+"</p></div>");t.unblock()}})}}))}(jQuery);

View File

@@ -1 +1 @@
!function(o,e,n){"use strict";o.fn.WCBackboneModal=function(e){return this.each(function(){new o.WCBackboneModal(o(this),e)})},o.WCBackboneModal=function(e,t){t=o.extend({},o.WCBackboneModal.defaultOptions,t);t.template&&new o.WCBackboneModal.View({target:t.template,string:t.variable})},o.WCBackboneModal.defaultOptions={template:"",variable:{}},o.WCBackboneModal.View=e.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:undefined,_string:undefined,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","touchstart #btn-ok":"addButton",keydown:"keyboardActions"},resizeContent:function(){var e=o(".wc-backbone-modal-content").find("article"),t=.75*o(window).height();e.css({"max-height":t+"px"})},initialize:function(e){var t=this;this._target=e.target,this._string=e.string,n.bindAll(this,"render"),this.render(),o(window).on("resize",function(){t.resizeContent()})},render:function(){var e=wp.template(this._target);this.$el.append(e(this._string)),o(document.body).css({overflow:"hidden"}).append(this.$el),this.resizeContent(),this.$(".wc-backbone-modal-content").attr("tabindex","0").trigger("focus"),o(document.body).trigger("init_tooltips"),o(document.body).trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(e){e.preventDefault(),o(document.body).trigger("wc_backbone_modal_before_remove",this._target),this.undelegateEvents(),o(document).off("focusin"),o(document.body).css({overflow:"auto"}),this.remove(),o(document.body).trigger("wc_backbone_modal_removed",this._target)},addButton:function(e){o(document.body).trigger("wc_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(e)},getFormData:function(){var n={};return o(document.body).trigger("wc_backbone_modal_before_update",this._target),o.each(o("form",this.$el).serializeArray(),function(e,t){-1!==t.name.indexOf("[]")?(t.name=t.name.replace("[]",""),n[t.name]=o.makeArray(n[t.name]),n[t.name].push(t.value)):n[t.name]=t.value}),n},keyboardActions:function(e){var t=e.keyCode||e.which;13!==t||e.target.tagName&&("input"===e.target.tagName.toLowerCase()||"textarea"===e.target.tagName.toLowerCase())||this.addButton(e),27===t&&this.closeButton(e)}})}(jQuery,Backbone,_);
!function(e,t,n){"use strict";e.fn.WCBackboneModal=function(t){return this.each(function(){new e.WCBackboneModal(e(this),t)})},e.WCBackboneModal=function(t,n){var o=e.extend({},e.WCBackboneModal.defaultOptions,n);o.template&&new e.WCBackboneModal.View({target:o.template,string:o.variable})},e.WCBackboneModal.defaultOptions={template:"",variable:{}},e.WCBackboneModal.View=t.View.extend({tagName:"div",id:"wc-backbone-modal-dialog",_target:undefined,_string:undefined,events:{"click .modal-close":"closeButton","click #btn-ok":"addButton","touchstart #btn-ok":"addButton",keydown:"keyboardActions"},resizeContent:function(){var t=e(".wc-backbone-modal-content").find("article"),n=.75*e(window).height();t.css({"max-height":n+"px"})},initialize:function(t){var o=this;this._target=t.target,this._string=t.string,n.bindAll(this,"render"),this.render(),e(window).on("resize",function(){o.resizeContent()})},render:function(){var t=wp.template(this._target);this.$el.append(t(this._string)),e(document.body).css({overflow:"hidden"}).append(this.$el),this.resizeContent(),this.$(".wc-backbone-modal-content").attr("tabindex","0").trigger("focus"),e(document.body).trigger("init_tooltips"),e(document.body).trigger("wc_backbone_modal_loaded",this._target)},closeButton:function(t){t.preventDefault(),e(document.body).trigger("wc_backbone_modal_before_remove",this._target),this.undelegateEvents(),e(document).off("focusin"),e(document.body).css({overflow:"auto"}),this.remove(),e(document.body).trigger("wc_backbone_modal_removed",this._target)},addButton:function(t){e(document.body).trigger("wc_backbone_modal_response",[this._target,this.getFormData()]),this.closeButton(t)},getFormData:function(){var t={};return e(document.body).trigger("wc_backbone_modal_before_update",this._target),e.each(e("form",this.$el).serializeArray(),function(n,o){-1!==o.name.indexOf("[]")?(o.name=o.name.replace("[]",""),t[o.name]=e.makeArray(t[o.name]),t[o.name].push(o.value)):t[o.name]=o.value}),t},keyboardActions:function(e){var t=e.keyCode||e.which;13!==t||e.target.tagName&&("input"===e.target.tagName.toLowerCase()||"textarea"===e.target.tagName.toLowerCase())||this.addButton(e),27===t&&this.closeButton(e)}})}(jQuery,Backbone,_);

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
jQuery(function(_){({init:function(){_("select#discount_type").on("change",this.type_options).trigger("change"),this.insert_generate_coupon_code_button(),_(".button.generate-coupon-code").on("click",this.generate_coupon_code)},type_options:function(){var e=_(this).val();"percent"===e?_("#coupon_amount").removeClass("wc_input_price").addClass("wc_input_decimal"):_("#coupon_amount").removeClass("wc_input_decimal").addClass("wc_input_price"),"fixed_cart"!==e?_(".limit_usage_to_x_items_field").show():_(".limit_usage_to_x_items_field").hide()},insert_generate_coupon_code_button:function(){_(".post-type-shop_coupon").find("#title").after('<a href="#" class="button generate-coupon-code">'+woocommerce_admin_meta_boxes_coupon.generate_button_text+"</a>")},generate_coupon_code:function(e){e.preventDefault();for(var e=_("#title"),o=_("#title-prompt-text"),t="",n=0;n<woocommerce_admin_meta_boxes_coupon.char_length;n++)t+=woocommerce_admin_meta_boxes_coupon.characters.charAt(Math.floor(Math.random()*woocommerce_admin_meta_boxes_coupon.characters.length));t=woocommerce_admin_meta_boxes_coupon.prefix+t+woocommerce_admin_meta_boxes_coupon.suffix,e.trigger("focus").val(t),o.addClass("screen-reader-text")}}).init()});
jQuery(function(e){({init:function(){e("select#discount_type").on("change",this.type_options).trigger("change"),this.insert_generate_coupon_code_button(),e(".button.generate-coupon-code").on("click",this.generate_coupon_code)},type_options:function(){var o=e(this).val();"percent"===o?e("#coupon_amount").removeClass("wc_input_price").addClass("wc_input_decimal"):e("#coupon_amount").removeClass("wc_input_decimal").addClass("wc_input_price"),"fixed_cart"!==o?e(".limit_usage_to_x_items_field").show():e(".limit_usage_to_x_items_field").hide()},insert_generate_coupon_code_button:function(){e(".post-type-shop_coupon").find("#title").after('<a href="#" class="button generate-coupon-code">'+woocommerce_admin_meta_boxes_coupon.generate_button_text+"</a>")},generate_coupon_code:function(o){o.preventDefault();for(var t=e("#title"),n=e("#title-prompt-text"),_="",c=0;c<woocommerce_admin_meta_boxes_coupon.char_length;c++)_+=woocommerce_admin_meta_boxes_coupon.characters.charAt(Math.floor(Math.random()*woocommerce_admin_meta_boxes_coupon.characters.length));_=woocommerce_admin_meta_boxes_coupon.prefix+_+woocommerce_admin_meta_boxes_coupon.suffix,t.trigger("focus").val(_),n.addClass("screen-reader-text")}}).init()});

File diff suppressed because one or more lines are too long

View File

@@ -47,13 +47,11 @@ jQuery( function ( $ ) {
'woocommerce_variations_loaded',
this.variations_loaded
);
$( document.body )
.on( 'woocommerce_variations_added', this.variation_added )
.on(
'keyup',
'.wc_input_variations_price',
this.maybe_enable_button_to_add_price_to_variations
);
$( document.body ).on(
'keyup',
'.wc_input_variations_price',
this.maybe_enable_button_to_add_price_to_variations
);
},
create_variations: function ( event ) {
@@ -328,21 +326,6 @@ jQuery( function ( $ ) {
$( document.body ).trigger( 'wc-enhanced-select-init' );
},
/**
* Run actions when added a variation
*
* @param {Object} event
* @param {Int} qty
*/
variation_added: function ( event, qty ) {
if ( 1 === qty ) {
wc_meta_boxes_product_variations_actions.variations_loaded(
null,
true
);
}
},
/**
* Sets a price for every variation
*/
@@ -997,11 +980,17 @@ jQuery( function ( $ ) {
$(
'button.cancel-variation-changes, button.save-variation-changes'
).prop( 'disabled', false );
$( '#variable_product_options' ).trigger(
'woocommerce_variations_added',
1
wc_meta_boxes_product_variations_pagenav.update_single_quantity();
wc_meta_boxes_product_variations_actions.variations_loaded(
null,
true
);
wc_meta_boxes_product_variations_ajax.show_hide_variation_empty_state();
$( '#variable_product_options' ).trigger( 'woocommerce_variations_added', 1 );
wc_meta_boxes_product_variations_ajax.unblock();
}
);
@@ -1074,6 +1063,12 @@ jQuery( function ( $ ) {
page = total_pages;
}
if ( total_pages === 0 ) {
$( '.generate_variations' ).text(
'Generate variations'
);
}
wc_meta_boxes_product_variations_pagenav.go_to_page(
page,
-1
@@ -1118,25 +1113,20 @@ jQuery( function ( $ ) {
woocommerce_admin_meta_boxes_variations.ajax_url,
data,
function ( response ) {
var count = parseInt( response, 10 );
const count = parseInt( response, 10 ) || 0;
if ( 1 === count ) {
window.alert(
count +
' ' +
woocommerce_admin_meta_boxes_variations.i18n_variation_added
);
} else if ( 0 === count || count > 1 ) {
window.alert(
count +
' ' +
woocommerce_admin_meta_boxes_variations.i18n_variations_added
);
} else {
window.alert(
woocommerce_admin_meta_boxes_variations.i18n_no_variations_added
);
}
const message =
count === 1
? woocommerce_admin_meta_boxes_variations.i18n_variation_added
: woocommerce_admin_meta_boxes_variations.i18n_variations_added.replace(
'%qty%',
count
);
window.wp.data.dispatch( 'core/notices' ).createSuccessNotice(
message,
{ icon: '🎉' }
);
wc_meta_boxes_product_variations_ajax.show_hide_variation_empty_state();
@@ -1145,9 +1135,8 @@ jQuery( function ( $ ) {
1,
count
);
$( '#variable_product_options' ).trigger(
'woocommerce_variations_added',
count
$( '.generate_variations' ).text(
'Regenerate variations'
);
} else {
wc_meta_boxes_product_variations_ajax.unblock();
@@ -1319,6 +1308,7 @@ jQuery( function ( $ ) {
$( '#variable_product_options' )
.find( '.variation-needs-update' )
.removeClass( 'variation-needs-update' );
$( '.generate_variations' ).text( 'Generate variations' );
} else {
wc_meta_boxes_product_variations_ajax.check_for_changes();
}
@@ -1354,10 +1344,14 @@ jQuery( function ( $ ) {
'.woocommerce_variations'
);
if ( parseInt( wrapper.attr( 'data-total' ) ) > 0 ) {
$( '.add-variation-container' ).addClass( 'hidden' );
$( '#variable_product_options_inner' ).removeClass(
'no-variations'
);
$( '#field_to_edit' ).removeClass( 'hidden' );
} else {
$( '.add-variation-container' ).removeClass( 'hidden' );
$( '#variable_product_options_inner' ).addClass(
'no-variations'
);
$( '#field_to_edit' ).addClass( 'hidden' );
}
},
@@ -1386,10 +1380,6 @@ jQuery( function ( $ ) {
*/
init: function () {
$( document.body )
.on(
'woocommerce_variations_added',
this.update_single_quantity
)
.on(
'change',
'.variations-pagenav .page-selector',
@@ -1426,46 +1416,35 @@ jQuery( function ( $ ) {
// Set the new total of variations
wrapper.attr( 'data-total', total );
if ( 1 === total ) {
displaying_num.text(
woocommerce_admin_meta_boxes_variations.i18n_variation_count_single.replace(
'%qty%',
total
)
);
} else {
displaying_num.text(
woocommerce_admin_meta_boxes_variations.i18n_variation_count_plural.replace(
'%qty%',
total
)
);
}
const message =
total === 1
? woocommerce_admin_meta_boxes_variations.i18n_variation_count_single
: woocommerce_admin_meta_boxes_variations.i18n_variation_count_plural.replace(
'%qty%',
total
);
displaying_num.text( message );
return total;
},
/**
* Update variations quantity when add a new variation
*
* @param {Object} event
* @param {Int} qty
*/
update_single_quantity: function ( event, qty ) {
if ( 1 === qty ) {
var page_nav = $( '.variations-pagenav' );
update_single_quantity: function () {
wc_meta_boxes_product_variations_pagenav.update_variations_count(
1
);
wc_meta_boxes_product_variations_pagenav.update_variations_count(
qty
);
const page_nav = $( '.variations-pagenav' );
if ( page_nav.is( ':hidden' ) ) {
$( 'option, optgroup', '.variation_actions' ).show();
$( '.variation_actions' ).val( 'bulk_actions' );
$( '#variable_product_options' ).find( '.toolbar' ).show();
page_nav.show();
$( '.pagination-links', page_nav ).hide();
}
if ( page_nav.is( ':hidden' ) ) {
$( 'option, optgroup', '.variation_actions' ).show();
$( '.variation_actions' ).val( 'bulk_actions' );
$( '#variable_product_options' ).find( '.toolbar' ).show();
page_nav.show();
$( '.pagination-links', page_nav ).hide();
}
},

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,11 @@
/*global woocommerce_admin_meta_boxes */
jQuery( function ( $ ) {
let isPageUnloading = false;
$( window ).on( 'beforeunload', function () {
isPageUnloading = true;
} );
// Scroll to first checked category
// https://github.com/scribu/wp-category-checklist-tree/blob/d1c3c1f449e1144542efa17dde84a9f52ade1739/category-checklist-tree.php
$( function () {
@@ -57,12 +63,6 @@ jQuery( function ( $ ) {
} );
} );
$( function () {
if ( ! woocommerce_admin_meta_boxes.has_local_attributes ) {
$( 'button.add_attribute' ).trigger( 'click' );
}
} );
// Catalog Visibility.
$( '#catalog-visibility' )
.find( '.edit-catalog-visibility' )
@@ -157,10 +157,22 @@ jQuery( function ( $ ) {
} )
.trigger( 'change' );
$( 'input#_downloadable, input#_virtual' ).on( 'change', function () {
$( 'input#_downloadable' ).on( 'change', function () {
show_and_hide_panels();
} );
$( 'input#_virtual' ).on( 'change', function () {
show_and_hide_panels();
// If user enables virtual while on shipping tab, switch to general tab.
if (
$( this ).is( ':checked' ) &&
$( '.shipping_options.shipping_tab' ).hasClass( 'active' )
) {
$( '.general_options.general_tab > a' ).trigger( 'click' );
}
} );
function change_product_type_tip( content ) {
$( '#tiptip_holder' ).removeAttr( 'style' );
$( '#tiptip_arrow' ).removeAttr( 'style' );
@@ -189,7 +201,7 @@ jQuery( function ( $ ) {
}
}
function show_and_hide_panels() {
function show_and_hide_controls( context ) {
var product_type = $( 'select#product-type' ).val();
var is_virtual = $( 'input#_virtual:checked' ).length;
var is_downloadable = $( 'input#_downloadable:checked' ).length;
@@ -198,41 +210,40 @@ jQuery( function ( $ ) {
var hide_classes = '.hide_if_downloadable, .hide_if_virtual';
var show_classes = '.show_if_downloadable, .show_if_virtual';
$.each( woocommerce_admin_meta_boxes.product_types, function (
index,
value
) {
hide_classes = hide_classes + ', .hide_if_' + value;
show_classes = show_classes + ', .show_if_' + value;
} );
$.each(
woocommerce_admin_meta_boxes.product_types,
function ( index, value ) {
hide_classes = hide_classes + ', .hide_if_' + value;
show_classes = show_classes + ', .show_if_' + value;
}
);
$( hide_classes ).show();
$( show_classes ).hide();
$( hide_classes, context ).show();
$( show_classes, context ).hide();
// Shows rules.
if ( is_downloadable ) {
$( '.show_if_downloadable' ).show();
$( '.show_if_downloadable', context ).show();
}
if ( is_virtual ) {
$( '.show_if_virtual' ).show();
// If user enables virtual while on shipping tab, switch to general tab.
if ( $( '.shipping_options.shipping_tab' ).hasClass( 'active' ) ) {
$( '.general_options.general_tab > a' ).trigger( 'click' );
}
$( '.show_if_virtual', context ).show();
}
$( '.show_if_' + product_type ).show();
$( '.show_if_' + product_type, context ).show();
// Hide rules.
if ( is_downloadable ) {
$( '.hide_if_downloadable' ).hide();
$( '.hide_if_downloadable', context ).hide();
}
if ( is_virtual ) {
$( '.hide_if_virtual' ).hide();
$( '.hide_if_virtual', context ).hide();
}
$( '.hide_if_' + product_type ).hide();
$( '.hide_if_' + product_type, context ).hide();
}
function show_and_hide_panels() {
show_and_hide_controls();
$( 'input#_manage_stock' ).trigger( 'change' );
@@ -244,12 +255,12 @@ jQuery( function ( $ ) {
return;
}
var $invisble = $children.filter( function () {
var $invisible = $children.filter( function () {
return 'none' === $( this ).css( 'display' );
} );
// Hide panel.
if ( $invisble.length === $children.length ) {
if ( $invisible.length === $children.length ) {
var $id = $( this ).prop( 'id' );
$( '.product_data_tabs' )
.find( 'li a[href="#' + $id + '"]' )
@@ -393,23 +404,36 @@ jQuery( function ( $ ) {
} );
} );
// Attribute Tables.
// Set up attributes, if current page has the attributes list.
const $product_attributes = $( '.product_attributes' );
if ( $product_attributes.length === 1 ) {
// When the attributes tab is shown, add an empty attribute to be filled out by the user.
$( '#product_attributes' ).on( 'woocommerce_tab_shown', function() {
remove_blank_custom_attribute_if_no_other_attributes();
// Initial order.
var woocommerce_attribute_items = $( '.product_attributes' )
.find( '.woocommerce_attribute' )
.get();
const woocommerce_attribute_items = $product_attributes.find( '.woocommerce_attribute' ).get();
woocommerce_attribute_items.sort( function ( a, b ) {
var compA = parseInt( $( a ).attr( 'rel' ), 10 );
var compB = parseInt( $( b ).attr( 'rel' ), 10 );
return compA < compB ? -1 : compA > compB ? 1 : 0;
} );
$( woocommerce_attribute_items ).each( function ( index, el ) {
$( '.product_attributes' ).append( el );
} );
// If the product has no attributes, add an empty attribute to be filled out by the user.
if ( woocommerce_attribute_items.length === 0 ) {
add_custom_attribute_to_list();
}
} );
function attribute_row_indexes() {
const woocommerce_attribute_items = $product_attributes.find( '.woocommerce_attribute' ).get();
// Sort the attributes by their position.
woocommerce_attribute_items.sort( function ( a, b ) {
var compA = parseInt( $( a ).attr( 'rel' ), 10 );
var compB = parseInt( $( b ).attr( 'rel' ), 10 );
return compA < compB ? -1 : compA > compB ? 1 : 0;
} );
$( woocommerce_attribute_items ).each( function ( index, el ) {
$product_attributes.append( el );
} );
}
function update_attribute_row_indexes() {
$( '.product_attributes .woocommerce_attribute' ).each( function (
index,
el
@@ -445,123 +469,165 @@ jQuery( function ( $ ) {
selectedAttributes
);
function toggle_add_global_attribute_layout() {
$( 'div.add-attribute-container' ).toggle();
$( 'div.add-global-attribute-container' ).toggle();
$( '#product_attributes > .toolbar-buttons' ).toggle();
function get_new_attribute_list_item_html(
indexInList,
globalAttributeId
) {
return new Promise( function ( resolve, reject ) {
$.post( {
url: woocommerce_admin_meta_boxes.ajax_url,
data: {
action: 'woocommerce_add_attribute',
product_type: $( '#product-type' ).val(),
taxonomy: globalAttributeId ? globalAttributeId : '',
i: indexInList,
security: woocommerce_admin_meta_boxes.add_attribute_nonce,
},
success: function ( newAttributeListItemHtml ) {
resolve( newAttributeListItemHtml );
},
error: function ( jqXHR, textStatus, errorThrown ) {
reject( { jqXHR, textStatus, errorThrown } );
},
} );
} );
}
function add_attribute( element, attribute ) {
var size = $( '.product_attributes .woocommerce_attribute' ).length;
var $wrapper = $( element ).closest( '#product_attributes' );
var $attributes = $wrapper.find( '.product_attributes' );
var product_type = $( 'select#product-type' ).val();
var data = {
action: 'woocommerce_add_attribute',
taxonomy: attribute,
i: size,
security: woocommerce_admin_meta_boxes.add_attribute_nonce,
};
function block_attributes_tab_container() {
const $attributesTabContainer = $( '#product_attributes' );
$wrapper.block( {
$attributesTabContainer.block( {
message: null,
overlayCSS: {
background: '#fff',
opacity: 0.6,
},
} );
}
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function (
response
) {
$attributes.append( response );
function unblock_attributes_tab_container() {
const $attributesTabContainer = $( '#product_attributes' );
$attributesTabContainer.unblock();
}
if ( 'variable' !== product_type ) {
$attributes.find( '.enable_variation' ).hide();
}
function toggle_expansion_of_attribute_list_item( $attributeListItem ) {
$attributeListItem.find( 'h3' ).trigger( 'click' );
}
$( document.body ).trigger( 'wc-enhanced-select-init' );
function init_select_controls() {
$( document.body ).trigger( 'wc-enhanced-select-init' );
}
attribute_row_indexes();
async function add_attribute_to_list( globalAttributeId ) {
try {
block_attributes_tab_container();
$attributes
.find( '.woocommerce_attribute' )
.last()
.find( 'h3' )
.trigger( 'click' );
const numberOfAttributesInList = $(
'.product_attributes .woocommerce_attribute'
).length;
const newAttributeListItemHtml =
await get_new_attribute_list_item_html(
numberOfAttributesInList,
globalAttributeId
);
$wrapper.unblock();
const $attributesListContainer = $(
'#product_attributes .product_attributes'
);
const $attributeListItem = $( newAttributeListItemHtml ).appendTo(
$attributesListContainer
);
show_and_hide_controls( $attributeListItem );
init_select_controls(); // make sure any new select controls in the new list item are initialized
update_attribute_row_indexes();
toggle_expansion_of_attribute_list_item( $attributeListItem );
$( document.body ).trigger( 'woocommerce_added_attribute' );
jQuery.maybe_disable_save_button();
} );
if ( attribute ) {
$( 'select.attribute_taxonomy' )
.find( 'option[value="' + attribute + '"]' )
.attr( 'disabled', 'disabled' );
$( 'select.attribute_taxonomy' ).val( '' );
jQuery.maybe_disable_save_button();
} catch ( error ) {
if ( isPageUnloading ) {
// If the page is unloading, the outstanding ajax fetch may fail in Firefox (and possible other browsers, too).
// We don't want to show an error message in this case, because it was caused by the user leaving the page.
return;
}
alert( woocommerce_admin_meta_boxes.i18n_add_attribute_error_notice );
throw error;
} finally {
unblock_attributes_tab_container();
}
}
function add_global_attribute_to_list( globalAttributeId ) {
add_attribute_to_list( globalAttributeId );
}
function add_custom_attribute_to_list() {
add_attribute_to_list();
}
function add_if_not_exists( arr, item ) {
return arr.includes( item ) ? attr : [ ...arr, item ];
}
function disable_in_attribute_search( selectedAttributes ) {
$( 'select.wc-attribute-search' ).data(
'disabled-items',
selectedAttributes
);
}
function remove_blank_custom_attribute_if_no_other_attributes() {
const $attributes = $( '.product_attributes .woocommerce_attribute' );
if ( $attributes.length === 1 ) {
const $attribute = $attributes.first();
const $attributeName = $attribute.find(
'input[name="attribute_names[0]"]'
);
const $attributeValue = $attribute.find(
'input[name="attribute_values[0]"]'
);
if ( ! $attributeName.val() && ! $attributeValue.val() ) {
$attribute.remove();
}
}
}
$( 'select.wc-attribute-search' ).on( 'select2:select', function ( e ) {
if ( e.params && e.params.data && e.params.data.id ) {
add_attribute( this, e.params.data.id );
if ( ! selectedAttributes.includes( e.params.data.id ) ) {
selectedAttributes.push( e.params.data.id );
$( 'select.wc-attribute-search' ).data(
'disabled-items',
selectedAttributes
);
}
window.wcTracks.recordEvent( 'product_attributes_buttons', {
action: 'add_existing',
} );
const attributeId = e && e.params && e.params.data && e.params.data.id;
if ( attributeId ) {
remove_blank_custom_attribute_if_no_other_attributes();
add_global_attribute_to_list( attributeId );
selectedAttributes = add_if_not_exists(
selectedAttributes,
attributeId
);
disable_in_attribute_search( selectedAttributes );
}
$( this ).val( null );
$( this ).trigger( 'change' );
if (
$( 'div.add-attribute-container' ).hasClass( 'hidden' ) &&
! $( 'div.add-global-attribute-container' ).hasClass( 'hidden' )
) {
toggle_add_global_attribute_layout();
}
return false;
} );
// Add rows.
$( 'button.add_attribute' ).on( 'click', function () {
var attribute = $( 'select.attribute_taxonomy' ).val();
if (
! attribute &&
$( 'select.attribute_taxonomy' ).hasClass( 'wc-attribute-search' )
) {
return;
}
add_attribute( this, attribute );
$( 'select.attribute_taxonomy' ).val( null );
$( 'select.attribute_taxonomy' ).trigger( 'change' );
// We record the event only when an existing attribute is added.
if ( attribute !== '' ) {
window.wcTracks.recordEvent( 'product_attributes_buttons', {
action: 'add_existing',
} );
}
return false;
} );
$( 'button.add_custom_attribute' ).on( 'click', function () {
add_attribute( this, '' );
add_custom_attribute_to_list();
if (
$( 'div.add-attribute-container' ).hasClass( 'hidden' ) &&
! $( 'div.add-global-attribute-container' ).hasClass( 'hidden' )
) {
toggle_add_global_attribute_layout();
}
return false;
} );
@@ -603,41 +669,43 @@ jQuery( function ( $ ) {
security: wc_enhanced_select_params.search_taxonomy_terms_nonce,
};
$.get( woocommerce_admin_meta_boxes.ajax_url, data, function (
response
) {
if ( response.errors ) {
// Error.
window.alert( response.errors );
} else if ( response && response.length > 0 ) {
// Success.
response.forEach( function ( term ) {
const currentItem = $wrapper.find(
'select.attribute_values option[value="' +
term.term_id +
'"]'
);
if ( currentItem && currentItem.length > 0 ) {
currentItem.prop( 'selected', 'selected' );
} else {
$wrapper
.find( 'select.attribute_values' )
.append(
'<option value="' +
term.term_id +
'" selected="selected">' +
term.name +
'</option>'
);
}
} );
$wrapper
.find( 'select.attribute_values' )
.trigger( 'change' );
}
$.get(
woocommerce_admin_meta_boxes.ajax_url,
data,
function ( response ) {
if ( response.errors ) {
// Error.
window.alert( response.errors );
} else if ( response && response.length > 0 ) {
// Success.
response.forEach( function ( term ) {
const currentItem = $wrapper.find(
'select.attribute_values option[value="' +
term.term_id +
'"]'
);
if ( currentItem && currentItem.length > 0 ) {
currentItem.prop( 'selected', 'selected' );
} else {
$wrapper
.find( 'select.attribute_values' )
.append(
'<option value="' +
term.term_id +
'" selected="selected">' +
term.name +
'</option>'
);
}
} );
$wrapper
.find( 'select.attribute_values' )
.trigger( 'change' );
}
$( '.product_attributes' ).unblock();
} );
$( '.product_attributes' ).unblock();
}
);
return false;
}
);
@@ -660,13 +728,16 @@ jQuery( function ( $ ) {
'.product_attributes .remove_row',
function () {
var $parent = $( this ).parent().parent();
var confirmMessage = $parent
var isUsedForVariations = $parent
.find( 'input[name^="attribute_variation"]' )
.is( ':checked' )
? woocommerce_admin_meta_boxes.i18n_remove_used_attribute_confirmation_message
: woocommerce_admin_meta_boxes.remove_attribute;
.is( ':visible:checked' );
if ( window.confirm( confirmMessage ) ) {
if (
! isUsedForVariations ||
window.confirm(
woocommerce_admin_meta_boxes.i18n_remove_used_attribute_confirmation_message
)
) {
if ( $parent.is( '.taxonomy' ) ) {
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();
@@ -685,7 +756,7 @@ jQuery( function ( $ ) {
} else {
$parent.find( 'select, input[type=text]' ).val( '' );
$parent.hide();
attribute_row_indexes();
update_attribute_row_indexes();
}
$parent.remove();
@@ -694,16 +765,6 @@ jQuery( function ( $ ) {
action: 'remove_attribute',
} );
if (
! $( '.woocommerce_attribute_data' ).is( ':visible' ) &&
! $( 'div.add-global-attribute-container' ).hasClass(
'hidden'
) &&
$( '.product_attributes' ).find( 'input, select, textarea' )
.length === 0
) {
toggle_add_global_attribute_layout();
}
jQuery.maybe_disable_save_button();
}
return false;
@@ -726,7 +787,7 @@ jQuery( function ( $ ) {
},
stop: function ( event, ui ) {
ui.item.removeAttr( 'style' );
attribute_row_indexes();
update_attribute_row_indexes();
},
} );
@@ -734,7 +795,10 @@ jQuery( function ( $ ) {
$( '.product_attributes' ).on(
'click',
'button.add_new_attribute',
function () {
function ( event ) {
// prevent form submission but allow event propagation
event.preventDefault();
$( '.product_attributes' ).block( {
message: null,
overlayCSS: {
@@ -757,35 +821,35 @@ jQuery( function ( $ ) {
security: woocommerce_admin_meta_boxes.add_attribute_nonce,
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function (
response
) {
if ( response.error ) {
// Error.
window.alert( response.error );
} else if ( response.slug ) {
// Success.
$wrapper
.find( 'select.attribute_values' )
.append(
'<option value="' +
response.term_id +
'" selected="selected">' +
response.name +
'</option>'
);
$wrapper
.find( 'select.attribute_values' )
.trigger( 'change' );
}
$.post(
woocommerce_admin_meta_boxes.ajax_url,
data,
function ( response ) {
if ( response.error ) {
// Error.
window.alert( response.error );
} else if ( response.slug ) {
// Success.
$wrapper
.find( 'select.attribute_values' )
.append(
'<option value="' +
response.term_id +
'" selected="selected">' +
response.name +
'</option>'
);
$wrapper
.find( 'select.attribute_values' )
.trigger( 'change' );
}
$( '.product_attributes' ).unblock();
} );
$( '.product_attributes' ).unblock();
}
);
} else {
$( '.product_attributes' ).unblock();
}
return false;
}
);
@@ -814,70 +878,76 @@ jQuery( function ( $ ) {
security: woocommerce_admin_meta_boxes.save_attributes_nonce,
};
$.post( woocommerce_admin_meta_boxes.ajax_url, data, function (
response
) {
if ( response.error ) {
// Error.
window.alert( response.error );
} else if ( response.data ) {
// Success.
$( '.product_attributes' ).html( response.data.html );
$( '.product_attributes' ).unblock();
$.post(
woocommerce_admin_meta_boxes.ajax_url,
data,
function ( response ) {
if ( response.error ) {
// Error.
window.alert( response.error );
} else if ( response.data ) {
// Success.
$( '.product_attributes' ).html( response.data.html );
$( '.product_attributes' ).unblock();
// Hide the 'Used for variations' checkbox if not viewing a variable product
show_and_hide_panels();
// Hide the 'Used for variations' checkbox if not viewing a variable product
show_and_hide_panels();
// Make sure the dropdown is not disabled for empty value attributes.
$( 'select.attribute_taxonomy' )
.find( 'option' )
.prop( 'disabled', false );
// Make sure the dropdown is not disabled for empty value attributes.
$( 'select.attribute_taxonomy' )
.find( 'option' )
.prop( 'disabled', false );
var newSelectedAttributes = [];
$( '.product_attributes .woocommerce_attribute' ).each(
function ( index, el ) {
if (
$( el ).css( 'display' ) !== 'none' &&
$( el ).is( '.taxonomy' )
) {
newSelectedAttributes.push(
$( el ).data( 'taxonomy' )
);
$( 'select.attribute_taxonomy' )
.find(
'option[value="' +
$( el ).data( 'taxonomy' ) +
'"]'
)
.prop( 'disabled', true );
var newSelectedAttributes = [];
$( '.product_attributes .woocommerce_attribute' ).each(
function ( index, el ) {
if (
$( el ).css( 'display' ) !== 'none' &&
$( el ).is( '.taxonomy' )
) {
newSelectedAttributes.push(
$( el ).data( 'taxonomy' )
);
$( 'select.attribute_taxonomy' )
.find(
'option[value="' +
$( el ).data( 'taxonomy' ) +
'"]'
)
.prop( 'disabled', true );
}
}
}
);
selectedAttributes = newSelectedAttributes;
$( 'select.wc-attribute-search' ).data(
'disabled-items',
newSelectedAttributes
);
);
selectedAttributes = newSelectedAttributes;
$( 'select.wc-attribute-search' ).data(
'disabled-items',
newSelectedAttributes
);
// Reload variations panel.
var this_page = window.location.toString();
this_page = this_page.replace(
'post-new.php?',
'post.php?post=' +
woocommerce_admin_meta_boxes.post_id +
'&action=edit&'
);
// Reload variations panel.
var this_page = window.location.toString();
this_page = this_page.replace(
'post-new.php?',
'post.php?post=' +
woocommerce_admin_meta_boxes.post_id +
'&action=edit&'
);
$( '#variable_product_options' ).load(
this_page + ' #variable_product_options_inner',
function () {
$( '#variable_product_options' ).trigger( 'reload' );
}
);
$( '#variable_product_options' ).load(
this_page + ' #variable_product_options_inner',
function () {
$( '#variable_product_options' ).trigger(
'reload'
);
}
);
$( document.body ).trigger( 'woocommerce_attributes_saved' );
$( document.body ).trigger(
'woocommerce_attributes_saved'
);
}
}
} );
);
} );
// Go to attributes tab when clicking on link in variations message
@@ -1102,7 +1172,7 @@ jQuery( function ( $ ) {
// Add a descriptive tooltip to the product description editor
$( '#wp-content-media-buttons' )
.append( '<span class="woocommerce-help-tip" tabindex="-1"></span>' )
.append( '<span class="woocommerce-help-tip" tabindex="0"></span>' )
.find( '.woocommerce-help-tip' )
.attr( 'tabindex', '0' )
.attr( 'for', 'content' )

File diff suppressed because one or more lines are too long

View File

@@ -126,7 +126,9 @@ jQuery( function ( $ ) {
$( 'ul.wc-tabs li', panel_wrap ).removeClass( 'active' );
$( this ).parent().addClass( 'active' );
$( 'div.panel', panel_wrap ).hide();
$( $( this ).attr( 'href' ) ).show();
$( $( this ).attr( 'href' ) ).show( 0, function () {
$( this ).trigger( 'woocommerce_tab_shown' );
} );
} );
$( 'div.panel-wrap' ).each( function () {
$( this )

View File

@@ -1 +1 @@
jQuery(function(a){jQuery.is_attribute_or_variation_empty=function(e){var t=!1;return e.each(function(){var e=a(this);e.hasClass("checkbox")||e.filter("[class*=search__field]").length||(e.is("select")?0!==e.find(":selected").length:e.val())||(t=!0)}),t},jQuery.maybe_disable_save_button=function(){e=a(".woocommerce_variation_new_attribute_data").is(":visible")?(t=a(".woocommerce_variation_new_attribute_data"),a("button.create-variations")):(t=a(".product_attributes"),a("button.save_attributes"));var e,t=t.find("input, select, textarea");jQuery.is_attribute_or_variation_empty(t)?e.hasClass("disabled")||(e.addClass("disabled"),e.attr("aria-disabled",!0)):(e.removeClass("disabled"),e.removeAttr("aria-disabled"))},a("#tiptip_holder").removeAttr("style"),a("#tiptip_arrow").removeAttr("style"),a(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),a(".save_attributes").tipTip({content:function(){return a(".save_attributes").hasClass("disabled")?woocommerce_admin_meta_boxes.i18n_save_attribute_variation_tip:""},fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),a(".create-variations").tipTip({content:function(){return a(".create-variations").hasClass("disabled")?woocommerce_admin_meta_boxes.i18n_save_attribute_variation_tip:""},fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),a(".wc-metaboxes-wrapper").on("click",".wc-metabox > h3",function(){var e=a(this).parent(".wc-metabox");e.hasClass("closed")?e.removeClass("closed"):e.addClass("closed"),e.hasClass("open")?e.removeClass("open"):e.addClass("open")}),a(document.body).on("wc-init-tabbed-panels",function(){a("ul.wc-tabs").show(),a("ul.wc-tabs a").on("click",function(e){e.preventDefault();e=a(this).closest("div.panel-wrap");a("ul.wc-tabs li",e).removeClass("active"),a(this).parent().addClass("active"),a("div.panel",e).hide(),a(a(this).attr("href")).show()}),a("div.panel-wrap").each(function(){a(this).find("ul.wc-tabs li").eq(0).find("a").trigger("click")})}).trigger("wc-init-tabbed-panels"),a(document.body).on("wc-init-datepickers",function(){a(".date-picker-field, .date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0})}).trigger("wc-init-datepickers"),a(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(e){a(e.target).filter(":input, option, .sort").length||a(this).next(".wc-metabox-content").stop().slideToggle()}).on("click",".expand_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").show(),!1}).on("click",".close_all",function(){return a(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").hide(),!1}),a(".wc-metabox.closed").each(function(){a(this).find(".wc-metabox-content").hide()}),a("#product_attributes").on("change","select.attribute_values",jQuery.maybe_disable_save_button),a("#product_attributes, #variable_product_options").on("keyup","input, textarea",jQuery.maybe_disable_save_button),jQuery.maybe_disable_save_button()});
jQuery(function(e){jQuery.is_attribute_or_variation_empty=function(t){var a=!1;return t.each(function(){var t=e(this);t.hasClass("checkbox")||t.filter("[class*=search__field]").length||(t.is("select")?0===t.find(":selected").length:!t.val())&&(a=!0)}),a},jQuery.maybe_disable_save_button=function(){if(e(".woocommerce_variation_new_attribute_data").is(":visible"))t=e(".woocommerce_variation_new_attribute_data"),a=e("button.create-variations");else var t=e(".product_attributes"),a=e("button.save_attributes");var i=t.find("input, select, textarea");jQuery.is_attribute_or_variation_empty(i)?a.hasClass("disabled")||(a.addClass("disabled"),a.attr("aria-disabled",!0)):(a.removeClass("disabled"),a.removeAttr("aria-disabled"))},e("#tiptip_holder").removeAttr("style"),e("#tiptip_arrow").removeAttr("style"),e(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),e(".save_attributes").tipTip({content:function(){return e(".save_attributes").hasClass("disabled")?woocommerce_admin_meta_boxes.i18n_save_attribute_variation_tip:""},fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),e(".create-variations").tipTip({content:function(){return e(".create-variations").hasClass("disabled")?woocommerce_admin_meta_boxes.i18n_save_attribute_variation_tip:""},fadeIn:50,fadeOut:50,delay:200,keepAlive:!0}),e(".wc-metaboxes-wrapper").on("click",".wc-metabox > h3",function(){var t=e(this).parent(".wc-metabox");t.hasClass("closed")?t.removeClass("closed"):t.addClass("closed"),t.hasClass("open")?t.removeClass("open"):t.addClass("open")}),e(document.body).on("wc-init-tabbed-panels",function(){e("ul.wc-tabs").show(),e("ul.wc-tabs a").on("click",function(t){t.preventDefault();var a=e(this).closest("div.panel-wrap");e("ul.wc-tabs li",a).removeClass("active"),e(this).parent().addClass("active"),e("div.panel",a).hide(),e(e(this).attr("href")).show(0,function(){e(this).trigger("woocommerce_tab_shown")})}),e("div.panel-wrap").each(function(){e(this).find("ul.wc-tabs li").eq(0).find("a").trigger("click")})}).trigger("wc-init-tabbed-panels"),e(document.body).on("wc-init-datepickers",function(){e(".date-picker-field, .date-picker").datepicker({dateFormat:"yy-mm-dd",numberOfMonths:1,showButtonPanel:!0})}).trigger("wc-init-datepickers"),e(".wc-metaboxes-wrapper").on("click",".wc-metabox h3",function(t){e(t.target).filter(":input, option, .sort").length||e(this).next(".wc-metabox-content").stop().slideToggle()}).on("click",".expand_all",function(){return e(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").show(),!1}).on("click",".close_all",function(){return e(this).closest(".wc-metaboxes-wrapper").find(".wc-metabox > .wc-metabox-content").hide(),!1}),e(".wc-metabox.closed").each(function(){e(this).find(".wc-metabox-content").hide()}),e("#product_attributes").on("change","select.attribute_values",jQuery.maybe_disable_save_button),e("#product_attributes, #variable_product_options").on("keyup","input, textarea",jQuery.maybe_disable_save_button),jQuery.maybe_disable_save_button()});

View File

@@ -1 +1 @@
!function(o,e){var t,n,s,r,a,c,d,m;"undefined"!=typeof woocommerce_network_orders&&(t=[],n=[],s=[],r=o(document.getElementById("network-orders-tbody")),a=e.template(o(document.getElementById("network-orders-row-template")).text()),c=o(document.getElementById("woocommerce-network-order-table-loading")),d=o(document.getElementById("woocommerce-network-order-table")),m=o(document.getElementById("woocommerce-network-orders-no-orders")),woocommerce_network_orders.sites.length?(o.each(woocommerce_network_orders.sites,function(r,e){n[r]=o.Deferred(),s.push(o.ajax({url:woocommerce_network_orders.order_endpoint,data:{_wpnonce:woocommerce_network_orders.nonce,network_orders:!0,blog_id:e},type:"GET"}).success(function(e){for(var o in e)t.push(e[o]);n[r].resolve()}).fail(function(){n[r].resolve()}))}),0<n.length&&o.when.apply(o,n).done(function(){var e,o;if(t.sort(function(e,o){e=Date.parse(e.date_created_gmt),o=Date.parse(o.date_created_gmt);return e===o?0:e<o?1:-1}),0<t.length){for(e in t)o=t[e],r.append(a(o));m.removeClass("is-active"),c.removeClass("is-active"),d.addClass("is-active")}else m.addClass("is-active"),c.removeClass("is-active"),d.removeClass("is-active")})):(c.removeClass("is-active"),d.removeClass("is-active"),m.addClass("is-active")))}(jQuery,_);
!function(e,o,r){if("undefined"!=typeof woocommerce_network_orders){var t=[],n=[],s=[],a=e(document.getElementById("network-orders-tbody")),d=o.template(e(document.getElementById("network-orders-row-template")).text()),c=e(document.getElementById("woocommerce-network-order-table-loading")),i=e(document.getElementById("woocommerce-network-order-table")),m=e(document.getElementById("woocommerce-network-orders-no-orders"));if(!woocommerce_network_orders.sites.length)return c.removeClass("is-active"),i.removeClass("is-active"),void m.addClass("is-active");e.each(woocommerce_network_orders.sites,function(o,r){n[o]=e.Deferred(),s.push(e.ajax({url:woocommerce_network_orders.order_endpoint,data:{_wpnonce:woocommerce_network_orders.nonce,network_orders:!0,blog_id:r},type:"GET"}).success(function(e){var r;for(r in e)t.push(e[r]);n[o].resolve()}).fail(function(){n[o].resolve()}))}),n.length>0&&e.when.apply(e,n).done(function(){var e,o;if(t.sort(function(e,o){var r,t;return(r=Date.parse(e.date_created_gmt))===(t=Date.parse(o.date_created_gmt))?0:r<t?1:-1}),t.length>0){for(e in t)o=t[e],a.append(d(o));m.removeClass("is-active"),c.removeClass("is-active"),i.addClass("is-active")}else m.addClass("is-active"),c.removeClass("is-active"),i.removeClass("is-active")})}}(jQuery,_);

View File

@@ -1 +1 @@
jQuery(function(e){e(function(){var o=e("#postdivrich");o.length&&(o.addClass("postbox woocommerce-product-description"),o.prepend('<h2 class="postbox-header"><label>'+woocommerce_admin_product_editor.i18n_description+"</label></h2>"))})});
jQuery(function(o){o(function(){var e=o("#postdivrich");e.length&&(e.addClass("postbox woocommerce-product-description"),e.prepend('<h2 class="postbox-header"><label>'+woocommerce_admin_product_editor.i18n_description+"</label></h2>"))})});

View File

@@ -1 +1 @@
jQuery(function(d){d("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),d("table.widefat tbody").sortable({items:"tr:not(.inline-edit-row)",cursor:"move",axis:"y",containment:"table.widefat",scrollSensitivity:40,helper:function(t,e){return e.each(function(){d(this).width(d(this).width())}),e},start:function(t,e){e.item.css("background-color","#ffffff"),e.item.children("td, th").css("border-bottom-width","0"),e.item.css("outline","1px solid #dfdfdf")},stop:function(t,e){e.item.removeAttr("style"),e.item.children("td,th").css("border-bottom-width","1px")},update:function(t,e){d("table.widefat tbody th, table.widefat tbody td").css("cursor","default"),d("table.widefat tbody").sortable("disable");var i=e.item.find(".check-column input").val(),o=e.item.prev().find(".check-column input").val(),n=e.item.next().find(".check-column input").val();e.item.find(".check-column input").hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),d.post(ajaxurl,{action:"woocommerce_product_ordering",id:i,previd:o,nextid:n},function(t){d.each(t,function(t,e){d("#inline_"+t+" .menu_order").html(e)}),e.item.find(".check-column input").show().siblings("img").remove(),d("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),d("table.widefat tbody").sortable("enable")}),d("table.widefat tbody tr").each(function(){d("table.widefat tbody tr").index(this)%2==0?d(this).addClass("alternate"):d(this).removeClass("alternate")})},sort:function(t,i){i.placeholder.find("td").each(function(t,e){i.helper.find("td").eq(t).is(":visible")?d(this).show():d(this).hide()})}})});
jQuery(function(t){t("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),t("table.widefat tbody").sortable({items:"tr:not(.inline-edit-row)",cursor:"move",axis:"y",containment:"table.widefat",scrollSensitivity:40,helper:function(e,i){return i.each(function(){t(this).width(t(this).width())}),i},start:function(t,e){e.item.css("background-color","#ffffff"),e.item.children("td, th").css("border-bottom-width","0"),e.item.css("outline","1px solid #dfdfdf")},stop:function(t,e){e.item.removeAttr("style"),e.item.children("td,th").css("border-bottom-width","1px")},update:function(e,i){t("table.widefat tbody th, table.widefat tbody td").css("cursor","default"),t("table.widefat tbody").sortable("disable");var o=i.item.find(".check-column input").val(),n=i.item.prev().find(".check-column input").val(),d=i.item.next().find(".check-column input").val();i.item.find(".check-column input").hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),t.post(ajaxurl,{action:"woocommerce_product_ordering",id:o,previd:n,nextid:d},function(e){t.each(e,function(e,i){t("#inline_"+e+" .menu_order").html(i)}),i.item.find(".check-column input").show().siblings("img").remove(),t("table.widefat tbody th, table.widefat tbody td").css("cursor","move"),t("table.widefat tbody").sortable("enable")}),t("table.widefat tbody tr").each(function(){t("table.widefat tbody tr").index(this)%2==0?t(this).addClass("alternate"):t(this).removeClass("alternate")})},sort:function(e,i){i.placeholder.find("td").each(function(e,o){i.helper.find("td").eq(e).is(":visible")?t(this).show():t(this).hide()})}})});

View File

@@ -1 +1 @@
jQuery(function(g){g("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var e=(e=g(this).closest("tr").attr("id")).replace("post-",""),e=g("#woocommerce_inline_"+e),t=e.find(".sku").text(),i=e.find(".regular_price").text(),n=e.find(".sale_price ").text(),o=e.find(".weight").text(),d=e.find(".length").text(),s=e.find(".width").text(),l=e.find(".height").text(),c=e.find(".shipping_class").text(),a=e.find(".visibility").text(),r=e.find(".stock_status").text(),_=e.find(".stock").text(),p=e.find(".featured").text(),m=e.find(".manage_stock").text(),u=e.find(".menu_order").text(),f=e.find(".tax_status").text(),w=e.find(".tax_class").text(),h=e.find(".backorders").text(),k=e.find(".product_type").text(),i=i.replace(".",woocommerce_admin.mon_decimal_point),n=n.replace(".",woocommerce_admin.mon_decimal_point),t=(g('input[name="_sku"]',".inline-edit-row").val(t),g('input[name="_regular_price"]',".inline-edit-row").val(i),g('input[name="_sale_price"]',".inline-edit-row").val(n),g('input[name="_weight"]',".inline-edit-row").val(o),g('input[name="_length"]',".inline-edit-row").val(d),g('input[name="_width"]',".inline-edit-row").val(s),g('input[name="_height"]',".inline-edit-row").val(l),g('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).trigger("change"),g('select[name="_shipping_class"] option[value="'+c+'"]').attr("selected","selected").trigger("change"),g('input[name="_stock"]',".inline-edit-row").val(_),g('input[name="menu_order"]',".inline-edit-row").val(u),g('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').prop("selected",!1).removeAttr("selected"),"variable"===k),i=(g('select[name="_stock_status"] ~ .wc-quick-edit-warning',".inline-edit-row").toggle(t),g('select[name="_stock_status"] option[value="'+(t?"":r)+'"]',".inline-edit-row").attr("selected","selected"),g('select[name="_tax_status"] option[value="'+f+'"]',".inline-edit-row").attr("selected","selected"),g('select[name="_tax_class"] option[value="'+w+'"]',".inline-edit-row").attr("selected","selected"),g('select[name="_visibility"] option[value="'+a+'"]',".inline-edit-row").attr("selected","selected"),g('select[name="_backorders"] option[value="'+h+'"]',".inline-edit-row").attr("selected","selected"),"yes"===p?g('input[name="_featured"]',".inline-edit-row").prop("checked",!0):g('input[name="_featured"]',".inline-edit-row").prop("checked",!1),e.find(".product_is_virtual").text()),n="external"!==k,o="external"!==k&&"grouped"!==k;g(".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").show(),o?"yes"===m?(g(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),g(".stock_status_field").hide(),g(".manage_stock_field input").prop("checked",!0)):(g(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),g(".stock_status_field").show().removeAttr("style"),g(".manage_stock_field input").prop("checked",!1)):g(n?".stock_fields, .manage_stock_field, .backorder_field":".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").hide(),"simple"===k||"external"===k?g(".price_fields",".inline-edit-row").show().removeAttr("style"):g(".price_fields",".inline-edit-row").hide(),"yes"===i?g(".dimension_fields",".inline-edit-row").hide():g(".dimension_fields",".inline-edit-row").show().removeAttr("style"),g('input[name="comment_status"]').parent().find(".checkbox-title").text(woocommerce_quick_edit.strings.allow_reviews)}),g("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){g(this).is(":checked")?(g(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),g(".stock_status_field").hide()):(g(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),g(".stock_status_field").show().removeAttr("style"))}),g("#wpbody").on("click","#doaction, #doaction2",function(){g("input.text",".inline-edit-row").val(""),g("#woocommerce-fields").find("select").prop("selectedIndex",0),g("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide()}),g("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<g(this).val()?g(this).closest("div").find(".change-input").show():g(this).closest("div").find(".change-input").hide()}),g("#wpbody").on("click",".trash-product",function(){return window.confirm(woocommerce_admin.i18n_delete_product_notice)})});
jQuery(function(e){e("#the-list").on("click",".editinline",function(){inlineEditPost.revert();var t=e(this).closest("tr").attr("id");t=t.replace("post-","");var i=e("#woocommerce_inline_"+t),n=i.find(".sku").text(),o=i.find(".regular_price").text(),d=i.find(".sale_price ").text(),s=i.find(".weight").text(),l=i.find(".length").text(),c=i.find(".width").text(),a=i.find(".height").text(),r=i.find(".shipping_class").text(),_=i.find(".visibility").text(),p=i.find(".stock_status").text(),m=i.find(".stock").text(),u=i.find(".featured").text(),f=i.find(".manage_stock").text(),w=i.find(".menu_order").text(),h=i.find(".tax_status").text(),k=i.find(".tax_class").text(),g=i.find(".backorders").text(),v=i.find(".product_type").text(),x=o.replace(".",woocommerce_admin.mon_decimal_point),y=d.replace(".",woocommerce_admin.mon_decimal_point);e('input[name="_sku"]',".inline-edit-row").val(n),e('input[name="_regular_price"]',".inline-edit-row").val(x),e('input[name="_sale_price"]',".inline-edit-row").val(y),e('input[name="_weight"]',".inline-edit-row").val(s),e('input[name="_length"]',".inline-edit-row").val(l),e('input[name="_width"]',".inline-edit-row").val(c),e('input[name="_height"]',".inline-edit-row").val(a),e('select[name="_shipping_class"] option:selected',".inline-edit-row").attr("selected",!1).trigger("change"),e('select[name="_shipping_class"] option[value="'+r+'"]').attr("selected","selected").trigger("change"),e('input[name="_stock"]',".inline-edit-row").val(m),e('input[name="menu_order"]',".inline-edit-row").val(w),e('select[name="_tax_status"] option, select[name="_tax_class"] option, select[name="_visibility"] option, select[name="_stock_status"] option, select[name="_backorders"] option').prop("selected",!1).removeAttr("selected");var b="variable"===v;e('select[name="_stock_status"] ~ .wc-quick-edit-warning',".inline-edit-row").toggle(b),e('select[name="_stock_status"] option[value="'+(b?"":p)+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_tax_status"] option[value="'+h+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_tax_class"] option[value="'+k+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_visibility"] option[value="'+_+'"]',".inline-edit-row").attr("selected","selected"),e('select[name="_backorders"] option[value="'+g+'"]',".inline-edit-row").attr("selected","selected"),"yes"===u?e('input[name="_featured"]',".inline-edit-row").prop("checked",!0):e('input[name="_featured"]',".inline-edit-row").prop("checked",!1);var A=i.find(".product_is_virtual").text(),q="external"!==v,j="external"!==v&&"grouped"!==v;e(".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").show(),j?"yes"===f?(e(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),e(".stock_status_field").hide(),e(".manage_stock_field input").prop("checked",!0)):(e(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"),e(".manage_stock_field input").prop("checked",!1)):q?e(".stock_fields, .manage_stock_field, .backorder_field").hide():e(".stock_fields, .manage_stock_field, .stock_status_field, .backorder_field").hide(),"simple"===v||"external"===v?e(".price_fields",".inline-edit-row").show().removeAttr("style"):e(".price_fields",".inline-edit-row").hide(),"yes"===A?e(".dimension_fields",".inline-edit-row").hide():e(".dimension_fields",".inline-edit-row").show().removeAttr("style"),e('input[name="comment_status"]').parent().find(".checkbox-title").text(woocommerce_quick_edit.strings.allow_reviews)}),e("#the-list").on("change",'.inline-edit-row input[name="_manage_stock"]',function(){e(this).is(":checked")?(e(".stock_qty_field, .backorder_field",".inline-edit-row").show().removeAttr("style"),e(".stock_status_field").hide()):(e(".stock_qty_field, .backorder_field",".inline-edit-row").hide(),e(".stock_status_field").show().removeAttr("style"))}),e("#wpbody").on("click","#doaction, #doaction2",function(){e("input.text",".inline-edit-row").val(""),e("#woocommerce-fields").find("select").prop("selectedIndex",0),e("#woocommerce-fields-bulk").find(".inline-edit-group .change-input").hide()}),e("#wpbody").on("change","#woocommerce-fields-bulk .inline-edit-group .change_to",function(){0<e(this).val()?e(this).closest("div").find(".change-input").show():e(this).closest("div").find(".change-input").hide()}),e("#wpbody").on("click",".trash-product",function(){return window.confirm(woocommerce_admin.i18n_delete_product_notice)})});

View File

@@ -1 +1 @@
jQuery(function(p){function r(t,e,a){p('<div class="chart-tooltip">'+a+"</div>").css({top:e-16,left:t+20}).appendTo("body").fadeIn(200)}var o=null,s=null,a=(p(".chart-placeholder").on("plothover",function(t,e,a){var n,i;a?o===a.dataIndex&&s===a.seriesIndex||(o=a.dataIndex,s=a.seriesIndex,p(".chart-tooltip").remove(),(a.series.points.show||a.series.enable_tooltip)&&(n=a.series.data[a.dataIndex][1],i="",a.series.prepend_label&&(i=i+a.series.label+": "),a.series.prepend_tooltip&&(i+=a.series.prepend_tooltip),i+=n,a.series.append_tooltip&&(i+=a.series.append_tooltip),a.series.pie.show?r(e.pageX,e.pageY,i):r(a.pageX,a.pageY,i))):(p(".chart-tooltip").remove(),o=null)}),p(".wc_sparkline.bars").each(function(){var t=[{data:p(this).data("sparkline"),color:p(this).data("color"),bars:{fillColor:p(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:p(this).data("barwidth"),align:"center"},shadowSize:0}];p.plot(p(this),t,{grid:{show:!1}})}),p(".wc_sparkline.lines").each(function(){var t=[{data:p(this).data("sparkline"),color:p(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];p.plot(p(this),t,{grid:{show:!1}})}),p(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-20Y",maxDate:"+1D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(){var t=p(this).is(".from")?"minDate":"maxDate",e=p(this).datepicker("getDate");a.not(this).datepicker("option",t,e)}}));"undefined"==typeof document.createElement("a").download&&p(".export_csv").hide(),p(".export_csv").on("click",function(){var t,e,a=p(this).data("exclude_series")||"",n=(a=(a=a.toString()).split(","),p(this).data("xaxes")),r=p(this).data("groupby"),o=p(this).data("index_type"),i=p(this).data("export"),s="";if("table"===i)p(this).offsetParent().find("thead tr,tbody tr").each(function(){p(this).find("th, td").each(function(){var t=(t=p(this).text()).replace("[?]","").replace("#","");s+='"'+t+'",'}),s=s.substring(0,s.length-1),s+="\n"}),p(this).offsetParent().find("tfoot tr").each(function(){p(this).find("th, td").each(function(){var t=(t=p(this).text()).replace("[?]","").replace("#","");if(s+='"'+t+'",',0<p(this).attr("colspan"))for(c=1;c<p(this).attr("colspan");c++)s+='"",'}),s=s.substring(0,s.length-1),s+="\n"});else{if(!window.main_chart)return!1;var i=window.main_chart.getData(),l=[];for(s+='"'+n+'",',p.each(i,function(t,e){a&&-1!==p.inArray(t.toString(),a)||l.push(e)}),d=0;d<l.length;++d)s+='"'+l[d].label+'",';s=s.substring(0,s.length-1),s+="\n";for(var h={},d=0;d<l.length;++d)for(t=l[d].data,e=0;e<t.length;++e){h[t[e][0]]=[];for(var c=0;c<l.length;++c)h[t[e][0]].push(0)}for(d=0;d<l.length;++d)for(t=l[d].data,e=0;e<t.length;++e)h[t[e][0]][d]=t[e][1];p.each(h,function(t,e){var a=new Date(parseInt(t,10));s+="none"===o?'"'+t+'",':"day"===r?'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+"-"+a.getUTCDate()+'",':'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+'",';for(var n=0;n<e.length;++n){var i=e[n];Math.round(i)!==i&&(i=(i=parseFloat(i)).toFixed(2)),s+='"'+i+'",'}s=s.substring(0,s.length-1),s+="\n"})}return s="data:text/csv;charset=utf-8,\ufeff"+encodeURIComponent(s),p(this).attr("href",s),!0})});
jQuery(function(t){function e(e,a,n){t('<div class="chart-tooltip">'+n+"</div>").css({top:a-16,left:e+20}).appendTo("body").fadeIn(200)}var a=null,n=null;t(".chart-placeholder").on("plothover",function(i,r,o){if(o){if((a!==o.dataIndex||n!==o.seriesIndex)&&(a=o.dataIndex,n=o.seriesIndex,t(".chart-tooltip").remove(),o.series.points.show||o.series.enable_tooltip)){var s=o.series.data[o.dataIndex][1],l="";o.series.prepend_label&&(l=l+o.series.label+": "),o.series.prepend_tooltip&&(l+=o.series.prepend_tooltip),l+=s,o.series.append_tooltip&&(l+=o.series.append_tooltip),o.series.pie.show?e(r.pageX,r.pageY,l):e(o.pageX,o.pageY,l)}}else t(".chart-tooltip").remove(),a=null}),t(".wc_sparkline.bars").each(function(){var e=[{data:t(this).data("sparkline"),color:t(this).data("color"),bars:{fillColor:t(this).data("color"),fill:!0,show:!0,lineWidth:1,barWidth:t(this).data("barwidth"),align:"center"},shadowSize:0}];t.plot(t(this),e,{grid:{show:!1}})}),t(".wc_sparkline.lines").each(function(){var e=[{data:t(this).data("sparkline"),color:t(this).data("color"),lines:{fill:!1,show:!0,lineWidth:1,align:"center"},shadowSize:0}];t.plot(t(this),e,{grid:{show:!1}})});var i=t(".range_datepicker").datepicker({changeMonth:!0,changeYear:!0,defaultDate:"",dateFormat:"yy-mm-dd",numberOfMonths:1,minDate:"-20Y",maxDate:"+1D",showButtonPanel:!0,showOn:"focus",buttonImageOnly:!0,onSelect:function(){var e=t(this).is(".from")?"minDate":"maxDate",a=t(this).datepicker("getDate");i.not(this).datepicker("option",e,a)}});"undefined"==typeof document.createElement("a").download&&t(".export_csv").hide(),t(".export_csv").on("click",function(){var e=t(this).data("exclude_series")||"";e=(e=e.toString()).split(",");var a,n,i,r=t(this).data("xaxes"),o=t(this).data("groupby"),s=t(this).data("index_type"),l="";if("table"===t(this).data("export"))t(this).offsetParent().find("thead tr,tbody tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();e=e.replace("[?]","").replace("#",""),l+='"'+e+'",'}),l=l.substring(0,l.length-1),l+="\n"}),t(this).offsetParent().find("tfoot tr").each(function(){t(this).find("th, td").each(function(){var e=t(this).text();if(e=e.replace("[?]","").replace("#",""),l+='"'+e+'",',t(this).attr("colspan")>0)for(p=1;p<t(this).attr("colspan");p++)l+='"",'}),l=l.substring(0,l.length-1),l+="\n"});else{if(!window.main_chart)return!1;var h=window.main_chart.getData(),d=[];for(l+='"'+r+'",',t.each(h,function(a,n){e&&-1!==t.inArray(a.toString(),e)||d.push(n)}),a=0;a<d.length;++a)l+='"'+d[a].label+'",';l=l.substring(0,l.length-1),l+="\n";var c={};for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i){c[n[i][0]]=[];for(var p=0;p<d.length;++p)c[n[i][0]].push(0)}for(a=0;a<d.length;++a)for(n=d[a].data,i=0;i<n.length;++i)c[n[i][0]][a]=n[i][1];t.each(c,function(t,e){var a=new Date(parseInt(t,10));l+="none"===s?'"'+t+'",':"day"===o?'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+"-"+a.getUTCDate()+'",':'"'+a.getUTCFullYear()+"-"+parseInt(a.getUTCMonth()+1,10)+'",';for(var n=0;n<e.length;++n){var i=e[n];Math.round(i)!==i&&(i=(i=parseFloat(i)).toFixed(2)),l+='"'+i+'",'}l=l.substring(0,l.length-1),l+="\n"})}return l="data:text/csv;charset=utf-8,\ufeff"+encodeURIComponent(l),t(this).attr("href",l),!0})});

View File

@@ -18,7 +18,7 @@
$table = $( '.wc_tax_rates' ),
$tbody = $( '#rates' ),
$save_button = $( ':input[name="save"]' ),
$pagination = $( '#rates-pagination' ),
$pagination = $( '#rates-pagination, #rates-bottom-pagination' ),
$search_field = $( '#rates-search .wc-tax-rates-search-field' ),
$submit = $( '.submit .button-primary[type=submit]' ),
WCTaxTableModelConstructor = Backbone.Model.extend({

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function(n,c,s){n(function(){n("select#woocommerce_allowed_countries").on("change",function(){"specific"===n(this).val()?(n(this).closest("tr").next("tr").hide(),n(this).closest("tr").next().next("tr").show()):("all_except"===n(this).val()?n(this).closest("tr").next("tr").show():n(this).closest("tr").next("tr").hide(),n(this).closest("tr").next().next("tr").hide())}).trigger("change"),n("select#woocommerce_ship_to_countries").on("change",function(){"specific"===n(this).val()?n(this).closest("tr").next("tr").show():n(this).closest("tr").next("tr").hide()}).trigger("change"),n("input#woocommerce_manage_stock").on("change",function(){n(this).is(":checked")?n(this).closest("tbody").find(".manage_stock_field").closest("tr").show():n(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).trigger("change"),n(".colorpick").iris({change:function(t,e){n(this).parent().find(".colorpickpreview").css({backgroundColor:e.color.toString()})},hide:!0,border:!0}).on("click focus",function(t){t.stopPropagation(),n(".iris-picker").hide(),n(this).closest("td").find(".iris-picker").show(),n(this).data("originalValue",n(this).val())}).on("change",function(){n(this).is(".iris-error")&&(n(this).data("originalValue").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?n(this).val(n(this).data("originalValue")):n(this).val("")).trigger("change")}),n("body").on("click",function(){n(".iris-picker").hide()}),n(function(){var e=!1;let o=n(".wp-list-table .check-column");n("input, textarea, select, checkbox").on("change",function(t){o.length&&o.has(t.target)||e||(window.onbeforeunload=function(){return c.i18n_nav_warning},e=!0)}),n(".submit :input, input#search-submit").on("click",function(){window.onbeforeunload=""})}),n("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(t,e){return e.children().each(function(){n(this).width(n(this).width())}),e.css("left","0"),e},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style"),e.item.trigger("updateMoveButtons")}}),n(".woocommerce").on("click",".select_all",function(){return n(this).closest("td").find("select option").prop("selected",!0),n(this).closest("td").find("select").trigger("change"),!1}),n(".woocommerce").on("click",".select_none",function(){return n(this).closest("td").find("select option").prop("selected",!1),n(this).closest("td").find("select").trigger("change"),!1}),n(".wc-item-reorder-nav").find(".wc-move-up, .wc-move-down").on("click",function(){var t=n(this),e=t.closest("tr"),o=(t.trigger("focus"),t.is(".wc-move-up")),i=t.is(".wc-move-down");o?(o=e.prev("tr"))&&o.length&&(o.before(e),s.a11y.speak(c.i18n_moved_up)):i&&(o=e.next("tr"))&&o.length&&(o.after(e),s.a11y.speak(c.i18n_moved_down)),t.trigger("focus"),t.closest("table").trigger("updateMoveButtons")}),n(".wc-item-reorder-nav").closest("table").on("updateMoveButtons",function(){var t=n(this),e=n(this).find("tbody tr:last"),o=n(this).find("tbody tr:first");t.find(".wc-item-reorder-nav .wc-move-disabled").removeClass("wc-move-disabled").attr({tabindex:"0","aria-hidden":"false"}),o.find(".wc-item-reorder-nav .wc-move-up").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"}),e.find(".wc-item-reorder-nav .wc-move-down").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"})}),n(".wc-item-reorder-nav").closest("table").trigger("updateMoveButtons"),n(".submit button").on("click",function(){if("specific"===n("select#woocommerce_allowed_countries").val()&&!n('[name="woocommerce_specific_allowed_countries[]"]').val())return!!window.confirm(woocommerce_settings_params.i18n_no_specific_countries_selected)}),n("#settings-other-payment-methods").on("click",function(t){"undefined"==typeof window.wcTracks.recordEvent&&"undefined"==typeof window.wc.tracks.recordEvent||(window.wc.tracks.recordEvent||window.wcTracks.recordEvent)("settings_payments_recommendations_other_options",{available_payment_methods:n.map(n("td.wc_payment_gateways_wrapper tbody tr[data-gateway_id] "),function(t){return n(t).attr("data-gateway_id")})})})})}(jQuery,woocommerce_settings_params,wp);
!function(t,e,i){t(function(){t("select#woocommerce_allowed_countries").on("change",function(){"specific"===t(this).val()?(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").show()):"all_except"===t(this).val()?(t(this).closest("tr").next("tr").show(),t(this).closest("tr").next().next("tr").hide()):(t(this).closest("tr").next("tr").hide(),t(this).closest("tr").next().next("tr").hide())}).trigger("change"),t("select#woocommerce_ship_to_countries").on("change",function(){"specific"===t(this).val()?t(this).closest("tr").next("tr").show():t(this).closest("tr").next("tr").hide()}).trigger("change"),t("input#woocommerce_manage_stock").on("change",function(){t(this).is(":checked")?t(this).closest("tbody").find(".manage_stock_field").closest("tr").show():t(this).closest("tbody").find(".manage_stock_field").closest("tr").hide()}).trigger("change"),t(".colorpick").iris({change:function(e,i){t(this).parent().find(".colorpickpreview").css({backgroundColor:i.color.toString()})},hide:!0,border:!0}).on("click focus",function(e){e.stopPropagation(),t(".iris-picker").hide(),t(this).closest("td").find(".iris-picker").show(),t(this).data("originalValue",t(this).val())}).on("change",function(){t(this).is(".iris-error")&&(t(this).data("originalValue").match(/^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/)?t(this).val(t(this).data("originalValue")).trigger("change"):t(this).val("").trigger("change"))}),t("body").on("click",function(){t(".iris-picker").hide()}),t(function(){var i=!1;let o=t(".wp-list-table .check-column");t("input, textarea, select, checkbox").on("change",function(t){o.length&&o.has(t.target)||i||(window.onbeforeunload=function(){return e.i18n_nav_warning},i=!0)}),t(".submit :input, input#search-submit").on("click",function(){window.onbeforeunload=""})}),t("table.wc_gateways tbody, table.wc_shipping tbody").sortable({items:"tr",cursor:"move",axis:"y",handle:"td.sort",scrollSensitivity:40,helper:function(e,i){return i.children().each(function(){t(this).width(t(this).width())}),i.css("left","0"),i},start:function(t,e){e.item.css("background-color","#f6f6f6")},stop:function(t,e){e.item.removeAttr("style"),e.item.trigger("updateMoveButtons")}}),t(".woocommerce").on("click",".select_all",function(){return t(this).closest("td").find("select option").prop("selected",!0),t(this).closest("td").find("select").trigger("change"),!1}),t(".woocommerce").on("click",".select_none",function(){return t(this).closest("td").find("select option").prop("selected",!1),t(this).closest("td").find("select").trigger("change"),!1}),t(".wc-item-reorder-nav").find(".wc-move-up, .wc-move-down").on("click",function(){var o=t(this),n=o.closest("tr");o.trigger("focus");var c=o.is(".wc-move-up"),s=o.is(".wc-move-down");if(c){var r=n.prev("tr");r&&r.length&&(r.before(n),i.a11y.speak(e.i18n_moved_up))}else if(s){var a=n.next("tr");a&&a.length&&(a.after(n),i.a11y.speak(e.i18n_moved_down))}o.trigger("focus"),o.closest("table").trigger("updateMoveButtons")}),t(".wc-item-reorder-nav").closest("table").on("updateMoveButtons",function(){var e=t(this),i=t(this).find("tbody tr:last"),o=t(this).find("tbody tr:first");e.find(".wc-item-reorder-nav .wc-move-disabled").removeClass("wc-move-disabled").attr({tabindex:"0","aria-hidden":"false"}),o.find(".wc-item-reorder-nav .wc-move-up").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"}),i.find(".wc-item-reorder-nav .wc-move-down").addClass("wc-move-disabled").attr({tabindex:"-1","aria-hidden":"true"})}),t(".wc-item-reorder-nav").closest("table").trigger("updateMoveButtons"),t(".submit button").on("click",function(){if("specific"===t("select#woocommerce_allowed_countries").val()&&!t('[name="woocommerce_specific_allowed_countries[]"]').val())return!!window.confirm(woocommerce_settings_params.i18n_no_specific_countries_selected)}),t("#settings-other-payment-methods").on("click",function(e){"undefined"==typeof window.wcTracks.recordEvent&&"undefined"==typeof window.wc.tracks.recordEvent||(window.wc.tracks.recordEvent||window.wcTracks.recordEvent)("settings_payments_recommendations_other_options",{available_payment_methods:t.map(t("td.wc_payment_gateways_wrapper tbody tr[data-gateway_id] "),function(e){return t(e).attr("data-gateway_id")})})})})}(jQuery,woocommerce_settings_params,wp);

View File

@@ -1 +1 @@
jQuery(function(r){({init:function(){r(document.body).on("click","a.help_tip, a.woocommerce-help-tip, woocommerce-product-type-tip",this.preventTipTipClick).on("click","a.debug-report",this.generateReport).on("click","#copy-for-support",this.copyReport).on("aftercopy","#copy-for-support",this.copySuccess).on("aftercopyfailure","#copy-for-support",this.copyFail).on("click","#download-for-support",this.downloadReport)},preventTipTipClick:function(){return!1},generateReport:function(){var n="";r(".wc_status_table thead, .wc_status_table tbody").each(function(){var t;r(this).is("thead")?(t=r(this).find("th:eq(0)").data("exportLabel")||r(this).text(),n=n+"\n### "+t.trim()+" ###\n\n"):r("tr",r(this)).each(function(){var o,t=(r(this).find("td:eq(0)").data("exportLabel")||r(this).find("td:eq(0)").text()).trim().replace(/(<([^>]+)>)/gi,""),e=r(this).find("td:eq(2)").clone(),e=(e.find(".private").remove(),e.find(".dashicons-yes").replaceWith("&#10004;"),e.find(".dashicons-no-alt, .dashicons-warning").replaceWith("&#10060;"),e.text().trim()),i=e.split(", ");1<i.length&&(o="",r.each(i,function(t,e){o=o+e+"\n"}),e=o),n=n+""+t+": "+e+"\n"})});try{r("#debug-report").slideDown(),r("#debug-report").find("textarea").val("`"+n+"`").trigger("focus").trigger("select"),r(this).fadeOut()}catch(t){console.log(t)}return!1},copyReport:function(t){wcClearClipboard(),wcSetClipboard(r("#debug-report").find("textarea").val(),r(this)),t.preventDefault()},copySuccess:function(){r("#copy-for-support").tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).trigger("focus")},copyFail:function(){r(".copy-error").removeClass("hidden"),r("#debug-report").find("textarea").trigger("focus").trigger("select")},downloadReport:function(){var t=new Blob([r("#debug-report").find("textarea").val()],{type:"text/plain"}),e=window.location.hostname,o=(new Date).toISOString().slice(0,19).replace(/:/g,"-"),i=document.createElement("a");i.download="SystemStatusReport_"+e+"_"+o+".txt",i.href=window.URL.createObjectURL(t),i.textContent="Download ready",i.style="display:none",i.click(),i.remove()}}).init(),r(".wc_status_table").on("click",".run-tool .button",function(t){return t.stopImmediatePropagation(),window.confirm(woocommerce_admin_system_status.run_tool_confirmation)}),r("#log-viewer-select").on("click","h2 a.page-title-action",function(t){return t.stopImmediatePropagation(),window.confirm(woocommerce_admin_system_status.delete_log_confirmation)})});
jQuery(function(t){({init:function(){t(document.body).on("click","a.help_tip, a.woocommerce-help-tip, woocommerce-product-type-tip",this.preventTipTipClick).on("click","a.debug-report",this.generateReport).on("click","#copy-for-support",this.copyReport).on("aftercopy","#copy-for-support",this.copySuccess).on("aftercopyfailure","#copy-for-support",this.copyFail).on("click","#download-for-support",this.downloadReport)},preventTipTipClick:function(){return!1},generateReport:function(){var e="";t(".wc_status_table thead, .wc_status_table tbody").each(function(){if(t(this).is("thead")){var o=t(this).find("th:eq(0)").data("exportLabel")||t(this).text();e=e+"\n### "+o.trim()+" ###\n\n"}else t("tr",t(this)).each(function(){var o=(t(this).find("td:eq(0)").data("exportLabel")||t(this).find("td:eq(0)").text()).trim().replace(/(<([^>]+)>)/gi,""),i=t(this).find("td:eq(2)").clone();i.find(".private").remove(),i.find(".dashicons-yes").replaceWith("&#10004;"),i.find(".dashicons-no-alt, .dashicons-warning").replaceWith("&#10060;");var n=i.text().trim(),r=n.split(", ");if(r.length>1){var a="";t.each(r,function(t,e){a=a+e+"\n"}),n=a}e=e+""+o+": "+n+"\n"})});try{return t("#debug-report").slideDown(),t("#debug-report").find("textarea").val("`"+e+"`").trigger("focus").trigger("select"),t(this).fadeOut(),!1}catch(o){console.log(o)}return!1},copyReport:function(e){wcClearClipboard(),wcSetClipboard(t("#debug-report").find("textarea").val(),t(this)),e.preventDefault()},copySuccess:function(){t("#copy-for-support").tipTip({attribute:"data-tip",activation:"focus",fadeIn:50,fadeOut:50,delay:0}).trigger("focus")},copyFail:function(){t(".copy-error").removeClass("hidden"),t("#debug-report").find("textarea").trigger("focus").trigger("select")},downloadReport:function(){var e=new Blob([t("#debug-report").find("textarea").val()],{type:"text/plain"}),o=window.location.hostname,i=(new Date).toISOString().slice(0,19).replace(/:/g,"-"),n=document.createElement("a");n.download="SystemStatusReport_"+o+"_"+i+".txt",n.href=window.URL.createObjectURL(e),n.textContent="Download ready",n.style="display:none",n.click(),n.remove()}}).init(),t(".wc_status_table").on("click",".run-tool .button",function(t){return t.stopImmediatePropagation(),window.confirm(woocommerce_admin_system_status.run_tool_confirmation)}),t("#log-viewer-select").on("click","h2 a.page-title-action",function(t){return t.stopImmediatePropagation(),window.confirm(woocommerce_admin_system_status.delete_log_confirmation)})});

View File

@@ -1 +1 @@
jQuery(function(c){var l="table.wp-list-table",s='.column-handle input[name="term_id"]',i='<td class="column-handle"></td>';0===c(l).find(".column-handle").length&&(c(l).find("tr:not(.inline-edit-row)").append(i),s=".check-column input"),window.wcTracks=window.wcTracks||{},window.wcTracks.recordEvent=window.wcTracks.recordEvent||function(){},c(l).find(".column-handle").show(),c.wc_add_missing_sort_handles=function(){var e=c(l).find("tbody > tr"),n=c(l).find("tbody > tr > td.column-handle").parent();e.length!==n.length&&e.each(function(e,t){n.is(t)||c(t).append(i)}),c(l).find(".column-handle").show()},c(document).ajaxComplete(function(e,t,n){t&&4===t.readyState&&200===t.status&&n.data&&(0<=n.data.indexOf("_inline_edit")||0<=n.data.indexOf("add-tag"))&&(c.wc_add_missing_sort_handles(),c(document.body).trigger("init_tooltips"))}),c(l).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(e,t){var n,i,d=t.item.find(s).val(),o=t.item.find(".parent").html(),a=t.item.prev().find(s).val(),r=t.item.next().find(s).val();a!==undefined&&(n=t.item.prev().find(".parent").html())!==o&&(a=undefined),r!==undefined&&(i=t.item.next().find(".parent").html())!==o&&(r=undefined),a===undefined&&r===undefined||r===undefined&&i===a||r!==undefined&&n===d?c(l).sortable("cancel"):(window.wcTracks.recordEvent("product_attributes_ordering_term",{is_category:"product_cat"===woocommerce_term_ordering_params.taxonomy?"yes":"no"}),t.item.find(".check-column input").hide(),t.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),c.post(ajaxurl,{action:"woocommerce_term_ordering",id:d,nextid:r,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(t.item.find(".check-column input").show(),t.item.find(".check-column").find("img").remove())}),c("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});
jQuery(function(e){var t="table.wp-list-table",n='.column-handle input[name="term_id"]';0===e(t).find(".column-handle").length&&(e(t).find("tr:not(.inline-edit-row)").append('<td class="column-handle"></td>'),n=".check-column input"),window.wcTracks=window.wcTracks||{},window.wcTracks.recordEvent=window.wcTracks.recordEvent||function(){},e(t).find(".column-handle").show(),e.wc_add_missing_sort_handles=function(){var n=e(t).find("tbody > tr"),i=e(t).find("tbody > tr > td.column-handle").parent();n.length!==i.length&&n.each(function(t,n){i.is(n)||e(n).append('<td class="column-handle"></td>')}),e(t).find(".column-handle").show()},e(document).ajaxComplete(function(t,n,i){n&&4===n.readyState&&200===n.status&&i.data&&(0<=i.data.indexOf("_inline_edit")||0<=i.data.indexOf("add-tag"))&&(e.wc_add_missing_sort_handles(),e(document.body).trigger("init_tooltips"))}),e(t).sortable({items:"tbody tr:not(.inline-edit-row)",cursor:"move",handle:".column-handle",axis:"y",forcePlaceholderSize:!0,helper:"clone",opacity:.65,placeholder:"product-cat-placeholder",scrollSensitivity:40,start:function(e,t){t.item.hasClass("alternate")||t.item.css("background-color","#ffffff"),t.item.children("td, th").css("border-bottom-width","0"),t.item.css("outline","1px solid #aaa")},stop:function(e,t){t.item.removeAttr("style"),t.item.children("td, th").css("border-bottom-width","1px")},update:function(i,d){var o,a,r=d.item.find(n).val(),c=d.item.find(".parent").html(),l=d.item.prev().find(n).val(),s=d.item.next().find(n).val();l!==undefined&&(o=d.item.prev().find(".parent").html())!==c&&(l=undefined),s!==undefined&&(a=d.item.next().find(".parent").html())!==c&&(s=undefined),l===undefined&&s===undefined||s===undefined&&a===l||s!==undefined&&o===r?e(t).sortable("cancel"):(window.wcTracks.recordEvent("product_attributes_ordering_term",{is_category:"product_cat"===woocommerce_term_ordering_params.taxonomy?"yes":"no"}),d.item.find(".check-column input").hide(),d.item.find(".check-column").append('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />'),e.post(ajaxurl,{action:"woocommerce_term_ordering",id:r,nextid:s,thetaxonomy:woocommerce_term_ordering_params.taxonomy},function(e){"children"===e?window.location.reload():(d.item.find(".check-column input").show(),d.item.find(".check-column").find("img").remove())}),e("table.widefat tbody tr").each(function(){jQuery("table.widefat tbody tr").index(this)%2==0?jQuery(this).addClass("alternate"):jQuery(this).removeClass("alternate")}))}})});

View File

@@ -1 +1 @@
jQuery(function(u){var h={states:null,init:function(){"undefined"!=typeof wc_users_params.countries&&(this.states=JSON.parse(wc_users_params.countries.replace(/&quot;/g,'"'))),u(".js_field-country").selectWoo().on("change",this.change_country),u(".js_field-country").trigger("change",[!0]),u(document.body).on("change","select.js_field-state",this.change_state),u(document.body).on("click","button.js_copy-billing",this.copy_billing)},change_country:function(e,t){var a,n,o,i,c,s,l,r,p,d;void 0===t&&(t=!1),null!==h.states&&(n=(a=u(this)).val(),i=(o=a.parents(".form-table").find(":input.js_field-state")).parent(),c=o.attr("name"),s=o.attr("id"),l=a.data(l="woocommerce.stickState-"+n)?a.data(l):o.val(),r=o.attr("placeholder"),t&&a.data("woocommerce.stickState-"+n,l),i.show().find(".select2-container").remove(),u.isEmptyObject(h.states[n])?(d=u('<input type="text" />').prop("id",s).prop("name",c).prop("placeholder",r).addClass("js_field-state regular-text").val(l),o.replaceWith(d)):(p=h.states[n],t=u('<option value=""></option>').text(h.i18n_select_state_text),d=u('<select style="width: 25em;"></select>').prop("id",s).prop("name",c).prop("placeholder",r).addClass("js_field-state").append(t),u.each(p,function(e){e=u("<option></option>").prop("value",e).text(p[e]);d.append(e)}),d.val(l),o.replaceWith(d),d.show().selectWoo().hide().trigger("change")),u(document.body).trigger("contry-change.woocommerce",[n,u(this).closest("div")]),u(document.body).trigger("country-change.woocommerce",[n,u(this).closest("div")]))},change_state:function(){var e=u(this),t=e.val(),e=e.parents(".form-table").find(":input.js_field-country"),a=e.val();e.data("woocommerce.stickState-"+a,t)},copy_billing:function(e){e.preventDefault(),u("#fieldset-billing").find("input, select").each(function(e,t){var a=t.name.replace(/^billing_/,"shipping_"),a=u('[name="'+a+'"]');a.length&&a.val(t.value).trigger("change")})}};h.init()});
jQuery(function(e){var t={states:null,init:function(){"undefined"!=typeof wc_users_params.countries&&(this.states=JSON.parse(wc_users_params.countries.replace(/&quot;/g,'"'))),e(".js_field-country").selectWoo().on("change",this.change_country),e(".js_field-country").trigger("change",[!0]),e(document.body).on("change","select.js_field-state",this.change_state),e(document.body).on("click","button.js_copy-billing",this.copy_billing)},change_country:function(a,n){if(void 0===n&&(n=!1),null!==t.states){var o,i=e(this),c=i.val(),s=i.parents(".form-table").find(":input.js_field-state"),r=s.parent(),l=s.attr("name"),p=s.attr("id"),d="woocommerce.stickState-"+c,u=i.data(d)?i.data(d):s.val(),h=s.attr("placeholder");if(n&&i.data("woocommerce.stickState-"+c,u),r.show().find(".select2-container").remove(),e.isEmptyObject(t.states[c]))o=e('<input type="text" />').prop("id",p).prop("name",l).prop("placeholder",h).addClass("js_field-state regular-text").val(u),s.replaceWith(o);else{var g=t.states[c],f=e('<option value=""></option>').text(t.i18n_select_state_text);o=e('<select style="width: 25em;"></select>').prop("id",p).prop("name",l).prop("placeholder",h).addClass("js_field-state").append(f),e.each(g,function(t){var a=e("<option></option>").prop("value",t).text(g[t]);o.append(a)}),o.val(u),s.replaceWith(o),o.show().selectWoo().hide().trigger("change")}e(document.body).trigger("contry-change.woocommerce",[c,e(this).closest("div")]),e(document.body).trigger("country-change.woocommerce",[c,e(this).closest("div")])}},change_state:function(){var t=e(this),a=t.val(),n=t.parents(".form-table").find(":input.js_field-country"),o=n.val();n.data("woocommerce.stickState-"+o,a)},copy_billing:function(t){t.preventDefault(),e("#fieldset-billing").find("input, select").each(function(t,a){var n=a.name.replace(/^billing_/,"shipping_"),o=e('[name="'+n+'"]');o.length&&o.val(a.value).trigger("change")})}};t.init()});

View File

@@ -312,7 +312,7 @@ jQuery( function( $ ) {
var select2_args = $.extend( {
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
placeholder : $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ?? '3',
minimumInputLength: $( this ).data( 'minimum_input_length' ) !== null && $( this ).data( 'minimum_input_length' ) !== undefined ? $( this ).data( 'minimum_input_length' ) : '3',
escapeMarkup : function( m ) {
return m;
},
@@ -356,7 +356,7 @@ jQuery( function( $ ) {
var select2_args = $.extend( {
allowClear : $( this ).data( 'allow_clear' ) ? true : false,
placeholder : $( this ).data( 'placeholder' ),
minimumInputLength: $( this ).data( 'minimum_input_length' ) ?? '3',
minimumInputLength: $( this ).data( 'minimum_input_length' ) !== null && $( this ).data( 'minimum_input_length' ) !== undefined ? $( this ).data( 'minimum_input_length' ) : '3',
escapeMarkup : function( m ) {
return m;
},

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
jQuery(function(o){if("undefined"==typeof wc_orders_params)return!1;var e=function(){o(document).on("click",".post-type-shop_order .wp-list-table tbody td, .woocommerce_page_wc-orders .wp-list-table.orders tbody td",this.onRowClick).on("click",".order-preview:not(.disabled)",this.onPreview)};e.prototype.onRowClick=function(e){var t;return!!o(e.target).filter("a, a *, .no-link, .no-link *, button, button *").length||(!(!window.getSelection||!window.getSelection().toString().length)||void((t=o(this).closest("tr").find("a.order-view").attr("href"))&&t.length&&(e.preventDefault(),e.metaKey||e.ctrlKey?window.open(t,"_blank"):window.location=t)))},e.prototype.onPreview=function(){var t=o(this),e=t.data("orderId");return t.data("order-data")?o(this).WCBackboneModal({template:"wc-modal-view-order",variable:t.data("orderData")}):(t.addClass("disabled"),o.ajax({url:wc_orders_params.ajax_url,data:{order_id:e,action:"woocommerce_get_order_details",security:wc_orders_params.preview_nonce},type:"GET",success:function(e){o(".order-preview").removeClass("disabled"),e.success&&(t.data("orderData",e.data),o(this).WCBackboneModal({template:"wc-modal-view-order",variable:e.data}))}})),!1},new e});
jQuery(function(e){if("undefined"==typeof wc_orders_params)return!1;var t=function(){e(document).on("click",".post-type-shop_order .wp-list-table tbody td, .woocommerce_page_wc-orders .wp-list-table.orders tbody td",this.onRowClick).on("click",".order-preview:not(.disabled)",this.onPreview)};t.prototype.onRowClick=function(t){if(e(t.target).filter("a, a *, .no-link, .no-link *, button, button *").length)return!0;if(window.getSelection&&window.getSelection().toString().length)return!0;var r=e(this).closest("tr").find("a.order-view").attr("href");r&&r.length&&(t.preventDefault(),t.metaKey||t.ctrlKey?window.open(r,"_blank"):window.location=r)},t.prototype.onPreview=function(){var t=e(this),r=t.data("orderId");return t.data("order-data")?e(this).WCBackboneModal({template:"wc-modal-view-order",variable:t.data("orderData")}):(t.addClass("disabled"),e.ajax({url:wc_orders_params.ajax_url,data:{order_id:r,action:"woocommerce_get_order_details",security:wc_orders_params.preview_nonce},type:"GET",success:function(r){e(".order-preview").removeClass("disabled"),r.success&&(t.data("orderData",r.data),e(this).WCBackboneModal({template:"wc-modal-view-order",variable:r.data}))}})),!1},new t});

View File

@@ -1 +1 @@
!function(n,i){var o=function(o){this.$form=o,this.xhr=!1,this.$form.find(".woocommerce-exporter-progress").val(0),this.processStep=this.processStep.bind(this),o.on("submit",{productExportForm:this},this.onSubmit),o.find(".woocommerce-exporter-types").on("change",{productExportForm:this},this.exportTypeFields)};o.prototype.onSubmit=function(o){o.preventDefault();var e=new Date,e="wc-product-export-"+e.getDate()+"-"+(e.getMonth()+1)+"-"+e.getFullYear()+"-"+e.getTime()+".csv";o.data.productExportForm.$form.addClass("woocommerce-exporter__exporting"),o.data.productExportForm.$form.find(".woocommerce-exporter-progress").val(0),o.data.productExportForm.$form.find(".woocommerce-exporter-button").prop("disabled",!0),o.data.productExportForm.processStep(1,n(this).serialize(),"",e)},o.prototype.processStep=function(o,e,r,t){var c=this,p=n(".woocommerce-exporter-columns").val(),a=n("#woocommerce-exporter-meta:checked").length?1:0,s=n(".woocommerce-exporter-types").val(),m=n(".woocommerce-exporter-category").val();n.ajax({type:"POST",url:ajaxurl,data:{form:e,action:"woocommerce_do_ajax_product_export",step:o,columns:r,selected_columns:p,export_meta:a,export_types:s,export_category:m,filename:t,security:wc_product_export_params.export_nonce},dataType:"json",success:function(o){o.success&&("done"===o.data.step?(c.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),i.location=o.data.url,setTimeout(function(){c.$form.removeClass("woocommerce-exporter__exporting"),c.$form.find(".woocommerce-exporter-button").prop("disabled",!1)},2e3)):(c.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),c.processStep(parseInt(o.data.step,10),e,o.data.columns,t)))}}).fail(function(o){i.console.log(o)})},o.prototype.exportTypeFields=function(){var o=n(".woocommerce-exporter-category");-1!==n.inArray("variation",n(this).val())?(o.closest("tr").hide(),o.val("").trigger("change")):o.closest("tr").show()},n.fn.wc_product_export_form=function(){return new o(this),this},n(".woocommerce-exporter").wc_product_export_form()}(jQuery,window);
!function(o,e){var r=function(o){this.$form=o,this.xhr=!1,this.$form.find(".woocommerce-exporter-progress").val(0),this.processStep=this.processStep.bind(this),o.on("submit",{productExportForm:this},this.onSubmit),o.find(".woocommerce-exporter-types").on("change",{productExportForm:this},this.exportTypeFields)};r.prototype.onSubmit=function(e){e.preventDefault();var r=new Date,t="wc-product-export-"+r.getDate()+"-"+(r.getMonth()+1)+"-"+r.getFullYear()+"-"+r.getTime()+".csv";e.data.productExportForm.$form.addClass("woocommerce-exporter__exporting"),e.data.productExportForm.$form.find(".woocommerce-exporter-progress").val(0),e.data.productExportForm.$form.find(".woocommerce-exporter-button").prop("disabled",!0),e.data.productExportForm.processStep(1,o(this).serialize(),"",t)},r.prototype.processStep=function(r,t,c,p){var a=this,s=o(".woocommerce-exporter-columns").val(),m=o("#woocommerce-exporter-meta:checked").length?1:0,n=o(".woocommerce-exporter-types").val(),i=o(".woocommerce-exporter-category").val();o.ajax({type:"POST",url:ajaxurl,data:{form:t,action:"woocommerce_do_ajax_product_export",step:r,columns:c,selected_columns:s,export_meta:m,export_types:n,export_category:i,filename:p,security:wc_product_export_params.export_nonce},dataType:"json",success:function(o){o.success&&("done"===o.data.step?(a.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),e.location=o.data.url,setTimeout(function(){a.$form.removeClass("woocommerce-exporter__exporting"),a.$form.find(".woocommerce-exporter-button").prop("disabled",!1)},2e3)):(a.$form.find(".woocommerce-exporter-progress").val(o.data.percentage),a.processStep(parseInt(o.data.step,10),t,o.data.columns,p)))}}).fail(function(o){e.console.log(o)})},r.prototype.exportTypeFields=function(){var e=o(".woocommerce-exporter-category");-1!==o.inArray("variation",o(this).val())?(e.closest("tr").hide(),e.val("").trigger("change")):e.closest("tr").show()},o.fn.wc_product_export_form=function(){return new r(this),this},o(".woocommerce-exporter").wc_product_export_form()}(jQuery,window);

View File

@@ -17,6 +17,7 @@
// Number of import successes/failures.
this.imported = 0;
this.imported_variations = 0;
this.failed = 0;
this.updated = 0;
this.skipped = 0;
@@ -54,6 +55,7 @@
if ( response.success ) {
$this.position = response.data.position;
$this.imported += response.data.imported;
$this.imported_variations += response.data.imported_variations;
$this.failed += response.data.failed;
$this.updated += response.data.updated;
$this.skipped += response.data.skipped;
@@ -64,6 +66,8 @@
window.location = response.data.url +
'&products-imported=' +
parseInt( $this.imported, 10 ) +
'&products-imported-variations=' +
parseInt( $this.imported_variations, 10 ) +
'&products-failed=' +
parseInt( $this.failed, 10 ) +
'&products-updated=' +

View File

@@ -1 +1 @@
!function(t,p){var i=function(t){this.$form=t,this.xhr=!1,this.mapping=wc_product_import_params.mapping,this.position=0,this.file=wc_product_import_params.file,this.update_existing=wc_product_import_params.update_existing,this.delimiter=wc_product_import_params.delimiter,this.security=wc_product_import_params.import_nonce,this.character_encoding=wc_product_import_params.character_encoding,this.imported=0,this.failed=0,this.updated=0,this.skipped=0,this.$form.find(".woocommerce-importer-progress").val(0),this.run_import=this.run_import.bind(this),this.run_import()};i.prototype.run_import=function(){var r=this;t.ajax({type:"POST",url:ajaxurl,data:{action:"woocommerce_do_ajax_product_import",position:r.position,mapping:r.mapping,file:r.file,update_existing:r.update_existing,delimiter:r.delimiter,security:r.security,character_encoding:r.character_encoding},dataType:"json",success:function(t){var i;t.success&&(r.position=t.data.position,r.imported+=t.data.imported,r.failed+=t.data.failed,r.updated+=t.data.updated,r.skipped+=t.data.skipped,r.$form.find(".woocommerce-importer-progress").val(t.data.percentage),"done"===t.data.position?(i=wc_product_import_params.file.split("/").pop(),p.location=t.data.url+"&products-imported="+parseInt(r.imported,10)+"&products-failed="+parseInt(r.failed,10)+"&products-updated="+parseInt(r.updated,10)+"&products-skipped="+parseInt(r.skipped,10)+"&file-name="+i):r.run_import())}}).fail(function(t){p.console.log(t)})},t.fn.wc_product_importer=function(){return new i(this),this},t(".woocommerce-importer").wc_product_importer()}(jQuery,window);
!function(i,t){var r=function(i){this.$form=i,this.xhr=!1,this.mapping=wc_product_import_params.mapping,this.position=0,this.file=wc_product_import_params.file,this.update_existing=wc_product_import_params.update_existing,this.delimiter=wc_product_import_params.delimiter,this.security=wc_product_import_params.import_nonce,this.character_encoding=wc_product_import_params.character_encoding,this.imported=0,this.imported_variations=0,this.failed=0,this.updated=0,this.skipped=0,this.$form.find(".woocommerce-importer-progress").val(0),this.run_import=this.run_import.bind(this),this.run_import()};r.prototype.run_import=function(){var r=this;i.ajax({type:"POST",url:ajaxurl,data:{action:"woocommerce_do_ajax_product_import",position:r.position,mapping:r.mapping,file:r.file,update_existing:r.update_existing,delimiter:r.delimiter,security:r.security,character_encoding:r.character_encoding},dataType:"json",success:function(i){if(i.success)if(r.position=i.data.position,r.imported+=i.data.imported,r.imported_variations+=i.data.imported_variations,r.failed+=i.data.failed,r.updated+=i.data.updated,r.skipped+=i.data.skipped,r.$form.find(".woocommerce-importer-progress").val(i.data.percentage),"done"===i.data.position){var o=wc_product_import_params.file.split("/").pop();t.location=i.data.url+"&products-imported="+parseInt(r.imported,10)+"&products-imported-variations="+parseInt(r.imported_variations,10)+"&products-failed="+parseInt(r.failed,10)+"&products-updated="+parseInt(r.updated,10)+"&products-skipped="+parseInt(r.skipped,10)+"&file-name="+o}else r.run_import()}}).fail(function(i){t.console.log(i)})},i.fn.wc_product_importer=function(){return new r(this),this},i(".woocommerce-importer").wc_product_importer()}(jQuery,window);

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function(d,c,l,r){d(function(){var e=d(".wc-shipping-class-rows"),i=d(".wc-shipping-class-save"),s=l.template("wc-shipping-class-row"),n=l.template("wc-shipping-class-row-blank"),t=Backbone.Model.extend({changes:{},logChanges:function(e){var s=this.changes||{};_.each(e,function(e,i){s[i]=_.extend(s[i]||{term_id:i},e)}),this.changes=s,this.trigger("change:classes")},save:function(){_.size(this.changes)?d.post(r+(0<r.indexOf("?")?"&":"?")+"action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:c.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):a.trigger("saved:classes")},discardChanges:function(e){delete(this.changes||{})[e],0===_.size(this.changes)&&o.clearUnloadConfirmation()},onSaveResponse:function(e,i){"success"===i&&(e.success?(a.set("classes",e.data.shipping_classes),a.trigger("change:classes"),a.changes={},a.trigger("saved:classes")):e.data?window.alert(e.data):window.alert(c.strings.save_failed)),o.unblock()}}),s=Backbone.View.extend({rowTemplate:s,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),e.on("change",{view:this},this.updateModelOnChange),d(window).on("beforeunload",{view:this},this.unloadConfirmation),i.on("click",{view:this},this.onSubmit),d(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),d(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){d(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){d(this.el).unblock()},render:function(){var e=_.indexBy(this.model.get("classes"),"term_id"),s=this;this.$el.empty(),this.unblock(),_.size(e)?(e=_.sortBy(e,function(e){return e.name}),d.each(e,function(e,i){s.renderRow(i)})):s.$el.append(n)},renderRow:function(e){var i=this;i.$el.append(i.rowTemplate(e)),i.initRow(e)},initRow:function(i){var e=this.$el.find('tr[data-id="'+i.term_id+'"]');e.find("select").each(function(){var e=d(this).data("attribute");d(this).find('option[value="'+i[e]+'"]').prop("selected",!0)}),e.find(".view").show(),e.find(".edit").hide(),e.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),e.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),e.find(".editing .wc-shipping-class-edit").trigger("click"),e.find(".wc-shipping-class-cancel-edit").on("click",{view:this},this.onCancelEditRow),!0===i.editing&&(e.addClass("editing"),e.find(".wc-shipping-class-edit").trigger("click"))},onSubmit:function(e){e.data.view.block(),e.data.view.model.save(),e.preventDefault()},onAddNewRow:function(e){e.preventDefault();var e=e.data.view,i=e.model,s=_.indexBy(i.get("classes"),"term_id"),n={},s=_.size(s),s=_.extend({},c.default_shipping_class,{term_id:"new-"+s+"-"+Date.now(),editing:!0,newRow:!0});n[s.term_id]=s,i.logChanges(n),e.renderRow(s),d(".wc-shipping-classes-blank-state").remove()},onEditRow:function(e){e.preventDefault(),d(this).closest("tr").addClass("editing"),d(this).closest("tr").find(".view").hide(),d(this).closest("tr").find(".edit").show(),e.data.view.model.trigger("change:classes")},onDeleteRow:function(e){var i=e.data.view,s=i.model,n=_.indexBy(s.get("classes"),"term_id"),t={},a=d(this).closest("tr").data("id");e.preventDefault(),n[a]&&(delete n[a],t[a]=_.extend(t[a]||{},{deleted:"deleted"}),s.set("classes",n),s.logChanges(t)),i.render()},onCancelEditRow:function(e){var i=e.data.view,s=i.model,n=d(this).closest("tr"),t=d(this).closest("tr").data("id"),a=_.indexBy(s.get("classes"),"term_id");e.preventDefault(),s.discardChanges(t),a[t]&&(a[t].editing=!1,n.after(i.rowTemplate(a[t])),i.initRow(a[t])),n.remove()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,i.prop("disabled",!1)},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,i.attr("disabled","disabled")},unloadConfirmation:function(e){if(e.data.view.needsUnloadConfirm)return e.returnValue=c.strings.unload_confirmation_msg,window.event.returnValue=c.strings.unload_confirmation_msg,c.strings.unload_confirmation_msg},updateModelOnChange:function(e){var i=e.data.view.model,e=d(e.target),s=e.closest("tr").data("id"),n=e.data("attribute"),e=e.val(),t=_.indexBy(i.get("classes"),"term_id"),a={};t[s]&&t[s][n]===e||(a[s]={},a[s][n]=e),i.logChanges(a)}}),a=new t({classes:c.classes}),o=new s({model:a,el:e});o.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);
!function(e,i,s,n){e(function(){var t=e(".wc-shipping-class-rows"),a=e(".wc-shipping-class-save"),o=s.template("wc-shipping-class-row"),d=s.template("wc-shipping-class-row-blank"),c=Backbone.Model.extend({changes:{},logChanges:function(e){var i=this.changes||{};_.each(e,function(e,s){i[s]=_.extend(i[s]||{term_id:s},e)}),this.changes=i,this.trigger("change:classes")},save:function(){_.size(this.changes)?e.post(n+(n.indexOf("?")>0?"&":"?")+"action=woocommerce_shipping_classes_save_changes",{wc_shipping_classes_nonce:i.wc_shipping_classes_nonce,changes:this.changes},this.onSaveResponse,"json"):r.trigger("saved:classes")},discardChanges:function(e){delete(this.changes||{})[e],0===_.size(this.changes)&&h.clearUnloadConfirmation()},onSaveResponse:function(e,s){"success"===s&&(e.success?(r.set("classes",e.data.shipping_classes),r.trigger("change:classes"),r.changes={},r.trigger("saved:classes")):e.data?window.alert(e.data):window.alert(i.strings.save_failed)),h.unblock()}}),l=Backbone.View.extend({rowTemplate:o,initialize:function(){this.listenTo(this.model,"change:classes",this.setUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:classes",this.render),t.on("change",{view:this},this.updateModelOnChange),e(window).on("beforeunload",{view:this},this.unloadConfirmation),a.on("click",{view:this},this.onSubmit),e(document.body).on("click",".wc-shipping-class-add",{view:this},this.onAddNewRow),e(document.body).on("click",".wc-shipping-class-save-changes",{view:this},this.onSubmit)},block:function(){e(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){e(this.el).unblock()},render:function(){var i=_.indexBy(this.model.get("classes"),"term_id"),s=this;this.$el.empty(),this.unblock(),_.size(i)?(i=_.sortBy(i,function(e){return e.name}),e.each(i,function(e,i){s.renderRow(i)})):s.$el.append(d)},renderRow:function(e){this.$el.append(this.rowTemplate(e)),this.initRow(e)},initRow:function(i){var s=this.$el.find('tr[data-id="'+i.term_id+'"]');s.find("select").each(function(){var s=e(this).data("attribute");e(this).find('option[value="'+i[s]+'"]').prop("selected",!0)}),s.find(".view").show(),s.find(".edit").hide(),s.find(".wc-shipping-class-edit").on("click",{view:this},this.onEditRow),s.find(".wc-shipping-class-delete").on("click",{view:this},this.onDeleteRow),s.find(".editing .wc-shipping-class-edit").trigger("click"),s.find(".wc-shipping-class-cancel-edit").on("click",{view:this},this.onCancelEditRow),!0===i.editing&&(s.addClass("editing"),s.find(".wc-shipping-class-edit").trigger("click"))},onSubmit:function(e){e.data.view.block(),e.data.view.model.save(),e.preventDefault()},onAddNewRow:function(s){s.preventDefault();var n=s.data.view,t=n.model,a=_.indexBy(t.get("classes"),"term_id"),o={},d=_.size(a),c=_.extend({},i.default_shipping_class,{term_id:"new-"+d+"-"+Date.now(),editing:!0,newRow:!0});o[c.term_id]=c,t.logChanges(o),n.renderRow(c),e(".wc-shipping-classes-blank-state").remove()},onEditRow:function(i){i.preventDefault(),e(this).closest("tr").addClass("editing"),e(this).closest("tr").find(".view").hide(),e(this).closest("tr").find(".edit").show(),i.data.view.model.trigger("change:classes")},onDeleteRow:function(i){var s=i.data.view,n=s.model,t=_.indexBy(n.get("classes"),"term_id"),a={},o=e(this).closest("tr").data("id");i.preventDefault(),t[o]&&(delete t[o],a[o]=_.extend(a[o]||{},{deleted:"deleted"}),n.set("classes",t),n.logChanges(a)),s.render()},onCancelEditRow:function(i){var s=i.data.view,n=s.model,t=e(this).closest("tr"),a=e(this).closest("tr").data("id"),o=_.indexBy(n.get("classes"),"term_id");i.preventDefault(),n.discardChanges(a),o[a]&&(o[a].editing=!1,t.after(s.rowTemplate(o[a])),s.initRow(o[a])),t.remove()},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,a.prop("disabled",!1)},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,a.attr("disabled","disabled")},unloadConfirmation:function(e){if(e.data.view.needsUnloadConfirm)return e.returnValue=i.strings.unload_confirmation_msg,window.event.returnValue=i.strings.unload_confirmation_msg,i.strings.unload_confirmation_msg},updateModelOnChange:function(i){var s=i.data.view.model,n=e(i.target),t=n.closest("tr").data("id"),a=n.data("attribute"),o=n.val(),d=_.indexBy(s.get("classes"),"term_id"),c={};d[t]&&d[t][a]===o||(c[t]={},c[t][a]=o),s.logChanges(c)}}),r=new c({classes:i.classes}),h=new l({model:r,el:t});h.render()})}(jQuery,shippingClassesLocalizeScript,wp,ajaxurl);

View File

@@ -85,6 +85,7 @@
this.listenTo( this.model, 'change:methods', this.setUnloadConfirmation );
this.listenTo( this.model, 'saved:methods', this.clearUnloadConfirmation );
this.listenTo( this.model, 'saved:methods', this.render );
this.listenTo( this.model, 'rerender', this.render );
$tbody.on( 'change', { view: this }, this.updateModelOnChange );
$tbody.on( 'sortupdate', { view: this }, this.updateModelOnSort );
$( window ).on( 'beforeunload', { view: this }, this.unloadConfirmation );
@@ -197,16 +198,37 @@
model = view.model,
methods = _.indexBy( model.get( 'methods' ), 'instance_id' ),
changes = {},
instance_id = $( this ).closest('tr').data('id');
instance_id = $( this ).closest( 'tr' ).data( 'id' );
event.preventDefault();
delete methods[ instance_id ];
changes.methods = changes.methods || { methods : {} };
changes.methods[ instance_id ] = _.extend( changes.methods[ instance_id ] || {}, { deleted : 'deleted' } );
model.set( 'methods', methods );
model.logChanges( changes );
view.render();
if ( window.confirm( data.strings.delete_shipping_method_confirmation ) ) {
shippingMethodView.block();
// Add method to zone via ajax call
$.post( {
url: ajaxurl + ( ajaxurl.indexOf( '?' ) > 0 ? '&' : '?') + 'action=woocommerce_shipping_zone_remove_method',
data: {
wc_shipping_zones_nonce: data.wc_shipping_zones_nonce,
instance_id: instance_id,
zone_id: data.zone_id,
},
success: function( { data } ) {
delete methods[instance_id];
changes.methods = changes.methods || data.methods;
model.set('methods', methods);
model.logChanges( changes );
view.clearUnloadConfirmation();
view.render();
shippingMethodView.unblock();
},
error: function( jqXHR, textStatus, errorThrown ) {
window.alert( data.strings.remove_method_failed );
shippingMethodView.unblock();
},
dataType: 'json'
});
}
},
onToggleEnabled: function( event ) {
var view = event.data.view,
@@ -388,11 +410,12 @@
}
// Trigger save if there are changes, or just re-render
if ( _.size( shippingMethodView.model.changes ) ) {
shippingMethodView.model.save();
shippingMethodView.model.set( 'methods', response.data.methods );
shippingMethodView.model.trigger( 'change:methods' );
shippingMethodView.model.trigger( 'rerender' );
} else {
shippingMethodView.model.set( 'methods', response.data.methods );
shippingMethodView.model.trigger( 'change:methods' );
shippingMethodView.model.changes = {};
shippingMethodView.model.trigger( 'saved:methods' );
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
!function(r,l,c,h){r(function(){var e=r(".wc-shipping-zones"),n=r(".wc-shipping-zone-rows"),i=r(".wc-shipping-zone-save"),o=c.template("wc-shipping-zone-row"),t=c.template("wc-shipping-zone-row-blank"),s=Backbone.Model.extend({changes:{},logChanges:function(e){var i=this.changes||{};_.each(e,function(e,n){i[n]=_.extend(i[n]||{zone_id:n},e)}),this.changes=i,this.trigger("change:zones")},discardChanges:function(e){var n=this.changes||{},i=null,o=_.indexBy(this.get("zones"),"zone_id");n[e]&&n[e].zone_order!==undefined&&(i=n[e].zone_order),delete n[e],null!==i&&o[e]&&o[e].zone_order!==i&&(n[e]=_.extend(n[e]||{},{zone_id:e,zone_order:i})),this.changes=n,0===_.size(this.changes)&&a.clearUnloadConfirmation()},save:function(){_.size(this.changes)?r.post(h+(0<h.indexOf("?")?"&":"?")+"action=woocommerce_shipping_zones_save_changes",{wc_shipping_zones_nonce:l.wc_shipping_zones_nonce,changes:this.changes},this.onSaveResponse,"json"):d.trigger("saved:zones")},onSaveResponse:function(e,n){"success"===n&&(e.success?(d.set("zones",e.data.zones),d.trigger("change:zones"),d.changes={},d.trigger("saved:zones")):window.alert(l.strings.save_failed))}}),o=Backbone.View.extend({rowTemplate:o,initialize:function(){this.listenTo(this.model,"change:zones",this.setUnloadConfirmation),this.listenTo(this.model,"saved:zones",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:zones",this.render),n.on("change",{view:this},this.updateModelOnChange),n.on("sortupdate",{view:this},this.updateModelOnSort),r(window).on("beforeunload",{view:this},this.unloadConfirmation),r(document.body).on("click",".wc-shipping-zone-add",{view:this},this.onAddNewRow)},onAddNewRow:function(){var e=r(this);window.location.href=e.attr("href")},block:function(){r(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){r(this.el).unblock()},render:function(){var e=_.indexBy(this.model.get("zones"),"zone_id"),i=this;i.$el.empty(),i.unblock(),_.size(e)?(e=_(e).chain().sortBy(function(e){return parseInt(e.zone_id,10)}).sortBy(function(e){return parseInt(e.zone_order,10)}).value(),r.each(e,function(e,n){i.renderRow(n)})):i.$el.append(t),i.initRows()},renderRow:function(e){var n=this;n.$el.append(n.rowTemplate(e)),n.initRow(e)},initRow:function(e){var n=this.$el.find('tr[data-id="'+e.zone_id+'"]');this.renderShippingMethods(e.zone_id,e.shipping_methods),n.find(".wc-shipping-zone-delete").on("click",{view:this},this.onDeleteRow)},initRows:function(){0==r("tbody.wc-shipping-zone-rows tr").length%2?e.find("tbody.wc-shipping-zone-rows").next("tbody").find("tr").addClass("odd"):e.find("tbody.wc-shipping-zone-rows").next("tbody").find("tr").removeClass("odd"),r("#tiptip_holder").removeAttr("style"),r("#tiptip_arrow").removeAttr("style"),r(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:50})},renderShippingMethods:function(e,n){var i=r('.wc-shipping-zones tr[data-id="'+e+'"]').find(".wc-shipping-zone-methods ul");i.find(".wc-shipping-zone-method").remove(),_.size(n)?(n=_.sortBy(n,function(e){return parseInt(e.method_order,10)}),_.each(n,function(e){var n="method_disabled";"yes"===e.enabled&&(n="method_enabled"),i.append('<li class="wc-shipping-zone-method '+n+'">'+e.title+"</li>")})):i.append('<li class="wc-shipping-zone-method">'+l.strings.no_shipping_methods_offered+"</li>")},onDeleteRow:function(e){var n=e.data.view.model,i=_.indexBy(n.get("zones"),"zone_id"),o={},t=r(this).closest("tr").data("id");e.preventDefault(),window.confirm(l.strings.delete_confirmation_msg)&&i[t]&&(delete i[t],o[t]=_.extend(o[t]||{},{deleted:"deleted"}),n.set("zones",i),n.logChanges(o),e.data.view.block(),e.data.view.model.save())},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,i.prop("disabled",!1)},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,i.prop("disabled",!0)},unloadConfirmation:function(e){if(e.data.view.needsUnloadConfirm)return e.returnValue=l.strings.unload_confirmation_msg,window.event.returnValue=l.strings.unload_confirmation_msg,l.strings.unload_confirmation_msg},updateModelOnChange:function(e){var n=e.data.view.model,e=r(e.target),i=e.closest("tr").data("id"),o=e.data("attribute"),e=e.val(),t=_.indexBy(n.get("zones"),"zone_id"),s={};t[i]&&t[i][o]===e||(s[i]={},s[i][o]=e),n.logChanges(s)},updateModelOnSort:function(e){var n=e.data.view.model,o=_.indexBy(n.get("zones"),"zone_id"),i=r("tbody.wc-shipping-zone-rows tr"),t={};_.each(i,function(e){var n=r(e).data("id"),i=null,e=parseInt(r(e).index(),10);(i=o[n]?parseInt(o[n].zone_order,10):i)!==e&&(t[n]=_.extend(t[n]||{},{zone_order:e}))}),_.size(t)&&(n.logChanges(t),e.data.view.block(),e.data.view.model.save())}}),d=new s({zones:l.zones}),a=new o({model:d,el:n});a.render(),n.sortable({items:"tr",cursor:"move",axis:"y",handle:"td.wc-shipping-zone-sort",scrollSensitivity:40})})}(jQuery,shippingZonesLocalizeScript,wp,ajaxurl);
!function(e,n,i,o){e(function(){var t=e(".wc-shipping-zones"),s=e(".wc-shipping-zone-rows"),d=e(".wc-shipping-zone-save"),a=i.template("wc-shipping-zone-row"),r=i.template("wc-shipping-zone-row-blank"),l=Backbone.Model.extend({changes:{},logChanges:function(e){var n=this.changes||{};_.each(e,function(e,i){n[i]=_.extend(n[i]||{zone_id:i},e)}),this.changes=n,this.trigger("change:zones")},discardChanges:function(e){var n=this.changes||{},i=null,o=_.indexBy(this.get("zones"),"zone_id");n[e]&&n[e].zone_order!==undefined&&(i=n[e].zone_order),delete n[e],null!==i&&o[e]&&o[e].zone_order!==i&&(n[e]=_.extend(n[e]||{},{zone_id:e,zone_order:i})),this.changes=n,0===_.size(this.changes)&&p.clearUnloadConfirmation()},save:function(){_.size(this.changes)?e.post(o+(o.indexOf("?")>0?"&":"?")+"action=woocommerce_shipping_zones_save_changes",{wc_shipping_zones_nonce:n.wc_shipping_zones_nonce,changes:this.changes},this.onSaveResponse,"json"):h.trigger("saved:zones")},onSaveResponse:function(e,i){"success"===i&&(e.success?(h.set("zones",e.data.zones),h.trigger("change:zones"),h.changes={},h.trigger("saved:zones")):window.alert(n.strings.save_failed))}}),c=Backbone.View.extend({rowTemplate:a,initialize:function(){this.listenTo(this.model,"change:zones",this.setUnloadConfirmation),this.listenTo(this.model,"saved:zones",this.clearUnloadConfirmation),this.listenTo(this.model,"saved:zones",this.render),s.on("change",{view:this},this.updateModelOnChange),s.on("sortupdate",{view:this},this.updateModelOnSort),e(window).on("beforeunload",{view:this},this.unloadConfirmation),e(document.body).on("click",".wc-shipping-zone-add",{view:this},this.onAddNewRow)},onAddNewRow:function(){var n=e(this);window.location.href=n.attr("href")},block:function(){e(this.el).block({message:null,overlayCSS:{background:"#fff",opacity:.6}})},unblock:function(){e(this.el).unblock()},render:function(){var n=_.indexBy(this.model.get("zones"),"zone_id"),i=this;i.$el.empty(),i.unblock(),_.size(n)?(n=_(n).chain().sortBy(function(e){return parseInt(e.zone_id,10)}).sortBy(function(e){return parseInt(e.zone_order,10)}).value(),e.each(n,function(e,n){i.renderRow(n)})):i.$el.append(r),i.initRows()},renderRow:function(e){this.$el.append(this.rowTemplate(e)),this.initRow(e)},initRow:function(e){var n=this.$el.find('tr[data-id="'+e.zone_id+'"]');this.renderShippingMethods(e.zone_id,e.shipping_methods),n.find(".wc-shipping-zone-delete").on("click",{view:this},this.onDeleteRow)},initRows:function(){0==e("tbody.wc-shipping-zone-rows tr").length%2?t.find("tbody.wc-shipping-zone-rows").next("tbody").find("tr").addClass("odd"):t.find("tbody.wc-shipping-zone-rows").next("tbody").find("tr").removeClass("odd"),e("#tiptip_holder").removeAttr("style"),e("#tiptip_arrow").removeAttr("style"),e(".tips").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:50})},renderShippingMethods:function(i,o){var t=e('.wc-shipping-zones tr[data-id="'+i+'"]').find(".wc-shipping-zone-methods ul");t.find(".wc-shipping-zone-method").remove(),_.size(o)?(o=_.sortBy(o,function(e){return parseInt(e.method_order,10)}),_.each(o,function(e){var n="method_disabled";"yes"===e.enabled&&(n="method_enabled"),t.append('<li class="wc-shipping-zone-method '+n+'">'+e.title+"</li>")})):t.append('<li class="wc-shipping-zone-method">'+n.strings.no_shipping_methods_offered+"</li>")},onDeleteRow:function(i){var o=i.data.view.model,t=_.indexBy(o.get("zones"),"zone_id"),s={},d=e(this).closest("tr").data("id");i.preventDefault(),window.confirm(n.strings.delete_confirmation_msg)&&t[d]&&(delete t[d],s[d]=_.extend(s[d]||{},{deleted:"deleted"}),o.set("zones",t),o.logChanges(s),i.data.view.block(),i.data.view.model.save())},setUnloadConfirmation:function(){this.needsUnloadConfirm=!0,d.prop("disabled",!1)},clearUnloadConfirmation:function(){this.needsUnloadConfirm=!1,d.prop("disabled",!0)},unloadConfirmation:function(e){if(e.data.view.needsUnloadConfirm)return e.returnValue=n.strings.unload_confirmation_msg,window.event.returnValue=n.strings.unload_confirmation_msg,n.strings.unload_confirmation_msg},updateModelOnChange:function(n){var i=n.data.view.model,o=e(n.target),t=o.closest("tr").data("id"),s=o.data("attribute"),d=o.val(),a=_.indexBy(i.get("zones"),"zone_id"),r={};a[t]&&a[t][s]===d||(r[t]={},r[t][s]=d),i.logChanges(r)},updateModelOnSort:function(n){var i=n.data.view.model,o=_.indexBy(i.get("zones"),"zone_id"),t=e("tbody.wc-shipping-zone-rows tr"),s={};_.each(t,function(n){var i=e(n).data("id"),t=null,d=parseInt(e(n).index(),10);o[i]&&(t=parseInt(o[i].zone_order,10)),t!==d&&(s[i]=_.extend(s[i]||{},{zone_order:d}))}),_.size(s)&&(i.logChanges(s),n.data.view.block(),n.data.view.model.save())}}),h=new l({zones:n.zones}),p=new c({model:h,el:s});p.render(),s.sortable({items:"tr",cursor:"move",axis:"y",handle:"td.wc-shipping-zone-sort",scrollSensitivity:40})})}(jQuery,shippingZonesLocalizeScript,wp,ajaxurl);

View File

@@ -1,6 +1,6 @@
/*global jQuery */
(function( $ ) {
$( document ).on( 'ready', function() {
$( function() {
window.wcTracks.recordEvent( 'wcadmin_status_widget_view' );
});

View File

@@ -1 +1 @@
!function(o){o(document).on("ready",function(){window.wcTracks.recordEvent("wcadmin_status_widget_view")});var n=function(o){window.wcTracks.recordEvent("status_widget_click",{link:o})};o(".sales-this-month a").on("click",function(){n("net-sales")}),o(".best-seller-this-month a").on("click",function(){n("best-seller-this-month")}),o(".processing-orders a").on("click",function(){n("orders-processing")}),o(".on-hold-orders a").on("click",function(){n("orders-on-hold")}),o(".low-in-stock a").on("click",function(){n("low-stock")}),o(".out-of-stock a").on("click",function(){n("out-of-stock")})}(jQuery);
!function(o){o(function(){window.wcTracks.recordEvent("wcadmin_status_widget_view")});var n=function(o){window.wcTracks.recordEvent("status_widget_click",{link:o})};o(".sales-this-month a").on("click",function(){n("net-sales")}),o(".best-seller-this-month a").on("click",function(){n("best-seller-this-month")}),o(".processing-orders a").on("click",function(){n("orders-processing")}),o(".on-hold-orders a").on("click",function(){n("orders-on-hold")}),o(".low-in-stock a").on("click",function(){n("low-stock")}),o(".out-of-stock a").on("click",function(){n("out-of-stock")})}(jQuery);

View File

@@ -665,4 +665,91 @@
);
}
} );
$( function() {
/**
* Handles heartbeat integration of order locking when HPOS is enabled.
*/
var wc_order_lock = {
init: function() {
// Order screen.
this.$lock_dialog = $( '.woocommerce_page_wc-orders #post-lock-dialog.order-lock-dialog' );
if ( 0 !== this.$lock_dialog.length && 'undefined' !== typeof woocommerce_admin_meta_boxes ) {
$( document ).on( 'heartbeat-send', this.refresh_order_lock );
$( document ).on( 'heartbeat-tick', this.check_order_lock );
}
// Orders list table.
this.$list_table = $( '.woocommerce_page_wc-orders table.wc-orders-list-table' );
if ( 0 !== this.$list_table.length ) {
$( document ).on( 'heartbeat-send', this.send_orders_in_list );
$( document ).on( 'heartbeat-tick', this.check_orders_in_list );
}
},
refresh_order_lock: function( e, data ) {
data['wc-refresh-order-lock'] = woocommerce_admin_meta_boxes.post_id;
},
check_order_lock: function( e, data ) {
var lock_data = data['wc-refresh-order-lock'];
if ( ! lock_data || ! lock_data.error ) {
// No lock request in heartbeat or lock refreshed ok.
return;
}
if ( wc_order_lock.$lock_dialog.is( ':visible' ) ) {
return;
}
if ( lock_data.error.user_avatar_src ) {
wc_order_lock.$lock_dialog.find( '.post-locked-avatar' ).empty().append(
$(
'<img />',
{
'class': 'avatar avatar-64 photo',
width: 64,
height: 64,
alt: '',
src: lock_data.error.user_avatar_src,
srcset: lock_data.error.user_avatar_src_2x ? lock_data.error.user_avatar_src_2x + ' 2x' : undefined
}
)
);
}
wc_order_lock.$lock_dialog.find( '.currently-editing' ).text( lock_data.error.message );
wc_order_lock.$lock_dialog.show();
wc_order_lock.$lock_dialog.find( '.wp-tab-first' ).trigger( 'focus' );
},
send_orders_in_list: function( e, data ) {
data['wc-check-locked-orders'] = wc_order_lock.$list_table.find( 'tr input[name="order"]' ).map(
function() { return this.value; }
).get();
},
check_orders_in_list: function( e, data ) {
var locked_orders = data['wc-check-locked-orders'] || {};
wc_order_lock.$list_table.find( 'tr' ).each( function( i, tr ) {
var $tr = $( tr );
var order_id = $tr.find( 'input[name="order"]' ).val();
if ( locked_orders[ order_id ] ) {
if ( ! $tr.hasClass( 'wp-locked' ) ) {
$tr.find( '.check-column checkbox' ).prop( 'checked', false );
$tr.addClass( 'wp-locked' );
}
} else {
$tr.removeClass( 'wp-locked' ).find( '.locked-info span' ).empty();
}
} );
}
};
wc_order_lock.init();
} );
} )( jQuery, woocommerce_admin );

File diff suppressed because one or more lines are too long