Add fullVcPfp (#134)

This commit is contained in:
mochie 2025-02-04 08:13:44 +01:00 committed by GitHub
parent e47a87dcad
commit b94a062dcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 56 additions and 1 deletions

View file

@ -0,0 +1,8 @@
div[data-selenium-video-tile] div[role="img"] {
width: 100% !important;
height: 100% !important;
border-radius: unset !important;
background: center / contain no-repeat;
background-image: var(--full-res-avatar);
> * { display: none; }
}

View file

@ -0,0 +1,43 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2025 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { disableStyle, enableStyle } from "@api/Styles";
import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
import { IconUtils, UserStore } from "@webpack/common";
import style from "./index.css?managed";
export default definePlugin({
name: "fullVcPfp",
description: "Makes avatars take up the entire vc tile for a more dynamic and immersive experience 🚀",
authors: [EquicordDevs.mochienya],
patches: [{
find: "\"data-selenium-video-tile\":",
replacement: {
match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/,
replace: "$1.style=$self.getVoiceBackgroundStyles($1);",
}
}],
getVoiceBackgroundStyles({ className, participantUserId }: any) {
if (!className.includes("tile_")) return;
const user = UserStore.getUser(participantUserId);
const avatarUrl = IconUtils.getUserAvatarURL(user, false, 1024);
return {
"--full-res-avatar": `url(${avatarUrl})`,
};
},
start() {
enableStyle(style);
},
stop() {
disableStyle(style);
},
});

View file

@ -975,7 +975,11 @@ export const EquicordDevs = Object.freeze({
OIRNOIR: {
name: "OIRNOIR",
id: 720842469024989195n
}
},
mochienya: {
name: "mochie",
id: 1043599230247374869n,
},
} satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly