Update ServerFolders.plugin.js

This commit is contained in:
Mirco Wittrien 2021-10-18 21:38:28 +02:00
parent 4bb6074c2e
commit 2e94561de0
1 changed files with 21 additions and 46 deletions

View File

@ -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);
};
}
}