Fix eslint for meta-boxes-product-variation.js
This commit is contained in:
parent
b77c7fbbd8
commit
b79c02658d
|
@ -118,7 +118,8 @@ jQuery( function( $ ) {
|
||||||
// Init TipTip
|
// Init TipTip
|
||||||
$( '#tiptip_holder' ).removeAttr( 'style' );
|
$( '#tiptip_holder' ).removeAttr( 'style' );
|
||||||
$( '#tiptip_arrow' ).removeAttr( 'style' );
|
$( '#tiptip_arrow' ).removeAttr( 'style' );
|
||||||
$( '.woocommerce_variations .tips, .woocommerce_variations .help_tip, .woocommerce_variations .woocommerce-help-tip', wrapper ).tipTip({
|
$( '.woocommerce_variations .tips, .woocommerce_variations .help_tip, .woocommerce_variations .woocommerce-help-tip', wrapper )
|
||||||
|
.tipTip({
|
||||||
'attribute': 'data-tip',
|
'attribute': 'data-tip',
|
||||||
'fadeIn': 50,
|
'fadeIn': 50,
|
||||||
'fadeOut': 50,
|
'fadeOut': 50,
|
||||||
|
@ -195,7 +196,10 @@ jQuery( function( $ ) {
|
||||||
offset = parseInt( ( current_page - 1 ) * woocommerce_admin_meta_boxes_variations.variations_per_page, 10 );
|
offset = parseInt( ( current_page - 1 ) * woocommerce_admin_meta_boxes_variations.variations_per_page, 10 );
|
||||||
|
|
||||||
$( '.woocommerce_variations .woocommerce_variation' ).each( function ( index, el ) {
|
$( '.woocommerce_variations .woocommerce_variation' ).each( function ( index, el ) {
|
||||||
$( '.variation_menu_order', el ).val( parseInt( $( el ).index( '.woocommerce_variations .woocommerce_variation' ), 10 ) + 1 + offset ).change();
|
$( '.variation_menu_order', el )
|
||||||
|
.val( parseInt( $( el )
|
||||||
|
.index( '.woocommerce_variations .woocommerce_variation' ), 10 ) + 1 + offset )
|
||||||
|
.change();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -259,14 +263,16 @@ jQuery( function( $ ) {
|
||||||
if ( $button.is( '.remove' ) ) {
|
if ( $button.is( '.remove' ) ) {
|
||||||
|
|
||||||
$( '.upload_image_id', wc_meta_boxes_product_variations_media.setting_variation_image ).val( '' ).change();
|
$( '.upload_image_id', wc_meta_boxes_product_variations_media.setting_variation_image ).val( '' ).change();
|
||||||
wc_meta_boxes_product_variations_media.setting_variation_image.find( 'img' ).eq( 0 ).attr( 'src', woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src );
|
wc_meta_boxes_product_variations_media.setting_variation_image.find( 'img' ).eq( 0 )
|
||||||
|
.attr( 'src', woocommerce_admin_meta_boxes_variations.woocommerce_placeholder_img_src );
|
||||||
wc_meta_boxes_product_variations_media.setting_variation_image.find( '.upload_image_button' ).removeClass( 'remove' );
|
wc_meta_boxes_product_variations_media.setting_variation_image.find( '.upload_image_button' ).removeClass( 'remove' );
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If the media frame already exists, reopen it.
|
// If the media frame already exists, reopen it.
|
||||||
if ( wc_meta_boxes_product_variations_media.variable_image_frame ) {
|
if ( wc_meta_boxes_product_variations_media.variable_image_frame ) {
|
||||||
wc_meta_boxes_product_variations_media.variable_image_frame.uploader.uploader.param( 'post_id', wc_meta_boxes_product_variations_media.setting_variation_image_id );
|
wc_meta_boxes_product_variations_media.variable_image_frame.uploader.uploader
|
||||||
|
.param( 'post_id', wc_meta_boxes_product_variations_media.setting_variation_image_id );
|
||||||
wc_meta_boxes_product_variations_media.variable_image_frame.open();
|
wc_meta_boxes_product_variations_media.variable_image_frame.open();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -291,7 +297,8 @@ jQuery( function( $ ) {
|
||||||
// When an image is selected, run a callback.
|
// When an image is selected, run a callback.
|
||||||
wc_meta_boxes_product_variations_media.variable_image_frame.on( 'select', function () {
|
wc_meta_boxes_product_variations_media.variable_image_frame.on( 'select', function () {
|
||||||
|
|
||||||
var attachment = wc_meta_boxes_product_variations_media.variable_image_frame.state().get( 'selection' ).first().toJSON(),
|
var attachment = wc_meta_boxes_product_variations_media.variable_image_frame.state()
|
||||||
|
.get( 'selection' ).first().toJSON(),
|
||||||
url = attachment.sizes && attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
|
url = attachment.sizes && attachment.sizes.thumbnail ? attachment.sizes.thumbnail.url : attachment.url;
|
||||||
|
|
||||||
$( '.upload_image_id', wc_meta_boxes_product_variations_media.setting_variation_image ).val( attachment.id ).change();
|
$( '.upload_image_id', wc_meta_boxes_product_variations_media.setting_variation_image ).val( attachment.id ).change();
|
||||||
|
@ -554,7 +561,8 @@ jQuery( function( $ ) {
|
||||||
cancel_variations: function() {
|
cancel_variations: function() {
|
||||||
var current = parseInt( $( '#variable_product_options' ).find( '.woocommerce_variations' ).attr( 'data-page' ), 10 );
|
var current = parseInt( $( '#variable_product_options' ).find( '.woocommerce_variations' ).attr( 'data-page' ), 10 );
|
||||||
|
|
||||||
$( '#variable_product_options' ).find( '.woocommerce_variations .variation-needs-update' ).removeClass( 'variation-needs-update' );
|
$( '#variable_product_options' ).find( '.woocommerce_variations .variation-needs-update' )
|
||||||
|
.removeClass( 'variation-needs-update' );
|
||||||
$( '.variations-defaults select' ).each( function() {
|
$( '.variations-defaults select' ).each( function() {
|
||||||
$( this ).val( $( this ).attr( 'data-current' ) );
|
$( this ).val( $( this ).attr( 'data-current' ) );
|
||||||
});
|
});
|
||||||
|
@ -618,7 +626,9 @@ jQuery( function( $ ) {
|
||||||
$.post( woocommerce_admin_meta_boxes_variations.ajax_url, data, function() {
|
$.post( woocommerce_admin_meta_boxes_variations.ajax_url, data, function() {
|
||||||
var wrapper = $( '#variable_product_options' ).find( '.woocommerce_variations' ),
|
var wrapper = $( '#variable_product_options' ).find( '.woocommerce_variations' ),
|
||||||
current_page = parseInt( wrapper.attr( 'data-page' ), 10 ),
|
current_page = parseInt( wrapper.attr( 'data-page' ), 10 ),
|
||||||
total_pages = Math.ceil( ( parseInt( wrapper.attr( 'data-total' ), 10 ) - 1 ) / woocommerce_admin_meta_boxes_variations.variations_per_page ),
|
total_pages = Math.ceil( (
|
||||||
|
parseInt( wrapper.attr( 'data-total' ), 10 ) - 1
|
||||||
|
) / woocommerce_admin_meta_boxes_variations.variations_per_page ),
|
||||||
page = 1;
|
page = 1;
|
||||||
|
|
||||||
$( '#woocommerce-product-data' ).trigger( 'woocommerce_variations_removed' );
|
$( '#woocommerce-product-data' ).trigger( 'woocommerce_variations_removed' );
|
||||||
|
@ -727,7 +737,8 @@ jQuery( function( $ ) {
|
||||||
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations ) ) {
|
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_delete_all_variations ) ) {
|
||||||
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_last_warning ) ) {
|
if ( window.confirm( woocommerce_admin_meta_boxes_variations.i18n_last_warning ) ) {
|
||||||
data.allowed = true;
|
data.allowed = true;
|
||||||
changes = parseInt( $( '#variable_product_options' ).find( '.woocommerce_variations' ).attr( 'data-total' ), 10 ) * -1;
|
changes = parseInt( $( '#variable_product_options' ).find( '.woocommerce_variations' )
|
||||||
|
.attr( 'data-total' ), 10 ) * -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue