BetterFolders: Fix dedicated sidebar (#3037)
This commit is contained in:
parent
a9d44e3341
commit
d8df96d1e3
1 changed files with 20 additions and 14 deletions
|
@ -123,7 +123,7 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
|
||||||
{
|
{
|
||||||
match: /lastTargetNode:\i\[\i\.length-1\].+?Fragment.+?\]}\)\]/,
|
match: /lastTargetNode:\i\[\i\.length-1\].+?}\)\](?=}\))/,
|
||||||
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
|
replace: "$&.filter($self.makeGuildsBarGuildListFilter(!!arguments[0]?.isBetterFolders))"
|
||||||
},
|
},
|
||||||
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
|
// If we are rendering the Better Folders sidebar, we filter out everything but the scroller for the guild list from the GuildsBar Tree children
|
||||||
|
@ -275,24 +275,30 @@ export default definePlugin({
|
||||||
},
|
},
|
||||||
|
|
||||||
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
makeGuildsBarGuildListFilter(isBetterFolders: boolean) {
|
||||||
return child => {
|
return child => {
|
||||||
if (isBetterFolders) {
|
if (!isBetterFolders) return true;
|
||||||
try {
|
|
||||||
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
try {
|
||||||
} catch (e) {
|
return child?.props?.["aria-label"] === getIntlMessage("SERVERS");
|
||||||
console.error(e);
|
} catch (e) {
|
||||||
}
|
console.error(e);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
};
|
return true;
|
||||||
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
||||||
return child => {
|
return child => {
|
||||||
if (isBetterFolders) {
|
if (!isBetterFolders) return true;
|
||||||
return child?.props?.onScroll != null;
|
|
||||||
|
if (child?.props?.className?.includes("itemsContainer") && child.props.children != null) {
|
||||||
|
// Filter out everything but the scroller for the guild list
|
||||||
|
child.props.children = child.props.children.filter(child => child?.props?.onScroll != null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return false;
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue