mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-11 06:05:16 +08:00
fixed a bug where the blur would remain when clicking the logo
This commit is contained in:
parent
09df26a42c
commit
fd4e3acffd
1 changed files with 14 additions and 7 deletions
|
@ -3731,24 +3731,31 @@ $("#wordsInput").keypress((event) => {
|
|||
event.preventDefault();
|
||||
});
|
||||
|
||||
let outOfFocusTimeout;
|
||||
let outOfFocusTimeouts = [];
|
||||
|
||||
function clearTimeouts(timeouts) {
|
||||
timeouts.forEach(to => {
|
||||
clearTimeout(to);
|
||||
to = null;
|
||||
})
|
||||
}
|
||||
|
||||
$("#wordsInput").on("focus", (event) => {
|
||||
if (!resultVisible) {
|
||||
$("#words").css("transition","none").removeClass("blurred");
|
||||
$(".outOfFocusWarning").addClass('hidden');
|
||||
clearTimeout(outOfFocusTimeout);
|
||||
clearTimeouts(outOfFocusTimeouts);
|
||||
}
|
||||
showCaret();
|
||||
});
|
||||
|
||||
$("#wordsInput").on("focusout", (event) => {
|
||||
if (!resultVisible) {
|
||||
outOfFocusTimeout = setTimeout(() => {
|
||||
$("#words").css("transition","0.25s").addClass('blurred');
|
||||
$(".outOfFocusWarning").removeClass('hidden');
|
||||
}, 1000)
|
||||
}
|
||||
outOfFocusTimeouts.push(setTimeout(() => {
|
||||
$("#words").css("transition", "0.25s").addClass('blurred');
|
||||
$(".outOfFocusWarning").removeClass('hidden');
|
||||
}, 1000));
|
||||
}
|
||||
hideCaret();
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue