Skip to content

Commit 19037df

Browse files
authored
Merge pull request projecthorus#153 from projecthorus/testing
Hide chase cars
2 parents d0a1787 + 963eef0 commit 19037df

File tree

3 files changed

+47
-10
lines changed

3 files changed

+47
-10
lines changed

index.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
177177
<input type="checkbox" id="opt_hide_recoveries">
178178
</div>
179179
</div>
180+
<div class="row option">
181+
<span><b>Hide chase cars from the map</b></span>
182+
<div class="switch off" id="sw_hide_chase">
183+
<span class="thumb"></span>
184+
<input type="checkbox" id="opt_hide_chase">
185+
</div>
186+
</div>
180187
<div class="row option">
181188
<span><b>Highlight selected vehicle</b></span>
182189
<div class="switch off" id="sw_hilight_vehicle">
@@ -210,7 +217,7 @@ <h4>Overlays</h4>
210217
<h4>Other</h4>
211218
<hr/>
212219
<div class="row option">
213-
<span><b>Show Launch Sites</b></span>
220+
<span><b>Hide Launch Sites</b></span>
214221
<div class="switch off" id="sw_layers_launches">
215222
<span class="thumb"></span>
216223
<input type="checkbox" id="opt_layers_launches">

js/app.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ $(window).ready(function() {
746746
"#sw_daylight",
747747
"#sw_hide_receivers",
748748
"#sw_hide_recoveries",
749+
"#sw_hide_chase",
749750
"#sw_hide_timebox",
750751
"#sw_hilight_vehicle",
751752
'#sw_hide_horizon',
@@ -811,6 +812,14 @@ $(window).ready(function() {
811812
refreshRecoveries();
812813
}
813814
break;
815+
case "opt_hide_chase":
816+
if(on) {
817+
clearTimeout(periodical_listeners);
818+
deleteChase();
819+
} else {
820+
refreshNewReceivers(true);
821+
}
822+
break;
814823
case "opt_hide_timebox":
815824
var elm = $("#timebox");
816825
if(on) {
@@ -844,9 +853,9 @@ $(window).ready(function() {
844853
case "opt_layers_launches":
845854
showLaunchSites();
846855
if(on) {
847-
map.addLayer(launches);
848-
} else {
849856
map.removeLayer(launches);
857+
} else {
858+
map.addLayer(launches);
850859
}
851860
break;
852861
case "opt_interpolate":

js/tracker.js

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,9 @@ function clean_refresh(text, force, history_step) {
423423
clearTimeout(periodical_listeners);
424424

425425
refresh();
426-
refreshNewReceivers(true);
426+
if (!offline.get("opt_hide_chase")) {
427+
refreshNewReceivers(true);
428+
}
427429

428430
return true;
429431
}
@@ -513,7 +515,7 @@ function load() {
513515
map.addLayer(nite);
514516
}
515517

516-
if (offline.get("opt_layers_launches")) {
518+
if (!offline.get("opt_layers_launches")) {
517519
showLaunchSites();
518520
map.addLayer(launches);
519521
}
@@ -2095,7 +2097,7 @@ function mapInfoBox_handle_prediction(event) {
20952097
formatDate(new Date(parseInt(data.time) * 1000), true) + "\n\n" +
20962098
"<b>Altitude:</b> " + altitude + "\n" +
20972099
"<b>Latitude:</b> " + data.lat + "\n" +
2098-
"<b>Longtitude:</b> " + data.lon + "\n" +
2100+
"<b>Longitude:</b> " + data.lon + "\n" +
20992101
"</pre>"
21002102
);
21012103
mapInfoBox.setLatLng(event.latlng);
@@ -3512,7 +3514,9 @@ function refreshSingleNew(serial) {
35123514
}
35133515

35143516
if (serial.includes("_chase")) {
3515-
refreshNewReceivers(false, serial.replace("_chase", ""));
3517+
if (!offline.get("opt_hide_chase")) {
3518+
refreshNewReceivers(false, serial.replace("_chase", ""));
3519+
}
35163520
return;
35173521
}
35183522

@@ -3562,7 +3566,9 @@ function refreshPatreons() {
35623566

35633567
function refreshReceivers() {
35643568
if(offline.get('opt_hide_receivers')) {
3565-
refreshNewReceivers(true);
3569+
if (!offline.get("opt_hide_chase")) {
3570+
refreshNewReceivers(true);
3571+
}
35663572
} else {
35673573
data_str = "duration=1d";
35683574

@@ -3575,7 +3581,9 @@ function refreshReceivers() {
35753581
updateReceivers(response);
35763582
},
35773583
complete: function(request, textStatus) {
3578-
refreshNewReceivers(true);
3584+
if (!offline.get("opt_hide_chase")) {
3585+
refreshNewReceivers(true);
3586+
}
35793587
}
35803588
});
35813589
}
@@ -3593,13 +3601,16 @@ function refreshNewReceivers(initial, serial) {
35933601
data_str = "duration=1m";
35943602
}
35953603

3604+
35963605
$.ajax({
35973606
type: "GET",
35983607
url: receivers_url,
35993608
data: data_str,
36003609
dataType: "json",
36013610
success: function(response, textStatus) {
3602-
updateChase(response);
3611+
if (!offline.get("opt_hide_chase")) {
3612+
updateChase(response);
3613+
}
36033614
},
36043615
complete: function(request, textStatus) {
36053616
if (typeof serial === 'undefined') {
@@ -3798,6 +3809,16 @@ function updateReceiverMarker(receiver) {
37983809
}
37993810
}
38003811

3812+
function deleteChase(r) {
3813+
var callsign;
3814+
for(callsign in vehicles) {
3815+
if (vehicles[callsign].vehicle_type == "car") {
3816+
vehicles[callsign].kill();
3817+
}
3818+
}
3819+
car_index = 0;
3820+
}
3821+
38013822
function updateChase(r) {
38023823
if(!r) return;
38033824

0 commit comments

Comments
 (0)