Mercurial Hosting > chat
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 22:949914955bfe | 23:c54c806fcc6e |
|---|---|
| 82 function doDeleteChat(el) { | 82 function doDeleteChat(el) { |
| 83 closeModal(el); | 83 closeModal(el); |
| 84 ajax(`delete_chat.js?chat=${currentChatId}`); | 84 ajax(`delete_chat.js?chat=${currentChatId}`); |
| 85 } | 85 } |
| 86 | 86 |
| 87 let currentPostId; | |
| 88 | |
| 89 function deletePost(postId) { | |
| 90 currentPostId = postId; | |
| 91 let dialog = document.querySelector('dialog[delete_post]'); | |
| 92 openModal(dialog); | |
| 93 } | |
| 94 | |
| 95 function doDeletePost(el) { | |
| 96 closeModal(el); | |
| 97 ajax(`delete_post.js?post=${currentPostId}`); | |
| 98 } | |
| 99 | |
| 100 function deleted(postId) { | |
| 101 let div = document.querySelector(`div[post="${postId}"]`); | |
| 102 if( div ) | |
| 103 div.outerHTML = ''; | |
| 104 } | |
| 105 | |
| 87 function added(html) { | 106 function added(html) { |
| 88 let input = document.querySelector('div[input]'); | 107 let input = document.querySelector('div[input]'); |
| 89 input.insertAdjacentHTML('beforebegin',html); | 108 input.insertAdjacentHTML('beforebegin',html); |
| 90 fixPosts(); | 109 fixPosts(); |
| 91 input.scrollIntoView({block: 'end'}); | 110 input.scrollIntoView({block: 'end'}); |
