From d97c3e2e020e464635a929602f0815f566425206 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Wed, 19 Oct 2022 19:45:22 +0200 Subject: Fix ViewIcons, make banner have right cursor Discord loves pushing 2 almost identical Avatar components for A/B testing, they have never heard of an if statement :trolleybus: --- src/plugins/viewIcons.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/viewIcons.tsx') diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx index d6cbf60..ca106ae 100644 --- a/src/plugins/viewIcons.tsx +++ b/src/plugins/viewIcons.tsx @@ -31,14 +31,15 @@ export default definePlugin({ { find: "onAddFriend:", replacement: { - match: /\{src:(.{1,2}),avatarDecoration/, + // global because Discord has two components that are 99% identical with one small change ._. + match: /\{src:(.{1,2}),avatarDecoration/g, replace: (_, src) => `{src:${src},onClick:()=>${OPEN_URL}${src}.replace(/\\?.+$/, "")+"?size=2048"),avatarDecoration` } }, { find: "().popoutNoBannerPremium", replacement: { match: /style:.{0,10}\{\},(.{1,2})\)/, - replace: (m, bannerObj) => `onClick:${bannerObj}.backgroundImage&&(()=>${OPEN_URL}${bannerObj}.backgroundImage.replace("url(", "").replace(/(\\?size=.+)?\\)/, "?size=2048"))),${m}` + replace: (m, style) => `onClick:${style}.backgroundImage&&(${style}.cursor="pointer",()=>${OPEN_URL}${style}.backgroundImage.replace("url(", "").replace(/(\\?size=.+)?\\)/, "?size=2048"))),${m}` } }, { find: '"GuildContextMenu:', -- cgit