aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/viewIcons.tsx
diff options
context:
space:
mode:
authorVendicated <vendicated@riseup.net>2023-04-28 18:36:22 +0200
committerVendicated <vendicated@riseup.net>2023-04-28 18:36:22 +0200
commit1b2cb52dac86bc97fc42b3b040460cff68c9bf0a (patch)
tree6f2a66f84f082f79f62995e59f87bc4ed5840546 /src/plugins/viewIcons.tsx
parent0fe0fecba25b060830c524f50cb9b046273831da (diff)
downloadVencord-1b2cb52dac86bc97fc42b3b040460cff68c9bf0a.tar.gz
Vencord-1b2cb52dac86bc97fc42b3b040460cff68c9bf0a.tar.bz2
Vencord-1b2cb52dac86bc97fc42b3b040460cff68c9bf0a.zip
ViewIcons: Fix viewing banners
Diffstat (limited to 'src/plugins/viewIcons.tsx')
-rw-r--r--src/plugins/viewIcons.tsx26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/viewIcons.tsx b/src/plugins/viewIcons.tsx
index 7519d74..dea5bf8 100644
--- a/src/plugins/viewIcons.tsx
+++ b/src/plugins/viewIcons.tsx
@@ -167,26 +167,30 @@ export default definePlugin({
},
patches: [
+ // Make pfps clickable
{
find: "onAddFriend:",
replacement: {
- // global because Discord has two components that are 99% identical with one small change ._.
- match: /\{src:(\i),avatarDecoration/g,
- replace: "{src:$1,onClick:()=>$self.openImage($1),avatarDecoration"
+ match: /\{src:(\i)(?=,avatarDecoration)/,
+ replace: "{src:$1,onClick:()=>$self.openImage($1)"
}
- }, {
- find: ".popoutNoBannerPremium",
+ },
+ // Make banners clickable
+ {
+ find: ".NITRO_BANNER,",
replacement: {
- match: /style:.{0,10}\{\},(\i)\)/,
+ // style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,
+ match: /style:\{(?=backgroundImage:(\i&&\i)\?"url\("\.concat\((\i),)/,
replace:
- "onClick:$1.backgroundImage&&($1.cursor=\"pointer\"," +
- "()=>$self.openImage($1.backgroundImage.replace(\"url(\", \"\"))),$&"
+ // onClick: () => shouldShowBanner && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0,
+ 'onClick:()=>$1&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
}
- }, {
+ },
+ {
find: "().avatarWrapperNonUserBot",
replacement: {
- match: /(avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/,
- replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
+ match: /(?<=avatarPositionPanel.+?)onClick:(\i\|\|\i)\?void 0(?<=,(\i)=\i\.avatarSrc.+?)/,
+ replace: "style:($1)?{cursor:\"pointer\"}:{},onClick:$1?()=>{$self.openImage($2)}"
}
}
]