fix more stupid image shit

This commit is contained in:
Greg Gauthier 2024-07-17 01:08:58 +01:00
parent 96ffba405a
commit 554f93f6cc
4 changed files with 4 additions and 16 deletions

View File

@ -41,8 +41,5 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
}); });
}); });
}, 1000); }, 1000);
}); });

View File

@ -12,10 +12,12 @@ export function loadingGif(resultSection) {
resultSection.appendChild(imgElement); resultSection.appendChild(imgElement);
return imgElement; return imgElement;
} }
export function setResultImage(document, name) { export function setResultImage(document, name) {
let imgElement = document.createElement('img'); let imgElement = document.createElement('img');
let resultSection = document.getElementById('resultSection'); let resultSection = document.getElementById('resultSection');
imgElement.src = `${window.IMG}/${name}.jpg`; let safeName = name.replace(/ /g,"%20");
imgElement.src = `${window.IMG}/${safeName}.jpg`;
console.log(imgElement.src); console.log(imgElement.src);
imgElement.onerror = function () { imgElement.onerror = function () {
this.src = `${window.IMG}/404.jpg`; this.src = `${window.IMG}/404.jpg`;

View File

@ -1,11 +0,0 @@
export function setResultImage(name) {
let imgElement = document.createElement('img');
imgElement.src = `${window.IMG}/${name }.jpg`;
console.log(imgElement.src);
imgElement.onerror = function () {
this.src = `${window.IMG}/404.jpg`;
};
resultSection.appendChild(imgElement);
return imgElement;
}

View File

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="assets/css/styles.css"> <link rel="stylesheet" type="text/css" href="assets/css/styles.css">
<title>Gamma World Gaming Tools</title> <title>Gamma World Gaming Tools</title>
<script src="/assets/js/config.js"></script> <script src="../assets/js/config.js"></script>
</head> </head>
<body> <body>
<div style="text-align: center"> <div style="text-align: center">