show selected callsign on the map

This commit is contained in:
Jakob Ketterl
2019-07-06 15:04:39 +02:00
parent 089964a5eb
commit 3f05565b7b
2 changed files with 20 additions and 2 deletions

View File

@ -4,6 +4,18 @@
protocol = 'wss';
}
var query = window.location.search.replace(/^\?/, '').split('&').map(function(v){
var s = v.split('=');
r = {}
r[s[0]] = s.slice(1).join('=')
return r;
}).reduce(function(a, b){
return a.assign(b);
});
var expectedCallsign;
if (query.callsign) expectedCallsign = query.callsign;
var ws_url = protocol + "://" + (window.location.origin.split("://")[1]) + "/ws/";
if (!("WebSocket" in window)) return;
@ -34,6 +46,12 @@
title: update.callsign
});
}
// TODO the trim should happen on the server side
if (expectedCallsign && expectedCallsign == update.callsign.trim()) {
map.panTo(pos);
delete(expectedCallsign);
}
});
}