stuff
This commit is contained in:
parent
0427261358
commit
858c74e2d4
|
@ -604,7 +604,7 @@ class PluginRepo {
|
||||||
BDFDB.removeEles("iframe.discordSandbox",".pluginrepo-loadingicon");
|
BDFDB.removeEles("iframe.discordSandbox",".pluginrepo-loadingicon");
|
||||||
var settings = BDFDB.loadAllData(this, "settings");
|
var settings = BDFDB.loadAllData(this, "settings");
|
||||||
var getPluginInfo, createFrame, runInFrame;
|
var getPluginInfo, createFrame, runInFrame;
|
||||||
var frame, framekey = Math.round(Math.random()*10000000000000000), framerunning = false, framequeue = [], outdated = 0, newentries = 0, i = 0;
|
var frame, framerunning = false, framequeue = [], outdated = 0, newentries = 0, i = 0;
|
||||||
var tags = ["getName", "getVersion", "getAuthor", "getDescription"];
|
var tags = ["getName", "getVersion", "getAuthor", "getDescription"];
|
||||||
var seps = ["\"", "\'", "\`"];
|
var seps = ["\"", "\'", "\`"];
|
||||||
var newentriesdata = BDFDB.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
|
var newentriesdata = BDFDB.loadAllData(this, "newentriesdata"), ownlist = BDFDB.loadData("ownlist", this, "ownlist") || [];
|
||||||
|
@ -763,10 +763,10 @@ class PluginRepo {
|
||||||
callback();
|
callback();
|
||||||
},600000);
|
},600000);
|
||||||
frame.messageReceived = e => {
|
frame.messageReceived = e => {
|
||||||
if (typeof e.data === "object" && e.data.origin == "DiscordPreview" && e.data.framekey == framekey) {
|
if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
|
||||||
switch (e.data.reason) {
|
switch (e.data.reason) {
|
||||||
case "OnLoad":
|
case "OnLoad":
|
||||||
frame.contentWindow.postMessage({origin:"PluginRepo",reason:"OnLoad",framekey},"*");
|
frame.contentWindow.postMessage({origin:"PluginRepo",reason:"OnLoad"},"*");
|
||||||
callback();
|
callback();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ class PluginRepo {
|
||||||
runInFrame();
|
runInFrame();
|
||||||
};
|
};
|
||||||
var evalResultReceived = e => {
|
var evalResultReceived = e => {
|
||||||
if (typeof e.data === "object" && e.data.origin == "DiscordPreview" && e.data.framekey == framekey) {
|
if (typeof e.data === "object" && e.data.origin == "DiscordPreview") {
|
||||||
switch (e.data.reason) {
|
switch (e.data.reason) {
|
||||||
case "EvalResult":
|
case "EvalResult":
|
||||||
window.removeEventListener("message", evalResultReceived);
|
window.removeEventListener("message", evalResultReceived);
|
||||||
|
@ -809,7 +809,7 @@ class PluginRepo {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
window.addEventListener("message", evalResultReceived);
|
window.addEventListener("message", evalResultReceived);
|
||||||
frame.contentWindow.postMessage({origin:"PluginRepo",reason:"Eval",framekey,jsstring:`
|
frame.contentWindow.postMessage({origin:"PluginRepo",reason:"Eval",jsstring:`
|
||||||
try {
|
try {
|
||||||
${body}
|
${body}
|
||||||
var p = new ${name}();
|
var p = new ${name}();
|
||||||
|
|
|
@ -484,9 +484,9 @@ class ThemeRepo {
|
||||||
var avatar = BDFDB.getUserAvatar();
|
var avatar = BDFDB.getUserAvatar();
|
||||||
var nativecss = document.querySelector("head link[rel='stylesheet'][integrity]");
|
var nativecss = document.querySelector("head link[rel='stylesheet'][integrity]");
|
||||||
nativecss = nativecss && nativecss.href ? nativecss.href : null;
|
nativecss = nativecss && nativecss.href ? nativecss.href : null;
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"OnLoad",framekey,username,id,discriminator,avatar,nativecss},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"OnLoad",username,id,discriminator,avatar,nativecss},"*");
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"DarkLight",framekey,checked:darklightinput.checked,light:BDFDB.disCN.themelight,dark:BDFDB.disCN.themedark},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"DarkLight",checked:darklightinput.checked,light:BDFDB.disCN.themelight,dark:BDFDB.disCN.themedark},"*");
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"Normalize",framekey,checked:normalizeinput.checked},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"Normalize",checked:normalizeinput.checked},"*");
|
||||||
break;
|
break;
|
||||||
case "KeyUp":
|
case "KeyUp":
|
||||||
keyPressed(e.data);
|
keyPressed(e.data);
|
||||||
|
@ -499,7 +499,6 @@ class ThemeRepo {
|
||||||
window.addEventListener("message", messageReceived);
|
window.addEventListener("message", messageReceived);
|
||||||
|
|
||||||
var frame = BDFDB.htmlToElement(this.frameMarkup);
|
var frame = BDFDB.htmlToElement(this.frameMarkup);
|
||||||
var framekey = Math.round(Math.random()*10000000000000000);
|
|
||||||
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
|
var themeRepoModal = BDFDB.htmlToElement(this.themeRepoModalMarkup);
|
||||||
var hiddenSettings = BDFDB.loadAllData(this, "hidden");
|
var hiddenSettings = BDFDB.loadAllData(this, "hidden");
|
||||||
var darklightinput = themeRepoModal.querySelector("#input-darklight");
|
var darklightinput = themeRepoModal.querySelector("#input-darklight");
|
||||||
|
@ -528,17 +527,17 @@ class ThemeRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
darklightinput.addEventListener("change", e => {
|
darklightinput.addEventListener("change", e => {
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"DarkLight",framekey,checked:darklightinput.checked,light:BDFDB.disCN.themelight,dark:BDFDB.disCN.themedark},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"DarkLight",checked:darklightinput.checked,light:BDFDB.disCN.themelight,dark:BDFDB.disCN.themedark},"*");
|
||||||
});
|
});
|
||||||
normalizeinput.addEventListener("change", e => {
|
normalizeinput.addEventListener("change", e => {
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"Normalize",framekey,checked:normalizeinput.checked},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"Normalize",checked:normalizeinput.checked},"*");
|
||||||
});
|
});
|
||||||
customcssinput.addEventListener("change", e => {
|
customcssinput.addEventListener("change", e => {
|
||||||
var customCSS = document.querySelector("style#customcss");
|
var customCSS = document.querySelector("style#customcss");
|
||||||
if (customCSS && customCSS.innerText.length > 0) frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"CustomCSS",framekey,checked:customcssinput.checked,css:customCSS.innerText},"*");
|
if (customCSS && customCSS.innerText.length > 0) frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"CustomCSS",checked:customcssinput.checked,css:customCSS.innerText},"*");
|
||||||
});
|
});
|
||||||
themefixerinput.addEventListener("change", e => {
|
themefixerinput.addEventListener("change", e => {
|
||||||
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"ThemeFixer",framekey,checked:themefixerinput.checked,css:this.themeFixerCSS},"*");
|
frame.contentWindow.postMessage({origin:"ThemeRepo",reason:"ThemeFixer",checked:themefixerinput.checked,css:this.themeFixerCSS},"*");
|
||||||
});
|
});
|
||||||
themeRepoModal.querySelector("#download-themefixer").addEventListener("click", e => {
|
themeRepoModal.querySelector("#download-themefixer").addEventListener("click", e => {
|
||||||
this.createThemeFile("ThemeFixer.theme.css", `//META{"name":"ThemeFixer","description":"ThemeFixerCSS for transparent themes","author":"DevilBro","version":"1.0.1"}*//\n\n` + this.themeFixerCSS);
|
this.createThemeFile("ThemeFixer.theme.css", `//META{"name":"ThemeFixer","description":"ThemeFixerCSS for transparent themes","author":"DevilBro","version":"1.0.1"}*//\n\n` + this.themeFixerCSS);
|
||||||
|
|
Loading…
Reference in New Issue