From bfa6f0ae84240ab215657d5a79d15d4c95e843dd Mon Sep 17 00:00:00 2001 From: yennanliu Date: Thu, 16 Nov 2023 18:51:58 +0800 Subject: [PATCH] add private chat popup window --- springChatRoom/src/main/resources/static/js/main.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/springChatRoom/src/main/resources/static/js/main.js b/springChatRoom/src/main/resources/static/js/main.js index 028b43c76..c69f4ee6c 100644 --- a/springChatRoom/src/main/resources/static/js/main.js +++ b/springChatRoom/src/main/resources/static/js/main.js @@ -178,6 +178,15 @@ function updateOnlineUsers(users) { function startChat(username) { // Add your logic here to start a private chat with the selected user console.log('>>> Start chat with ' + username); + + // Open a popup window for the chat + const popupWindow = window.open('', '_blank', 'width=400,height=300'); + + // Add your logic to customize the popup window content + popupWindow.document.write('Chat with ' + username + ''); + popupWindow.document.write('

Chat with ' + username + '

'); + popupWindow.document.write('

This is the chat content. Customize it as needed.

'); + popupWindow.document.write(''); } // Call the fetchUserList function to initially populate the user list