Fix imggen
This commit is contained in:
parent
4162711d53
commit
192be32268
|
@ -38,23 +38,17 @@ function generatd() {
|
||||||
|
|
||||||
function generaimg() {
|
function generaimg() {
|
||||||
const mezzo = document.getElementById("mezzo").value.trim();
|
const mezzo = document.getElementById("mezzo").value.trim();
|
||||||
const link = document.getElementById("link").value.trim();
|
var link = document.getElementById("link").value.trim();
|
||||||
|
|
||||||
if (!mezzo || !link) {
|
if (!mezzo || !link) {
|
||||||
alert("Compila entrambi i campi.");
|
alert("Compila entrambi i campi.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
link = link.replace(/&a=true/, '');
|
||||||
try {
|
try {
|
||||||
const urlObj = new URL(link);
|
const urlObj = new URL(link);
|
||||||
const params = new URLSearchParams(urlObj.search);
|
const params = new URLSearchParams(urlObj.search);
|
||||||
const path = params.get("file");
|
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 htmlString = `<img id="${mezzo}" class="bus" src="${link}" onerror='this.onerror=null; changeUrlToFallbackNoTrue("","${mezzo}","${path}");' alt="Server foto non raggiungibile.">`;
|
||||||
|
|
||||||
const escapedOutput = htmlString
|
const escapedOutput = htmlString
|
||||||
|
|
Loading…
Reference in New Issue