Ticket #34756: 34756.2.patch
File 34756.2.patch, 4.2 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/inline-edit-post.js
1 1 /* global inlineEditL10n, ajaxurl, typenow */ 2 window.wp = window.wp || {}; 2 3 3 4 var inlineEditPost; 4 5 (function($) { … … 62 63 $('select[name="_status"] option[value="future"]', bulkRow).remove(); 63 64 64 65 $('#doaction, #doaction2').click(function(e){ 65 var n = $(this).attr('id').substr(2); 66 var n; 67 68 t.whichBulkButtonId = $( this ).attr( 'id' ); 69 n = t.whichBulkButtonId.substr( 2 ); 70 66 71 if ( 'edit' === $( 'select[name="' + n + '"]' ).val() ) { 67 72 e.preventDefault(); 68 73 t.setBulk(); … … 244 249 return false; 245 250 }, 246 251 252 // Ajax saving is only for Quick Edit. 247 253 save : function(id) { 248 254 var params, fields, page = $('.post_status_page').val() || ''; 249 255 … … 267 273 // make ajax request 268 274 $.post( ajaxurl, params, 269 275 function(r) { 276 var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' ); 277 270 278 $( 'table.widefat .spinner' ).removeClass( 'is-active' ); 271 279 $( '.ac_results' ).hide(); 272 280 … … 274 282 if ( -1 !== r.indexOf( '<tr' ) ) { 275 283 $(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove(); 276 284 $('#edit-'+id).before(r).remove(); 277 $(inlineEditPost.what+id).hide().fadeIn(); 285 $( inlineEditPost.what + id ).hide().fadeIn( 400, function() { 286 // Move focus back to the Quick Edit link. $( this ) is the row being animated. 287 $( this ).find( '.editinline' ).focus(); 288 wp.a11y.speak( inlineEditL10n.saved ); 289 }); 278 290 } else { 279 291 r = r.replace( /<.[^<>]*?>/g, '' ); 280 $('#edit-'+id+' .inline-edit-save .error').html(r).show(); 292 $errorSpan.html( r ).show(); 293 wp.a11y.speak( $errorSpan.text() ); 281 294 } 282 295 } else { 283 $('#edit-'+id+' .inline-edit-save .error').html(inlineEditL10n.error).show(); 296 $errorSpan.html( inlineEditL10n.error ).show(); 297 wp.a11y.speak( inlineEditL10n.error ); 284 298 } 285 299 }, 286 300 'html'); … … 288 302 return false; 289 303 }, 290 304 305 // Revert is for both Quick Edit and Bulk Edit. 291 306 revert : function(){ 292 307 var $tableWideFat = $( '.widefat' ), 293 308 id = $( '.inline-editor', $tableWideFat ).attr( 'id' ); … … 300 315 $( '#bulk-edit', $tableWideFat ).removeClass( 'inline-editor' ).hide().siblings( '.hidden' ).remove(); 301 316 $('#bulk-titles').empty(); 302 317 $('#inlineedit').append( $('#bulk-edit') ); 318 // Move focus back to the Bulk Action button that was activated. 319 $( '#' + inlineEditPost.whichBulkButtonId ).focus(); 303 320 } else { 304 321 $('#'+id).siblings('tr.hidden').addBack().remove(); 305 322 id = id.substr( id.lastIndexOf('-') + 1 ); 306 $(this.what+id).show(); 323 // Show the post row and move focus back to the Quick Edit link. 324 $( this.what + id ).show().find( '.editinline' ).focus(); 307 325 } 308 326 } 309 327 … … 362 380 } 363 381 }); 364 382 365 } (jQuery));383 })( jQuery, window.wp ); -
src/wp-includes/script-loader.php
560 560 561 561 $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 ); 562 562 563 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );563 $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest', 'wp-a11y' ), false, 1 ); 564 564 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 565 'error' => __('Error while saving the changes.'), 566 'ntdeltitle' => __('Remove From Bulk Edit'), 567 'notitle' => __('(no title)'), 568 'comma' => trim( _x( ',', 'tag delimiter' ) ), 565 'error' => __( 'Error while saving the changes.' ), 566 'ntdeltitle' => __( 'Remove From Bulk Edit' ), 567 'notitle' => __( '(no title)' ), 568 'comma' => trim( _x( ',', 'tag delimiter' ) ), 569 'saved' => __( 'Changes saved.' ), 569 570 ) ); 570 571 571 572 $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );