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);
}
});
}

View File

@ -1351,8 +1351,8 @@ function update_metadata(meta) {
if (meta.mode && meta.mode != "") {
mode = "Mode: " + meta.mode;
source = meta.source || "";
if (meta.lat && meta.lon) {
source = "<a class=\"openwebrx-maps-pin\" href=\"/map\"></a>" + source;
if (meta.lat && meta.lon && meta.source) {
source = "<a class=\"openwebrx-maps-pin\" href=\"/map?callsign=" + meta.source + "\" target=\"_blank\"></a>" + source;
}
up = meta.up ? "Up: " + meta.up : "";
down = meta.down ? "Down: " + meta.down : "";