diff --git a/libs/umami.js b/libs/umami.js index 26bf180d..5ef2dfb3 100644 --- a/libs/umami.js +++ b/libs/umami.js @@ -1,5 +1,5 @@ (window => { - const noTrack = !location.hostname || window.localStorage.getItem("noTrack"); + const noTrack = window.localStorage.getItem("noTrack"); const { screen: {width, height}, diff --git a/modules/coa-renderer.js b/modules/coa-renderer.js index 047862c4..8ab0fef5 100644 --- a/modules/coa-renderer.js +++ b/modules/coa-renderer.js @@ -1953,9 +1953,9 @@ window.COArenderer = (function () { return fetchedCharges.join(""); } - const url = location.hostname ? "./charges/" : "http://armoria.herokuapp.com/charges/"; // on local machine fetch files from server + const PATH = "./charges/"; async function fetchCharge(charge, id) { - const fetched = fetch(url + charge + ".svg") + const fetched = fetch(PATH + charge + ".svg") .then(res => { if (res.ok) return res.text(); else throw new Error("Cannot fetch charge"); diff --git a/modules/io/export.js b/modules/io/export.js index 402342a2..4951bde6 100644 --- a/modules/io/export.js +++ b/modules/io/export.js @@ -236,27 +236,27 @@ async function getMapURL(type, options = {}) { cloneDefs.querySelector("#defs-emblems")?.remove(); } - // replace ocean pattern href to base64 - if (location.hostname) { - const el = cloneEl.getElementById("oceanicPattern"); - const url = el?.getAttribute("href"); - if (url) { + { + // replace ocean pattern href to base64 + const image = cloneEl.getElementById("oceanicPattern"); + const href = image?.getAttribute("href"); + if (href) { await new Promise(resolve => { - getBase64(url, base64 => { - el.setAttribute("href", base64); + getBase64(href, base64 => { + image.setAttribute("href", base64); resolve(); }); }); } } - // replace texture href to base64 - if (location.hostname) { - const image = document.querySelector("#texture > image"); + { + // replace texture href to base64 + const image = cloneEl.querySelector("#texture > image"); if (image) { - const url = image.getAttribute("href"); + const href = image.getAttribute("href"); await new Promise(resolve => { - getBase64(url, base64 => { + getBase64(href, base64 => { image.setAttribute("href", base64); resolve(); }); diff --git a/modules/ui/general.js b/modules/ui/general.js index 74042d6f..083e2c8b 100644 --- a/modules/ui/general.js +++ b/modules/ui/general.js @@ -9,7 +9,7 @@ window.addEventListener("resize", function (e) { changeMapSize(); }); -if (location.hostname && location.hostname !== "localhost" && location.hostname !== "127.0.0.1") { +if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1") { window.onbeforeunload = () => "Are you sure you want to navigate away?"; }