mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Highlight wanted calls. Closes #117
This commit is contained in:
+34
-27
@@ -46,34 +46,35 @@ function loadSpots() {
|
||||
// data if they can.
|
||||
$.ajax({
|
||||
url: '/api/v2/spots' + buildQueryString(), dataType: 'json', success: function (jsonData) {
|
||||
// Store data
|
||||
spots = jsonData;
|
||||
// Update map
|
||||
updateMap();
|
||||
if ($("#showTerminator")[0].checked) {
|
||||
terminator.setTime();
|
||||
// Store data
|
||||
spots = jsonData;
|
||||
// Update map
|
||||
updateMap();
|
||||
if ($("#showTerminator")[0].checked) {
|
||||
terminator.setTime();
|
||||
}
|
||||
// Check if we have any credentials to use
|
||||
if (Object.keys(getCredentialHeaders()).length > 0) {
|
||||
// OK, we have credentials and have loaded once without them so the user has a basic map. Now reload
|
||||
// with the credentials and replace what's on the map, so we can improve the data.
|
||||
$.ajax({
|
||||
url: '/api/v2/spots' + buildQueryString(),
|
||||
dataType: 'json',
|
||||
headers: getCredentialHeaders(),
|
||||
success: function (jsonData2) {
|
||||
spots = jsonData2;
|
||||
updateMap();
|
||||
// Now start the ongoing SSE connection
|
||||
startSSEConnection();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// We had no credentials with which to augment the data anyway, so just start the SSE connection
|
||||
// now
|
||||
startSSEConnection();
|
||||
}
|
||||
}
|
||||
// Check if we have any credentials to use
|
||||
if (Object.keys(getCredentialHeaders()).length > 0) {
|
||||
// OK, we have credentials and have loaded once without them so the user has a basic map. Now reload
|
||||
// with the credentials and replace what's on the map, so we can improve the data.
|
||||
$.ajax({
|
||||
url: '/api/v2/spots' + buildQueryString(),
|
||||
dataType: 'json',
|
||||
headers: getCredentialHeaders(),
|
||||
success: function(jsonData2) {
|
||||
spots = jsonData2;
|
||||
updateMap();
|
||||
// Now start the ongoing SSE connection
|
||||
startSSEConnection();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// We had no credentials with which to augment the data anyway, so just start the SSE connection
|
||||
// now
|
||||
startSSEConnection();
|
||||
}
|
||||
}});
|
||||
});
|
||||
}
|
||||
|
||||
// Start the SSE connection to receive new spots as they arrive
|
||||
@@ -143,6 +144,12 @@ function addSpotToMap(s) {
|
||||
markersLayer.addLayer(m);
|
||||
oms.addMarker(m);
|
||||
|
||||
// Add highlight for wanted spots
|
||||
if (callWanted(s["dx_call"])) {
|
||||
console.log(s["dx_call"]);
|
||||
$(m._icon).addClass('marker-icon-wanted');
|
||||
}
|
||||
|
||||
let geodesic = null;
|
||||
if ($("#mapShowGeodesics")[0].checked && s["de_latitude"] != null && s["de_longitude"] != null) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user