parent
8c63d00613
commit
4befeed427
|
@ -0,0 +1,24 @@
|
||||||
|
<!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 <td> per ER-TPL</h1>
|
||||||
|
<a href="notrue.html">Generatore <img></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>
|
|
@ -0,0 +1,91 @@
|
||||||
|
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, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">");
|
||||||
|
|
||||||
|
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, "&")
|
||||||
|
.replace(/</g, "<")
|
||||||
|
.replace(/>/g, ">");
|
||||||
|
|
||||||
|
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 = "";
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
<!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 <img> per ER-TPL</h1>
|
||||||
|
<a href="index.html">Generatore <td></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>
|
|
@ -0,0 +1,4 @@
|
||||||
|
body{
|
||||||
|
text-align: center;
|
||||||
|
font-family: Consolas;
|
||||||
|
}
|
Loading…
Reference in New Issue