Skip to content

Commit a3a794e

Browse files
TheSkormMark Jessopxssfox
authored
Recovery Reporting Changes (projecthorus#400)
Co-authored-by: Mark Jessop <[email protected]> Co-authored-by: xssfox <[email protected]>
1 parent f9a425e commit a3a794e

File tree

6 files changed

+408
-228
lines changed

6 files changed

+408
-228
lines changed

css/main.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,13 @@ body {
9999
#timebox {
100100
top: 7px;
101101
right: 5px;
102+
width: 205px;
102103
}
103104

104105
#lookanglesbox {
105106
top: 40px;
106107
right: 5px;
108+
width: 205px;
107109
}
108110

109111
#timebox.past svg path {

index.template.html

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<link rel="stylesheet" href="css/leaflet.fullscreen.css"/>
2929
<link rel="stylesheet" href="css/skewt.css"/>
3030

31-
<script type="text/javascript" language="javascript" src="https://www.google.com/recaptcha/api.js" async defer></script>
3231
<script type="text/javascript" language="javascript" src="js/skewt.js?v={VER}"></script>
3332
<script type="text/javascript" language="javascript" src="js/aws-sdk-2.1029.0.min.js"></script>
3433
<script type="text/javascript" language="javascript" src="js/leaflet.js?v={VER}"></script>
@@ -89,16 +88,64 @@
8988

9089
<div id="recoveriesbox" style="display: none" class="flatpage">
9190
<div class="slimContainer">
92-
<h2><i class="icon-habhub rfloat"></i>Recoveries</h2>
91+
<h3><i class="icon-habhub rfloat"></i>Report Recovery</h3>
9392
<hr/>
94-
<p>Recovery reports can be added on the Chase-Car pane.</p>
93+
<div class="row">
94+
<span><b>Please report recovered radiosondes! Don't waste others time and effort with a frustrating failed recovery!</b></span>
95+
<span>Enter the serial number, select recovered / planned, and add some notes. If marking as planned, please add contact information!</span>
96+
<span>If the sonde is not on the map, type its serial into the top-left search box (may require landscape mode on mobile) and press enter to retrieve historical data.</span>
97+
</div>
98+
<div class="row">
99+
<span><b>Serial</b> <a href="https://github.com/projecthorus/sondehub-infra/wiki/Radiosonde-Serial-Numbers" target="_blank" rel="noopener">(Help)</a></span>
100+
<span class="r"><input type="text" id="pr_serial" style="width: 140px;"/></span>
101+
</div>
102+
<div class="row">
103+
<span><b>Recovered By</b></span>
104+
<span class="r"><input type="text" id="recovery_callsign" style="width: 140px;" maxlength="15"/></span>
105+
</div>
106+
<div class="row option">
107+
<span><b>Recovery Success</b></span>
108+
<div class="switchyn on" id="sw_recovery_ok">
109+
<span class="thumb"></span>
110+
<input type="checkbox" id="recovery_ok">
111+
</div>
112+
</div>
113+
<div class="row option">
114+
<span><b>Recovery Planned</b></span>
115+
<div class="switchyn off" id="sw_recovery_planned">
116+
<span class="thumb"></span>
117+
<input type="checkbox" id="recovery_planned">
118+
</div>
119+
</div>
120+
<div class="row option">
121+
<span><b>Use Browser Position</b></span>
122+
<div class="switch off" id="sw_use_car_pos">
123+
<span class="thumb"></span>
124+
<input type="checkbox" id="use_car_pos">
125+
</div>
126+
</div>
127+
<div class="row">
128+
<span><b>Notes</b></span>
129+
</div>
130+
<div class="row">
131+
<span>
132+
<textarea name="pr_notes" id="pr_notes" style="width:280px;height:60px;"></textarea>
133+
</span>
134+
</div>
135+
<div class="row">
136+
<span><b>Report Result</b></span>
137+
<span class="r" id="pr_last_report">none</span>
138+
</div>
139+
<div class="row">
140+
<span class="r"><input type="button" value="Submit" id="pr_submit" onclick="ChaseCar.markRecovered();"/></span>
141+
</div>
95142
<hr/>
96-
<div id="recovery-list"><img style="width:90px;height:30px;display:block;margin:auto;" src="img/hab-spinner.gif"/><br></div>
97-
</div>
98-
<div class="slimContainer">
99-
<h2>Statistics</h2>
143+
<h3>Statistics</h3>
100144
<hr/>
101145
<div id="leaderboard-list"><img style="width:90px;height:30px;display:block;margin:auto;" src="img/hab-spinner.gif"/><br></div>
146+
<hr/>
147+
<h3>Recoveries</h3>
148+
<div id="recovery-list"><img style="width:90px;height:30px;display:block;margin:auto;" src="img/hab-spinner.gif"/><br></div>
102149
</div>
103150
</div>
104151
<div id="aboutbox" style="display: none" class="flatpage">
@@ -119,7 +166,7 @@ <h4>Radiosondes?</h4>
119166
<br/>
120167

