From 2e94561de0687d07a14d3e181154726d441e3234 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Mon, 18 Oct 2021 21:38:28 +0200 Subject: [PATCH] Update ServerFolders.plugin.js --- Plugins/ServerFolders/ServerFolders.plugin.js | 67 ++++++------------- 1 file changed, 21 insertions(+), 46 deletions(-) diff --git a/Plugins/ServerFolders/ServerFolders.plugin.js b/Plugins/ServerFolders/ServerFolders.plugin.js index 26faa78c87..fd23e4b0d3 100644 --- a/Plugins/ServerFolders/ServerFolders.plugin.js +++ b/Plugins/ServerFolders/ServerFolders.plugin.js @@ -2,7 +2,7 @@ * @name ServerFolders * @author DevilBro * @authorId 278543574059057154 - * @version 6.9.4 + * @version 6.9.5 * @description Changes Discord's Folders, Servers open in a new Container, also adds extra Features to more easily organize, customize and manage your Folders * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -17,7 +17,7 @@ module.exports = (_ => { "info": { "name": "ServerFolders", "author": "DevilBro", - "version": "6.9.4", + "version": "6.9.5", "description": "Changes Discord's Folders, Servers open in a new Container, also adds extra Features to more easily organize, customize and manage your Folders" } }; @@ -193,12 +193,12 @@ module.exports = (_ => { this.hoveredGuild != guildId ? null : BDFDB.ReactUtils.createElement("div", { className: BDFDB.disCNS.guildouter + BDFDB.disCN._serverfoldersguildplaceholder, children: BDFDB.ReactUtils.createElement("div", { - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.DragPlaceholder, {}) + children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.DragPlaceholder, {}) }) }) ] }); - }).filter(n => n).reduce((r, a) => r.concat(a, _this.settings.general.addSeparators ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Items.Separator, {}) : null), [0]).slice(1, -1).flat(10).filter(n => n) + }).filter(n => n).reduce((r, a) => r.concat(a, _this.settings.general.addSeparators ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.GuildComponents.Separator, {}) : null), [0]).slice(1, -1).flat(10).filter(n => n) }) }) }); @@ -665,49 +665,24 @@ module.exports = (_ => { folderGuildContent.props.themeOverride = e.instance.props.themeOverride; BDFDB.ReactUtils.forceUpdate(folderGuildContent); } - if (typeof e.returnvalue.props.children == "function") { - let childrenRender = e.returnvalue.props.children; - e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.checkTree(children); - return children; - }, "", this); + let topBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbartop]]}); + if (topBar) { + let topIsVisible = topBar.props.isVisible; + topBar.props.isVisible = (...args) => { + let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10); + args[2] = args[2].filter(id => !ids.includes(id)); + return topIsVisible(...args); + }; + } + let bottomBar = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]}); + if (bottomBar) { + let bottomIsVisible = bottomBar.props.isVisible; + bottomBar.props.isVisible = (...args) => { + let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10); + args[2] = args[2].filter(id => !ids.includes(id)); + return bottomIsVisible(...args); + }; } - else this.checkTree(e.returnvalue); - } - } - - checkTree (returnvalue) { - let tree = BDFDB.ReactUtils.findChild(returnvalue, {filter: n => n && n.props && typeof n.props.children == "function"}); - if (tree) { - let childrenRender = tree.props.children; - tree.props.children = BDFDB.TimeUtils.suppress((...args) => { - let children = childrenRender(...args); - this.handleGuilds(children); - return children; - }, "", this); - } - else this.handleGuilds(returnvalue); - } - - handleGuilds (returnvalue) { - let topBar = BDFDB.ReactUtils.findChild(returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbartop]]}); - if (topBar) { - let topIsVisible = topBar.props.isVisible; - topBar.props.isVisible = (...args) => { - let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10); - args[2] = args[2].filter(id => !ids.includes(id)); - return topIsVisible(...args); - }; - } - let bottomBar = BDFDB.ReactUtils.findChild(returnvalue, {props: [["className", BDFDB.disCN.guildswrapperunreadmentionsbarbottom]]}); - if (bottomBar) { - let bottomIsVisible = bottomBar.props.isVisible; - bottomBar.props.isVisible = (...args) => { - let ids = BDFDB.LibraryModules.FolderStore.guildFolders.filter(n => n.folderId).map(n => n.guildIds).flat(10); - args[2] = args[2].filter(id => !ids.includes(id)); - return bottomIsVisible(...args); - }; } }