Update DisplayServersAsChannels.plugin.js

This commit is contained in:
Mirco Wittrien 2019-01-17 22:20:27 +01:00
parent 5ee3c70556
commit 4fe77fdc43
1 changed files with 10 additions and 10 deletions

View File

@ -3,7 +3,7 @@
class DisplayServersAsChannels { class DisplayServersAsChannels {
getName () {return "DisplayServersAsChannels";} getName () {return "DisplayServersAsChannels";}
getVersion () {return "1.1.6";} getVersion () {return "1.1.7";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -200,21 +200,21 @@ class DisplayServersAsChannels {
load () {} load () {}
start () { start () {
var libraryScript = null; var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!global.BDFDB || typeof BDFDB !== "object" || typeof BDFDB.isLibraryOutdated !== "function" || BDFDB.isLibraryOutdated()) { if ((!global.BDFDB || typeof BDFDB !== "object" || typeof BDFDB.isLibraryOutdated !== "function" || BDFDB.isLibraryOutdated()) && !(libraryScript && performance.now() - libraryScript.getAttribute("date") < 600000)) {
libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (libraryScript) libraryScript.remove(); if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script"); libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript"); libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"); libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {
BDFDB.loaded = true;
this.initialize();
});
document.head.appendChild(libraryScript); document.head.appendChild(libraryScript);
} }
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000); this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
else if (libraryScript) libraryScript.addEventListener("load", () => {
BDFDB.loaded = true;
this.initialize();
});
} }
initialize () { initialize () {
@ -283,7 +283,7 @@ class DisplayServersAsChannels {
avatar.DSAColdName = avatar.textContent; avatar.DSAColdName = avatar.textContent;
avatar.innerHTML = `<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">${BDFDB.encodeToHTML(info.name || info.folderName || "")}</div></span>`; avatar.innerHTML = `<span class="DevilBro-textscrollwrapper" speed=3><div class="DevilBro-textscroll">${BDFDB.encodeToHTML(info.name || info.folderName || "")}</div></span>`;
BDFDB.initElements(avatar); BDFDB.initElements(avatar);
if (info.features && info.features.has("VERIFIED")) avatar.parentElement.insertBefore(avatar, BDFDB.htmlToElement(this.verificationBadgeMarkup)); if (info.features && info.features.has("VERIFIED")) avatar.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), avatar);
} }
} }