121168
<h4>Found a Radiosonde?</h4>
122-
Click the 'car' icon on the top-right to submit a recovery notification.
169+
<b>Please click the 'balloon' icon on the top-right to submit a recovery notification!</b>
123170

124171
<h4>Support Us!</h4>
125172
If you use SondeHub regularly, please consider <a href="https://www.patreon.com/sondehub" target="_blank" rel="noopener">supporting us on Patreon</a>, or with a <a href="https://sondehub.org/go/donate" target="_blank" rel="noopener">donation on Paypal</a>.</br>
@@ -351,48 +398,7 @@ <h2><i class="icon-car rfloat"></i>Chase Mode</h2>
351398
<span class="r" id="cc_speed">none</span>
352399
</div>
353400
<hr>
354-
<h3>Report Recovery</h3>
355-
<hr>
356-
<div class="row">
357-
<span>You can report a recovery here. Enter the serial number (e.g. 'S1234567'), tick recovered/not recovered, and add some notes. <a href="https://github.com/projecthorus/sondehub-infra/wiki/Radiosonde-Serial-Numbers" target="_blank" rel="noopener">Click here</a> for information on how to locate a sonde's serial number.</a> If the sonde is not on the map, type its serial into the top-left search box and press enter to retrieve historical data. You can then mark it as recovered. Optionally, you can use your location instead of the sonde's last location.</span>
358-
</div>
359-
<div class="row">
360-
<span><b>Serial</b></span>
361-
<span class="r"><input type="text" id="pr_serial" style="width: 140px;"/></span>
362-
</div>
363-
<div class="row option">
364-
<span><b>Recovery Success</b></span>
365-
<div class="switchyn on" id="sw_recovery_ok">
366-
<span class="thumb"></span>
367-
<input type="checkbox" id="recovery_ok">
368-
</div>
369-
</div>
370-
<div class="row option">
371-
<span><b>Use Car Position</b></span>
372-
<div class="switch off" id="sw_use_car_pos">
373-
<span class="thumb"></span>
374-
<input type="checkbox" id="use_car_pos">
375-
</div>
376-
</div>
377-
<div class="row">
378-
<span><b>Notes</b></span>
379-
</div>
380-
<div class="row">
381-
<span>
382-
<!--<input type="text" id="pr_notes" style="width: 140px;"/>-->
383-
<textarea name="pr_notes" id="pr_notes" style="width:280px;height:60px;"></textarea>
384-
</span>
385-
</div>
386-
<div class="row">
387-
<span><b>Report Result</b></span>
388-
<span class="r" id="pr_last_report">none</span>
389-
</div>
390-
<div class="row">
391-
<div class="g-recaptcha" data-sitekey="6LcEkBUbAAAAABTgn2lktm6UPeP0lbyqIDBBujSF"></div>
392-
</div>
393-
<div class="row">
394-
<span class="r"><input type="button" value="Submit" id="pr_submit" onclick="ChaseCar.markRecovered();"/></span>
395-
</div>
401+
Recovery reporting is now on the recoveries tab! (Balloon icon)
396402

