Fix: Apply latest phpcbf formatting fixes

This commit is contained in:
2025-04-18 18:01:52 +01:00
parent 93412896e8
commit 275958bfdb
5 changed files with 371 additions and 347 deletions

View File

@@ -71,7 +71,8 @@
$submitButton.prop( 'disabled', true ).addClass( 'loading' ); $submitButton.prop( 'disabled', true ).addClass( 'loading' );
// Send AJAX request // Send AJAX request
$.ajax({ $.ajax(
{
url: wpstData.ajaxUrl, url: wpstData.ajaxUrl,
type: 'POST', type: 'POST',
data: { data: {
@@ -93,7 +94,8 @@
// Re-enable submit button and remove loading state // Re-enable submit button and remove loading state
$submitButton.prop( 'disabled', false ).removeClass( 'loading' ); $submitButton.prop( 'disabled', false ).removeClass( 'loading' );
} }
}); }
);
}, },
/** /**
@@ -109,17 +111,25 @@
$( '.wpst-notices' ).html( $notice ); $( '.wpst-notices' ).html( $notice );
// Automatically remove notice after 5 seconds // Automatically remove notice after 5 seconds
setTimeout(function() { setTimeout(
$notice.fadeOut(300, function() { function () {
$notice.fadeOut(
300,
function () {
$( this ).remove(); $( this ).remove();
}); }
}, 5000); );
},
5000
);
} }
}; };
// Initialize when document is ready // Initialize when document is ready
$(document).ready(function() { $( document ).ready(
function () {
WPSTAdmin.init(); WPSTAdmin.init();
}); }
);
})( jQuery ); })( jQuery );

View File

@@ -41,11 +41,15 @@
// Close modal when clicking on the close button or outside the modal // Close modal when clicking on the close button or outside the modal
this.$modal.on( 'click', '.wpst-modal-close', this.closeModal.bind( this ) ); this.$modal.on( 'click', '.wpst-modal-close', this.closeModal.bind( this ) );
$(document).on('click', '.wpst-modal', function(e) { $( document ).on(
'click',
'.wpst-modal',
function (e) {
if ($( e.target ).hasClass( 'wpst-modal' )) { if ($( e.target ).hasClass( 'wpst-modal' )) {
WPSTUpdateSourceSelector.closeModal(); WPSTUpdateSourceSelector.closeModal();
} }
}); }
);
// Select source option // Select source option
this.$modal.on( 'click', '.wpst-source-option', this.selectSource.bind( this ) ); this.$modal.on( 'click', '.wpst-source-option', this.selectSource.bind( this ) );
@@ -105,7 +109,8 @@
$saveButton.prop( 'disabled', true ).html( '<span class="wpst-loading"></span> Saving...' ); $saveButton.prop( 'disabled', true ).html( '<span class="wpst-loading"></span> Saving...' );
// Send AJAX request // Send AJAX request
$.ajax({ $.ajax(
{
url: wpstModalData.ajaxUrl, url: wpstModalData.ajaxUrl,
type: 'POST', type: 'POST',
data: { data: {
@@ -118,9 +123,12 @@
WPSTUpdateSourceSelector.showMessage( 'success', response.data.message ); WPSTUpdateSourceSelector.showMessage( 'success', response.data.message );
// Close modal after a short delay // Close modal after a short delay
setTimeout(function() { setTimeout(
function () {
WPSTUpdateSourceSelector.closeModal(); WPSTUpdateSourceSelector.closeModal();
}, 1500); },
1500
);
} else { } else {
WPSTUpdateSourceSelector.showMessage( 'error', response.data.message ); WPSTUpdateSourceSelector.showMessage( 'error', response.data.message );
} }
@@ -132,7 +140,8 @@
// Reset button state // Reset button state
$saveButton.prop( 'disabled', false ).text( wpstModalData.i18n.confirm ); $saveButton.prop( 'disabled', false ).text( wpstModalData.i18n.confirm );
} }
}); }
);
}, },
/** /**
@@ -149,16 +158,21 @@
// Hide message after a delay for success messages // Hide message after a delay for success messages
if (type === 'success') { if (type === 'success') {
setTimeout(function() { setTimeout(
function () {
$message.fadeOut( 300 ); $message.fadeOut( 300 );
}, 3000); },
3000
);
} }
} }
}; };
// Initialize when document is ready // Initialize when document is ready
$(document).ready(function() { $( document ).ready(
function () {
WPSTUpdateSourceSelector.init(); WPSTUpdateSourceSelector.init();
}); }
);
})( jQuery ); })( jQuery );