wp/wp-admin/js/comment.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
--- a/wp/wp-admin/js/comment.js	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/js/comment.js	Wed Sep 21 18:19:35 2022 +0200
@@ -11,7 +11,7 @@
  *
  * @param {jQuery} $ The jQuery object.
  */
-jQuery(document).ready( function($) {
+jQuery( function($) {
 
 	postboxes.add_postbox_toggles('comment');
 
@@ -29,11 +29,11 @@
 	 * @param {Event} event The event object.
 	 * @return {void}
 	 */
-	$edittimestamp.click( function( event ) {
+	$edittimestamp.on( 'click', function( event ) {
 		if ( $timestampdiv.is( ':hidden' ) ) {
 			// Slide down the form and set focus on the first field.
 			$timestampdiv.slideDown( 'fast', function() {
-				$( 'input, select', $timestampwrap ).first().focus();
+				$( 'input, select', $timestampwrap ).first().trigger( 'focus' );
 			} );
 			$(this).hide();
 		}
@@ -49,9 +49,9 @@
 	 * @return {void}
 	 */
 
-	$timestampdiv.find('.cancel-timestamp').click( function( event ) {
+	$timestampdiv.find('.cancel-timestamp').on( 'click', function( event ) {
 		// Move focus back to the Edit link.
-		$edittimestamp.show().focus();
+		$edittimestamp.show().trigger( 'focus' );
 		$timestampdiv.slideUp( 'fast' );
 		$('#mm').val($('#hidden_mm').val());
 		$('#jj').val($('#hidden_jj').val());
@@ -70,7 +70,7 @@
 	 * @param {Event} event The event object.
 	 * @return {void}
 	 */
-	$timestampdiv.find('.save-timestamp').click( function( event ) { // Crazyhorse - multiple OK cancels.
+	$timestampdiv.find('.save-timestamp').on( 'click', function( event ) { // Crazyhorse - multiple OK cancels.
 		var aa = $('#aa').val(), mm = $('#mm').val(), jj = $('#jj').val(), hh = $('#hh').val(), mn = $('#mn').val(),
 			newD = new Date( aa, mm - 1, jj, hh, mn );
 
@@ -96,7 +96,7 @@
 		);
 
 		// Move focus back to the Edit link.
-		$edittimestamp.show().focus();
+		$edittimestamp.show().trigger( 'focus' );
 		$timestampdiv.slideUp( 'fast' );
 	});
 });