Skip to:
Content

BuddyPress.org

Changeset 12521


Ignore:
Timestamp:
01/16/2020 06:45:34 AM (8 months ago)
Author:
imath
Message:

Admin: fix some JS Coding standards into the Activity screen script

Props passoniate

Fixes #8205

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/admin/js/admin.js

    r10141 r12521  
    33
    44/**
    5  * Activity reply object for the activity index screen
     5 * Activity reply object for the activity index screen.
    66 *
    77 * @since 1.6.0
     
    1919        $(document).on( 'click', '#bp-activities-container a.save',   activityReply.send );
    2020
    21         // Close textarea on escape
     21        // Close textarea on escape.
    2222        $(document).on( 'keyup', '#bp-activities:visible', function( e ) {
    2323            if ( 27 === e.which ) {
     
    3333     */
    3434    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.
    3636        var box = $( '#bp-activities-container' ).hide();
    3737        $( this ).parents( 'tr' ).after( box );
     
    5050     */
    5151    close : function() {
    52         // Hide the container row
     52        // Hide the container row.
    5353        $('#bp-activities-container').fadeOut( '200', function () {
    5454
    55             // Empty and unfocus the text area
     55            // Empty and unfocus the text area.
    5656            $( '#bp-activities' ).val( '' ).blur();
    5757
    58             // Remove any error message and disable the spinner
     58            // Remove any error message and disable the spinner.
    5959            $( '#bp-replysubmit .error' ).html( '' ).hide();
    6060            $( '#bp-replysubmit .waiting' ).hide();
     
    7070     */
    7171    send : function() {
    72         // Hide any existing error message, and show the loading spinner
     72        // Hide any existing error message, and show the loading spinner.
    7373        $( '#bp-replysubmit .error' ).hide();
    7474        $( '#bp-replysubmit .waiting' ).show();
    7575
    76         // Grab the nonce
     76        // Grab the nonce.
    7777        var reply = {};
    7878        reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
    7979
    80         // Get the rest of the data
     80        // Get the rest of the data.
    8181        reply.action    = 'bp-activity-admin-reply';
    8282        reply.content   = $( '#bp-activities' ).val();
     
    8484        reply.root_id   = $( '#bp-activities-container' ).prev().data( 'root_id' );
    8585
    86         // Make the AJAX call
     86        // Make the AJAX call.
    8787        $.ajax({
    8888            data    : reply,
     
    9090            url     : ajaxurl,
    9191
    92             // Callbacks
     92            // Callbacks.
    9393            error   : function( r ) { activityReply.error( r ); },
    9494            success : function( r ) { activityReply.show( r ); }
     
    9999
    100100    /**
    101      * send() error message handler
     101     * send() error message handler.
    102102     *
    103103     * @since 1.6.0
     
    117117
    118118    /**
    119      * send() success handler
     119     * send() success handler.
    120120     *
    121121     * @since 1.6.0
     
    124124        var bg, id, response;
    125125
    126         // Handle any errors in the response
     126        // Handle any errors in the response.
    127127        if ( typeof( xml ) === 'string' ) {
    128128            activityReply.error( { 'responseText': xml } );
     
    140140        $('#bp-activities-container').fadeOut( '200', function () {
    141141
    142             // Empty and unfocus the text area
     142            // Empty and unfocus the text area.
    143143            $( '#bp-activities' ).val( '' ).blur();
    144144
    145             // Remove any error message and disable the spinner
     145            // Remove any error message and disable the spinner.
    146146            $( '#bp-replysubmit .error' ).html( '' ).hide();
    147147            $( '#bp-replysubmit .waiting' ).hide();
    148148
    149             // Insert new activity item
     149            // Insert new activity item.
    150150            $( '#bp-activities-container' ).before( response.data );
    151151
    152             // Get background colour and animate the flash
     152            // Get background colour and animate the flash.
    153153            id = $( '#activity-' + response.id );
    154154            bg = id.closest( '.widefat' ).css( 'backgroundColor' );
     
    159159
    160160$(document).ready( function () {
    161     // Create the Activity reply object after domready event
     161    // Create the Activity reply object after domready event.
    162162    activityReply.init();
    163163
    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.
    165165    $( '#bp_activity_action h3, #bp_activity_content h3' ).unbind( 'click' );
    166166
Note: See TracChangeset for help on using the changeset viewer.