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'] );
|
$('#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(){
|
function animate(){
|
||||||
if (shouldAnimate === false)
|
if (shouldAnimate === false)
|
||||||
@ -30,8 +35,7 @@
|
|||||||
$input.val( password.substr(0, $input.val().length + 1) );
|
$input.val( password.substr(0, $input.val().length + 1) );
|
||||||
updateResult();
|
updateResult();
|
||||||
} else {
|
} else {
|
||||||
$input.val('');
|
resetMeter();
|
||||||
$('#pass-strength-result').removeClass('short bad good strong');
|
|
||||||
}
|
}
|
||||||
// Look like real typing by changing the speed new letters are added each time
|
// Look like real typing by changing the speed new letters are added each time
|
||||||
setTimeout(animate, 220 + Math.floor(Math.random() * ( 800 - 220)) );
|
setTimeout(animate, 220 + Math.floor(Math.random() * ( 800 - 220)) );
|
||||||
@ -48,9 +52,7 @@
|
|||||||
// Turn off the animation on focus
|
// Turn off the animation on focus
|
||||||
$input.on('focus', function(){
|
$input.on('focus', function(){
|
||||||
shouldAnimate = false;
|
shouldAnimate = false;
|
||||||
$('#pass-strength-result').removeClass('short bad good strong');
|
resetMeter();
|
||||||
$('#pass-strength-result').text(indicatorString);
|
|
||||||
$input.val('')
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Act like a normal password strength meter
|
// Act like a normal password strength meter
|
||||||
|
Loading…
Reference in New Issue
Block a user