From ba8a529c9eacf9b2a148090459e05e9f3655f28e Mon Sep 17 00:00:00 2001 From: Azgaar Date: Thu, 1 Jul 2021 23:24:38 +0300 Subject: [PATCH] enter debug mode from localStorage --- main.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 538b1440..c53c5f65 100644 --- a/main.js +++ b/main.js @@ -7,10 +7,11 @@ document.title += " v" + version; // Switches to disable/enable logging features const PRODUCTION = window.location.host; -const INFO = !PRODUCTION; -const TIME = !PRODUCTION; -const WARN = 1; -const ERROR = 1; +const DEBUG = localStorage.getItem("debug"); +const INFO = DEBUG || !PRODUCTION; +const TIME = DEBUG || !PRODUCTION; +const WARN = true; +const ERROR = true; // if map version is not stored, clear localStorage and show a message if (rn(localStorage.getItem("version"), 1) !== rn(version, 1)) { @@ -776,7 +777,7 @@ function markup(cells, start, increment, limit) { } function addLakesInDeepDepressions() { - console.time("addLakesInDeepDepressions"); + TIME && console.time("addLakesInDeepDepressions"); const {cells, features} = grid; const {c, h, b} = cells; const ELEVATION_LIMIT = +document.getElementById("lakeElevationLimitOutput").value; @@ -831,7 +832,7 @@ function addLakesInDeepDepressions() { features.push({i: f, land: false, border: false, type: "lake"}); } - console.timeEnd("addLakesInDeepDepressions"); + TIME && console.timeEnd("addLakesInDeepDepressions"); } // near sea lakes usually get a lot of water inflow, most of them should brake threshold and flow out to sea (see Ancylus Lake)