This commit is contained in:
Aevann1 2021-10-06 01:24:09 +02:00
parent 7adf7f779f
commit ebf182f062
5 changed files with 6 additions and 17 deletions

View file

@ -1,17 +1,9 @@
function post(url, callback, errortext) {
function post(url) {
var xhr = new XMLHttpRequest();
xhr.open("POST", url, true);
var form = new FormData()
form.append("formkey", formkey());
xhr.withCredentials=true;
xhr.onerror=function() { alert(errortext); };
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status < 300) {
if (typeof callback === "function") callback();
} else {
xhr.onerror();
}
};
xhr.send(form);
};

View file

@ -165,6 +165,7 @@ def api_vote_comment(comment_id, new, v):
@app.post("/vote/poll/<comment_id>")
@auth_required
@validate_formkey
def api_vote_poll(comment_id, v):
vote = request.values.get("vote")

View file

@ -33,7 +33,7 @@
{% if v %}
{% include "award_modal.html" %}
<script src="/assets/js/comments_v.js?v=9"></script>
<script src="/assets/js/comments_v.js?v=10"></script>
{% endif %}
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>

View file

@ -22,12 +22,8 @@
this.innerHTML='<span class="spinner-border spinner-border-sm mr-2" role="status" aria-hidden="true"></span>Deleting post';
this.disabled = true;
post('/delete_post/' + id,
callback = function() {
location.reload();
}
)
post('/delete_post/' + id);
location.reload();
}
document.getElementById("deletePostButton-mobile").onclick = delete_post;

View file

@ -36,7 +36,7 @@
{% if 'rdrama' not in request.host %}
{% if v %}
<script src="/assets/js/comments_v.js?v=9"></script>
<script src="/assets/js/comments_v.js?v=10"></script>
{% include "award_modal.html" %}
{% include "emoji_modal.html" %}
{% include "gif_modal.html" %}