Ticket #25696: 25696.3.patch
File 25696.3.patch, 7.6 KB (added by , 9 years ago) |
---|
-
src/wp-admin/js/edit-comments.js
569 569 if ( e.which == 13 ) { 570 570 commentReply.send(); 571 571 e.preventDefault(); 572 // @todo check if really necessary. 572 573 return false; 573 574 } 574 575 }); … … 606 607 607 608 revert : function() { 608 609 609 if ( $('#the-comment-list #replyrow').length < 1 ) 610 if ( $('#the-comment-list #replyrow').length < 1 ) { 611 // @todo when buttons will be buttons this should just return? 610 612 return false; 613 } 611 614 612 615 $('#replyrow').fadeOut('fast', function(){ 613 616 commentReply.close(); 614 617 }); 615 618 619 // Try to abort any previous AJAX request when users click Cancel. 620 if ( commentReply.xhr && commentReply.xhr.readyState !== 4 ) { 621 commentReply.xhr.abort(); 622 commentReply.xhr = null; 623 } 624 625 // @todo buttons should be buttons. 616 626 return false; 617 627 }, 618 628 … … 728 738 commentReply.revert(); // close on Escape 729 739 }); 730 740 }, 600); 731 741 // @todo check if really necessary, default links action is already prevented. 732 742 return false; 733 743 }, 734 744 … … 735 745 send : function() { 736 746 var post = {}; 737 747 748 // Return and prevent form submitting if there's already an AJAX request in progress. 749 if ( commentReply.xhr && commentReply.xhr.readyState !== 4 ) { 750 return false; 751 } 752 738 753 $('#replysubmit .error').hide(); 739 754 $( '#replysubmit .spinner' ).addClass( 'is-active' ); 740 755 … … 751 766 if ( $('#comment-' + $('#comment_ID').val()).hasClass('unapproved') ) 752 767 post.approve_parent = 1; 753 768 754 $.ajax({ 769 // Fire the AJAX request. 770 commentReply.xhr = $.ajax({ 755 771 type : 'POST', 756 772 url : ajaxurl, 757 773 data : post, … … 759 775 error : function(r) { commentReply.error(r); } 760 776 }); 761 777 778 // @todo buttons should be buttons. 762 779 return false; 763 780 }, 764 781 … … 919 936 // Quick Edit and Reply have an inline comment editor. 920 937 $( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) { 921 938 e.preventDefault(); 939 940 // Don't open a new Quick Edit form when a previous Quick Edit request has not completed yet. 941 if ( commentReply.xhr && commentReply.xhr.readyState !== 4 ) { 942 return; 943 } 944 922 945 var $el = $( this ), 923 946 action = 'replyto'; 924 947 -
src/wp-admin/js/inline-edit-post.js
51 51 // add events 52 52 $('#the-list').on( 'click', 'a.editinline', function( e ) { 53 53 e.preventDefault(); 54 // Don't open a new Quick Edit form when a previous Quick Edit request has not completed yet. 55 if ( inlineEditPost.xhr && inlineEditPost.xhr.readyState !== 4 ) { 56 return; 57 } 54 58 inlineEditPost.edit(this); 55 59 }); 56 60 … … 77 81 }); 78 82 }, 79 83 80 toggle : function(el){81 var t = this;82 $( t.what + t.getId( el ) ).css( 'display' ) === 'none' ? t.revert() : t.edit( el );83 },84 85 84 setBulk : function(){ 86 85 var te = '', type = this.type, tax, c = true; 87 86 this.revert(); … … 253 252 save : function(id) { 254 253 var params, fields, page = $('.post_status_page').val() || ''; 255 254 255 // Return and prevent form submitting if there's already an AJAX request in progress. 256 if ( inlineEditPost.xhr && inlineEditPost.xhr.readyState !== 4 ) { 257 return false; 258 } 259 256 260 if ( typeof(id) === 'object' ) { 257 261 id = this.getId(id); 258 262 } … … 270 274 fields = $('#edit-'+id).find(':input').serialize(); 271 275 params = fields + '&' + $.param(params); 272 276 273 // make ajax request274 $.post( ajaxurl, params,277 // Fire the AJAX request. 278 inlineEditPost.xhr = $.post( ajaxurl, params, 275 279 function(r) { 276 280 var $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' ); 277 281 … … 280 284 281 285 if (r) { 282 286 if ( -1 !== r.indexOf( '<tr' ) ) { 287 // Get both the edited row and the empty row used to maintain zebra striping, then remove them. 283 288 $(inlineEditPost.what+id).siblings('tr.hidden').addBack().remove(); 289 // Get the Quick Edit form, append the returned row before it and then remove it. 284 290 $('#edit-'+id).before(r).remove(); 291 // Get the new appended row, ensure it's hidden then fade it in. 285 292 $( inlineEditPost.what + id ).hide().fadeIn( 400, function() { 286 293 // Move focus back to the Quick Edit link. $( this ) is the row being animated. 287 294 $( this ).find( '.editinline' ).focus(); … … 325 332 } 326 333 } 327 334 328 return false; 335 // Try to abort any previous AJAX request when users click Cancel. 336 if ( inlineEditPost.xhr && inlineEditPost.xhr.readyState !== 4 ) { 337 inlineEditPost.xhr.abort(); 338 inlineEditPost.xhr = null; 339 } 329 340 }, 330 341 331 342 getId : function(o) { -
src/wp-admin/js/inline-edit-tax.js
11 11 t.type = $('#the-list').attr('data-wp-lists').substr(5); 12 12 t.what = '#'+t.type+'-'; 13 13 14 $('#the-list').on('click', 'a.editinline', function(){ 14 $( '#the-list' ).on( 'click', 'a.editinline', function( e ) { 15 e.preventDefault(); 16 // Don't open a new Quick Edit form when a previous Quick Edit request has not completed yet. 17 if ( inlineEditTax.xhr && inlineEditTax.xhr.readyState !== 4 ) { 18 return; 19 } 15 20 inlineEditTax.edit(this); 16 return false;17 21 }); 18 22 19 23 // prepare the edit row … … 40 44 }); 41 45 }, 42 46 43 toggle : function(el) {44 var t = this;45 $(t.what+t.getId(el)).css('display') === 'none' ? t.revert() : t.edit(el);46 },47 48 47 edit : function(id) { 49 48 var editRow, rowData, val, 50 49 t = this; … … 78 77 save : function(id) { 79 78 var params, fields, tax = $('input[name="taxonomy"]').val() || ''; 80 79 80 // Return and prevent form submitting if there's already an AJAX request in progress. 81 if ( inlineEditTax.xhr && inlineEditTax.xhr.readyState !== 4 ) { 82 return false; 83 } 84 81 85 if( typeof(id) === 'object' ) { 82 86 id = this.getId(id); 83 87 } … … 94 98 fields = $('#edit-'+id).find(':input').serialize(); 95 99 params = fields + '&' + $.param(params); 96 100 97 // make ajax request98 $.post( ajaxurl, params,101 // Fire the AJAX request. 102 inlineEditTax.xhr = $.post( ajaxurl, params, 99 103 function(r) { 100 104 var row, new_id, option_value, 101 105 $errorSpan = $( '#edit-' + id + ' .inline-edit-save .error' ); … … 104 108 105 109 if (r) { 106 110 if ( -1 !== r.indexOf( '<tr' ) ) { 111 // Get both the edited row and the empty row used to maintain zebra striping, then remove them. 107 112 $(inlineEditTax.what+id).siblings('tr.hidden').addBack().remove(); 108 113 new_id = $(r).attr('id'); 109 114 // Get the Quick Edit form, append the returned row before it and then remove it. 110 115 $('#edit-'+id).before(r).remove(); 111 116 112 117 if ( new_id ) { … … 119 124 120 125 // Update the value in the Parent dropdown. 121 126 $( '#parent' ).find( 'option[value=' + option_value + ']' ).text( row.find( '.row-title' ).text() ); 122 127 // Get the new appended row, ensure it's hidden then fade it in. 123 128 row.hide().fadeIn( 400, function() { 124 129 // Move focus back to the Quick Edit link. 125 130 row.find( '.editinline' ).focus(); … … 151 156 // Show the taxonomy row and move focus back to the Quick Edit link. 152 157 $( this.what + id ).show().find( '.editinline' ).focus(); 153 158 } 159 160 // Try to abort any previous AJAX request when users click Cancel. 161 if ( inlineEditTax.xhr && inlineEditTax.xhr.readyState !== 4 ) { 162 inlineEditTax.xhr.abort(); 163 inlineEditTax.xhr = null; 164 } 154 165 }, 155 166 156 167 getId : function(o) {