combine postToast variants (#648)

This commit is contained in:
justcool393 2023-07-28 03:05:47 -07:00 committed by GitHub
parent 46714fd520
commit 0e8856ee46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 252 additions and 456 deletions

View file

@ -27,41 +27,10 @@ function pick(kind, canbuy1, canbuy2) {
} }
function buy(mb) { function buy(mb) {
const kind = document.getElementById('kind').value; postToast(null, `/buy/${kind}${mb ? '?mb=true' : ''}`, 'POST', null, (xhr) => {
const xhr = new XMLHttpRequest(); document.getElementById('giveaward').disabled = false;
url = `/buy/${kind}` let owned = document.getElementById(`${kind}-owned`);
if (mb) url += "?mb=true" const ownednum = Number(owned.textContent);
xhr.open("POST", url); owned.textContent = ownednum + 1;
xhr.setRequestHeader('xhr', 'xhr'); });
var form = new FormData()
form.append("formkey", formkey());
if(typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) {
form.append(k, data[k]);
}
}
form.append("formkey", formkey());
xhr.onload = function() {
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) {
document.getElementById('toast-post-success-text2').innerText = data["message"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success2')).show();
document.getElementById('giveaward').disabled=false;
let owned = document.getElementById(`${kind}-owned`)
let ownednum = Number(owned.textContent);
owned.textContent = ownednum + 1
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
if (data && data["error"]) document.getElementById('toast-post-error-text2').innerText = data["error"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error2')).show();
}
};
xhr.send(form);
} }

View file

