stuff
This commit is contained in:
parent
f9e183d60d
commit
03b27921ae
|
@ -3737,6 +3737,7 @@
|
|||
if (!BDFDB.ObjectUtils.is(nodeOrInstance)) return;
|
||||
var instance = BDFDB.ReactUtils.findOwner(nodeOrInstance, {props:"closeContextMenu", up:true});
|
||||
if (BDFDB.ObjectUtils.is(instance) && instance.props && typeof instance.props.closeContextMenu == "function") instance.props.closeContextMenu();
|
||||
else BDFDB.LibraryModules.ContextMenuUtils.closeContextMenu();
|
||||
};
|
||||
|
||||
BDFDB.createMessageOptionPopout = function (button) {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
class ServerHider {
|
||||
getName () {return "ServerHider";}
|
||||
|
||||
getVersion () {return "6.1.1";}
|
||||
getVersion () {return "6.1.2";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,6 +11,7 @@ class ServerHider {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"fixed":[["No Folders","Plugin now works properly even if you got no server folders"]],
|
||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"],["Folder Support","You can now also hide folders with the plugin"]]
|
||||
};
|
||||
|
||||
|
@ -143,21 +144,30 @@ class ServerHider {
|
|||
let hiddenGuildIds = BDFDB.DataUtils.load(this, "hidden", "servers") || [];
|
||||
let hiddenFolderIds = BDFDB.DataUtils.load(this, "hidden", "folders") || [];
|
||||
if (hiddenGuildIds.length || hiddenFolderIds.length) {
|
||||
let guildChildren;
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:["DragSource(ForwardRef(FluxContainer(GuildFolder)))", "DragSource(ForwardRef(FluxContainer(Guild)))"]});
|
||||
if (index > -1) for (let i in children) {
|
||||
let child = children[i];
|
||||
if (index > -1) guildChildren = children;
|
||||
else {
|
||||
[children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "ConnectedUnreadDMs"});
|
||||
if (index > -1) for (let sub of children) if (BDFDB.ArrayUtils.is(sub) && sub[0] && sub[0].type && sub[0].type.displayName == "DragSource(ConnectedGuild)") {
|
||||
guildChildren = sub;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (guildChildren) for (let i in guildChildren) {
|
||||
let child = guildChildren[i];
|
||||
if (child.props.folderId) {
|
||||
if (hiddenFolderIds.includes(child.props.folderId)) children[i] = null;
|
||||
if (hiddenFolderIds.includes(child.props.folderId)) guildChildren[i] = null;
|
||||
else {
|
||||
let guildIds = [].concat(child.props.guildIds.filter(guildId => !hiddenGuildIds.includes(guildId)));
|
||||
if (guildIds.length) {
|
||||
child.props.hiddenGuildIds = [].concat(child.props.guildIds.filter(guildId => hiddenGuildIds.includes(guildId)));
|
||||
child.props.guildIds = guildIds;
|
||||
}
|
||||
else children[i] = null;
|
||||
else guildChildren[i] = null;
|
||||
}
|
||||
}
|
||||
else if (child.props.guildId && hiddenGuildIds.includes(child.props.guildId)) children[i] = null;
|
||||
else if (child.props.guildId && hiddenGuildIds.includes(child.props.guildId)) guildChildren[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue