comparison src/chat.js @ 48:7628fd0e3560

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 28 Feb 2025 19:59:27 -0700
parents 42b741a1d5c6
children 9298b04607ae
comparison
equal deleted inserted replaced
47:8c6a2f602dbd 48:7628fd0e3560
15 let userEventSource = new EventSource(`${location.origin}/user/${userId}`); 15 let userEventSource = new EventSource(`${location.origin}/user/${userId}`);
16 userEventSource.onmessage = evalEvent; 16 userEventSource.onmessage = evalEvent;
17 } 17 }
18 18
19 function selectChat(div,email) { 19 function selectChat(div,email) {
20 document.querySelector('div[content]').setAttribute('show','posts'); 20 document.querySelector('div[chat_content]').setAttribute('show','posts');
21 let chatId = div.getAttribute('chat'); 21 let chatId = div.getAttribute('chat');
22 if( chatId === currentChatId ) 22 if( chatId === currentChatId )
23 return; 23 return;
24 let selected = div.parentNode.querySelector('[selected]'); 24 let selected = div.parentNode.querySelector('[selected]');
25 if( selected ) selected.removeAttribute('selected'); 25 if( selected ) selected.removeAttribute('selected');
32 eventSource = new EventSource(`${location.origin}/chat/${chatId}`); 32 eventSource = new EventSource(`${location.origin}/chat/${chatId}`);
33 eventSource.onmessage = evalEvent; 33 eventSource.onmessage = evalEvent;
34 } 34 }
35 35
36 function back() { 36 function back() {
37 document.querySelector('div[content]').setAttribute('show','chats'); 37 document.querySelector('div[chat_content]').setAttribute('show','chats');
38 } 38 }
39 39
40 function gotChat(html) { 40 function gotChat(html) {
41 document.querySelector('div[posts]').innerHTML = html; 41 document.querySelector('div[posts]').innerHTML = html;
42 fixPosts(); 42 fixPosts();