Add download link to axiom

This commit is contained in:
Nicholas Jitkoff 2022-07-21 02:33:19 -07:00
parent 780a670aa9
commit f346bb579b
2 changed files with 18 additions and 3 deletions

View file

@ -31,7 +31,7 @@ body {
flex-direction: column;
background-color:#384747;
}
.titlebar {
#titlebar {
font-size:18px;
text-align:left;
width: 1000px;
@ -39,8 +39,13 @@ body {
padding:8px;
box-sizing: border-box;
border-bottom: 2px solid #87EDD3;
}
#titlebar a {
float:right;
color: #87EDD3;
}
canvas {
width: 1000px;
max-width: 90vw;

View file

@ -15,13 +15,23 @@ function render() {
window.h = window.canvas.height
document.body.appendChild(el("div.window",
el("div.titlebar", {}, "Axiom QuickServe", el("span#title")),
el("div#titlebar", {}, "Axiom QuickServe", el("span#title")),
window.canvas
)
);
document.body.appendChild(el("script", {}, params.body))
setTimeout(() => {
document.title = getName();
var a = new FileReader();
a.onload = function(e) {
console.log("e.target.result", e.target.result)
document.getElementById("titlebar").appendChild(el("a", {href:e.target.result, download:document.title}, "Download QuickServe Script"))
}
a.readAsDataURL(new Blob([params.body], {encoding:"UTF-8",type:"text/javascript;charset=UTF-8"}));
document.getElementById("title").innerText = " - " + document.title;
parent.postMessage({ title: document.title }, "*");
onConnect()