Skip to:
Content

BuddyPress.org

Changeset 10496


Ignore:
Timestamp:
02/02/2016 07:59:24 PM (10 years ago)
Author:
imath
Message:

Make sure the Avatar UI behaves the right way in Microsoft Edge & Chrome

  • Use, if needed, MS Edge specific attribute for the video stream (srcObject).
  • Make sure Plupload Uploader is also ready for MS Edge within the wp-admin/profile screen.
  • Make sure the "Browse" button works the right way in MS Edge.
  • About the Chrome Browser: only load the webcam script if the website is using ssl.

Fixes #6846 (trunk)

props r-a-y, hnla

Location:
trunk/src/bp-core
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-avatars.php

    r10487 r10496  
    19371937 */
    19381938function bp_avatar_use_webcam() {
    1939         global $is_safari, $is_IE;
     1939        global $is_safari, $is_IE, $is_chrome;
    19401940
    19411941        /**
     
    19521952         * @see  http://caniuse.com/#feat=stream
    19531953         */
    1954         if ( $is_safari || $is_IE ) {
     1954        if ( $is_safari || $is_IE || ( $is_chrome && ! is_ssl() ) ) {
    19551955                return false;
    19561956        }
  • trunk/src/bp-core/css/avatar-rtl.css

    r10155 r10496  
    171171}
    172172
    173 .drag-drop-inside p.drag-drop-info {margin-top: 0;}
     173.drag-drop-inside p.drag-drop-info {
     174        margin-top: 0;
     175}
     176
     177@supports (-ms-accelerator:true) {
     178        .drag-drop-inside p.drag-drop-info {
     179                display: block;
     180        }
     181}
    174182
    175183#avatar-to-crop {
  • trunk/src/bp-core/css/avatar.css

    r10155 r10496  
    171171}
    172172
    173 .drag-drop-inside p.drag-drop-info {margin-top: 0;}
     173.drag-drop-inside p.drag-drop-info {
     174        margin-top: 0;
     175}
     176
     177@supports (-ms-accelerator:true) {
     178        .drag-drop-inside p.drag-drop-info {
     179                display: block;
     180        }
     181}
    174182
    175183#avatar-to-crop {
  • trunk/src/bp-core/js/avatar.js

    r10208 r10496  
    1616        bp.Avatar = {
    1717                start: function() {
     18                        var self = this;
     19
    1820                        /**
    1921                         * Remove the bp-legacy UI
     
    4345                        /**
    4446                         * In Administration screens we're using Thickbox
    45                          * We need to make sure to reset the views if it's closed
     47                         * We need to make sure to reset the views if it's closed or opened
    4648                         */
    4749                        $( 'body.wp-admin' ).on( 'tb_unload', '#TB_window', function() {
    48                                 // Reset to the uploader view
    49                                 bp.Avatar.nav.trigger( 'bp-avatar-view:changed', 'upload' );
    50 
    51                                 // Reset to the uploader nav
    52                                 _.each( bp.Avatar.navItems.models, function( model ) {
    53                                         if ( model.id === 'upload' ) {
    54                                                 model.set( { active: 1 } );
    55                                         } else {
    56                                                 model.set( { active: 0 } );
    57                                         }
    58                                 } );
     50                                self.resetViews();
     51                        } );
     52
     53                        $( 'body.wp-admin' ).on( 'click', '.bp-xprofile-avatar-user-edit', function() {
     54                                self.resetViews();
    5955                        } );
    6056                },
     
    121117                                        break;
    122118                        }
     119                },
     120
     121                resetViews: function() {
     122                        // Reset to the uploader view
     123                        this.nav.trigger( 'bp-avatar-view:changed', 'upload' );
     124
     125                        // Reset to the uploader nav
     126                        _.each( this.navItems.models, function( model ) {
     127                                if ( model.id === 'upload' ) {
     128                                        model.set( { active: 1 } );
     129                                } else {
     130                                        model.set( { active: 0 } );
     131                                }
     132                        } );
    123133                },
    124134
  • trunk/src/bp-core/js/webcam.js

    r10017 r10496  
    9090                                video.src = stream;
    9191                                video.play();
     92                        } else if ( video.srcObject !== undefined ) {
     93                                video.srcObject = stream;
    9294                        } else if ( window.URL ) {
    9395                                video.src = window.URL.createObjectURL( stream );
     
    213215
    214216                        if ( navigator.getUserMedia ) {
    215                                 navigator.getUserMedia( { video:true }, bp.WebCam.gotStream, bp.WebCams.noStream );
     217                                navigator.getUserMedia( { video:true }, bp.WebCam.gotStream, bp.WebCam.noStream );
    216218                        }  else if ( navigator.oGetUserMedia ) {
    217219                                navigator.oGetUserMedia( { video:true }, bp.WebCam.gotStream, bp.WebCam.noStream );
Note: See TracChangeset for help on using the changeset viewer.