HideAttachments: allow hiding stickers (#13)

Self explanatory

Reviewed-on: https://codeberg.org/Ven/cord/pulls/13
Co-authored-by: Luna <imlvnaa@gmail.com>
Co-committed-by: Luna <imlvnaa@gmail.com>
This commit is contained in:
Luna 2023-09-05 18:56:28 +00:00 committed by Ven
parent 223b0366c6
commit 860d6edc7b

View file

@ -49,7 +49,7 @@ export default definePlugin({
await this.buildCss(); await this.buildCss();
addButton("HideAttachments", msg => { addButton("HideAttachments", msg => {
if (!msg.attachments.length && !msg.embeds.length) return null; if (!msg.attachments.length && !msg.embeds.length && !msg.stickerItems.length) return null;
const isHidden = hiddenMessages.has(msg.id); const isHidden = hiddenMessages.has(msg.id);
@ -72,7 +72,7 @@ export default definePlugin({
async buildCss() { async buildCss() {
const elements = [...hiddenMessages].map(id => `#message-accessories-${id}`).join(","); const elements = [...hiddenMessages].map(id => `#message-accessories-${id}`).join(",");
style.textContent = ` style.textContent = `
:is(${elements}) [class*="embedWrapper"] { :is(${elements}) :is([class*="embedWrapper", [class*"clickableSticker"]) {
/* important is not necessary, but add it to make sure bad themes won't break it */ /* important is not necessary, but add it to make sure bad themes won't break it */
display: none !important; display: none !important;
} }