From c49ae422055f24ad5b3160ba8c646e84c138c5fe Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Fri, 14 Oct 2022 20:41:03 +0200 Subject: [PATCH] fix for joan --- ...ission_listing.js => highlightcomments.js} | 25 ------------------- files/assets/js/pinpost.js | 24 ++++++++++++++++++ files/templates/submission.html | 6 ++++- files/templates/submission_listing.html | 6 ++++- 4 files changed, 34 insertions(+), 27 deletions(-) rename files/assets/js/{submission+submission_listing.js => highlightcomments.js} (68%) create mode 100644 files/assets/js/pinpost.js diff --git a/files/assets/js/submission+submission_listing.js b/files/assets/js/highlightcomments.js similarity index 68% rename from files/assets/js/submission+submission_listing.js rename to files/assets/js/highlightcomments.js index 96dcd99c3..8f359d539 100644 --- a/files/assets/js/submission+submission_listing.js +++ b/files/assets/js/highlightcomments.js @@ -39,28 +39,3 @@ if (typeof showNewCommentCounts === 'undefined') { setTimeout(cleanCache, 500) } - -function pinPost(t, id) { - t.disabled = true; - t.classList.add("disabled"); - post_toast_callback(`/sticky/${id}`, - { - }, - (xhr) => { - if(xhr.status == 200) { - t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin permanently') - } - else if(xhr.status == 201) { - t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin for 1 hour') - t.classList.add('d-none') - } - t.nextElementSibling.classList.remove('d-none') - t.disabled = false; - t.classList.remove("disabled"); - } - ); - setTimeout(() => { - t.disabled = false; - t.classList.remove("disabled"); - }, 2000); -} diff --git a/files/assets/js/pinpost.js b/files/assets/js/pinpost.js new file mode 100644 index 000000000..b99f450ae --- /dev/null +++ b/files/assets/js/pinpost.js @@ -0,0 +1,24 @@ +function pinPost(t, id) { + t.disabled = true; + t.classList.add("disabled"); + post_toast_callback(`/sticky/${id}`, + { + }, + (xhr) => { + if(xhr.status == 200) { + t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin permanently') + } + else if(xhr.status == 201) { + t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin for 1 hour') + t.classList.add('d-none') + } + t.nextElementSibling.classList.remove('d-none') + t.disabled = false; + t.classList.remove("disabled"); + } + ); + setTimeout(() => { + t.disabled = false; + t.classList.remove("disabled"); + }, 2000); +} diff --git a/files/templates/submission.html b/files/templates/submission.html index 2ec933caa..992c1120f 100644 --- a/files/templates/submission.html +++ b/files/templates/submission.html @@ -1099,7 +1099,11 @@ {% endif %} {% if not v or v.highlightcomments %} - + +{% endif %} + +{% if v and v.admin_level > 1 %} + {% endif %} diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index 2800a93ea..ba66e4925 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -11,7 +11,11 @@ {% endif %} {% if not v or v.highlightcomments %} - + +{% endif %} + +{% if v and v.admin_level > 1 %} + {% endif %} {% include "popover.html" %}