diff src/chat.js @ 34:62d04ca486dd

UI
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 12 Nov 2024 16:08:24 -0700
parents e2b7f6393dab
children 27c41f22d2a9
line wrap: on
line diff
--- a/src/chat.js	Sun Nov 10 19:57:14 2024 -0700
+++ b/src/chat.js	Tue Nov 12 16:08:24 2024 -0700
@@ -26,6 +26,8 @@
 	div.setAttribute('selected','');
 	ajax(`get_chat.js?chat=${chatId}`);
 	currentChatId = chatId;
+	let email = div.querySelector('[email]').textContent;
+	history.replaceState(null,null,`?with=${email}`);
 
 	if(eventSource)  eventSource.close();
 	eventSource = new EventSource(`${location.origin}/chat/${chatId}`);
@@ -212,14 +214,6 @@
 	ajax(`heartbeat.js?last_update=${lastUpdate}`);
 }, 10000 );
 
-function resync(updated) {
-	lastUpdate = updated;
-	currentChatId = null;
-	document.querySelector('div[posts]').innerHTML = '';
-	back();
-	ajax('get_chats.js');
-}
-
 let sound = new Audio('/images/notify.mp3');
 function notify() {
 	sound.play();