From 96ffba405adf4a5959d1aa339778f31b898170ba Mon Sep 17 00:00:00 2001 From: Greg Gauthier Date: Wed, 17 Jul 2024 00:50:14 +0100 Subject: [PATCH] fix stupid pathing mistakes --- web/assets/js/androidResultTable.js | 2 +- web/assets/js/config.js | 6 +++--- web/assets/js/encounter.js | 2 +- web/assets/js/loading.js | 6 +++--- web/assets/js/mentalattack.js | 2 +- web/assets/js/physicalattack.js | 2 +- web/assets/js/setCreatureTable.js | 2 +- web/assets/js/setResultImage.js | 4 ++-- web/index.html | 6 +++--- web/pages/ability_check.html | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/web/assets/js/androidResultTable.js b/web/assets/js/androidResultTable.js index fc8c4d4..a75ab62 100644 --- a/web/assets/js/androidResultTable.js +++ b/web/assets/js/androidResultTable.js @@ -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); diff --git a/web/assets/js/config.js b/web/assets/js/config.js index 23f1213..62cfdfe 100644 --- a/web/assets/js/config.js +++ b/web/assets/js/config.js @@ -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`; diff --git a/web/assets/js/encounter.js b/web/assets/js/encounter.js index 3f4b2e6..0c3ab47 100644 --- a/web/assets/js/encounter.js +++ b/web/assets/js/encounter.js @@ -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`; }); }); diff --git a/web/assets/js/loading.js b/web/assets/js/loading.js index 48a5b8f..63b497b 100644 --- a/web/assets/js/loading.js +++ b/web/assets/js/loading.js @@ -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); } \ No newline at end of file diff --git a/web/assets/js/mentalattack.js b/web/assets/js/mentalattack.js index 0dfddbb..8719721 100644 --- a/web/assets/js/mentalattack.js +++ b/web/assets/js/mentalattack.js @@ -39,7 +39,7 @@ window.onload = function () { let outcomeText = data['outcome']; html += `

${outcomeText}

`; // adding img tag - let outcomeImage = 'img/' + outcomeText.replace(' ', '%20') + '.png'; + let outcomeImage = `${window.IMG}/` + outcomeText.replace(' ', '%20') + '.png'; html += `` resultsDiv.innerHTML = html; diff --git a/web/assets/js/physicalattack.js b/web/assets/js/physicalattack.js index 50f93d7..1d6edd5 100644 --- a/web/assets/js/physicalattack.js +++ b/web/assets/js/physicalattack.js @@ -41,7 +41,7 @@ window.onload = function () { let outcomeText = data['outcome']; html += `

${outcomeText}

`; // adding img tag - let outcomeImage = 'img/' + outcomeText.replace(' ', '%20') + '.png'; + let outcomeImage = `${window.IMG}/` + outcomeText.replace(' ', '%20') + '.png'; html += `` resultsDiv.innerHTML = html; diff --git a/web/assets/js/setCreatureTable.js b/web/assets/js/setCreatureTable.js index 6240d88..1b175cd 100644 --- a/web/assets/js/setCreatureTable.js +++ b/web/assets/js/setCreatureTable.js @@ -13,7 +13,7 @@ export function setCreatureTable(data, creatureName) { creatureId.className = 'creature_id'; creatureId.innerHTML = `

${creatureName.toUpperCase()}

- + ${creatureName} `; let profile = createProfileSection(data); diff --git a/web/assets/js/setResultImage.js b/web/assets/js/setResultImage.js index 8171a7f..1a754a9 100644 --- a/web/assets/js/setResultImage.js +++ b/web/assets/js/setResultImage.js @@ -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; diff --git a/web/index.html b/web/index.html index db1c1f5..d772763 100644 --- a/web/index.html +++ b/web/index.html @@ -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'; diff --git a/web/pages/ability_check.html b/web/pages/ability_check.html index 944667e..3434656 100644 --- a/web/pages/ability_check.html +++ b/web/pages/ability_check.html @@ -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);