Merge pull request #750 from SeerLite/esc-closes-command

Have Escape always close command line/leaderboard
This commit is contained in:
Jack 2020-12-22 17:18:00 +00:00 committed by GitHub
commit ca19b619a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -1766,17 +1766,17 @@ $("#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")) {
} else if (
$("#commandLineWrapper").hasClass("hidden") &&
(event.keyCode == 9 || !config.swapEscAndTab)
) {
if (config.singleListCommandLine == "on")
useSingleListCommandLine(false);
else currentCommands = [commands];

View file

@ -4565,7 +4565,8 @@ function handleTab(event) {
!$(".pageLogin").hasClass("active") &&
!resultCalculating &&
$("#commandLineWrapper").hasClass("hidden") &&
$("#simplePopupWrapper").hasClass("hidden")
$("#simplePopupWrapper").hasClass("hidden") &&
$("#leaderboardsWrapper").hasClass("hidden")
) {
event.preventDefault();
if ($(".pageTest").hasClass("active")) {