fix stupid pathing mistakes

This commit is contained in:
Greg Gauthier 2024-07-17 00:50:14 +01:00
parent 00ed3d48fc
commit 96ffba405a
10 changed files with 18 additions and 18 deletions

View File

@ -12,7 +12,7 @@ export function androidResultTable(data, creatureName) {
let image = document.createElement('img');
image.src = `${window.IMG}/android.jpg`;
image.onerror = () => { image.src = '/assets/img/404.jpg' };
image.onerror = () => { image.src = `${window.IMG}/404.jpg` };
image.style.width = '275px';
image.style.height = '275px';
container.appendChild(image);

View File

@ -7,7 +7,7 @@ if (window.location.hostname === 'localhost' || window.location.hostname === '12
window.DOC_ROOT = '/gw';
}
window.IMG = `${window.DOC_ROOT}/img`;
window.CSS = `${window.DOC_ROOT}/css`;
window.JS = `${window.DOC_ROOT}/js`;
window.IMG = `${window.DOC_ROOT}/assets/img`;
window.CSS = `${window.DOC_ROOT}/assets/css`;
window.JS = `${window.DOC_ROOT}/assets/js`;
window.DOC = `${window.DOC_ROOT}/pages`;

View File

@ -37,7 +37,7 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
})
.catch((err) => {
err.text().then(() => {
imgElement.src = '/assets/img/404.jpg';
imgElement.src = `${window.IMG}/404.jpg`;
});
});

View File

@ -3,7 +3,7 @@ export function loadingGif(resultSection) {
// Insert the loading.gif before making the fetch request
resultSection.innerHTML = '';
let imgElement = document.createElement('img');
imgElement.src = `/assets/img/checking.gif`;
imgElement.src = `${window.IMG}/checking.gif`;
imgElement.style.width = '275px';
imgElement.style.height = '275px';
imgElement.style.display = 'block';
@ -15,10 +15,10 @@ export function loadingGif(resultSection) {
export function setResultImage(document, name) {
let imgElement = document.createElement('img');
let resultSection = document.getElementById('resultSection');
imgElement.src = `/assets/img/` + name + ".jpg";
imgElement.src = `${window.IMG}/${name}.jpg`;
console.log(imgElement.src);
imgElement.onerror = function () {
this.src = `/assets/img/404.jpg`;
this.src = `${window.IMG}/404.jpg`;
};
resultSection.appendChild(imgElement);
}

View File

@ -39,7 +39,7 @@ window.onload = function () {
let outcomeText = data['outcome'];
html += `<p><h2>${outcomeText}</h2></p>`;
// adding img tag
let outcomeImage = 'img/' + outcomeText.replace(' ', '%20') + '.png';
let outcomeImage = `${window.IMG}/` + outcomeText.replace(' ', '%20') + '.png';
html += `<img src="${outcomeImage}" width="350px" height="350px"/>`
resultsDiv.innerHTML = html;

View File

@ -41,7 +41,7 @@ window.onload = function () {
let outcomeText = data['outcome'];
html += `<p><h2>${outcomeText}</h2></p>`;
// adding img tag
let outcomeImage = 'img/' + outcomeText.replace(' ', '%20') + '.png';
let outcomeImage = `${window.IMG}/` + outcomeText.replace(' ', '%20') + '.png';
html += `<img src="${outcomeImage}" width="350px" height="350px"/>`
resultsDiv.innerHTML = html;

View File

@ -13,7 +13,7 @@ export function setCreatureTable(data, creatureName) {
creatureId.className = 'creature_id';
creatureId.innerHTML = `
<h2>${creatureName.toUpperCase()}</h2>
<img src='${window.IMG}/${creatureName}.jpg' onerror='this.src="${window.IMG}/404.jpg";' style='width: 275px; height: 275px;'>
<img src='${window.IMG}/${creatureName}.jpg' onerror='this.src="${window.IMG}/404.jpg";' style='width: 275px; height: 275px;' alt="${creatureName}">
`;
let profile = createProfileSection(data);

View File

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

View File

@ -72,7 +72,7 @@
let commonImgSize = '250px'
// Display a placeholder image or loading indicator
let imgElement = document.createElement('img');
imgElement.src = '/assets/img/loading.gif';
imgElement.src = `${window.IMG}/loading.gif`;
imgElement.style.width = commonImgSize;
imgElement.style.height = commonImgSize;
@ -87,7 +87,7 @@
fetch(`${window.BASE_URL}/coinflip`)
.then(response => response.text())
.then(data => {
let imgSrc = '/assets/img/' + data.replace(/\"/g, '') + '.jpg';
let imgSrc = `${window.IMG}/` + data.replace(/\"/g, '') + '.jpg';
setTimeout(() => {
imgElement.src = imgSrc;
}, 1500);
@ -104,7 +104,7 @@
let resultSection = document.getElementById('toolPanel');
resultSection.innerHTML = '';
let imgElement = document.createElement('img');
imgElement.src = '/assets/img/odds.gif';
imgElement.src = `${window.IMG}/odds.gif`;
imgElement.style.width = '250px';
imgElement.style.height = '250px';
imgElement.style.display = 'block';

View File

@ -75,7 +75,7 @@
});
let imgElement = document.createElement('img');
imgElement.src = 'img/ability_check_loading.gif';
imgElement.src = `${window.IMG}/ability_check_loading.gif`;
let results = document.getElementById('results');
results.innerHTML = '';
results.appendChild(imgElement);
@ -93,7 +93,7 @@
h2tag.textContent = data.success ? "You Succeeded!" : "You Failed!";
results.appendChild(h2tag);
let imgSrc = data.success ? "img/ability_check_succeeded.gif" : "img/ability_check_failed.gif";
let imgSrc = data.success ? `${window.IMG}/ability_check_succeeded.gif` : `${window.IMG}/ability_check_failed.gif`;
imgElement.src = imgSrc;
results.appendChild(imgElement);
}, 1500);