From e80915a4083022dbe451658dcd39086ec0260caa Mon Sep 17 00:00:00 2001 From: Curry141 <135717077+Daniongithub@users.noreply.github.com> Date: Wed, 11 Jun 2025 12:28:18 +0200 Subject: [PATCH] New JsonGen --- admin/dani/jsongen/index.html | 33 ++++++++++++++++++++++++++++++ admin/dani/jsongen/script.js | 38 +++++++++++++++++++++++++++++++++++ admin/dani/linkgen/style.css | 3 +++ admin/dani/servizi.html | 1 + scripts/tperbus.json | 6 ++++-- 5 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 admin/dani/jsongen/index.html create mode 100644 admin/dani/jsongen/script.js 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 @@ + + +
+ + +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 @@
Complimenti! Se hai trovato questa pagina sei davvero un grande smanettone.
Tranquillo, qui non troverai segreti statali e mai ci saranno.