397403
</div>
398404
</div>
@@ -402,6 +408,9 @@ <h3>Report Recovery</h3>
402408
<div id="zoom_warning" class="lfloat slickbox" style="width:250px; bottom: 0px; left: 50%; transform: translate(-50%, -50%);">
403409
<div style="width:250px">Zoom in for realtime data!</div>
404410
</div>
411+
<div id="recovery_notice" class="lfloat slickbox" onclick="show_recoveries();" style="width:225px; bottom: 35px; left: 50%; transform: translate(-50%, -50%); display:none;">
412+
<div style="width:225px"><b>Please report recovered sondes!</b></div>
413+
</div>
405414
</div>
406415
<div id="timebox" class="present slickbox animate" style="display: none">
407416
<svg width="40" height="40" viewbox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" version="1.1" version="1.1" class="lfloat">
@@ -441,8 +450,8 @@ <h3>Report Recovery</h3>
441450
</div>
442451
</div>
443452

444-
<div id="reload_warning">This version of SondeHub is out of date. <a href="javascript:window.location.reload(true)">Click here to reload</a>. Page will reload automatically in <span id="reload_timer"></span>
445-
</div>
453+
<div id="reload_warning">This version of SondeHub is out of date. <a href="javascript:window.location.reload(true)">Click here to reload</a>. Page will reload automatically in <span id="reload_timer"></span></div>
454+
446455

447456
<!-- Was 3.31-->
448457

js/app.js

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -486,20 +486,22 @@ var format_time_friendly = function(start, end) {
486486
var format_coordinates = function(lat, lon, name) {
487487
var coords_text;
488488
var ua = navigator.userAgent.toLowerCase();
489-
489+
var span = document.createElement('span')
490+
var a = document.createElement("a")
491+
span.appendChild(a)
490492
// determine how to link the coordinates to a native app, if on a mobile device
491493
if(ua.indexOf('iphone') > -1) {
492-
coords_text = '<a href="maps://?q='+lat+','+lon+'">' +
493-
roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +'</a>';
494+
a.href = 'maps://?q='+lat+','+lon
494495
} else if(ua.indexOf('android') > -1) {
495-
coords_text = '<a href="geo:'+lat+','+lon+'?q='+lat+','+lon+'('+name+')">' +
496-
roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +'</a>';
496+
a.href = 'geo:'+lat+','+lon+'?q='+lat+','+lon+'('+name+')'
497497
} else {
498-
coords_text = '<a href="https://www.google.com/maps/search/?api=1&query='+lat+','+lon+'" target="_blank" rel="noopener noreferrer">' +
499-
roundNumber(lat, 5) + ', ' + roundNumber(lon, 5) +'</a>';
498+
a.href = 'https://www.google.com/maps/search/?api=1&query='+lat+','+lon
499+
a.target="_blank"
500+
a.rel="noopener noreferrer"
500501
}
502+
a.innerText = roundNumber(lat, 5) + ', ' + roundNumber(lon, 5)
501503

502-
return coords_text;
504+
return span.innerHTML;
503505
};
504506

505507
// runs every second
@@ -684,9 +686,7 @@ $(window).ready(function() {
684686
} else {
685687
wvar.box = null
686688
}
687-
console.log("aaa")
688-
console.log(wvar.box)
689-
console.log("bbbb")
689+
690690
lhash_update(true);
691691
checkSize();
692692
});
@@ -748,6 +748,23 @@ $(window).ready(function() {
748748
// turning the switch on
749749
} else {
750750
e.removeClass('off').addClass('on');
751+
// Remove any planned recovery check.
752+
$("#sw_recovery_planned").removeClass('on').addClass('off');
753+
}
754+
});
755+
// Logic to switch the recovery Planned button
756+
$("#sw_recovery_planned").click(function() {
757+
var e = $(this);
758+
759+
// turning the switch off
760+
if(e.hasClass('on')) {
761+
e.removeClass('on').addClass('off');
762+
763+
// turning the switch on
764+
} else {
765+
e.removeClass('off').addClass('on');
766+
// Set recovery OK to false.
767+
$("#sw_recovery_ok").removeClass('on').addClass('off');
751768
}
752769
});
753770
// Logic to switch the use car position button
@@ -768,11 +785,21 @@ $(window).ready(function() {
768785
callsign = $(this).val().trim();
769786
offline.set('callsign', callsign); // put in localStorage
770787
CHASE_listenerSent = false;
788+
$('#recovery_callsign').val(callsign);
771789
});
772790

