Skip to:
Content

BuddyPress.org

Changeset 12548


Ignore:
Timestamp:
01/29/2020 10:04:53 PM (5 years ago)
Author:
imath
Message:

Core: fix JavaScript code standards & typos in inline comments

Props passoniate

Fixes #8230
Fixes #8231
Fixes #8232

Location:
trunk/src/bp-core/js
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/js/avatar.js

    r10496 r12548  
    55( function( exports, $ ) {
    66
    7     // Bail if not set
     7    // Bail if not set.
    88    if ( typeof BP_Uploader === 'undefined' ) {
    99        return;
     
    2626            this.removeLegacyUI();
    2727
    28             // Init some vars
     28            // Init some vars.
    2929            this.views    = new Backbone.Collection();
    3030            this.jcropapi = {};
    3131            this.warning = null;
    3232
    33             // Set up nav
     33            // Set up nav.
    3434            this.setupNav();
    3535
    36             // Avatars are uploaded files
     36            // Avatars are uploaded files.
    3737            this.avatars = bp.Uploader.filesUploaded;
    3838
     
    4040            this.Attachment = new Backbone.Model();
    4141
    42             // Wait till the queue is reset
     42            // Wait till the queue is reset.
    4343            bp.Uploader.filesQueue.on( 'reset', this.cropView, this );
    4444
     
    5757
    5858        removeLegacyUI: function() {
    59             // User
     59            // User.
    6060            if ( $( '#avatar-upload-form' ).length ) {
    6161                $( '#avatar-upload' ).remove();
    6262                $( '#avatar-upload-form p' ).remove();
    6363
    64             // Group Manage
     64            // Group Manage.
    6565            } else if ( $( '#group-settings-form' ).length ) {
    6666                $( '#group-settings-form p' ).each( function( i ) {
     
    7474                }
    7575
    76             // Group Create
     76            // Group Create.
    7777            } else if ( $( '#group-create-body' ).length ) {
    7878                $( '.main-column p #file' ).remove();
    7979                $( '.main-column p #upload' ).remove();
    8080
    81             // Admin Extended Profile
     81            // Admin Extended Profile.
    8282            } else if ( $( '#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin' ).length ) {
    8383                $( '#bp_xprofile_user_admin_avatar a.bp-xprofile-avatar-user-admin' ).remove();
     
    8686
    8787        setView: function( view ) {
    88             // Clear views
     88            // Clear views.
    8989            if ( ! _.isUndefined( this.views.models ) ) {
    9090                _.each( this.views.models, function( model ) {
     
    9393            }
    9494
    95             // Reset Views
     95            // Reset Views.
    9696            this.views.reset();
    9797
    98             // Reset Avatars (file uploaded)
     98            // Reset Avatars (file uploaded).
    9999            if ( ! _.isUndefined( this.avatars ) ) {
    100100                this.avatars.reset();
    101101            }
    102102
    103             // Reset the Jcrop API
     103            // Reset the Jcrop API.
    104104            if ( ! _.isEmpty( this.jcropapi ) ) {
    105105                this.jcropapi.destroy();
     
    107107            }
    108108
    109             // Load the required view
     109            // Load the required view.
    110110            switch ( view ) {
    111111                case 'upload':
     
    120120
    121121        resetViews: function() {
    122             // Reset to the uploader view
     122            // Reset to the uploader view.
    123123            this.nav.trigger( 'bp-avatar-view:changed', 'upload' );
    124124
    125             // Reset to the uploader nav
     125            // Reset to the uploader nav.
    126126            _.each( this.navItems.models, function( model ) {
    127127                if ( model.id === 'upload' ) {
     
    144144                }
    145145
    146                 // Reset active View
     146                // Reset active View.
    147147                activeView = 0;
    148148
     
    164164            this.nav.inject( '.bp-avatar-nav' );
    165165
    166             // Activate the initial view (uploader)
     166            // Activate the initial view (uploader).
    167167            this.setView( initView );
    168168
    169             // Listen to nav changes (it's like a do_action!)
     169            // Listen to nav changes (it's like a do_action!).
    170170            this.nav.on( 'bp-avatar-view:changed', _.bind( this.setView, this ) );
    171171        },
    172172
    173173        uploaderView: function() {
    174             // Listen to the Queued uploads
     174            // Listen to the Queued uploads.
    175175            bp.Uploader.filesQueue.on( 'add', this.uploadProgress, this );
    176176
    177             // Create the BuddyPress Uploader
     177            // Create the BuddyPress Uploader.
    178178            var uploader = new bp.Views.Uploader();
    179179
    180             // Add it to views
     180            // Add it to views.
    181181            this.views.add( { id: 'upload', view: uploader } );
    182182
    183             // Display it
     183            // Display it.
    184184            uploader.inject( '.bp-avatar' );
    185185        },
    186186
    187187        uploadProgress: function() {
    188             // Create the Uploader status view
     188            // Create the Uploader status view.
    189189            var avatarStatus = new bp.Views.uploaderStatus( { collection: bp.Uploader.filesQueue } );
    190190
     
    195195            }
    196196
    197             // Display it
     197            // Display it.
    198198            avatarStatus.inject( '.bp-avatar-status' );
    199199        },
     
    202202            var status;
    203203
    204             // Bail there was an error during the Upload
     204            // Bail there was an error during the Upload.
    205205            if ( _.isEmpty( this.avatars.models ) ) {
    206206                return;
    207207            }
    208208
    209             // Make sure to remove the uploads status
     209            // Make sure to remove the uploads status.
    210210            if ( ! _.isUndefined( this.views.get( 'status' ) ) ) {
    211211                status = this.views.get( 'status' );
     
    214214            }
    215215
    216             // Create the Avatars view
     216            // Create the Avatars view.
    217217            var avatar = new bp.Views.Avatars( { collection: this.avatars } );
    218218            this.views.add( { id: 'crop', view: avatar } );
     
    225225                crop;
    226226
    227             // Remove the crop view
     227            // Remove the crop view.
    228228            if ( ! _.isUndefined( this.views.get( 'crop' ) ) ) {
    229                 // Remove the JCrop API
     229                // Remove the JCrop API.
    230230                if ( ! _.isEmpty( this.jcropapi ) ) {
    231231                    this.jcropapi.destroy();
     
    262262                avatarStatus.inject( '.bp-avatar-status' );
    263263
    264                 // Update each avatars of the page
     264                // Update each avatars of the page.
    265265                $( '.' + avatar.get( 'object' ) + '-' + response.item_id + '-avatar' ).each( function() {
    266266                    $(this).prop( 'src', response.avatar );
    267267                } );
    268268
    269                 // Inject the Delete nav
     269                // Inject the Delete nav.
    270270                bp.Avatar.navItems.get( 'delete' ).set( { hide: 0 } );
    271271
     
    305305
    306306        deleteView:function() {
    307             // Create the delete model
     307            // Create the delete model.
    308308            var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
    309309                'object',
     
    312312            ) );
    313313
    314             // Create the delete view
     314            // Create the delete view.
    315315            var deleteView = new bp.Views.DeleteAvatar( { model: delete_model } );
    316316
    317             // Add it to views
     317            // Add it to views.
    318318            this.views.add( { id: 'delete', view: deleteView } );
    319319
    320             // Display it
     320            // Display it.
    321321            deleteView.inject( '.bp-avatar' );
    322322        },
     
    326326                deleteView;
    327327
    328             // Remove the delete view
     328            // Remove the delete view.
    329329            if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
    330330                deleteView = this.views.get( 'delete' );
     
    352352                avatarStatus.inject( '.bp-avatar-status' );
    353353
    354                 // Update each avatars of the page
     354                // Update each avatars of the page.
    355355                $( '.' + model.get( 'object' ) + '-' + response.item_id + '-avatar').each( function() {
    356356                    $( this ).prop( 'src', response.avatar );
    357357                } );
    358358
    359                 // Remove the Delete nav
     359                // Remove the Delete nav.
    360360                bp.Avatar.navItems.get( 'delete' ).set( { active: 0, hide: 1 } );
    361361
    362362                /**
    363                  * Reset the Attachment object
     363                 * Reset the Attachment object.
    364364                 *
    365365                 * You can run extra actions once the avatar is set using:
     
    411411    };
    412412
    413     // Main Nav view
     413    // Main Nav view.
    414414    bp.Views.Nav = bp.View.extend( {
    415415        tagName:    'ul',
     
    423423            var hasAvatar = _.findWhere( this.collection.models, { id: 'delete' } );
    424424
    425             // Display a message to inform about the delete tab
     425            // Display a message to inform about the delete tab.
    426426            if ( 1 !== hasAvatar.get( 'hide' ) ) {
    427427                bp.Avatar.displayWarning( BP_Uploader.strings.has_avatar_warning );
     
    435435            /**
    436436             * The delete nav is not added if no avatar
    437              * is set for the object
     437             * is set for the object.
    438438             */
    439439            if ( 1 === item.get( 'hide' ) ) {
     
    456456                }
    457457
    458                 // Check to see if the nav is not already rendered
     458                // Check to see if the nav is not already rendered.
    459459                if ( item.get( 'id' ) === view.model.get( 'id' ) ) {
    460460                    isRendered = true;
     
    462462            } );
    463463
    464             // Add the Delete nav if not rendered
     464            // Add the Delete nav if not rendered.
    465465            if ( ! _.isBoolean( isRendered ) ) {
    466466                this.addNavItem( item );
     
    471471            event.preventDefault();
    472472
    473             // First make sure to remove all warnings
     473            // First make sure to remove all warnings.
    474474            bp.Avatar.removeWarning();
    475475
     
    487487    } );
    488488
    489     // Nav item view
     489    // Nav item view.
    490490    bp.Views.NavItem = bp.View.extend( {
    491491        tagName:    'li',
     
    511511    } );
    512512
    513     // Avatars view
     513    // Avatars view.
    514514    bp.Views.Avatars = bp.View.extend( {
    515515        className: 'items',
     
    520520
    521521        addItemView: function( item ) {
    522             // Defaults to 150
     522            // Defaults to 150.
    523523            var full_d = { full_h: 150, full_w: 150 };
    524524
    525             // Make sure to take in account bp_core_avatar_full_height or bp_core_avatar_full_width php filters
     525            // Make sure to take in account bp_core_avatar_full_height or bp_core_avatar_full_width php filters.
    526526            if ( ! _.isUndefined( BP_Uploader.settings.crop.full_h ) && ! _.isUndefined( BP_Uploader.settings.crop.full_w ) ) {
    527527                full_d.full_h = BP_Uploader.settings.crop.full_h;
     
    529529            }
    530530
    531             // Set the avatar model
     531            // Set the avatar model.
    532532            item.set( _.extend( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
    533533                'object',
     
    536536            ), full_d ) );
    537537
    538             // Add the view
     538            // Add the view.
    539539            this.views.add( new bp.Views.Avatar( { model: item } ) );
    540540        }
    541541    } );
    542542
    543     // Avatar view
     543    // Avatar view.
    544544    bp.Views.Avatar = bp.View.extend( {
    545545        className: 'item',
     
    557557            } );
    558558
    559             // Display a warning if the image is smaller than minimum advised
     559            // Display a warning if the image is smaller than minimum advised.
    560560            if ( false !== this.model.get( 'feedback' ) ) {
    561561                bp.Avatar.displayWarning( this.model.get( 'feedback' ) );
     
    601601            }
    602602
    603             // Add the cropping interface
     603            // Add the cropping interface.
    604604            tocrop.Jcrop( {
    605605                onChange: _.bind( self.showPreview, self ),
     
    608608                setSelect: [ crop_left, crop_top, crop_right, crop_bottom ]
    609609            }, function() {
    610                 // Get the Jcrop API
     610                // Get the Jcrop API.
    611611                bp.Avatar.jcropapi = this;
    612612            } );
     
    630630                var ry = fh / coords.h;
    631631
    632                 // Update the model
     632                // Update the model.
    633633                this.model.set( { x: coords.x, y: coords.y, w: coords.w, h: coords.h } );
    634634
     
    644644    } );
    645645
    646     // BuddyPress Avatar Feedback view
     646    // BuddyPress Avatar Feedback view.
    647647    bp.Views.AvatarStatus = bp.View.extend( {
    648648        tagName: 'p',
  • trunk/src/bp-core/js/bp-api-request.js

    r12454 r12548  
    99
    1010( function( wp, bp, $ ) {
    11     // Bail if not set
     11    // Bail if not set.
    1212    if ( typeof bpApiSettings === 'undefined' ) {
    1313        return;
     
    1616    bp.isRestEnabled = true;
    1717
    18     // Polyfill wp.apiRequest if WordPress < 4.9
     18    // Polyfill wp.apiRequest if WordPress < 4.9.
    1919    bp.apiRequest = function( options ) {
    2020        var bpRequest;
  • trunk/src/bp-core/js/bp-plupload.js

    r11727 r12548  
    66( function( exports, $ ) {
    77
    8     // Bail if not set
     8    // Bail if not set.
    99    if ( typeof BP_Uploader === 'undefined' ) {
    1010        return;
     
    1818    _.extend( bp, _.pick( wp, 'Backbone', 'ajax', 'template' ) );
    1919
    20     // Init Models, Collections, Views and the BuddyPress Uploader
     20    // Init Models, Collections, Views and the BuddyPress Uploader.
    2121    bp.Models      = bp.Models || {};
    2222    bp.Collections = bp.Collections || {};
     
    2727     * BuddyPress Uploader.
    2828     *
    29      * This is an adapted version of wp.Uploader
     29     * This is an adapted version of wp.Uploader.
    3030     */
    3131    bp.Uploader.uploader = function() {
     
    4848        }
    4949
    50         // Make sure flash sends cookies (seems in IE it does without switching to urlstream mode)
     50        // Make sure flash sends cookies (seems in IE it does without switching to urlstream mode).
    5151        if ( ! isIE && 'flash' === plupload.predictRuntime( this.params.defaults ) &&
    5252            ( ! this.params.defaults.required_features || ! this.params.defaults.required_features.hasOwnProperty( 'send_binary_string' ) ) ) {
     
    9898        } );
    9999
    100         // See https://core.trac.wordpress.org/ticket/37039
     100        // See https://core.trac.wordpress.org/ticket/37039.
    101101        this.uploader.bind( 'postinit', function( up ) {
    102102            up.refresh();
    103103        });
    104104
    105         // Init BuddyPress Uploader
     105        // Init BuddyPress Uploader.
    106106        this.uploader.init();
    107107
     
    110110         *
    111111         * Add a new message to the errors collection, so it's possible
    112          * to give some feedback to the user
     112         * to give some feedback to the user.
    113113         *
    114114         * @param  {string}        message
     
    141141            /**
    142142             * In case the multiple selection is false (eg: avatar) stop the process and send
    143              * and event containing a warning
     143             * and event containing a warning.
    144144             */
    145145            if ( ! uploader.settings.multi_selection && files.length > 1 ) {
     
    182182
    183183        /**
    184          * Update each file item on progress
     184         * Update each file item on progress.
    185185         *
    186186         * @event UploadProgress
     
    226226            file.item.set( _.extend( response.data, { uploading: false } ) );
    227227
    228             //  Add the file to the Uploaded ones
     228            //  Add the file to the Uploaded ones.
    229229            bp.Uploader.filesUploaded.add( file.item );
    230230
     
    232232
    233233        /**
    234          * Trigger an event to inform a new upload is being processed
    235          *
    236          * Mainly used to remove an eventual warning
     234         * Trigger an event to inform a new upload is being processed.
     235         *
     236         * Mainly used to remove an eventual warning.
    237237         *
    238238         * @event BeforeUpload
     
    245245
    246246        /**
    247          * Reset the filesQueue once the upload is complete
     247         * Reset the filesQueue once the upload is complete.
    248248         *
    249249         * @event BeforeUpload
     
    257257
    258258        /**
    259          * Map Plupload errors & Create a warning when plupload failed
     259         * Map Plupload errors & Create a warning when plupload failed.
    260260         *
    261261         * @event Error
     
    292292    };
    293293
    294     // Create a very generic Model for files
     294    // Create a very generic Model for files.
    295295    bp.Models.File = Backbone.Model.extend( {
    296296        file: {}
    297297    } );
    298298
    299     // Add Collections to store queue, uploaded files and errors
     299    // Add Collections to store queue, uploaded files and errors.
    300300    $.extend( bp.Uploader, {
    301301        filesQueue    : new Backbone.Collection(),
     
    304304    } );
    305305
    306     // Extend wp.Backbone.View with .prepare() and .inject()
     306    // Extend wp.Backbone.View with .prepare() and .inject().
    307307    bp.View = bp.Backbone.View.extend( {
    308308        inject: function( selector ) {
     
    321321    } );
    322322
    323     // BuddyPress Uploader main view
     323    // BuddyPress Uploader main view.
    324324    bp.Views.Uploader = bp.View.extend( {
    325325        className: 'bp-uploader-window',
     
    359359            }
    360360
    361             // Remove all warning views
     361            // Remove all warning views.
    362362            _.each( this.warnings, function( view ) {
    363363                view.remove();
    364364            } );
    365365
    366             // Reset Warnings
     366            // Reset Warnings.
    367367            this.warnings = [];
    368368        }
    369369    } );
    370370
    371     // BuddyPress Uploader warning view
     371    // BuddyPress Uploader warning view.
    372372    bp.Views.uploaderWarning = bp.View.extend( {
    373373        tagName: 'p',
     
    384384    } );
    385385
    386     // BuddyPress Uploader Files view
     386    // BuddyPress Uploader Files view.
    387387    bp.Views.uploaderStatus = bp.View.extend( {
    388388        className: 'files',
     
    411411    } );
    412412
    413     // BuddyPress Uploader File progress view
     413    // BuddyPress Uploader File progress view.
    414414    bp.Views.uploaderProgress = bp.View.extend( {
    415415        className: 'bp-uploader-progress',
  • trunk/src/bp-core/js/cover-image.js

    r10208 r12548  
    55( function( exports, $ ) {
    66
    7     // Bail if not set
     7    // Bail if not set.
    88    if ( typeof BP_Uploader === 'undefined' ) {
    99        return;
     
    1717        start: function() {
    1818
    19             // Init some vars
     19            // Init some vars.
    2020            this.views   = new Backbone.Collection();
    2121            this.warning = null;
     
    2424            this.Attachment = new Backbone.Model();
    2525
    26             // Set up views
     26            // Set up views.
    2727            this.uploaderView();
    2828
    29             // Inform about the needed dimensions
     29            // Inform about the needed dimensions.
    3030            this.displayWarning( BP_Uploader.strings.cover_image_warnings.dimensions );
    3131
    32             // Set up the delete view if needed
     32            // Set up the delete view if needed.
    3333            if ( true === BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image ) {
    3434                this.deleteView();
     
    3737
    3838        uploaderView: function() {
    39             // Listen to the Queued uploads
     39            // Listen to the Queued uploads.
    4040            bp.Uploader.filesQueue.on( 'add', this.uploadProgress, this );
    4141
    42             // Create the BuddyPress Uploader
     42            // Create the BuddyPress Uploader.
    4343            var uploader = new bp.Views.Uploader();
    4444
    45             // Add it to views
     45            // Add it to views.
    4646            this.views.add( { id: 'upload', view: uploader } );
    4747
    48             // Display it
     48            // Display it.
    4949            uploader.inject( '.bp-cover-image' );
    5050        },
    5151
    5252        uploadProgress: function() {
    53             // Create the Uploader status view
     53            // Create the Uploader status view.
    5454            var coverImageUploadProgress = new bp.Views.coverImageUploadProgress( { collection: bp.Uploader.filesQueue } );
    5555
     
    6060            }
    6161
    62             // Display it
     62            // Display it.
    6363            coverImageUploadProgress.inject( '.bp-cover-image-status' );
    6464        },
    6565
    6666        deleteView: function() {
    67             // Create the delete model
     67            // Create the delete model.
    6868            var delete_model = new Backbone.Model( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
    6969                ['object', 'item_id', 'nonces']
     
    7575            }
    7676
    77             // Create the delete view
     77            // Create the delete view.
    7878            var deleteView = new bp.Views.DeleteCoverImage( { model: delete_model } );
    7979
    80             // Add it to views
     80            // Add it to views.
    8181            this.views.add( { id: 'delete', view: deleteView } );
    8282
    83             // Display it
     83            // Display it.
    8484            deleteView.inject( '.bp-cover-image-manage' );
    8585        },
     
    8989                deleteView;
    9090
    91             // Remove the delete view
     91            // Remove the delete view.
    9292            if ( ! _.isUndefined( this.views.get( 'delete' ) ) ) {
    9393                deleteView = this.views.get( 'delete' );
     
    115115                coverImageStatus.inject( '.bp-cover-image-status' );
    116116
    117                 // Reset the header of the page
     117                // Reset the header of the page.
    118118                if ( '' === response.reset_url ) {
    119119                    $( '#header-cover-image' ).css( {
     
    126126                }
    127127
    128                 // Reset the has_cover_image bp_param
     128                // Reset the has_cover_image bp_param.
    129129                BP_Uploader.settings.defaults.multipart_params.bp_params.has_cover_image = false;
    130130
    131131                /**
    132                  * Reset the Attachment object
     132                 * Reset the Attachment object.
    133133                 *
    134134                 * You can run extra actions once the cover image is set using:
     
    183183    };
    184184
    185     // Custom Uploader Files view
     185    // Custom Uploader Files view.
    186186    bp.Views.coverImageUploadProgress = bp.Views.uploaderStatus.extend( {
    187187        className: 'files',
     
    198198            if ( ! _.isUndefined( model.get( 'url' ) ) ) {
    199199
    200                 // Image is too small
     200                // Image is too small.
    201201                if ( 0 === model.get( 'feedback_code' ) ) {
    202202                    message = BP_Uploader.strings.cover_image_warnings.dimensions;
     
    214214                } ) );
    215215
    216                 // Update the header of the page
     216                // Update the header of the page.
    217217                $( '#header-cover-image' ).css( {
    218218                    'background-image': 'url( ' + model.get( 'url' ) + ' )'
    219219                } );
    220220
    221                 // Add the delete view
     221                // Add the delete view.
    222222                bp.CoverImage.deleteView();
    223223
    224224                /**
    225                  * Set the Attachment object
     225                 * Set the Attachment object.
    226226                 *
    227227                 * You can run extra actions once the cover image is set using:
     
    239239    } );
    240240
    241     // BuddyPress Cover Image Feedback view
     241    // BuddyPress Cover Image Feedback view.
    242242    bp.Views.CoverImageStatus = bp.View.extend( {
    243243        tagName: 'p',
     
    256256    } );
    257257
    258     // BuddyPress Cover Image Delete view
     258    // BuddyPress Cover Image Delete view.
    259259    bp.Views.DeleteCoverImage = bp.View.extend( {
    260260        tagName: 'div',
  • trunk/src/bp-core/js/vendor/jquery-cookie.js

    r11009 r12548  
    99 */
    1010(function(factory) {
    11     // AMD
     11    // AMD.
    1212    if (typeof define === 'function' && define.amd) {
    1313        define(['jquery'], factory);
    14     // CommonJS
     14    // CommonJS.
    1515    } else if (typeof exports === 'object') {
    1616        factory(require('jquery'));
    17     // Browser globals
     17    // Browser globals.
    1818    } else {
    1919        factory(jQuery);
     
    5858    var config = $.cookie = function(key, value, options) {
    5959
    60         // Write
     60        // Write.
    6161
    6262        if (value !== undefined && !$.isFunction(value)) {
     
    7777        }
    7878
    79         // Read
     79        // Read.
    8080
    8181        var result = key ? undefined : {};
  • trunk/src/bp-core/js/vendor/jquery-scroll-to.js

    r11009 r12548  
    1313
    1414(function(factory) {
    15     // AMD
     15    // AMD.
    1616    if (typeof define === 'function' && define.amd) {
    1717        define(['jquery'], factory);
    18     // CommonJS
     18    // CommonJS.
    1919    } else if (typeof exports === 'object') {
    2020        factory(require('jquery'));
    21     // Browser globals
     21    // Browser globals.
    2222    } else {
    2323        factory(jQuery);
     
    3636
    3737    // Returns the element that needs to be animated to scroll the window.
    38     // Kept for backwards compatibility (specially for localScroll & serialScroll)
     38    // Kept for backwards compatibility (specially for localScroll & serialScroll).
    3939    $scrollTo.window = function() {
    4040        return $(window)._scrollable();
     
    4242
    4343    // Hack, hack, hack :)
    44     // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
     44    // Returns the real elements to scroll (supports window/iframes, documents and regular nodes).
    4545    $.fn._scrollable = function() {
    4646        return this.map(function() {
     
    7474
    7575        settings = $.extend({}, $scrollTo.defaults, settings);
    76         // Speed is still recognized for backwards compatibility
     76        // Speed is still recognized for backwards compatibility.
    7777        duration = duration || settings.duration;
    78         // Make sure the settings are given right
     78        // Make sure the settings are given right.
    7979        settings.queue = settings.queue && settings.axis.length > 1;
    8080
    81         // Let's keep the overall duration
     81        // Let's keep the overall duration.
    8282        if (settings.queue) {
    8383            duration /= 2;
     
    8989        return this._scrollable().each(function() {
    9090
    91             // Null target yields nothing, just like jQuery does
     91            // Null target yields nothing, just like jQuery does.
    9292            if (target === null) {
    9393                return;
     
    100100
    101101            switch (typeof targ) {
    102                 // A number will pass the regex
     102                // A number will pass the regex.
    103103                case 'number':
    104104                case 'string':
     
    115115                    /* falls through */
    116116                case 'object':
    117                     // DOMElement / jQuery
     117                    // DOMElement / jQuery.
    118118                    if (targ.is || targ.style) {
    119                         // Get the real position of the target
     119                        // Get the real position of the target.
    120120                        toff = (targ = $(targ)).offset();
    121121                    }
     
    131131                        max = $scrollTo.max(elem, axis);
    132132
    133                 if (toff) {// jQuery / DOMElement
     133                if (toff) { // jQuery / DOMElement.
    134134                    attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);
    135135
    136                     // If it's a dom element, reduce the margin
     136                    // If it's a dom element, reduce the margin.
    137137                    if (settings.margin) {
    138138                        attr[key] -= parseInt(targ.css('margin' + Pos)) || 0;
     
    142142                    attr[key] += offset[pos] || 0;
    143143
    144                     // Scroll to a fraction of its width/height
     144                    // Scroll to a fraction of its width/height.
    145145                    if (settings.over[pos]) {
    146146                        attr[key] += targ[axis === 'x' ? 'width' : 'height']() * settings.over[pos];
     
    148148                } else {
    149149                    var val = targ[pos];
    150                     // Handle percentage values
     150                    // Handle percentage values.
    151151                    attr[key] = val.slice && val.slice(-1) === '%' ?
    152152                            parseFloat(val) / 100 * max
     
    154154                }
    155155
    156                 // Number or 'number'
     156                // Number or 'number'.
    157157                if (settings.limit && /^\d+$/.test(attr[key])) {
    158158                    // Check the limits
     
    160160                }
    161161
    162                 // Queueing axes
     162                // Queueing axes.
    163163                if (!i && settings.queue) {
    164164                    // Don't waste time animating, if there's no need.
    165165                    if (old !== attr[key]) {
    166                         // Intermediate animation
     166                        // Intermediate animation.
    167167                        animate(settings.onAfterFirst);
    168168                    }
     
    204204    }
    205205
    206     // AMD requirement
     206    // AMD requirement.
    207207    return $scrollTo;
    208208}));
  • trunk/src/bp-core/js/vendor/jquery.atwho.js

    r11795 r12548  
    77(function (root, factory) {
    88  if (typeof define === 'function' && define.amd) {
    9     // AMD. Register as an anonymous module unless amdModuleId is set
     9    // AMD. Register as an anonymous module unless amdModuleId is set.
    1010    define(["jquery"], function (a0) {
    1111      return (factory(a0));
  • trunk/src/bp-core/js/vendor/jquery.caret.js

    r11795 r12548  
    77  } else if (typeof exports === 'object') {
    88    // Node. Does not work with strict CommonJS, but
    9     // only CommonJS-like enviroments that support module.exports,
     9    // only CommonJS-like environments that support module.exports,
    1010    // like Node.
    1111    module.exports = factory(require("jquery"));
  • trunk/src/bp-core/js/vendor/moment-js/moment.js

    r11190 r12548  
    2929    function isObject(input) {
    3030        // IE8 will treat undefined and null as object if it wasn't for
    31         // input != null
     31        // input != null.
    3232        return input != null && Object.prototype.toString.call(input) === '[object Object]';
    3333    }
     
    3636        var k;
    3737        for (k in obj) {
    38             // even if its not own property I'd still call it non-empty
     38            // Even if its not own property I'd still call it non-empty.
    3939            return false;
    4040        }
     
    225225    var updateInProgress = false;
    226226
    227     // Moment prototype object
     227    // Moment prototype object.
    228228    function Moment(config) {
    229229        copyConfig(this, config);
     
    262262    }
    263263
    264     // compare two arrays, return the number of differences
     264    // Compare two arrays, return the number of differences.
    265265    function compareArrays(array1, array2, dontConvert) {
    266266        var len = Math.min(array1.length, array2.length),
     
    301301                            arg += key + ': ' + arguments[0][key] + ', ';
    302302                        }
    303                         arg = arg.slice(0, -2); // Remove trailing comma and space
     303                        arg = arg.slice(0, -2); // Remove trailing comma and space.
    304304                    } else {
    305305                        arg = arguments[i];
     
    368368                    !hasOwnProp(childConfig, prop) &&
    369369                    isObject(parentConfig[prop])) {
    370                 // make sure changes to properties don't modify parent config
     370                // Make sure changes to properties don't modify parent config.
    371371                res[prop] = extend({}, res[prop]);
    372372            }
     
    544544    }
    545545
    546     // MOMENTS
     546    // MOMENTS.
    547547
    548548    function stringGet (units) {
     
    640640    }
    641641
    642     // format date using native date object
     642    // format date using native date object.
    643643    function formatMoment(m, format) {
    644644        if (!m.isValid()) {
     
    689689    var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
    690690
    691     // any word (or two) characters or numbers including two/three word month in arabic.
    692     // includes scottish gaelic two word and hyphenated months
     691    // Any word (or two) characters or numbers including two/three word month in arabic.
     692    // includes scottish gaelic two word and hyphenated months.
    693693    var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;
    694694
     
    767767    } else {
    768768        indexOf = function (o) {
    769             // I know
     769            // I know.
    770770            var i;
    771771            for (i = 0; i < this.length; ++i) {
     
    782782    }
    783783
    784     // FORMATTING
     784    // FORMATTING.
    785785
    786786    addFormatToken('M', ['MM', 2], 'Mo', function () {
     
    796796    });
    797797
    798     // ALIASES
     798    // ALIASES.
    799799
    800800    addUnitAlias('month', 'M');
    801801
    802     // PRIORITY
     802    // PRIORITY.
    803803
    804804    addUnitPriority('month', 8);
    805805
    806     // PARSING
     806    // PARSING.
    807807
    808808    addRegexToken('M',    match1to2);
     
    821821    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
    822822        var month = config._locale.monthsParse(input, token, config._strict);
    823         // if we didn't find a month name, mark the date as invalid.
     823        // If we didn't find a month name, mark the date as invalid.
    824824        if (month != null) {
    825825            array[MONTH] = month;
     
    829829    });
    830830
    831     // LOCALES
     831    // LOCALES.
    832832
    833833    var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/;
     
    904904        }
    905905
    906         // TODO: add sorting
     906        // TODO: add sorting.
    907907        // Sorting makes sure if one month (or abbr) is a prefix of another
    908         // see sorting in computeMonthsParse
     908        // see sorting in computeMonthsParse.
    909909        for (i = 0; i < 12; i++) {
    910             // make the regex if we don't have it already
     910            // Make the regex if we don't have it already.
    911911            mom = create_utc__createUTC([2000, i]);
    912912            if (strict && !this._longMonthsParse[i]) {
     
    918918                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
    919919            }
    920             // test the regex
     920            // Test the regex.
    921921            if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
    922922                return i;
     
    929929    }
    930930
    931     // MOMENTS
     931    // MOMENTS.
    932932
    933933    function setMonth (mom, value) {
     
    935935
    936936        if (!mom.isValid()) {
    937             // No op
     937            // No op.
    938938            return mom;
    939939        }
     
    10181018            i, mom;
    10191019        for (i = 0; i < 12; i++) {
    1020             // make the regex if we don't have it already
     1020            // Make the regex if we don't have it already.
    10211021            mom = create_utc__createUTC([2000, i]);
    10221022            shortPieces.push(this.monthsShort(mom, ''));
     
    10441044    }
    10451045
    1046     // FORMATTING
     1046    // FORMATTING.
    10471047
    10481048    addFormatToken('Y', 0, 0, function () {
     
    10591059    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
    10601060
    1061     // ALIASES
     1061    // ALIASES.
    10621062
    10631063    addUnitAlias('year', 'y');
    10641064
    1065     // PRIORITIES
     1065    // PRIORITIES.
    10661066
    10671067    addUnitPriority('year', 1);
    10681068
    1069     // PARSING
     1069    // PARSING.
    10701070
    10711071    addRegexToken('Y',      matchSigned);
     
    10861086    });
    10871087
    1088     // HELPERS
     1088    // HELPERS.
    10891089
    10901090    function daysInYear(year) {
     
    10961096    }
    10971097
    1098     // HOOKS
     1098    // HOOKS.
    10991099
    11001100    utils_hooks__hooks.parseTwoDigitYear = function (input) {
     
    11021102    };
    11031103
    1104     // MOMENTS
     1104    // MOMENTS.
    11051105
    11061106    var getSetYear = makeGetSet('FullYear', true);
     
    11111111
    11121112    function createDate (y, m, d, h, M, s, ms) {
    1113         //can't just apply() to create a date:
    1114         //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
     1113        // can't just apply() to create a date:
     1114        // http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
    11151115        var date = new Date(y, m, d, h, M, s, ms);
    11161116
    1117         //the date constructor remaps years 0-99 to 1900-1999
     1117        // The date constructor remaps years 0-99 to 1900-1999.
    11181118        if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
    11191119            date.setFullYear(y);
     
    11251125        var date = new Date(Date.UTC.apply(null, arguments));
    11261126
    1127         //the Date.UTC function remaps years 0-99 to 1900-1999
     1127        // The Date.UTC function remaps years 0-99 to 1900-1999.
    11281128        if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
    11291129            date.setUTCFullYear(y);
     
    11321132    }
    11331133
    1134     // start-of-first-week - start-of-year
     1134    // Start-of-first-week - start-of-year.
    11351135    function firstWeekOffset(year, dow, doy) {
    1136         var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
     1136        var // First-week day -- which January is always in the first week (4 for iso, 1 for other).
    11371137            fwd = 7 + dow - doy,
    1138             // first-week day local weekday -- which local weekday is fwd
     1138            // First-week day local weekday -- which local weekday is fwd.
    11391139            fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
    11401140
     
    11421142    }
    11431143
    1144     //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
     1144    // http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
    11451145    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
    11461146        var localWeekday = (7 + weekday - dow) % 7,
     
    11941194    }
    11951195
    1196     // FORMATTING
     1196    // FORMATTING.
    11971197
    11981198    addFormatToken('w', ['ww', 2], 'wo', 'week');
    11991199    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
    12001200
    1201     // ALIASES
     1201    // ALIASES.
    12021202
    12031203    addUnitAlias('week', 'w');
    12041204    addUnitAlias('isoWeek', 'W');
    12051205
    1206     // PRIORITIES
     1206    // PRIORITIES.
    12071207
    12081208    addUnitPriority('week', 5);
    12091209    addUnitPriority('isoWeek', 5);
    12101210
    1211     // PARSING
     1211    // PARSING.
    12121212
    12131213    addRegexToken('w',  match1to2);
     
    12201220    });
    12211221
    1222     // HELPERS
    1223 
    1224     // LOCALES
     1222    // HELPERS.
     1223
     1224    // LOCALES.
    12251225
    12261226    function localeWeek (mom) {
     
    12411241    }
    12421242
    1243     // MOMENTS
     1243    // MOMENTS.
    12441244
    12451245    function getSetWeek (input) {
     
    12531253    }
    12541254
    1255     // FORMATTING
     1255    // FORMATTING.
    12561256
    12571257    addFormatToken('d', 0, 'do', 'day');
     
    12721272    addFormatToken('E', 0, 0, 'isoWeekday');
    12731273
    1274     // ALIASES
     1274    // ALIASES.
    12751275
    12761276    addUnitAlias('day', 'd');
     
    12781278    addUnitAlias('isoWeekday', 'E');
    12791279
    1280     // PRIORITY
     1280    // PRIORITY.
    12811281    addUnitPriority('day', 11);
    12821282    addUnitPriority('weekday', 11);
    12831283    addUnitPriority('isoWeekday', 11);
    12841284
    1285     // PARSING
     1285    // PARSING.
    12861286
    12871287    addRegexToken('d',    match1to2);
     
    13001300    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
    13011301        var weekday = config._locale.weekdaysParse(input, token, config._strict);
    1302         // if we didn't get a weekday name, mark the date as invalid
     1302        // If we didn't get a weekday name, mark the date as invalid.
    13031303        if (weekday != null) {
    13041304            week.d = weekday;
     
    13121312    });
    13131313
    1314     // HELPERS
     1314    // HELPERS.
    13151315
    13161316    function parseWeekday(input, locale) {
     
    13381338    }
    13391339
    1340     // LOCALES
     1340    // LOCALES.
    13411341
    13421342    var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
     
    14381438
    14391439        for (i = 0; i < 7; i++) {
    1440             // make the regex if we don't have it already
     1440            // Make the regex if we don't have it already.
    14411441
    14421442            mom = create_utc__createUTC([2000, 1]).day(i);
     
    14501450                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
    14511451            }
    1452             // test the regex
     1452            // Test the regex.
    14531453            if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
    14541454                return i;
     
    14631463    }
    14641464
    1465     // MOMENTS
     1465    // MOMENTS.
    14661466
    14671467    function getSetDayOfWeek (input) {
     
    14911491        }
    14921492
    1493         // behaves the same as moment#day except
     1493        // Behaves the same as moment#day except
    14941494        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
    14951495        // as a setter, sunday should belong to the previous week.
     
    16051605    }
    16061606
    1607     // FORMATTING
     1607    // FORMATTING.
    16081608
    16091609    function hFormat() {
     
    16461646    meridiem('A', false);
    16471647
    1648     // ALIASES
     1648    // ALIASES.
    16491649
    16501650    addUnitAlias('hour', 'h');
    16511651
    1652     // PRIORITY
     1652    // PRIORITY.
    16531653    addUnitPriority('hour', 13);
    16541654
    1655     // PARSING
     1655    // PARSING.
    16561656
    16571657    function matchMeridiem (isStrict, locale) {
     
    17071707    });
    17081708
    1709     // LOCALES
     1709    // LOCALES.
    17101710
    17111711    function localeIsPM (input) {
     
    17251725
    17261726
    1727     // MOMENTS
     1727    // MOMENTS.
    17281728
    17291729    // Setting the hour should keep the time, because the user explicitly
     
    17531753    };
    17541754
    1755     // internal storage for locale config files
     1755    // Internal storage for locale config files.
    17561756    var locales = {};
    17571757    var globalLocale;
     
    17611761    }
    17621762
    1763     // pick the locale from the array
     1763    // Pick the locale from the array
    17641764    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
    17651765    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
     
    17781778                }
    17791779                if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
    1780                     //the next array item is better than a shallower substring of this one
     1780                    // The next array item is better than a shallower substring of this one.
    17811781                    break;
    17821782                }
     
    17901790    function loadLocale(name) {
    17911791        var oldLocale = null;
    1792         // TODO: Find a better way to register and load all the locales in Node
     1792        // TODO: Find a better way to register and load all the locales in Node.
    17931793        if (!locales[name] && (typeof module !== 'undefined') &&
    17941794                module && module.exports) {
     
    17961796                oldLocale = globalLocale._abbr;
    17971797                require('./locale/' + name);
    1798                 // because defineLocale currently also sets the global locale, we
    1799                 // want to undo that for lazy loaded locales
     1798                // Because defineLocale currently also sets the global locale, we
     1799                // want to undo that for lazy loaded locales.
    18001800                locale_locales__getSetGlobalLocale(oldLocale);
    18011801            } catch (e) { }
     
    18411841                    parentConfig = locales[config.parentLocale]._config;
    18421842                } else {
    1843                     // treat as if there is no base config
     1843                    // Treat as if there is no base config.
    18441844                    deprecateSimple('parentLocaleUndefined',
    18451845                            'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/');
     
    18481848            locales[name] = new Locale(mergeConfigs(parentConfig, config));
    18491849
    1850             // backwards compat for now: also set the locale
     1850            // backwards compat for now: also set the locale.
    18511851            locale_locales__getSetGlobalLocale(name);
    18521852
    18531853            return locales[name];
    18541854        } else {
    1855             // useful for testing
     1855            // Useful for testing.
    18561856            delete locales[name];
    18571857            return null;
     
    18621862        if (config != null) {
    18631863            var locale, parentConfig = baseConfig;
    1864             // MERGE
     1864            // MERGE.
    18651865            if (locales[name] != null) {
    18661866                parentConfig = locales[name]._config;
     
    18711871            locales[name] = locale;
    18721872
    1873             // backwards compat for now: also set the locale
     1873            // Backwards compat for now: also set the locale.
    18741874            locale_locales__getSetGlobalLocale(name);
    18751875        } else {
    1876             // pass null for config to unupdate, useful for tests
     1876            // Pass null for config to unupdate, useful for tests.
    18771877            if (locales[name] != null) {
    18781878                if (locales[name].parentLocale != null) {
     
    18861886    }
    18871887
    1888     // returns locale data
     1888    // Returns locale data.
    18891889    function locale_locales__getLocale (key) {
    18901890        var locale;
     
    18991899
    19001900        if (!isArray(key)) {
    1901             //short-circuit everything else
     1901            // Short-circuit everything else.
    19021902            locale = loadLocale(key);
    19031903            if (locale) {
     
    19601960        ['YYYYYYMMDD', /[+-]\d{10}/],
    19611961        ['YYYYMMDD', /\d{8}/],
    1962         // YYYYMM is NOT allowed by the standard
     1962        // YYYYMM is NOT allowed by the standard.
    19631963        ['GGGG[W]WWE', /\d{4}W\d{3}/],
    19641964        ['GGGG[W]WW', /\d{4}W\d{2}/, false],
     
    19661966    ];
    19671967
    1968     // iso time formats and regexes
     1968    // Iso time formats and regexes.
    19691969    var isoTimes = [
    19701970        ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
     
    19811981    var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
    19821982
    1983     // date from iso format
     1983    // Date from iso format.
    19841984    function configFromISO(config) {
    19851985        var i, l,
     
    20342034    }
    20352035
    2036     // date from iso format or fallback
     2036    // Date from iso format or fallback.
    20372037    function configFromString(config) {
    20382038        var matched = aspNetJsonRegex.exec(config._i);
     
    20802080    }
    20812081
    2082     // convert an array to a date.
     2082    // Convert an array to a date.
    20832083    // the array should mirror the parameters below
    20842084    // note: all values past the year are optional and will default to the lowest possible value.
    2085     // [year, month, day , hour, minute, second, millisecond]
     2085    // [year, month, day , hour, minute, second, millisecond].
    20862086    function configFromArray (config) {
    20872087        var i, date, input = [], currentDate, yearToUse;
     
    20932093        currentDate = currentDateArray(config);
    20942094
    2095         //compute day of the year from weeks and weekdays
     2095        // Compute day of the year from weeks and weekdays.
    20962096        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
    20972097            dayOfYearFromWeekInfo(config);
    20982098        }
    20992099
    2100         //if the day of the year is set, figure out what it is
     2100        // If the day of the year is set, figure out what it is.
    21012101        if (config._dayOfYear) {
    21022102            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
     
    21202120        }
    21212121
    2122         // Zero out whatever was not defaulted, including time
     2122        // Zero out whatever was not defaulted, including time.
    21232123        for (; i < 7; i++) {
    21242124            config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
     
    21722172
    21732173            if (w.d != null) {
    2174                 // weekday -- low day numbers are considered next week
     2174                // Weekday -- low day numbers are considered next week.
    21752175                weekday = w.d;
    21762176                if (weekday < 0 || weekday > 6) {
     
    21782178                }
    21792179            } else if (w.e != null) {
    2180                 // local weekday -- counting starts from begining of week
     2180                // Local weekday -- counting starts from beginning of week.
    21812181                weekday = w.e + dow;
    21822182                if (w.e < 0 || w.e > 6) {
     
    21842184                }
    21852185            } else {
    2186                 // default to begining of week
     2186                // Default to beginning of week.
    21872187                weekday = dow;
    21882188            }
     
    21992199    }
    22002200
    2201     // constant that refers to the ISO standard
     2201    // Constant that refers to the ISO standard.
    22022202    utils_hooks__hooks.ISO_8601 = function () {};
    22032203
    2204     // date from string and format string
     2204    // Date from string and format string.
    22052205    function configFromStringAndFormat(config) {
    2206         // TODO: Move this to another part of the creation flow to prevent circular deps
     2206        // TODO: Move this to another part of the creation flow to prevent circular deps.
    22072207        if (config._f === utils_hooks__hooks.ISO_8601) {
    22082208            configFromISO(config);
     
    22132213        getParsingFlags(config).empty = true;
    22142214
    2215         // This array is used to make a Date, either with `new Date` or `Date.UTC`
     2215        // This array is used to make a Date, either with `new Date` or `Date.UTC`.
    22162216        var string = '' + config._i,
    22172217            i, parsedInput, tokens, token, skipped,
     
    22242224            token = tokens[i];
    22252225            parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
    2226             // console.log('token', token, 'parsedInput', parsedInput,
     2226            // Console.log('token', token, 'parsedInput', parsedInput,
    22272227            //         'regex', getParseRegexForToken(token, config));
    22282228            if (parsedInput) {
     
    22342234                totalParsedInputLength += parsedInput.length;
    22352235            }
    2236             // don't parse if it's not a known token
     2236            // Don't parse if it's not a known token.
    22372237            if (formatTokenFunctions[token]) {
    22382238                if (parsedInput) {
     
    22492249        }
    22502250
    2251         // add remaining unparsed input length to the string
     2251        // Add remaining unparsed input length to the string.
    22522252        getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
    22532253        if (string.length > 0) {
     
    22552255        }
    22562256
    2257         // clear _12h flag if hour is <= 12
     2257        // Clear _12h flag if hour is <= 12.
    22582258        if (config._a[HOUR] <= 12 &&
    22592259            getParsingFlags(config).bigHour === true &&
     
    22762276
    22772277        if (meridiem == null) {
    2278             // nothing to do
     2278            // Nothing to do.
    22792279            return hour;
    22802280        }
     
    22822282            return locale.meridiemHour(hour, meridiem);
    22832283        } else if (locale.isPM != null) {
    2284             // Fallback
     2284            // Fallback.
    22852285            isPm = locale.isPM(meridiem);
    22862286            if (isPm && hour < 12) {
     
    22922292            return hour;
    22932293        } else {
    2294             // this is not supposed to happen
     2294            // This is not supposed to happen.
    22952295            return hour;
    22962296        }
    22972297    }
    22982298
    2299     // date from string and array of format strings
     2299    // Date from string and array of format strings.
    23002300    function configFromStringAndArray(config) {
    23012301        var tempConfig,
     
    23252325            }
    23262326
    2327             // if there is any input that was not parsed add a penalty for that format
     2327            // If there is any input that was not parsed add a penalty for that format.
    23282328            currentScore += getParsingFlags(tempConfig).charsLeftOver;
    23292329
    2330             //or tokens
     2330            // Or tokens.
    23312331            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
    23322332
     
    23582358        var res = new Moment(checkOverflow(prepareConfig(config)));
    23592359        if (res._nextDay) {
    2360             // Adding is smart enough around DST
     2360            // Adding is smart enough around DST.
    23612361            res.add(1, 'd');
    23622362            res._nextDay = undefined;
     
    24342434            input = undefined;
    24352435        }
    2436         // object construction must be done this way.
     2436        // Object construction must be done this way.
    24372437        // https://github.com/moment/moment/issues/1423
    24382438        c._isAMomentObject = true;
     
    25252525            milliseconds = normalizedInput.millisecond || 0;
    25262526
    2527         // representation for dateAddRemove
     2527        // Representation for dateAddRemove.
    25282528        this._milliseconds = +milliseconds +
    25292529            seconds * 1e3 + // 1000
    25302530            minutes * 6e4 + // 1000 * 60
    2531             hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
     2531            hours * 1000 * 60 * 60; // Using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
    25322532        // Because of dateAddRemove treats 24 hours as different from a
    2533         // day when working around DST, we need to store them separately
     2533        // day when working around DST, we need to store them separately.
    25342534        this._days = +days +
    25352535            weeks * 7;
     
    25602560    }
    25612561
    2562     // FORMATTING
     2562    // FORMATTING.
    25632563
    25642564    function offset (token, separator) {
     
    25772577    offset('ZZ', '');
    25782578
    2579     // PARSING
     2579    // PARSING.
    25802580
    25812581    addRegexToken('Z',  matchShortOffset);
     
    25862586    });
    25872587
    2588     // HELPERS
    2589 
    2590     // timezone chunker
     2588    // HELPERS.
     2589
     2590    // Timezone chunker
    25912591    // '+10:00' > ['10',  '00']
    2592     // '-1530'  > ['-15', '30']
     2592    // '-1530'  > ['-15', '30'].
    25932593    var chunkOffset = /([\+\-]|\d\d)/gi;
    25942594
     
    27702770    }
    27712771
    2772     // ASP.NET json date format regex
     2772    // ASP.NET json date format regex.
    27732773    var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
    27742774
    27752775    // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
    27762776    // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
    2777     // and further modified to allow for strings containing both week and day
     2777    // and further modified to allow for strings containing both week and day.
    27782778    var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
    27792779
    27802780    function create__createDuration (input, key) {
    27812781        var duration = input,
    2782             // matching against regexp is expensive, do it on demand
     2782            // Matching against regexp is expensive, do it on demand.
    27832783            match = null,
    27842784            sign,
     
    28072807                m  : toInt(match[MINUTE])                       * sign,
    28082808                s  : toInt(match[SECOND])                       * sign,
    2809                 ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
     2809                ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // The millisecond decimal point is included in the match.
    28102810            };
    28112811        } else if (!!(match = isoRegex.exec(input))) {
     
    28202820                s : parseIso(match[8], sign)
    28212821            };
    2822         } else if (duration == null) {// checks for null or undefined
     2822        } else if (duration == null) { // Checks for null or undefined.
    28232823            duration = {};
    28242824        } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
     
    28462846        // inp may be undefined, so careful calling replace on it.
    28472847        var res = inp && parseFloat(inp.replace(',', '.'));
    2848         // apply sign while we're at it
     2848        // Apply sign while we're at it.
    28492849        return (isNaN(res) ? 0 : res) * sign;
    28502850    }
     
    28822882    }
    28832883
    2884     // TODO: remove 'name' arg after deprecation is removed
     2884    // TODO: remove 'name' arg after deprecation is removed.
    28852885    function createAdder(direction, name) {
    28862886        return function (val, period) {
    28872887            var dur, tmp;
    2888             //invert the arguments, but complain about it
     2888            // Invert the arguments, but complain about it.
    28892889            if (period !== null && !isNaN(+period)) {
    28902890                deprecateSimple(name, 'moment().' + name  + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
     
    29062906
    29072907        if (!mom.isValid()) {
    2908             // No op
     2908            // No op.
    29092909            return;
    29102910        }
     
    30493049
    30503050    function monthDiff (a, b) {
    3051         // difference in months
     3051        // Difference in months.
    30523052        var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
    3053             // b is in (anchor - 1 month, anchor + 1 month)
     3053            // B is in (anchor - 1 month, anchor + 1 month).
    30543054            anchor = a.clone().add(wholeMonthDiff, 'months'),
    30553055            anchor2, adjust;
     
    30573057        if (b - anchor < 0) {
    30583058            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
    3059             // linear across the month
     3059            // linear across the month.
    30603060            adjust = (b - anchor) / (anchor - anchor2);
    30613061        } else {
    30623062            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
    3063             // linear across the month
     3063            // linear across the month.
    30643064            adjust = (b - anchor) / (anchor2 - anchor);
    30653065        }
    30663066
    3067         //check for negative zero, return zero if negative zero
     3067        // Check for negative zero, return zero if negative zero.
    30683068        return -(wholeMonthDiff + adjust) || 0;
    30693069    }
     
    30803080        if (0 < m.year() && m.year() <= 9999) {
    30813081            if (isFunction(Date.prototype.toISOString)) {
    3082                 // native implementation is ~50x faster, use it when we can
     3082                // Native implementation is ~50x faster, use it when we can.
    30833083                return this.toDate().toISOString();
    30843084            } else {
     
    31603160    function startOf (units) {
    31613161        units = normalizeUnits(units);
    3162         // the following switch intentionally omits break keywords
     3162        // The following switch intentionally omits break keywords
    31633163        // to utilize falling through the cases.
    31643164        switch (units) {
     
    31863186        }
    31873187
    3188         // weeks are a special case
     3188        // Weeks are a special case.
    31893189        if (units === 'week') {
    31903190            this.weekday(0);
     
    31943194        }
    31953195
    3196         // quarters are also special
     3196        // Quarters are also special.
    31973197        if (units === 'quarter') {
    31983198            this.month(Math.floor(this.month() / 3) * 3);
     
    32473247
    32483248    function toJSON () {
    3249         // new Date(NaN).toJSON() === null
     3249        // New Date(NaN).toJSON() === null.
    32503250        return this.isValid() ? this.toISOString() : null;
    32513251    }
     
    32733273    }
    32743274
    3275     // FORMATTING
     3275    // FORMATTING.
    32763276
    32773277    addFormatToken(0, ['gg', 2], 0, function () {
     
    32923292    addWeekYearFormatToken('GGGGG', 'isoWeekYear');
    32933293
    3294     // ALIASES
     3294    // ALIASES.
    32953295
    32963296    addUnitAlias('weekYear', 'gg');
    32973297    addUnitAlias('isoWeekYear', 'GG');
    32983298
    3299     // PRIORITY
     3299    // PRIORITY.
    33003300
    33013301    addUnitPriority('weekYear', 1);
     
    33033303
    33043304
    3305     // PARSING
     3305    // PARSING.
    33063306
    33073307    addRegexToken('G',      matchSigned);
     
    33223322    });
    33233323
    3324     // MOMENTS
     3324    // MOMENTS.
    33253325
    33263326    function getSetWeekYear (input) {
     
    33703370    }
    33713371
    3372     // FORMATTING
     3372    // FORMATTING.
    33733373
    33743374    addFormatToken('Q', 0, 'Qo', 'quarter');
    33753375
    3376     // ALIASES
     3376    // ALIASES.
    33773377
    33783378    addUnitAlias('quarter', 'Q');
    33793379
    3380     // PRIORITY
     3380    // PRIORITY.
    33813381
    33823382    addUnitPriority('quarter', 7);
    33833383
    3384     // PARSING
     3384    // PARSING.
    33853385
    33863386    addRegexToken('Q', match1);
     
    33893389    });
    33903390
    3391     // MOMENTS
     3391    // MOMENTS.
    33923392
    33933393    function getSetQuarter (input) {
     
    33953395    }
    33963396
    3397     // FORMATTING
     3397    // FORMATTING.
    33983398
    33993399    addFormatToken('D', ['DD', 2], 'Do', 'date');
    34003400
    3401     // ALIASES
     3401    // ALIASES.
    34023402
    34033403    addUnitAlias('date', 'D');
    34043404
    3405     // PRIOROITY
     3405    // PRIOROITY.
    34063406    addUnitPriority('date', 9);
    34073407
    3408     // PARSING
     3408    // PARSING.
    34093409
    34103410    addRegexToken('D',  match1to2);
     
    34193419    });
    34203420
    3421     // MOMENTS
     3421    // MOMENTS.
    34223422
    34233423    var getSetDayOfMonth = makeGetSet('Date', true);
    34243424
    3425     // FORMATTING
     3425    // FORMATTING.
    34263426
    34273427    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
    34283428
    3429     // ALIASES
     3429    // ALIASES.
    34303430
    34313431    addUnitAlias('dayOfYear', 'DDD');
    34323432
    3433     // PRIORITY
     3433    // PRIORITY.
    34343434    addUnitPriority('dayOfYear', 4);
    34353435
    3436     // PARSING
     3436    // PARSING.
    34373437
    34383438    addRegexToken('DDD',  match1to3);
     
    34423442    });
    34433443
    3444     // HELPERS
    3445 
    3446     // MOMENTS
     3444    // HELPERS.
     3445
     3446    // MOMENTS.
    34473447
    34483448    function getSetDayOfYear (input) {
     
    34513451    }
    34523452
    3453     // FORMATTING
     3453    // FORMATTING.
    34543454
    34553455    addFormatToken('m', ['mm', 2], 0, 'minute');
    34563456
    3457     // ALIASES
     3457    // ALIASES.
    34583458
    34593459    addUnitAlias('minute', 'm');
    34603460
    3461     // PRIORITY
     3461    // PRIORITY.
    34623462
    34633463    addUnitPriority('minute', 14);
    34643464
    3465     // PARSING
     3465    // PARSING.
    34663466
    34673467    addRegexToken('m',  match1to2);
     
    34693469    addParseToken(['m', 'mm'], MINUTE);
    34703470
    3471     // MOMENTS
     3471    // MOMENTS.
    34723472
    34733473    var getSetMinute = makeGetSet('Minutes', false);
    34743474
    3475     // FORMATTING
     3475    // FORMATTING.
    34763476
    34773477    addFormatToken('s', ['ss', 2], 0, 'second');
    34783478
    3479     // ALIASES
     3479    // ALIASES.
    34803480
    34813481    addUnitAlias('second', 's');
    34823482
    3483     // PRIORITY
     3483    // PRIORITY.
    34843484
    34853485    addUnitPriority('second', 15);
    34863486
    3487     // PARSING
     3487    // PARSING.
    34883488
    34893489    addRegexToken('s',  match1to2);
     
    34913491    addParseToken(['s', 'ss'], SECOND);
    34923492
    3493     // MOMENTS
     3493    // MOMENTS.
    34943494
    34953495    var getSetSecond = makeGetSet('Seconds', false);
    34963496
    3497     // FORMATTING
     3497    // FORMATTING.
    34983498
    34993499    addFormatToken('S', 0, 0, function () {
     
    35263526
    35273527
    3528     // ALIASES
     3528    // ALIASES.
    35293529
    35303530    addUnitAlias('millisecond', 'ms');
    35313531
    3532     // PRIORITY
     3532    // PRIORITY.
    35333533
    35343534    addUnitPriority('millisecond', 16);
    35353535
    3536     // PARSING
     3536    // PARSING.
    35373537
    35383538    addRegexToken('S',    match1to3, match1);
     
    35523552        addParseToken(token, parseMs);
    35533553    }
    3554     // MOMENTS
     3554    // MOMENTS.
    35553555
    35563556    var getSetMillisecond = makeGetSet('Milliseconds', false);
    35573557
    3558     // FORMATTING
     3558    // FORMATTING.
    35593559
    35603560    addFormatToken('z',  0, 0, 'zoneAbbr');
    35613561    addFormatToken('zz', 0, 0, 'zoneName');
    35623562
    3563     // MOMENTS
     3563    // MOMENTS.
    35643564
    35653565    function getZoneAbbr () {
     
    36113611    momentPrototype__proto.creationData      = creationData;
    36123612
    3613     // Year
     3613    // Year.
    36143614    momentPrototype__proto.year       = getSetYear;
    36153615    momentPrototype__proto.isLeapYear = getIsLeapYear;
    36163616
    3617     // Week Year
     3617    // Week Year.
    36183618    momentPrototype__proto.weekYear    = getSetWeekYear;
    36193619    momentPrototype__proto.isoWeekYear = getSetISOWeekYear;
    36203620
    3621     // Quarter
     3621    // Quarter.
    36223622    momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;
    36233623
    3624     // Month
     3624    // Month.
    36253625    momentPrototype__proto.month       = getSetMonth;
    36263626    momentPrototype__proto.daysInMonth = getDaysInMonth;
    36273627
    3628     // Week
     3628    // Week.
    36293629    momentPrototype__proto.week           = momentPrototype__proto.weeks        = getSetWeek;
    36303630    momentPrototype__proto.isoWeek        = momentPrototype__proto.isoWeeks     = getSetISOWeek;
     
    36323632    momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;
    36333633
    3634     // Day
     3634    // Day.
    36353635    momentPrototype__proto.date       = getSetDayOfMonth;
    36363636    momentPrototype__proto.day        = momentPrototype__proto.days             = getSetDayOfWeek;
     
    36393639    momentPrototype__proto.dayOfYear  = getSetDayOfYear;
    36403640
    3641     // Hour
     3641    // Hour.
    36423642    momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;
    36433643
    3644     // Minute
     3644    // Minute.
    36453645    momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;
    36463646
    3647     // Second
     3647    // Second.
    36483648    momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;
    36493649
    3650     // Millisecond
     3650    // Millisecond.
    36513651    momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;
    36523652
    3653     // Offset
     3653    // Offset.
    36543654    momentPrototype__proto.utcOffset            = getSetOffset;
    36553655    momentPrototype__proto.utc                  = setOffsetToUTC;
     
    36633663    momentPrototype__proto.isUTC                = isUtc;
    36643664
    3665     // Timezone
     3665    // Timezone.
    36663666    momentPrototype__proto.zoneAbbr = getZoneAbbr;
    36673667    momentPrototype__proto.zoneName = getZoneName;
    36683668
    3669     // Deprecations
     3669    // Deprecations.
    36703670    momentPrototype__proto.dates  = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
    36713671    momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
     
    37003700    prototype__proto.set             = locale_set__set;
    37013701
    3702     // Month
     3702    // Month.
    37033703    prototype__proto.months            =        localeMonths;
    37043704    prototype__proto.monthsShort       =        localeMonthsShort;
     
    37073707    prototype__proto.monthsShortRegex  = monthsShortRegex;
    37083708
    3709     // Week
     3709    // Week.
    37103710    prototype__proto.week = localeWeek;
    37113711    prototype__proto.firstDayOfYear = localeFirstDayOfYear;
    37123712    prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;
    37133713
    3714     // Day of Week
     3714    // Day of Week.
    37153715    prototype__proto.weekdays       =        localeWeekdays;
    37163716    prototype__proto.weekdaysMin    =        localeWeekdaysMin;
     
    37223722    prototype__proto.weekdaysMinRegex    =        weekdaysMinRegex;
    37233723
    3724     // Hours
     3724    // Hours.
    37253725    prototype__proto.isPM = localeIsPM;
    37263726    prototype__proto.meridiem = localeMeridiem;
     
    38283828    });
    38293829
    3830     // Side effect imports
     3830    // Side effect imports.
    38313831    utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
    38323832    utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);
     
    38613861    }
    38623862
    3863     // supports only 2.0-style add(1, 's') or add(duration)
     3863    // Supports only 2.0-style add(1, 's') or add(duration).
    38643864    function duration_add_subtract__add (input, value) {
    38653865        return duration_add_subtract__addSubtract(this, input, value, 1);
    38663866    }
    38673867
    3868     // supports only 2.0-style subtract(1, 's') or subtract(duration)
     3868    // Supports only 2.0-style subtract(1, 's') or subtract(duration).
    38693869    function duration_add_subtract__subtract (input, value) {
    38703870        return duration_add_subtract__addSubtract(this, input, value, -1);
     
    38863886        var seconds, minutes, hours, years, monthsFromDays;
    38873887
    3888         // if we have a mix of positive and negative values, bubble down first
    3889         // check: https://github.com/moment/moment/issues/2166
     3888        // If we have a mix of positive and negative values, bubble down first
     3889        // check: https://github.com/moment/moment/issues/2166.
    38903890        if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
    38913891                (milliseconds <= 0 && days <= 0 && months <= 0))) {
     
    39103910        days += absFloor(hours / 24);
    39113911
    3912         // convert days to months
     3912        // Convert days to months.
    39133913        monthsFromDays = absFloor(daysToMonths(days));
    39143914        months += monthsFromDays;
    39153915        days -= absCeil(monthsToDays(monthsFromDays));
    39163916
    3917         // 12 months -> 1 year
     3917        // 12 months -> 1 year.
    39183918        years = absFloor(months / 12);
    39193919        months %= 12;
     
    39283928    function daysToMonths (days) {
    39293929        // 400 years have 146097 days (taking into account leap year rules)
    3930         // 400 years have 12 months === 4800
     3930        // 400 years have 12 months === 4800.
    39313931        return days * 4800 / 146097;
    39323932    }
    39333933
    39343934    function monthsToDays (months) {
    3935         // the reverse of daysToMonths
     3935        // The reverse of daysToMonths.
    39363936        return months * 146097 / 4800;
    39373937    }
     
    39493949            return units === 'month' ? months : months / 12;
    39503950        } else {
    3951             // handle milliseconds separately because of floating point math errors (issue #1867)
     3951            // Handle milliseconds separately because of floating point math errors (issue #1867).
    39523952            days = this._days + Math.round(monthsToDays(this._months));
    39533953            switch (units) {
     
    39573957                case 'minute' : return days * 1440  + milliseconds / 6e4;
    39583958                case 'second' : return days * 86400 + milliseconds / 1000;
    3959                 // Math.floor prevents floating point math errors here
     3959                // Math.floor prevents floating point math errors here.
    39603960                case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
    39613961                default: throw new Error('Unknown unit ' + units);
     
    40144014    var round = Math.round;
    40154015    var thresholds = {
    4016         s: 45,  // seconds to minute
    4017         m: 45,  // minutes to hour
    4018         h: 22,  // hours to day
    4019         d: 26,  // days to month
    4020         M: 11   // months to year
     4016        s: 45,  // Seconds to minute.
     4017        m: 45,  // Minutes to hour.
     4018        h: 22,  // Hours to day.
     4019        d: 26,  // Days to month.
     4020        M: 11   // Months to year.
    40214021    };
    40224022
    4023     // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
     4023    // Helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize.
    40244024    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
    40254025        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
     
    40524052    }
    40534053
    4054     // This function allows you to set the rounding function for relative time strings
     4054    // This function allows you to set the rounding function for relative time strings.
    40554055    function duration_humanize__getSetRelativeTimeRounding (roundingFunction) {
    40564056        if (roundingFunction === undefined) {
     
    40644064    }
    40654065
    4066     // This function allows you to set a threshold for relative time strings
     4066    // This function allows you to set a threshold for relative time strings.
    40674067    function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
    40684068        if (thresholds[threshold] === undefined) {
     
    40934093        //  * milliseconds bubble up until they become hours
    40944094        //  * days do not bubble at all
    4095         //  * months bubble up until they become years
     4095        //  * months bubble up until they become years.
    40964096        // This is because there is no context-free conversion between hours and days
    40974097        // (think of clock changes)
    4098         // and also not between days and months (28-31 days per month)
     4098        // and also not between days and months (28-31 days per month).
    40994099        var seconds = iso_string__abs(this._milliseconds) / 1000;
    41004100        var days         = iso_string__abs(this._days);
     
    41024102        var minutes, hours, years;
    41034103
    4104         // 3600 seconds -> 60 minutes -> 1 hour
     4104        // 3600 seconds -> 60 minutes -> 1 hour.
    41054105        minutes           = absFloor(seconds / 60);
    41064106        hours             = absFloor(minutes / 60);
     
    41084108        minutes %= 60;
    41094109
    4110         // 12 months -> 1 year
     4110        // 12 months -> 1 year.
    41114111        years  = absFloor(months / 12);
    41124112        months %= 12;
    41134113
    41144114
    4115         // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
     4115        // Inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
    41164116        var Y = years;
    41174117        var M = months;
     
    41234123
    41244124        if (!total) {
    4125             // this is the same as C#'s (Noda) and python (isodate)...
    4126             // but not other JS (goog.date)
     4125            // This is the same as C#'s (Noda) and python (isodate)...
     4126            // but not other JS (goog.date).
    41274127            return 'P0D';
    41284128        }
     
    41714171    duration_prototype__proto.localeData     = localeData;
    41724172
    4173     // Deprecations
     4173    // Deprecations.
    41744174    duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
    41754175    duration_prototype__proto.lang = lang;
    41764176
    4177     // Side effect imports
    4178 
    4179     // FORMATTING
     4177    // Side effect imports.
     4178
     4179    // FORMATTING.
    41804180
    41814181    addFormatToken('X', 0, 0, 'unix');
    41824182    addFormatToken('x', 0, 0, 'valueOf');
    41834183
    4184     // PARSING
     4184    // PARSING.
    41854185
    41864186    addRegexToken('x', matchSigned);
     
    41934193    });
    41944194
    4195     // Side effect imports
     4195    // Side effect imports.
    41964196
    41974197
  • trunk/src/bp-core/js/webcam.js

    r11944 r12548  
    55( function() {
    66
    7     // Bail if not set
     7    // Bail if not set.
    88    if ( typeof BP_Uploader === 'undefined' ) {
    99        return;
     
    3131        setView: function( view ) {
    3232            if ( 'camera' !== view ) {
    33                 // Stop the camera if needed
     33                // Stop the camera if needed.
    3434                if ( ! _.isNull( this.params.video ) ) {
    3535                    this.stop();
    3636
    37                     // Remove all warnings as we're changing the view
     37                    // Remove all warnings as we're changing the view.
    3838                    this.removeWarning();
    3939                }
    4040
    41                 // Stop as this is not Camera area
    42                 return;
    43             }
    44 
    45             // Create the WebCam view
     41                // Stop as this is not Camera area.
     42                return;
     43            }
     44
     45            // Create the WebCam view.
    4646            var cameraView = new bp.Views.WebCamAvatar( { model: new Backbone.Model( { user_media: false } ) } );
    4747
    48             // Make sure the flipped param is reset
     48            // Make sure the flipped param is reset.
    4949            this.params.flipped = false;
    5050
    51             // Add it to views
     51            // Add it to views.
    5252            bp.Avatar.views.add( { id: 'camera', view: cameraView } );
    5353
    54             // Display it
     54            // Display it.
    5555            cameraView.inject( '.bp-avatar' );
    5656        },
     
    7070            bp.WebCam.params.videoStream = stream;
    7171
    72             // User Feedback
     72            // User Feedback.
    7373            bp.WebCam.displayWarning( 'loaded' );
    7474
    7575            video.onerror = function () {
    76                 // User Feedback
     76                // User Feedback.
    7777                bp.WebCam.displayWarning( 'videoerror' );
    7878
     
    8484            stream.onended = bp.WebCam.noStream();
    8585
    86             // Older browsers may not have srcObject
     86            // Older browsers may not have srcObject.
    8787            if ( 'srcObject' in video ) {
    8888                video.srcObject = stream;
     
    122122        noStream: function() {
    123123            if ( _.isNull( bp.WebCam.params.videoStream ) ) {
    124                 // User Feedback
     124                // User Feedback.
    125125                bp.WebCam.displayWarning( 'noaccess' );
    126126
     
    134134            }
    135135
    136             // Remove the view
     136            // Remove the view.
    137137            bp.WebCam.removeView();
    138138
     
    157157    };
    158158
    159     // BuddyPress WebCam view
     159    // BuddyPress WebCam view.
    160160    bp.Views.WebCamAvatar = bp.View.extend( {
    161161        tagName: 'div',
     
    181181
    182182            if ( typeof navigator.getUserMedia !== 'undefined' ) {
    183                 // We need to add some cropping stuff to use bp.Avatar.setAvatar()
     183                // We need to add some cropping stuff to use bp.Avatar.setAvatar().
    184184                params = _.extend( _.pick( BP_Uploader.settings.defaults.multipart_params.bp_params,
    185185                    'object',
     
    217217            bp.WebCam.params.canvas = this.options.canvas.el;
    218218
    219             // User Feedback
     219            // User Feedback.
    220220            bp.WebCam.displayWarning( 'requesting' );
    221221
     
    235235                // ES3 compatibility.
    236236                ['catch'](function() {
    237                     // User Feedback
     237                    // User Feedback.
    238238                    bp.WebCam.displayWarning( 'errormsg' );
    239239                });
     
    246246
    247247            if ( ! bp.WebCam.params.capture_enable ) {
    248                 // User Feedback
     248                // User Feedback.
    249249                bp.WebCam.displayWarning( 'loading' );
    250250                return;
     
    256256            }
    257257
    258             // Set the offset
     258            // Set the offset.
    259259            sc = this.options.video.el.videoHeight;
    260260            sx = ( this.options.video.el.videoWidth - sc ) / 2;
     
    271271            this.model.set( 'url', bp.WebCam.params.capture );
    272272
    273             // User Feedback
     273            // User Feedback.
    274274            bp.WebCam.displayWarning( 'ready' );
    275275        },
     
    279279
    280280            if ( ! bp.WebCam.params.capture ) {
    281                 // User Feedback
     281                // User Feedback.
    282282                bp.WebCam.displayWarning( 'nocapture' );
    283283                return;
     
    289289    } );
    290290
    291     // BuddyPress Video stream view
     291    // BuddyPress Video stream view.
    292292    bp.Views.WebCamVideo = bp.View.extend( {
    293293        tagName: 'video',
     
    298298    } );
    299299
    300     // BuddyPress Canvas (capture) view
     300    // BuddyPress Canvas (capture) view.
    301301    bp.Views.WebCamCanvas = bp.View.extend( {
    302302        tagName: 'canvas',
     
    308308
    309309        initialize: function() {
    310             // Make sure to take in account bp_core_avatar_full_height or bp_core_avatar_full_width php filters
     310            // Make sure to take in account bp_core_avatar_full_height or bp_core_avatar_full_width php filters.
    311311            if ( ! _.isUndefined( BP_Uploader.settings.crop.full_h ) && ! _.isUndefined( BP_Uploader.settings.crop.full_w ) ) {
    312312                this.el.attributes.width.value  = BP_Uploader.settings.crop.full_w;
Note: See TracChangeset for help on using the changeset viewer.