1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-26 09:16:24 +00:00

Merge branch 'dev' into patch-donor-and-contrib-cards

This commit is contained in:
samara 2024-12-11 13:00:35 -08:00 committed by GitHub
commit a760e70926
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 27 deletions

View file

@ -185,7 +185,7 @@ export default definePlugin({
{ {
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar // Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always, predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
match: /(?<=\.wrapper,children:\[)/, match: /(?<=\.isExpanded\),children:\[)/,
replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&" replace: "$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&"
}, },
{ {

View file

@ -66,6 +66,13 @@ export default definePlugin({
}, },
patches: [ patches: [
{
find: "https://github.com/highlightjs/highlight.js/issues/2277",
replacement: {
match: /(?<=&&\()console.log\(`Deprecated.+?`\),/,
replace: ""
}
},
{ {
find: 'react-spring: The "interpolate" function', find: 'react-spring: The "interpolate" function',
replacement: { replacement: {

View file

@ -91,34 +91,31 @@ export default definePlugin({
name: "TypingTweaks", name: "TypingTweaks",
description: "Show avatars and role colours in the typing indicator", description: "Show avatars and role colours in the typing indicator",
authors: [Devs.zt], authors: [Devs.zt],
settings,
patches: [ patches: [
// Style the indicator and add function call to modify the children before rendering
{ {
find: "getCooldownTextStyle", find: "#{intl::THREE_USERS_TYPING}",
replacement: { replacement: [
match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i/, {
replace: "$self.mutateChildren(this.props, $1, $&), style: $self.TYPING_TEXT_STYLE" // Style the indicator and add function call to modify the children before rendering
} match: /(?<=children:\[(\i)\.length>0.{0,200}?"aria-atomic":!0,children:)\i(?<=guildId:(\i).+?)/,
}, replace: "$self.mutateChildren($2,$1,$&),style:$self.TYPING_TEXT_STYLE"
// Changes the indicator to keep the user object when creating the list of typing users },
{ {
find: "getCooldownTextStyle", // Changes the indicator to keep the user object when creating the list of typing users
replacement: { match: /\.map\((\i)=>\i\.\i\.getName\(\i,\i\.id,\1\)\)/,
match: /(?<=map\(\i=>)\i\.\i\.getName\(\i,this\.props\.channel\.id,(\i)\)/, replace: ""
replace: "$1" },
} {
}, // Adds the alternative formatting for several users typing
// Adds the alternative formatting for several users typing match: /(,{a:(\i),b:(\i),c:\i}\):\i\.length>3&&\(\i=)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/,
{ replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })`,
find: "getCooldownTextStyle", predicate: () => settings.store.alternativeFormatting
replacement: { }
match: /(,{a:(\i),b:(\i),c:\i}\):)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/, ]
replace: (_, rest, a, b, users) => `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2 })`
},
predicate: () => settings.store.alternativeFormatting
} }
], ],
settings,
TYPING_TEXT_STYLE: { TYPING_TEXT_STYLE: {
display: "grid", display: "grid",
@ -128,7 +125,7 @@ export default definePlugin({
buildSeveralUsers, buildSeveralUsers,
mutateChildren(props: any, users: User[], children: any) { mutateChildren(guildId: any, users: User[], children: any) {
try { try {
if (!Array.isArray(children)) { if (!Array.isArray(children)) {
return children; return children;
@ -138,7 +135,7 @@ export default definePlugin({
return children.map(c => return children.map(c =>
c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c)) c.type === "strong" || (typeof c !== "string" && !React.isValidElement(c))
? <TypingUser {...props} user={users[element++]} /> ? <TypingUser guildId={guildId} user={users[element++]} />
: c : c
); );
} catch (e) { } catch (e) {