diff --git a/web/assets/js/androidResultTable.js b/web/assets/js/androidResultTable.js index 3b16e5c..fc8c4d4 100644 --- a/web/assets/js/androidResultTable.js +++ b/web/assets/js/androidResultTable.js @@ -11,7 +11,7 @@ export function androidResultTable(data, creatureName) { container.appendChild(creatureTitle) let image = document.createElement('img'); - image.src = '/assets/img/android.jpg'; + image.src = `${window.IMG}/android.jpg`; image.onerror = () => { image.src = '/assets/img/404.jpg' }; image.style.width = '275px'; image.style.height = '275px'; diff --git a/web/assets/js/bestiary.js b/web/assets/js/bestiary.js index 7d9d91a..cbe91c8 100644 --- a/web/assets/js/bestiary.js +++ b/web/assets/js/bestiary.js @@ -24,7 +24,7 @@ document.getElementById('searchForm').addEventListener('submit', function (event }) .then((json) => { if (json === null) { // if json is null update the image and stop execution - imgElement.src = '/assets/img/404.jpg'; + imgElement.src = `${window.IMG}/404.jpg`; throw new Error('No data found'); // this will stop the execution and go to the catch block } resultSection.innerHTML = ''; // Clear previous content @@ -37,7 +37,7 @@ document.getElementById('searchForm').addEventListener('submit', function (event .catch((err) => { console.log(err); if (!resultSection.hasChildNodes()) { // Only update the image if it wasn't already updated - imgElement.src = '/assets/img/404.jpg'; + imgElement.src = `${window.IMG}/404.jpg`; } }); }, 1000); diff --git a/web/assets/js/config.js b/web/assets/js/config.js index ac830ed..f56dd0d 100644 --- a/web/assets/js/config.js +++ b/web/assets/js/config.js @@ -1,13 +1,17 @@ if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') { window.BASE_URL = 'http://127.0.0.1:5000'; + window.IMG = "/assets/img"; + window.CSS = "/assets/css"; + window.JS = "/assets/js"; + window.DOC = "/pages"; } else { window.BASE_URL = 'https://gammaworld.gmgauthier.com'; + window.IMG = "/gw/assets/img"; + window.CSS = "/gw/assets/css"; + window.JS = "/gw/assets/js"; + window.DOC = "/gw/pages"; } -window.IMG = "/assets/img"; -window.CSS = "/assets/css"; -window.JS = "/assets/js"; -window.DOC = "/pages"; console.log(window.location.hostname) console.log(window.BASE_URL) \ No newline at end of file diff --git a/web/assets/js/setCreatureTable.js b/web/assets/js/setCreatureTable.js index 78c929d..6240d88 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()}

- + `; let profile = createProfileSection(data);