1
0
forked from MTSR/mapserver
mapserver/static/js/compat.js

34 lines
643 B
JavaScript
Raw Normal View History

2019-08-30 11:59:55 +03:00
export function hashCompat(){
if (window.location.hash) {
2019-11-30 19:21:30 +03: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 19:33:19 +03:00
// #1799.5/399/10
2019-11-30 19:21:30 +03:00
window.location.hash = `#!/map/0/${parts[0]}/${parts[1]}/${parts[2]}`;
2019-08-30 11:59:55 +03:00
}
2019-11-30 19:21:30 +03:00
if (parts.length == 4) {
2019-11-30 19:33:19 +03:00
// #0/-1799.5/399/10
// #0/5405.875/11148/12
2019-11-30 19:21:30 +03:00
window.location.hash = `#!/map/${parts[0]}/${parts[3]}/${parts[1]}/${parts[2]}`;
2019-08-30 11:59:55 +03:00
}
}
}