forked from rDrama/rDrama
fds
parent
d2a2780f87
commit
adc4e25f2f
|
@ -37,6 +37,43 @@
|
|||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% if v %}
|
||||
<script>
|
||||
post_comment=function(fullname){
|
||||
|
||||
var form = new FormData();
|
||||
|
||||
form.append('formkey', formkey());
|
||||
form.append('parent_fullname', fullname);
|
||||
form.append('submission', document.getElementById('reply-form-submission-'+fullname).value);
|
||||
form.append('body', document.getElementById('reply-form-body-'+fullname).value);
|
||||
form.append('file', document.getElementById('file-upload-reply-'+fullname).files[0]);
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("post", "/comment");
|
||||
xhr.withCredentials=true;
|
||||
xhr.onload=function(){
|
||||
if (xhr.status==200) {
|
||||
commentForm=document.getElementById('comment-form-space-'+fullname);
|
||||
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
||||
document.getElementById('toast-comment-success').toast('dispose');
|
||||
document.getElementById('toast-comment-error').toast('dispose');
|
||||
document.getElementById('toast-comment-success').toast('show');
|
||||
}
|
||||
else {
|
||||
var commentError = document.getElementById("comment-error-text");
|
||||
document.getElementById('toast-comment-success').toast('dispose');
|
||||
document.getElementById('toast-comment-error').toast('dispose');
|
||||
document.getElementById('toast-comment-error').toast('show');
|
||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
||||
}
|
||||
}
|
||||
xhr.send(form)
|
||||
|
||||
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
||||
|
||||
}
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<script>
|
||||
var date = new Date('{{p.created_datetime}}');
|
||||
|
|
Loading…
Reference in New Issue