Update deprecated jQuery functions in includes folder
This commit is contained in:
parent
09aabeeb6f
commit
387e095a01
|
@ -180,7 +180,7 @@ jQuery( function( $ ) {
|
|||
wp.customize.widgetsPreview.WidgetPartial
|
||||
);
|
||||
if ( hasSelectiveRefresh ) {
|
||||
wp.customize.selectiveRefresh.on( 'partial-content-rendered', function() {
|
||||
wp.customize.selectiveRefresh.bind( 'partial-content-rendered', function() {
|
||||
refresh_cart_fragment();
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -140,23 +140,23 @@ class WC_Admin_Permalink_Settings {
|
|||
<?php wp_nonce_field( 'wc-permalinks', 'wc-permalinks-nonce' ); ?>
|
||||
<script type="text/javascript">
|
||||
jQuery( function() {
|
||||
jQuery('input.wctog').change(function() {
|
||||
jQuery('input.wctog').on( 'change', function() {
|
||||
jQuery('#woocommerce_permalink_structure').val( jQuery( this ).val() );
|
||||
});
|
||||
jQuery('.permalink-structure input').change(function() {
|
||||
jQuery('.permalink-structure input').on( 'change', function() {
|
||||
jQuery('.wc-permalink-structure').find('code.non-default-example, code.default-example').hide();
|
||||
if ( jQuery(this).val() ) {
|
||||
jQuery('.wc-permalink-structure code.non-default-example').show();
|
||||
jQuery('.wc-permalink-structure input').removeAttr('disabled');
|
||||
jQuery('.wc-permalink-structure input').prop('disabled', false);
|
||||
} else {
|
||||
jQuery('.wc-permalink-structure code.default-example').show();
|
||||
jQuery('.wc-permalink-structure input:eq(0)').click();
|
||||
jQuery('.wc-permalink-structure input:eq(0)').trigger( 'click' );
|
||||
jQuery('.wc-permalink-structure input').attr('disabled', 'disabled');
|
||||
}
|
||||
});
|
||||
jQuery('.permalink-structure input:checked').change();
|
||||
jQuery('#woocommerce_permalink_structure').focus( function(){
|
||||
jQuery('#woocommerce_custom_selection').click();
|
||||
jQuery('.permalink-structure input:checked').trigger( 'change' );
|
||||
jQuery('#woocommerce_permalink_structure').on( 'focus', function(){
|
||||
jQuery('#woocommerce_custom_selection').trigger( 'click' );
|
||||
} );
|
||||
} );
|
||||
</script>
|
||||
|
|
|
@ -254,12 +254,12 @@ class WC_Admin_Pointers {
|
|||
button2 = $( '<a class=\"button button-primary\" href=\"#\">' + next + '</a>' ),
|
||||
wrapper = $( '<div class=\"wc-pointer-buttons\" />' );
|
||||
|
||||
button.bind( 'click.pointer', function(e) {
|
||||
button.on( 'click.pointer', function(e) {
|
||||
e.preventDefault();
|
||||
t.element.pointer('destroy');
|
||||
});
|
||||
|
||||
button2.bind( 'click.pointer', function(e) {
|
||||
button2.on( 'click.pointer', function(e) {
|
||||
e.preventDefault();
|
||||
t.element.pointer('close');
|
||||
});
|
||||
|
|
|
@ -157,7 +157,7 @@ class WC_Plugins_Screen_Updates extends WC_Plugin_Updates {
|
|||
$update_link.removeClass( 'wc-thickbox open-plugin-details-modal' );
|
||||
$update_link.addClass( 'update-link' );
|
||||
$update_link.attr( 'href', update_url );
|
||||
$update_link.click();
|
||||
$update_link.trigger( 'click' );
|
||||
});
|
||||
|
||||
$( '#wc_untested_extensions_modal .cancel' ).on( 'click', function( evt ) {
|
||||
|
|
|
@ -69,7 +69,7 @@ class WC_Updates_Screen_Updates extends WC_Plugin_Updates {
|
|||
}
|
||||
var $checkbox = $( 'input[value="woocommerce/woocommerce.php"]' );
|
||||
if ( $checkbox.prop( 'checked' ) ) {
|
||||
$( '#wc-upgrade-warning' ).click();
|
||||
$( '#wc-upgrade-warning' ).trigger( 'click' );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -343,9 +343,9 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
|||
} );
|
||||
jQuery( '.section' ).slideUp( 100, function() {
|
||||
<?php if ( empty( $this->coupon_codes ) ) : ?>
|
||||
jQuery( '.section_title:eq(1)' ).click();
|
||||
jQuery( '.section_title:eq(1)' ).trigger( 'click' );
|
||||
<?php else : ?>
|
||||
jQuery( '.section_title:eq(0)' ).click();
|
||||
jQuery( '.section_title:eq(0)' ).trigger( 'click' );
|
||||
<?php endif; ?>
|
||||
} );
|
||||
</script>
|
||||
|
@ -551,7 +551,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
|||
}
|
||||
);
|
||||
|
||||
jQuery('.chart-placeholder').resize();
|
||||
jQuery('.chart-placeholder').trigger( 'resize' );
|
||||
}
|
||||
|
||||
drawGraph();
|
||||
|
|
|
@ -155,7 +155,7 @@ class WC_Report_Customers extends WC_Admin_Report {
|
|||
}
|
||||
);
|
||||
|
||||
jQuery('.chart-placeholder.customers_vs_guests').resize();
|
||||
jQuery('.chart-placeholder.customers_vs_guests').trigger( 'resize' );
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
|
@ -412,7 +412,7 @@ class WC_Report_Customers extends WC_Admin_Report {
|
|||
],
|
||||
}
|
||||
);
|
||||
jQuery('.chart-placeholder').resize();
|
||||
jQuery('.chart-placeholder').trigger( 'resize' );
|
||||
}
|
||||
|
||||
drawGraph();
|
||||
|
|
|
@ -244,13 +244,13 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
|||
// Select all/None
|
||||
jQuery( '.chart-widget' ).on( 'click', '.select_all', function() {
|
||||
jQuery(this).closest( 'div' ).find( 'select option' ).attr( 'selected', 'selected' );
|
||||
jQuery(this).closest( 'div' ).find('select').change();
|
||||
jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
|
||||
jQuery( '.chart-widget').on( 'click', '.select_none', function() {
|
||||
jQuery(this).closest( 'div' ).find( 'select option' ).removeAttr( 'selected' );
|
||||
jQuery(this).closest( 'div' ).find('select').change();
|
||||
jQuery(this).closest( 'div' ).find( 'select option' ).prop( 'selected', false );
|
||||
jQuery(this).closest( 'div' ).find('select').trigger( 'change' );
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
@ -430,7 +430,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
|||
}
|
||||
);
|
||||
|
||||
jQuery('.chart-placeholder').resize();
|
||||
jQuery('.chart-placeholder').trigger( 'resize' );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -849,7 +849,7 @@ class WC_Report_Sales_By_Date extends WC_Admin_Report {
|
|||
}
|
||||
);
|
||||
|
||||
jQuery('.chart-placeholder').resize();
|
||||
jQuery('.chart-placeholder').trigger( 'resize' );
|
||||
}
|
||||
|
||||
drawGraph();
|
||||
|
|
|
@ -389,7 +389,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
|||
} );
|
||||
jQuery( '.section' ).slideUp( 100, function() {
|
||||
<?php if ( empty( $this->product_ids ) ) : ?>
|
||||
jQuery( '.section_title:eq(1)' ).click();
|
||||
jQuery( '.section_title:eq(1)' ).trigger( 'click' );
|
||||
<?php endif; ?>
|
||||
} );
|
||||
</script>
|
||||
|
@ -610,7 +610,7 @@ class WC_Report_Sales_By_Product extends WC_Admin_Report {
|
|||
}
|
||||
);
|
||||
|
||||
jQuery('.chart-placeholder').resize();
|
||||
jQuery('.chart-placeholder').trigger( 'resize' );
|
||||
}
|
||||
|
||||
drawGraph();
|
||||
|
|
|
@ -221,6 +221,6 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
if ( 'action' === current ) {
|
||||
action_event_field.show();
|
||||
}
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -128,7 +128,7 @@ class WC_Shop_Customizer {
|
|||
} );
|
||||
|
||||
wp.customize.bind( 'ready', function() { // Ready?
|
||||
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).change();
|
||||
$( '.woocommerce-cropping-control' ).find( 'input:checked' ).trigger( 'change' );
|
||||
} );
|
||||
|
||||
wp.customize( 'woocommerce_demo_store', function( setting ) {
|
||||
|
|
|
@ -1029,7 +1029,7 @@ class WC_Email extends WC_Settings_API {
|
|||
|
||||
<?php
|
||||
wc_enqueue_js(
|
||||
"jQuery( 'select.email_type' ).change( function() {
|
||||
"jQuery( 'select.email_type' ).on( 'change', function() {
|
||||
|
||||
var val = jQuery( this ).val();
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ class WC_Email extends WC_Settings_API {
|
|||
jQuery('.template_plain').hide();
|
||||
}
|
||||
|
||||
}).change();
|
||||
}).trigger( 'change' );
|
||||
|
||||
var view = '" . esc_js( __( 'View template', 'woocommerce' ) ) . "';
|
||||
var hide = '" . esc_js( __( 'Hide template', 'woocommerce' ) ) . "';
|
||||
|
@ -1067,7 +1067,7 @@ class WC_Email extends WC_Settings_API {
|
|||
return false;
|
||||
});
|
||||
|
||||
jQuery( '.editor textarea' ).change( function() {
|
||||
jQuery( '.editor textarea' ).on( 'change', function() {
|
||||
var name = jQuery( this ).attr( 'data-name' );
|
||||
|
||||
if ( name ) {
|
||||
|
|
|
@ -38,7 +38,7 @@ jQuery( function( $ ) {
|
|||
}
|
||||
} );
|
||||
|
||||
$( '#woocommerce_paypal_testmode' ).change();
|
||||
$( '#woocommerce_paypal_testmode' ).trigger( 'change' );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method {
|
|||
});
|
||||
|
||||
// Change while load.
|
||||
$( '#woocommerce_free_shipping_requires' ).change();
|
||||
$( '#woocommerce_free_shipping_requires' ).trigger( 'change' );
|
||||
$( document.body ).on( 'wc_backbone_modal_loaded', function( evt, target ) {
|
||||
if ( 'wc-modal-shipping-method-settings' === target ) {
|
||||
wcFreeShippingShowHideMinAmountField( $( '#wc-backbone-modal-dialog #woocommerce_free_shipping_requires', evt.currentTarget ) );
|
||||
|
|
|
@ -297,13 +297,13 @@ class WC_Widget_Layered_Nav extends WC_Widget {
|
|||
wc_enqueue_js(
|
||||
"
|
||||
// Update value on change.
|
||||
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).change( function() {
|
||||
jQuery( '.dropdown_layered_nav_" . esc_js( $taxonomy_filter_name ) . "' ).on( 'change', function() {
|
||||
var slug = jQuery( this ).val();
|
||||
jQuery( ':input[name=\"filter_" . esc_js( $taxonomy_filter_name ) . "\"]' ).val( slug );
|
||||
|
||||
// Submit form on change if standard dropdown.
|
||||
if ( ! jQuery( this ).attr( 'multiple' ) ) {
|
||||
jQuery( this ).closest( 'form' ).submit();
|
||||
jQuery( this ).closest( 'form' ).trigger( 'submit' );
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ class WC_Widget_Product_Categories extends WC_Widget {
|
|||
|
||||
wc_enqueue_js(
|
||||
"
|
||||
jQuery( '.dropdown_product_cat' ).change( function() {
|
||||
jQuery( '.dropdown_product_cat' ).on( 'change', function() {
|
||||
if ( jQuery(this).val() != '' ) {
|
||||
var this_page = '';
|
||||
var home_url = '" . esc_js( home_url( '/' ) ) . "';
|
||||
|
|
Loading…
Reference in New Issue