aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/usrbg
diff options
context:
space:
mode:
authorĐỗ Văn Hoài Tuân <htuan03@gmail.com>2023-05-04 17:54:33 -0700
committerGitHub <noreply@github.com>2023-05-05 02:54:33 +0200
commitc25bc0ff4b597131ed223fd5c1a8cf75ac5282e3 (patch)
tree75945b9709c2449a6b128c0269706d47a93359e4 /src/plugins/usrbg
parent22334663cf886daf777566df0a627897161c98cf (diff)
downloadVencord-c25bc0ff4b597131ed223fd5c1a8cf75ac5282e3.tar.gz
Vencord-c25bc0ff4b597131ed223fd5c1a8cf75ac5282e3.tar.bz2
Vencord-c25bc0ff4b597131ed223fd5c1a8cf75ac5282e3.zip
USRBG: Add VoiceBackground (#1038)
Co-authored-by: V <vendicated@riseup.net>
Diffstat (limited to 'src/plugins/usrbg')
-rw-r--r--src/plugins/usrbg/index.css6
-rw-r--r--src/plugins/usrbg/index.tsx29
2 files changed, 33 insertions, 2 deletions
diff --git a/src/plugins/usrbg/index.css b/src/plugins/usrbg/index.css
index 819d975..93e37ef 100644
--- a/src/plugins/usrbg/index.css
+++ b/src/plugins/usrbg/index.css
@@ -1,10 +1,12 @@
:is([class*="userProfile"], [class*="userPopout"]) [class*="bannerPremium"] {
background: center / cover no-repeat;
- position: relative;
- z-index: -1;
}
[class*="NonPremium"]:has([class*="bannerPremium"]) [class*="avatarPositionNormal"],
[class*="PremiumWithoutBanner"]:has([class*="bannerPremium"]) [class*="avatarPositionPremiumNoBanner"] {
top: 76px;
}
+
+[style*="background-image"] [class*="background-"] {
+ background-color: transparent !important;
+}
diff --git a/src/plugins/usrbg/index.tsx b/src/plugins/usrbg/index.tsx
index 09ecd57..9c72676 100644
--- a/src/plugins/usrbg/index.tsx
+++ b/src/plugins/usrbg/index.tsx
@@ -36,6 +36,12 @@ const settings = definePluginSettings({
{ label: "Nitro banner", value: true, default: true },
{ label: "USRBG banner", value: false },
]
+ },
+ voiceBackground: {
+ description: "Use USRBG banners as voice chat backgrounds",
+ type: OptionType.BOOLEAN,
+ default: true,
+ restartNeeded: true
}
});
@@ -57,6 +63,16 @@ export default definePlugin({
replace: "$self.useBannerHook($1),"
}
]
+ },
+ {
+ find: "\"data-selenium-video-tile\":",
+ predicate: () => settings.store.voiceBackground,
+ replacement: [
+ {
+ match: /(\i)\.style,/,
+ replace: "$self.voiceBackgroundHook($1),"
+ }
+ ]
}
],
@@ -66,6 +82,19 @@ export default definePlugin({
);
},
+ voiceBackgroundHook({ className, participantUserId }: any) {
+ if (className.includes("tile-")) {
+ if (data[participantUserId]) {
+ return {
+ backgroundImage: `url(${data[participantUserId]})`,
+ backgroundSize: "cover",
+ backgroundPosition: "center",
+ backgroundRepeat: "no-repeat"
+ };
+ }
+ }
+ },
+
useBannerHook({ displayProfile, user }: any) {
if (displayProfile?.banner && settings.store.nitroFirst) return;
if (data[user.id]) return data[user.id];