From ba6a5456e8d76b9c1eae7cd81dca3f2b16359ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Thu, 29 Jul 2021 17:05:39 +0200 Subject: reaktor2: fix agenda.r webinterface custom styling --- krebs/2configs/reaktor2.nix | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/krebs/2configs/reaktor2.nix b/krebs/2configs/reaktor2.nix index e9837ff7..4a33c33e 100644 --- a/krebs/2configs/reaktor2.nix +++ b/krebs/2configs/reaktor2.nix @@ -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") -- cgit v1.2.3