From f2b6dcbb912a3f3f4f20c9f2a1454fc30950dc8b Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 19 Sep 2024 03:08:51 +0300 Subject: [PATCH] make it togglable --- src/plugins/hideMessage/index.tsx | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/plugins/hideMessage/index.tsx b/src/plugins/hideMessage/index.tsx index 41fa78f2c..a62a3bf13 100644 --- a/src/plugins/hideMessage/index.tsx +++ b/src/plugins/hideMessage/index.tsx @@ -5,8 +5,9 @@ */ import { addButton, removeButton } from "@api/MessagePopover"; +import { Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; -import definePlugin from "@utils/types"; +import definePlugin, { OptionType } from "@utils/types"; import { ChannelStore } from "@webpack/common"; import { get, set } from "@api/DataStore"; @@ -33,6 +34,13 @@ export default definePlugin({ description: "Adds an option to hide messages", authors: [Devs.Isaac], dependencies: ["MessagePopoverAPI"], + options: { + showMessageHiddenText: { + description: `Hidden messages will contain a small text indicating they're hidden.`, + type: OptionType.BOOLEAN, + default: true + }, + }, async start() { style = document.createElement("style"); @@ -70,19 +78,22 @@ export default definePlugin({ :is(${messagesContent}) { visibility: hidden; } - :is(${messagesContent})::after { - visibility: visible; - content: "Message hidden" !important; - color: var(--text-muted); - font-size: 80%; - position: absolute; - display: block; - top: 0; - } :is(${messagesAccessories}) { display: none !important; } `; + if (Settings.plugins.HideMessage.showMessageHiddenText) { + style.textContent += ` + :is(${messagesContent})::after { + visibility: visible; + content: "Message hidden" !important; + color: var(--text-muted); + font-size: 80%; + position: absolute; + display: block; + top: 0; + } + `} }, async toggleHide(sentIds: string) {