sneed
This commit is contained in:
parent
e9ad5855ff
commit
bdcc5dfc28
3 changed files with 104 additions and 102 deletions
|
@ -961,16 +961,3 @@ $('.expandable-image').click( function(event) {
|
||||||
|
|
||||||
expandDesktopImage(url,url);
|
expandDesktopImage(url,url);
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.text-expand').click(function(event){
|
|
||||||
if (event.which != 1) {
|
|
||||||
return
|
|
||||||
};
|
|
||||||
id=$(this).data('id');
|
|
||||||
|
|
||||||
|
|
||||||
$('#post-text-'+id).toggleClass('d-none');
|
|
||||||
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
|
|
||||||
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
|
|
||||||
|
|
||||||
})
|
|
|
@ -3,101 +3,101 @@
|
||||||
<head>
|
<head>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
post_comment=function(fullname){
|
post_comment=function(fullname){
|
||||||
|
|
||||||
|
|
||||||
var form = new FormData();
|
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", "/api/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"];
|
||||||
|
$('#toast-comment-success').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('dispose');
|
||||||
|
$('#toast-comment-success').toast('show');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var commentError = document.getElementById("comment-error-text");
|
||||||
|
$('#toast-comment-success').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('show');
|
||||||
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(form)
|
||||||
|
|
||||||
|
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
||||||
|
|
||||||
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", "/api/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"];
|
|
||||||
$('#toast-comment-success').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('dispose');
|
|
||||||
$('#toast-comment-success').toast('show');
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
|
herald_comment=function(bid,cid){
|
||||||
|
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("post", "/mod/distinguish_comment/"+bid+'/'+cid);
|
||||||
|
|
||||||
|
var form = new FormData();
|
||||||
|
|
||||||
|
form.append('formkey', formkey());
|
||||||
|
|
||||||
|
xhr.withCredentials=true;
|
||||||
|
xhr.onload=function(){
|
||||||
|
if (xhr.status==200) {
|
||||||
|
comment=document.getElementById('comment-'+cid+'-only');
|
||||||
|
comment.innerHTML=JSON.parse(xhr.response)["html"];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var commentError = document.getElementById("comment-error-text");
|
||||||
|
$('#toast-comment-success').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('show');
|
||||||
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(form)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
comment_edit=function(id){
|
||||||
|
|
||||||
var commentError = document.getElementById("comment-error-text");
|
var commentError = document.getElementById("comment-error-text");
|
||||||
$('#toast-comment-success').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('dispose');
|
var form = new FormData();
|
||||||
$('#toast-comment-error').toast('show');
|
|
||||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
form.append('formkey', formkey());
|
||||||
|
form.append('body', document.getElementById('comment-edit-body-'+id).value);
|
||||||
|
form.append('file', document.getElementById('file-edit-reply-'+id).files[0]);
|
||||||
|
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("post", "/edit_comment/"+id);
|
||||||
|
xhr.withCredentials=true;
|
||||||
|
xhr.onload=function(){
|
||||||
|
if (xhr.status==200) {
|
||||||
|
commentForm=document.getElementById('comment-text-'+id);
|
||||||
|
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
||||||
|
document.getElementById('cancel-edit-'+id).click()
|
||||||
|
$('#toast-comment-success').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('dispose');
|
||||||
|
$('#toast-comment-success').toast('show');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#toast-comment-success').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('dispose');
|
||||||
|
$('#toast-comment-error').toast('show');
|
||||||
|
commentError.textContent = JSON.parse(xhr.response)["error"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xhr.send(form)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
xhr.send(form)
|
|
||||||
|
|
||||||
document.getElementById('save-reply-to-'+fullname).classList.add('disabled');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
herald_comment=function(bid,cid){
|
|
||||||
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("post", "/mod/distinguish_comment/"+bid+'/'+cid);
|
|
||||||
|
|
||||||
var form = new FormData();
|
|
||||||
|
|
||||||
form.append('formkey', formkey());
|
|
||||||
|
|
||||||
xhr.withCredentials=true;
|
|
||||||
xhr.onload=function(){
|
|
||||||
if (xhr.status==200) {
|
|
||||||
comment=document.getElementById('comment-'+cid+'-only');
|
|
||||||
comment.innerHTML=JSON.parse(xhr.response)["html"];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var commentError = document.getElementById("comment-error-text");
|
|
||||||
$('#toast-comment-success').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('show');
|
|
||||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.send(form)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
comment_edit=function(id){
|
|
||||||
|
|
||||||
var commentError = document.getElementById("comment-error-text");
|
|
||||||
|
|
||||||
var form = new FormData();
|
|
||||||
|
|
||||||
form.append('formkey', formkey());
|
|
||||||
form.append('body', document.getElementById('comment-edit-body-'+id).value);
|
|
||||||
form.append('file', document.getElementById('file-edit-reply-'+id).files[0]);
|
|
||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("post", "/edit_comment/"+id);
|
|
||||||
xhr.withCredentials=true;
|
|
||||||
xhr.onload=function(){
|
|
||||||
if (xhr.status==200) {
|
|
||||||
commentForm=document.getElementById('comment-text-'+id);
|
|
||||||
commentForm.innerHTML=JSON.parse(xhr.response)["html"];
|
|
||||||
document.getElementById('cancel-edit-'+id).click()
|
|
||||||
$('#toast-comment-success').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('dispose');
|
|
||||||
$('#toast-comment-success').toast('show');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#toast-comment-success').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('dispose');
|
|
||||||
$('#toast-comment-error').toast('show');
|
|
||||||
commentError.textContent = JSON.parse(xhr.response)["error"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xhr.send(form)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
block_user=function() {
|
block_user=function() {
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
<script>
|
||||||
|
$('.text-expand').click(function(event){
|
||||||
|
if (event.which != 1) {
|
||||||
|
return
|
||||||
|
};
|
||||||
|
id=$(this).data('id');
|
||||||
|
|
||||||
|
|
||||||
|
$('#post-text-'+id).toggleClass('d-none');
|
||||||
|
$('.text-expand-icon-'+id).toggleClass('fa-expand-alt');
|
||||||
|
$('.text-expand-icon-'+id).toggleClass('fa-compress-alt');
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
{% for p in listing %}
|
{% for p in listing %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue