Ticket #8205: 8205.patch
File 8205.patch, 4.1 KB (added by , 5 years ago) |
---|
-
src/bp-activity/admin/js/admin.js
18 18 $(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close ); 19 19 $(document).on( 'click', '#bp-activities-container a.save', activityReply.send ); 20 20 21 // Close textarea on escape 21 // Close textarea on escape. 22 22 $(document).on( 'keyup', '#bp-activities:visible', function( e ) { 23 23 if ( 27 === e.which ) { 24 24 activityReply.close(); … … 32 32 * @since 1.6.0 33 33 */ 34 34 open : function() { 35 // Hide the container row, and move it to the new location 35 // Hide the container row, and move it to the new location. 36 36 var box = $( '#bp-activities-container' ).hide(); 37 37 $( this ).parents( 'tr' ).after( box ); 38 38 … … 52 52 // Hide the container row 53 53 $('#bp-activities-container').fadeOut( '200', function () { 54 54 55 // Empty and unfocus the text area 55 // Empty and unfocus the text area. 56 56 $( '#bp-activities' ).val( '' ).blur(); 57 57 58 // Remove any error message and disable the spinner 58 // Remove any error message and disable the spinner. 59 59 $( '#bp-replysubmit .error' ).html( '' ).hide(); 60 60 $( '#bp-replysubmit .waiting' ).hide(); 61 61 }); … … 69 69 * @since 1.6.0 70 70 */ 71 71 send : function() { 72 // Hide any existing error message, and show the loading spinner 72 // Hide any existing error message, and show the loading spinner. 73 73 $( '#bp-replysubmit .error' ).hide(); 74 74 $( '#bp-replysubmit .waiting' ).show(); 75 75 76 // Grab the nonce 76 // Grab the nonce. 77 77 var reply = {}; 78 78 reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val(); 79 79 80 // Get the rest of the data 80 // Get the rest of the data. 81 81 reply.action = 'bp-activity-admin-reply'; 82 82 reply.content = $( '#bp-activities' ).val(); 83 83 reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' ); 84 84 reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' ); 85 85 86 // Make the AJAX call 86 // Make the AJAX call. 87 87 $.ajax({ 88 88 data : reply, 89 89 type : 'POST', 90 90 url : ajaxurl, 91 91 92 // Callbacks 92 // Callbacks. 93 93 error : function( r ) { activityReply.error( r ); }, 94 94 success : function( r ) { activityReply.show( r ); } 95 95 }); … … 123 123 show : function ( xml ) { 124 124 var bg, id, response; 125 125 126 // Handle any errors in the response 126 // Handle any errors in the response. 127 127 if ( typeof( xml ) === 'string' ) { 128 128 activityReply.error( { 'responseText': xml } ); 129 129 return false; … … 139 139 // Close and reset the reply row, and add the new Activity item into the list. 140 140 $('#bp-activities-container').fadeOut( '200', function () { 141 141 142 // Empty and unfocus the text area 142 // Empty and unfocus the text area. 143 143 $( '#bp-activities' ).val( '' ).blur(); 144 144 145 // Remove any error message and disable the spinner 145 // Remove any error message and disable the spinner. 146 146 $( '#bp-replysubmit .error' ).html( '' ).hide(); 147 147 $( '#bp-replysubmit .waiting' ).hide(); 148 148 149 // Insert new activity item 149 // Insert new activity item. 150 150 $( '#bp-activities-container' ).before( response.data ); 151 151 152 // Get background colour and animate the flash 152 // Get background colour and animate the flash. 153 153 id = $( '#activity-' + response.id ); 154 154 bg = id.closest( '.widefat' ).css( 'backgroundColor' ); 155 155 id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 ); … … 158 158 }; 159 159 160 160 $(document).ready( function () { 161 // Create the Activity reply object after domready event 161 // Create the Activity reply object after domready event. 162 162 activityReply.init(); 163 163 164 // On the edit screen, unload the close/open toggle js for the action & content metaboxes 164 // On the edit screen, unload the close/open toggle js for the action & content metaboxes. 165 165 $( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' ); 166 166 167 167 // redo the post box toggles to reset the one made by comment.js in favor