2019-08-30 10:59:55 +02:00
|
|
|
|
|
|
|
export function hashCompat(){
|
|
|
|
|
|
|
|
if (window.location.hash) {
|
2019-11-30 17:21:30 +01:00
|
|
|
|
|
|
|
const parts = window.location.hash.replace("#", "").split("/");
|
|
|
|
if (parts.length == 0){
|
|
|
|
//invalid
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parts[0] == "map"){
|
|
|
|
//new link
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isNaN(+parts[0])){
|
|
|
|
//NaN
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (parts.length == 3){
|
2019-11-30 17:33:19 +01:00
|
|
|
// #1799.5/399/10
|
2019-12-07 15:40:25 +01:00
|
|
|
window.location.hash = `#!/map/0/${parts[2]}/${parts[0]}/${parts[1]}`;
|
2019-08-30 10:59:55 +02:00
|
|
|
}
|
|
|
|
|
2019-11-30 17:21:30 +01:00
|
|
|
if (parts.length == 4) {
|
2019-11-30 17:33:19 +01:00
|
|
|
// #0/-1799.5/399/10
|
|
|
|
// #0/5405.875/11148/12
|
2019-11-30 17:21:30 +01:00
|
|
|
window.location.hash = `#!/map/${parts[0]}/${parts[3]}/${parts[1]}/${parts[2]}`;
|
2019-08-30 10:59:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|