From 0b887043fa185127c6f1d9f9837b65d5a8ec9d07 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sat, 29 Apr 2023 15:02:01 +0200 Subject: [PATCH] fix this https://rdrama.net/post/18459/marseycapywalking-megathread-for-bugs-and-suggestions/4064078#context --- files/assets/js/bottom.js | 6 ++++-- files/assets/js/submission_listing.js | 10 +--------- files/templates/submission_listing.html | 4 ++-- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/files/assets/js/bottom.js b/files/assets/js/bottom.js index fc10cf112..364440347 100644 --- a/files/assets/js/bottom.js +++ b/files/assets/js/bottom.js @@ -144,7 +144,7 @@ function register_new_elements(e) { const onclick = e.querySelectorAll('[data-onclick]'); for (const element of onclick) { - element.onclick = () => {execute(element, 'onclick')}; + element.addEventListener("click", () => {execute(element, 'onclick')}); } const textareas = e.getElementsByTagName('textarea') @@ -169,7 +169,9 @@ bs_trigger(document); document.addEventListener("click", function(e){ - const element = e.target + let element = e.target + if (element.tagName == "I") + element = element.parentElement if (element instanceof HTMLImageElement && (element.alt.startsWith('![](')) || element.classList.contains('in-comment-image') || element.classList.contains('img')) { expandImage() diff --git a/files/assets/js/submission_listing.js b/files/assets/js/submission_listing.js index 9b24858aa..b8333dc59 100644 --- a/files/assets/js/submission_listing.js +++ b/files/assets/js/submission_listing.js @@ -1,12 +1,4 @@ -function expandText(id) { - document.querySelectorAll(".toggled-visible").forEach(i => { - i.classList.add("d-none") - i.classList.remove("toggled-visible") - }); - const toggling = document.getElementById('post-text-'+id) - toggling.classList.toggle('d-none'); - toggling.classList.add("toggled-visible") - +function changeIcon(id) { for (const e of document.getElementsByClassName('text-expand-icon-p_'+id)) { e.classList.toggle('fa-expand-alt'); diff --git a/files/templates/submission_listing.html b/files/templates/submission_listing.html index e1dee88e8..a8c9aeca3 100644 --- a/files/templates/submission_listing.html +++ b/files/templates/submission_listing.html @@ -116,7 +116,7 @@