From f729e29a8d27a276a4b8deac0a1b78237d7ab4fb Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Fri, 2 Dec 2022 16:47:28 +0300 Subject: [PATCH] Fix for fluoride.js --- static/fluoride.js | 9 +-------- templates/status.tmpl | 6 +++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/static/fluoride.js b/static/fluoride.js index 62ce0a4..132008a 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -9,7 +9,6 @@ var reverseActions = { var csrfToken = ""; var antiDopamineMode = false; -var retweetVisibility = "public" function checkCSRFToken() { var tag = document.querySelector("meta[name='csrf_token']"); @@ -23,12 +22,6 @@ function checkAntiDopamineMode() { antiDopamineMode = tag.getAttribute("content") === "true"; } -function checkRetweetVisibility() { - var tag = document.querySelector("meta[name='retweet_visibility']"); - if (tag) - retweetVisibility = tag.getAttribute("content"); -} - function http(method, url, body, type, success, error) { var req = new XMLHttpRequest(); req.onload = function() { @@ -104,6 +97,7 @@ function handleRetweetForm(id, f) { updateActionForm(id, forms[i], reverseActions[action]); } + var retweetVisibility = document.querySelector('input[id="retweet_visibility-'+id+'"]:checked').value; var body = "csrf_token=" + encodeURIComponent(csrfToken) + "&retweet_visibility=" + encodeURIComponent(retweetVisibility); var contentType = "application/x-www-form-urlencoded"; http("POST", "/fluoride/" + action + "/" + id, @@ -295,7 +289,6 @@ function onPaste(e) { document.addEventListener("DOMContentLoaded", function() { checkCSRFToken(); checkAntiDopamineMode(); - checkRetweetVisibility(); var statuses = document.querySelectorAll(".status-container"); for (var i = 0; i < statuses.length; i++) { diff --git a/templates/status.tmpl b/templates/status.tmpl index 18d0730..b340f3b 100644 --- a/templates/status.tmpl +++ b/templates/status.tmpl @@ -237,11 +237,11 @@ {{if or (eq .Visibility "private") (eq .Visibility "direct")}} Locked {{else}} - + - + - + {{end}}