viewIcons: support new simplified profile (#2535)

Co-authored-by: Sqaaakoi <sqaaakoi-git@sqaaakoi.xyz>
This commit is contained in:
AutumnVN 2024-06-06 10:05:53 +07:00 committed by GitHub
parent 9cafe8084c
commit 5976d52cbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -184,16 +184,16 @@ export default definePlugin({
patches: [
// Profiles Modal pfp
{
find: "User Profile Modal - Context Menu",
...["User Profile Modal - Context Menu", ".UserProfileTypes.FULL_SIZE,hasProfileEffect:"].map(find => ({
find,
replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/,
replace: "{src:$1,onClick:()=>$self.openImage($1)"
}
},
})),
// Banners
{
find: ".NITRO_BANNER,",
...[".NITRO_BANNER,", /overrideBannerSrc:\i,overrideBannerWidth:/].map(find => ({
find,
replacement: {
// style: { backgroundImage: shouldShowBanner ? "url(".concat(bannerUrl,
match: /style:\{(?=backgroundImage:(null!=\i)\?"url\("\.concat\((\i),)/,
@ -201,7 +201,7 @@ export default definePlugin({
// onClick: () => shouldShowBanner && ev.target.style.backgroundImage && openImage(bannerUrl), style: { cursor: shouldShowBanner ? "pointer" : void 0,
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
}
},
})),
// User DMs "User Profile" popup in the right
{
find: ".avatarPositionPanel",
@ -210,6 +210,14 @@ export default definePlugin({
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
}
},
{
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
replacement: {
match: /children:\(0,\i\.jsx\)\(\i,{src:(\i)/,
replace: "style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},$&"
}
},
// Group DMs top small & large icon
{
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,