Mercurial Hosting > chat
diff src/chat.js @ 83:a47036fd0158
group chat
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 11 Mar 2025 13:56:59 -0600 |
parents | a0d3477d5694 |
children | 83fb90276334 |
line wrap: on
line diff
--- a/src/chat.js Mon Mar 10 22:42:46 2025 -0600 +++ b/src/chat.js Tue Mar 11 13:56:59 2025 -0600 @@ -304,7 +304,7 @@ function gotoInvite(el) { let email = document.querySelector('dialog[invite] span[email]').textContent; closeModal(el); - location = `chat?with=${email}`; + location = `chat?with=${encodeURIComponent(email)}`; ajax(`save_post.js?post=${currentPostId}`,`content=${encodeURIComponent(text)}`); } @@ -443,3 +443,20 @@ div.setAttribute('hidden',''); div.setAttribute('reply',''); } + +function openAddToChat() { + let dialog = document.querySelector('dialog[add]'); + dialog.querySelector('input[name=email]').value = ''; + openModal(dialog); +} + +function addToChat() { + let dialog = document.querySelector('dialog[add]'); + let email = dialog.querySelector('input[name=email]').value; + ajax(`add_to_chat.js?chat=${currentChatId}&email=${encodeURIComponent(email)}`); +} + +function addToChatError(msg) { + let dialog = document.querySelector('dialog[add]'); + dialog.querySelector('span[error]').textContent = msg; +}