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/index.template.html b/index.template.html index 8d3f3b0..0630f4b 100644 --- a/index.template.html +++ b/index.template.html @@ -84,6 +84,7 @@ no
location
+ @@ -269,13 +270,6 @@

Visibility

-
- Show Horizon Rings -
- - -
-
Hide Titles
diff --git a/js/app.js b/js/app.js index 8a2454f..ce08051 100644 --- a/js/app.js +++ b/js/app.js @@ -809,7 +809,6 @@ $(window).ready(function() { "#sw_hide_chase", "#sw_hide_timebox", "#sw_hilight_vehicle", - '#sw_hide_horizon', '#sw_hide_titles', '#sw_layers_launches', '#sw_selective_sidebar', @@ -907,14 +906,6 @@ $(window).ready(function() { $('#lookanglesbox').css({top:'40px'}); } break; - case "opt_hide_horizon": - if(on) { - showHorizonRings(); - } - else { - hideHorizonRings(); - } - break; case "opt_hide_titles": if(on) { hideTitles(); @@ -1126,6 +1117,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 @@ -1135,7 +1139,8 @@ function update_countdown(){ } check_version() +check_banner() update_check = setInterval(check_version, 15 * 60 * 1000) load_hash(); startAjax(); -load(); \ No newline at end of file +load(); diff --git a/js/sondehub.js b/js/sondehub.js index d29944f..f8b3f4c 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' }); @@ -998,27 +998,25 @@ function load() { map.on('zoomend', function() { sub_to_nearby_sondes(); //do check for horizon labels - if (offline.get("opt_hide_horizon")) { - for (key in vehicles) { - if (vehicles[key]["vehicle_type"] == "balloon") { - if (vehicles[key]["horizon_circle"]["_map"]) - { - try { - var zoom = map.getZoom(); - var horizonzoom = (Math.abs(Math.log(vehicles[key]["horizon_circle"].getRadius()/2000000)/0.75)); - var subhorizonzoom = (Math.abs(Math.log(vehicles[key]["subhorizon_circle"].getRadius()/2000000)/0.75)); - if (horizonzoom > zoom) { - map.removeLayer(vehicles[key]["horizon_circle_title"]); - } else { - map.addLayer(vehicles[key]["horizon_circle_title"]); - } - if (subhorizonzoom > zoom) { - map.removeLayer(vehicles[key]["subhorizon_circle_title"]); - } else { - map.addLayer(vehicles[key]["subhorizon_circle_title"]); - } - } catch(e){}; - } + for (key in vehicles) { + if (vehicles[key]["vehicle_type"] == "balloon") { + if (vehicles[key]["horizon_circle"]["_map"]) + { + try { + var zoom = map.getZoom(); + var horizonzoom = (Math.abs(Math.log(vehicles[key]["horizon_circle"].getRadius()/2000000)/0.75)); + var subhorizonzoom = (Math.abs(Math.log(vehicles[key]["subhorizon_circle"].getRadius()/2000000)/0.75)); + if (horizonzoom > zoom) { + map.removeLayer(vehicles[key]["horizon_circle_title"]); + } else { + map.addLayer(vehicles[key]["horizon_circle_title"]); + } + if (subhorizonzoom > zoom) { + map.removeLayer(vehicles[key]["subhorizon_circle_title"]); + } else { + map.addLayer(vehicles[key]["subhorizon_circle_title"]); + } + } catch(e){}; } } } @@ -1564,6 +1562,7 @@ function stopFollow(no_data_reset) { if(follow_vehicle !== null) { if(!no_data_reset) { focusVehicle(null); + hideHorizonRings(); // remove target mark $("#main .row.follow").removeClass("follow"); @@ -1612,6 +1611,7 @@ function followVehicle(vcallsign, noPan, force) { follow_vehicle = vcallsign; vehicles[follow_vehicle].follow = true; + updateHorizonVisibility(); // add target mark $("#main .row.follow").removeClass("follow"); @@ -1894,8 +1894,9 @@ function updateVehicleInfo(vcallsign, newPosition) { } } if(newPosition.callsign[callsign].hasOwnProperty('frequency')){ - if(newPosition.callsign[callsign].frequency){ - vehicle.receiver_info[i].frequency = newPosition.callsign[rxcall].frequency.toFixed(4) + const freq = Number(newPosition.callsign[rxcall].frequency); + if(!Number.isNaN(freq)){ + vehicle.receiver_info[i].frequency = freq.toFixed(4) } } return @@ -1913,8 +1914,9 @@ function updateVehicleInfo(vcallsign, newPosition) { } } if(newPosition.callsign[callsign].hasOwnProperty('frequency')){ - if(newPosition.callsign[callsign].frequency){ - temp_receiver.frequency = newPosition.callsign[rxcall].frequency.toFixed(4) + const freq = Number(newPosition.callsign[rxcall].frequency); + if(!Number.isNaN(freq)){ + temp_receiver.frequency = freq.toFixed(4) } } vehicle.receiver_info[callsign] = temp_receiver; @@ -3305,12 +3307,7 @@ function addPosition(position) { } else { map.addLayer(vehicle.marker.shadow); - if(!offline.get('opt_hide_horizon') == false){ - map.addLayer(vehicle.horizon_circle); - map.addLayer(vehicle.subhorizon_circle); - map.addLayer(vehicle.horizon_circle_title); - map.addLayer(vehicle.subhorizon_circle_title); - } + updateHorizonVisibility(); if(mode == "parachute") { img_src = recolorSVG(host_url + markers_url + "parachute.svg", this.balloonColor); @@ -3379,14 +3376,9 @@ function addPosition(position) { horizon_circle_title = new L.Marker(point, { icon: horizon_circle_title_icon, interactive: true, - title: "Line-of-right (radio) horizon of the payload" + title: "Line-of-sight (radio) horizon of the payload" }); - if (offline.get("opt_hide_horizon")) { - horizon_circle.addTo(map); - horizon_circle_title.addTo(map); - } - horizon_circle.on('move', function (e) { try { var latlng = L.latLng(e.target.getBounds()._southWest.lat, ((e.target.getBounds()._northEast.lng + e.target.getBounds()._southWest.lng)/2)); @@ -3415,11 +3407,6 @@ function addPosition(position) { 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")) { - subhorizon_circle.addTo(map); - subhorizon_circle_title.addTo(map); - } - subhorizon_circle.on('move', function (e) { try { var latlng = L.latLng(e.target.getBounds()._southWest.lat, ((e.target.getBounds()._northEast.lng + e.target.getBounds()._southWest.lng)/2)); @@ -3585,6 +3572,7 @@ function addPosition(position) { } vehicles[vcallsign] = vehicle_info; + updateHorizonVisibility(); } var vehicle = vehicles[vcallsign]; @@ -5057,17 +5045,21 @@ function hideHorizonRings(){ } } -function showHorizonRings(){ - for(var vcallsign in vehicles) { - 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); - } - } +function updateHorizonVisibility(){ + // Only show horizon rings for the sonde we are currently 'following' + // (the last selected sonde) + hideHorizonRings(); + + if (follow_vehicle === null) return; + if (!vehicles.hasOwnProperty(follow_vehicle)) return; + if (vehicles[follow_vehicle].vehicle_type != "balloon") return; + + map.addLayer(vehicles[follow_vehicle].horizon_circle); + map.addLayer(vehicles[follow_vehicle].subhorizon_circle); + vehicles[follow_vehicle].horizon_circle.fire("move"); + vehicles[follow_vehicle].subhorizon_circle.fire("move"); + map.addLayer(vehicles[follow_vehicle].horizon_circle_title); + map.addLayer(vehicles[follow_vehicle].subhorizon_circle_title); } function hideTitles(){ diff --git a/js/station.js b/js/station.js index 6ad8857..580ee72 100644 --- a/js/station.js +++ b/js/station.js @@ -957,6 +957,7 @@ function generateLaunchSites() { popupContent += "
Know when this site launches? Contribute here"; popupContent += "
Site Code: " + key; + popupContent += "
Launch times are synoptic times. Sonde launches may occur up to 1 hr prior to this." // Generate view historical button popupContent += "
";