@ -1,44 +1,3 @@
function post_toast3(t, url, button1, button2) {
t.disabled=true;
t.classList.add("disabled");
const xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader('xhr', 'xhr');
var form = new FormData()
form.append("formkey", formkey());
if(typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) {
form.append(k, data[k]);
}
}
xhr.onload = function() {
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) {
document.getElementById('toast-post-success-text').innerText = data["message"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
document.getElementById(button1).classList.toggle("d-md-inline-block");
document.getElementById(button2).classList.toggle("d-md-inline-block");
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
}
setTimeout(() => {
t.disabled = false;
t.classList.remove("disabled");
}, 2000);
};
xhr.send(form);
}
function report_commentModal(id, author) { function report_commentModal(id, author) {
document.getElementById("comment-author").textContent = author; document.getElementById("comment-author").textContent = author;
@ -128,33 +87,15 @@ function toggleEdit(id){
function delete_commentModal(id) { function delete_commentModal(id) {
document.getElementById("deleteCommentButton").onclick = function() { document.getElementById("deleteCommentButton").onclick = () => postToast(null, `/delete/comment/${id}`, 'POST', null, (xhr) => {
const xhr = new XMLHttpRequest(); if (xhr.status >= 200 && xhr.status < 300) {
xhr.open("POST", `/delete/comment/${id}`); document.getElementsByClassName(`comment-${id}-only`)[0].classList.add('deleted');
xhr.setRequestHeader('xhr', 'xhr'); document.getElementById(`delete-${id}`).classList.add('d-none');
var form = new FormData() document.getElementById(`undelete-${id}`).classList.remove('d-none');
form.append("formkey", formkey()); document.getElementById(`delete2-${id}`).classList.add('d-none');
xhr.onload = function() { document.getElementById(`undelete2-${id}`).classList.remove('d-none');
let data }
try {data = JSON.parse(xhr.response)} });
catch(e) {console.log(e)}
if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) {
document.getElementsByClassName(`comment-${id}-only`)[0].classList.add('deleted');
document.getElementById(`delete-${id}`).classList.add('d-none');
document.getElementById(`undelete-${id}`).classList.remove('d-none');
document.getElementById(`delete2-${id}`).classList.add('d-none');
document.getElementById(`undelete2-${id}`).classList.remove('d-none');
document.getElementById('toast-post-success-text').innerText = data["message"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
}
};
xhr.send(form);
};
} }
function post_reply(id){ function post_reply(id){
@ -275,7 +216,7 @@ function post_comment(fullname,id,level = 1){
catch(e) {} catch(e) {}
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open("post", "/comment"); xhr.open("post", "/comment"); // TODO: use postToast for this?
xhr.setRequestHeader('xhr', 'xhr'); xhr.setRequestHeader('xhr', 'xhr');
xhr.onload=function(){ xhr.onload=function(){
let data let data

View file

@ -1,29 +1,11 @@
function delete_postModal(id) { function delete_postModal(id) {
document.getElementById("deletePostButton").onclick = function() { document.getElementById("deletePostButton").onclick = () => postToast(null, `/delete_post/${id}`, 'POST', null, (xhr) => {
const xhr = new XMLHttpRequest(); if (xhr.status >= 200 && xhr.status < 300) {
xhr.open("POST", `/delete_post/${id}`); document.getElementById(`post-${id}`).classList.add('deleted');
xhr.setRequestHeader('xhr', 'xhr'); document.getElementById(`delete-${id}`).classList.add('d-none');
var form = new FormData() document.getElementById(`undelete-${id}`).classList.remove('d-none');
form.append("formkey", formkey()); document.getElementById(`delete2-${id}`).classList.add('d-none');
xhr.onload = function() { document.getElementById(`undelete2-${id}`).classList.remove('d-none');
let data }
try {data = JSON.parse(xhr.response)} });
catch(e) {console.log(e)}
if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) {
document.getElementById(`post-${id}`).classList.add('deleted');
document.getElementById(`delete-${id}`).classList.add('d-none');
document.getElementById(`undelete-${id}`).classList.remove('d-none');
document.getElementById(`delete2-${id}`).classList.add('d-none');
document.getElementById(`undelete2-${id}`).classList.remove('d-none');
document.getElementById('toast-post-success-text').innerText = data["message"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
}
};
xhr.send(form);
};
} }

View file

@ -1,5 +1,5 @@
function removeFollower(event, username) { function removeFollower(event, username) {
post_toast(event.target,'/remove_follow/' + username); postToastSimple(event.target,'/remove_follow/' + username);
let table = document.getElementById("followers-table"); let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement); table.removeChild(event.target.parentElement.parentElement);
} }

View file

@ -1,5 +1,5 @@
function removeFollowing(event, username) { function removeFollowing(event, username) {
post_toast(event.target,'/unfollow/' + username); postToastSimple(event.target,'/unfollow/' + username);
let table = document.getElementById("followers-table"); let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement); table.removeChild(event.target.parentElement.parentElement);
} }

View file

@ -81,45 +81,99 @@ function expandDesktopImage(image) {
document.getElementById("desktop-expanded-image-wrap-link").href = image; document.getElementById("desktop-expanded-image-wrap-link").href = image;
}; };
function post_toast(t, url, reload, data) { function postToast(targetElement, url, method, data, callbackFn) {
if (t) { if (targetElement) { // disable element to avoid repeated requests
t.disabled = true; targetElement.disabled = true;
t.classList.add("disabled"); targetElement.classList.add("disabled");
} }
const xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest(); // set up the request now
xhr.open("POST", url); xhr.open(method, url);
xhr.setRequestHeader('xhr', 'xhr'); xhr.setRequestHeader("xhr", "xhr");
var form = new FormData()
var formData = null;
if (data instanceof HTMLFormElement) {
formData = data;
}
var form = new FormData(formData ?? undefined);
form.append("formkey", formkey()); form.append("formkey", formkey());
if(typeof data === 'object' && data !== null) { if (typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) { for (let k of Object.keys(data)) {
form.append(k, data[k]); form.append(k, data[k]);
} }
} }
xhr.onload = function() { xhr.onload = function() {
let data let data;
try {data = JSON.parse(xhr.response)} try {
catch(e) {console.log(e)} data = JSON.parse(xhr.response);
} catch (e) {
console.error("Failed to parse response as JSON", e);
}
var message = null;
if (callbackFn !== null) {
try {
const result = callbackFn(xhr);
if (typeof result === 'string' && result !== null) {
message = result;
}
} catch (e) {
console.error("Failed to run callback function for postToast", e, xhr);
}
}
if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) { if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) {
document.getElementById('toast-post-success-text').innerText = data["message"]; const toastPostSuccessTextElement = document.getElementById("toast-post-success-text");
if (message === null) {
message = data["message"];
}
if (message === null) {
message = "Success!";
}
toastPostSuccessTextElement.innerText = message;
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show(); bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
if (reload == 1) {location.reload()}
} else { } else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later." const toastPostErrorTextElement = document.getElementById('toast-post-error-text');
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"]; if (message === null && data) {
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"]; if (data["details"]) {
message = data["details"];
} else if (data["error"]) {
message = data["error"];
}
}
if (message === null) {
message = "Error, please try again later.";
}
toastPostErrorTextElement.innerText = message;
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show(); bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
} }
setTimeout(() => { }
t.disabled = false;
t.classList.remove("disabled"); setTimeout(() => {
}, 2000); if (targetElement !== null) {
}; targetElement.disabled = false;
targetElement.classList.remove("disabled");
}
}, 1500);
xhr.send(form); xhr.send(form);
}
function postToastSimple(t, url, method="POST", data=null) {
postToast(t, url, method, data, null);
}
function postToastReload(t, url, method, data) {
postToast(t, url, method, data, (xhr) => location.reload());
}
function postToastSwitch(t, url, method, button1, button2, cssClass="d-none") {
postToast(t, url, method, null, (xhr) => {
document.getElementById(button1).classList.toggle(cssClass);
document.getElementById(button2).classList.toggle(cssClass);
})
} }
function escapeHTML(unsafe) { function escapeHTML(unsafe) {

View file

@ -1,43 +0,0 @@
function post_toast2(t, url, button1, button2) {
t.disabled=true;
t.classList.add("disabled");
const xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader('xhr', 'xhr');
var form = new FormData()
form.append("formkey", formkey());
if(typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) {
form.append(k, data[k]);
}
}
form.append("formkey", formkey());
xhr.onload = function() {
let data
try {data = JSON.parse(xhr.response)}
catch(e) {console.log(e)}
if (xhr.status >= 200 && xhr.status < 300 && data && data["message"]) {
document.getElementById('toast-post-success-text').innerText = data["message"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success')).show();
document.getElementById(button1).classList.toggle("d-none");
document.getElementById(button2).classList.toggle("d-none");
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error')).show();
}
setTimeout(() => {
t.disabled = false;
t.classList.remove("disabled");
}, 2000);
};
xhr.send(form);
}

View file

@ -1,60 +1,3 @@
function post_toast_callback(url, data, callback) {
const xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader('xhr', 'xhr');
var form = new FormData()
form.append("formkey", formkey());
if(typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) {
form.append(k, data[k]);
}
}
form.append("formkey", formkey());
xhr.onload = function() {
let result = callback(xhr);
if (xhr.status >= 200 && xhr.status < 300) {
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
myToast.hide();
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
myToast.show();
try {
if(typeof result == "string") {
document.getElementById('toast-post-success-text').innerText = result;
} else {
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
}
} catch(e) {
}
return true;
} else {
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
myToast.hide();
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
myToast.show();
try {
if(typeof result == "string") {
document.getElementById('toast-post-error-text').innerText = result;
} else {
document.getElementById('toast-post-error-text').innerText = JSON.parse(xhr.response)["error"];
}
return false
} catch(e) {console.log(e)}
return false;
}
};
xhr.send(form);
}
function toggleElement(id, id2) { function toggleElement(id, id2) {
for(let el of document.getElementsByClassName('toggleable')) { for(let el of document.getElementsByClassName('toggleable')) {
if(el.id != id) { if(el.id != id) {
@ -91,8 +34,10 @@ function transferCoins(mobile=false) {
let transferred = amount - Math.ceil(amount*TRANSFER_TAX); let transferred = amount - Math.ceil(amount*TRANSFER_TAX);
let username = document.getElementById('username').innerHTML let username = document.getElementById('username').innerHTML
post_toast_callback(`/@${username}/transfer_coins`, postToast(null, `/@${username}/transfer_coins`, "POST",
{"amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value}, {
"amount": document.getElementById(mobile ? "coin-transfer-amount-mobile" : "coin-transfer-amount").value
},
(xhr) => { (xhr) => {
if(xhr.status == 200) { if(xhr.status == 200) {
document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - amount; document.getElementById("user-coins-amount").innerText = parseInt(document.getElementById("user-coins-amount").innerText) - amount;
@ -115,7 +60,7 @@ function transferBux(mobile=false) {
let amount = parseInt(document.getElementById("bux-transfer-amount").value); let amount = parseInt(document.getElementById("bux-transfer-amount").value);
let username = document.getElementById('username').innerHTML let username = document.getElementById('username').innerHTML
post_toast_callback(`/@${username}/transfer_bux`, postToast(null, `/@${username}/transfer_bux`, "POST",
{"amount": document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value}, {"amount": document.getElementById(mobile ? "bux-transfer-amount-mobile" : "bux-transfer-amount").value},
(xhr) => { (xhr) => {
if(xhr.status == 200) { if(xhr.status == 200) {
@ -130,57 +75,11 @@ function transferBux(mobile=false) {
} }
function submitFormAjax(e) { function submitFormAjax(e) {
document.getElementById('message').classList.add('d-none'); for (elementId in ['message', 'message-mobile', 'message-preview', 'message-preview-mobile']) {
document.getElementById('message-mobile').classList.add('d-none'); document.getElementById(elementId).classList.add("d-none");
document.getElementById('message-preview').classList.add('d-none'); }
document.getElementById('message-preview-mobile').classList.add('d-none');
const form = e.target; const form = e.target;
const xhr = new XMLHttpRequest(); postToast(null, form.getAttribute("action"), "POST", form, null);
e.preventDefault(); return false;
formData = new FormData(form);
formData.append("formkey", formkey());
if(typeof data === 'object' && data !== null) {
for(let k of Object.keys(data)) {
form.append(k, data[k]);
}
}
actionPath = form.getAttribute("action");
xhr.open("POST", actionPath);
xhr.setRequestHeader('xhr', 'xhr');
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
let data = JSON.parse(xhr.response);
try {
document.getElementById('toast-post-success-text').innerText = data["message"];
} catch(e) {
document.getElementById('toast-post-success-text').innerText = "Action successful!";
}
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
myToast.show();
return true
} else {
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
try {
let data=JSON.parse(xhr.response);
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
myToast.show();
if (data && data["error"]) document.getElementById('toast-post-error-text').innerText = data["error"];
if (data && data["details"]) document.getElementById('toast-post-error-text').innerText = data["details"];
} catch(e) {
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-success'));
myToast.hide();
var myToast = bootstrap.Toast.getOrCreateInstance(document.getElementById('toast-post-error'));
myToast.show();
}
}
};
xhr.send(formData);
return false
} }

View file

@ -78,14 +78,14 @@
<h3>Site Settings</h3> <h3>Site Settings</h3>
{%- macro site_setting_bool(name, label) -%} {%- macro site_setting_bool(name, label) -%}
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="site-setting-{{name}}" {% if site_settings[name] %}checked{% endif %} onchange="post_toast(this,'/admin/site_settings/{{name}}');"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="site-setting-{{name}}" {% if site_settings[name] %}checked{% endif %} onchange="postToastSimple(this,'/admin/site_settings/{{name}}');">
<label class="custom-control-label" for="site-setting-{{name}}">{{label}}</label> <label class="custom-control-label" for="site-setting-{{name}}">{{label}}</label>
</div> </div>
{%- endmacro -%} {%- endmacro -%}
{%- macro site_setting_int(name, label) -%} {%- macro site_setting_int(name, label) -%}
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input type="number" class="" id="site-setting-{{name}}" name="{{name}}" value="{{ site_settings[name] }}" <input type="number" class="" id="site-setting-{{name}}" name="{{name}}" value="{{ site_settings[name] }}"
onblur="post_toast(null, '/admin/site_settings/{{name}}', false, { new_value: this.value })"/> onblur="postToastSimple(null, '/admin/site_settings/{{name}}', 'POST', { new_value: this.value })"/>
<label for="site-setting-{{name}}">{{label}}</label> <label for="site-setting-{{name}}">{{label}}</label>
</div> </div>
{%- endmacro -%} {%- endmacro -%}
@ -94,7 +94,7 @@
{{site_setting_bool('FilterNewPosts', 'Filter New Posts')}} {{site_setting_bool('FilterNewPosts', 'Filter New Posts')}}
{{site_setting_bool('Read-only mode', 'Read-Only Mode')}} {{site_setting_bool('Read-only mode', 'Read-Only Mode')}}
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="under_attack" name="under_attack" {% if under_attack%}checked{% endif %} onchange="post_toast(this,'/admin/under_attack');"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="under_attack" name="under_attack" {% if under_attack%}checked{% endif %} onchange="postToastSimple(this,'/admin/under_attack');">
<label class="custom-control-label" for="under_attack">Under attack mode</label> <label class="custom-control-label" for="under_attack">Under attack mode</label>
</div> </div>
@ -108,8 +108,8 @@
{{site_setting_int('min_truescore_private_profile', 'Minimum Karma')}} {{site_setting_int('min_truescore_private_profile', 'Minimum Karma')}}
{{site_setting_int('min_age_days_private_profile', 'Minimum Account Age (Days)')}} {{site_setting_int('min_age_days_private_profile', 'Minimum Account Age (Days)')}}
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/purge_cache');">PURGE CDN CACHE</button> <button class="btn btn-primary mt-3" onclick="postToastSimple(this,'/admin/purge_cache');">PURGE CDN CACHE</button>
<button class="btn btn-primary mt-3" onclick="post_toast(this,'/admin/dump_cache');">DUMP INTERNAL CACHE</button> <button class="btn btn-primary mt-3" onclick="postToastSimple(this,'/admin/dump_cache');">DUMP INTERNAL CACHE</button>
{% endif %} {% endif %}
{% if g.debug %} {% if g.debug %}
<section id="admin-section-debug" class="admin-section mt-3"> <section id="admin-section-debug" class="admin-section mt-3">

View file

@ -34,12 +34,12 @@
<div class="d-flex"> <div class="d-flex">
{% if not app.client_id%} {% if not app.client_id%}
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a> <a role="button" class="btn btn-primary ml-auto" onclick="postToastSimple(this,'/admin/app/approve/{{app.id}}')">Approve</a>
<a role="button" class="btn btn-secondary mr-0" onclick="post_toast(this,'/admin/app/reject/{{app.id}}')">Reject</a> <a role="button" class="btn btn-secondary mr-0" onclick="postToastSimple(this,'/admin/app/reject/{{app.id}}')">Reject</a>
{% else %} {% else %}
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/revoke/{{app.id}}')">Revoke</a> <a role="button" class="btn btn-primary ml-auto" onclick="postToastSimple(this,'/admin/app/revoke/{{app.id}}')">Revoke</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View file

@ -39,12 +39,12 @@
<div class="d-flex"> <div class="d-flex">
{% if not app.client_id %} {% if not app.client_id %}
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/approve/{{app.id}}')">Approve</a> <a role="button" class="btn btn-primary ml-auto" onclick="postToastSimple(this,'/admin/app/approve/{{app.id}}')">Approve</a>
<a role="button" class="btn btn-secondary mr-0" onclick="post_toast(this,'/admin/app/reject/{{app.id}}')">Reject</a> <a role="button" class="btn btn-secondary mr-0" onclick="postToastSimple(this,'/admin/app/reject/{{app.id}}')">Reject</a>
{% else %} {% else %}
<a role="button" class="btn btn-primary ml-auto" onclick="post_toast(this,'/admin/app/revoke/{{app.id}}')">Revoke</a> <a role="button" class="btn btn-primary ml-auto" onclick="postToastSimple(this,'/admin/app/revoke/{{app.id}}')">Revoke</a>
{% endif %} {% endif %}
</div> </div>

View file

@ -1,7 +1,7 @@
{%- extends 'default.html' -%} {%- extends 'default.html' -%}
{% block content %} {% block content %}
{%- macro post_toast_button(text, url, css_class) -%} {%- macro post_toast_button(text, url, css_class) -%}
<button class="btn{% if css_class %} {{css_class}}{% endif %}" onclick="post_toast(this, '{{url}}')">{{text}}</button> <button class="btn{% if css_class %} {{css_class}}{% endif %}" onclick="postToastSimple(this, '{{url}}')">{{text}}</button>
{%- endmacro -%} {%- endmacro -%}
<h5 class="mt-3">System Info</h5> <h5 class="mt-3">System Info</h5>
<section class="system-resource-usage"> <section class="system-resource-usage">

View file

@ -48,8 +48,8 @@
{% block content %} {% block content %}
{% if v %} {% if v %}
<a id="subscribe" class="{% if v.changelogsub %}d-none{% endif %} btn btn-primary followbutton" role="button" onclick="post_toast2(this, '/changelogsub','subscribe','unsubscribe')">Subscribe</a> <a id="subscribe" class="{% if v.changelogsub %}d-none{% endif %} btn btn-primary followbutton" role="button" onclick="postToastSwitch(this,'/changelogsub','POST','subscribe','unsubscribe');">Subscribe</a>
<a id="unsubscribe" class="{% if not v.changelogsub %}d-none{% endif %} btn btn-primary followbutton" role="button" onclick="post_toast2(this, '/changelogsub','subscribe','unsubscribe')">Unsubscribe</a> <a id="unsubscribe" class="{% if not v.changelogsub %}d-none{% endif %} btn btn-primary followbutton" role="button" onclick="postToastSwitch(this,'/changelogsub','POST','subscribe','unsubscribe');">Unsubscribe</a>
{% endif %} {% endif %}
<div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}"> <div class="row no-gutters {% if listing %}mt-md-3{% elif not listing %}my-md-3{% endif %}">
@ -80,7 +80,4 @@
</ul> </ul>
</nav> </nav>
{% endif %} {% endif %}
<script src="{{ 'js/post_toast2.js' | asset }}"></script>
{% endblock %} {% endblock %}

View file

@ -6,13 +6,13 @@
{% if v %} {% if v %}
<button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button> <button class="btn caction py-0 nobackground px-1 text-muted" role="button" onclick="openReplyBox('reply-to-{{c.id}}')"><i class="fas fa-reply" aria-hidden="true"></i>Reply</button>
<button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button> <button class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}',)"><i class="fas fa-flag fa-fw"></i>Report</button>
<button id="unsave-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id in v.saved_comment_idlist() %}d-md-inline-block{% endif %} text-muted d-none" role="button" onclick="post_toast3(this,'/unsave_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}')"><i class="fas fa-save"></i>Unsave</button> <button id="unsave-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id in v.saved_comment_idlist() %}d-md-inline-block{% endif %} text-muted d-none" role="button" onclick="postToastSwitch(this,'/unsave_comment/{{c.id}}','POST', 'save-{{c.id}}','unsave-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-save"></i>Unsave</button>
<button id="save-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id not in v.saved_comment_idlist() %}d-md-inline-block{% endif %} text-muted d-none" role="button" onclick="post_toast3(this,'/save_comment/{{c.id}}','save-{{c.id}}','unsave-{{c.id}}')"><i class="fas fa-save"></i>Save</button> <button id="save-{{c.id}}" class="btn caction py-0 nobackground px-1 {% if c.id not in v.saved_comment_idlist() %}d-md-inline-block{% endif %} text-muted d-none" role="button" onclick="postToastSwitch(this,'/save_comment/{{c.id}}','POST', 'save-{{c.id}}','unsave-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-save"></i>Save</button>
{% endif %} {% endif %}
{% if c.parent_submission %} {% if c.parent_submission %}
{% if v and c.author_id == v.id %} {% if v and c.author_id == v.id %}
<button class="btn caction py-0 nobackground px-1 text-muted" onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</button> <button class="btn caction py-0 nobackground px-1 text-muted" onclick="toggleEdit('{{c.id}}')"><i class="fas fa-edit fa-fw"></i>Edit</button>
<button id="undelete-{{c.id}}" class="btn caction py-0 nobackground px-1 text-muted {% if not c.state_user_deleted_utc %}d-none{% endif %}" onclick="post_toast2(this,'/undelete/comment/{{c.id}}','delete-{{c.id}}','undelete-{{c.id}}');document.getElementById('comment-{{c.id}}').classList.remove('deleted')"><i class="fas fa-trash-alt fa-fw"></i>Undelete</button> <button id="undelete-{{c.id}}" class="btn caction py-0 nobackground px-1 text-muted {% if not c.state_user_deleted_utc %}d-none{% endif %}" onclick="postToastSwitch(this,'/undelete/comment/{{c.id}}','POST','delete-{{c.id}}','undelete-{{c.id}}');document.getElementById('comment-{{c.id}}').classList.remove('deleted');"><i class="fas fa-trash-alt fa-fw"></i>Undelete</button>
<button id="delete-{{c.id}}" class="btn caction py-0 nobackground px-1 text-muted {% if c.state_user_deleted_utc %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Delete</button> <button id="delete-{{c.id}}" class="btn caction py-0 nobackground px-1 text-muted {% if c.state_user_deleted_utc %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="fas fa-trash-alt fa-fw"></i>Delete</button>
{% elif v and c.body %} {% elif v and c.body %}
<button class="btn caction py-0 nobackground px-1 text-muted" onclick="expandMarkdown(this,'{{c.id}}')"><i class="fas text-expand-icon-{{c.id}} fa-expand-alt"></i><span>View source</span></button> <button class="btn caction py-0 nobackground px-1 text-muted" onclick="expandMarkdown(this,'{{c.id}}')"><i class="fas text-expand-icon-{{c.id}} fa-expand-alt"></i><span>View source</span></button>
@ -30,30 +30,30 @@
<button style="margin-top:0.2rem" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-ellipsis-h fa-fw"></i></button> <button style="margin-top:0.2rem" class="btn caction py-0 nobackground px-1 text-muted" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-ellipsis-h fa-fw"></i></button>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% if v.admin_level and v.id==c.author_id %} {% if v.admin_level and v.id==c.author_id %}
<button id="undistinguish-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.distinguish_level %}d-md-block{% endif %} text-info" onclick="post_toast3(this,'/distinguish_comment/{{c.id}}','distinguish-{{c.id}}','undistinguish-{{c.id}}','no')"><i class="fas fa-id-badge text-info fa-fw"></i>Undistinguish</button> <button id="undistinguish-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.distinguish_level %}d-md-block{% endif %} text-info" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish-{{c.id}}','undistinguish-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-id-badge text-info fa-fw"></i>Undistinguish</button>
<button id="distinguish-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.distinguish_level %}d-md-block{% endif %} text-info" onclick="post_toast3(this,'/distinguish_comment/{{c.id}}','distinguish-{{c.id}}','undistinguish-{{c.id}}','yes')"><i class="fas fa-id-badge text-info fa-fw"></i>Distinguish</button> <button id="distinguish-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.distinguish_level %}d-md-block{% endif %} text-info" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish-{{c.id}}','undistinguish-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-id-badge text-info fa-fw"></i>Distinguish</button>
{% endif %} {% endif %}
{% if v.id != c.author_id and not c.ghost %} {% if v.id != c.author_id and not c.ghost %}
<a id="unblock-{{c.id}}" class="dropdown-item text-success list-inline-item {% if not c.is_blocking %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/settings/unblock?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}')"><i class="fas fa-eye text-success"></i>Unblock user</a> <a id="unblock-{{c.id}}" class="dropdown-item text-success list-inline-item {% if not c.is_blocking %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/settings/unblock?username={{c.author_name}}','POST','block-{{c.id}}','unblock-{{c.id}}');"><i class="fas fa-eye text-success"></i>Unblock user</a>
<a id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/settings/block?username={{c.author_name}}','block-{{c.id}}','unblock-{{c.id}}')"><i class="fas fa-eye-slash text-danger"></i>Block user</a> <a id="block-{{c.id}}" class="dropdown-item list-inline-item text-danger {% if c.is_blocking %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/settings/block?username={{c.author_name}}','POST','block-{{c.id}}','unblock-{{c.id}}');"><i class="fas fa-eye-slash text-danger"></i>Block user</a>
{% endif %} {% endif %}
{% if c.post %} {% if c.post %}
{%- set url = c.sticky_api_url(v) -%} {%- set url = c.sticky_api_url(v) -%}
{% if url != "" %} {% if url != "" %}
<button id="unpin-{{c.id}}" class="dropdown-item list-inline-item {% if c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/un{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button> <button id="unpin-{{c.id}}" class="dropdown-item list-inline-item {% if c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="postToastSwitch(this,'/un{{url}}/{{c.id}}','POST','pin-{{c.id}}','unpin-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Unpin</button>
<button id="pin-{{c.id}}" class="dropdown-item list-inline-item {% if not c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast3(this,'/{{url}}/{{c.id}}','pin-{{c.id}}','unpin-{{c.id}}')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button> <button id="pin-{{c.id}}" class="dropdown-item list-inline-item {% if not c.is_pinned %}d-md-block{% endif %} text-muted d-none text-info" data-bs-dismiss="modal" data-bs-target="#actionsModal-{{c.id}}" onclick="postToastSwitch(this,'/{{url}}/{{c.id}}','POST','pin-{{c.id}}','unpin-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-thumbtack fa-rotate--45 text-info fa-fw"></i>Pin</button>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if c.parent_submission and (c.author_id==v.id or v.admin_level >= 2) %} {% if c.parent_submission and (c.author_id==v.id or v.admin_level >= 2) %}
<button id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast3(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Unmark +18</button> <button id="unmark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.over_18 %}d-md-block{% endif %} text-danger" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark-{{c.id}}','unmark-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Unmark +18</button>
<button id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" onclick="post_toast3(this,'/toggle_comment_nsfw/{{c.id}}','mark-{{c.id}}','unmark-{{c.id}}')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button> <button id="mark-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.over_18 %}d-md-block{% endif %} text-danger" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark-{{c.id}}','unmark-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-eye-evil text-danger fa-fw"></i>Mark +18</button>
{% endif %} {% endif %}
{% if v.admin_level >= 2 and v.id != c.author_id %} {% if v.admin_level >= 2 and v.id != c.author_id %}
<button id="unban-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.author.is_suspended %}d-md-block{% endif %} text-success" id="unexile-comment-{{c.id}}" onclick="post_toast3(this,'/unban_user/{{c.author_id}}','ban-{{c.id}}','unban-{{c.id}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button> <button id="unban-{{c.id}}" class="dropdown-item list-inline-item d-none {% if c.author.is_suspended %}d-md-block{% endif %} text-success" id="unexile-comment-{{c.id}}" onclick="postToastSwitch(this,'/unban_user/{{c.author_id}}','POST','ban-{{c.id}}','unban-{{c.id}}', 'd-md-inline-block')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
<button id="ban-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.author.is_suspended %}d-md-block{% endif %} text-danger" id="exile-comment-{{c.id}}" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/comment/{{c.id}}', '{{c.author.id}}', '{{c.author_name}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button> <button id="ban-{{c.id}}" class="dropdown-item list-inline-item d-none {% if not c.author.is_suspended %}d-md-block{% endif %} text-danger" id="exile-comment-{{c.id}}" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/comment/{{c.id}}', '{{c.author.id}}', '{{c.author_name}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
{% endif %} {% endif %}

View file

@ -18,38 +18,38 @@
{% if v %} {% if v %}
<a role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</a> <a role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportCommentModal" onclick="report_commentModal('{{c.id}}','{{c.author_name}}')" class="list-group-item"><i class="fas fa-flag mr-2"></i>Report</a>
<a id="save2-{{c.id}}" class="list-group-item {% if c.id in v.saved_comment_idlist() %}d-none{% endif %}" role="button" data-bs-dismiss="modal" onclick="post_toast2(this,'/save_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')"><i class="fas fa-save mr-2"></i>Save</a> <a id="save2-{{c.id}}" class="list-group-item {% if c.id in v.saved_comment_idlist() %}d-none{% endif %}" role="button" data-bs-dismiss="modal" onclick="postToastSwitch(this,'/save_comment/{{c.id}}','POST','save2-{{c.id}}','unsave2-{{c.id}}');"><i class="fas fa-save mr-2"></i>Save</a>
<a id="unsave2-{{c.id}}" class="list-group-item {% if c.id not in v.saved_comment_idlist() %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/unsave_comment/{{c.id}}','save2-{{c.id}}','unsave2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-save mr-2"></i>Unsave</a> <a id="unsave2-{{c.id}}" class="list-group-item {% if c.id not in v.saved_comment_idlist() %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/unsave_comment/{{c.id}}','POST','save2-{{c.id}}','unsave2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-save mr-2"></i>Unsave</a>
{% if c.author_id == v.id %} {% if c.author_id == v.id %}
<a role="button" data-bs-dismiss="modal" onclick="toggleEdit('{{c.id}}')" class="list-group-item"><i class="fas fa-edit mr-2"></i>Edit</a> <a role="button" data-bs-dismiss="modal" onclick="toggleEdit('{{c.id}}')" class="list-group-item"><i class="fas fa-edit mr-2"></i>Edit</a>
{% if v.admin_level == 1 %} {% if v.admin_level == 1 %}
<a id="distinguish2-{{c.id}}" class="list-group-item {% if c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="post_toast2(this,'/distinguish_comment/{{c.id}}','distinguish2-{{c.id}}','undistinguish2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Distinguish</a> <a id="distinguish2-{{c.id}}" class="list-group-item {% if c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish2-{{c.id}}','undistinguish2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Distinguish</a>
<a id="undistinguish2-{{c.id}}" class="list-group-item {% if not c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="post_toast2(this,'/distinguish_comment/{{c.id}}','distinguish2-{{c.id}}','undistinguish2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Undistinguish</a> <a id="undistinguish2-{{c.id}}" class="list-group-item {% if not c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish2-{{c.id}}','undistinguish2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Undistinguish</a>
{% endif %} {% endif %}
<a id="undelete2-{{c.id}}" class="{% if not c.state_user_deleted_utc %}d-none{% endif %} list-group-item text-success" role="button" onclick="post_toast2(this,'/undelete/comment/{{c.id}}', 'delete2-{{c.id}}', 'undelete2-{{c.id}}');document.getElementById('comment-{{c.id}}').classList.remove('deleted')" data-bs-dismiss="modal"><i class="far fa-trash-alt text-success mr-2"></i>Undelete</a> <a id="undelete2-{{c.id}}" class="{% if not c.state_user_deleted_utc %}d-none{% endif %} list-group-item text-success" role="button" onclick="postToastSwitch(this,'/undelete/comment/{{c.id}}','POST','delete2-{{c.id}}','undelete2-{{c.id}}');document.getElementById('comment-{{c.id}}').classList.remove('deleted');" data-bs-dismiss="modal"><i class="far fa-trash-alt text-success mr-2"></i>Undelete</a>
<a id="delete2-{{c.id}}" class="{% if c.state_user_deleted_utc %}d-none{% endif %} list-group-item text-danger" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="far fa-trash-alt text-danger mr-2"></i>Delete</a> <a id="delete2-{{c.id}}" class="{% if c.state_user_deleted_utc %}d-none{% endif %} list-group-item text-danger" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deleteCommentModal" onclick="delete_commentModal('{{c.id}}')"><i class="far fa-trash-alt text-danger mr-2"></i>Delete</a>
<a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a> <a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark2-{{c.id}}','unmark2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a>
<a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a> <a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark2-{{c.id}}','unmark2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a>
{% else %} {% else %}
{% if c.body %} {% if c.body %}
<a role="button" data-bs-dismiss="modal" onclick="expandMarkdown(this,'{{c.id}}')" class="list-group-item"><i class="fas text-expand-icon-{{c.id}} fa-expand-alt mr-2"></i><span>View source</span></a> <a role="button" data-bs-dismiss="modal" onclick="expandMarkdown(this,'{{c.id}}')" class="list-group-item"><i class="fas text-expand-icon-{{c.id}} fa-expand-alt mr-2"></i><span>View source</span></a>
{% endif %} {% endif %}
{% if not c.ghost %} {% if not c.ghost %}
<a id="unblock2-{{c.id}}" data-bs-dismiss="modal" class="text-success list-group-item {% if not c.is_blocking %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/settings/unblock?username={{c.author_name}}','block2-{{c.id}}','unblock2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash text-success mr-2"></i>Unblock user</a> <a id="unblock2-{{c.id}}" data-bs-dismiss="modal" class="text-success list-group-item {% if not c.is_blocking %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/settings/unblock?username={{c.author_name}}','POST','block2-{{c.id}}','unblock2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-slash text-success mr-2"></i>Unblock user</a>
<a id="prompt2-{{c.id}}" data-bs-dismiss="modal" class="blockuser list-group-item d-none text-danger" role="button" onclick="post_toast2(this,'/settings/block?username={{c.author_name}}','prompt2-{{c.id}}','unblock2-{{c.id}}')"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Are you sure?</a> <a id="prompt2-{{c.id}}" data-bs-dismiss="modal" class="blockuser list-group-item d-none text-danger" role="button" onclick="postToastSwitch(this,'/settings/block?username={{c.author_name}}','POST','prompt2-{{c.id}}','unblock2-{{c.id}}');"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Are you sure?</a>
<a id="block2-{{c.id}}" class="{% if c.is_blocking %}d-none{% endif %} list-group-item text-danger" role="button" onclick="document.getElementById('block2-{{c.id}}').classList.toggle('d-none');document.getElementById('prompt2-{{c.id}}').classList.toggle('d-none');"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Block user</a> <a id="block2-{{c.id}}" class="{% if c.is_blocking %}d-none{% endif %} list-group-item text-danger" role="button" onclick="document.getElementById('block2-{{c.id}}').classList.toggle('d-none');document.getElementById('prompt2-{{c.id}}').classList.toggle('d-none');"><i class="fas fa-eye-slash fa-fw text-danger mr-2"></i>Block user</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if v.admin_level < 2 %} {% if v.admin_level < 2 %}
{% if c.post and v.id == c.post.author_id %} {% if c.post and v.id == c.post.author_id %}
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/pin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a> <a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="postToastSwitch(this,'/pin_comment/{{c.id}}','POST','pin2-{{c.id}}','unpin2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="post_toast2(this,'/unpin_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a> <a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#actionsModal-{{c.id}}" onclick="postToastSwitch(this,'/unpin_comment/{{c.id}}','POST','pin2-{{c.id}}','unpin2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -11,20 +11,20 @@
<ul class="list-group comment-actions"> <ul class="list-group comment-actions">
{% if c.parent_submission %} {% if c.parent_submission %}
{% if v.id == c.author_id %} {% if v.id == c.author_id %}
<a id="distinguish2-{{c.id}}" class="list-group-item {% if c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="post_toast2(this,'/distinguish_comment/{{c.id}}','distinguish2-{{c.id}}','undistinguish2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Distinguish</a> <a id="distinguish2-{{c.id}}" class="list-group-item {% if c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish2-{{c.id}}','undistinguish2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Distinguish</a>
<a id="undistinguish2-{{c.id}}" class="list-group-item {% if not c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="post_toast2(this,'/distinguish_comment/{{c.id}}','distinguish2-{{c.id}}','undistinguish2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Undistinguish</a> <a id="undistinguish2-{{c.id}}" class="list-group-item {% if not c.distinguish_level %}d-none{% endif %} text-info" role="button" onclick="postToastSwitch(this,'/distinguish_comment/{{c.id}}','POST','distinguish2-{{c.id}}','undistinguish2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-id-badge text-info mr-2"></i>Undistinguish</a>
{% endif %} {% endif %}
<a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/sticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a> <a id="pin2-{{c.id}}" class="list-group-item {% if c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="postToastSwitch(this,'/sticky_comment/{{c.id}}','POST','pin2-{{c.id}}','unpin2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Pin</a>
<a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="post_toast2(this,'/unsticky_comment/{{c.id}}','pin2-{{c.id}}','unpin2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a> <a id="unpin2-{{c.id}}" class="list-group-item {% if not c.is_pinned %}d-none{% endif %} text-info" role="button" data-bs-target="#adminModal-{{c.id}}" onclick="postToastSwitch(this,'/unsticky_comment/{{c.id}}','POST','pin2-{{c.id}}','unpin2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-info mr-2"></i>Unpin</a>
<a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a> <a id="mark2-{{c.id}}" class="{% if c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark2-{{c.id}}','unmark2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Mark +18</a>
<a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="post_toast2(this,'/toggle_comment_nsfw/{{c.id}}','mark2-{{c.id}}','unmark2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a> <a id="unmark2-{{c.id}}" class="{% if not c.over_18 %}d-none{% endif %} list-group-item text-danger" role="button" onclick="postToastSwitch(this,'/toggle_comment_nsfw/{{c.id}}','POST','mark2-{{c.id}}','unmark2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-evil text-danger mr-2"></i>Unmark +18</a>
{% endif %} {% endif %}
{% if v.id != c.author_id %} {% if v.id != c.author_id %}
<a id="ban2-{{c.id}}" class="{% if c.author.is_banned %}d-none{% endif %} list-group-item text-danger" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/comment/{{c.id}}', '{{c.author.id}}', '{{c.author_name}}')" role="button"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</a> <a id="ban2-{{c.id}}" class="{% if c.author.is_banned %}d-none{% endif %} list-group-item text-danger" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/comment/{{c.id}}', '{{c.author.id}}', '{{c.author_name}}')" role="button"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</a>
<a id="unban2-{{c.id}}" class="{% if not c.author.is_banned %}d-none{% endif %} list-group-item text-success" role="button" onclick="post_toast2(this,'/unban_user/{{c.author_id}}','ban2-{{c.id}}','unban2-{{c.id}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</a> <a id="unban2-{{c.id}}" class="{% if not c.author.is_banned %}d-none{% endif %} list-group-item text-success" role="button" onclick="postToastSwitch(this,'/unban_user/{{c.author_id}}','POST','ban2-{{c.id}}','unban2-{{c.id}}');" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</a>
{% endif %} {% endif %}
{%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%} {%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%}

View file

@ -13,24 +13,24 @@
{# <a class="list-inline-item copy-link" role="button" data-clipboard-text="{{p.permalink}}"><i class="fas fa-copy"></i>Copy link</a> #} {# <a class="list-inline-item copy-link" role="button" data-clipboard-text="{{p.permalink}}"><i class="fas fa-copy"></i>Copy link</a> #}
{% if v %} {% if v %}
<a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/subscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye"></i>Subscribe</a> <a id="subscribe-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="postToastSwitch(this,'/subscribe/{{p.id}}','POST','subscribe-{{p.id}}','unsubscribe-{{p.id}}');"><i class="fas fa-eye"></i>Subscribe</a>
<a id="unsubscribe-{{p.id}}" class="{% if p.id not in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/unsubscribe/{{p.id}}','subscribe-{{p.id}}','unsubscribe-{{p.id}}')"><i class="fas fa-eye-slash"></i>Unsubscribe</a> <a id="unsubscribe-{{p.id}}" class="{% if p.id not in v.subscribed_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="postToastSwitch(this,'/unsubscribe/{{p.id}}','POST','subscribe-{{p.id}}','unsubscribe-{{p.id}}');"><i class="fas fa-eye-slash"></i>Unsubscribe</a>
{% endif %} {% endif %}
{% if v %} {% if v %}
<a id="save-{{p.id}}" class="{% if p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/save_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Save</a> <a id="save-{{p.id}}" class="{% if p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="postToastSwitch(this,'/save_post/{{p.id}}','POST','save-{{p.id}}','unsave-{{p.id}}');"><i class="fas fa-save"></i>Save</a>
<a id="unsave-{{p.id}}" class="{% if not p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/unsave_post/{{p.id}}','save-{{p.id}}','unsave-{{p.id}}')"><i class="fas fa-save"></i>Unsave</a> <a id="unsave-{{p.id}}" class="{% if not p.id in v.saved_idlist() %}d-none{% endif %} list-inline-item" role="button" onclick="postToastSwitch(this,'/unsave_post/{{p.id}}','POST','save-{{p.id}}','unsave-{{p.id}}');"><i class="fas fa-save"></i>Unsave</a>
<a class="list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="fas fa-flag"></i>Report</a> <a class="list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="fas fa-flag"></i>Report</a>
{% endif %} {% endif %}
{% if v and v.id==p.author_id %} {% if v and v.id==p.author_id %}
{% if request.path.startswith('/@') %} {% if request.path.startswith('/@') %}
<a id="pin-profile-{{p.id}}" class="{% if p.is_pinned %}d-none{% endif %} list-inline-item text-muted" role="button" onclick="post_toast2(this,'/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack fa-rotate--45"></i>Pin to profile</a> <a id="pin-profile-{{p.id}}" class="{% if p.is_pinned %}d-none{% endif %} list-inline-item text-muted" role="button" onclick="postToastSwitch(this,'/pin/{{p.id}}','POST','unpin-profile-{{p.id}}','pin-profile-{{p.id}}');"><i class="fas fa-thumbtack fa-rotate--45"></i>Pin to profile</a>
<a id="unpin-profile-{{p.id}}" class="{% if not p.is_pinned %}d-none{% endif %} list-inline-item text-muted" role="button" onclick="post_toast2(this,'/pin/{{p.id}}','unpin-profile-{{p.id}}','pin-profile-{{p.id}}')"><i class="fas fa-thumbtack fa-rotate--45"></i>Unpin from profile</a> <a id="unpin-profile-{{p.id}}" class="{% if not p.is_pinned %}d-none{% endif %} list-inline-item text-muted" role="button" onclick="postToastSwitch(this,'/pin/{{p.id}}','POST','unpin-profile-{{p.id}}','pin-profile-{{p.id}}');"><i class="fas fa-thumbtack fa-rotate--45"></i>Unpin from profile</a>
{% endif %} {% endif %}
<a id="undelete2-{{p.id}}" class="{% if not p.state_user_deleted_utc %}d-none{% endif %} list-inline-item" role="button" onclick="post_toast2(this,'/undelete_post/{{p.id}}', 'delete2-{{p.id}}', 'undelete2-{{p.id}}');document.getElementById('post-{{p.id}}').classList.remove('deleted')"><i class="fas fa-trash-alt"></i>Undelete</a> <a id="undelete2-{{p.id}}" class="{% if not p.state_user_deleted_utc %}d-none{% endif %} list-inline-item" role="button" onclick="postToastSwitch(this,'/undelete_post/{{p.id}}','POST','delete2-{{p.id}}','undelete2-{{p.id}}');document.getElementById('post-{{p.id}}').classList.remove('deleted');"><i class="fas fa-trash-alt"></i>Undelete</a>
<a id="delete2-{{p.id}}" class="{% if p.state_user_deleted_utc %}d-none{% endif %} list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a> <a id="delete2-{{p.id}}" class="{% if p.state_user_deleted_utc %}d-none{% endif %} list-inline-item" role="button" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="fas fa-trash-alt"></i>Delete</a>
{% endif %} {% endif %}
@ -44,18 +44,18 @@
<a class="list-inline-item" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-ellipsis-h fa-fw"></i></a> <a class="list-inline-item" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fas fa-ellipsis-h fa-fw"></i></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{# {% if v.admin_level %} {# {% if v.admin_level %}
<a id="distinguish-{{p.id}}" class="dropdown-item {% if p.distinguish_level %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Distinguish</a> <a id="distinguish-{{p.id}}" class="dropdown-item {% if p.distinguish_level %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish-{{p.id}}','undistinguish-{{p.id}}');"><i class="fas fa-crown"></i>Distinguish</a>
<a id="undistinguish-{{p.id}}" class="dropdown-item {% if not p.distinguish_level %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish-{{p.id}}','undistinguish-{{p.id}}')"><i class="fas fa-crown"></i>Undistinguish</a> <a id="undistinguish-{{p.id}}" class="dropdown-item {% if not p.distinguish_level %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish-{{p.id}}','undistinguish-{{p.id}}');"><i class="fas fa-crown"></i>Undistinguish</a>
{% endif %} #} {% endif %} #}
{% if v.admin_level > 1 %} {% if v.admin_level > 1 %}
<a id="pin-{{p.id}}" class="dropdown-item {% if p.stickied %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/sticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack fa-rotate--45"></i>Pin</a> <a id="pin-{{p.id}}" class="dropdown-item {% if p.stickied %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/sticky/{{p.id}}','POST','pin-{{p.id}}','unpin-{{p.id}}');"><i class="fas fa-thumbtack fa-rotate--45"></i>Pin</a>
<a id="unpin-{{p.id}}" class="dropdown-item {% if not p.stickied %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/unsticky/{{p.id}}','pin-{{p.id}}','unpin-{{p.id}}')"><i class="fas fa-thumbtack fa-rotate--45"></i>Unpin</a> <a id="unpin-{{p.id}}" class="dropdown-item {% if not p.stickied %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/unsticky/{{p.id}}','POST','pin-{{p.id}}','unpin-{{p.id}}');"><i class="fas fa-thumbtack fa-rotate--45"></i>Unpin</a>
{% endif %} {% endif %}
{# {% if v.admin_level > 1 or v.id == p.author_id %} {# {% if v.admin_level > 1 or v.id == p.author_id %}
<a id="club-{{p.id}}" class="dropdown-item {% if p.club %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye-slash"></i>Mark club</a> <a id="club-{{p.id}}" class="dropdown-item {% if p.club %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club-{{p.id}}','unclub-{{p.id}}');"><i class="fas fa-eye-slash"></i>Mark club</a>
<a id="unclub-{{p.id}}" class="dropdown-item {% if not p.club %}d-none{% endif %} list-inline-item text-info" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club-{{p.id}}','unclub-{{p.id}}')"><i class="fas fa-eye"></i>Unmark club</a> <a id="unclub-{{p.id}}" class="dropdown-item {% if not p.club %}d-none{% endif %} list-inline-item text-info" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club-{{p.id}}','unclub-{{p.id}}');"><i class="fas fa-eye"></i>Unmark club</a>
{% endif %} #} {% endif %} #}
{%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%} {%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%}
@ -72,19 +72,19 @@
{% endif %} {% endif %}
{% if v.id != p.author_id and not p.ghost %} {% if v.id != p.author_id and not p.ghost %}
<a id="unblock-{{p.id}}" class="dropdown-item text-success list-inline-item {% if not p.is_blocking %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/settings/unblock?username={{p.author_name}}','block-{{p.id}}','unblock-{{p.id}}')"><i class="fas fa-eye text-success"></i>Unblock user</a> <a id="unblock-{{p.id}}" class="dropdown-item text-success list-inline-item {% if not p.is_blocking %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/settings/unblock?username={{p.author_name}}','POST','block-{{p.id}}','unblock-{{p.id}}');"><i class="fas fa-eye text-success"></i>Unblock user</a>
<a id="block-{{p.id}}" class="dropdown-item list-inline-item text-danger {% if p.is_blocking %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/settings/block?username={{p.author_name}}','block-{{p.id}}','unblock-{{p.id}}')"><i class="fas fa-eye-slash text-danger"></i>Block user</a> <a id="block-{{p.id}}" class="dropdown-item list-inline-item text-danger {% if p.is_blocking %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/settings/block?username={{p.author_name}}','POST','block-{{p.id}}','unblock-{{p.id}}');"><i class="fas fa-eye-slash text-danger"></i>Block user</a>
{% endif %} {% endif %}
{% if v.id==p.author_id or v.admin_level > 1 %} {% if v.id==p.author_id or v.admin_level > 1 %}
<a id="mark-{{p.id}}" class="dropdown-item {% if p.over_18 %}d-none{% endif %} list-inline-item text-danger" role="button" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}')"><i class="fas fa-eye-evil"></i>Mark +18</a> <a id="mark-{{p.id}}" class="dropdown-item {% if p.over_18 %}d-none{% endif %} list-inline-item text-danger" role="button" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark-{{p.id}}','unmark-{{p.id}}');"><i class="fas fa-eye-evil"></i>Mark +18</a>
<a id="unmark-{{p.id}}" class="dropdown-item {% if not p.over_18 %}d-none{% endif %} list-inline-item text-success" role="button" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark-{{p.id}}','unmark-{{p.id}}')"><i class="fas fa-eye-evil"></i>Unmark +18</a> <a id="unmark-{{p.id}}" class="dropdown-item {% if not p.over_18 %}d-none{% endif %} list-inline-item text-success" role="button" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark-{{p.id}}','unmark-{{p.id}}');"><i class="fas fa-eye-evil"></i>Unmark +18</a>
{% endif %} {% endif %}
{% if v.admin_level > 1 and v.id != p.author_id %} {% if v.admin_level > 1 and v.id != p.author_id %}
<a id="ban-{{p.id}}" class="dropdown-item {% if p.author.is_suspended %}d-none{% endif %} list-inline-item text-danger" id="exile-comment-{{p.id}}" role="button" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/post/{{p.id}}', '{{p.author.id}}', '{{p.author_name}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</a> <a id="ban-{{p.id}}" class="dropdown-item {% if p.author.is_suspended %}d-none{% endif %} list-inline-item text-danger" id="exile-comment-{{p.id}}" role="button" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/post/{{p.id}}', '{{p.author.id}}', '{{p.author_name}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</a>
<a id="unban-{{p.id}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-danger" id="unexile2-user-{{p.id}}" role="button" onclick="post_toast2(this,'/unban_user/{{p.author_id}}','ban-{{p.id}}','unban-{{p.id}}')"><i class="fas fa-user-slash"></i>Unban user</a> <a id="unban-{{p.id}}" class="dropdown-item {% if not p.author.is_suspended %}d-none{% endif %} list-inline-item text-danger" id="unexile2-user-{{p.id}}" role="button" onclick="postToastSwitch(this,'/unban_user/{{p.author_id}}','POST','ban-{{p.id}}','unban-{{p.id}}');"><i class="fas fa-user-slash"></i>Unban user</a>
{% endif %} {% endif %}
</ul> </ul>
{% endif %} {% endif %}

View file

@ -13,14 +13,14 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-dismiss="modal" onclick="togglePostEdit('{{p.id}}')"><i class="far fa-edit text-center text-muted mr-3"></i>Edit</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-dismiss="modal" onclick="togglePostEdit('{{p.id}}')"><i class="far fa-edit text-center text-muted mr-3"></i>Edit</button>
{% endif %} {% endif %}
{# <button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button> {# <button id="club2-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club2-{{p.id}}','unclub2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
<button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club2-{{p.id}}','unclub2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button> <button id="unclub2-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-info text-left" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club2-{{p.id}}','unclub2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button>
<button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-3"></i>Distinguish</button> <button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish2-{{p.id}}','undistinguish2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-3"></i>Distinguish</button>
<button id="undistinguish2-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-3"></i>Undistinguish</button> #} <button id="undistinguish2-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish2-{{p.id}}','undistinguish2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-crown text-center text-primary mr-3"></i>Undistinguish</button> #}
<button id="pin2-{{p.id}}" class="{% if p.stickied %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast2(this,'/sticky/{{p.id}}','pin2-{{p.id}}','unpin2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center text-primary mr-3"></i>Pin</button> <button id="pin2-{{p.id}}" class="{% if p.stickied %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="postToastSwitch(this,'/sticky/{{p.id}}','POST','pin2-{{p.id}}','unpin2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center text-primary mr-3"></i>Pin</button>
<button id="unpin2-{{p.id}}" class="{% if not p.stickied %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="post_toast2(this,'/unsticky/{{p.id}}','pin2-{{p.id}}','unpin2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center text-primary mr-3"></i>Unpin</button> <button id="unpin2-{{p.id}}" class="{% if not p.stickied %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-primary" role="button" onclick="postToastSwitch(this,'/unsticky/{{p.id}}','POST','pin2-{{p.id}}','unpin2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center text-primary mr-3"></i>Unpin</button>
{%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%} {%- if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] -%}
{%- set show_approve = p.state_mod != StateMod.VISIBLE or "/reported/" in request.path -%} {%- set show_approve = p.state_mod != StateMod.VISIBLE or "/reported/" in request.path -%}
@ -33,12 +33,12 @@
<a href="{{p.oauth_app.permalink}}"><button class="nobackground btn btn-link btn-block btn-lg text-muted text-left"><i class="far fa-code text-center text-info mr-3"></i>API App</button></a> <a href="{{p.oauth_app.permalink}}"><button class="nobackground btn btn-link btn-block btn-lg text-muted text-left"><i class="far fa-code text-center text-info mr-3"></i>API App</button></a>
{% endif %} {% endif %}
<button id="mark2-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Mark +18</button> <button id="mark2-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark2-{{p.id}}','unmark2-{{p.id}}');" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Mark +18</button>
<button id="unmark2-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark2-{{p.id}}','unmark2-{{p.id}}')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Unmark +18</button> <button id="unmark2-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark2-{{p.id}}','unmark2-{{p.id}}');" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center text-danger mr-3"></i>Unmark +18</button>
{% if v.id != p.author_id %} {% if v.id != p.author_id %}
<button id="ban2-{{p.id}}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/post/{{p.id}}', '{{p.author.id}}', '{{p.author_name}}')" class="{% if p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button"><i class="fas fa-user-minus mr-3"></i>Ban user</button> <button id="ban2-{{p.id}}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" onclick="banModal('/post/{{p.id}}', '{{p.author.id}}', '{{p.author_name}}')" class="{% if p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button"><i class="fas fa-user-minus mr-3"></i>Ban user</button>
<button id="unban2-{{p.id}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="post_toast2(this,'/unban_user/{{p.author_id}}','ban2-{{p.id}}','unban2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-3"></i>Unban user</button> <button id="unban2-{{p.id}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="postToastSwitch(this,'/unban_user/{{p.author_id}}','POST','ban2-{{p.id}}','unban2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-3"></i>Unban user</button>
{% endif %} {% endif %}
</ul> </ul>
</div> </div>

View file

@ -13,40 +13,40 @@
<button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-3"></i>Report</button> <button class="nobackground btn btn-link btn-block btn-lg text-left text-muted" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#reportPostModal" onclick="report_postModal('{{p.id}}')"><i class="far fa-flag text-center text-muted mr-3"></i>Report</button>
<button id="subscribe2-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/subscribe/{{p.id}}','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye text-center text-muted mr-3"></i>Subscribe</button> <button id="subscribe2-{{p.id}}" class="{% if p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="postToastSwitch(this,'/subscribe/{{p.id}}','POST','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye text-center text-muted mr-3"></i>Subscribe</button>
<button id="unsubscribe2-{{p.id}}" class="{% if not p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/unsubscribe/{{p.id}}','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash text-center text-muted mr-3"></i>Unsubscribe</button> <button id="unsubscribe2-{{p.id}}" class="{% if not p.id in v.subscribed_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="postToastSwitch(this,'/unsubscribe/{{p.id}}','POST','subscribe2-{{p.id}}','unsubscribe2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-slash text-center text-muted mr-3"></i>Unsubscribe</button>
<button id="save2-{{p.id}}" class="{% if p.id in v.saved_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/save_post/{{p.id}}','save2-{{p.id}}','unsave2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-save text-center text-muted mr-3"></i>Save</button> <button id="save2-{{p.id}}" class="{% if p.id in v.saved_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="postToastSwitch(this,'/save_post/{{p.id}}','POST','save2-{{p.id}}','unsave2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-save text-center text-muted mr-3"></i>Save</button>
<button id="unsave2-{{p.id}}" class="{% if not p.id in v.saved_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="post_toast2(this,'/unsave_post/{{p.id}}','save2-{{p.id}}','unsave2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-save text-center text-muted mr-3"></i>Unsave</button> <button id="unsave2-{{p.id}}" class="{% if not p.id in v.saved_idlist() %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-muted" role="button" onclick="postToastSwitch(this,'/unsave_post/{{p.id}}','POST','save2-{{p.id}}','unsave2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-save text-center text-muted mr-3"></i>Unsave</button>
{% if v.id==p.author_id %} {% if v.id==p.author_id %}
{# {% if v.admin_level == 1 %} {# {% if v.admin_level == 1 %}
<button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-crown text-center mr-3"></i>Distinguish</button> <button id="distinguish2-{{p.id}}" class="{% if p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish2-{{p.id}}','undistinguish2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-crown text-center mr-3"></i>Distinguish</button>
<button id="undistinguish2-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left" role="button" onclick="post_toast2(this,'/distinguish/{{p.id}}','distinguish2-{{p.id}}','undistinguish2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-crown text-center mr-3"></i>Undistinguish</button> <button id="undistinguish2-{{p.id}}" class="{% if not p.distinguish_level %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left" role="button" onclick="postToastSwitch(this,'/distinguish/{{p.id}}','POST','distinguish2-{{p.id}}','undistinguish2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-crown text-center mr-3"></i>Undistinguish</button>
{% endif %} #} {% endif %} #}
{% if request.path.startswith('/@') %} {% if request.path.startswith('/@') %}
<button id="pin-profile2-{{p.id}}" class="{% if p.is_pinned %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-muted text-left"role="button" onclick="post_toast2(this,'/pin/{{p.id}}','pin-profile2-{{p.id}}','unpin-profile2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center mr-3"></i>Pin to profile</button> <button id="pin-profile2-{{p.id}}" class="{% if p.is_pinned %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-muted text-left"role="button" onclick="postToastSwitch(this,'/pin/{{p.id}}','POST','pin-profile2-{{p.id}}','unpin-profile2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center mr-3"></i>Pin to profile</button>
<button id="unpin-profile2-{{p.id}}" class="{% if not p.is_pinned %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-muted text-left" role="button" onclick="post_toast2(this,'/pin/{{p.id}}','pin-profile2-{{p.id}}','unpin-profile2-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center mr-3"></i>Unpin from profile</button> <button id="unpin-profile2-{{p.id}}" class="{% if not p.is_pinned %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-muted text-left" role="button" onclick="postToastSwitch(this,'/pin/{{p.id}}','POST','pin-profile2-{{p.id}}','unpin-profile2-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-thumbtack fa-rotate--45 text-center mr-3"></i>Unpin from profile</button>
{% endif %} {% endif %}
<button id="undelete-{{p.id}}" class="{% if not p.state_user_deleted_utc %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" role="button" onclick="post_toast2(this,'/undelete_post/{{p.id}}', 'delete-{{p.id}}', 'undelete-{{p.id}}');document.getElementById('post-{{p.id}}').classList.remove('deleted')" data-bs-dismiss="modal"><i class="far fa-trash-alt text-center mr-3"></i>Undelete</button> <button id="undelete-{{p.id}}" class="{% if not p.state_user_deleted_utc %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" role="button" onclick="postToastSwitch(this,'/undelete_post/{{p.id}}','POST','delete-{{p.id}}','undelete-{{p.id}}');document.getElementById('post-{{p.id}}').classList.remove('deleted');" data-bs-dismiss="modal"><i class="far fa-trash-alt text-center mr-3"></i>Undelete</button>
<button id="delete-{{p.id}}" class="{% if p.state_user_deleted_utc %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="far fa-trash-alt mr-3"></i>Delete</button> <button id="delete-{{p.id}}" class="{% if p.state_user_deleted_utc %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" data-bs-toggle="modal" data-bs-dismiss="modal" data-bs-target="#deletePostModal" onclick="delete_postModal('{{p.id}}')"><i class="far fa-trash-alt mr-3"></i>Delete</button>
{# <button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button> {# <button id="club3-{{p.id}}" class="{% if p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-danger text-left" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club3-{{p.id}}','unclub3-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye-slash mr-3"></i>Mark club</button>
<button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="post_toast2(this,'/toggle_club/{{p.id}}','club3-{{p.id}}','unclub3-{{p.id}}')" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button> #} <button id="unclub3-{{p.id}}" class="{% if not p.club %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" role="button" onclick="postToastSwitch(this,'/toggle_club/{{p.id}}','POST','club3-{{p.id}}','unclub3-{{p.id}}');" data-bs-dismiss="modal"><i class="fas fa-eye mr-3"></i>Unmark club</button> #}
<button id="mark3-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-3"></i>Mark +18</button> <button id="mark3-{{p.id}}" class="{% if p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-danger" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark3-{{p.id}}','unmark3-{{p.id}}');" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-3"></i>Mark +18</button>
<button id="unmark3-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" onclick="post_toast2(this,'/toggle_post_nsfw/{{p.id}}','mark3-{{p.id}}','unmark3-{{p.id}}')" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-3"></i>Unmark +18</button> <button id="unmark3-{{p.id}}" class="{% if not p.over_18 %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-left text-success" onclick="postToastSwitch(this,'/toggle_post_nsfw/{{p.id}}','POST','mark3-{{p.id}}','unmark3-{{p.id}}');" data-bs-dismiss="modal"><i class="far fa-eye-evil text-center mr-3"></i>Unmark +18</button>
{% else %} {% else %}
{% if not p.ghost %} {% if not p.ghost %}
<button id="unblock2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left{% if not p.is_blocking %} d-none{% endif %}" data-bs-dismiss="modal" onclick="post_toast2(this,'/settings/unblock?username={{p.author_name}}','block2-{{p.id}}','unblock2-{{p.id}}')"><i class="fas fa-eye mr-3 text-success"></i>Unblock user</button> <button id="unblock2-{{p.id}}" class="nobackground btn btn-link btn-block btn-lg text-success text-left{% if not p.is_blocking %} d-none{% endif %}" data-bs-dismiss="modal" onclick="postToastSwitch(this,'/settings/unblock?username={{p.author_name}}','POST','block2-{{p.id}}','unblock2-{{p.id}}');"><i class="fas fa-eye mr-3 text-success"></i>Unblock user</button>
<button id="prompt2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left d-none" data-bs-dismiss="modal" onclick="post_toast2(this,'/settings/block?username={{p.author_name}}','prompt2-{{p.id}}','unblock2-{{p.id}}')"><i class="fas fa-eye-slash mr-3 text-danger"></i>Are you sure?</button> <button id="prompt2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left d-none" data-bs-dismiss="modal" onclick="postToastSwitch(this,'/settings/block?username={{p.author_name}}','POST','prompt2-{{p.id}}','unblock2-{{p.id}}');"><i class="fas fa-eye-slash mr-3 text-danger"></i>Are you sure?</button>
<button id="block2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left{% if p.is_blocking %} d-none{% endif %}" onclick="document.getElementById('block2-{{p.id}}').classList.toggle('d-none');document.getElementById('prompt2-{{p.id}}').classList.toggle('d-none');"><i class="fas fa-eye-slash mr-3 text-danger"></i>Block user</button> <button id="block2-{{p.id}}" class="blockuser nobackground btn btn-link btn-block btn-lg text-danger text-left{% if p.is_blocking %} d-none{% endif %}" onclick="document.getElementById('block2-{{p.id}}').classList.toggle('d-none');document.getElementById('prompt2-{{p.id}}').classList.toggle('d-none');"><i class="fas fa-eye-slash mr-3 text-danger"></i>Block user</button>
{% endif %} {% endif %}
{% endif %} {% endif %}

View file

@ -296,16 +296,13 @@
<script src="{{ 'js/lozad.js' | asset }}"></script> <script src="{{ 'js/lozad.js' | asset }}"></script>
{% if v %} {% if v %}
<script src="{{ 'js/post_toast2.js' | asset }}"></script>
<script src="{{ 'js/formatting.js' | asset }}"></script> <script src="{{ 'js/formatting.js' | asset }}"></script>
{% endif %} {% endif %}
<script src="{{ 'js/lite-youtube.js' | asset }}"></script> <script src="{{ 'js/lite-youtube.js' | asset }}"></script>
<script> <script>
MicroModal.init(); MicroModal.init();
</script> </script>
</body> </body>
</html> </html>

View file

@ -40,7 +40,7 @@
</div> </div>
<a class="btn btn-primary mt-3 ml-3" role="button" onclick="post_toast(this, '/clear', '1')">Mark All Read</a> <a class="btn btn-primary mt-3 ml-3" role="button" onclick="postToastReload(this, '/clear', 'POST')">Mark All Read</a>
<div class="notifs px-3 p-md-0"> <div class="notifs px-3 p-md-0">

View file

@ -43,7 +43,7 @@
</div> </div>
<div class="footer"> <div class="footer">
<div class="d-flex"> <div class="d-flex">
<a role="button" class="btn btn-secondary ml-auto" onclick="post_toast(this,'/oauth/reroll/{{app.id}}','1')">Reroll Client ID</a> <a role="button" class="btn btn-secondary ml-auto" onclick="postToastReload(this,'/oauth/reroll/{{app.id}}','POST')">Reroll Client ID</a>
<input type="submit" class="btn btn-primary ml-2" value="Save Changes"> <input type="submit" class="btn btn-primary ml-2" value="Save Changes">
</div> </div>
</div> </div>
@ -109,7 +109,7 @@
</div> </div>
<div class="footer"> <div class="footer">
<div class="d-flex"> <div class="d-flex">
<a role="button" class="btn btn-primary ml-auto text-white" onclick="post_toast(this,'/oauth/rescind/{{auth.id}}')">Revoke</a> <a role="button" class="btn btn-primary ml-auto text-white" onclick="postToastSimple(this,'/oauth/rescind/{{auth.id}}')">Revoke</a>
</div> </div>
</div> </div>
</div> </div>

View file

@ -54,7 +54,7 @@
<i class="fas fa-ellipsis-h text-muted"></i> <i class="fas fa-ellipsis-h text-muted"></i>
</a> </a>
<div class="dropdown-menu border-0 shadow dropdown-menu-right mt-2" aria-labelledby="dropdownMoreLink" x-placement="bottom-end" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(21px, 18px, 0px);"> <div class="dropdown-menu border-0 shadow dropdown-menu-right mt-2" aria-labelledby="dropdownMoreLink" x-placement="bottom-end" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(21px, 18px, 0px);">
<a class="dropdown-item" role="button" onclick="post_toast(this,'/settings/unblock?username={{block.target.username}}&formkey={{v.formkey}}')"><i class="fas fa-check"></i>Unblock</a> <a class="dropdown-item" role="button" onclick="postToastSimple(this,'/settings/unblock?username={{block.target.username}}&formkey={{v.formkey}}')"><i class="fas fa-check"></i>Unblock</a>
</div> </div>
</div> </div>
</td> </td>

View file

@ -13,7 +13,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change how many posts appear on every page.</p> <p>Change how many posts appear on every page.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='frontsize' class="form-control" form="profile-settings" name="frontsize" onchange="post_toast(this,'/settings/profile?frontsize='+document.getElementById('frontsize').value)"> <select autocomplete="off" id='frontsize' class="form-control" form="profile-settings" name="frontsize" onchange="postToastSimple(this,'/settings/profile?frontsize='+document.getElementById('frontsize').value)">
{% for entry in [15, 25, 50, 100] %} {% for entry in [15, 25, 50, 100] %}
<option value="{{entry}}"{{' selected' if v.frontsize==entry}}>{{entry}}</option> <option value="{{entry}}"{{' selected' if v.frontsize==entry}}>{{entry}}</option>
{% endfor %} {% endfor %}
@ -36,7 +36,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the default sorting for comments.</p> <p>Change the default sorting for comments.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='defaultsortingcomments' class="form-control" form="profile-settings" name="defaultsortingcomments" onchange="post_toast(this,'/settings/profile?defaultsortingcomments='+document.getElementById('defaultsortingcomments').value)"> <select autocomplete="off" id='defaultsortingcomments' class="form-control" form="profile-settings" name="defaultsortingcomments" onchange="postToastSimple(this,'/settings/profile?defaultsortingcomments='+document.getElementById('defaultsortingcomments').value)">
{% for entry in SORTS_COMMENTS %} {% for entry in SORTS_COMMENTS %}
<option value="{{entry}}"{{' selected' if v.defaultsortingcomments==entry}}>{{entry}}</option> <option value="{{entry}}"{{' selected' if v.defaultsortingcomments==entry}}>{{entry}}</option>
{% endfor %} {% endfor %}
@ -53,7 +53,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the default sorting for posts.</p> <p>Change the default sorting for posts.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='defaultsorting' class="form-control" form="profile-settings" name="defaultsorting" onchange="post_toast(this,'/settings/profile?defaultsorting='+document.getElementById('defaultsorting').value)"> <select autocomplete="off" id='defaultsorting' class="form-control" form="profile-settings" name="defaultsorting" onchange="postToastSimple(this,'/settings/profile?defaultsorting='+document.getElementById('defaultsorting').value)">
{% for entry in SORTS_POSTS %} {% for entry in SORTS_POSTS %}
<option value="{{entry}}"{{' selected' if v.defaultsorting==entry}}>{{entry}}</option> <option value="{{entry}}"{{' selected' if v.defaultsorting==entry}}>{{entry}}</option>
{% endfor %} {% endfor %}
@ -68,7 +68,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the default time filter for posts.</p> <p>Change the default time filter for posts.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='defaulttime' class="form-control" form="profile-settings" name="defaulttime" onchange="post_toast(this,'/settings/profile?defaulttime='+document.getElementById('defaulttime').value)"> <select autocomplete="off" id='defaulttime' class="form-control" form="profile-settings" name="defaulttime" onchange="postToastSimple(this,'/settings/profile?defaulttime='+document.getElementById('defaulttime').value)">
{% for entry in ["hour", "day", "week", "month", "year", "all"] %} {% for entry in ["hour", "day", "week", "month", "year", "all"] %}
<option value="{{entry}}"{{' selected' if v.defaulttime==entry}}>{{entry}}</option> <option value="{{entry}}"{{' selected' if v.defaulttime==entry}}>{{entry}}</option>
{% endfor %} {% endfor %}
@ -87,7 +87,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="newtab" name="newtab"{% if v.newtab %} checked{% endif %} onchange="post_toast(this,'/settings/profile?newtab='+document.getElementById('newtab').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="newtab" name="newtab"{% if v.newtab %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?newtab='+document.getElementById('newtab').checked);">
<label class="custom-control-label" for="newtab"></label> <label class="custom-control-label" for="newtab"></label>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to automatically open links to other pages in the site in new tabs.</span> <span class="text-small-extra text-muted">Enable if you would like to automatically open links to other pages in the site in new tabs.</span>
@ -104,7 +104,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="newtabexternal" name="newtabexternal"{% if v.newtabexternal %} checked{% endif %} onchange="post_toast(this,'/settings/profile?newtabexternal='+document.getElementById('newtabexternal').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="newtabexternal" name="newtabexternal"{% if v.newtabexternal %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?newtabexternal='+document.getElementById('newtabexternal').checked);">
<label class="custom-control-label" for="newtabexternal"></label> <label class="custom-control-label" for="newtabexternal"></label>
</div> </div>
@ -123,7 +123,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="nitter" name="nitter"{% if v.nitter %} checked{% endif %} onchange="post_toast(this,'/settings/profile?nitter='+document.getElementById('nitter').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="nitter" name="nitter"{% if v.nitter %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?nitter='+document.getElementById('nitter').checked);">
<label class="custom-control-label" for="nitter"></label> <label class="custom-control-label" for="nitter"></label>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to automatically convert twitter.com links to nitter.net links.</span> <span class="text-small-extra text-muted">Enable if you would like to automatically convert twitter.com links to nitter.net links.</span>
@ -140,7 +140,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the domain you would like to view reddit posts in.</p> <p>Change the domain you would like to view reddit posts in.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='reddit' class="form-control" form="profile-settings" name="reddit" onchange="post_toast(this,'/settings/profile?reddit='+document.getElementById('reddit').value)"> <select autocomplete="off" id='reddit' class="form-control" form="profile-settings" name="reddit" onchange="postToastSimple(this,'/settings/profile?reddit='+document.getElementById('reddit').value)">
{% for entry in ['old.reddit.com', 'reddit.com', 'i.reddit.com', 'unddit.com', 'teddit.net', 'libredd.it'] %} {% for entry in ['old.reddit.com', 'reddit.com', 'i.reddit.com', 'unddit.com', 'teddit.net', 'libredd.it'] %}
<option value="{{entry}}"{{' selected' if v.reddit==entry}}>{{entry}}</option> <option value="{{entry}}"{{' selected' if v.reddit==entry}}>{{entry}}</option>
{% endfor %} {% endfor %}
@ -156,7 +156,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="controversial" name="controversial"{% if v.controversial %} checked{% endif %} onchange="post_toast(this,'/settings/profile?controversial='+document.getElementById('controversial').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="controversial" name="controversial"{% if v.controversial %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?controversial='+document.getElementById('controversial').checked);">
<label class="custom-control-label" for="controversial"></label> <label class="custom-control-label" for="controversial"></label>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to automatically sort reddit.com links by controversial.</span> <span class="text-small-extra text-muted">Enable if you would like to automatically sort reddit.com links by controversial.</span>
@ -177,7 +177,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="over18" name="over18"{% if v.over_18 %} checked{% endif %} onchange="post_toast(this,'/settings/profile?over18='+document.getElementById('over18').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="over18" name="over18"{% if v.over_18 %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?over18='+document.getElementById('over18').checked);">
<label class="custom-control-label" for="over18"></label> <label class="custom-control-label" for="over18"></label>
</div> </div>
@ -196,7 +196,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="hidevotedon" name="hidevotedon"{% if v.hidevotedon %} checked{% endif %} onchange="post_toast(this,'/settings/profile?hidevotedon='+document.getElementById('hidevotedon').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="hidevotedon" name="hidevotedon"{% if v.hidevotedon %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?hidevotedon='+document.getElementById('hidevotedon').checked);">
<label class="custom-control-label" for="hidevotedon"></label> <label class="custom-control-label" for="hidevotedon"></label>
</div> </div>

View file

@ -13,7 +13,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="cardview" name="cardview"{% if v.cardview %} checked{% endif %} onchange="post_toast(this,'/settings/profile?cardview='+document.getElementById('cardview').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="cardview" name="cardview"{% if v.cardview %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?cardview='+document.getElementById('cardview').checked);">
<label class="custom-control-label" for="cardview"></label> <label class="custom-control-label" for="cardview"></label>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to display images and videos in full size on the frontpage.</span> <span class="text-small-extra text-muted">Enable if you would like to display images and videos in full size on the frontpage.</span>
@ -27,7 +27,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="highlightcomments" name="highlightcomments"{% if v.highlightcomments %} checked{% endif %} onchange="post_toast(this,'/settings/profile?highlightcomments='+document.getElementById('highlightcomments').checked);"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="highlightcomments" name="highlightcomments"{% if v.highlightcomments %} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?highlightcomments='+document.getElementById('highlightcomments').checked);">
<label class="custom-control-label" for="highlightcomments"></label> <label class="custom-control-label" for="highlightcomments"></label>
</div> </div>
<span class="text-small-extra text-muted">Enable if you would like to highlight comments made after the last time you visited a thread.</span> <span class="text-small-extra text-muted">Enable if you would like to highlight comments made after the last time you visited a thread.</span>
@ -41,7 +41,7 @@
<div class="body w-lg-100"> <div class="body w-lg-100">
<p>Change the theme for the website.</p> <p>Change the theme for the website.</p>
<div class="input-group mb2"> <div class="input-group mb2">
<select autocomplete="off" id='theme' class="form-control" form="profile-settings" name="theme" onchange="post_toast(this,'/settings/profile?theme='+document.getElementById('theme').value, '1')"> <select autocomplete="off" id='theme' class="form-control" form="profile-settings" name="theme" onchange="postToastReload(this,'/settings/profile?theme='+document.getElementById('theme').value, 'POST')">
{% for entry in THEMES %} {% for entry in THEMES %}
<option value="{{entry}}" {% if v.theme==entry %} selected {% endif %}> <option value="{{entry}}" {% if v.theme==entry %} selected {% endif %}>
{{entry}} {{entry}}
@ -281,7 +281,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="privateswitch" name="private"{% if v.is_private %} checked{% endif %}{% if not can_change_profile_privacy %} disabled{% endif %} onchange="post_toast(this,'/id/{{v.id}}/private/' + (this.checked ? '1' : '0'));"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="privateswitch" name="private"{% if v.is_private %} checked{% endif %}{% if not can_change_profile_privacy %} disabled{% endif %} onchange="postToastSimple(this,'/id/{{v.id}}/private/' + (this.checked ? '1' : '0'));">
<label class="custom-control-label" for="privateswitch"></label> <label class="custom-control-label" for="privateswitch"></label>
</div> </div>
<span class="text-small-extra text-muted"> <span class="text-small-extra text-muted">
@ -299,7 +299,7 @@
</div> </div>
<div class="body w-lg-100"> <div class="body w-lg-100">
<div class="custom-control custom-switch"> <div class="custom-control custom-switch">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="nofollowswitch" name="nofollow"{% if v.is_nofollow%} checked{% endif %} onchange="post_toast(this,'/settings/profile?nofollow='+document.getElementById('nofollowswitch').checked)"> <input autocomplete="off" type="checkbox" class="custom-control-input" id="nofollowswitch" name="nofollow"{% if v.is_nofollow%} checked{% endif %} onchange="postToastSimple(this,'/settings/profile?nofollow='+document.getElementById('nofollowswitch').checked)">
<label class="custom-control-label" for="nofollowswitch"></label> <label class="custom-control-label" for="nofollowswitch"></label>
</div> </div>
<span class="text-small-extra text-muted">Prevent other users from following you.</span> <span class="text-small-extra text-muted">Prevent other users from following you.</span>

View file

@ -25,7 +25,7 @@
<input autocomplete="off" class="form-control" id="new_email" {% if v.email %}placeholder="{{v.email}}"{% else %}placeholder="Your email"{% endif %} <input autocomplete="off" class="form-control" id="new_email" {% if v.email %}placeholder="{{v.email}}"{% else %}placeholder="Your email"{% endif %}
aria-describedby="new_email" type="email" pattern='[^@]+@[^@]+\.[^@]+' name="new_email" required> aria-describedby="new_email" type="email" pattern='[^@]+@[^@]+\.[^@]+' name="new_email" required>
{% if v.email and not v.is_activated %} {% if v.email and not v.is_activated %}
<div class="text-danger text-small-extra mt-1" id="email-verify-text">Email not verified. You will not be able to recover your account with this email until you verify it. <u><a role="button" onclick="post_toast(this,'/verify_email');emailVerifyText()">Verify now.</a></u></div> <div class="text-danger text-small-extra mt-1" id="email-verify-text">Email not verified. You will not be able to recover your account with this email until you verify it. <u><a role="button" onclick="postToastSimple(this,'/verify_email');emailVerifyText()">Verify now.</a></u></div>
{% elif not v.email %} {% elif not v.email %}
<div class="text-danger text-small-extra mt-1" id="email-verify-text">Add an email to secure your account in case you forget your password.</div> <div class="text-danger text-small-extra mt-1" id="email-verify-text">Add an email to secure your account in case you forget your password.</div>
{% endif %} {% endif %}

View file

@ -72,8 +72,8 @@
<td>{{a['owned']}}</td> <td>{{a['owned']}}</td>
{% set kind = a['kind'] %} {% set kind = a['kind'] %}
<td> <td>
{% if a['kind'] != "benefactor" %}<a class="d-flex btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}')"><span class="m-auto">Buy with coins</span></a>{% endif %} {% if a['kind'] != "benefactor" %}<a class="d-flex btn btn-success {% if v.coins < a['price'] %}disabled{% endif %}" role="button" onclick="postToastSimple(this,'/buy/{{kind}}')"><span class="m-auto">Buy with coins</span></a>{% endif %}
{% if a['kind'] != "grass" %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="post_toast(this,'/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with marseybux</span></a>{% endif %} {% if a['kind'] != "grass" %}<a class="d-flex marseybux btn btn-success {% if v.procoins < a['price'] %}disabled{% endif %}" role="button" onclick="postToastSimple(this,'/buy/{{kind}}?mb=true')"><span class="m-auto">Buy with marseybux</span></a>{% endif %}
</td> </td>
<td> <td>
{{a['description']}} {{a['description']}}

View file

@ -13,9 +13,9 @@
{% if v %} {% if v %}
{% if v.id!=u.id and not u.is_private and not u.is_nofollow %} {% if v.id!=u.id and not u.is_private and not u.is_nofollow %}
<div id="button-sub-{{u.id}}" style="z-index: 2" class="{% if u.has_follower(v) %}d-none{% endif %}"><a class="btn btn-primary" role="button" onclick="post_toast2(this,'/follow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Follow</a></div> <div id="button-sub-{{u.id}}" style="z-index: 2" class="{% if u.has_follower(v) %}d-none{% endif %}"><a class="btn btn-primary" role="button" onclick="postToastSwitch(this,'/follow/{{u.username}}','POST','button-sub-{{u.id}}','button-unsub-{{u.id}}');">Follow</a></div>
<div id="button-unsub-{{u.id}}" style="z-index: 2" class="{% if not u.has_follower(v) %} d-none{% endif %}"><a class="btn btn-secondary" role="button" onclick="post_toast2(this,'/unfollow/{{u.username}}','button-sub-{{u.id}}','button-unsub-{{u.id}}')">Unfollow</a></div> <div id="button-unsub-{{u.id}}" style="z-index: 2" class="{% if not u.has_follower(v) %} d-none{% endif %}"><a class="btn btn-secondary" role="button" onclick="postToastSwitch(this,'/unfollow/{{u.username}}','POST','button-sub-{{u.id}}','button-unsub-{{u.id}}');">Unfollow</a></div>
{% endif %} {% endif %}
{% else %} {% else %}
<div id="button-sub-{{u.id}}" style="z-index: 2"><a class="btn btn-primary" href="/signup">Follow</a></div> <div id="button-sub-{{u.id}}" style="z-index: 2"><a class="btn btn-primary" href="/signup">Follow</a></div>

View file

@ -145,16 +145,16 @@
<div class="d-flex justify-content-between align-items-center"> <div class="d-flex justify-content-between align-items-center">
<div> <div>
{% if v and v.id != u.id %} {% if v and v.id != u.id %}
<a id="button-unsub" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/unfollow/{{u.username}}','button-unsub','button-sub')">Unfollow</a> <a id="button-unsub" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/unfollow/{{u.username}}','POST','button-unsub','button-sub');">Unfollow</a>
<a id="button-sub" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/follow/{{u.username}}','button-unsub','button-sub')">Follow</a> <a id="button-sub" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/follow/{{u.username}}','POST','button-unsub','button-sub');">Follow</a>
<a class="btn btn-primary" role="button" onclick="toggleElement('message', 'input-message')">Message</a> <a class="btn btn-primary" role="button" onclick="toggleElement('message', 'input-message')">Message</a>
{% if v and v.admin_level >= 3 %} {% if v and v.admin_level >= 3 %}
<a id="admin" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2(this,'/@{{u.username}}/make_admin','admin','unadmin')">Make admin</a> <a id="admin" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="postToastSwitch(this,'/@{{u.username}}/make_admin','POST','admin','unadmin');">Make admin</a>
<a id="unadmin" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2(this,'/@{{u.username}}/remove_admin','admin','unadmin')">Remove admin</a> <a id="unadmin" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="postToastSwitch(this,'/@{{u.username}}/remove_admin','POST','admin','unadmin');">Remove admin</a>
{% if u.admin_level > 1 %} {% if u.admin_level > 1 %}
<a class="btn btn-primary" role="button" onclick="post_toast(this,'/@{{u.username}}/revert_actions')">Revert admin actions</a> <a class="btn btn-primary" role="button" onclick="postToastSimple(this,'/@{{u.username}}/revert_actions')">Revert admin actions</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -222,16 +222,16 @@
<pre></pre> <pre></pre>
<pre></pre> <pre></pre>
<a id="shadowban" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban','unshadowban')">Shadowban</a> <a id="shadowban" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/shadowban/{{u.id}}','POST','shadowban','unshadowban');">Shadowban</a>
<a id="unshadowban" class="{% if not u.shadowbanned %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/unshadowban/{{u.id}}','shadowban','unshadowban')">Unshadowban</a> <a id="unshadowban" class="{% if not u.shadowbanned %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/unshadowban/{{u.id}}','POST','shadowban','unshadowban');">Unshadowban</a>
<pre></pre> <pre></pre>
{% if v and v.admin_level >= 3 %} {% if v and v.admin_level >= 3 %}
<a id="verify" class="{% if u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/admin/verify/{{u.id}}','verify','unverify')">Verify</a> <a id="verify" class="{% if u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/admin/verify/{{u.id}}','POST','verify','unverify');">Verify</a>
<a id="unverify" class="{% if not u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/admin/unverify/{{u.id}}','verify','unverify')">Unverify</a> <a id="unverify" class="{% if not u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/admin/unverify/{{u.id}}','POST','verify','unverify');">Unverify</a>
{% endif %} {% endif %}
<pre></pre> <pre></pre>
@ -247,12 +247,12 @@
<input type="submit" class="btn btn-danger" value="Remove User's Content"> <input type="submit" class="btn btn-danger" value="Remove User's Content">
</form> </form>
<pre></pre> <pre></pre>
<button id="grant2" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2(this,'/@{{u.username}}/club_allow','grant2','bar2')">Grant club access</button> <button id="grant2" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="postToastSwitch(this,'/@{{u.username}}/club_allow','POST','grant2','bar2');">Grant club access</button>
<button id="bar2" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast2(this,'/@{{u.username}}/club_ban','grant2','bar2')">Bar from club</button> <button id="bar2" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="postToastSwitch(this,'/@{{u.username}}/club_ban','POST','grant2','bar2');">Bar from club</button>
{% endif %} {% endif %}
{% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %} {% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %}
<a id="private-desktop" class="{% if u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/id/{{u.id}}/private/1','private-desktop','unprivate-desktop')">Set Private Mode</a> <a id="private-desktop" class="{% if u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/id/{{u.id}}/private/1','POST','private-desktop','unprivate-desktop');">Set Private Mode</a>
<a id="unprivate-desktop" class="{% if not u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/id/{{u.id}}/private/0','private-desktop','unprivate-desktop')">Unset Private Mode</a> <a id="unprivate-desktop" class="{% if not u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/id/{{u.id}}/private/0','POST','private-desktop','unprivate-desktop');">Unset Private Mode</a>
{% endif %} {% endif %}
<pre></pre> <pre></pre>
<p>User ID: {{u.id}}</p> <p>User ID: {{u.id}}</p>
@ -395,16 +395,16 @@
{% endif %} {% endif %}
{% if v and v.id != u.id %} {% if v and v.id != u.id %}
<a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/unfollow/{{u.username}}','button-unsub2','button-sub2')">Unfollow</a> <a id="button-unsub2" class="btn btn-secondary {% if not is_following %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/unfollow/{{u.username}}','POST','button-unsub2','button-sub2');">Unfollow</a>
<a id="button-sub2" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" role="button" onclick="post_toast2(this,'/follow/{{u.username}}','button-unsub2','button-sub2')">Follow</a> <a id="button-sub2" class="btn btn-primary {% if is_following or u.is_nofollow or u.is_blocked %}d-none{% endif %}" role="button" onclick="postToastSwitch(this,'/follow/{{u.username}}','POST','button-unsub2','button-sub2');">Follow</a>
<a class="btn btn-primary" role="button" onclick="toggleElement('message-mobile', 'input-message-mobile')">Message</a> <a class="btn btn-primary" role="button" onclick="toggleElement('message-mobile', 'input-message-mobile')">Message</a>
{% if v and v.admin_level >= 3 %} {% if v and v.admin_level >= 3 %}
<a id="admin2" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2(this,'/@{{u.username}}/make_admin','admin2','unadmin2')">Make admin</a> <a id="admin2" class="{% if u.admin_level > 1 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="postToastSwitch(this,'/@{{u.username}}/make_admin','POST','admin2','unadmin2');">Make admin</a>
<a id="unadmin2" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="post_toast2(this,'/@{{u.username}}/remove_admin','admin2','unadmin2')">Remove admin</a> <a id="unadmin2" class="{% if u.admin_level < 2 %}d-none{% endif %} btn btn-primary" href="javascript:void(0)" onclick="postToastSwitch(this,'/@{{u.username}}/remove_admin','POST','admin2','unadmin2');">Remove admin</a>
{% if u.admin_level > 1 %} {% if u.admin_level > 1 %}
<a class="btn btn-primary" role="button" onclick="post_toast(this,'/@{{u.username}}/revert_actions')">Revert admin actions</a> <a class="btn btn-primary" role="button" onclick="postToastSimple(this,'/@{{u.username}}/revert_actions')">Revert admin actions</a>
{% endif %} {% endif %}
{% endif %} {% endif %}
@ -426,8 +426,8 @@
{% if v and v.admin_level >= 2 %} {% if v and v.admin_level >= 2 %}
<button id="grant" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="post_toast2(this,'/@{{u.username}}/club_allow','grant','bar')">Grant club access</button> <button id="grant" class="{% if u.paid_dues %}d-none{% endif %} btn btn-success" onclick="postToastSwitch(this,'/@{{u.username}}/club_allow','POST','grant','bar');">Grant club access</button>
<button id="bar" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="post_toast2(this,'/@{{u.username}}/club_ban','grant','bar')">Bar from club</button> <button id="bar" class="{% if u.club_allowed == False %}d-none{% endif %} btn btn-danger" onclick="postToastSwitch(this,'/@{{u.username}}/club_ban','POST','grant','bar');">Bar from club</button>
<br><br> <br><br>
<div class="body d-lg-flex border-bottom"> <div class="body d-lg-flex border-bottom">
@ -474,16 +474,16 @@
<pre></pre> <pre></pre>
<pre></pre> <pre></pre>
<a id="shadowban2" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/shadowban/{{u.id}}','shadowban2','unshadowban2')">Shadowban</a> <a id="shadowban2" class="{% if u.shadowbanned %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/shadowban/{{u.id}}','POST','shadowban2','unshadowban2');">Shadowban</a>
<a id="unshadowban2" class="{% if not u.shadowbanned %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/unshadowban/{{u.id}}','shadowban2','unshadowban2')">Unshadowban</a> <a id="unshadowban2" class="{% if not u.shadowbanned %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/unshadowban/{{u.id}}','POST','shadowban2','unshadowban2');">Unshadowban</a>
<pre></pre> <pre></pre>
{% if v and v.admin_level >= 3 %} {% if v and v.admin_level >= 3 %}
<a id="verify2" class="{% if u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/admin/verify/{{u.id}}','verify2','unverify2')">Verify</a> <a id="verify2" class="{% if u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/admin/verify/{{u.id}}','POST','verify2','unverify2');">Verify</a>
<a id="unverify2" class="{% if not u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="post_toast2(this,'/admin/unverify/{{u.id}}','verify2','unverify2')">Unverify</a> <a id="unverify2" class="{% if not u.verified %}d-none{% endif %} btn btn-success" role="button" onclick="postToastSwitch(this,'/admin/unverify/{{u.id}}','POST','verify2','unverify2');">Unverify</a>
{% endif %} {% endif %}
<pre></pre> <pre></pre>
@ -501,8 +501,8 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %} {% if v and v.admin_level >= PERMS['USER_SET_PROFILE_PRIVACY'] %}
<a id="private-mobile" class="{% if u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/id/{{u.id}}/private/1','private-mobile','unprivate-mobile')">Set Private Mode</a> <a id="private-mobile" class="{% if u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/id/{{u.id}}/private/1','POST','private-mobile','unprivate-mobile')">Set Private Mode</a>
<a id="unprivate-mobile" class="{% if not u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="post_toast2(this,'/id/{{u.id}}/private/0','private-mobile','unprivate-mobile')">Unset Private Mode</a> <a id="unprivate-mobile" class="{% if not u.is_private %}d-none{% endif %} btn btn-danger" role="button" onclick="postToastSwitch(this,'/id/{{u.id}}/private/0','POST','private-mobile','unprivate-mobile')">Unset Private Mode</a>
{% endif %} {% endif %}
<pre></pre> <pre></pre>
<p>User ID: {{u.id}}</p> <p>User ID: {{u.id}}</p>