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'); let image = document.createElement('img');
image.src = `${window.IMG}/android.jpg`; 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.width = '275px';
image.style.height = '275px'; image.style.height = '275px';
container.appendChild(image); container.appendChild(image);

View File

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

View File

@ -37,7 +37,7 @@ document.getElementById('terrainForm').addEventListener('submit', function (even
}) })
.catch((err) => { .catch((err) => {
err.text().then(() => { 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 // Insert the loading.gif before making the fetch request
resultSection.innerHTML = ''; resultSection.innerHTML = '';
let imgElement = document.createElement('img'); let imgElement = document.createElement('img');
imgElement.src = `/assets/img/checking.gif`; imgElement.src = `${window.IMG}/checking.gif`;
imgElement.style.width = '275px'; imgElement.style.width = '275px';
imgElement.style.height = '275px'; imgElement.style.height = '275px';
imgElement.style.display = 'block'; imgElement.style.display = 'block';
@ -15,10 +15,10 @@ export function loadingGif(resultSection) {
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 = `/assets/img/` + name + ".jpg"; imgElement.src = `${window.IMG}/${name}.jpg`;
console.log(imgElement.src); console.log(imgElement.src);
imgElement.onerror = function () { imgElement.onerror = function () {
this.src = `/assets/img/404.jpg`; this.src = `${window.IMG}/404.jpg`;
}; };
resultSection.appendChild(imgElement); resultSection.appendChild(imgElement);
} }

View File

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

View File

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

View File

@ -13,7 +13,7 @@ export function setCreatureTable(data, creatureName) {
creatureId.className = 'creature_id'; creatureId.className = 'creature_id';
creatureId.innerHTML = ` creatureId.innerHTML = `
<h2>${creatureName.toUpperCase()}</h2> <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); let profile = createProfileSection(data);

View File

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

View File

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

View File

@ -75,7 +75,7 @@
}); });
let imgElement = document.createElement('img'); 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'); let results = document.getElementById('results');
results.innerHTML = ''; results.innerHTML = '';
results.appendChild(imgElement); results.appendChild(imgElement);
@ -93,7 +93,7 @@
h2tag.textContent = data.success ? "You Succeeded!" : "You Failed!"; h2tag.textContent = data.success ? "You Succeeded!" : "You Failed!";
results.appendChild(h2tag); 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; imgElement.src = imgSrc;
results.appendChild(imgElement); results.appendChild(imgElement);
}, 1500); }, 1500);