wp/wp-admin/js/media.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
--- a/wp/wp-admin/js/media.js	Tue Dec 15 15:52:01 2020 +0100
+++ b/wp/wp-admin/js/media.js	Wed Sep 21 18:19:35 2022 +0200
@@ -46,7 +46,7 @@
 			$( '#find-posts' ).show();
 
 			// Close the dialog when the escape key is pressed.
-			$('#find-posts-input').focus().keyup( function( event ){
+			$('#find-posts-input').trigger( 'focus' ).on( 'keyup', function( event ){
 				if ( event.which == 27 ) {
 					findPosts.close();
 				}
@@ -140,7 +140,7 @@
 	 *
 	 * @return {void}
 	 */
-	$( document ).ready( function() {
+	$( function() {
 		var settings, $mediaGridWrap = $( '#wp-media-grid' );
 
 		// Opens a manage media frame into the grid.
@@ -158,13 +158,13 @@
 		}
 
 		// Prevents form submission if no post has been selected.
-		$( '#find-posts-submit' ).click( function( event ) {
+		$( '#find-posts-submit' ).on( 'click', function( event ) {
 			if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
 				event.preventDefault();
 		});
 
 		// Submits the search query when hitting the enter key in the search input.
-		$( '#find-posts .find-box-search :input' ).keypress( function( event ) {
+		$( '#find-posts .find-box-search :input' ).on( 'keypress', function( event ) {
 			if ( 13 == event.which ) {
 				findPosts.send();
 				return false;
@@ -172,19 +172,18 @@
 		});
 
 		// Binds the click event to the search button.
-		$( '#find-posts-search' ).click( findPosts.send );
+		$( '#find-posts-search' ).on( 'click', findPosts.send );
 
 		// Binds the close dialog click event.
-		$( '#find-posts-close' ).click( findPosts.close );
+		$( '#find-posts-close' ).on( 'click', findPosts.close );
 
 		// Binds the bulk action events to the submit buttons.
-		$( '#doaction, #doaction2' ).click( function( event ) {
+		$( '#doaction' ).on( 'click', function( event ) {
 
 			/*
-			 * Retrieves all select elements for bulk actions that have a name starting with `action`
-			 * and handle its action based on its value.
+			 * Handle the bulk action based on its value.
 			 */
-			$( 'select[name^="action"]' ).each( function() {
+			$( 'select[name="action"]' ).each( function() {
 				var optionValue = $( this ).val();
 
 				if ( 'attach' === optionValue ) {