Have Escape always close command line/leaderboard

This commit is contained in:
SeerLite 2020-12-21 18:54:23 -03:00
parent b5d5a18984
commit cd2761029e
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")) {