Delayed ServerFolders startup to avoid loading issues on reload

This commit is contained in:
Mirco Wittrien 2019-01-04 21:50:14 +01:00
parent 4ce2a3d6ff
commit d0c0f5872d
1 changed files with 11 additions and 9 deletions

View File

@ -305,7 +305,7 @@ class ServerFolders {
getDescription () {return "Adds the feature to create folders to organize your servers. Right click a server > 'Serverfolders' > 'Create Server' to create a server. To add servers to a folder hold 'Ctrl' and drag the server onto the folder, this will add the server to the folderlist and hide it in the serverlist. To open a folder click the folder. A folder can only be opened when it has at least one server in it. To remove a server from a folder, open the folder and either right click the server > 'Serverfolders' > 'Remove Server from Folder' or hold 'Del' and click the server in the folderlist.";}
getVersion () {return "5.9.3";}
getVersion () {return "5.9.4";}
getAuthor () {return "DevilBro";}
@ -371,14 +371,16 @@ class ServerFolders {
this.DiscordConstants = BDFDB.WebModules.findByProperties("Permissions", "ActivityTypes", "StatusTypes");
this.Animations = BDFDB.WebModules.findByProperties("spring");
let folders = BDFDB.loadAllData(this, "folders"), sortedFolders = [];
for (let id in folders) sortedFolders[folders[id].position] = folders[id];
for (let data of sortedFolders) if (data && !document.querySelector(BDFDB.dotCN.guild + ".folder#" + data.folderID)) {
let folderdiv = this.createFolderDiv(data);
this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);});
}
BDFDB.WebModules.forceAllUpdates(this);
setTimeout(() => {
let folders = BDFDB.loadAllData(this, "folders"), sortedFolders = [];
for (let id in folders) sortedFolders[folders[id].position] = folders[id];
for (let data of sortedFolders) if (data && !document.querySelector(BDFDB.dotCN.guild + ".folder#" + data.folderID)) {
let folderdiv = this.createFolderDiv(data);
this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);});
}
BDFDB.WebModules.forceAllUpdates(this);
},5000);
}
else {
console.error(this.getName() + ": Fatal Error: Could not load BD functions!");