Partially selectable reblogs visibility (fluoride required fix)

This commit is contained in:
localhost_frssoft 2022-12-02 04:45:19 +03:00
parent a678b620a1
commit 8c41878b6d
5 changed files with 36 additions and 8 deletions

View file

@ -9,6 +9,7 @@ var reverseActions = {
var csrfToken = "";
var antiDopamineMode = false;
var retweetVisibility = "public"
function checkCSRFToken() {
var tag = document.querySelector("meta[name='csrf_token']");
@ -22,6 +23,12 @@ 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() {
@ -97,7 +104,7 @@ function handleRetweetForm(id, f) {
updateActionForm(id, forms[i], reverseActions[action]);
}
var body = "csrf_token=" + encodeURIComponent(csrfToken);
var body = "csrf_token=" + encodeURIComponent(csrfToken) + "&retweet_visibility=" + encodeURIComponent(retweetVisibility);
var contentType = "application/x-www-form-urlencoded";
http("POST", "/fluoride/" + action + "/" + id,
body, contentType, function(res, type) {
@ -288,6 +295,7 @@ function onPaste(e) {
document.addEventListener("DOMContentLoaded", function() {
checkCSRFToken();
checkAntiDopamineMode();
checkRetweetVisibility();
var statuses = document.querySelectorAll(".status-container");
for (var i = 0; i < statuses.length; i++) {