Skip to content

Commit 71b649e

Browse files
committed
hide chase cars
1 parent b3a8035 commit 71b649e

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

index.html

Lines changed: 7 additions & 0 deletions
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">

js/app.js

Lines changed: 9 additions & 0 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) {

js/tracker.js

Lines changed: 25 additions & 6 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,6 @@ function load() {
513515
map.addLayer(nite);
514516
}
515517

516-
517518
if (!offline.get("opt_layers_launches")) {
518519
showLaunchSites();
519520
map.addLayer(launches);
@@ -3513,7 +3514,9 @@ function refreshSingleNew(serial) {
35133514
}
35143515

35153516
if (serial.includes("_chase")) {
3516-
refreshNewReceivers(false, serial.replace("_chase", ""));
3517+
if (!offline.get("opt_hide_chase")) {
3518+
refreshNewReceivers(false, serial.replace("_chase", ""));
3519+
}
35173520
return;
35183521
}
35193522

@@ -3563,7 +3566,9 @@ function refreshPatreons() {
35633566

35643567
function refreshReceivers() {
35653568
if(offline.get('opt_hide_receivers')) {
3566-
refreshNewReceivers(true);
3569+
if (!offline.get("opt_hide_chase")) {
3570+
refreshNewReceivers(true);
3571+
}
35673572
} else {
35683573
data_str = "duration=1d";
35693574

@@ -3576,7 +3581,9 @@ function refreshReceivers() {
35763581
updateReceivers(response);
35773582
},
35783583
complete: function(request, textStatus) {
3579-
refreshNewReceivers(true);
3584+
if (!offline.get("opt_hide_chase")) {
3585+
refreshNewReceivers(true);
3586+
}
35803587
}
35813588
});
35823589
}
@@ -3601,7 +3608,9 @@ function refreshNewReceivers(initial, serial) {
36013608
data: data_str,
36023609
dataType: "json",
36033610
success: function(response, textStatus) {
3604-
updateChase(response);
3611+
if (!offline.get("opt_hide_chase")) {
3612+
updateChase(response);
3613+
}
36053614
},
36063615
complete: function(request, textStatus) {
36073616
if (typeof serial === 'undefined') {
@@ -3800,6 +3809,16 @@ function updateReceiverMarker(receiver) {
38003809
}
38013810
}
38023811

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+
38033822
function updateChase(r) {
38043823
if(!r) return;
38053824

0 commit comments

Comments
 (0)