forked from MTSR/mapserver
34 lines
643 B
JavaScript
34 lines
643 B
JavaScript
|
|
export function hashCompat(){
|
|
|
|
if (window.location.hash) {
|
|
|
|
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){
|
|
// #1799.5/399/10
|
|
window.location.hash = `#!/map/0/${parts[2]}/${parts[0]}/${parts[1]}`;
|
|
}
|
|
|
|
if (parts.length == 4) {
|
|
// #0/-1799.5/399/10
|
|
// #0/5405.875/11148/12
|
|
window.location.hash = `#!/map/${parts[0]}/${parts[3]}/${parts[1]}/${parts[2]}`;
|
|
}
|
|
}
|
|
}
|