stuff
This commit is contained in:
parent
3b643fa7b3
commit
16f04c3192
|
@ -2260,7 +2260,9 @@
|
||||||
let GuildsRerenderTimeout;
|
let GuildsRerenderTimeout;
|
||||||
BDFDB.GuildUtils = {};
|
BDFDB.GuildUtils = {};
|
||||||
BDFDB.GuildUtils.is = function (guild) {
|
BDFDB.GuildUtils.is = function (guild) {
|
||||||
return guild && guild instanceof BDFDB.DiscordObjects.Guild;
|
if (!BDFDB.ObjectUtils.is(guild)) return false;
|
||||||
|
let keys = Object.keys(guild);
|
||||||
|
return guild instanceof BDFDB.DiscordObjects.Guild || Object.keys(new BDFDB.DiscordObjects.Guild({})).every(key => keys.indexOf(key) > -1);
|
||||||
};
|
};
|
||||||
BDFDB.GuildUtils.getIcon = function (id) {
|
BDFDB.GuildUtils.getIcon = function (id) {
|
||||||
let guild = LibraryModules.GuildStore.getGuild(typeof id == "number" ? id.toFixed() : id);
|
let guild = LibraryModules.GuildStore.getGuild(typeof id == "number" ? id.toFixed() : id);
|
||||||
|
@ -2424,7 +2426,9 @@
|
||||||
|
|
||||||
BDFDB.ChannelUtils = {};
|
BDFDB.ChannelUtils = {};
|
||||||
BDFDB.ChannelUtils.is = function (channel) {
|
BDFDB.ChannelUtils.is = function (channel) {
|
||||||
return channel && channel instanceof BDFDB.DiscordObjects.Channel;
|
if (!BDFDB.ObjectUtils.is(channel)) return false;
|
||||||
|
let keys = Object.keys(channel);
|
||||||
|
return channel instanceof BDFDB.DiscordObjects.Channel || Object.keys(new BDFDB.DiscordObjects.Channel({})).every(key => keys.indexOf(key) > -1);
|
||||||
};
|
};
|
||||||
BDFDB.ChannelUtils.isTextChannel = function (channelOrId) {
|
BDFDB.ChannelUtils.isTextChannel = function (channelOrId) {
|
||||||
let channel = typeof channelOrId == "string" ? LibraryModules.ChannelStore.getChannel(channelOrId) : channelOrId;
|
let channel = typeof channelOrId == "string" ? LibraryModules.ChannelStore.getChannel(channelOrId) : channelOrId;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ var EditServers = (_ => {
|
||||||
return class EditServers {
|
return class EditServers {
|
||||||
getName () {return "EditServers";}
|
getName () {return "EditServers";}
|
||||||
|
|
||||||
getVersion () {return "2.1.9";}
|
getVersion () {return "2.2.0";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -12,8 +12,7 @@ var EditServers = (_ => {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"fixed":[["Message Update","Fixed the plugin for the new Message Update"]],
|
"improved":[["Server Folders","Works better with Server Folders now"]]
|
||||||
"improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]]
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
|
@ -36,6 +35,8 @@ var EditServers = (_ => {
|
||||||
GuildHeader: "render"
|
GuildHeader: "render"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.patchPriority = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
initConstructor () {
|
initConstructor () {
|
||||||
|
@ -200,6 +201,7 @@ var EditServers = (_ => {
|
||||||
type: "right",
|
type: "right",
|
||||||
guild: e.instance.props.guild,
|
guild: e.instance.props.guild,
|
||||||
list: true,
|
list: true,
|
||||||
|
offset: 12,
|
||||||
backgroundColor: data.color3,
|
backgroundColor: data.color3,
|
||||||
fontColor: data.color4
|
fontColor: data.color4
|
||||||
},
|
},
|
||||||
|
|
|
@ -276,7 +276,7 @@ var ServerFolders = (_ => {
|
||||||
return class ServerFolders {
|
return class ServerFolders {
|
||||||
getName () {return "ServerFolders";}
|
getName () {return "ServerFolders";}
|
||||||
|
|
||||||
getVersion () {return "6.7.5";}
|
getVersion () {return "6.7.6";}
|
||||||
|
|
||||||
getAuthor () {return "DevilBro";}
|
getAuthor () {return "DevilBro";}
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ var ServerFolders = (_ => {
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
this.changelog = {
|
this.changelog = {
|
||||||
"fixed":[["Color Gradients","Fixed color gradients not working on icons"]]
|
"added":[["No extra column","Added the option to disable the unique way of displaying the servers in an extra column"]]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.patchedModules = {
|
this.patchedModules = {
|
||||||
|
@ -373,7 +373,8 @@ var ServerFolders = (_ => {
|
||||||
closeAllFolders: {value:false, description:"Close All Folders when selecting a Server."},
|
closeAllFolders: {value:false, description:"Close All Folders when selecting a Server."},
|
||||||
forceOpenFolder: {value:false, description:"Force a Folder to open when switching to a Server of that Folder."},
|
forceOpenFolder: {value:false, description:"Force a Folder to open when switching to a Server of that Folder."},
|
||||||
showCountBadge: {value:true, description:"Display Badge for Amount of Servers in a Folder."},
|
showCountBadge: {value:true, description:"Display Badge for Amount of Servers in a Folder."},
|
||||||
addSeparators: {value:true, description:"Adds separators between Servers of different Folders."}
|
extraColumn: {value:true, description:"Moves the Servers from opened Folders in an extra column."},
|
||||||
|
addSeparators: {value:true, description:"Adds separators between Servers of different Folders in extra column."}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -581,10 +582,12 @@ var ServerFolders = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
processAppView (e) {
|
processAppView (e) {
|
||||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: ["FluxContainer(Guilds)", "FluxContainer(NavigableGuilds)"]});
|
if (BDFDB.DataUtils.get(this, "settings", "extraColumn")) {
|
||||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(folderGuildContentComponent, {
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: ["FluxContainer(Guilds)", "FluxContainer(NavigableGuilds)"]});
|
||||||
themeOverride: children[index].props.themeOverride
|
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement(folderGuildContentComponent, {
|
||||||
}));
|
themeOverride: children[index].props.themeOverride
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processGuildFolder (e) {
|
processGuildFolder (e) {
|
||||||
|
@ -595,6 +598,8 @@ var ServerFolders = (_ => {
|
||||||
let data = this.getFolderConfig(e.instance.props.folderId);
|
let data = this.getFolderConfig(e.instance.props.folderId);
|
||||||
if (data.muteFolder) for (let guildId of e.instance.props.guildIds) if (!BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId)) BDFDB.LibraryModules.GuildSettingsUtils.updateNotificationSettings(guildId, {muted:true, suppress_everyone:true});
|
if (data.muteFolder) for (let guildId of e.instance.props.guildIds) if (!BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(guildId)) BDFDB.LibraryModules.GuildSettingsUtils.updateNotificationSettings(guildId, {muted:true, suppress_everyone:true});
|
||||||
|
|
||||||
|
let settings = BDFDB.DataUtils.get(this, "settings");
|
||||||
|
|
||||||
let state = this.getState(e.instance);
|
let state = this.getState(e.instance);
|
||||||
if (folderStates[e.instance.props.folderId] && !BDFDB.equals(state, folderStates[e.instance.props.folderId])) {
|
if (folderStates[e.instance.props.folderId] && !BDFDB.equals(state, folderStates[e.instance.props.folderId])) {
|
||||||
if (data.autoRead && (state.unread || state.badge > 0)) {
|
if (data.autoRead && (state.unread || state.badge > 0)) {
|
||||||
|
@ -630,7 +635,7 @@ var ServerFolders = (_ => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (BDFDB.DataUtils.get(this, "settings", "showCountBadge")) {
|
if (settings.showCountBadge) {
|
||||||
[children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"BlobMask"});
|
[children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"BlobMask"});
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
children[index].props.upperLeftBadgeWidth = BDFDB.LibraryComponents.Badges.getBadgeWidthForValue(e.instance.props.guildIds.length);
|
children[index].props.upperLeftBadgeWidth = BDFDB.LibraryComponents.Badges.getBadgeWidthForValue(e.instance.props.guildIds.length);
|
||||||
|
@ -640,12 +645,13 @@ var ServerFolders = (_ => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (settings.extraColumn) {
|
||||||
e.returnvalue.props.children[0] = null;
|
e.returnvalue.props.children[0] = null;
|
||||||
e.returnvalue.props.children[2] = BDFDB.ReactUtils.createElement("div", {
|
e.returnvalue.props.children[2] = BDFDB.ReactUtils.createElement("div", {
|
||||||
children: e.returnvalue.props.children[2],
|
children: e.returnvalue.props.children[2],
|
||||||
style: {display: "none"}
|
style: {display: "none"}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processGuild (e) {
|
processGuild (e) {
|
||||||
|
@ -656,6 +662,22 @@ var ServerFolders = (_ => {
|
||||||
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
|
BDFDB.ReactUtils.forceUpdate(folderGuildContent);
|
||||||
}
|
}
|
||||||
guildStates[e.instance.props.guild.id] = state;
|
guildStates[e.instance.props.guild.id] = state;
|
||||||
|
if (e.returnvalue) {
|
||||||
|
let data = this.getFolderConfig(folder.folderId);
|
||||||
|
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: ["GuildTooltip", "BDFDB_TooltipContainer"]});
|
||||||
|
if (index > -1) children[index] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
|
||||||
|
tooltipConfig: Object.assign({
|
||||||
|
type: "right",
|
||||||
|
list: true,
|
||||||
|
guild: e.instance.props.guild,
|
||||||
|
offset: 12
|
||||||
|
}, data.copyTooltipColor && {
|
||||||
|
backgroundColor: data.color3,
|
||||||
|
fontColor: data.color4,
|
||||||
|
}),
|
||||||
|
children: children[index].props.children
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (e.node) BDFDB.ListenerUtils.add(this, e.node, "click", _ => {BDFDB.TimeUtils.timeout(_ => {
|
if (e.node) BDFDB.ListenerUtils.add(this, e.node, "click", _ => {BDFDB.TimeUtils.timeout(_ => {
|
||||||
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
|
let folder = BDFDB.GuildUtils.getFolder(e.instance.props.guild.id);
|
||||||
|
|
Loading…
Reference in New Issue