From 662cce8c6cb9e45bc65897502bb0f4e74c6cea33 Mon Sep 17 00:00:00 2001 From: RossAsscends <124905043+RossAscends@users.noreply.github.com> Date: Fri, 24 Mar 2023 15:21:06 +0900 Subject: [PATCH] cleaned up process of post-chat deletion handling not a smart solution, but it works without error --- public/script.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/public/script.js b/public/script.js index 7b5c71357..f8d0e65e3 100644 --- a/public/script.js +++ b/public/script.js @@ -702,8 +702,22 @@ async function delChat(chatfile) { }), }); if (response.ok === true) { + //close past chat popup + $("#select_chat_cross").click(); + + //this is a copy of what 'start new chat' does, just without the popup and confirmation + //not an ideal solution, and needs to be smarter clearChat(); + chat.length = 0; + characters[this_chid].chat = name2 + " - " + humanizedDateTime(); + $("#selected_chat_pole").val(characters[this_chid].chat); + saveCharacterDebounced(); getChat(); + + //open the history view again after 100ms + setTimeout(function () { $("#option_select_chat").click() }, 100); + //hide option popup menu + $("#options").hide(); } } @@ -3229,9 +3243,9 @@ $(document).ready(function () { bg_file_for_del.parent().remove(); } if (popup_type == "del_chat") { - $("#select_chat_cross").click(); + delChat(chat_file_for_del); - $("#option_select_chat").click(); + } if (popup_type == "del_ch") { console.log(