Skip to:
Content

BuddyPress.org

Changeset 12526


Ignore:
Timestamp:
01/18/2020 11:42:35 AM (5 years ago)
Author:
imath
Message:

Nouveau: fix JS Code standards in inline comments

Props passoniate

Fixes #8214

Location:
trunk/src/bp-templates/bp-nouveau/js
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-nouveau.js

    r12447 r12526  
    88( function( exports, $ ) {
    99
    10     // Bail if not set
     10    // Bail if not set.
    1111    if ( typeof BP_Nouveau === 'undefined' ) {
    1212        return;
     
    2424        start: function() {
    2525
    26             // Setup globals
     26            // Setup globals.
    2727            this.setupGlobals();
    2828
    29             // Adjust Document/Forms properties
     29            // Adjust Document/Forms properties.
    3030            this.prepareDocument();
    3131
    32             // Init the BuddyPress objects
     32            // Init the BuddyPress objects.
    3333            this.initObjects();
    3434
    35             // Set BuddyPress HeartBeat
     35            // Set BuddyPress HeartBeat.
    3636            this.setHeartBeat();
    3737
    38             // Listen to events ("Add hooks!")
     38            // Listen to events ("Add hooks!").
    3939            this.addListeners();
    4040        },
     
    4747            this.ajax_request           = null;
    4848
    49             // Object Globals
     49            // Object Globals.
    5050            this.objects                = $.map( BP_Nouveau.objects, function( value ) { return value; } );
    5151            this.objectNavParent        = BP_Nouveau.object_nav_parent;
    5252
    53             // HeartBeat Global
     53            // HeartBeat Global.
    5454            this.heartbeat              = wp.heartbeat || {};
    5555
    56             // An object containing each query var
     56            // An object containing each query var.
    5757            this.querystring            = this.getLinkParams();
    5858        },
     
    6464        prepareDocument: function() {
    6565
    66             // Remove the no-js class and add the js one
     66            // Remove the no-js class and add the js one.
    6767            if ( $( 'body' ).hasClass( 'no-js' ) ) {
    6868                $('body').removeClass( 'no-js' ).addClass( 'js' );
    6969            }
    7070
    71             // Log Warnings into the console instead of the screen
     71            // Log Warnings into the console instead of the screen.
    7272            if ( BP_Nouveau.warnings && 'undefined' !== typeof console && console.warn ) {
    7373                $.each( BP_Nouveau.warnings, function( w, warning ) {
     
    7676            }
    7777
    78             // Remove the directory title if there's a widget containing it
     78            // Remove the directory title if there's a widget containing it.
    7979            if ( $( '.buddypress_object_nav .widget-title' ).length ) {
    8080                var text = $( '.buddypress_object_nav .widget-title' ).html();
     
    124124                delete store[ property ];
    125125            } else {
    126                 // Set property
     126                // Set property.
    127127                store[ property ] = value;
    128128            }
     
    166166         *
    167167         * @param  {string} qv    The query variable to decode.
    168          * @param  {object} chars The specific characters to use. Optionnal.
     168         * @param  {object} chars The specific characters to use. Optional.
    169169         * @return {string}       The URL decoded variable.
    170170         */
     
    194194            }
    195195
    196             // Extend posted data with stored data and object nonce
     196            // Extend posted data with stored data and object nonce.
    197197            var postData = $.extend( {}, bp.Nouveau.getStorage( 'bp-' + object ), { nonce: BP_Nouveau.nonces[object] }, post_data );
    198198
     
    255255            }, data );
    256256
    257             // Do not request if we don't have the object or the target to inject results into
     257            // Do not request if we don't have the object or the target to inject results into.
    258258            if ( ! data.object || ! data.target ) {
    259259                return;
    260260            }
    261261
    262             // Prepare the search terms for the request
     262            // Prepare the search terms for the request.
    263263            if ( data.search_terms ) {
    264264                data.search_terms = data.search_terms.replace( /</g, '&lt;' ).replace( />/g, '&gt;' );
    265265            }
    266266
    267             // Set session's data
     267            // Set session's data.
    268268            if ( null !== data.scope ) {
    269269                this.setStorage( 'bp-' + data.object, 'scope', data.scope );
     
    353353                }
    354354
    355                 // Notifications always need to start with Newest ones
     355                // Notifications always need to start with Newest ones.
    356356                if ( undefined !== objectData.extras && 'notifications' !== object ) {
    357357                    extras = objectData.extras;
     
    375375                }
    376376
    377                 // Check the querystring to eventually include the search terms
     377                // Check the querystring to eventually include the search terms.
    378378                if ( null !== self.querystring ) {
    379379                    if ( undefined !== self.querystring[ object + '_search'] ) {
     
    398398                    };
    399399
    400                     // Populate the object list
     400                    // Populate the object list.
    401401                    self.objectRequest( queryData );
    402402                }
     
    414414            this.heartbeat.interval( Number( BP_Nouveau.pulse ) );
    415415
    416             // Extend "send" with BuddyPress namespace
     416            // Extend "send" with BuddyPress namespace.
    417417            $.fn.extend( {
    418418                'heartbeat-send': function() {
     
    421421            } );
    422422
    423             // Extend "tick" with BuddyPress namespace
     423            // Extend "tick" with BuddyPress namespace.
    424424            $.fn.extend( {
    425425                'heartbeat-tick': function() {
     
    435435         */
    436436        addListeners: function() {
    437             // Disabled inputs
     437            // Disabled inputs.
    438438            $( '[data-bp-disable-input]' ).on( 'change', this.toggleDisabledInput );
    439439
    440             // HeartBeat Send and Receive
     440            // HeartBeat Send and Receive.
    441441            $( document ).on( 'heartbeat-send.buddypress', this.heartbeatSend );
    442442            $( document ).on( 'heartbeat-tick.buddypress', this.heartbeatTick );
    443443
    444             // Refreshing
     444            // Refreshing.
    445445            $( this.objectNavParent + ' .bp-navs' ).on( 'click', 'a', this, this.scopeQuery );
    446446
    447             // Filtering
     447            // Filtering.
    448448            $( '#buddypress [data-bp-filter]' ).on( 'change', this, this.filterQuery );
    449449
    450             // Searching
     450            // Searching.
    451451            $( '#buddypress [data-bp-search]' ).on( 'submit', 'form', this, this.searchQuery );
    452452            $( '#buddypress [data-bp-search] form' ).on( 'search', 'input[type=search]', this.resetSearch );
    453453
    454             // Buttons
     454            // Buttons.
    455455            $( '#buddypress [data-bp-list], #buddypress #item-header' ).on( 'click', '[data-bp-btn-action]', this, this.buttonAction );
    456456
    457             // Close notice
     457            // Close notice.
    458458            $( '#buddypress [data-bp-close]' ).on( 'click', this, this.closeNotice );
    459459
    460             // Pagination
     460            // Pagination.
    461461            $( '#buddypress [data-bp-list]' ).on( 'click', '[data-bp-pagination] a', this, this.paginateAction );
    462462        },
     
    495495         */
    496496        heartbeatSend: function( event, data ) {
    497             // Add an heartbeat send event to possibly any BuddyPress pages
     497            // Add an heartbeat send event to possibly any BuddyPress pages.
    498498            $( '#buddypress' ).trigger( 'bp_heartbeat_send', data );
    499499        },
     
    506506         */
    507507        heartbeatTick: function( event, data ) {
    508             // Add an heartbeat send event to possibly any BuddyPress pages
     508            // Add an heartbeat send event to possibly any BuddyPress pages.
    509509            $( '#buddypress' ).trigger( 'bp_heartbeat_tick', data );
    510510        },
     
    530530            }
    531531
    532             // Stop event propagation
     532            // Stop event propagation.
    533533            event.preventDefault();
    534534
     
    539539            }
    540540
    541             // Remove the New count on dynamic tabs
     541            // Remove the New count on dynamic tabs.
    542542            if ( target.hasClass( 'dynamic' ) ) {
    543543                target.find( 'a span' ).html('');
     
    597597            }
    598598
    599             // Stop event propagation
     599            // Stop event propagation.
    600600            event.preventDefault();
    601601
     
    653653                object = item.data( 'bp-item-component' ), nonce = '';
    654654
    655             // Simply let the event fire if we don't have needed values
     655            // Simply let the event fire if we don't have needed values.
    656656            if ( ! action || ! item_id || ! object ) {
    657657                return event;
    658658            }
    659659
    660             // Stop event propagation
     660            // Stop event propagation.
    661661            event.preventDefault();
    662662
     
    691691            }
    692692
    693             // Add a pending class to prevent queries while we're processing the action
     693            // Add a pending class to prevent queries while we're processing the action.
    694694            target.addClass( 'pending loading' );
    695695
     
    704704                    item.find( '.bp-feedback' ).fadeOut( 6000 );
    705705                } else {
    706                     // Specific cases for groups
     706                    // Specific cases for groups.
    707707                    if ( 'groups' === object ) {
    708708
    709                         // Group's header button
     709                        // Group's header button.
    710710                        if ( undefined !== response.data.is_group && response.data.is_group ) {
    711711                            return window.location.reload();
     
    713713                    }
    714714
    715                     // User's groups invitations screen & User's friend screens
     715                    // User's groups invitations screen & User's friend screens.
    716716                    if ( undefined !== response.data.is_user && response.data.is_user ) {
    717717                        target.parent().html( response.data.feedback );
     
    720720                    }
    721721
    722                     // Update count
     722                    // Update count.
    723723                    if ( $( self.objectNavParent + ' [data-bp-scope="personal"]' ).length ) {
    724724                        var personal_count = Number( $( self.objectNavParent + ' [data-bp-scope="personal"] span' ).html() ) || 0;
     
    752752            event.preventDefault();
    753753
    754             // Make sure cookies are removed
     754            // Make sure cookies are removed.
    755755            if ( 'clear' === closeBtn.data( 'bp-close' ) ) {
    756756                if ( undefined !== $.cookie( 'bp-message' ) ) {
     
    771771            }
    772772
    773             // Remove the notice
     773            // Remove the notice.
    774774            closeBtn.closest( '.bp-feedback' ).remove();
    775775        },
     
    789789            object = $( event.delegateTarget ).data( 'bp-list' ) || null;
    790790
    791             // Set the scope & filter
     791            // Set the scope & filter.
    792792            if ( null !== object ) {
    793793                objectData = self.getStorage( 'bp-' + object );
     
    806806            }
    807807
    808             // Set the search terms
     808            // Set the search terms.
    809809            if ( $( '#buddypress [data-bp-search="' + object + '"] input[type=search]' ).length ) {
    810810                search_terms = $( '#buddypress [data-bp-search="' + object + '"] input[type=search]' ).val();
     
    820820            };
    821821
    822             // Request the page
     822            // Request the page.
    823823            self.objectRequest( queryData );
    824824        }
    825825    };
    826826
    827     // Launch BP Nouveau
     827    // Launch BP Nouveau.
    828828    bp.Nouveau.start();
    829829
  • trunk/src/bp-templates/bp-nouveau/js/buddypress-xprofile.js

    r12082 r12526  
    55( function( exports, $ ) {
    66
    7     // Bail if not set
     7    // Bail if not set.
    88    if ( typeof BP_Nouveau === 'undefined' ) {
    99        return;
     
    1818    /** Profile Visibility Settings *********************************/
    1919
    20     // Initially hide the 'field-visibility-settings' block
     20    // Initially hide the 'field-visibility-settings' block.
    2121    $( '.field-visibility-settings' ).addClass( 'bp-hide' );
    22     // Add initial aria state to button
     22    // Add initial aria state to button.
    2323    $( '.visibility-toggle-link' ).attr( 'aria-expanded', 'false' );
    2424
  • trunk/src/bp-templates/bp-nouveau/js/customizer.js

    r12197 r12526  
    1313            userFrontPage  = wp.customize.control( 'user_front_page' );
    1414
    15         // If the Main Group setting is disabled, hide all others
     15        // If the Main Group setting is disabled, hide all others.
    1616        if ( 'undefined' !== typeof groupFrontPage ) {
    1717            $( groupFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) {
     
    3030        }
    3131
    32         // If the Main User setting is disabled, hide all others
     32        // If the Main User setting is disabled, hide all others.
    3333        if ( 'undefined' !== typeof userFrontPage ) {
    3434            $( userFrontPage.selector ).on( 'click', 'input[type=checkbox]', function( event ) {
  • trunk/src/bp-templates/bp-nouveau/js/password-verify.js

    r12397 r12526  
    1515            strength;
    1616
    17         // Reset classes and result text
     17        // Reset classes and result text.
    1818        $( '#pass-strength-result' ).removeClass( 'show mismatch short bad good strong' );
    1919        if ( ! pass1 ) {
     
    4343    }
    4444
    45     // Bind check_pass_strength to keyup events in the password fields
     45    // Bind check_pass_strength to keyup events in the password fields.
    4646    $( document ).ready( function() {
    4747        $( '.password-entry' ).val( '' ).keyup( check_pass_strength );
Note: See TracChangeset for help on using the changeset viewer.