diff --git a/main.js b/main.js index 3e820f00..3ab242d7 100644 --- a/main.js +++ b/main.js @@ -11,11 +11,10 @@ const version = "1.4"; // generator version document.title += " v" + version; // Switches to disable/enable logging features -var LOG = 0; -var TIME = 0; -var GROUP = 0; -var WARN = 0; -var ERROR = 0; +const INFO = 0; +const TIME = 0; +const WARN = 1; +const ERROR = 1; // if map version is not stored, clear localStorage and show a message if (rn(localStorage.getItem("version"), 2) !== rn(version, 2)) { @@ -514,7 +513,7 @@ function generate() { const timeStart = performance.now(); invokeActiveZooming(); generateSeed(); - GROUP && console.group("Generated Map " + seed); + INFO && console.group("Generated Map " + seed); applyMapSize(); randomizeOptions(); placePoints(); @@ -557,7 +556,7 @@ function generate() { WARN && console.warn(`TOTAL: ${rn((performance.now()-timeStart)/1000,2)}s`); showStatistics(); - GROUP && console.groupEnd("Generated Map " + seed); + INFO && console.groupEnd("Generated Map " + seed); } catch(error) { ERROR && console.error(error); @@ -1719,7 +1718,7 @@ function showStatistics() { mapId = Date.now(); // unique map id is it's creation date number mapHistory.push({seed, width:graphWidth, height:graphHeight, template, created:mapId}); - LOG && console.log(stats); + INFO && console.log(stats); } const regenerateMap = debounce(function() { diff --git a/modules/save-and-load.js b/modules/save-and-load.js index abc2c3e1..7ee574a5 100644 --- a/modules/save-and-load.js +++ b/modules/save-and-load.js @@ -564,7 +564,7 @@ function parseLoadedData(data) { mapId = params[6] ? +params[6] : Date.now(); }() - GROUP && console.group("Loaded Map " + seed); + INFO && console.group("Loaded Map " + seed); void function parseSettings() { const settings = data[1].split("|"); @@ -1067,7 +1067,7 @@ function parseLoadedData(data) { WARN && console.warn(`TOTAL: ${rn((performance.now()-uploadMap.timeStart)/1000,2)}s`); showStatistics(); - GROUP && console.groupEnd("Loaded Map " + seed); + INFO && console.groupEnd("Loaded Map " + seed); tip("Map is successfully loaded", true, "success", 7000); } catch(error) { diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js index 17061ee3..66fba656 100644 --- a/modules/ui/heightmap-editor.js +++ b/modules/ui/heightmap-editor.js @@ -164,7 +164,7 @@ function editHeightmap() { } function regenerateErasedData() { - GROUP && console.group("Edit Heightmap"); + INFO && console.group("Edit Heightmap"); TIME && console.time("regenerateErasedData"); const change = changeHeights.checked; @@ -205,7 +205,7 @@ function editHeightmap() { addMarkers(); addZones(); TIME && console.timeEnd("regenerateErasedData"); - GROUP && console.groupEnd("Edit Heightmap"); + INFO && console.groupEnd("Edit Heightmap"); } function restoreKeptData() { @@ -216,7 +216,7 @@ function editHeightmap() { } function restoreRiskedData() { - GROUP && console.group("Edit Heightmap"); + INFO && console.group("Edit Heightmap"); TIME && console.time("restoreRiskedData"); // assign pack data to grid cells @@ -402,7 +402,7 @@ function editHeightmap() { }); TIME && console.timeEnd("restoreRiskedData"); - GROUP && console.groupEnd("Edit Heightmap"); + INFO && console.groupEnd("Edit Heightmap"); } // trigger heightmap redraw and history update if at least 1 cell is changed diff --git a/modules/ui/style.js b/modules/ui/style.js index 8c8fc48c..e02393a7 100644 --- a/modules/ui/style.js +++ b/modules/ui/style.js @@ -653,7 +653,7 @@ function setBase64Texture(url) { }; function fetchTextureURL(url) { - LOG && console.log("Provided URL is", url); + INFO && console.log("Provided URL is", url); const img = new Image(); img.onload = function () { const canvas = document.getElementById("texturePreview"); diff --git a/modules/utils.js b/modules/utils.js index f256a15f..352c7b59 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -628,4 +628,4 @@ void function() { }() // indexedDB; ldb object -!function(){function e(t,o){return n?void(n.transaction("s").objectStore("s").get(t).onsuccess=function(e){var t=e.target.result&&e.target.result.v||null;o(t)}):void setTimeout(function(){e(t,o)},100)}var t=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(!t)return void ERROR && console.error("indexedDB not supported");var n,o={k:"",v:""},r=t.open("d2",1);r.onsuccess=function(e){n=this.result},r.onerror=function(e){ERROR && console.error("indexedDB request error"),LOG && console.log(e)},r.onupgradeneeded=function(e){n=null;var t=e.target.result.createObjectStore("s",{keyPath:"k"});t.transaction.oncomplete=function(e){n=e.target.db}},window.ldb={get:e,set:function(e,t){o.k=e,o.v=t,n.transaction("s","readwrite").objectStore("s").put(o)}}}(); \ No newline at end of file +!function(){function e(t,o){return n?void(n.transaction("s").objectStore("s").get(t).onsuccess=function(e){var t=e.target.result&&e.target.result.v||null;o(t)}):void setTimeout(function(){e(t,o)},100)}var t=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB;if(!t)return void ERROR && console.error("indexedDB not supported");var n,o={k:"",v:""},r=t.open("d2",1);r.onsuccess=function(e){n=this.result},r.onerror=function(e){ERROR && console.error("indexedDB request error"),INFO && console.log(e)},r.onupgradeneeded=function(e){n=null;var t=e.target.result.createObjectStore("s",{keyPath:"k"});t.transaction.oncomplete=function(e){n=e.target.db}},window.ldb={get:e,set:function(e,t){o.k=e,o.v=t,n.transaction("s","readwrite").objectStore("s").put(o)}}}(); \ No newline at end of file