This commit is contained in:
Curry141 2025-05-17 16:50:25 +02:00 committed by GitHub
parent 4befeed427
commit f3ea8aa0d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 141 deletions

View File

@ -1,24 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Generatore <td></title>
<link rel="stylesheet" href="style.css">
<script src="linkgen.js"></script>
</head>
<body>
<h1>Generatore di &lt;td&gt; per ER-TPL</h1>
<a href="notrue.html">Generatore &lt;img&gt;</a>
<p>Inserisci matricola:</p>
<input type="number" id="matricola" required="required">
<p>Inserisci numero se hai altre foto con stessa matricola (default: 1):</p>
<input type="number" id="numero">
<p>Inserisci link share:</p>
<input type="url" id="link" required="required">
<button onclick="generatd()">Conferma</button>
<button onclick="copiaOutput()">Copia negli appunti</button>
<button onclick="puliscitd()">Pulisci</button>
<pre><code id="output"></code></pre>
</body>
</html>

View File

@ -1,91 +0,0 @@
function generatd() {
const matricola = document.getElementById("matricola").value.trim();
var numero = document.getElementById("numero").value.trim();
const link = document.getElementById("link").value.trim();
if (!matricola || !link) {
alert("Compila entrambi i campi.");
return;
}
try {
const urlObj = new URL(link);
const params = new URLSearchParams(urlObj.search);
const path = params.get("file");
if (!path) {
alert("Parametro ?file= mancante nell'URL.");
return;
}
if (numero === "") {
numero = 1;
}
const htmlString = `<td><a id="${matricola}-link${numero}" href="${link}"><img id="${matricola}-img${numero}" src="${link}" onerror='this.onerror=null; changeUrlToFallback("${matricola}-link${numero}","${matricola}-img${numero}","${path}");' alt="Server foto non raggiungibile."></a></td>`;
const escapedOutput = htmlString
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
document.getElementById("output").innerHTML = escapedOutput;
} catch (error) {
alert("URL non valido.");
}
}
function generaimg() {
const mezzo = document.getElementById("mezzo").value.trim();
const link = document.getElementById("link").value.trim();
if (!mezzo || !link) {
alert("Compila entrambi i campi.");
return;
}
try {
const urlObj = new URL(link);
const params = new URLSearchParams(urlObj.search);
const path = params.get("file");
if (!path) {
alert("Parametro ?file= mancante nell'URL.");
return;
}
const htmlString = `<img id="${mezzo}" class="bus" src="${link}" onerror='this.onerror=null; changeUrlToFallbackNoTrue("","${mezzo}","${path}");' alt="Server foto non raggiungibile.">`;
const escapedOutput = htmlString
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;");
document.getElementById("output").innerHTML = escapedOutput;
} catch (error) {
alert("URL non valido.");
}
}
function copiaOutput() {
const code = document.getElementById("output").innerText;
navigator.clipboard.writeText(code).then(() => {
//alert("Codice copiato negli appunti!");
}).catch(() => {
alert("Errore durante la copia.");
});
}
function puliscitd() {
document.getElementById("matricola").value = "";
document.getElementById("link").value = "";
document.getElementById("output").innerHTML = "";
}
function pulisciimg() {
document.getElementById("mezzo").value = "";
document.getElementById("link").value = "";
document.getElementById("output").innerHTML = "";
}

View File

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Generatore <td></title>
<link rel="stylesheet" href="style.css">
<script src="linkgen.js"></script>
</head>
<body>
<h1>Generatore di &lt;img&gt; per ER-TPL</h1>
<a href="index.html">Generatore &lt;td&gt;</a>
<p>Inserisci nome mezzo html:</p>
<input type="text" id="mezzo" required="required">
<p>Inserisci link share:</p>
<input type="url" id="link" required="required">
<button onclick="generaimg()">Conferma</button>
<button onclick="copiaOutput()">Copia negli appunti</button>
<button onclick="pulisciimg()">Pulisci</button>
<pre><code id="output"></code></pre>
</body>
</html>

View File

@ -1,4 +0,0 @@
body{
text-align: center;
font-family: Consolas;
}