New stuff
This commit is contained in:
parent
2b21044bd3
commit
044ba5d889
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Admin Space</title>
|
||||||
|
<link rel="stylesheet" href="/style.css">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700&display=swap" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Pagina dei servizi del Dani</h1>
|
||||||
|
<p>Complimenti! Se hai trovato questa pagina sei davvero un grande smanettone.<br> Tranquillo, qui non troverai segreti statali e mai ci saranno.</p>
|
||||||
|
<a href="/admin/dani/tdgenerator/index.html">Generatore <td></a>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,21 @@
|
||||||
|
<!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>
|
||||||
|
<p>Inserisci matricola:</p>
|
||||||
|
<input type="number" id="matricola" required="required">
|
||||||
|
<p>Inserisci link share:</p>
|
||||||
|
<input type="url" id="link" required="required">
|
||||||
|
<button onclick="genera()">Conferma</button>
|
||||||
|
<button onclick="copiaOutput()">Copia negli appunti</button>
|
||||||
|
<button onclick="pulisci()">Pulisci</button>
|
||||||
|
<pre><code id="output"></code></pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,47 @@
|
||||||
|
function genera() {
|
||||||
|
const matricola = document.getElementById("matricola").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;
|
||||||
|
}
|
||||||
|
|
||||||
|
const htmlString = `<td><a id="${matricola}-link1" href="${link}"><img id="${matricola}-img1" src="${link}" onerror='this.onerror=null; changeUrlToFallback("${matricola}-link1","${matricola}-img1","${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 copiaOutput() {
|
||||||
|
const code = document.getElementById("output").innerText;
|
||||||
|
navigator.clipboard.writeText(code).then(() => {
|
||||||
|
//alert("Codice copiato negli appunti!");
|
||||||
|
}).catch(() => {
|
||||||
|
alert("Errore durante la copia.");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function pulisci() {
|
||||||
|
document.getElementById("matricola").value = "";
|
||||||
|
document.getElementById("link").value = "";
|
||||||
|
document.getElementById("output").innerHTML = "";
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
body{
|
||||||
|
text-align: center;
|
||||||
|
font-family: Consolas;
|
||||||
|
}
|
Loading…
Reference in New Issue