mirror of
https://github.com/Vendicated/Vencord
synced 2024-08-26 03:37:47 -04:00
BetterQuickReact: cleanup stuff
This commit is contained in:
parent
43252bbe83
commit
c0b1c02628
1 changed files with 19 additions and 21 deletions
|
@ -58,35 +58,33 @@ export default definePlugin({
|
|||
replace: "($self.settings.store.frequentEmojis?[]:$1).concat"
|
||||
}
|
||||
},
|
||||
// Override limit of emojis to display
|
||||
{
|
||||
find: ".ADD_REACTION_NAMED.format",
|
||||
replacement: {
|
||||
match: /(\i)\.length>4&&\((\i)\.length=4\);/,
|
||||
replace: "let [betterQuickReactScrollValue,setBetterQuickReactScrollValue]=Vencord.Webpack.Common.React.useState(0);betterQuickReactScrollValue;"
|
||||
}
|
||||
},
|
||||
// Add a custom class to identify the quick reactions have been modified and a CSS variable for the number of columns to display
|
||||
{
|
||||
find: ".ADD_REACTION_NAMED.format",
|
||||
replacement: {
|
||||
match: /className:(\i)\.wrapper,/,
|
||||
replace: "className:\"vc-better-quick-react \"+($self.settings.store.compactMode?\"vc-better-quick-react-compact \":\"\")+$1.wrapper,style:{\"--vc-better-quick-react-columns\":$self.settings.store.columns},"
|
||||
}
|
||||
},
|
||||
{
|
||||
find: ".ADD_REACTION_NAMED.format",
|
||||
replacement: {
|
||||
match: /children:(\i)\.map\(/,
|
||||
replace: "onWheel:$self.onWheelWrapper(betterQuickReactScrollValue,setBetterQuickReactScrollValue,$1.length),children:$self.applyScroll($1,betterQuickReactScrollValue).map("
|
||||
}
|
||||
group: true,
|
||||
replacement: [
|
||||
// Override limit of emojis to display with offset hook.
|
||||
{
|
||||
match: /(\i)\.length>4&&\((\i)\.length=4\);/,
|
||||
replace: "let [betterQuickReactScrollValue,setBetterQuickReactScrollValue]=Vencord.Webpack.Common.React.useState(0);betterQuickReactScrollValue;"
|
||||
},
|
||||
// Add a custom class to identify the quick reactions have been modified and a CSS variable for the number of columns to display
|
||||
{
|
||||
match: /className:(\i)\.wrapper,/,
|
||||
replace: "className:\"vc-better-quick-react \"+($self.settings.store.compactMode?\"vc-better-quick-react-compact \":\"\")+$1.wrapper,style:{\"--vc-better-quick-react-columns\":$self.settings.store.columns},"
|
||||
},
|
||||
// Scroll handler + Apply the emoji count limit from earlier with custom logic
|
||||
{
|
||||
match: /children:(\i)\.map\(/,
|
||||
replace: "onWheel:$self.onWheelWrapper(betterQuickReactScrollValue,setBetterQuickReactScrollValue,$1.length),children:$self.applyScroll($1,betterQuickReactScrollValue).map("
|
||||
}
|
||||
]
|
||||
},
|
||||
// MenuGroup doesn't accept styles or anything special by default :/
|
||||
{
|
||||
find: ".groupLabel,",
|
||||
replacement: {
|
||||
match: /role:"group",/,
|
||||
replace: "role:\"group\",style:arguments[0].style,onWheel:arguments[0].onWheel,"
|
||||
replace: "$&style:arguments[0].style,onWheel:arguments[0].onWheel,"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue