Changeset 12521
- Timestamp:
- 01/16/2020 06:45:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-activity/admin/js/admin.js
r10141 r12521 3 3 4 4 /** 5 * Activity reply object for the activity index screen 5 * Activity reply object for the activity index screen. 6 6 * 7 7 * @since 1.6.0 … … 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 ) { … … 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 ); … … 50 50 */ 51 51 close : function() { 52 // Hide the container row 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(); … … 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(); … … 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, … … 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 ); } … … 99 99 100 100 /** 101 * send() error message handler 101 * send() error message handler. 102 102 * 103 103 * @since 1.6.0 … … 117 117 118 118 /** 119 * send() success handler 119 * send() success handler. 120 120 * 121 121 * @since 1.6.0 … … 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 } ); … … 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' ); … … 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
Note: See TracChangeset
for help on using the changeset viewer.