diff --git a/.gitignore b/.gitignore
index f91ec08..1708808 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,7 @@
*.swp
*.pyc
*.log
-js/mobile.js
-js/init_plot.js
-js/version.json
-css/mobile.css
-cache.manifest
-tiles/
\ No newline at end of file
+/index.html
+/service-worker.js
+/js/version.json
+tiles/
diff --git a/.htaccess b/.htaccess
deleted file mode 100644
index 3d763d3..0000000
--- a/.htaccess
+++ /dev/null
@@ -1,38 +0,0 @@
-

" +
formatDate(new Date(parseInt(data.time) * 1000), true) + "\n\n" +
@@ -2989,10 +3145,10 @@ var marker_rotate_setup = function(marker, image_src) {
else {
marker.iconImg = new Image();
icon_cache[image_src] = marker.iconImg;
- marker.iconImg.onload = function() {
+ marker.iconImg.addEventListener("load", function() {
if(!marker.rotated) marker.setCourse(90);
marker.setLatLng(marker.getLatLng());
- };
+ })
marker.iconImg.src = image_src;
}
};
@@ -3023,9 +3179,12 @@ function addPosition(position) {
var horizon_circle_title = null;
var subhorizon_circle_title = null;
if(vcallsign.search(/(chase)/i) != -1) {
+ if (offline.get("opt_hide_chase") ){
+ return
+ }
vehicle_type = "car";
color_index = car_index++ % car_colors.length;
- image_src = host_url + markers_url + "car-" + car_colors[color_index] + ".png";
+ image_src = recolorSVG(host_url + markers_url + "car.svg", car_colors[color_index]);
image_src_size = [55,25];
image_src_offset = [0,-25];
@@ -3066,37 +3225,19 @@ function addPosition(position) {
weight: 3,
})
];
- }
- else if(vcallsign == "XX") {
- vehicle_type = "xmark";
- image_src = host_url + markers_url + "balloon-xmark.png";
- image_src_size = [48,38];
- image_src_offset = [0,-38];
-
- xmarkIcon = new L.icon({
- iconUrl: image_src,
- iconSize: image_src_size,
- iconAnchor: [24, 18],
- });
-
- marker = new L.Marker(point, {
- icon: xmarkIcon,
- title: vcallsign,
- zIndexOffset: Z_CAR,
- });
-
- marker.addTo(map);
} else {
vehicle_type = "balloon";
- color_index = balloon_index++ % balloon_colors.length;
+ let colorHash = 0;
+ for (let i = 0; i < vcallsign.length; i++){
+ colorHash += vcallsign.charCodeAt(i);
+ }
+ color_index = colorHash % balloon_colors.length;
if(wvar.nena){
// All the balloon are red.
color_index = 0;
}
-
- image_src = host_url + markers_url + "balloon-" +
- ((vcallsign == "PIE") ? "rpi" : balloon_colors_name[color_index]) + ".png";
+ image_src = recolorSVG(host_url + markers_url + "balloon.svg", balloon_colors[color_index]);
image_src_size = [46,84];
image_src_offset = [-35,-46];
@@ -3141,7 +3282,7 @@ function addPosition(position) {
};
marker.shadow = marker_shadow;
- marker.balloonColor = (vcallsign == "PIE") ? "rpi" : balloon_colors_name[color_index];
+ marker.balloonColor = balloon_colors[color_index];
marker.mode = 'balloon';
marker.setMode = function(mode) {
if(this.mode == mode) return;
@@ -3154,9 +3295,9 @@ function addPosition(position) {
map.removeLayer(vehicle.subhorizon_circle);
map.removeLayer(vehicle.horizon_circle_title);
map.removeLayer(vehicle.subhorizon_circle_title);
-
+ img_src = recolorSVG(host_url + markers_url + "payload.svg", this.balloonColor);
img = new L.icon ({
- iconUrl: host_url + markers_url + "payload-" + this.balloonColor + ".png",
+ iconUrl: img_src,
iconSize: [17,18],
iconAnchor: [8,14],
tooltipAnchor: [0,-20],
@@ -3172,15 +3313,17 @@ function addPosition(position) {
}
if(mode == "parachute") {
+ img_src = recolorSVG(host_url + markers_url + "parachute.svg", this.balloonColor);
img = new L.icon ({
- iconUrl: host_url + markers_url + "parachute-" + this.balloonColor + ".png",
+ iconUrl: img_src,
iconSize: [46,84],
tooltipAnchor: [0,-98],
iconAnchor: [23,90],
});
} else {
+ img_src = recolorSVG(host_url + markers_url + "balloon.svg", this.balloonColor);
img = new L.icon ({
- iconUrl: host_url + markers_url + "balloon-" + this.balloonColor + ".png",
+ iconUrl: img_src,
iconSize: [46,84],
tooltipAnchor: [0,-98],
iconAnchor: [23,90],
@@ -3235,7 +3378,8 @@ function addPosition(position) {
horizon_circle_title = new L.Marker(point, {
icon: horizon_circle_title_icon,
- interactive: false,
+ interactive: true,
+ title: "Line-of-right (radio) horizon of the payload"
});
if (offline.get("opt_hide_horizon")) {
@@ -3267,7 +3411,8 @@ function addPosition(position) {
subhorizon_circle_title = new L.Marker(point, {
icon: subhorizon_circle_title_icon,
- interactive: false,
+ interactive: true,
+ title: "Payload is greater than 5 degrees above the horizon within this circle, which indicates it should be fairly easily receivable."
});
if (offline.get("opt_hide_horizon")) {
@@ -3288,15 +3433,20 @@ function addPosition(position) {
color: balloon_colors[color_index],
opacity: 1,
weight: 3,
+ }),
+ new L.Polyline(point, {
+ color: "#fff",
+ opacity: 0.6,
+ weight: 6,
})
];
}
if (!offline.get("opt_hide_titles")) {
if (vehicle_type == "car") {
- title = marker.bindTooltip(vcallsign, {direction: 'center', permanent: 'true', className: 'serialtooltip'});
+ title = marker.bindTooltip(vcallsign, {direction: 'center', permanent: 'false', className: 'serialtooltip'});
} else {
- title = marker.bindTooltip((tempTitle), {direction: 'center', permanent: 'true', className: 'serialtooltip'});
+ title = marker.bindTooltip((tempTitle), {direction: 'center', permanent: 'false', className: 'serialtooltip'});
}
} else {
title = null;
@@ -3399,11 +3549,13 @@ function addPosition(position) {
vehicle_info.kill = function() {
$(".vehicle"+vehicle_info.uuid).remove();
potentialobjects = [marker, marker_shadow, landing_marker, horizon_circle, horizon_circle_title, subhorizon_circle, subhorizon_circle_title, polyline];
- if (map.hasLayer(vehicle_info["prediction_polyline"])) {
- map.removeLayer(vehicle_info["prediction_polyline"]);
+ if (vehicle_info["prediction_polyline"] && map.hasLayer(vehicle_info["prediction_polyline"][0])) {
+ map.removeLayer(vehicle_info["prediction_polyline"][0]);
+ map.removeLayer(vehicle_info["prediction_polyline"][1]);
}
- if (map.hasLayer(vehicle_info["prediction_launch_polyline"])) {
- map.removeLayer(vehicle_info["prediction_launch_polyline"]);
+ if (vehicle_info["prediction_launch_polyline"] && map.hasLayer(vehicle_info["prediction_launch_polyline"][0])) {
+ map.removeLayer(vehicle_info["prediction_launch_polyline"][0]);
+ map.removeLayer(vehicle_info["prediction_launch_polyline"][1]);
}
if (map.hasLayer(vehicle_info["prediction_target"])) {
map.removeLayer(vehicle_info["prediction_target"]);
@@ -3528,7 +3680,7 @@ function addPosition(position) {
};
// if car doesn't report heading, we calculate it from the last position
- if(vehicle.num_positions > 1 && vehicle.vehicle_type == 'car' && 'gps_heading' in position && position.gps_heading === "") {
+ if(vehicle.num_positions > 1 && vehicle.vehicle_type == 'car') {
// Source
var startLat = toRadians(vehicle.curr_position.gps_lat);
@@ -3883,24 +4035,26 @@ function refresh() {
data: data_str,
dataType: "json",
success: function(data, textStatus) {
- if (wvar.query != null && JSON.stringify(data).indexOf(wvar.query) == -1) {
- refreshSingle(wvar.query);
- } else {
- response = formatData(data, false);
- update(response, true);
- $("#stTimer").attr("data-timestamp", response.fetch_timestamp);
+ var checkLoadedTimer = setInterval(() => {
+ if (map){
+ if (wvar.query != null && JSON.stringify(data).indexOf(wvar.query) == -1) {
+ refreshSingle(wvar.query);
+ } else {
+ response = formatData(data, false);
+ update(response, true);
+ $("#stTimer").attr("data-timestamp", response.fetch_timestamp);
+ }
+ $("#stText").text("");
+ clearInterval(checkLoadedTimer)
}
- $("#stText").text("");
+ }, 50)
},
error: function() {
$("#stText").text("poll error |");
- document.getElementById("timeperiod").disabled = false;
ajax_inprogress = false;
},
complete: function(request, textStatus) {
- if (!ajax_inprogress_single) {
- document.getElementById("timeperiod").disabled = false;
- }
+
clientActive = true;
//console.log("WebSockets - Resuming Websockets updates after poll.")
clearTimeout(periodical);
@@ -3909,6 +4063,7 @@ function refresh() {
});
}
+
live_data_buffer = {positions:{position:[]}}
function liveData() {
client.onConnectionLost = onConnectionLost;
@@ -4052,7 +4207,10 @@ function liveData() {
// Interval to read in the live data buffer and update the page.
setInterval(function(){
- update(live_data_buffer);
+ if(map){
+ update(live_data_buffer);
+ }
+
live_data_buffer.positions.position=[];
}, 500)
@@ -4077,20 +4235,23 @@ function refreshSingle(serial) {
url: data_url,
dataType: "json",
success: function(data, textStatus) {
- response = formatData(data, false);
- update(response, true);
- singleRecovery(serial);
- $("#stText").text("");
+ var checkLoadedTimer = setInterval(() => {
+ if (map){
+ response = formatData(data, false);
+ update(response, true);
+ singleRecovery(serial);
+ $("#stText").text("");
+ clearInterval(checkLoadedTimer);
+ }
+ }, 50)
},
error: function() {
$("#stText").text("error |");
ajax_inprogress_single = false;
- document.getElementById("timeperiod").disabled = false;
},
complete: function(request, textStatus) {
clearTimeout(periodical_focus);
ajax_inprogress_single = false;
- document.getElementById("timeperiod").disabled = false;
}
});
}
@@ -4112,12 +4273,17 @@ function refreshSingleNew(serial) {
ajax_inprogress_single_new = true;
var data_str = "duration=3d&serial=" + serial;
-
+
+ var xhr = new XMLHttpRequest();
+
ajax_positions_single_new = $.ajax({
type: "GET",
url: newdata_url,
data: data_str,
dataType: "json",
+ xhr: function() {
+ return xhr;
+ },
success: function(data, textStatus) {
response = formatData(data, false);
update(response, true);
@@ -4128,6 +4294,20 @@ function refreshSingleNew(serial) {
complete: function(request, textStatus) {
clearTimeout(periodical_focus_new);
ajax_inprogress_single_new = false;
+ // check if we have been redirected for history - if not we can also fetch that if it exists
+ if (xhr.responseURL.includes(newdata_url)){
+ $.ajax({
+ type: "GET",
+ url: "https://sondehub-history.s3.amazonaws.com/serial/"+ encodeURIComponent(serial) +".json.gz",
+ dataType: "json",
+ success: function(data, textStatus) {
+ response = formatData(data, false);
+ update(response, true);
+ },
+ error: function() {
+ }
+ })
+ }
}
});
}
@@ -4167,7 +4347,12 @@ function refreshReceivers() {
data: data_str,
dataType: "json",
success: function(response, textStatus) {
- updateReceivers(response, single=false);
+ var checkLoadedTimer = setInterval(() => {
+ if (map){
+ updateReceivers(response, single=false);
+ clearInterval(checkLoadedTimer);
+ }
+ }, 50);
},
complete: function(request, textStatus) {
if (!offline.get("opt_hide_chase")) {
@@ -4220,7 +4405,9 @@ function singleRecovery(serial) {
data: datastr,
dataType: "json",
success: function(response, textStatus) {
- updateRecoveries(response);
+ if(!offline.get('opt_hide_recoveries')) {
+ updateRecoveries(response, true);
+ }
}
});
@@ -4233,10 +4420,15 @@ function refreshRecoveries() {
url: recovered_sondes_url,
dataType: "json",
success: function(response, textStatus) {
- updateRecoveryPane(response);
- if(!offline.get('opt_hide_recoveries')) {
- updateRecoveries(response);
+ var checkLoadedTimer = setInterval(() => {
+ if (map){
+ updateRecoveryPane(response);
+ if(!offline.get('opt_hide_recoveries')) {
+ updateRecoveries(response);
+ }
+ clearInterval(checkLoadedTimer);
}
+ }, 50);
},
error: function() {
updateRecoveryPane([]);
@@ -4263,45 +4455,6 @@ function refreshRecoveryStats() {
var ajax_predictions = null;
-// function refreshPredictions() {
-// if(ajax_inprogress) {
-// clearTimeout(periodical_predictions);
-// periodical_predictions = setTimeout(refreshPredictions, 1000);
-// return;
-// }
-
-// ajax_predictions = $.ajax({
-// type: "GET",
-// url: predictions_url + encodeURIComponent(wvar.query),
-// data: "",
-// dataType: "json",
-// success: function(response, textStatus) {
-// updatePredictions(response);
-// },
-// error: function() {
-// },
-// complete: function(request, textStatus) {
-// clearTimeout(periodical_predictions);
-// periodical_predictions = setTimeout(refreshPredictions, 60 * 1000);
-// }
-// });
-
-// var data_str = "duration=" + wvar.mode + "&vehicles=" + encodeURIComponent(wvar.query);
-
-// ajax_predictions = $.ajax({
-// type: "GET",
-// url: launch_predictions_url,
-// data: data_str,
-// dataType: "json",
-// success: function(response, textStatus) {
-// updateLaunchPredictions(response);
-// },
-// error: function() {
-// },
-// complete: function(request, textStatus) {
-// }
-// });
-// }
var periodical, periodical_focus, periodical_focus_new, periodical_receivers, periodical_listeners, periodical_recoveries;
var periodical_predictions = null;
@@ -4309,8 +4462,6 @@ var timer_seconds = 5;
function startAjax() {
- document.getElementById("timeperiod").disabled = true;
-
// prevent insane clicks to start numerous requests
clearTimeout(periodical);
clearTimeout(periodical_focus);
@@ -4368,14 +4519,17 @@ function updateCurrentPosition(lat, lon) {
} else {
currentPosition.lat = lat;
currentPosition.lon = lon;
- currentPosition.marker.addTo(map);
- currentPosition.marker.setLatLng(latlng);
+ if (!CHASE_enabled){
+ currentPosition.marker.addTo(map);
+ currentPosition.marker.setLatLng(latlng);
+ }
}
}
function updateReceiverMarker(receiver) {
var latlng = new L.LatLng(receiver.lat, receiver.lon);
+
// init a marker if the receiver doesn't already have one
if(!receiver.marker) {
@@ -4412,8 +4566,10 @@ function updateReceiverMarker(receiver) {
}
receiver.marker.bindPopup(receiver.infobox);
-
- receiverCanvas.addLayer(receiver.marker);
+ if (!offline.get("opt_hide_receivers") ){
+ receiverCanvas.addLayer(receiver.marker);
+ }
+
} else {
receiver.marker.setLatLng(latlng);
receiver.infobox = new L.popup({ autoClose: false, closeOnClick: false }).setContent(receiver.description);
@@ -4453,6 +4609,7 @@ function updateChase(r) {
dataTempEntry.gps_alt = last.uploader_position[2];
dataTempEntry.gps_lat = last.uploader_position[0];
dataTempEntry.gps_lon = last.uploader_position[1];
+ dataTempEntry.gps_heading = 90;
var date = new Date(last.ts)
var userTimezoneOffset = date.getTimezoneOffset() * 60000;
var time = new Date(date.getTime() - userTimezoneOffset).toISOString();
@@ -4586,7 +4743,7 @@ function updateReceivers(r, single) {
i = 0;
for(; i < receivers.length;) {
var e = receivers[i];
- if(e.fresh) {
+ if(e.fresh && !offline.get("opt_hide_receivers")) {
e.fresh = false;
i++;
}
@@ -4615,6 +4772,13 @@ function updateRecoveryMarker(recovery) {
_recovery_icon = host_url + markers_url + "payload-not-recovered.png";
}
+ // Override icon if 'is planned' field exists and is true
+ if(recovery.hasOwnProperty('planned')){
+ if(recovery.planned == true){
+ _recovery_icon = host_url + markers_url + "payload-recovery-planned.png";
+ }
+ }
+
recoveryIcon = new L.icon({
iconUrl: _recovery_icon,
iconSize: [17, 19],
@@ -4634,23 +4798,36 @@ function updateRecoveryMarker(recovery) {
div = document.createElement('div');
+ _recovered_text = recovery.recovered ? " Recovered" : " Not Recovered";
+
+ // Override text is planned field exists and is true
+ if(recovery.hasOwnProperty('planned')){
+ if(recovery.planned == true){
+ _recovered_text = " Recovery Planned";
+ }
+ }
+
html = "";
- html += ""+recovery.serial+(recovery.recovered ? " Recovered" : " Not Recovered")+"";
+ html += "";
html += "
";
- html += " "+roundNumber(recovery.lat, 5) + ', ' + roundNumber(recovery.lon, 5)+"";
+ html += " "+format_coordinates(recovery.lat, recovery.lon, recovery.serial)+"";
- var imp = offline.get('opt_imperial');
- var text_alt = Number((imp) ? Math.floor(3.2808399 * parseInt(recovery.alt)) : parseInt(recovery.alt)).toLocaleString("us");
- text_alt += " " + ((imp) ? 'ft':'m');
-
- html += "Time: "+formatDate(stringToDateUTC(recovery.datetime))+"";
- html += "Reported by: "+recovery.recovered_by+"";
- html += "Notes: "+$('').text(recovery.description).html()+"";
- html += "Flight Path: "+recovery.serial+"";
+ html += "Time: ";
+ html += "Reported by: ";
+ html += "Notes: ";
+ html += "";
html += "";
div.innerHTML = html;
+ div.getElementsByClassName("recovery_text")[0].textContent = recovery.serial+_recovered_text
+ div.getElementsByClassName("recovery_time")[0].textContent = formatDate(stringToDateUTC(recovery.datetime))
+ div.getElementsByClassName("recovery_by")[0].textContent = recovery.recovered_by
+ div.getElementsByClassName("recovery_desc")[0].textContent = recovery.description
+ div.getElementsByClassName("recovery_path")[0].textContent = recovery.serial
+ div.getElementsByClassName("recovery_path")[0].onclick = function(){
+ showRecoveredMap(recovery.serial)
+ }
recovery.infobox.setContent(div);
@@ -4659,8 +4836,7 @@ function updateRecoveryMarker(recovery) {
}
}
- function updateRecoveries(r) {
-
+ function updateRecoveries(r, single=false) {
if(!r) return;
ls_recoveries = true;
@@ -4669,41 +4845,39 @@ function updateRecoveryMarker(recovery) {
var i = 0, ii = r.length;
for(; i < ii; i++) {
- var date = Date.parse(r[i].datetime);
- if (((dateNow - date) / 86400000) < 3) {
- var lat = parseFloat(r[i].lat);
- var lon = parseFloat(r[i].lon);
-
- if(lat < -90 || lat > 90 || lon < -180 || lon > 180) continue;
-
- var r_index = $.inArray(r[i].serial, recovery_names);
-
- if(r_index == -1) {
- recovery_names.push(r[i].serial);
- r_index = recovery_names.length - 1;
- recoveries[r_index] = {marker: null, infobox: null};
- }
-
- var recovery = recoveries[r_index];
- recovery.serial = r[i].serial;
- recovery.lat = lat;
- recovery.lon = lon;
- recovery.recovered_by = r[i].recovered_by;
- recovery.alt = parseFloat(r[i].alt);
- recovery.recovered = r[i].recovered;
- recovery.description = r[i].description;
- recovery.datetime = r[i].datetime;
- recovery.fresh = true;
-
- updateRecoveryMarker(recovery);
- }
+ var lat = parseFloat(r[i].lat);
+ var lon = parseFloat(r[i].lon);
+
+ if(lat < -90 || lat > 90 || lon < -180 || lon > 180) continue;
+
+ var r_index = $.inArray(r[i].serial, recovery_names);
+
+ if(r_index == -1) {
+ recovery_names.push(r[i].serial);
+ r_index = recovery_names.length - 1;
+ recoveries[r_index] = {marker: null, infobox: null};
+ }
+
+ var recovery = recoveries[r_index];
+ recovery.serial = r[i].serial;
+ recovery.lat = lat;
+ recovery.lon = lon;
+ recovery.recovered_by = r[i].recovered_by;
+ recovery.alt = parseFloat(r[i].alt);
+ recovery.recovered = r[i].recovered;
+ recovery.description = r[i].description;
+ recovery.datetime = r[i].datetime;
+ recovery.planned = r[i].planned;
+ recovery.fresh = true;
+ updateRecoveryMarker(recovery);
+
}
// clear old recovery markers
i = 0;
for(; i < recoveries.length;) {
var e = recoveries[i];
- if(e.fresh) {
+ if(e.fresh || single) {
e.fresh = false;
i++;
}
@@ -4747,9 +4921,18 @@ function updateRecoveryPane(r){
recoveries[r_index] = {marker: null, infobox: null};
}
+ _recovered_text = r[i].recovered ? " Recovered by " : " Not Recovered by ";
+
+ // Override text is planned field exists and is true
+ if(r[i].hasOwnProperty('planned')){
+ if(r[i].planned == true){
+ _recovered_text = " Recovery Planned by ";
+ }
+ }
+
html += "";
- html += ""+r[i].serial+(r[i].recovered ? " Recovered by " : " Not Recovered by ")+r[i].recovered_by+"";
- html += " "+roundNumber(lat, 5) + ', ' + roundNumber(lon, 5)+"";
+ html += ""+r[i].serial+(_recovered_text)+r[i].recovered_by+"";
+ html += " "+format_coordinates(lat, lon, r[i].serial)+"";
var imp = offline.get('opt_imperial');
var text_alt = Number((imp) ? Math.floor(3.2808399 * parseInt(alt)) : parseInt(alt)).toLocaleString("us");
@@ -4831,23 +5014,26 @@ function updatePredictions(r) {
if(vcallsign == "XX") continue;
if(vehicles.hasOwnProperty(vcallsign)) {
- var vehicle = vehicles[vcallsign];
-
- if(vehicle.marker.mode == "landed") {
- removePrediction(vcallsign);
- continue;
+ var vehicle = vehicles[vcallsign];
+ if(vehicle.prediction && vehicle.prediction.time == r[i].time) continue;
+ vehicle.prediction = r[i];
+ vehicle.prediction.data = $.parseJSON(r[i].data);
+
+ // Figure out local ground level.
+ if(vehicle.prediction.data.length >= 2){
+ vehicle.local_ground_asl = vehicle.prediction.data[vehicle.prediction.data.length-1]['alt'];
+ } else {
+ vehicle.local_ground_asl = 0;
}
- if(vehicle.prediction && vehicle.prediction.time == r[i].time) {
- continue;
- }
- vehicle.prediction = r[i];
- if(parseInt(vehicle.prediction.landed) === 0) {
- vehicle.prediction.data = $.parseJSON(r[i].data);
+ // Only draw prediction if the last known position of the payload was > 100m above local ground level.
+ if( (vehicle.curr_position['gps_alt']-vehicle.local_ground_asl) > 100){
redrawPrediction(vcallsign);
} else {
- removePrediction(vcallsign);
+ continue;
}
+
+
}
}
}
@@ -4876,6 +5062,8 @@ function showHorizonRings(){
if(vehicles[vcallsign].vehicle_type == "balloon"){
map.addLayer(vehicles[vcallsign].horizon_circle);
map.addLayer(vehicles[vcallsign].subhorizon_circle);
+ vehicles[vcallsign].horizon_circle.fire("move")
+ vehicles[vcallsign].subhorizon_circle.fire("move")
map.addLayer(vehicles[vcallsign].horizon_circle_title);
map.addLayer(vehicles[vcallsign].subhorizon_circle_title);
}
@@ -4893,7 +5081,7 @@ function hideTitles(){
function showTitles(){
for(var vcallsign in vehicles) {
if(vehicles[vcallsign].vehicle_type == "balloon" || vehicles[vcallsign].vehicle_type == "car"){
- vehicles[vcallsign].title = vehicles[vcallsign].marker.bindTooltip(vehicles[vcallsign]["marker"]["options"]["title"], {direction: 'center', permanent: 'true', className: 'serialtooltip'});
+ vehicles[vcallsign].title = vehicles[vcallsign].marker.bindTooltip(vehicles[vcallsign]["marker"]["options"]["title"], {direction: 'center', permanent: 'false', className: 'serialtooltip'});
}
}
}
@@ -5013,7 +5201,7 @@ function update(response, none) {
},
};
-
+ document.getElementById("spinner")?.remove();
ctx_init.run(ctx_init);
sub_to_nearby_sondes();
}
diff --git a/js/station.js b/js/station.js
index 09cade0..6ad8857 100644
--- a/js/station.js
+++ b/js/station.js
@@ -174,12 +174,22 @@ function drawHistorical (data, station) {
}
}
- var popup = L.popup();
+ var popup = new L.popup({ autoClose: false, closeOnClick: false }).setContent(serial);
+
+ if (!recovered) {
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "white", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
+ } else {
+ var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "grey", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
+ }
+
+ marker.bindPopup(popup);
+
+ div = document.createElement('div');
html = "";
html += ""+serial+" ("+time+")";
html += "
";
- html += " "+roundNumber(landing.lat, 5) + ', ' + roundNumber(landing.lon, 5)+"";
+ html += "Last Position: "+format_coordinates(landing.lat, landing.lon, serial)+"";
var imp = offline.get('opt_imperial');
var text_alt = Number((imp) ? Math.floor(3.2808399 * parseInt(landing.alt)) : parseInt(landing.alt)).toLocaleString("us");
@@ -187,40 +197,60 @@ function drawHistorical (data, station) {
html += "Altitude: "+text_alt+"";
html += "Time: "+formatDate(stringToDateUTC(time))+"";
-
- if (landing.hasOwnProperty("type")) {
- html += "Sonde Type: " + landing.type + "";
- };
+ html += "Sonde Type: Unknown"
html += "
";
- if (recovered) {
- html += ""+(recovery_info.recovered ? "Recovered by " : "Not Recovered by ")+recovery_info.recovered_by+"";
- html += "Recovery time: "+formatDate(stringToDateUTC(recovery_info.datetime))+"";
- html += "Recovery location: "+recovery_info.position[1]+", "+recovery_info.position[0] + "";
- html += "Recovery notes: "+recovery_info.description+"";
-
- html += "
";
- }
+ html += "";
+ html += "";
+ html += "Reported at: ";
+ html += "Reported by: ";
+ html += "Notes: ";
+ html += "
";
+ html += "";
- html += "Show Full Flight Path: " + serial + "";
+ html += "";
html += "
";
html += ""
+ html += ""
+ html += "";
- if (landing.hasOwnProperty("uploader_callsign")) {
- html += "Last received by: " + landing.uploader_callsign.toLowerCase() + "";
+ div.innerHTML = html;
+
+
+ div.getElementsByClassName("recovery_path")[0].textContent = serial
+ div.getElementsByClassName("recovery_path")[0].onclick = function(){
+ showRecoveredMap(serial)
+ }
+
+ if (landing.hasOwnProperty("type")) {
+ div.getElementsByClassName("landing_sonde_type")[0].textContent = landing.type;
};
- popup.setContent(html);
+ if (landing.hasOwnProperty("uploader_callsign")) {
+ div.getElementsByClassName("landing_uploader_callsign")[0].textContent = "Last received by: " + landing.uploader_callsign.toLowerCase();
+ };
- if (!recovered) {
- var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "white", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
+ if (recovered) {
+ _recovered_text = recovery_info.recovered ? " Recovered" : "Not Recovered";
+
+ // Override text is planned field exists and is true
+ if(recovery_info.hasOwnProperty('planned')){
+ if(recovery_info.planned == true){
+ _recovered_text = " Recovery Planned";
+ }
+ }
+ div.getElementsByClassName("recovery_text")[0].textContent = recovery_info.serial + _recovered_text;
+ div.getElementsByClassName("recovery_time")[0].textContent = formatDate(stringToDateUTC(recovery_info.datetime));
+ div.getElementsByClassName("recovery_by")[0].textContent = recovery_info.recovered_by;
+ div.getElementsByClassName("recovery_desc")[0].textContent = recovery_info.description;
} else {
- var marker = L.circleMarker([landing.lat, landing.lon], {fillColor: "grey", color: iconColour, weight: 3, radius: 5, fillOpacity:1});
+ div.getElementsByClassName("recovery_section")[0].style.display = "none";
}
- marker.bindPopup(popup);
+ popup.setContent(div);
+
marker.addTo(map);
marker.bringToBack();
@@ -602,26 +632,26 @@ function launchSitePredictions(times, station, properties, marker, id) {
var date = new Date();
var time = times[i].split(":");
if (time[0] != 0) {
- date.setDate(date.getDate() + (7 + time[0] - date.getDay()) % 7);
+ date.setUTCDate(date.getUTCDate() + (7 + time[0] - date.getUTCDay()) % 7);
}
date.setUTCHours(time[1]);
date.setUTCMinutes(time[2]);
- date.setSeconds(0);
- date.setMilliseconds(0);
+ date.setUTCSeconds(0);
+ date.setUTCMilliseconds(0);
// launch time 45 minutes before target time
- date.setMinutes( date.getMinutes() - 45 );
+ date.setUTCMinutes( date.getUTCMinutes() - 45 );
while (date < now) {
if (time[0] == 0) {
- date.setDate(date.getDate() + 1);
+ date.setUTCDate(date.getUTCDate() + 1);
} else {
- date.setDate(date.getDate() + 7);
+ date.setUTCDate(date.getUTCDate() + 7);
}
}
if (day > 0) {
if (time[0] == 0) {
- date.setDate(date.getDate() + day);
+ date.setUTCDate(date.getUTCDate() + day);
} else {
- date.setDate(date.getDate() + (7*day));
+ date.setUTCDate(date.getUTCDate() + (7*day));
}
}
if (count < maxCount) {
@@ -738,15 +768,24 @@ function plotPrediction (data, dates, marker, properties) {
icon: new L.NumberedDivIcon({number: dates.indexOf(data.request.launch_datetime)+1})
}).addTo(map);
+ var coords_text = format_coordinates(landingPoint.latitude, landingLongitude, "Prediction");
+
var landingTime = new Date(landingPoint.datetime);
if (properties[3] != "" && properties[4] != "") {
var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset +
+ "
Prediction: " + coords_text +
"
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude (" + properties[3] + " samples)
- " + data.request.descent_rate + "m/s descent (" + properties[4] + " samples)";
} else {
var landingTooltip = "Time: " + landingTime.toLocaleString() + "
Model Dataset: " + data.request.dataset +
+ "
Prediction:" + coords_text +
"
Model Assumptions:
- " + data.request.ascent_rate + "m/s ascent
- " + data.request.burst_altitude + "m burst altitude
- " + data.request.descent_rate + "m/s descent";
}
- plot.landingMarker.bindTooltip(landingTooltip, {offset: [13,-28]});
+
+ plot.landingMarker.bindPopup(landingTooltip, { autoClose: false, closeOnClick: false })
+ .on('click', function (e) {
+ this.openPopup();
+ });
+
}
function showPrediction(url) {
@@ -917,6 +956,7 @@ function generateLaunchSites() {
}
popupContent += "
Know when this site launches? Contribute here";
+ popupContent += "
Site Code: " + key;
// Generate view historical button
popupContent += "
";
diff --git a/service-worker.js b/service-worker.js
deleted file mode 100644
index fc7d456..0000000
--- a/service-worker.js
+++ /dev/null
@@ -1,73 +0,0 @@
-self.addEventListener('install', function(event) {
- event.waitUntil(
- caches.open("{VER}").then(function(cache) {
- return cache.addAll(
- [
- '/css/mobile.css',
- '/css/leaflet.css',
- '/css/leaflet.fullscreen.css',
- '/js/leaflet.js',
- '/js/Leaflet.fullscreen.min.js',
- '/js/L.Terminator.js',
- '/js/mobile.js',
- '/js/rbush.js',
- '/js/leaflet.canvas-markers.js',
- '/js/pwa.js',
- '/js/init_plot.js',
- '/img/markers/antenna-green.png',
- '/img/markers/balloon-blue.png',
- '/img/markers/balloon-cyan.png',
- '/img/markers/balloon-green.png',
- '/img/markers/balloon-orange.png',
- '/img/markers/balloon-purple.png',
- '/img/markers/balloon-red.png',
- '/img/markers/balloon-yellow.png',
- '/img/markers/car-blue.png',
- '/img/markers/car-green.png',
- '/img/markers/car-red.png',
- '/img/markers/car-yellow.png',
- '/img/markers/parachute-yellow.png',
- '/img/markers/parachute-blue.png',
- '/img/markers/parachute-cyan.png',
- '/img/markers/parachute-green.png',
- '/img/markers/parachute-orange.png',
- '/img/markers/parachute-purple.png',
- '/img/markers/parachute-red.png',
- '/img/markers/payload-blue.png',
- '/img/markers/payload-cyan.png',
- '/img/markers/payload-green.png',
- '/img/markers/payload-not-recovered.png',
- '/img/markers/payload-orange.png',
- '/img/markers/payload-purple.png',
- '/img/markers/payload-recovered.png',
- '/img/markers/payload-red.png',
- '/img/markers/payload-yellow.png',
- '/img/markers/target-blue.png',
- '/img/markers/target-cyan.png',
- '/img/markers/target-green.png',
- '/img/markers/target-orange.png',
- '/img/markers/target-purple.png',
- '/img/markers/target-red.png',
- '/img/markers/target-yellow.png',
- '/img/markers/shadow.png',
- '/img/markers/balloon-pop.png',
- '/img/hab-spinner.gif',
- '/img/marker-you.gif',
- '/img/sondehub_logo.gif',
- '/favicon.ico',
- '/font/HabitatFont.woff',
- '/font/Roboto-regular.woff',
- '/index.html'
- ]
- );
- })
- );
-});
-
-self.addEventListener('fetch', function (event) {
- event.respondWith(
- caches.match(event.request).then(function (response) {
- return response || fetch(event.request);
- }),
- );
-});
\ No newline at end of file
diff --git a/service-worker.template.js b/service-worker.template.js
new file mode 100644
index 0000000..82e6ce6
--- /dev/null
+++ b/service-worker.template.js
@@ -0,0 +1,62 @@
+self.addEventListener('install', function(event) {
+ event.waitUntil(
+ caches.open("{VER}").then(function(cache) {
+ return cache.addAll(
+ [
+ '/css/base.css',
+ '/css/skeleton.css',
+ '/css/layout.css',
+ '/css/habitat-font.css',
+ '/css/main.css',
+ '/css/leaflet.css',
+ '/css/leaflet.fullscreen.css',
+ '/css/skewt.css',
+ '/js/skewt.js',
+ '/js/aws-sdk-2.1029.0.min.js',
+ '/js/leaflet.js',
+ '/js/Leaflet.fullscreen.min.js',
+ '/js/L.Terminator.js',
+ '/js/L.TileLayer.NoGap.js',
+ '/js/paho-mqtt.js',
+ '/js/jquery-1.12.4-min.js',
+ '/js/iscroll.js',
+ '/js/chasecar.lib.js',
+ '/js/sondehub.js',
+ '/js/app.js',
+ '/js/colour-map.js',
+ '/js/xdata.js',
+ '/js/station.js',
+ '/js/format.js',
+ '/js/rbush.js',
+ '/js/pwa.js',
+ '/js/_jquery.flot.js',
+ '/js/plot_config.js',
+ '/img/markers/balloon.svg',
+ '/img/markers/car.svg',
+ '/img/markers/parachute.svg',
+ '/img/markers/payload.svg',
+ '/img/markers/payload-not-recovered.png',
+ '/img/markers/payload-recovered.png',
+ '/img/markers/target.svg',
+ '/img/markers/shadow.png',
+ '/img/markers/balloon-pop.png',
+ '/img/hab-spinner.gif',
+ '/img/sondehub_au.png',
+ '/favicon.ico',
+ '/font/HabitatFont.woff',
+ '/font/Roboto-regular.woff',
+ '/index.html',
+ '/'
+ ]
+ );
+ })
+ );
+});
+
+self.addEventListener('fetch', function (event) {
+ event.respondWith(
+ caches.match(event.request).then(function (response) {
+ return response || fetch(event.request);
+ }),
+ );
+});
\ No newline at end of file
diff --git a/tools/pngout.exe b/tools/pngout.exe
deleted file mode 100755
index c72d567..0000000
Binary files a/tools/pngout.exe and /dev/null differ
diff --git a/tools/yuicompressor-2.4.8.jar b/tools/yuicompressor-2.4.8.jar
deleted file mode 100755
index a1cf0a0..0000000
Binary files a/tools/yuicompressor-2.4.8.jar and /dev/null differ