Mercurial Hosting > chat
diff src/chat.js @ 23:c54c806fcc6e
add delete_post
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 05 Nov 2024 16:09:10 -0700 |
parents | 949914955bfe |
children | af41be2dcdec |
line wrap: on
line diff
--- a/src/chat.js Tue Nov 05 14:29:16 2024 -0700 +++ b/src/chat.js Tue Nov 05 16:09:10 2024 -0700 @@ -84,6 +84,25 @@ ajax(`delete_chat.js?chat=${currentChatId}`); } +let currentPostId; + +function deletePost(postId) { + currentPostId = postId; + let dialog = document.querySelector('dialog[delete_post]'); + openModal(dialog); +} + +function doDeletePost(el) { + closeModal(el); + ajax(`delete_post.js?post=${currentPostId}`); +} + +function deleted(postId) { + let div = document.querySelector(`div[post="${postId}"]`); + if( div ) + div.outerHTML = ''; +} + function added(html) { let input = document.querySelector('div[input]'); input.insertAdjacentHTML('beforebegin',html);