WordPress.org

Make WordPress Core

Ticket #25603: 25603.11.diff

File 25603.11.diff, 1.5 KB (added by jorbin, 6 years ago)
  • src/wp-admin/js/about.js

     
    2222                $('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
    2323        }
    2424    }
     25    function resetMeter(){
     26        $input.val('');
     27        $('#pass-strength-result').text(indicatorString);
     28        $('#pass-strength-result').removeClass('short bad good strong');
     29    }
    2530
    2631    function animate(){
    2732        if (shouldAnimate === false)
     
    3035            $input.val( password.substr(0, $input.val().length + 1) );
    3136            updateResult();
    3237        } else {
    33             $input.val('');
    34                     $('#pass-strength-result').removeClass('short bad good strong');
     38            resetMeter();
    3539        }
    3640        // Look like real typing by changing the speed new letters are added each time
    3741        setTimeout(animate, 220 + Math.floor(Math.random() * ( 800 - 220)) );
     
    4852    // Turn off the animation on focus
    4953    $input.on('focus', function(){
    5054        shouldAnimate = false;
    51         $('#pass-strength-result').removeClass('short bad good strong');
    52         $('#pass-strength-result').text(indicatorString);
    53         $input.val('')
     55        resetMeter();
    5456    });
    5557
    5658    // Act like a normal password strength meter
     
    6163    // Start the animation
    6264    begin();
    6365
    64 })(jQuery);
    65  No newline at end of file
     66})(jQuery);