Fix for fluoride.js

This commit is contained in:
localhost_frssoft 2022-12-02 16:47:28 +03:00
parent 8c41878b6d
commit f729e29a8d
2 changed files with 4 additions and 11 deletions

View file

@ -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++) {

View file

@ -237,11 +237,11 @@
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
Locked
{{else}}
<input type="radio" id="retweet_visibility" name="retweet_visibility" value="public" checked>
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="public" checked>
<label for="retweet_visibility">public</label>
<input type="radio" id="retweet_visibility" name="retweet_visibility" value="unlisted">
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="unlisted">
<label for="retweet_visibility">unlisted</label>
<input type="radio" id="retweet_visibility" name="retweet_visibility" value="private">
<input type="radio" id="retweet_visibility-{{.ID}}" name="retweet_visibility" value="private">
<label for="retweet_visibility">private</label>
{{end}}
</div>