reaktor2: fix agenda.r webinterface custom styling

This commit is contained in:
Kierán Meinhardt 2021-07-29 17:05:39 +02:00 committed by lassulus
parent b19cfab1f3
commit ba6a5456e8

View File

@ -187,16 +187,18 @@ in {
const params = Object.fromEntries(urlSearchParams.entries());
if (params.hasOwnProperty("style")) {
fetch(params["style"])
.then((response) =>
response.text().then((css) => {
const title = document.getElementsByTagName("title")[0];
const style = document.createElement("style");
style.appendChild(document.createTextNode(css));
title.appendChild(style);
})
)
.catch(console.log);
const cssUrls = params["style"].split(" ").filter((x) => x.length > 0);
for (const cssUrl of cssUrls)
fetch(cssUrl)
.then((response) =>
response.text().then((css) => {
const title = document.getElementsByTagName("head")[0];
const style = document.createElement("style");
style.appendChild(document.createTextNode(css));
title.appendChild(style);
})
)
.catch(console.log);
}
fetch("/agenda.json")