This commit is contained in:
Mirco Wittrien 2019-05-16 00:58:35 +02:00
parent 5c17d90fd3
commit 5e4cb7bd5d
3 changed files with 14 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
class BadgesEverywhere { class BadgesEverywhere {
getName () {return "BadgesEverywhere";} getName () {return "BadgesEverywhere";}
getVersion () {return "1.2.4";} getVersion () {return "1.2.5";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class BadgesEverywhere {
initConstructor () { initConstructor () {
this.changelog = { this.changelog = {
"fixed":[["Icons","Fixed the issue where the badge image wouldn't be contained within the badge"]] "fixed":[["Tooltips","Fixed some issues with the tooltips"]]
}; };
this.patchModules = { this.patchModules = {
@ -204,7 +204,7 @@ class BadgesEverywhere {
if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) { if ((this.loadedusers[info.id].flags | flag) == this.loadedusers[info.id].flags && badges[flag]) {
let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div>`); let badge = BDFDB.htmlToElement(`<div class="BE-badge BE-badge-${this.defaults.badges[flag].name.replace(/ /g, "")} BE-badge-${type} ${this.BadgeClasses[this.defaults.badges[flag].selector]}"></div>`);
badgewrapper.appendChild(badge); badgewrapper.appendChild(badge);
badge.addEventListener("mouseenter", () => {BDFDB.createTooltip(this.defaults.badges[flag].name, badge, {"type":"top"});}); badge.addEventListener("mouseenter", () => {BDFDB.createTooltip(this.defaults.badges[flag].name, badge, {type:"top", style:"white-space: nowrap"});});
} }
} }
if (badgewrapper.firstChild) wrapper.insertBefore(badgewrapper, wrapper.querySelector(".owner-tag,.TRE-tag,svg[name=MobileDevice]")); if (badgewrapper.firstChild) wrapper.insertBefore(badgewrapper, wrapper.querySelector(".owner-tag,.TRE-tag,svg[name=MobileDevice]"));

View File

@ -3,7 +3,7 @@
class ServerFolders { class ServerFolders {
getName () {return "ServerFolders";} getName () {return "ServerFolders";}
getVersion () {return "6.2.5";} getVersion () {return "6.2.6";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class ServerFolders {
initConstructor () { initConstructor () {
this.changelog = { this.changelog = {
"fixed":[["Server Object","Changes in the Server Object broke the plugin"]] "fixed":[["Lags","Fixed some minor lags"]]
}; };
this.labels = {}; this.labels = {};
@ -568,10 +568,9 @@ class ServerFolders {
wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling); wrapper.parentElement.insertBefore(this.foldercontent, wrapper.nextElementSibling);
this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guilds); this.foldercontentguilds = this.foldercontent.querySelector(BDFDB.dotCN.guilds);
} }
let folders = BDFDB.loadAllData(this, "folders"), sortedFolders = []; let folders = BDFDB.sortObject(BDFDB.loadAllData(this, "folders"), "position");
for (let id in folders) sortedFolders[folders[id].position] = folders[id]; for (let folderID in folders) if (folderID && !wrapper.querySelector(BDFDB.dotCN.guildouter + ".folder#" + folderID)) {
for (let data of sortedFolders) if (data && !wrapper.querySelector(BDFDB.dotCN.guildouter + ".folder#" + data.folderID)) { let folderdiv = this.createFolderDiv(folders[folderID]);
let folderdiv = this.createFolderDiv(data);
this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);}); this.readIncludedServerList(folderdiv).forEach(guilddiv => {this.hideServer(guilddiv, folderdiv);});
} }
BDFDB.WebModules.forceAllUpdates(this, "Guild"); BDFDB.WebModules.forceAllUpdates(this, "Guild");
@ -580,8 +579,10 @@ class ServerFolders {
else setTimeout(process, 5000); else setTimeout(process, 5000);
} }
if (methodnames.includes("componentDidUpdate")) { if (methodnames.includes("componentDidUpdate")) {
let folders = BDFDB.loadAllData(this, "folders") let serverAndFolders = this.getAllServersAndFolders();
for (let folderdiv of document.querySelectorAll(BDFDB.dotCN.guildouter + ".folder")) { let folders = BDFDB.loadAllData(this, "folders");
let foundfolders = serverAndFolders.filter(ele => BDFDB.containsClass(ele, "folder"));
if (Object.keys(folders).length != foundfolders.length) for (let folderdiv of document.querySelectorAll(BDFDB.dotCN.guildouter + ".folder")) {
if (folders[folderdiv.id]) this.insertFolderDiv(folders[folderdiv.id], folderdiv); if (folders[folderdiv.id]) this.insertFolderDiv(folders[folderdiv.id], folderdiv);
} }
} }
@ -1034,7 +1035,7 @@ class ServerFolders {
insertFolderDiv (data, folderdiv) { insertFolderDiv (data, folderdiv) {
folderdiv.remove(); folderdiv.remove();
let serversandfolders = this.getAllServersAndFolders(); let serversandfolders = this.getAllServersAndFolders();
let insertnode = serversandfolders[data.position > serversandfolders.length - 1 ? serversandfolders.length - 1 : data.position]; let insertnode = serversandfolders[data.position == -1 || data.position > serversandfolders.length - 1 ? serversandfolders.length - 1 : data.position];
if (insertnode) insertnode.parentElement.insertBefore(folderdiv, insertnode); if (insertnode) insertnode.parentElement.insertBefore(folderdiv, insertnode);
else { else {
insertnode = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCNS.guilds + BDFDB.dotCN.guildbuttoncontainer)); insertnode = BDFDB.getParentEle(BDFDB.dotCN.guildouter, document.querySelector(BDFDB.dotCNS.guilds + BDFDB.dotCN.guildbuttoncontainer));