v1.5.24 - smarter generation

This commit is contained in:
Azgaar 2021-02-13 21:52:50 +03:00
parent e4e40fab49
commit 2f3f5d05fb
4 changed files with 17 additions and 24 deletions

View file

@ -968,18 +968,16 @@
}
async function fetchCharge(charge, id) {
const fetched = fetch("https://azgaar.github.io/Armoria/charges/" + charge + ".svg")
.then(res => {
const fetched = fetch("https://azgaar.github.io/Armoria/charges/" + charge + ".svg").then(res => {
if (res.ok) return res.text();
else throw new Error("Cannot fetch charge");
})
.then(text => {
}).then(text => {
const html = document.createElement("html");
html.innerHTML = text;
const g = html.querySelector("g");
g.setAttribute("id", charge + "_" + id);
return g.outerHTML;
});
}).catch(err => console.error(err));
return fetched;
}