diff --git a/index.html b/index.html index 272f9876..98a68930 100644 --- a/index.html +++ b/index.html @@ -4313,6 +4313,7 @@ + diff --git a/main.js b/main.js index df5b8f55..12573841 100644 --- a/main.js +++ b/main.js @@ -6,7 +6,7 @@ const version = "1.661"; // generator version document.title += " v" + version; // Switches to disable/enable logging features -const PRODUCTION = window.location.host; +const PRODUCTION = location.hostname && location.hostname !== "localhost" && location.hostname !== "127.0.0.1"; const DEBUG = localStorage.getItem("debug"); const INFO = DEBUG || !PRODUCTION; const TIME = DEBUG || !PRODUCTION; diff --git a/modules/coa-renderer.js b/modules/coa-renderer.js index f7c71bd2..1d6c583a 100644 --- a/modules/coa-renderer.js +++ b/modules/coa-renderer.js @@ -1795,7 +1795,7 @@ window.COArenderer = (function () { return fetchedCharges.join(""); } - const url = PRODUCTION ? "./charges/" : "http://armoria.herokuapp.com/charges/"; // on local machine fetch files from server + const url = location.hostname ? "./charges/" : "http://armoria.herokuapp.com/charges/"; // on local machine fetch files from server async function fetchCharge(charge, id) { const fetched = fetch(url + charge + ".svg") .then(res => { diff --git a/modules/save.js b/modules/save.js index 8618a007..b4540245 100644 --- a/modules/save.js +++ b/modules/save.js @@ -212,7 +212,7 @@ async function getMapURL(type, options = {}) { } // replace ocean pattern href to base64 - if (PRODUCTION && cloneEl.getElementById("oceanicPattern")) { + if (location.hostname && cloneEl.getElementById("oceanicPattern")) { const el = cloneEl.getElementById("oceanicPattern"); const url = el.getAttribute("href"); await new Promise(resolve => { diff --git a/modules/ui/general.js b/modules/ui/general.js index d1cd0f5e..ffc41a31 100644 --- a/modules/ui/general.js +++ b/modules/ui/general.js @@ -9,7 +9,9 @@ $(window).resize(function (e) { changeMapSize(); }); -window.onbeforeunload = () => "Are you sure you want to navigate away?"; +if (location.hostname && location.hostname !== "localhost" && location.hostname !== "127.0.0.1") { + window.onbeforeunload = () => "Are you sure you want to navigate away?"; +} // Tooltips const tooltip = document.getElementById("tooltip"); @@ -19,12 +21,6 @@ document.getElementById("dialogs").addEventListener("mousemove", showDataTip); document.getElementById("optionsContainer").addEventListener("mousemove", showDataTip); document.getElementById("exitCustomization").addEventListener("mousemove", showDataTip); -/** - * @param {string} tip Tooltip text - * @param {boolean} main Show above other tooltips - * @param {string} type Message type (color): error / warn / success - * @param {number} time Timeout to auto hide, ms - */ function tip(tip = "Tip is undefined", main, type, time) { tooltip.innerHTML = tip; tooltip.style.background = "linear-gradient(0.1turn, #ffffff00, #5e5c5c80, #ffffff00)"; diff --git a/modules/ui/hotkeys.js b/modules/ui/hotkeys.js new file mode 100644 index 00000000..e69de29b