sneed
This commit is contained in:
parent
684e2ee923
commit
e9ad5855ff
5 changed files with 116 additions and 113 deletions
|
@ -937,115 +937,6 @@ $(document).ready(function(){
|
|||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
||||
|
||||
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", "/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');
|
||||
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
//part of submit page js
|
||||
|
||||
hide_image=function(){
|
||||
x=document.getElementById('image-upload-block');
|
||||
url=document.getElementById('post-URL').value;
|
||||
if (url.length>=1){
|
||||
x.classList.add('d-none');
|
||||
}
|
||||
else {
|
||||
x.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
|
||||
}
|
||||
|
||||
$('.mention-user').click(function (event) {
|
||||
|
||||
|
|
|
@ -121,8 +121,8 @@
|
|||
{% if c.distinguish_level %}<i class="fas fa-broom text-admin" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Drama Badmin, speaking officially"></i> {% endif %}
|
||||
{% if c.is_op %}<i class="fas fa-microphone-stand text-info" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="OP"></i> {% endif %}
|
||||
{% if c.is_bot %}<i class="fad fa-robot text-info" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Bot"></i> {% endif %}
|
||||
{% if c.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this comment because {{'it\'s in your guild' if v.admin_level == 6 else 'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i> {% endif %}
|
||||
{% if c.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you, but you can see this comment because {{'it\'s in your guild' if v.admin_level == 6 else 'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i> {% endif %}
|
||||
{% if c.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this comment because {{'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i> {% endif %}
|
||||
{% if c.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you, but you can see this comment because {{'it\'s an admin comment' if c.distinguish_level else 'you\'re an admin'}}."></i> {% endif %}
|
||||
|
||||
{% if c.author.is_deleted %}[deleted account]{% else %}<a {% if c.author.patron %}class="patron"{% endif %} style="color:#{{c.author.namecolor}}; font-size:12px; font-weight:bold;" href="/@{{c.author.username}}">{{c.author.username}}</a>{% if c.author.customtitle %} <bdi style="color: #{{c.author.titlecolor}}"> {{c.author.customtitle | safe}}</bdi>{% endif %}{% endif %}
|
||||
|
||||
|
|
|
@ -2,6 +2,104 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<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", "/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');
|
||||
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
var exileForm = document.getElementById("exile-form");
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
{% if p.distinguish_level %} <i class="fas fa-broom text-admin" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Drama Badmin, speaking officially"></i> {% endif %}
|
||||
{% if p.over_18 %}<span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.is_bot %} <i class="fad fa-robot text-info" data-toggle="tooltip" data-placement="bottom" data-original-title="Bot"></i>{% endif %}
|
||||
{% if p.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this post because {{'it\'s in your guild' if p.is_guildmaster('content') else 'it\'s an admin post' if p.distinguish_level else 'you\'re an admin'}}."></i>{% endif %}
|
||||
{% if p.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this post because {{'it\'s an admin post' if p.distinguish_level else 'you\'re an admin'}}."></i>{% endif %}
|
||||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="text-warning"><i class="far fa-eye-slash text-small mr-1"></i>unlisted</span> {% endif %}
|
||||
{% if p.is_repost %}<span class="text-warning"><i class="far fa-sync text-small mr-1"></i><a class="text-warning" href="{{p.reposts.permalink}}">repost</a></span> {% endif %}
|
||||
|
@ -156,7 +156,7 @@
|
|||
{% if p.is_pinned and request.path.startswith('/@') %}<i class="fas fa-thumbtack text-admin fa-rotate--45" data-toggle="tooltip" data-placement="bottom" title="Pinned to profile"></i> {% endif %}
|
||||
{% if p.over_18 %} <span class="badge badge-danger text-small-extra mr-1">+18</span>{% endif %}
|
||||
{% if p.is_bot %} <i class="fad fa-robot text-info" data-toggle="tooltip" data-placement="bottom" data-original-title="Bot"></i>{% endif %}
|
||||
{% if p.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this post because {{'it\'s in your guild' if p.is_guildmaster('content') else 'it\'s an admin post' if p.distinguish_level else 'you\'re an admin'}}."></i>{% endif %}
|
||||
{% if p.is_blocking %}<i class="fas fa-user-minus text-warning" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="You're blocking this user, but you can see this post because {{'it\'s an admin post' if p.distinguish_level else 'you\'re an admin'}}."></i>{% endif %}
|
||||
{% if p.is_blocked %}<i class="fas fa-user-minus text-danger" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="This user is blocking you."></i>{% endif %}
|
||||
{% if p.private %}<span class="badge border-warning border-1 text-small-extra">unlisted</span>{% endif %}
|
||||
{% if p.is_repost %} <span class="badge border-warning border-1 text-small-extra"><a class="text-warning" href="{{p.reposts.permalink}}">repost</a></span>{% endif %}
|
||||
|
|
|
@ -3,6 +3,20 @@
|
|||
|
||||
<head>
|
||||
<script>
|
||||
|
||||
//part of submit page js
|
||||
|
||||
hide_image=function(){
|
||||
x=document.getElementById('image-upload-block');
|
||||
url=document.getElementById('post-URL').value;
|
||||
if (url.length>=1){
|
||||
x.classList.add('d-none');
|
||||
}
|
||||
else {
|
||||
x.classList.remove('d-none');
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-suggest title given URL
|
||||
|
||||
function autoSuggestTitle() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue