mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-11 08:14:11 +08:00
Have Esc always close commandline/leaderboards
This commit is contained in:
parent
139337fb5a
commit
1b2e50f8d6
1 changed files with 7 additions and 11 deletions
|
@ -1770,22 +1770,13 @@ $("#commandLine input").keyup((e) => {
|
|||
$(document).ready((e) => {
|
||||
$(document).keydown((event) => {
|
||||
//escape
|
||||
if (
|
||||
(event.keyCode == 27 && !config.swapEscAndTab) ||
|
||||
(event["keyCode"] == 9 && config.swapEscAndTab)
|
||||
) {
|
||||
if (event.keyCode == 27 || (event.keyCode == 9 && config.swapEscAndTab)) {
|
||||
event.preventDefault();
|
||||
if (!$("#leaderboardsWrapper").hasClass("hidden")) {
|
||||
//maybe add more condition for closing other dialogs in the future as well
|
||||
event.preventDefault();
|
||||
hideLeaderboards();
|
||||
return;
|
||||
} else if ($("#commandLineWrapper").hasClass("hidden")) {
|
||||
if (config.singleListCommandLine == "on")
|
||||
useSingleListCommandLine(false);
|
||||
else currentCommands = [commands];
|
||||
showCommandLine();
|
||||
} else {
|
||||
} else if (!$("#commandLineWrapper").hasClass("hidden")) {
|
||||
if (currentCommands.length > 1) {
|
||||
currentCommands.pop();
|
||||
$("#commandLine").removeClass("allCommands");
|
||||
|
@ -1799,6 +1790,11 @@ $(document).ready((e) => {
|
|||
} else {
|
||||
setTheme(config.theme);
|
||||
}
|
||||
} else if (event.keyCode == 9 || !config.swapEscAndTab) {
|
||||
if (config.singleListCommandLine == "on")
|
||||
useSingleListCommandLine(false);
|
||||
else currentCommands = [commands];
|
||||
showCommandLine();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue