Make WordPress Core

Ticket #32886: no-timeout.6.diff

File no-timeout.6.diff, 2.2 KB (added by adamsilverstein, 9 years ago)

fine tune

  • src/wp-admin/js/user-profile.js

     
    1717
    1818        function generatePassword() {
    1919                if ( typeof zxcvbn !== 'function' ) {
    20                    setTimeout( generatePassword, 50 );
     20                        setTimeout( generatePassword, 50 );
    2121                } else {
    22                    $pass1.val( $pass1.data( 'pw' ) );
    23                    $pass1.trigger( 'propertychange' );
    24                    $pass1Wrap.addClass( 'show-password' );
     22                        $pass1.val( $pass1.data( 'pw' ) );
     23                        $pass1.trigger( 'pwupdate' );
     24                        $pass1Wrap.addClass( 'show-password' );
    2525                }
    2626        }
    2727
     
    4040                        .addClass( $pass1[0].className )
    4141                        .data( 'pw', $pass1.data( 'pw' ) )
    4242                        .val( $pass1.val() )
    43                         .on( 'input', function () {
    44                                 $pass1.val( $pass1Text.val() ).trigger( 'propertychange' );
     43                        .on( 'input propertychange', function () {
     44                                if ( $pass1Text.val() === currentPass ) {
     45                                        return;
     46                                }
     47
     48                                $pass1.val( $pass1Text.val() ).trigger( 'pwupdate' );
     49                                currentPass = $pass1Text.val();
    4550                        } );
    4651
    4752                $pass1.after( $pass1Text );
     
    5055                        generatePassword();
    5156                }
    5257
    53                 $pass1.on( 'input propertychange', function () {
     58                $pass1.on( 'input propertychange pwupdate', function () {
    5459                        if ( $pass1.val() === currentPass ) {
    5560                                return;
    5661                        }
    57 
    5862                        currentPass = $pass1.val();
    5963                        $pass1Text.val( currentPass );
    6064                        $pass1.add( $pass1Text ).removeClass( 'short bad good strong' );
     
    154158                $pass2 = $('#pass2').on( 'input propertychange', function () {
    155159                        if ( $pass2.val().length > 0 ) {
    156160                                $pass1.val( $pass2.val() );
    157                                 $pass1.trigger( 'propertychange' );
     161                                $pass1.trigger( 'pwupdate' );
    158162                        }
    159163                } );
    160164
     
    228232                var $colorpicker, $stylesheet, user_id, current_user_id,
    229233                        select = $( '#display_name' );
    230234
    231                 $('#pass1').val('').on( 'input propertychange', check_pass_strength );
    232                 $('#pass2').val('').on( 'input propertychange', check_pass_strength );
     235                $('#pass1').val('').on( 'input propertychange pwupdate', check_pass_strength );
    233236                $('#pass-strength-result').show();
    234237                $('.color-palette').click( function() {
    235238                        $(this).siblings('input[name="admin_color"]').prop('checked', true);