Fix(RevealAllSpoilers): New spoiler class name (#1229)
This commit is contained in:
parent
263fbc377e
commit
55543d8640
|
@ -20,7 +20,7 @@ import { Devs } from "@utils/constants";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findByPropsLazy } from "@webpack";
|
import { findByPropsLazy } from "@webpack";
|
||||||
|
|
||||||
const SpoilerClasses = findByPropsLazy("spoilerText");
|
const SpoilerClasses = findByPropsLazy("spoilerContent");
|
||||||
const MessagesClasses = findByPropsLazy("messagesWrapper", "messages");
|
const MessagesClasses = findByPropsLazy("messagesWrapper", "messages");
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
|
@ -43,14 +43,14 @@ export default definePlugin({
|
||||||
|
|
||||||
if (!ctrlKey) { return; }
|
if (!ctrlKey) { return; }
|
||||||
|
|
||||||
const { spoilerText, hidden } = SpoilerClasses;
|
const { spoilerContent, hidden } = SpoilerClasses;
|
||||||
const { messagesWrapper } = MessagesClasses;
|
const { messagesWrapper } = MessagesClasses;
|
||||||
|
|
||||||
const parent = shiftKey
|
const parent = shiftKey
|
||||||
? document.querySelector(`div.${messagesWrapper}`)
|
? document.querySelector(`div.${messagesWrapper}`)
|
||||||
: (target as HTMLSpanElement).parentElement;
|
: (target as HTMLSpanElement).parentElement;
|
||||||
|
|
||||||
for (const spoiler of parent!.querySelectorAll(`span.${spoilerText}.${hidden}`)) {
|
for (const spoiler of parent!.querySelectorAll(`span.${spoilerContent}.${hidden}`)) {
|
||||||
(spoiler as HTMLSpanElement).click();
|
(spoiler as HTMLSpanElement).click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue