Update ServerFolders.plugin.js

This commit is contained in:
Mirco Wittrien 2019-10-24 09:09:48 +02:00
parent c39107bc81
commit 66930c3eb7
1 changed files with 17 additions and 17 deletions

View File

@ -3,7 +3,7 @@
class ServerFolders {
getName () {return "ServerFolders";}
getVersion () {return "6.5.8";}
getVersion () {return "6.5.9";}
getAuthor () {return "DevilBro";}
@ -816,14 +816,11 @@ class ServerFolders {
updateGuildInFolderContent (folderid, guildid) {
if (!this.foldercontentguilds || !folderid || !guildid) return;
let guild = BDFDB.LibraryModules.GuildStore.getGuild(guildid);
if (guild) {
let oldCopy = this.foldercontentguilds.querySelector(`.copy[guildid="${guildid}"]`);
if (guild) {
let newCopy = this.createCopyOfServer(folderid, guildid);
if (!newCopy) return;
else if (oldCopy) {
this.foldercontentguilds.insertBefore(newCopy, oldCopy);
BDFDB.DOMUtils.remove(oldCopy);
}
if (newCopy) {
if (oldCopy) this.foldercontentguilds.insertBefore(newCopy, oldCopy);
else {
let folder = BDFDB.LibraryModules.FolderStore.getGuildFolderById(folderid);
let position = folder.guildIds.indexOf(guildid);
@ -838,6 +835,8 @@ class ServerFolders {
if (BDFDB.DOMUtils.containsClass(this.foldercontentguilds.firstElementChild, "folderseparatorouter")) BDFDB.DOMUtils.remove(this.foldercontentguilds.firstElementChild);
}
}
BDFDB.DOMUtils.remove(oldCopy);
}
addSeparator (folderid) {
if (!this.foldercontentguilds) return;
@ -946,6 +945,7 @@ class ServerFolders {
};
guildcopyinner.addEventListener("mouseenter", () => {
if (!BDFDB.LibraryModules.GuildStore.getGuild(guildid)) return BDFDB.DOMUtils.remove(guildcopy);
let EditServers = BDFDB.BDUtils.getPlugin("EditServers");
let ESdata = EditServers ? EditServers.getGuildData(guildid, guildcopyinner) : null;
if (ESdata && (ESdata.name || ESdata.color3 || ESdata.color4)) EditServers.changeTooltip(guild, guildcopyinner, "right");