Merge pull request #28753 from helgatheviking/issues/28286-jquery-3
Issues/28286 Updates for deprecated jQuery 3 functions
This commit is contained in:
commit
ce31630498
|
@ -58,7 +58,7 @@
|
|||
} else {
|
||||
$( '#copy-error' ).text( '' );
|
||||
wcClearClipboard();
|
||||
wcSetClipboard( $.trim( $( this ).prev( 'input' ).val() ), $( css_class ) );
|
||||
wcSetClipboard( $( this ).prev( 'input' ).val().trim(), $( css_class ) );
|
||||
}
|
||||
} )
|
||||
.on( 'aftercopy', css_class, function() {
|
||||
|
|
|
@ -12,7 +12,7 @@ jQuery(function( $ ) {
|
|||
init: function() {
|
||||
$( 'select#discount_type' )
|
||||
.on( 'change', this.type_options )
|
||||
.change();
|
||||
.trigger( 'change' );
|
||||
|
||||
this.insert_generate_coupon_code_button();
|
||||
$( '.button.generate-coupon-code' ).on( 'click', this.generate_coupon_code );
|
||||
|
|
|
@ -90,7 +90,7 @@ jQuery( function ( $ ) {
|
|||
|
||||
$state.replaceWith( $newstate );
|
||||
|
||||
$newstate.show().selectWoo().hide().change();
|
||||
$newstate.show().selectWoo().hide().trigger( 'change' );
|
||||
} else {
|
||||
$newstate = $( '<input type="text" />' )
|
||||
.prop( 'id', input_id )
|
||||
|
@ -143,8 +143,8 @@ jQuery( function ( $ ) {
|
|||
$this.parent().find( 'a' ).toggle();
|
||||
|
||||
if ( ! $country_input.val() ) {
|
||||
$country_input.val( woocommerce_admin_meta_boxes_order.default_country ).change();
|
||||
$state_input.val( woocommerce_admin_meta_boxes_order.default_state ).change();
|
||||
$country_input.val( woocommerce_admin_meta_boxes_order.default_country ).trigger( 'change' );
|
||||
$state_input.val( woocommerce_admin_meta_boxes_order.default_state ).trigger( 'change' );
|
||||
}
|
||||
|
||||
$edit_address.show();
|
||||
|
@ -158,7 +158,7 @@ jQuery( function ( $ ) {
|
|||
|
||||
change_customer_user: function() {
|
||||
if ( ! $( '#_billing_country' ).val() ) {
|
||||
$( 'a.edit_address' ).click();
|
||||
$( 'a.edit_address' ).trigger( 'click' );
|
||||
wc_meta_boxes_order.load_billing( true );
|
||||
wc_meta_boxes_order.load_shipping( true );
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ jQuery( function ( $ ) {
|
|||
success: function( response ) {
|
||||
if ( response && response.billing ) {
|
||||
$.each( response.billing, function( key, data ) {
|
||||
$( ':input#_billing_' + key ).val( data ).change();
|
||||
$( ':input#_billing_' + key ).val( data ).trigger( 'change' );
|
||||
});
|
||||
}
|
||||
$( 'div.edit_address' ).unblock();
|
||||
|
@ -238,7 +238,7 @@ jQuery( function ( $ ) {
|
|||
success: function( response ) {
|
||||
if ( response && response.billing ) {
|
||||
$.each( response.shipping, function( key, data ) {
|
||||
$( ':input#_shipping_' + key ).val( data ).change();
|
||||
$( ':input#_shipping_' + key ).val( data ).trigger( 'change' );
|
||||
});
|
||||
}
|
||||
$( 'div.edit_address' ).unblock();
|
||||
|
@ -253,7 +253,7 @@ jQuery( function ( $ ) {
|
|||
$('.order_data_column :input[name^="_billing_"]').each( function() {
|
||||
var input_name = $(this).attr('name');
|
||||
input_name = input_name.replace( '_billing_', '_shipping_' );
|
||||
$( ':input#' + input_name ).val( $(this).val() ).change();
|
||||
$( ':input#' + input_name ).val( $(this).val() ).trigger( 'change' );
|
||||
});
|
||||
}
|
||||
return false;
|
||||
|
@ -643,7 +643,7 @@ jQuery( function ( $ ) {
|
|||
$( this ).closest( 'tr' ).find( '.view' ).hide();
|
||||
$( this ).closest( 'tr' ).find( '.edit' ).show();
|
||||
$( this ).hide();
|
||||
$( 'button.add-line-item' ).click();
|
||||
$( 'button.add-line-item' ).trigger( 'click' );
|
||||
$( 'button.cancel-action' ).attr( 'data-reload', true );
|
||||
window.wcTracks.recordEvent( 'order_edit_edit_item_click', {
|
||||
order_id: woocommerce_admin_meta_boxes.post_id,
|
||||
|
@ -1002,7 +1002,7 @@ jQuery( function ( $ ) {
|
|||
'',
|
||||
woocommerce_admin.mon_decimal_point
|
||||
) )
|
||||
.change();
|
||||
.trigger( 'change' );
|
||||
},
|
||||
|
||||
amount_changed: function() {
|
||||
|
@ -1032,7 +1032,7 @@ jQuery( function ( $ ) {
|
|||
parseFloat( accounting.formatNumber( unit_total * refund_qty, woocommerce_admin_meta_boxes.rounding_precision, '' ) )
|
||||
.toString()
|
||||
.replace( '.', woocommerce_admin.mon_decimal_point )
|
||||
).change();
|
||||
).trigger( 'change' );
|
||||
|
||||
// Taxes
|
||||
$( '.refund_line_tax', $row ).each( function() {
|
||||
|
@ -1054,9 +1054,9 @@ jQuery( function ( $ ) {
|
|||
parseFloat( accounting.formatNumber( unit_total_tax * refund_qty, precision, '' ) )
|
||||
.toString()
|
||||
.replace( '.', woocommerce_admin.mon_decimal_point )
|
||||
).change();
|
||||
).trigger( 'change' );
|
||||
} else {
|
||||
$refund_line_total_tax.val( 0 ).change();
|
||||
$refund_line_total_tax.val( 0 ).trigger( 'change' );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ jQuery( function ( $ ) {
|
|||
}
|
||||
|
||||
$( document.body ).trigger( 'wc-init-datepickers' );
|
||||
$( '#grant_access_id' ).val( '' ).change();
|
||||
$( '#grant_access_id' ).val( '' ).trigger( 'change' );
|
||||
$( '.order_download_permissions' ).unblock();
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ jQuery( function( $ ) {
|
|||
.on( 'click', 'h3 .sort', this.set_menu_order )
|
||||
.on( 'reload', this.reload );
|
||||
|
||||
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock' ).change();
|
||||
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock' ).trigger( 'change' );
|
||||
$( '#woocommerce-product-data' ).on( 'woocommerce_variations_loaded', this.variations_loaded );
|
||||
$( document.body ).on( 'woocommerce_variations_added', this.variation_added );
|
||||
},
|
||||
|
@ -95,7 +95,7 @@ jQuery( function( $ ) {
|
|||
|
||||
if ( ! needsUpdate ) {
|
||||
// Show/hide downloadable, virtual and stock fields
|
||||
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', wrapper ).change();
|
||||
$( 'input.variable_is_downloadable, input.variable_is_virtual, input.variable_manage_stock', wrapper ).trigger( 'change' );
|
||||
|
||||
// Open sale schedule fields when have some sale price date
|
||||
$( '.woocommerce_variation', wrapper ).each( function( index, el ) {
|
||||
|
@ -104,7 +104,7 @@ jQuery( function( $ ) {
|
|||
date_to = $( '.sale_price_dates_to', $el ).val();
|
||||
|
||||
if ( '' !== date_from || '' !== date_to ) {
|
||||
$( 'a.sale_schedule', $el ).click();
|
||||
$( 'a.sale_schedule', $el ).trigger( 'click' );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -138,7 +138,7 @@ jQuery( function( $ ) {
|
|||
date = $( this ).datepicker( 'getDate' );
|
||||
|
||||
dates.not( this ).datepicker( 'option', option, date );
|
||||
$( this ).change();
|
||||
$( this ).trigger( 'change' );
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -182,7 +182,7 @@ jQuery( function( $ ) {
|
|||
|
||||
if ( value != null ) {
|
||||
// Set value, save changes and reload view
|
||||
$menu_order.val( parseInt( value, 10 ) ).change();
|
||||
$menu_order.val( parseInt( value, 10 ) ).trigger( 'change' );
|
||||
wc_meta_boxes_product_variations_ajax.save_variations();
|
||||
}
|
||||
},
|
||||
|
@ -199,7 +199,7 @@ jQuery( function( $ ) {
|
|||
$( '.variation_menu_order', el )
|
||||
.val( parseInt( $( el )
|
||||
.index( '.woocommerce_variations .woocommerce_variation' ), 10 ) + 1 + offset )
|
||||
.change();
|
||||
.trigger( 'change' );
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -262,7 +262,7 @@ jQuery( function( $ ) {
|
|||
|
||||
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( '' ).trigger( '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( '.upload_image_button' ).removeClass( 'remove' );
|
||||
|
@ -301,7 +301,7 @@ jQuery( function( $ ) {
|
|||
.get( 'selection' ).first().toJSON(),
|
||||
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 ).trigger( 'change' );
|
||||
wc_meta_boxes_product_variations_media.setting_variation_image.find( '.upload_image_button' ).addClass( 'remove' );
|
||||
wc_meta_boxes_product_variations_media.setting_variation_image.find( 'img' ).eq( 0 ).attr( 'src', url );
|
||||
|
||||
|
@ -346,7 +346,7 @@ jQuery( function( $ ) {
|
|||
|
||||
postForm.on( 'submit', this.save_on_submit );
|
||||
|
||||
$( 'input:submit', postForm ).bind( 'click keypress', function() {
|
||||
$( 'input:submit', postForm ).on( 'click keypress', function() {
|
||||
postForm.data( 'callerid', this.id );
|
||||
});
|
||||
|
||||
|
@ -547,9 +547,9 @@ jQuery( function( $ ) {
|
|||
callerid = postForm.data( 'callerid' );
|
||||
|
||||
if ( 'publish' === callerid ) {
|
||||
postForm.append('<input type="hidden" name="publish" value="1" />').submit();
|
||||
postForm.append('<input type="hidden" name="publish" value="1" />').trigger( 'submit' );
|
||||
} else {
|
||||
postForm.append('<input type="hidden" name="save-post" value="1" />').submit();
|
||||
postForm.append('<input type="hidden" name="save-post" value="1" />').trigger( 'submit' );
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -977,7 +977,7 @@ jQuery( function( $ ) {
|
|||
* Set page
|
||||
*/
|
||||
set_page: function( page ) {
|
||||
$( '.variations-pagenav .page-selector' ).val( page ).first().change();
|
||||
$( '.variations-pagenav .page-selector' ).val( page ).first().trigger( 'change' );
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ jQuery( function( $ ) {
|
|||
});
|
||||
|
||||
// Prevent enter submitting post form.
|
||||
$( '#upsell_product_data' ).bind( 'keypress', function( e ) {
|
||||
$( '#upsell_product_data' ).on( 'keypress', function( e ) {
|
||||
if ( e.keyCode === 13 ) {
|
||||
return false;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ jQuery( function( $ ) {
|
|||
var select_val = $( this ).val();
|
||||
|
||||
if ( 'variable' === select_val ) {
|
||||
$( 'input#_manage_stock' ).change();
|
||||
$( 'input#_manage_stock' ).trigger( 'change' );
|
||||
$( 'input#_downloadable' ).prop( 'checked', false );
|
||||
$( 'input#_virtual' ).removeAttr( 'checked' );
|
||||
} else if ( 'grouped' === select_val ) {
|
||||
|
@ -113,11 +113,11 @@ jQuery( function( $ ) {
|
|||
|
||||
show_and_hide_panels();
|
||||
|
||||
$( 'ul.wc-tabs li:visible' ).eq( 0 ).find( 'a' ).click();
|
||||
$( 'ul.wc-tabs li:visible' ).eq( 0 ).find( 'a' ).trigger( 'click' );
|
||||
|
||||
$( document.body ).trigger( 'woocommerce-product-type-change', select_val, $( this ) );
|
||||
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
$( 'input#_downloadable, input#_virtual' ).change( function() {
|
||||
show_and_hide_panels();
|
||||
|
@ -165,7 +165,7 @@ jQuery( function( $ ) {
|
|||
|
||||
$( '.hide_if_' + product_type ).hide();
|
||||
|
||||
$( 'input#_manage_stock' ).change();
|
||||
$( 'input#_manage_stock' ).trigger( 'change' );
|
||||
|
||||
// Hide empty panels/tabs after display.
|
||||
$( '.woocommerce_options_panel' ).each( function() {
|
||||
|
@ -250,8 +250,8 @@ jQuery( function( $ ) {
|
|||
$( 'p.stock_status_field:not( .hide_if_' + product_type + ' )' ).show();
|
||||
}
|
||||
|
||||
$( 'input.variable_manage_stock' ).change();
|
||||
}).change();
|
||||
$( 'input.variable_manage_stock' ).trigger( 'change' );
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Date picker fields.
|
||||
function date_picker_select( datepicker ) {
|
||||
|
@ -260,7 +260,7 @@ jQuery( function( $ ) {
|
|||
date = $( datepicker ).datepicker( 'getDate' );
|
||||
|
||||
$( otherDateField ).datepicker( 'option', option, date );
|
||||
$( datepicker ).change();
|
||||
$( datepicker ).trigger( 'change' );
|
||||
}
|
||||
|
||||
$( '.sale_price_dates_fields' ).each( function() {
|
||||
|
@ -335,7 +335,7 @@ jQuery( function( $ ) {
|
|||
|
||||
attribute_row_indexes();
|
||||
|
||||
$attributes.find( '.woocommerce_attribute' ).last().find( 'h3' ).click();
|
||||
$attributes.find( '.woocommerce_attribute' ).last().find( 'h3' ).trigger( 'click' );
|
||||
|
||||
$wrapper.unblock();
|
||||
|
||||
|
@ -356,13 +356,13 @@ jQuery( function( $ ) {
|
|||
|
||||
$( '.product_attributes' ).on( 'click', 'button.select_all_attributes', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).prop( 'selected', 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).change();
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
$( '.product_attributes' ).on( 'click', 'button.select_no_attributes', function() {
|
||||
$( this ).closest( 'td' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
$( this ).closest( 'td' ).find( 'select' ).change();
|
||||
$( this ).closest( 'td' ).find( 'select' ).trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -436,7 +436,7 @@ jQuery( function( $ ) {
|
|||
// Success.
|
||||
$wrapper.find( 'select.attribute_values' )
|
||||
.append( '<option value="' + response.term_id + '" selected="selected">' + response.name + '</option>' );
|
||||
$wrapper.find( 'select.attribute_values' ).change();
|
||||
$wrapper.find( 'select.attribute_values' ).trigger( 'change' );
|
||||
}
|
||||
|
||||
$( '.product_attributes' ).unblock();
|
||||
|
@ -556,7 +556,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
});
|
||||
|
||||
file_path_field.val( file_path ).change();
|
||||
file_path_field.val( file_path ).trigger( 'change' );
|
||||
});
|
||||
|
||||
// Set post to 0 and set our custom type.
|
||||
|
|
|
@ -32,7 +32,7 @@ jQuery( function ( $ ) {
|
|||
$( $( this ).attr( 'href' ) ).show();
|
||||
});
|
||||
$( 'div.panel-wrap' ).each( function() {
|
||||
$( this ).find( 'ul.wc-tabs li' ).eq( 0 ).find( 'a' ).click();
|
||||
$( this ).find( 'ul.wc-tabs li' ).eq( 0 ).find( 'a' ).trigger( 'click' );
|
||||
});
|
||||
}).trigger( 'wc-init-tabbed-panels' );
|
||||
|
||||
|
|
|
@ -44,8 +44,8 @@ jQuery(
|
|||
$( 'input[name="_width"]', '.inline-edit-row' ).val( width );
|
||||
$( 'input[name="_height"]', '.inline-edit-row' ).val( height );
|
||||
|
||||
$( 'select[name="_shipping_class"] option:selected', '.inline-edit-row' ).attr( 'selected', false ).change();
|
||||
$( 'select[name="_shipping_class"] option[value="' + shipping_class + '"]' ).attr( 'selected', 'selected' ).change();
|
||||
$( 'select[name="_shipping_class"] option:selected', '.inline-edit-row' ).attr( 'selected', false ).trigger( 'change' );
|
||||
$( 'select[name="_shipping_class"] option[value="' + shipping_class + '"]' ).attr( 'selected', 'selected' ).trigger( 'change' );
|
||||
|
||||
$( 'input[name="_stock"]', '.inline-edit-row' ).val( stock );
|
||||
$( 'input[name="menu_order"]', '.inline-edit-row' ).val( menu_order );
|
||||
|
|
|
@ -10,7 +10,7 @@ jQuery(function( $ ) {
|
|||
var prev_data_index = null;
|
||||
var prev_series_index = null;
|
||||
|
||||
$( '.chart-placeholder' ).bind( 'plothover', function ( event, pos, item ) {
|
||||
$( '.chart-placeholder' ).on( 'plothover', function ( event, pos, item ) {
|
||||
if ( item ) {
|
||||
if ( prev_data_index !== item.dataIndex || prev_series_index !== item.seriesIndex ) {
|
||||
prev_data_index = item.dataIndex;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
$( this ).closest('tr').next().next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Ship Countries
|
||||
$( 'select#woocommerce_ship_to_countries' ).change( function() {
|
||||
|
@ -22,7 +22,7 @@
|
|||
} else {
|
||||
$( this ).closest('tr').next( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Stock management
|
||||
$( 'input#woocommerce_manage_stock' ).change( function() {
|
||||
|
@ -31,7 +31,7 @@
|
|||
} else {
|
||||
$( this ).closest('tbody').find( '.manage_stock_field' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Color picker
|
||||
$( '.colorpick' )
|
||||
|
@ -56,9 +56,9 @@
|
|||
var original_value = $( this ).data( 'original-value' );
|
||||
|
||||
if ( original_value.match( /^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ ) ) {
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).change();
|
||||
$( this ).val( $( this ).data( 'original-value' ) ).trigger( 'change' );
|
||||
} else {
|
||||
$( this ).val( '' ).change();
|
||||
$( this ).val( '' ).trigger( 'change' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -34,11 +34,11 @@ jQuery( function ( $ ) {
|
|||
$( '.wc_status_table thead, .wc_status_table tbody' ).each( function() {
|
||||
if ( $( this ).is( 'thead' ) ) {
|
||||
var label = $( this ).find( 'th:eq(0)' ).data( 'export-label' ) || $( this ).text();
|
||||
report = report + '\n### ' + $.trim( label ) + ' ###\n\n';
|
||||
report = report + '\n### ' + label.trim() + ' ###\n\n';
|
||||
} else {
|
||||
$( 'tr', $( this ) ).each( function() {
|
||||
var label = $( this ).find( 'td:eq(0)' ).data( 'export-label' ) || $( this ).find( 'td:eq(0)' ).text();
|
||||
var the_name = $.trim( label ).replace( /(<([^>]+)>)/ig, '' ); // Remove HTML.
|
||||
var the_name = label.trim().replace( /(<([^>]+)>)/ig, '' ); // Remove HTML.
|
||||
|
||||
// Find value
|
||||
var $value_html = $( this ).find( 'td:eq(2)' ).clone();
|
||||
|
@ -47,7 +47,7 @@ jQuery( function ( $ ) {
|
|||
$value_html.find( '.dashicons-no-alt, .dashicons-warning' ).replaceWith( '❌' );
|
||||
|
||||
// Format value
|
||||
var the_value = $.trim( $value_html.text() );
|
||||
var the_value = $value_html.text().trim();
|
||||
var value_array = the_value.split( ', ' );
|
||||
|
||||
if ( value_array.length > 1 ) {
|
||||
|
|
|
@ -71,7 +71,7 @@ jQuery( function ( $ ) {
|
|||
|
||||
$state.replaceWith( $newstate );
|
||||
|
||||
$newstate.show().selectWoo().hide().change();
|
||||
$newstate.show().selectWoo().hide().trigger( 'change' );
|
||||
} else {
|
||||
$newstate = $( '<input type="text" />' )
|
||||
.prop( 'id', input_id )
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
|
||||
if ( -1 !== $.inArray( 'variation', $( this ).val() ) ) {
|
||||
exportCategory.closest( 'tr' ).hide();
|
||||
exportCategory.val( '' ).change(); // Reset WooSelect selected value.
|
||||
exportCategory.val( '' ).trigger( 'change' ); // Reset WooSelect selected value.
|
||||
} else {
|
||||
exportCategory.closest( 'tr' ).show();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ jQuery( function( $ ) {
|
|||
} );
|
||||
|
||||
$( document.body ).on( 'wc_backbone_modal_response', function() {
|
||||
form.unbind( 'submit' ).submit();
|
||||
form.unbind( 'submit' ).trigger( 'submit' );
|
||||
} );
|
||||
|
||||
$( '#wc_tracker_checkbox_dialog' ).on( 'change', function( e ) {
|
||||
|
@ -46,7 +46,7 @@ jQuery( function( $ ) {
|
|||
} );
|
||||
|
||||
$( '#wc_tracker_submit' ).on( 'click', function () {
|
||||
form.unbind( 'submit' ).submit();
|
||||
form.unbind( 'submit' ).trigger( 'submit' );
|
||||
} );
|
||||
|
||||
return true;
|
||||
|
@ -72,13 +72,13 @@ jQuery( function( $ ) {
|
|||
} );
|
||||
|
||||
$( '.store-state-container' ).show();
|
||||
$state_select.selectWoo().val( wc_base_state ).change().prop( 'required', true );
|
||||
$state_select.selectWoo().val( wc_base_state ).trigger( 'change' ).prop( 'required', true );
|
||||
} else {
|
||||
$( '.store-state-container' ).hide();
|
||||
$state_select.empty().val( '' ).change().prop( 'required', false );
|
||||
$state_select.empty().val( '' ).trigger( 'change' ).prop( 'required', false );
|
||||
}
|
||||
|
||||
$( '#currency_code' ).val( wc_setup_currencies[ country ] ).change();
|
||||
$( '#currency_code' ).val( wc_setup_currencies[ country ] ).trigger( 'change' );
|
||||
} );
|
||||
|
||||
/* Setup postcode field and validations */
|
||||
|
@ -100,7 +100,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
} );
|
||||
|
||||
$( '#store_country' ).change();
|
||||
$( '#store_country' ).trigger( 'change' );
|
||||
|
||||
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-service-enable input', function() {
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
|
@ -121,7 +121,7 @@ jQuery( function( $ ) {
|
|||
$focused = $( document.activeElement );
|
||||
|
||||
if ( $focused.is( '.wc-wizard-service-toggle, .wc-wizard-service-enable' ) && ( 13 === code || 32 === code ) ) {
|
||||
$focused.find( ':input' ).click();
|
||||
$focused.find( ':input' ).trigger( 'click' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -135,7 +135,7 @@ jQuery( function( $ ) {
|
|||
|
||||
var $checkbox = $( this ).find( 'input[type="checkbox"]' );
|
||||
|
||||
$checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).change();
|
||||
$checkbox.prop( 'checked', ! $checkbox.prop( 'checked' ) ).trigger( 'change' );
|
||||
} );
|
||||
|
||||
$( '.wc-wizard-services-list-toggle' ).on( 'click', function() {
|
||||
|
@ -165,7 +165,7 @@ jQuery( function( $ ) {
|
|||
.removeClass( 'hide' )
|
||||
.find( '.shipping-method-required-field' )
|
||||
.prop( 'required', $checkbox.prop( 'checked' ) );
|
||||
} ).find( '.wc-wizard-shipping-method-select .method' ).change();
|
||||
} ).find( '.wc-wizard-shipping-method-select .method' ).trigger( 'change' );
|
||||
|
||||
$( '.wc-wizard-services' ).on( 'change', '.wc-wizard-shipping-method-enable', function() {
|
||||
var checked = $( this ).is( ':checked' );
|
||||
|
@ -182,7 +182,7 @@ jQuery( function( $ ) {
|
|||
} );
|
||||
|
||||
function submitActivateForm() {
|
||||
$( 'form.activate-jetpack' ).submit();
|
||||
$( 'form.activate-jetpack' ).trigger( 'submit' );
|
||||
}
|
||||
|
||||
function waitForJetpackInstall() {
|
||||
|
@ -239,7 +239,7 @@ jQuery( function( $ ) {
|
|||
.prop( 'disabled', true )
|
||||
.prop( 'required', false );
|
||||
}
|
||||
} ).find( 'input#stripe_create_account, input#ppec_paypal_reroute_requests' ).change();
|
||||
} ).find( 'input#stripe_create_account, input#ppec_paypal_reroute_requests' ).trigger( 'change' );
|
||||
|
||||
function addPlugins( bySlug, $el, hover ) {
|
||||
var plugins = $el.data( 'plugins' );
|
||||
|
|
|
@ -354,7 +354,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
$( '.wc-shipping-zone-method-selector select' ).change();
|
||||
$( '.wc-shipping-zone-method-selector select' ).trigger( 'change' );
|
||||
},
|
||||
onAddShippingMethodSubmitted: function( event, target, posted_data ) {
|
||||
if ( 'wc-modal-add-shipping-method' === target ) {
|
||||
|
|
|
@ -250,7 +250,7 @@
|
|||
var shifted = false;
|
||||
var hasFocus = false;
|
||||
|
||||
$( document.body ).bind( 'keyup keydown', function( e ) {
|
||||
$( document.body ).on( 'keyup keydown', function( e ) {
|
||||
shifted = e.shiftKey;
|
||||
controlled = e.ctrlKey || e.metaKey;
|
||||
});
|
||||
|
@ -315,7 +315,7 @@
|
|||
} else {
|
||||
$( this ).closest( 'tr' ).next( 'tr' ).show();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Hidden options
|
||||
$( '.hide_options_if_checked' ).each( function() {
|
||||
|
@ -331,7 +331,7 @@
|
|||
.nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
|
||||
.show();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
});
|
||||
|
||||
$( '.show_options_if_checked' ).each( function() {
|
||||
|
@ -347,7 +347,7 @@
|
|||
.nextUntil( '.hide_options_if_checked, .show_options_if_checked', '.hidden_option' )
|
||||
.hide();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
});
|
||||
|
||||
// Reviews.
|
||||
|
@ -357,7 +357,7 @@
|
|||
} else {
|
||||
$( '#woocommerce_enable_review_rating' ).closest( 'tr' ).hide();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
// Attribute term table
|
||||
$( 'table.attributes-table tbody tr:nth-child(odd)' ).addClass( 'alternate' );
|
||||
|
|
|
@ -24,7 +24,7 @@ jQuery( function( $ ) {
|
|||
})
|
||||
|
||||
// Trigger initial click
|
||||
.find( 'input[name=payment_method]:checked' ).click();
|
||||
.find( 'input[name=payment_method]:checked' ).trigger( 'click' );
|
||||
|
||||
$( '#add_payment_method' ).submit( function() {
|
||||
$( '#add_payment_method' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
*/
|
||||
VariationForm.prototype.onReset = function( event ) {
|
||||
event.preventDefault();
|
||||
event.data.variationForm.$attributeFields.val( '' ).change();
|
||||
event.data.variationForm.$attributeFields.val( '' ).trigger( 'change' );
|
||||
event.data.variationForm.$form.trigger( 'reset_data' );
|
||||
};
|
||||
|
||||
|
@ -286,11 +286,11 @@
|
|||
$template_html = $template_html.replace( '/*]]>*/', '' );
|
||||
|
||||
form.$singleVariation.html( $template_html );
|
||||
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( variation.variation_id ).change();
|
||||
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( variation.variation_id ).trigger( 'change' );
|
||||
|
||||
// Hide or show qty input
|
||||
if ( variation.is_sold_individually === 'yes' ) {
|
||||
$qty.find( 'input.qty' ).val( '1' ).attr( 'min', '1' ).attr( 'max', '' ).change();
|
||||
$qty.find( 'input.qty' ).val( '1' ).attr( 'min', '1' ).attr( 'max', '' ).trigger( 'change' );
|
||||
$qty.hide();
|
||||
} else {
|
||||
|
||||
|
@ -304,7 +304,7 @@
|
|||
qty_val = qty_val < parseFloat( variation.min_qty ) ? variation.min_qty : qty_val;
|
||||
}
|
||||
|
||||
$qty_input.attr( 'min', variation.min_qty ).attr( 'max', variation.max_qty ).val( qty_val ).change();
|
||||
$qty_input.attr( 'min', variation.min_qty ).attr( 'max', variation.max_qty ).val( qty_val ).trigger( 'change' );
|
||||
$qty.show();
|
||||
}
|
||||
|
||||
|
@ -314,7 +314,7 @@
|
|||
}
|
||||
|
||||
// Reveal
|
||||
if ( $.trim( form.$singleVariation.text() ) ) {
|
||||
if ( form.$singleVariation.text().trim() ) {
|
||||
form.$singleVariation.slideDown( 200 ).trigger( 'show_variation', [ variation, purchasable ] );
|
||||
} else {
|
||||
form.$singleVariation.show().trigger( 'show_variation', [ variation, purchasable ] );
|
||||
|
@ -327,7 +327,7 @@
|
|||
VariationForm.prototype.onChange = function( event ) {
|
||||
var form = event.data.variationForm;
|
||||
|
||||
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( '' ).change();
|
||||
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( '' ).trigger( 'change' );
|
||||
form.$form.find( '.wc-no-matching-variations' ).remove();
|
||||
|
||||
if ( form.useAjax ) {
|
||||
|
@ -379,7 +379,7 @@
|
|||
if ( ! current_attr_select.data( 'attribute_html' ) ) {
|
||||
var refSelect = current_attr_select.clone();
|
||||
|
||||
refSelect.find( 'option' ).removeAttr( 'disabled attached' ).removeAttr( 'selected' );
|
||||
refSelect.find( 'option' ).prop( 'disabled attached', false ).prop( 'selected', false );
|
||||
|
||||
// Legacy data attribute.
|
||||
current_attr_select.data(
|
||||
|
@ -484,7 +484,7 @@
|
|||
if ( selected_attr_val_valid ) {
|
||||
current_attr_select.val( selected_attr_val );
|
||||
} else {
|
||||
current_attr_select.val( '' ).change();
|
||||
current_attr_select.val( '' ).trigger( 'change' );
|
||||
}
|
||||
} else {
|
||||
current_attr_select.val( '' ); // No change event to prevent infinite loop.
|
||||
|
|
|
@ -32,7 +32,7 @@ jQuery( function( $ ) {
|
|||
|
||||
// Handle locale
|
||||
$( document.body )
|
||||
.bind( 'country_to_state_changing', function( event, country, wrapper ) {
|
||||
.on( 'country_to_state_changing', function( event, country, wrapper ) {
|
||||
var thisform = wrapper, thislocale;
|
||||
|
||||
if ( typeof locale[ country ] !== 'undefined' ) {
|
||||
|
|
|
@ -180,7 +180,7 @@ jQuery( function( $ ) {
|
|||
wp.customize.widgetsPreview.WidgetPartial
|
||||
);
|
||||
if ( hasSelectiveRefresh ) {
|
||||
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
||||
wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
|
||||
refresh_cart_fragment();
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ jQuery( function( $ ) {
|
|||
$order_review: $( '#order_review' ),
|
||||
$checkout_form: $( 'form.checkout' ),
|
||||
init: function() {
|
||||
$( document.body ).bind( 'update_checkout', this.update_checkout );
|
||||
$( document.body ).bind( 'init_checkout', this.init_checkout );
|
||||
$( document.body ).on( 'update_checkout', this.update_checkout );
|
||||
$( document.body ).on( 'init_checkout', this.init_checkout );
|
||||
|
||||
// Payment methods
|
||||
this.$checkout_form.on( 'click', 'input[name="payment_method"]', this.payment_method_selected );
|
||||
|
@ -50,7 +50,7 @@ jQuery( function( $ ) {
|
|||
this.$checkout_form.on( 'change', '#ship-to-different-address input', this.ship_to_different_address );
|
||||
|
||||
// Trigger events
|
||||
this.$checkout_form.find( '#ship-to-different-address input' ).change();
|
||||
this.$checkout_form.find( '#ship-to-different-address input' ).trigger( 'change' );
|
||||
this.init_payment_methods();
|
||||
|
||||
// Update on page load
|
||||
|
@ -58,7 +58,7 @@ jQuery( function( $ ) {
|
|||
$( document.body ).trigger( 'init_checkout' );
|
||||
}
|
||||
if ( wc_checkout_params.option_guest_checkout === 'yes' ) {
|
||||
$( 'input#createaccount' ).change( this.toggle_create_account ).change();
|
||||
$( 'input#createaccount' ).change( this.toggle_create_account ).trigger( 'change' );
|
||||
}
|
||||
},
|
||||
init_payment_methods: function() {
|
||||
|
@ -130,7 +130,7 @@ jQuery( function( $ ) {
|
|||
|
||||
if ( $( this ).is( ':checked' ) ) {
|
||||
// Ensure password is not pre-populated.
|
||||
$( '#account_password' ).val( '' ).change();
|
||||
$( '#account_password' ).val( '' ).trigger( 'change' );
|
||||
$( 'div.create-account' ).slideDown();
|
||||
}
|
||||
},
|
||||
|
@ -380,11 +380,11 @@ jQuery( function( $ ) {
|
|||
var ID = $( this ).attr( 'id' );
|
||||
if ( ID ) {
|
||||
if ( $.inArray( $( this ).attr( 'type' ), [ 'checkbox', 'radio' ] ) !== -1 ) {
|
||||
$( this ).prop( 'checked', paymentDetails[ ID ] ).change();
|
||||
$( this ).prop( 'checked', paymentDetails[ ID ] ).trigger( 'change' );
|
||||
} else if ( $.inArray( $( this ).attr( 'type' ), [ 'select' ] ) !== -1 ) {
|
||||
$( this ).val( paymentDetails[ ID ] ).change();
|
||||
$( this ).val( paymentDetails[ ID ] ).trigger( 'change' );
|
||||
} else if ( null !== $( this ).val() && 0 === $( this ).val().length ) {
|
||||
$( this ).val( paymentDetails[ ID ] ).change();
|
||||
$( this ).val( paymentDetails[ ID ] ).trigger( 'change' );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -406,7 +406,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
|
||||
// Lose focus for all fields
|
||||
$form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).blur();
|
||||
$form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).trigger( 'blur' );
|
||||
|
||||
wc_checkout_form.scroll_to_notices();
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ jQuery( function( $ ) {
|
|||
$( '.woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message' ).remove();
|
||||
wc_checkout_form.$checkout_form.prepend( '<div class="woocommerce-NoticeGroup woocommerce-NoticeGroup-checkout">' + error_message + '</div>' ); // eslint-disable-line max-len
|
||||
wc_checkout_form.$checkout_form.removeClass( 'processing' ).unblock();
|
||||
wc_checkout_form.$checkout_form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).blur();
|
||||
wc_checkout_form.$checkout_form.find( '.input-text, select, input:checkbox' ).trigger( 'validate' ).trigger( 'blur' );
|
||||
wc_checkout_form.scroll_to_notices();
|
||||
$( document.body ).trigger( 'checkout_error' , [ error_message ] );
|
||||
},
|
||||
|
|
|
@ -70,7 +70,7 @@ jQuery( function( $ ) {
|
|||
|
||||
wc_country_select_select2();
|
||||
|
||||
$( document.body ).bind( 'country_to_state_changed', function() {
|
||||
$( document.body ).on( 'country_to_state_changed', function() {
|
||||
wc_country_select_select2();
|
||||
});
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ jQuery( function( $ ) {
|
|||
$statebox.append( $option );
|
||||
} );
|
||||
|
||||
$statebox.val( value ).change();
|
||||
$statebox.val( value ).trigger( 'change' );
|
||||
|
||||
$( document.body ).trigger( 'country_to_state_changed', [country, $wrapper ] );
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
'form.edit-account #password_1, form.lost_reset_password #password_1',
|
||||
this.strengthMeter
|
||||
);
|
||||
$( 'form.checkout #createaccount' ).change();
|
||||
$( 'form.checkout #createaccount' ).trigger( 'change' );
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,13 +16,13 @@ jQuery( function( $ ) {
|
|||
var $tabs = $( this ).find( '.wc-tabs, ul.tabs' ).first();
|
||||
|
||||
if ( hash.toLowerCase().indexOf( 'comment-' ) >= 0 || hash === '#reviews' || hash === '#tab-reviews' ) {
|
||||
$tabs.find( 'li.reviews_tab a' ).click();
|
||||
$tabs.find( 'li.reviews_tab a' ).trigger( 'click' );
|
||||
} else if ( url.indexOf( 'comment-page-' ) > 0 || url.indexOf( 'cpage=' ) > 0 ) {
|
||||
$tabs.find( 'li.reviews_tab a' ).click();
|
||||
$tabs.find( 'li.reviews_tab a' ).trigger( 'click' );
|
||||
} else if ( hash === '#tab-additional_information' ) {
|
||||
$tabs.find( 'li.additional_information_tab a' ).click();
|
||||
$tabs.find( 'li.additional_information_tab a' ).trigger( 'click' );
|
||||
} else {
|
||||
$tabs.find( 'li:first a' ).click();
|
||||
$tabs.find( 'li:first a' ).trigger( 'click' );
|
||||
}
|
||||
} )
|
||||
.on( 'click', '.wc-tabs li a, ul.tabs li a', function( e ) {
|
||||
|
@ -39,7 +39,7 @@ jQuery( function( $ ) {
|
|||
} )
|
||||
// Review link
|
||||
.on( 'click', 'a.woocommerce-review-link', function() {
|
||||
$( '.reviews_tab a' ).click();
|
||||
$( '.reviews_tab a' ).trigger( 'click' );
|
||||
return true;
|
||||
} )
|
||||
// Star ratings for comments
|
||||
|
@ -101,8 +101,8 @@ jQuery( function( $ ) {
|
|||
$target.data( 'product_gallery', this );
|
||||
|
||||
// Pick functionality to initialize...
|
||||
this.flexslider_enabled = $.isFunction( $.fn.flexslider ) && wc_single_product_params.flexslider_enabled;
|
||||
this.zoom_enabled = $.isFunction( $.fn.zoom ) && wc_single_product_params.zoom_enabled;
|
||||
this.flexslider_enabled = 'function' === typeof $.fn.flexslider && wc_single_product_params.flexslider_enabled;
|
||||
this.zoom_enabled = 'function' === typeof $.fn.zoom && wc_single_product_params.zoom_enabled;
|
||||
this.photoswipe_enabled = typeof PhotoSwipe !== 'undefined' && wc_single_product_params.photoswipe_enabled;
|
||||
|
||||
// ...also taking args into account.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
jQuery( function( $ ) {
|
||||
// Orderby
|
||||
$( '.woocommerce-ordering' ).on( 'change', 'select.orderby', function() {
|
||||
$( this ).closest( 'form' ).submit();
|
||||
$( this ).closest( 'form' ).trigger( 'submit' );
|
||||
});
|
||||
|
||||
// Target quantity inputs on product pages
|
||||
|
|
Loading…
Reference in New Issue