From 02a6ad3499d6ecf16aa36b1e2823a7ca41f48b18 Mon Sep 17 00:00:00 2001 From: Hans5958 Date: Sat, 23 Apr 2022 20:28:32 +0700 Subject: [PATCH] Remove console log comments --- web/_js/draw.js | 31 ------------------------------- web/_js/infoblock.js | 1 - web/_js/main.js | 1 - web/_js/time.js | 16 ---------------- web/_js/view.js | 2 -- 5 files changed, 51 deletions(-) diff --git a/web/_js/draw.js b/web/_js/draw.js index 7967dca4..48d7c657 100644 --- a/web/_js/draw.js +++ b/web/_js/draw.js @@ -251,10 +251,6 @@ function initDraw() { const pathWithPeriodsTemp = pathWithPeriods.concat() - // console.log(pathWithPeriodsTemp) - - // calculateCenter(path) - for (let i = pathWithPeriodsTemp.length - 1; i > 0; i--) { for (let j = 0; j < i; j++) { if (JSON.stringify(pathWithPeriodsTemp[i][1]) === JSON.stringify(pathWithPeriodsTemp[j][1])) { @@ -485,7 +481,6 @@ function initDraw() { periodsAdd.addEventListener('click', () => { pathWithPeriods.push([defaultPeriod, []]) - // console.log(JSON.stringify(pathWithPeriods)) initPeriodGroups() }) @@ -501,8 +496,6 @@ function initPeriodGroups() { periodGroupElements = [] periodGroups.textContent = '' - // console.log(pathWithPeriods) - pathWithPeriods.forEach(([period, path], index) => { const periodGroupEl = periodGroupTemplate.cloneNode(true) periodGroupEl.id = "periodGroup" + index @@ -516,7 +509,6 @@ function initPeriodGroups() { const periodCopyEl = periodGroupEl.querySelector('.period-copy') const [start, end, variation] = parsePeriod(period) - // console.log(period, start, end, variation) startPeriodEl.id = "periodStart" + index startPeriodEl.previousSibling.for = startPeriodEl.id @@ -534,12 +526,10 @@ function initPeriodGroups() { startPeriodEl.addEventListener('input', event => { timelineSlider.value = parseInt(event.target.value) updateTime(parseInt(event.target.value), variation) - // console.log(parseInt(event.target.value)) }) endPeriodEl.addEventListener('input', event => { timelineSlider.value = parseInt(event.target.value) updateTime(parseInt(event.target.value), variation) - // console.log(parseInt(event.target.value)) }) periodDeleteEl.addEventListener('click', () => { if (pathWithPeriods.length === 1) return @@ -558,7 +548,6 @@ function initPeriodGroups() { endPeriodEl.value = newVariationConfig.default endPeriodEl.max = newVariationConfig.versions.length - 1 updateTime(newVariationConfig.default, newVariation) - // console.log(parseInt(event.target.value)) }) periodCopyEl.addEventListener("click", event => { @@ -575,7 +564,6 @@ function initPeriodGroups() { updatePeriodGroups() } else if (event.target.textContent === "Paste") { pathWithPeriods[index][1] = [...periodClipboard.path] - // console.log(pathWithPeriods[index]) if (pathWithPeriods.length > 2) console.log(pathWithPeriods[2]) initPeriodGroups() } @@ -601,14 +589,12 @@ function initPeriodGroups() { periodCopyEl }) }) - // console.log(periodGroupTemplate) updatePeriodGroups() } function updatePeriodGroups() { - // console.log('updatePeriodGroups') let pathToActive = [] let lastActivePathIndex let currentActivePathIndex @@ -649,9 +635,6 @@ function updatePeriodGroups() { if (periodClipboard.index !== null) { if (index !== periodClipboard.index) { periodCopyEl.textContent = "Paste" - // console.log(JSON.stringify(pathWithPeriods[index][1])) - // console.log(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)) { periodCopyEl.disabled = true } else { @@ -666,19 +649,8 @@ function updatePeriodGroups() { } }) - // console.log('updatePeriodGroups searcher', pathToActive, lastActivePathIndex, currentActivePathIndex, period) - periodsStatus.textContent = "" - // if (currentActivePathIndexes.length > 1) { - // periodsStatus.textContent = "Collision detected! Please resolve it." - // currentActivePathIndexes.forEach(index => { - // periodGroupElements[index].periodGroupEl.dataset.status = "error" - // }) - // currentActivePathIndex = undefined - // } - - // console.log(lastActivePathIndex) if (lastActivePathIndex !== undefined) { if (lastActivePathIndex === currentActivePathIndex) { // just update the path @@ -706,7 +678,6 @@ function updatePeriodGroups() { } } else { - // console.log('direct active', pathToActive) updatePath(pathToActive) } @@ -723,9 +694,7 @@ function formatPeriod(start, end, variation) { } function updatePath(newPath) { - // console.log('updatePath', path, newPath) if (newPath) path = newPath - // console.log('updatePath', path, newPath) if (path.length > 3) center = calculateCenter(path) render(path) undoButton.disabled = path.length == 0; // Maybe make it undo the cancel action in the future diff --git a/web/_js/infoblock.js b/web/_js/infoblock.js index 981f247a..017d8fca 100644 --- a/web/_js/infoblock.js +++ b/web/_js/infoblock.js @@ -14,7 +14,6 @@ */ function createInfoBlock(entry) { - // console.log(entry) function createInfoParagraph(name, value) { const entryParagraphPositionElement = document.createElement("p"); const nameElement = document.createElement("span"); diff --git a/web/_js/main.js b/web/_js/main.js index 859f588f..a254dbbe 100644 --- a/web/_js/main.js +++ b/web/_js/main.js @@ -143,7 +143,6 @@ async function init() { const liveResp = await fetch("https://place-atlas.stefanocoding.me/atlas.json"); let liveJson = await liveResp.json(); liveJson = updateAtlasAll(liveJson) - // console.log(liveJson) const liveAtlasReduced = liveJson.reduce(function (a, c) { a[c.id] = c; diff --git a/web/_js/time.js b/web/_js/time.js index d92c2373..2451e221 100644 --- a/web/_js/time.js +++ b/web/_js/time.js @@ -114,7 +114,6 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren currentUpdateIndex++ const myUpdateIndex = currentUpdateIndex currentPeriod = newPeriod - // console.log(newPeriod, newVariation) const variationConfig = variationsConfig[newVariation] if (currentVariation !== newVariation) { currentVariation = newVariation @@ -156,11 +155,9 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren })) for await (const url of configObject.url) { const imageLayer = new Image() - // console.log(imageCache[url]) await new Promise(resolve => { imageLayer.onload = () => { context.drawImage(imageLayer, 0, 0) - // console.log("image done") resolve() } imageLayer.src = imageCache[url] @@ -169,7 +166,6 @@ async function updateBackground(newPeriod = currentPeriod, newVariation = curren if (currentUpdateIndex !== myUpdateIndex) return [configObject, newPeriod, newVariation] const blob = await new Promise(resolve => canvas.toBlob(resolve)) - // console.log(URL.createObjectURL(blob)) image.src = URL.createObjectURL(blob) } @@ -188,15 +184,11 @@ async function updateTime(newPeriod = currentPeriod, newVariation = currentVaria const validPeriods2 = Object.keys(atlasAll[atlasIndex].path) - // console.log(chosenIndex) - for (const i in validPeriods2) { const validPeriods = validPeriods2[i].split(', ') for (const j in validPeriods) { const [start, end, variation] = parsePeriod(validPeriods[j]) - // console.log(start, end, variation, newPeriod, newVariation) if (isOnPeriod(start, end, variation, newPeriod, newVariation)) { - // console.log("match", start, end, variation, newPeriod, newVariation, i) chosenIndex = i break } @@ -204,25 +196,18 @@ async function updateTime(newPeriod = currentPeriod, newVariation = currentVaria if (chosenIndex !== undefined) break } - // console.log(testMatches) - - // console.log(chosenIndex) if (chosenIndex === undefined) continue pathChosen = Object.values(atlasAll[atlasIndex].path)[chosenIndex] centerChosen = Object.values(atlasAll[atlasIndex].center)[chosenIndex] if (pathChosen === undefined) continue - // console.log(123) - atlas.push({ ...atlasAll[atlasIndex], path: pathChosen, center: centerChosen, }) } - // console.log(atlas) - dispatchTimeUpdateEvent(newPeriod, atlas) document.body.dataset.canvasLoading = false } @@ -247,7 +232,6 @@ function isOnPeriod(start, end, variation, currentPeriod, currentVariation) { } function parsePeriod(periodString) { - // console.log(periodString) let variation = "default" periodString = periodString + "" if (periodString.split(':').length > 1) { diff --git a/web/_js/view.js b/web/_js/view.js index dc69efed..64b0e01a 100644 --- a/web/_js/view.js +++ b/web/_js/view.js @@ -389,8 +389,6 @@ function buildObjectsList(filter = null, sort = null) { break; } - - // console.log(sortedAtlas[i]) const element = createInfoBlock(sortedAtlas[i]); element.entry = sortedAtlas[i];