diff options
author | r <r@freesoftwareextremist.com> | 2024-10-28 15:31:30 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2024-10-28 15:31:30 +0000 |
commit | 90eb2628f2a77a4deeb561f4f52d3e3cdbea31df (patch) | |
tree | 7d59875be304a763ea4923a2f765f299eb1169d8 /static | |
parent | e5bf3159b8e485c108de0e4b1051ba6b66c16099 (diff) | |
download | bloat-90eb2628f2a77a4deeb561f4f52d3e3cdbea31df.tar.gz bloat-90eb2628f2a77a4deeb561f4f52d3e3cdbea31df.zip |
fluoride: Fix like/retweet for quote posts
Diffstat (limited to 'static')
-rw-r--r-- | static/fluoride.js | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/static/fluoride.js b/static/fluoride.js index 73d4939..d77b3ee 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -47,13 +47,15 @@ function updateActionForm(id, f, action) { f.dataset.action = action; } -function handleLikeForm(id, f) { +function handleLikeForm(f) { + var id = f.dataset.id; f.onsubmit = function(event) { event.preventDefault(); var action = f.dataset.action; var forms = document. - querySelectorAll(".status-"+id+" .status-like"); + querySelectorAll(".status-action-container-"+id+" .status-like"); + for (var i = 0; i < forms.length; i++) { updateActionForm(id, forms[i], reverseActions[action]); } @@ -70,7 +72,7 @@ function handleLikeForm(id, f) { if (count === 0) count = ""; var counts = document. - querySelectorAll(".status-"+id+" .status-like-count"); + querySelectorAll(".status-action-container-"+id+" .status-like-count"); for (var i = 0; i < counts.length; i++) { if (count > 0) { counts[i].innerHTML = "(" + count + ")"; @@ -88,13 +90,14 @@ function handleLikeForm(id, f) { } } -function handleRetweetForm(id, f) { +function handleRetweetForm(f) { + var id = f.dataset.id; f.onsubmit = function(event) { event.preventDefault(); var action = f.dataset.action; var forms = document. - querySelectorAll(".status-"+id+" .status-retweet"); + querySelectorAll(".status-action-container-"+id+" .status-retweet"); for (var i = 0; i < forms.length; i++) { updateActionForm(id, forms[i], reverseActions[action]); } @@ -111,7 +114,7 @@ function handleRetweetForm(id, f) { if (count === 0) count = ""; var counts = document. - querySelectorAll(".status-"+id+" .status-retweet-count"); + querySelectorAll(".status-action-container-"+id+" .status-retweet-count"); for (var i = 0; i < counts.length; i++) { if (count > 0) { counts[i].innerHTML = "(" + count + ")"; @@ -298,29 +301,29 @@ document.addEventListener("DOMContentLoaded", function() { checkCSRFToken(); checkAntiDopamineMode(); - var statuses = document.querySelectorAll(".status-container"); - for (var i = 0; i < statuses.length; i++) { - var s = statuses[i]; - var id = s.dataset.id; - - var likeForm = s.querySelector(".status-like"); - handleLikeForm(id, likeForm); + var likeForms = document.querySelectorAll(".status-like"); + for (var j = 0; j < likeForms.length; j++) { + handleLikeForm(likeForms[j]); + } - var retweetForm = s.querySelector(".status-retweet"); - handleRetweetForm(id, retweetForm); + var retweetForms = document.querySelectorAll(".status-retweet"); + for (var j = 0; j < retweetForms.length; j++) { + handleRetweetForm(retweetForms[j]); + } - var replyToLink = s.querySelector(".status-reply-to-link"); - handleReplyToLink(replyToLink); + var replyToLinks = document.querySelectorAll(".status-reply-to-link"); + for (var j = 0; j < replyToLinks.length; j++) { + handleReplyToLink(replyToLinks[j]); + } - var replyLinks = s.querySelectorAll(".status-reply-link"); - for (var j = 0; j < replyLinks.length; j++) { - handleReplyLink(replyLinks[j]); - } + var replyLinks = document.querySelectorAll(".status-reply-link"); + for (var j = 0; j < replyLinks.length; j++) { + handleReplyLink(replyLinks[j]); + } - var links = s.querySelectorAll(".status-content a"); - for (var j = 0; j < links.length; j++) { - handleStatusLink(links[j]); - } + var links = document.querySelectorAll(".status-content a"); + for (var j = 0; j < links.length; j++) { + handleStatusLink(links[j]); } var links = document.querySelectorAll(".user-profile-description a, .user-fields a"); |