From 8679b3e0f5283e66817b489e457ba90357c85368 Mon Sep 17 00:00:00 2001 From: shadedred Date: Fri, 15 Nov 2024 22:52:06 -0800 Subject: [PATCH 1/2] store prelogin message when not logged in --- assets/chat/js/chat.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index 05293cc1..a5bc4dad 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -635,6 +635,13 @@ class Chat { .catch(() => {}); } + setPreLoginText() { + const chatText = ChatStore.read('chat.preLoginText') || ''; + this.input.val(chatText); + ChatStore.remove('chat.preLoginText'); + this.input.focus(); + } + setEmotes(emotes) { this.emoteService.setEmotes(emotes); this.emoteService @@ -1101,6 +1108,7 @@ class Chat { onME(data) { this.setUser(data); + this.setPreLoginText(); if (data) { // If is a logged in user. this.loadSettings(); @@ -1545,6 +1553,7 @@ class Chat { } // LOGIN else if (!this.authenticated) { + ChatStore.write('chat.preLoginText', raw); this.loginscrn.show(); } // WHISPER From ebb7487ab2a31153d6d8df683ba1333a12fbdb11 Mon Sep 17 00:00:00 2001 From: shadedred Date: Sat, 23 Nov 2024 20:34:16 -0800 Subject: [PATCH 2/2] only update input if prelogin present, dont focus --- assets/chat/js/chat.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/chat/js/chat.js b/assets/chat/js/chat.js index a5bc4dad..92609a2c 100644 --- a/assets/chat/js/chat.js +++ b/assets/chat/js/chat.js @@ -636,10 +636,12 @@ class Chat { } setPreLoginText() { - const chatText = ChatStore.read('chat.preLoginText') || ''; + const chatText = ChatStore.read('chat.preLoginText'); + if (chatText === null) { + return; + } this.input.val(chatText); ChatStore.remove('chat.preLoginText'); - this.input.focus(); } setEmotes(emotes) {