Mercurial Hosting > chat
diff src/chat.js @ 77:624654817f99
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 09 Mar 2025 19:29:41 -0600 |
parents | 4dfe5af67f91 |
children | 2a602ef53eef |
line wrap: on
line diff
--- a/src/chat.js Sun Mar 09 18:45:39 2025 -0600 +++ b/src/chat.js Sun Mar 09 19:29:41 2025 -0600 @@ -148,14 +148,20 @@ } } +function active() { + let url = 'active.js'; + if( currentChatId ) + url += `?chat=${currentChatId}`; + ajax(url); +} + function added(html) { let input = document.querySelector('div[input]'); input.insertAdjacentHTML('beforebegin',html); fixPosts(); input.scrollIntoView({block: 'end'}); - ajax(`added.js?chat=${currentChatId}`); if( document.hasFocus() ) - ajax('active.js'); + active(); } function getChats(chatId,updated) { @@ -191,7 +197,7 @@ window.onfocus = function() { // console.log('onfocus'); document.title = title; - ajax('active.js'); + active(); }; let urlRegex = /(^|\s)(https?:\/\/\S+)/g;