From 02171c7e83561f388d9f10b4c32fd8e29c2f4474 Mon Sep 17 00:00:00 2001 From: Felipe Leon Date: Sun, 28 Jul 2024 09:52:13 -0300 Subject: [PATCH] improve app exit --- app/specific/Main.js | 12 +++++++++--- app/specific/Sidepannel.js | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/app/specific/Main.js b/app/specific/Main.js index 678f239aa..0dc429221 100644 --- a/app/specific/Main.js +++ b/app/specific/Main.js @@ -757,11 +757,12 @@ function Main_setExitDialog() { function Main_showExitDialog() { Main_setExitDialog(); Main_ShowElement('main_dialog_exit'); - Main_addEventListener('keydown', Main_ExitDialog); + Main_PreventClick(true, Main_ExitDialog, true); } function Main_HideExitDialog() { - Main_removeEventListener('keydown', Main_ExitDialog); + Main_PreventClick(false, Main_ExitDialog); + Main_SwitchScreen(); Main_clearExitDialog(); Main_HideElement('main_dialog_exit'); @@ -1213,7 +1214,10 @@ function Main_needUpdate(check_version) { } function Main_UpdateDialogSet() { - if (!Main_Ischecking) Main_UpdateDialogSetTitle(); + if (!Main_Ischecking) { + Main_UpdateDialogSetTitle(); + } + Main_RemoveClass('update_dialog_upbutton', 'button_dialog_focused'); Main_RemoveClass('update_dialog_changebutton', 'button_dialog_focused'); Main_AddClass(!Main_UpdateCursor ? 'update_dialog_upbutton' : 'update_dialog_changebutton', 'button_dialog_focused'); @@ -1858,6 +1862,8 @@ function Main_updateUserFeed() { } function Main_ExitDialog(event) { + event.stopPropagation(); + switch (event.keyCode) { case KEY_KEYBOARD_BACKSPACE: case KEY_RETURN: diff --git a/app/specific/Sidepannel.js b/app/specific/Sidepannel.js index c1d755d45..5a53830dd 100644 --- a/app/specific/Sidepannel.js +++ b/app/specific/Sidepannel.js @@ -431,7 +431,9 @@ function Sidepannel_KeyEnterUser() { Sidepannel_Go(Main_History[Main_HistoryPos]); } else if (Sidepannel_Sidepannel_Pos === 9) { Sidepannel_Go(Main_Blocked); - } else Sidepannel_KeyEnterBase(); + } else { + Sidepannel_KeyEnterBase(); + } } function Sidepannel_KeyEnterBase() { @@ -472,7 +474,9 @@ function Sidepannel_KeyEnter() { return; } - if (Sidepannel_Sidepannel_Pos !== 2 && Sidepannel_Sidepannel_Pos !== 13) Sidepannel_Hide(); + if (Sidepannel_Sidepannel_Pos !== 2) { + Sidepannel_Hide(); + } if (Sidepannel_Sidepannel_Pos === 2) { if (AddUser_IsUserSet()) {