mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-09-26 12:09:00 +02:00
Handle zzz and 0 prefix on URLs
This commit is contained in:
parent
5df83c25df
commit
ce4439f142
1 changed files with 7 additions and 1 deletions
|
@ -652,7 +652,13 @@ window.addEventListener("hashchange", highlightEntryFromUrl)
|
|||
function highlightEntryFromUrl() {
|
||||
|
||||
const hash = window.location.hash.substring(1); //Remove hash prefix
|
||||
const [id, period] = hash.split('/')
|
||||
let [id, period] = hash.split('/')
|
||||
|
||||
// Handle zzz and 0.. prefix
|
||||
let newId = id.replace(/^zzz([a-z0-9]{7})$/g, "$1").replace(/^0+/, '')
|
||||
if (id !== newId) history.replaceState({}, "", `./#${[newId, period].filter(e => e).join('/')}`)
|
||||
id = newId
|
||||
|
||||
let targetPeriod, targetVariation
|
||||
|
||||
if (period) {
|
||||
|
|
Loading…
Reference in a new issue