Mercurial Hosting > chat
comparison src/chat.js @ 88:7b339b1ccd11
add tools/users.html
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 13 Mar 2025 16:18:39 -0600 |
parents | 83fb90276334 |
children | 3053a4fc10be |
comparison
equal
deleted
inserted
replaced
87:246a792adedf | 88:7b339b1ccd11 |
---|---|
351 uploadToFilebin(file.name,reader.result); | 351 uploadToFilebin(file.name,reader.result); |
352 }; | 352 }; |
353 reader.readAsArrayBuffer(file); | 353 reader.readAsArrayBuffer(file); |
354 } | 354 } |
355 | 355 |
356 let times = [ | |
357 { | |
358 time: 1000*60*60*24, | |
359 unit: 'day' | |
360 }, | |
361 { | |
362 time: 1000*60*60, | |
363 unit: 'hour' | |
364 }, | |
365 { | |
366 time: 1000*60, | |
367 unit: 'minute' | |
368 } | |
369 ]; | |
370 | |
371 function ago(time) { | |
372 for( let t of times ) { | |
373 let n = Math.floor(time / t.time); | |
374 if( n > 0 ) { | |
375 let s = `${n} ${t.unit}`; | |
376 if( n > 1 ) | |
377 s = s + 's'; | |
378 return s + ' ago'; | |
379 } | |
380 } | |
381 return 'just now'; | |
382 end | |
383 } | |
384 | |
385 function openPeople() { | 356 function openPeople() { |
386 let dialog = document.querySelector('dialog[people]'); | 357 let dialog = document.querySelector('dialog[people]'); |
387 let spans = dialog.querySelectorAll('span[last_seen]'); | 358 let spans = dialog.querySelectorAll('span[last_seen]'); |
388 let now = Date.now(); | 359 let now = Date.now(); |
389 let old = now - 70000; | 360 let old = now - 70000; |