diff --git a/css/layout.css b/css/layout.css
index 2b915f2..8ebfd8f 100644
--- a/css/layout.css
+++ b/css/layout.css
@@ -179,4 +179,20 @@ header h1{
padding: 10px;
border-width: 1px;
display: none;
+}
+
+#banner {
+ display: none
+}
+@media only screen and (min-width: 768px){
+ #banner {
+ line-height: 1.1;
+ font-size: small;
+ display: block;
+ margin-left: 300px;
+ text-align: center;
+ overflow-y: auto;
+ font-weight: bold;
+ height: 100%;
+ }
}
\ No newline at end of file
diff --git a/img/markers/payload-recovery-planned.png b/img/markers/payload-recovery-planned.png
new file mode 100644
index 0000000..e314714
Binary files /dev/null and b/img/markers/payload-recovery-planned.png differ
diff --git a/index.template.html b/index.template.html
index 22c8048..964bc91 100644
--- a/index.template.html
+++ b/index.template.html
@@ -9,6 +9,7 @@
+
@@ -83,6 +84,7 @@
no
location
+
@@ -408,7 +410,7 @@
Chase Mode
Zoom in for realtime data!
-
+
Please report recovered sondes!
diff --git a/js/app.js b/js/app.js
index 7ab00d6..2731e23 100644
--- a/js/app.js
+++ b/js/app.js
@@ -128,6 +128,7 @@ function load_hash(no_refresh) {
}
break;
case "f":
+ v = v.toUpperCase();
refocus = (follow_vehicle != v);
follow_vehicle = v;
def.focus = v;
@@ -137,6 +138,7 @@ function load_hash(no_refresh) {
if(modeList.indexOf(def.mode) == -1) def.mode = (is_mobile) ? modeDefaultMobile : modeDefault;
break;
case "q":
+ v = v.toUpperCase();
def.query = v;
$("header .search input[type='text']").val(v);
break;
@@ -337,8 +339,7 @@ function positionUpdateError(error) {
switch(error.code)
{
case error.PERMISSION_DENIED:
- alert("no permission to use your location");
- $('#sw_chasecar').click(); // turn off chase car
+ $('#sw_chasecar').removeClass('on').addClass('off');
break;
default:
break;
@@ -353,89 +354,83 @@ var positionUpdateHandle = function(position) {
}
}
- //navigator.geolocation.getCurrentPosition(function(position) {
- var lat = position.coords.latitude;
- var lon = position.coords.longitude;
- var alt = (position.coords.altitude) ? position.coords.altitude : 0;
- var accuracy = (position.coords.accuracy) ? position.coords.accuracy : 0;
- var speed = (position.coords.speed) ? position.coords.speed : 0;
-
- // constantly update 'last updated' field, and display friendly time since last update
- if(!GPS_ts) {
- GPS_ts = parseInt(position.timestamp/1000);
-
- setInterval(function() {
- var delta_ts = parseInt(Date.now()/1000) - GPS_ts;
-
- // generate friendly timestamp
- var hours = Math.floor(delta_ts / 3600);
- var minutes = Math.floor(delta_ts / 60) % 60;
- var ts_str = (delta_ts >= 60) ?
- ((hours)?hours+'h ':'') +
- ((minutes)?minutes+'m':'') +
- ' ago'
- : 'just now';
- $('#cc_timestamp').text(ts_str);
- }, 30000);
-
- $('#cc_timestamp').text('just now');
- }
+ var lat = position.coords.latitude;
+ var lon = position.coords.longitude;
+ var alt = (position.coords.altitude) ? position.coords.altitude : 0;
+ var accuracy = (position.coords.accuracy) ? position.coords.accuracy : 0;
+ var speed = (position.coords.speed) ? position.coords.speed : 0;
+
+ // constantly update 'last updated' field, and display friendly time since last update
+ if(!GPS_ts) {
+ GPS_ts = parseInt(position.timestamp/1000);
+
+ setInterval(function() {
+ var delta_ts = parseInt(Date.now()/1000) - GPS_ts;
+
+ // generate friendly timestamp
+ var hours = Math.floor(delta_ts / 3600);
+ var minutes = Math.floor(delta_ts / 60) % 60;
+ var ts_str = (delta_ts >= 60) ?
+ ((hours)?hours+'h ':'') +
+ ((minutes)?minutes+'m':'') +
+ ' ago'
+ : 'just now';
+ $('#cc_timestamp').text(ts_str);
+ }, 30000);
+
+ $('#cc_timestamp').text('just now');
+ }
- // save position and update only if different is available
- if(CHASE_timer < (new Date()).getTime() &&
- (
- GPS_lat != lat ||
- GPS_lon != lon ||
- GPS_alt != alt ||
- GPS_speed != speed
- )
+ // save position and update only if different is available
+ if(CHASE_timer < (new Date()).getTime() &&
+ (
+ GPS_lat != lat ||
+ GPS_lon != lon ||
+ GPS_alt != alt ||
+ GPS_speed != speed
)
- {
- GPS_lat = lat;
- GPS_lon = lon;
- GPS_alt = alt;
- GPS_speed = speed;
- GPS_ts = parseInt(position.timestamp/1000);
- $('#cc_timestamp').text('just now');
-
- // update look angles once we get position
- if(follow_vehicle !== null && vehicles[follow_vehicle] !== undefined) {
- update_lookangles(follow_vehicle);
- }
+ )
+ {
+ GPS_lat = lat;
+ GPS_lon = lon;
+ GPS_alt = alt;
+ GPS_speed = speed;
+ GPS_ts = parseInt(position.timestamp/1000);
+ $('#cc_timestamp').text('just now');
+
+ // update look angles once we get position
+ if(follow_vehicle !== null && vehicles[follow_vehicle] !== undefined) {
+ update_lookangles(follow_vehicle);
+ }
- if(CHASE_enabled) {
- ChaseCar.updatePosition(callsign, position);
- CHASE_timer = (new Date()).getTime() + 15000;
- }
+ if(CHASE_enabled) {
+ ChaseCar.updatePosition(callsign, position);
+ CHASE_timer = (new Date()).getTime() + 15000;
}
- else { return; }
-
- // add/update marker on the map (sondehub.js)
- updateCurrentPosition(lat, lon);
-
- // round the coordinates
- lat = parseInt(lat * 10000)/10000; // 4 decimal places (11m accuracy at equator)
- lon = parseInt(lon * 10000)/10000; // 4 decimal places
- speed = parseInt(speed * 10)/10; // 1 decimal place
- accuracy = parseInt(accuracy);
- alt = parseInt(alt);
-
- // dispaly them in the top right corner
- $('#app_name b').html(lat + '
' + lon);
-
- // update chase car interface
- $('#cc_lat').text(lat);
- $('#cc_lon').text(lon);
- $('#cc_alt').text(alt + " m");
- $('#cc_accuracy').text(accuracy + " m");
- $('#cc_speed').text(speed + " m/s");
- /*
- },
- function() {
- // when there is no location
- $('#app_name b').html('mobile
tracker');
- });
- */
+ }
+
+
+ // add/update marker on the map (sondehub.js)
+ updateCurrentPosition(lat, lon);
+
+ // round the coordinates
+ lat = parseInt(lat * 10000)/10000; // 4 decimal places (11m accuracy at equator)
+ lon = parseInt(lon * 10000)/10000; // 4 decimal places
+ speed = parseInt(speed * 10)/10; // 1 decimal place
+ accuracy = parseInt(accuracy);
+ alt = parseInt(alt);
+
+ // dispaly them in the top right corner
+ $('#app_name b').html(lat + '
' + lon);
+
+ // update chase car interface
+ $('#cc_lat').text(lat);
+ $('#cc_lon').text(lon);
+ $('#cc_alt').text(alt + " m");
+ $('#cc_accuracy').text(accuracy + " m");
+ $('#cc_speed').text(speed + " m/s");
+
+
};
var twoZeroPad = function(n) {
@@ -701,7 +696,6 @@ $(window).ready(function() {
field.removeAttr('disabled');
e.removeClass('on').addClass('off');
- if(navigator.geolocation) navigator.geolocation.clearWatch(CHASE_enabled);
CHASE_enabled = null;
//CHASE_enabled = false;
@@ -729,8 +723,7 @@ $(window).ready(function() {
ChaseCar.updatePosition(callsign, { coords: { latitude: GPS_lat, longitude: GPS_lon, altitude: GPS_alt, speed: GPS_speed }});
}
- if(navigator.geolocation) CHASE_enabled = navigator.geolocation.watchPosition(positionUpdateHandle, positionUpdateError);
- //CHASE_enabled = true;
+ CHASE_enabled = true;
// hide the blue man
if(currentPosition && currentPosition.marker) map.removeLayer(currentPosition.marker);
@@ -848,6 +841,18 @@ $(window).ready(function() {
else focusVehicle(null, true);
break;
case "opt_imperial":
+ if (map_scale){
+ map_scale.remove()
+ }
+ // we need to remove and add the zoom controls so they end up in the same position
+ zoom_controls.remove()
+ if (on) {
+ map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map);
+ } else {
+ map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map);
+ }
+ zoom_controls.addTo(map);
+
case "opt_haxis_hours":
refreshUI();
break;
@@ -972,10 +977,7 @@ $(window).ready(function() {
});
navigator.geolocation.getCurrentPosition(positionUpdateHandle);
- // check for location update every 30sec
- //setInterval(positionUpdateHandle, 30000);
- // immediatelly check for position
- //positionUpdateHandle();
+ if(navigator.geolocation) navigator.geolocation.watchPosition(positionUpdateHandle, positionUpdateError);
}
// weather feature
@@ -1074,7 +1076,8 @@ $(window).ready(function() {
$("header .search form").on('submit', function(e) {
e.preventDefault();
- var text = $("header .search input[type='text']").val();
+ var text = $("header .search input[type='text']").val().toUpperCase();
+ $("header .search input[type='text']")[0].value = text; // update field in case it wasn't already uppercase
if(text === wvar.query) return;
@@ -1123,6 +1126,19 @@ function update_site(){
window.location.reload(true)
}
+function check_banner(){
+ const bannerRequest = new Request("https://api.v2.sondehub.org/banner");
+ fetch(bannerRequest)
+ .then(function(response){ return response.json()})
+ .then(function(response){
+ if (response['banner']) {
+ document.getElementsByTagName("header")[0].style.backgroundColor = "#ff6259"
+ document.getElementsByTagName("header")[0].style.borderColor = "#eb3d34"
+ document.getElementById("banner").innerText = response['banner']
+ }
+ })
+}
+
function update_countdown(){
var date = new Date(0);
time_remaining = (reload_end_time - new Date().getTime())/1000
@@ -1132,6 +1148,7 @@ function update_countdown(){
}
check_version()
+check_banner()
update_check = setInterval(check_version, 15 * 60 * 1000)
load_hash();
startAjax();
diff --git a/js/sondehub.js b/js/sondehub.js
index 6e2f0d2..1296cc4 100644
--- a/js/sondehub.js
+++ b/js/sondehub.js
@@ -570,7 +570,7 @@ function makeQuad(x, y, zoom) {
// map type list
-var osm = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
+var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© OpenStreetMap contributors'
});
@@ -681,7 +681,7 @@ function throttle_events(event) {
function sub_to_nearby_sondes(){
let bounds = map.getBounds().pad(1); // expand by one viewport
- let zoomed_out = map.getZoom() <= 6;
+ let zoomed_out = map.getZoom() <= 8;
const sub_logging = false;
if (zoomed_out){
// If we are fairly zooomed out - only give the slow feed
@@ -868,10 +868,15 @@ function load() {
L.control.status({ position: 'bottomright' }).addTo(map);
// scale (would be better if integrated into attirbution bar)
- L.control.scale({position:'bottomright', imperial:false}).addTo(map);
+ if (offline.get('opt_imperial')){
+ map_scale = L.control.scale({position:'bottomright', imperial:true, metric:false}).addTo(map);
+ } else {
+ map_scale = L.control.scale({position:'bottomright', imperial:false}).addTo(map);
+ }
+
// zoom controls
- new L.Control.Zoom({ position: 'bottomright' }).addTo(map);
+ zoom_controls = new L.Control.Zoom({ position: 'bottomright' }).addTo(map);
// map selector
layers = L.control.layers(baseMaps, null, {position: "topleft"}).addTo(map);
@@ -4514,8 +4519,10 @@ 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);
+ }
}
}
@@ -4765,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],
diff --git a/js/station.js b/js/station.js
index df1ce29..6ad8857 100644
--- a/js/station.js
+++ b/js/station.js
@@ -632,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) {
@@ -768,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) {