This commit is contained in:
Mirco Wittrien 2019-06-14 11:13:15 +02:00
parent fb1f0b6ae3
commit 5ca704cc20
2 changed files with 14 additions and 7 deletions

View File

@ -627,7 +627,7 @@ class PluginRepo {
result = result.replace(/[\r\t]/g, "");
BDFDB.saveData("urlbase64", btoa(result), this, "newentriesdata");
this.loadedPlugins = {};
this.grabbedPlugins = result.split("\n");
this.grabbedPlugins = result.split("\n").filter(n => n);
this.foundPlugins = this.grabbedPlugins.concat(ownlist);
this.loading = {is:true, timeout:setTimeout(() => {
clearTimeout(this.loading.timeout);
@ -781,7 +781,10 @@ class PluginRepo {
callback();
},600000);
frame.messageReceived = e => {
if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
if (!document.contains(frame)) {
window.removeEventListener("message", frame.messageReceived);
}
else if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
switch (e.data.reason) {
case "OnLoad":
frame.contentWindow.postMessage({origin:"PluginRepo",reason:"OnLoad"},"*");
@ -897,7 +900,7 @@ class PluginRepo {
let filename = data.url.split("/").pop();
require("fs").unlink(require("path").join(BDFDB.getPluginsFolder(), filename), (error) => {
if (error) BDFDB.showToast(`Unable to delete Plugin "${filename}".`, {type:"danger"});
else BDFDB.showToast(`Successfully deleted Plugin "${filename}".`, {type:"success"});
else BDFDB.showToast(`Successfully deleted Plugin "${filename}".`);
});
}

View File

@ -266,7 +266,7 @@ class ThemeRepo {
top: 0 !important;
}
iframe.discordPreview ~ ${BDFDB.dotCNS.appmount + BDFDB.dotCN.titlebar},
iframe.discordPreview ~ ${BDFDB.dotCNS.appmount + BDFDB.dotCN.app} {
iframe.discordPreview ~ ${BDFDB.dotCNS.appmount + BDFDB.dotCN.app} > *:not(.toasts):not(.bd-toasts) {
opacity: 0 !important;
visibility: hidden !important;
}
@ -482,7 +482,11 @@ class ThemeRepo {
};
var messageReceived = e => {
if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
if (!document.contains(frame)) {
document.removeEventListener("keyup", keyPressed);
window.removeEventListener("message", messageReceived);
}
else if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
switch (e.data.reason) {
case "OnLoad":
var username = BDFDB.myData.username;
@ -752,7 +756,7 @@ class ThemeRepo {
body = body.replace(/[\r\t]/g, "");
BDFDB.saveData("urlbase64", btoa(body), this, "newentriesdata");
this.loadedThemes = {};
this.grabbedThemes = body.split("\n");
this.grabbedThemes = body.split("\n").filter(n => n);
request("https://github.com/NFLD99/Better-Discord", (error2, response2, body2) => {
if (!error2 && body2) {
NFLDreplace = /\/NFLD99\/Better-Discord\/tree\/master\/Themes_[^"]+">([^<]+)/i.exec(body2);
@ -911,7 +915,7 @@ class ThemeRepo {
let filename = data.requesturl.split("/").pop();
require("fs").unlink(require("path").join(BDFDB.getThemesFolder(), filename), (error) => {
if (error) BDFDB.showToast(`Unable to delete Theme "${filename}".`, {type:"danger"});
else BDFDB.showToast(`Successfully deleted Theme "${filename}".`, {type:"success"});
else BDFDB.showToast(`Successfully deleted Theme "${filename}".`);
});
}