more Misskey 13 fixes for Misskey CW toggle

it actually toggles now! 🎉
This commit is contained in:
tastytea 2023-01-26 20:25:34 +01:00
parent 4dfe33bd4c
commit 886a214924
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 9 additions and 6 deletions

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Misskey CW toggle
// @description Adds a button to toggle the visibility of all notes with content warnings on note-pages.
// @version 2023.1.26.1
// @version 2023.1.26.2
// @author tastytea
// @copyright 2022-2023, tastytea (https://tastytea.de/)
// @license GPL-3.0-only
@ -32,12 +32,15 @@ function toggle() {
if (root === undefined) {
return;
}
for (let status of root.getElementsByClassName("cw")) {
let button = status.getElementsByTagName("button")[0];
if (button === undefined) {
continue;
const cw_classes = ["cw", "xpfPt"];
for (let classname of cw_classes) {
for (let status of root.getElementsByClassName(classname)) {
let button = status.getElementsByTagName("button")[0];
if (button === undefined) {
continue;
}
button.click();
}
button.click();
}
}