From 17a08aeb77d458b0414e237a84f5ba02035e7ebd Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Tue, 1 Feb 2022 04:20:25 +0200 Subject: [PATCH] fddf --- files/assets/js/delete_post_modal.js | 38 +++++++++++++--------- files/templates/admin/awards.html | 4 +-- files/templates/admin/badge_grant.html | 4 +-- files/templates/admin/badge_remove.html | 4 +-- files/templates/admin/sidebar.html | 2 +- files/templates/authforms.html | 4 +-- files/templates/award_modal.html | 2 +- files/templates/ban_modal.html | 6 ++-- files/templates/contact.html | 2 +- files/templates/default.html | 2 +- files/templates/delete_post_modal.html | 19 +++-------- files/templates/emoji_modal.html | 2 +- files/templates/login.html | 2 +- files/templates/login_2fa.html | 2 +- files/templates/mobile_navigation_bar.html | 14 ++++---- files/templates/report_post_modal.html | 8 ++--- files/templates/settings.html | 14 ++++---- files/templates/settings2.html | 2 +- files/templates/settings_blocks.html | 8 ++--- files/templates/settings_security.html | 2 +- files/templates/shop.html | 4 +-- files/templates/sign_up.html | 4 +-- files/templates/sign_up_failed_ref.html | 4 +-- files/templates/submission.html | 23 ++++++------- files/templates/submission_listing.html | 21 +++++------- 25 files changed, 94 insertions(+), 103 deletions(-) diff --git a/files/assets/js/delete_post_modal.js b/files/assets/js/delete_post_modal.js index 57732e158..446677227 100644 --- a/files/assets/js/delete_post_modal.js +++ b/files/assets/js/delete_post_modal.js @@ -1,22 +1,28 @@ function delete_postModal(id) { - - function delete_post(){ - - this.innerHTML='Deleting post'; - this.disabled = true; - - var url = '/delete_post/' + id + document.getElementById("deletePostButton").onclick = function() { const xhr = new XMLHttpRequest(); - xhr.open("POST", url, true); + xhr.open("POST", `/delete_post/${id}`, true); xhr.setRequestHeader('xhr', 'xhr'); var form = new FormData() form.append("formkey", formkey()); - xhr.onload = function() {location.reload(true);}; + 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(`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"]; + new bootstrap.Toast(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"]; + new bootstrap.Toast(document.getElementById('toast-post-error')).show(); + } + }; xhr.send(form); - } - - document.getElementById("deletePostButton-mobile").onclick = delete_post; - - document.getElementById("deletePostButton").onclick = delete_post; - -}; \ No newline at end of file + }; +} \ No newline at end of file diff --git a/files/templates/admin/awards.html b/files/templates/admin/awards.html index ec9862d93..75ac7c044 100644 --- a/files/templates/admin/awards.html +++ b/files/templates/admin/awards.html @@ -14,7 +14,7 @@ {{error}} - @@ -25,7 +25,7 @@ {{msg}} - diff --git a/files/templates/admin/badge_grant.html b/files/templates/admin/badge_grant.html index ea422d2b8..3381a853b 100644 --- a/files/templates/admin/badge_grant.html +++ b/files/templates/admin/badge_grant.html @@ -14,7 +14,7 @@ {{error}} - @@ -25,7 +25,7 @@ {{msg}} - diff --git a/files/templates/admin/badge_remove.html b/files/templates/admin/badge_remove.html index dbb986e04..a91f5210c 100644 --- a/files/templates/admin/badge_remove.html +++ b/files/templates/admin/badge_remove.html @@ -14,7 +14,7 @@ {{error}} - @@ -25,7 +25,7 @@ {{msg}} - diff --git a/files/templates/admin/sidebar.html b/files/templates/admin/sidebar.html index ce8e66fcd..1a0d66569 100644 --- a/files/templates/admin/sidebar.html +++ b/files/templates/admin/sidebar.html @@ -10,7 +10,7 @@ {{msg}} - diff --git a/files/templates/authforms.html b/files/templates/authforms.html index 5ed9100eb..02f25588c 100644 --- a/files/templates/authforms.html +++ b/files/templates/authforms.html @@ -79,7 +79,7 @@ {{error}} - @@ -90,7 +90,7 @@ {{msg}} - diff --git a/files/templates/award_modal.html b/files/templates/award_modal.html index ac43f9193..3b16a57b1 100644 --- a/files/templates/award_modal.html +++ b/files/templates/award_modal.html @@ -4,7 +4,7 @@ diff --git a/files/templates/contact.html b/files/templates/contact.html index b86654f0e..58ed3f2c6 100644 --- a/files/templates/contact.html +++ b/files/templates/contact.html @@ -13,7 +13,7 @@ {{msg}} - diff --git a/files/templates/default.html b/files/templates/default.html index d5d0a88b9..c0d9aba45 100644 --- a/files/templates/default.html +++ b/files/templates/default.html @@ -47,7 +47,7 @@ - + diff --git a/files/templates/delete_post_modal.html b/files/templates/delete_post_modal.html index 2c70bc57d..f1f1e4606 100644 --- a/files/templates/delete_post_modal.html +++ b/files/templates/delete_post_modal.html @@ -1,11 +1,11 @@ - + diff --git a/files/templates/emoji_modal.html b/files/templates/emoji_modal.html index d34b86cea..2524d466f 100644 --- a/files/templates/emoji_modal.html +++ b/files/templates/emoji_modal.html @@ -37,7 +37,7 @@ - diff --git a/files/templates/login.html b/files/templates/login.html index e059c63bb..99ad73601 100644 --- a/files/templates/login.html +++ b/files/templates/login.html @@ -64,7 +64,7 @@
Forgot password? - diff --git a/files/templates/login_2fa.html b/files/templates/login_2fa.html index b707b734d..74657b15b 100644 --- a/files/templates/login_2fa.html +++ b/files/templates/login_2fa.html @@ -56,7 +56,7 @@
Invalid verification code. Please try again.
- diff --git a/files/templates/mobile_navigation_bar.html b/files/templates/mobile_navigation_bar.html index 92eb0461c..454d3502c 100644 --- a/files/templates/mobile_navigation_bar.html +++ b/files/templates/mobile_navigation_bar.html @@ -3,7 +3,7 @@
- {% if v and v.defaultsorting == 'new' %} - {% else %} - {% endif %} - - {% if v %} - {% else %} -
@@ -15,8 +15,8 @@
@@ -25,7 +25,7 @@ We'll take it from here.
diff --git a/files/templates/settings.html b/files/templates/settings.html index b8a04a4d0..f5175b213 100644 --- a/files/templates/settings.html +++ b/files/templates/settings.html @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -73,7 +73,7 @@ {{error}} - @@ -84,7 +84,7 @@ {{msg}} - @@ -170,7 +170,7 @@ @@ -222,7 +222,7 @@ diff --git a/files/templates/settings2.html b/files/templates/settings2.html index 2c3fa4a2a..41c7dd282 100644 --- a/files/templates/settings2.html +++ b/files/templates/settings2.html @@ -18,7 +18,7 @@ - + diff --git a/files/templates/settings_blocks.html b/files/templates/settings_blocks.html index f4f9aabf8..e86c6736b 100644 --- a/files/templates/settings_blocks.html +++ b/files/templates/settings_blocks.html @@ -16,7 +16,7 @@ {{error}} - @@ -98,7 +98,7 @@ diff --git a/files/templates/settings_security.html b/files/templates/settings_security.html index c34b544aa..50c89d8fd 100644 --- a/files/templates/settings_security.html +++ b/files/templates/settings_security.html @@ -223,7 +223,7 @@ @@ -34,7 +34,7 @@ {{msg}} - diff --git a/files/templates/sign_up.html b/files/templates/sign_up.html index a6cf61b70..e88929e43 100644 --- a/files/templates/sign_up.html +++ b/files/templates/sign_up.html @@ -14,7 +14,7 @@ - + @@ -25,7 +25,7 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}Sign up - {{SITE_NAME}}{% endif %} diff --git a/files/templates/sign_up_failed_ref.html b/files/templates/sign_up_failed_ref.html index b0f90967f..0a76cc504 100644 --- a/files/templates/sign_up_failed_ref.html +++ b/files/templates/sign_up_failed_ref.html @@ -15,7 +15,7 @@ - + @@ -26,7 +26,7 @@ - + {% if ref_user %}{{ref_user.username}} invites you to {{SITE_NAME}}{% else %}{{SITE_NAME}}{% endif %} diff --git a/files/templates/submission.html b/files/templates/submission.html index 79180b49d..008e68b85 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -310,11 +310,10 @@ {% endif %} - {% if p.deleted_utc %} - - {% else %} - - {% endif %} + + + + {% if v.club_allowed != False %} @@ -409,8 +408,8 @@
-
-
+
+
{% if not p.is_image and p.thumb_url and not p.embed_url %}
@@ -632,11 +631,9 @@ Unpin from profile {% endif %} - {% if p.deleted_utc %} - Undelete - {% else %} - Delete - {% endif %} + Undelete + + Delete {% endif %} {% if v %} @@ -878,7 +875,7 @@
{% if offset %} - + {% endif %} {% elif not p.replies and p.deleted_utc == 0 %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index dbd5f01cb..ec769708e 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -236,11 +236,9 @@ Unpin from profile {% endif %} - {% if p.deleted_utc %} - Undelete - {% else %} - Delete - {% endif %} + Undelete + + Delete {% endif %} {% if v %} @@ -382,7 +380,7 @@