Add config to prefer numerical IDs

Compat for 2017
This commit is contained in:
Hans5958 2023-04-06 10:18:55 +07:00
parent 63dd4f67e8
commit abbab36445
2 changed files with 8 additions and 1 deletions

View file

@ -245,6 +245,9 @@ const variationsConfig = {
}
window.variationsConfig = variationsConfig
const useNumericalId = false
window.useNumericalId = useNumericalId
console.info(`%cThe 2022 r/place Atlas
%cCopyright (c) 2017 Roland Rytz <roland@draemm.li>
Copyright (c) 2022 Place Atlas contributors

View file

@ -268,6 +268,10 @@ function initDraw() {
center: {},
}
if (useNumericalId) {
if (!isNaN(Number(exportObject.id))) exportObject.id = Number(exportObject.id)
}
const pathWithPeriodsTemp = JSON.parse(JSON.stringify(pathWithPeriods))
for (let i = pathWithPeriodsTemp.length - 1; i > 0; i--) {
@ -518,7 +522,7 @@ function initDraw() {
}
const getEntry = id => {
const entries = atlasAll.filter(entry => entry.id === id)
const entries = atlasAll.filter(entry => entry.id.toString() === id.toString())
if (entries.length === 1) return entries[0]
return {}
}