| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.3/wp-content/plugins/woocommerce/assets/js/frontend/ |
Upload File : |
jQuery( function( $ ) {
// woocommerce_params is required to continue, ensure the object exists
if ( typeof woocommerce_params === 'undefined' ) {
return false;
}
var $form = $( '#add_payment_method' );
/**
* Create the API object passed to custom place order button render callbacks.
* This is specific to the add-payment-method page.
*
* @return {Object} API object with validate and submit methods
*/
function createAddPaymentMethodApi() {
return {
/**
* Validate the form.
* For add payment method, there's minimal validation - the payment gateway handles most of it.
*
* @return {Promise<{hasError: boolean}>} Promise resolving to a validation result
*/
validate: function() {
return new Promise( function( resolve ) {
// The "add payment method" page has no form validation needs.
resolve( { hasError: false } );
} );
},
/**
* Submit the "add payment method" form.
*/
submit: function() {
$form.trigger( 'submit' );
}
};
}
// When a gateway registers after a page load, render its button if it's selected.
$( document.body ).on( 'wc_custom_place_order_button_registered', function( e, gatewayId ) {
wc.customPlaceOrderButton.__maybeShow( gatewayId, createAddPaymentMethodApi() );
} );
/* Payment option selection */
$form.on( 'click init_add_payment_method', '.payment_methods input.input-radio', function() {
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 );
}
}
} else {
$( 'div.payment_box' ).show();
}
// Handle custom place order button for selected gateway
wc.customPlaceOrderButton.__maybeShow( $( this ).val(), createAddPaymentMethodApi() );
});
// Hide default button immediately if initially selected gateway has custom button.
// This must happen BEFORE triggering click to prevent flash of the default button.
var $initialPaymentMethod = $form.find( 'input[name="payment_method"]:checked' );
if ( $initialPaymentMethod.length ) {
wc.customPlaceOrderButton.__maybeHideDefaultButtonOnInit( $initialPaymentMethod.val() );
}
// Trigger initial click
$form.find( 'input[name=payment_method]:checked' ).trigger( 'click' );
$form.on( 'submit', function() {
$form.block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } });
});
$( document.body ).trigger( 'init_add_payment_method' );
// Prevent firing multiple requests upon double clicking the buttons in payment methods table
$(' .woocommerce .payment-method-actions .button.delete' ).on( 'click' , function( event ) {
if ( $( this ).hasClass( 'disabled' ) ) {
event.preventDefault();
}
$( this ).addClass( 'disabled' );
});
});