mirror of
https://github.com/Vendicated/Vencord
synced 2024-08-26 03:37:47 -04:00
Merge branch 'dev' into friendsSince-Section
This commit is contained in:
commit
e247fa53c9
5 changed files with 38 additions and 22 deletions
|
@ -39,6 +39,15 @@ export default definePlugin({
|
|||
}
|
||||
}),
|
||||
patches: [
|
||||
// Only one of the two patches will be at effect; Discord often updates to switch between them.
|
||||
// See: https://discord.com/channels/1015060230222131221/1032770730703716362/1261398512017477673
|
||||
{
|
||||
find: ".ENTER&&(!",
|
||||
replacement: {
|
||||
match: /(?<=(\i)\.which===\i\.\i.ENTER&&).{0,100}(\(0,\i\.\i\)\(\i\)).{0,100}(?=&&\(\i\.preventDefault)/,
|
||||
replace: "$self.shouldSubmit($1, $2)"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: "!this.hasOpenCodeBlock()",
|
||||
replacement: {
|
||||
|
|
|
@ -88,8 +88,8 @@ export default definePlugin({
|
|||
{
|
||||
find: "useCanFavoriteChannel",
|
||||
replacement: {
|
||||
match: /!\(\i\.isDM\(\)\|\|\i\.isThread\(\)\)/,
|
||||
replace: "true",
|
||||
match: /\i\.isDM\(\)\|\|\i\.isThread\(\)/,
|
||||
replace: "false",
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
|
@ -9,13 +9,15 @@ import { Devs } from "@utils/constants";
|
|||
import { getCurrentChannel } from "@utils/discord";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy } from "@webpack";
|
||||
import { RelationshipStore, Text } from "@webpack/common";
|
||||
import { findByCodeLazy, findByPropsLazy, findComponentByCodeLazy, findLazy } from "@webpack";
|
||||
import { Heading, RelationshipStore, Text } from "@webpack/common";
|
||||
|
||||
const containerWrapper = findByPropsLazy("memberSinceWrapper");
|
||||
const container = findByPropsLazy("memberSince");
|
||||
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
|
||||
const locale = findByPropsLazy("getLocale");
|
||||
const lastSection = findByPropsLazy("lastSection");
|
||||
const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);
|
||||
const Section = findComponentByCodeLazy("section", '"header-secondary"', "requestAnimationFrame");
|
||||
|
||||
export default definePlugin({
|
||||
|
@ -83,9 +85,11 @@ export default definePlugin({
|
|||
if (!friendsSince) return null;
|
||||
|
||||
return (
|
||||
<Section
|
||||
title="Friends Since"
|
||||
>
|
||||
<div className={lastSection.section}>
|
||||
<Heading variant="eyebrow">
|
||||
Friends Since
|
||||
</Heading>
|
||||
|
||||
<div className={containerWrapper.memberSinceWrapper}>
|
||||
{!!getCurrentChannel()?.guild_id && (
|
||||
<svg
|
||||
|
@ -103,7 +107,7 @@ export default definePlugin({
|
|||
{getCreatedAtDate(friendsSince, locale.getLocale())}
|
||||
</Text>
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
);
|
||||
}, { noop: true }),
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ export default definePlugin({
|
|||
// in profiles
|
||||
{
|
||||
find: ",overrideDiscriminator:",
|
||||
group: true,
|
||||
replacement: [
|
||||
{
|
||||
// prevent channel id from getting ghosted
|
||||
|
@ -263,7 +264,7 @@ export default definePlugin({
|
|||
match: /user:\i,nick:\i,/,
|
||||
replace: "$&moreTags_channelId,"
|
||||
}, {
|
||||
match: /,botType:(\i\((\i)\)),/g,
|
||||
match: /,botType:(\i),(?<=user:(\i).+?)/g,
|
||||
replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -183,14 +183,24 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
patches: [
|
||||
// Profiles Modal pfp
|
||||
...[".MODAL,hasProfileEffect", ".FULL_SIZE,hasProfileEffect:"].map(find => ({
|
||||
find,
|
||||
// Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp
|
||||
{
|
||||
find: ".overlay:void 0,status:",
|
||||
replacement: [
|
||||
...[/"PRESS_VIEW_PROFILE".+?(?=children:)(?<=avatarSrc:(\i).+?)/, /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/].map(match => ({
|
||||
match,
|
||||
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
||||
}))
|
||||
]
|
||||
},
|
||||
// Old Profiles Modal pfp
|
||||
{
|
||||
find: ".MODAL,hasProfileEffect",
|
||||
replacement: {
|
||||
match: /\{src:(\i)(?=,avatarDecoration)/,
|
||||
replace: "{src:$1,onClick:()=>$self.openImage($1)"
|
||||
}
|
||||
})),
|
||||
},
|
||||
// Banners
|
||||
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
|
||||
find,
|
||||
|
@ -202,7 +212,7 @@ export default definePlugin({
|
|||
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
|
||||
}
|
||||
})),
|
||||
// User DMs "User Profile" popup in the right
|
||||
// Old User DMs "User Profile" popup in the right
|
||||
{
|
||||
find: ".avatarPositionPanel",
|
||||
replacement: {
|
||||
|
@ -210,14 +220,6 @@ export default definePlugin({
|
|||
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
|
||||
replacement: {
|
||||
match: /\.avatar,\i\.clickable\),onClick:\i,(?<=avatarSrc:(\i).+?)/,
|
||||
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
|
||||
|
||||
}
|
||||
},
|
||||
// Group DMs top small & large icon
|
||||
{
|
||||
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
|
||||
|
|
Loading…
Reference in a new issue