About page: Prevent the meter from briefly sticking on 'Strong' when the animation resets.
props jorbin. see #25603. git-svn-id: https://develop.svn.wordpress.org/trunk@25848 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c85914b57e
commit
278b180b2f
@ -22,6 +22,11 @@
|
||||
$('#pass-strength-result').addClass('short').html( pwsL10n['short'] );
|
||||
}
|
||||
}
|
||||
function resetMeter(){
|
||||
$input.val('');
|
||||
$('#pass-strength-result').text(indicatorString);
|
||||
$('#pass-strength-result').removeClass('short bad good strong');
|
||||
}
|
||||
|
||||
function animate(){
|
||||
if (shouldAnimate === false)
|
||||
@ -30,8 +35,7 @@
|
||||
$input.val( password.substr(0, $input.val().length + 1) );
|
||||
updateResult();
|
||||
} else {
|
||||
$input.val('');
|
||||
$('#pass-strength-result').removeClass('short bad good strong');
|
||||
resetMeter();
|
||||
}
|
||||
// Look like real typing by changing the speed new letters are added each time
|
||||
setTimeout(animate, 220 + Math.floor(Math.random() * ( 800 - 220)) );
|
||||
@ -48,9 +52,7 @@
|
||||
// Turn off the animation on focus
|
||||
$input.on('focus', function(){
|
||||
shouldAnimate = false;
|
||||
$('#pass-strength-result').removeClass('short bad good strong');
|
||||
$('#pass-strength-result').text(indicatorString);
|
||||
$input.val('')
|
||||
resetMeter();
|
||||
});
|
||||
|
||||
// Act like a normal password strength meter
|
||||
|
Loading…
Reference in New Issue
Block a user