Remove console log comments

This commit is contained in:
Hans5958 2022-04-23 20:28:32 +07:00
parent 7543af3d9a
commit 02a6ad3499
5 changed files with 0 additions and 51 deletions

View file

@ -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

View file

@ -14,7 +14,6 @@
*/
function createInfoBlock(entry) {
// console.log(entry)
function createInfoParagraph(name, value) {
const entryParagraphPositionElement = document.createElement("p");
const nameElement = document.createElement("span");

View file

@ -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;

View file

@ -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) {

View file

@ -389,8 +389,6 @@ function buildObjectsList(filter = null, sort = null) {
break;
}
// console.log(sortedAtlas[i])
const element = createInfoBlock(sortedAtlas[i]);
element.entry = sortedAtlas[i];