From 2c9793202d1e9538736ec7e795e1b466a46a66cb Mon Sep 17 00:00:00 2001 From: Vendicated Date: Sat, 4 Nov 2023 18:54:02 +0100 Subject: [PATCH] Revert "Fix ViewIcons" This reverts commit 098da8c3fd95cdd1f299b86d0b919b001009a1df. --- src/plugins/viewIcons/index.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/plugins/viewIcons/index.tsx b/src/plugins/viewIcons/index.tsx index ccbc8ddc..fd6b7b6b 100644 --- a/src/plugins/viewIcons/index.tsx +++ b/src/plugins/viewIcons/index.tsx @@ -65,9 +65,7 @@ const settings = definePluginSettings({ } }); -function openImage(url?: string) { - if (!url) return; - +function openImage(url: string) { const format = url.startsWith("/") ? "png" : settings.store.format; const u = new URL(url, window.location.href); @@ -173,12 +171,12 @@ export default definePlugin({ }, patches: [ - // Make pfps clickable and add pointer cursor + // Make pfps clickable { - find: ".AVATAR_DECORATION_STATUS_ROUND_16;", + find: "onAddFriend:function", replacement: { - match: /memo\(.{0,50}(?=let{statusColor:\i,status:\i,...\i}=(\i),)/, - replace: (m, props) => `${m}${props}.onClick=()=>$self.openImage(${props}.src);${props}.style={cursor:${props}.src?"pointer":void 0};` + match: /\{src:(\i)(?=,avatarDecoration)/, + replace: "{src:$1,onClick:()=>$self.openImage($1)" } }, // Make banners clickable