Compare commits

..

4 commits

Author SHA1 Message Date
Isaac
e6ede77fc0
Merge f2b6dcbb91 into f27361f017 2024-09-19 00:09:06 +00:00
Isaac
f2b6dcbb91 make it togglable 2024-09-19 03:08:51 +03:00
Isaac
f01f1e03cc remove svg title 2024-09-19 01:54:14 +03:00
Isaac
572b304d98 Update index.tsx 2024-09-19 01:37:18 +03:00

View file

@ -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";
@ -23,8 +24,8 @@ const saveHiddenMessages = (ids: Set<string>) => set(KEY, ids);
const HideIcon = () => {
return <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" aria-labelledby="eyeCrossedIconTitle" stroke="currentColor" stroke-width="1.5" stroke-linecap="square" stroke-linejoin="miter" fill="none" color="currentColor">
<g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title id="eyeCrossedIconTitle">Hidden (crossed eye)</title>
<path d="M22 12C22 12 19 18 12 18C5 18 2 12 2 12C2 12 5 6 12 6C19 6 22 12 22 12Z"></path> <circle cx="12" cy="12" r="3"></circle> <path d="M3 21L20 4"></path> </g>
<g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier">
<path d="M22 12C22 12 19 18 12 18C5 18 2 12 2 12C2 12 5 6 12 6C19 6 22 12 22 12Z"></path><circle cx="12" cy="12" r="3"></circle><path d="M3 21L20 4"></path></g>
</svg>;
};
@ -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");
@ -68,12 +76,24 @@ export default definePlugin({
display: none !important;
}
:is(${messagesContent}) {
display: none !important;
visibility: hidden;
}
: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) {