comparison src/chat.js @ 72:bce0480721c1

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 08 Mar 2025 17:29:57 -0700
parents f067de76084c
children a63faf49e1d7
comparison
equal deleted inserted replaced
71:2206c20e91d2 72:bce0480721c1
243 let old = Date.now() - 70000; 243 let old = Date.now() - 70000;
244 for( let id of Object.keys(online) ) { 244 for( let id of Object.keys(online) ) {
245 if( online[id] < old ) 245 if( online[id] < old )
246 delete online[id]; 246 delete online[id];
247 } 247 }
248 let a = []; 248 let spans = document.querySelectorAll('span[online]');
249 for( let id in online ) { 249 for( let span of spans ) {
250 a.push( `span[online="${id}"]` ); 250 let id = span.getAttribute('online');
251 } 251 span.setAttribute('is_online',!!online[id]);
252 let style = document.querySelector('style[online]');
253 if( a.length === 0 ) {
254 style.innerHTML = '';
255 } else {
256 style.innerHTML = `
257 ${a.join(', ')} {
258 background-color: green;
259 }
260 ` ;
261 } 252 }
262 } 253 }
263 254
264 function clearUnread() { 255 function clearUnread() {
265 let span = document.querySelector(`div[chat="${currentChatId}"] span[unread]`); 256 let span = document.querySelector(`div[chat="${currentChatId}"] span[unread]`);