From 8322772696aa4adb735bd9d1cd01c70b10bca2bd Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Mon, 22 May 2023 08:31:12 +0200 Subject: [PATCH] Slightly improve script and output --- index.html | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 24ca30a..8c1b246 100644 --- a/index.html +++ b/index.html @@ -188,19 +188,12 @@ document.querySelector("#savePDF").addEventListener("click", event => { } var tipologija = document.getElementById("tipologija").value var prispevki = document.getElementById("prispevki").value - var priloge = "Priloga: " - var datum = new Date(); - var date = "Datum: " + datum.getDate() + ". " + (datum.getMonth()+1) + ". " + datum.getFullYear() + var date = "Datum: " + (new Date()).toLocaleDateString("sl"); - if (document.getElementById("fotokopija").checked){ - var fotokopija = document.getElementById("fotokopija").value - priloge = priloge + ", " + fotokopija - } - - if (document.getElementById("dokazila").checked){ - var dokazila = document.getElementById("dokazila").value - priloge = priloge + ", " + dokazila - } + var priloge = "Priloge: " + for (const priloga of ["fotokopija", "dokazila", "final"]) + if (document.getElementById(priloga).checked) + priloge += "\n" + "- " + document.getElementById(priloga).value var docDefinition = { defaultStyle: { fontSize: 12 },