2014-02-22 04:07:37 +00:00
|
|
|
jQuery( function( $ ) {
|
2013-11-05 22:41:21 +00:00
|
|
|
|
2013-12-04 19:15:24 +00:00
|
|
|
// woocommerce_params is required to continue, ensure the object exists
|
2015-07-10 05:13:30 +00:00
|
|
|
if ( typeof woocommerce_params === 'undefined' ) {
|
2013-12-04 19:15:24 +00:00
|
|
|
return false;
|
2015-07-10 05:13:30 +00:00
|
|
|
}
|
2013-12-04 19:15:24 +00:00
|
|
|
|
2014-02-22 04:07:37 +00:00
|
|
|
$( '#add_payment_method' )
|
2013-11-05 22:41:21 +00:00
|
|
|
|
|
|
|
/* Payment option selection */
|
|
|
|
|
|
|
|
.on( 'click init_add_payment_method', '.payment_methods input.input-radio', function() {
|
2014-02-22 04:07:37 +00:00
|
|
|
if ( $( '.payment_methods input.input-radio' ).length > 1 ) {
|
|
|
|
var target_payment_box = $( 'div.payment_box.' + $( this ).attr( 'ID' ) );
|
|
|
|
if ( $( this ).is( ':checked' ) && ! target_payment_box.is( ':visible' ) ) {
|
|
|
|
$( 'div.payment_box' ).filter( ':visible' ).slideUp( 250 );
|
|
|
|
if ( $( this ).is( ':checked' ) ) {
|
|
|
|
$( 'div.payment_box.' + $( this ).attr( 'ID' ) ).slideDown( 250 );
|
2014-01-20 15:18:47 +00:00
|
|
|
}
|
2013-11-05 22:41:21 +00:00
|
|
|
}
|
|
|
|
} else {
|
2014-02-22 04:07:37 +00:00
|
|
|
$( 'div.payment_box' ).show();
|
2013-11-05 22:41:21 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
// Trigger initial click
|
2021-01-07 22:00:55 +00:00
|
|
|
.find( 'input[name=payment_method]:checked' ).trigger( 'click' );
|
2013-11-05 22:41:21 +00:00
|
|
|
|
2021-02-04 18:16:20 +00:00
|
|
|
$( '#add_payment_method' ).on( 'submit', function() {
|
2014-11-13 18:28:15 +00:00
|
|
|
$( '#add_payment_method' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
|
2013-11-05 22:41:21 +00:00
|
|
|
});
|
|
|
|
|
2015-04-13 15:37:22 +00:00
|
|
|
$( document.body ).trigger( 'init_add_payment_method' );
|
2013-11-05 22:41:21 +00:00
|
|
|
|
2013-12-04 19:15:24 +00:00
|
|
|
});
|