mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-06-26 15:18:37 +02:00
Remove console logs, use info and error console logs
This commit is contained in:
parent
14151b639d
commit
a384577050
|
@ -14,7 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
window.addEventListener("error", function (e) {
|
window.addEventListener("error", function (e) {
|
||||||
console.log(e);
|
console.error(e);
|
||||||
let errorMessage = "<p class=\"error\">An error has occurred:</p>";
|
let errorMessage = "<p class=\"error\">An error has occurred:</p>";
|
||||||
errorMessage += "<p class=\"errorBody\">" + e.message + "</p>";
|
errorMessage += "<p class=\"errorBody\">" + e.message + "</p>";
|
||||||
errorMessage += "<p class=\"errorBody\">on line " + e.lineno + "</p>";
|
errorMessage += "<p class=\"errorBody\">on line " + e.lineno + "</p>";
|
||||||
|
|
|
@ -579,7 +579,7 @@ function initPeriodGroups() {
|
||||||
updatePeriodGroups()
|
updatePeriodGroups()
|
||||||
} else if (event.target.textContent === "Paste") {
|
} else if (event.target.textContent === "Paste") {
|
||||||
pathWithPeriods[index][1] = [...periodClipboard.path]
|
pathWithPeriods[index][1] = [...periodClipboard.path]
|
||||||
console.log(pathWithPeriods[index])
|
// console.log(pathWithPeriods[index])
|
||||||
if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2])
|
if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2])
|
||||||
initPeriodGroups()
|
initPeriodGroups()
|
||||||
}
|
}
|
||||||
|
@ -653,9 +653,9 @@ function updatePeriodGroups() {
|
||||||
if (periodClipboard.index !== null) {
|
if (periodClipboard.index !== null) {
|
||||||
if (index !== periodClipboard.index) {
|
if (index !== periodClipboard.index) {
|
||||||
periodCopyEl.textContent = "Paste"
|
periodCopyEl.textContent = "Paste"
|
||||||
console.log(JSON.stringify(pathWithPeriods[index][1]))
|
// console.log(JSON.stringify(pathWithPeriods[index][1]))
|
||||||
console.log(JSON.stringify(periodClipboard.path))
|
// console.log(JSON.stringify(periodClipboard.path))
|
||||||
console.log(JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path))
|
// console.log(JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path))
|
||||||
if (JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path)) {
|
if (JSON.stringify(pathWithPeriods[index][1]) === JSON.stringify(periodClipboard.path)) {
|
||||||
periodCopyEl.disabled = true
|
periodCopyEl.disabled = true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -74,7 +74,7 @@ function initOverlap() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(blank + " blank pixels, which are " + Math.round(blank / 100) / 100 + "% of the canvas (" + (100 - Math.round(blank / 100) / 100) + "% mapped)");
|
console.info(blank + " blank pixels, which are " + Math.round(blank / 100) / 100 + "% of the canvas (" + (100 - Math.round(blank / 100) / 100) + "% mapped)");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ for (const i in areas) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("There are " + largerThanMax + " entries larger than " + max + ", accounting for " + (largerThanMax / areas.length * 100) + "% of all entries.");
|
console.info("There are " + largerThanMax + " entries larger than " + max + ", accounting for " + (largerThanMax / areas.length * 100) + "% of all entries.");
|
||||||
console.log("The largest entry has an area of " + areas[areas.length - 1] + " pixels.");
|
console.info("The largest entry has an area of " + areas[areas.length - 1] + " pixels.");
|
||||||
|
|
||||||
const counts = [0];
|
const counts = [0];
|
||||||
const brackets = [max / steps];
|
const brackets = [max / steps];
|
||||||
|
@ -230,12 +230,12 @@ document.getElementById("wrapper").appendChild(el);
|
||||||
|
|
||||||
//console.log(areas);
|
//console.log(areas);
|
||||||
|
|
||||||
console.log("Median area: " + areas[~~(areas.length / 2)]);
|
console.info("Median area: " + areas[~~(areas.length / 2)]);
|
||||||
|
|
||||||
console.log("Average area: " + (areasSum / atlas.length));
|
console.info("Average area: " + (areasSum / atlas.length));
|
||||||
|
|
||||||
const topCount = 50;
|
const topCount = 50;
|
||||||
console.log("The " + topCount + " largest entries:");
|
console.info("The " + topCount + " largest entries:");
|
||||||
|
|
||||||
let outstring = "";
|
let outstring = "";
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ for (let i = 0; i < topCount; i++) {
|
||||||
outstring += ((i + 1) + "|[" + atlas[atlas.length - i - 1].name + "](http://place-atlas.stefanocoding.me/?id=" + atlas[atlas.length - i - 1].id + ")|" + ~~atlas[atlas.length - i - 1].area + "|" + Math.round(atlas[atlas.length - i - 1].area / 100) / 100 + "%\n");
|
outstring += ((i + 1) + "|[" + atlas[atlas.length - i - 1].name + "](http://place-atlas.stefanocoding.me/?id=" + atlas[atlas.length - i - 1].id + ")|" + ~~atlas[atlas.length - i - 1].area + "|" + Math.round(atlas[atlas.length - i - 1].area / 100) / 100 + "%\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(outstring);
|
console.info(outstring);
|
||||||
|
|
||||||
atlas.sort(function (a, b) {
|
atlas.sort(function (a, b) {
|
||||||
if (a.center[0] < b.center[0]) {
|
if (a.center[0] < b.center[0]) {
|
||||||
|
@ -256,7 +256,7 @@ atlas.sort(function (a, b) {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Median x: " + atlas[~~(atlas.length / 2)].center[0]);
|
console.info("Median x: " + atlas[~~(atlas.length / 2)].center[0]);
|
||||||
|
|
||||||
atlas.sort(function (a, b) {
|
atlas.sort(function (a, b) {
|
||||||
if (a.center[1] < b.center[1]) {
|
if (a.center[1] < b.center[1]) {
|
||||||
|
@ -269,7 +269,7 @@ atlas.sort(function (a, b) {
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("Median y: " + atlas[~~(atlas.length / 2)].center[1]);
|
console.info("Median y: " + atlas[~~(atlas.length / 2)].center[1]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ const dispatchTimeUpdateEvent = (period = timelineSlider.value, atlas = atlas) =
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateBackground(newPeriod = currentPeriod, newVariation = currentVariation) {
|
async function updateBackground(newPeriod = currentPeriod, newVariation = currentVariation) {
|
||||||
console.log(newPeriod, newVariation)
|
// console.log(newPeriod, newVariation)
|
||||||
abortController.abort()
|
abortController.abort()
|
||||||
abortController = new AbortController()
|
abortController = new AbortController()
|
||||||
currentUpdateIndex++
|
currentUpdateIndex++
|
||||||
|
@ -194,11 +194,11 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
|
||||||
imageCache[url] = URL.createObjectURL(imageBlob)
|
imageCache[url] = URL.createObjectURL(imageBlob)
|
||||||
}
|
}
|
||||||
const imageLayer = new Image()
|
const imageLayer = new Image()
|
||||||
console.log(imageCache[url])
|
// console.log(imageCache[url])
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
imageLayer.onload = () => {
|
imageLayer.onload = () => {
|
||||||
context.drawImage(imageLayer, 0, 0)
|
context.drawImage(imageLayer, 0, 0)
|
||||||
console.log("image done")
|
// console.log("image done")
|
||||||
resolve()
|
resolve()
|
||||||
}
|
}
|
||||||
imageLayer.src = imageCache[url]
|
imageLayer.src = imageCache[url]
|
||||||
|
@ -207,7 +207,7 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren
|
||||||
}
|
}
|
||||||
if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation]
|
if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation]
|
||||||
const blob = await new Promise(resolve => canvas.toBlob(resolve))
|
const blob = await new Promise(resolve => canvas.toBlob(resolve))
|
||||||
console.log(URL.createObjectURL(blob))
|
// console.log(URL.createObjectURL(blob))
|
||||||
image.src = URL.createObjectURL(blob)
|
image.src = URL.createObjectURL(blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -574,8 +574,7 @@ async function render() {
|
||||||
context.globalCompositeOperation = "source-over";
|
context.globalCompositeOperation = "source-over";
|
||||||
context.drawImage(overrideImage, startX, startY);
|
context.drawImage(overrideImage, startX, startY);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.log("Cannot override image.");
|
console.error("Cannot override image.", ex);
|
||||||
console.log(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue