forked from tastytea/userscripts
more Misskey 13 fixes for Misskey CW toggle
it actually toggles now! 🎉
This commit is contained in:
parent
4dfe33bd4c
commit
886a214924
|
@ -1,7 +1,7 @@
|
||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name Misskey CW toggle
|
// @name Misskey CW toggle
|
||||||
// @description Adds a button to toggle the visibility of all notes with content warnings on note-pages.
|
// @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
|
// @author tastytea
|
||||||
// @copyright 2022-2023, tastytea (https://tastytea.de/)
|
// @copyright 2022-2023, tastytea (https://tastytea.de/)
|
||||||
// @license GPL-3.0-only
|
// @license GPL-3.0-only
|
||||||
|
@ -32,7 +32,9 @@ function toggle() {
|
||||||
if (root === undefined) {
|
if (root === undefined) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (let status of root.getElementsByClassName("cw")) {
|
const cw_classes = ["cw", "xpfPt"];
|
||||||
|
for (let classname of cw_classes) {
|
||||||
|
for (let status of root.getElementsByClassName(classname)) {
|
||||||
let button = status.getElementsByTagName("button")[0];
|
let button = status.getElementsByTagName("button")[0];
|
||||||
if (button === undefined) {
|
if (button === undefined) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -40,6 +42,7 @@ function toggle() {
|
||||||
button.click();
|
button.click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add a “Toggle all CWs”-button.
|
// Add a “Toggle all CWs”-button.
|
||||||
function add_button() {
|
function add_button() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user