791+
$("#recovery_callsign").on('change keyup', function() {
792+
callsign = $(this).val().trim();
793+
offline.set('callsign', callsign); // put in localStorage
794+
CHASE_listenerSent = false;
795+
$('#cc_callsign').val(callsign);
796+
});
797+
798+
773799
// load value from localStorage
774800
callsign = offline.get('callsign');
775801
$('#cc_callsign').val(callsign);
802+
$('#recovery_callsign').val(callsign);
776803

777804
// settings page
778805

js/chasecar.lib.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ ChaseCar.updatePosition = function(callsign, position) {
4545

4646
ChaseCar.markRecovered = function(){
4747

48-
// Distance limits reinstated 2021-12-04
49-
_run_checks = true;
48+
// Remove range checks - 2025-01-24
49+
_range_check = false;
5050
_range_limit = 500000; // 200 km
5151

5252
// Get the serial number to be marked recovered
@@ -55,15 +55,15 @@ ChaseCar.markRecovered = function(){
5555
_notes = $("#pr_notes").val().trim();
5656

5757
// Check it exists.
58-
if(_serial.includes("chase") && _run_checks){
58+
if(_serial.includes("chase")){
5959
$('#pr_last_report').text("Invalid sonde callsign.");
6060
return;
6161
}
6262

63-
_callsign = $("#cc_callsign").val().trim();
63+
_callsign = $("#recovery_callsign").val().trim();
6464
if (_callsign == "" || _callsign == undefined || _callsign.length == 0)
6565
{
66-
$('#pr_last_report').text("Enter a callsign in the chase-car section above!");
66+
$('#pr_last_report').text("Enter a callsign/name in the 'Recovered by' field!");
6767
return;
6868
}
6969

@@ -109,7 +109,7 @@ ChaseCar.markRecovered = function(){
109109
// Calculate the distance from the sonde
110110
_lookangles = calculate_lookangles(_chaser, _sonde);
111111

112-
if( (_lookangles.range > _range_limit ) && _run_checks){
112+
if( (_lookangles.range > _range_limit ) && _range_check){
113113
$('#pr_last_report').text("Outside distance limit (500km).");
114114
return;
115115
}
@@ -120,28 +120,26 @@ ChaseCar.markRecovered = function(){
120120
}
121121
}
122122

123+
// Logic to make recovery & planned mutually exclusive is in app.js
124+
_recovered = $("#sw_recovery_ok").hasClass('on');
125+
_planned = $("#sw_recovery_planned").hasClass('on');
126+
123127

124128
var _doc = {
125129
"serial": _serial,
126130
"lat": _recov_lat,
127131
"lon": _recov_lon,
128132
"alt": 0.0,
129-
"recovered": $("#sw_recovery_ok").hasClass('on'),
133+
"recovered": _recovered,
134+
"planned": _planned,
130135
"recovered_by": _callsign,
131136
"description": _notes
132137
};
133138

134-
// Yes this is not the right way to do this...
135-
// .. but it adds an extra bit of check.
136-
var res = grecaptcha.getResponse();
137-
if (res == "" || res == undefined || res.length == 0)
138-
{
139-
$('#pr_last_report').text("Do Recaptcha first!");
140-
return;
141-
}
142139

143140
$('#pr_last_report').text("Submitting report...");
144141

142+
145143
$.ajax({
146144
type: "PUT",
147145
url: ChaseCar.recovery_uri,

0 commit comments

Comments
 (0)