diff --git a/admin/dani/jsongen/index.html b/admin/dani/jsongen/index.html new file mode 100644 index 0000000..f3f4d7e --- /dev/null +++ b/admin/dani/jsongen/index.html @@ -0,0 +1,33 @@ + + + + + + JsonGen + + + + +

JsonGen

+
+

Inserisci matricola a partire da:

+ +

Matricola a:

+ +
+

Seleziona settore:

+ +

Inserisci modello mezzo:

+ +

Inserisci link HTML:

+ + + + +
+ + \ No newline at end of file diff --git a/admin/dani/jsongen/script.js b/admin/dani/jsongen/script.js new file mode 100644 index 0000000..4093d6a --- /dev/null +++ b/admin/dani/jsongen/script.js @@ -0,0 +1,38 @@ +function genera() { +const matrda = document.getElementById("matrda").value.trim(); +const matra = document.getElementById("matra").value.trim(); +const selezione = document.getElementById("selezione").value.trim(); +const modello = document.getElementById("modello").value.trim(); +const link = document.getElementById("link").value.trim(); +const startMatricola = parseInt(matrda); +const endMatricola = parseInt(matra); +let jsonArray = []; +for (let i = startMatricola; i <= endMatricola; i++) { + let baseJson = { + "matricola": i.toString(), + "settore": selezione, + "modello": modello, + "link": link + }; + + jsonArray.push(baseJson); +} +document.getElementById("output").textContent = + jsonArray.map((item, index) => { + const jsonStr = JSON.stringify(item, null, 2); + return (index < jsonArray.length - 1) ? jsonStr + "," : jsonStr; + }).join("\n"); +} +function copiaOutput() { + const code = document.getElementById("output").innerText; + navigator.clipboard.writeText(code).then(() => { + }).catch(() => { + alert("Errore durante la copia."); + }); +} +function pulisci() { + document.getElementById("matrda").value = ""; + document.getElementById("matra").value = ""; + document.getElementById("link").value = ""; + document.getElementById("output").innerHTML = ""; +} \ No newline at end of file diff --git a/admin/dani/linkgen/style.css b/admin/dani/linkgen/style.css index a418fa9..f103f14 100644 --- a/admin/dani/linkgen/style.css +++ b/admin/dani/linkgen/style.css @@ -1,4 +1,7 @@ body{ text-align: center; font-family: Consolas; +} +pre{ + text-align: left; } \ No newline at end of file diff --git a/admin/dani/servizi.html b/admin/dani/servizi.html index a05d9b6..249cf26 100644 --- a/admin/dani/servizi.html +++ b/admin/dani/servizi.html @@ -13,5 +13,6 @@

Pagina dei servizi del Dani

Complimenti! Se hai trovato questa pagina sei davvero un grande smanettone.
Tranquillo, qui non troverai segreti statali e mai ci saranno.

Generatore <td> e <img> + \ No newline at end of file diff --git a/scripts/tperbus.json b/scripts/tperbus.json index af6c54d..4f1ed49 100644 --- a/scripts/tperbus.json +++ b/scripts/tperbus.json @@ -1,6 +1,8 @@ -{ +[ + { "matricola": "placeholderMatricola", "settore": "placeholderSettore", "modello": "placeholderModello", "link": "placeholderLink" -} \ No newline at end of file + } +] \ No newline at end of file