Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ <h2><i class="icon-settings rfloat"></i>Settings</h2>
<input type="checkbox" id="opt_hide_recoveries">
</div>
</div>
<div class="row option">
<span><b>Hide chase cars from the map</b></span>
<div class="switch off" id="sw_hide_chase">
<span class="thumb"></span>
<input type="checkbox" id="opt_hide_chase">
</div>
</div>
<div class="row option">
<span><b>Highlight selected vehicle</b></span>
<div class="switch off" id="sw_hilight_vehicle">
Expand Down Expand Up @@ -210,7 +217,7 @@ <h4>Overlays</h4>
<h4>Other</h4>
<hr/>
<div class="row option">
<span><b>Show Launch Sites</b></span>
<span><b>Hide Launch Sites</b></span>
<div class="switch off" id="sw_layers_launches">
<span class="thumb"></span>
<input type="checkbox" id="opt_layers_launches">
Expand Down
13 changes: 11 additions & 2 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ $(window).ready(function() {
"#sw_daylight",
"#sw_hide_receivers",
"#sw_hide_recoveries",
"#sw_hide_chase",
"#sw_hide_timebox",
"#sw_hilight_vehicle",
'#sw_hide_horizon',
Expand Down Expand Up @@ -811,6 +812,14 @@ $(window).ready(function() {
refreshRecoveries();
}
break;
case "opt_hide_chase":
if(on) {
clearTimeout(periodical_listeners);
deleteChase();
} else {
refreshNewReceivers(true);
}
break;
case "opt_hide_timebox":
var elm = $("#timebox");
if(on) {
Expand Down Expand Up @@ -844,9 +853,9 @@ $(window).ready(function() {
case "opt_layers_launches":
showLaunchSites();
if(on) {
map.addLayer(launches);
} else {
map.removeLayer(launches);
} else {
map.addLayer(launches);
}
break;
case "opt_interpolate":
Expand Down
35 changes: 28 additions & 7 deletions js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,9 @@ function clean_refresh(text, force, history_step) {
clearTimeout(periodical_listeners);

refresh();
refreshNewReceivers(true);
if (!offline.get("opt_hide_chase")) {
refreshNewReceivers(true);
}

return true;
}
Expand Down Expand Up @@ -513,7 +515,7 @@ function load() {
map.addLayer(nite);
}

if (offline.get("opt_layers_launches")) {
if (!offline.get("opt_layers_launches")) {
showLaunchSites();
map.addLayer(launches);
}
Expand Down Expand Up @@ -2095,7 +2097,7 @@ function mapInfoBox_handle_prediction(event) {
formatDate(new Date(parseInt(data.time) * 1000), true) + "\n\n" +
"<b>Altitude:</b> " + altitude + "\n" +
"<b>Latitude:</b> " + data.lat + "\n" +
"<b>Longtitude:</b> " + data.lon + "\n" +
"<b>Longitude:</b> " + data.lon + "\n" +
"</pre>"
);
mapInfoBox.setLatLng(event.latlng);
Expand Down Expand Up @@ -3512,7 +3514,9 @@ function refreshSingleNew(serial) {
}

if (serial.includes("_chase")) {
refreshNewReceivers(false, serial.replace("_chase", ""));
if (!offline.get("opt_hide_chase")) {
refreshNewReceivers(false, serial.replace("_chase", ""));
}
return;
}

Expand Down Expand Up @@ -3562,7 +3566,9 @@ function refreshPatreons() {

function refreshReceivers() {
if(offline.get('opt_hide_receivers')) {
refreshNewReceivers(true);
if (!offline.get("opt_hide_chase")) {
refreshNewReceivers(true);
}
} else {
data_str = "duration=1d";

Expand All @@ -3575,7 +3581,9 @@ function refreshReceivers() {
updateReceivers(response);
},
complete: function(request, textStatus) {
refreshNewReceivers(true);
if (!offline.get("opt_hide_chase")) {
refreshNewReceivers(true);
}
}
});
}
Expand All @@ -3593,13 +3601,16 @@ function refreshNewReceivers(initial, serial) {
data_str = "duration=1m";
}


$.ajax({
type: "GET",
url: receivers_url,
data: data_str,
dataType: "json",
success: function(response, textStatus) {
updateChase(response);
if (!offline.get("opt_hide_chase")) {
updateChase(response);
}
},
complete: function(request, textStatus) {
if (typeof serial === 'undefined') {
Expand Down Expand Up @@ -3798,6 +3809,16 @@ function updateReceiverMarker(receiver) {
}
}

function deleteChase(r) {
var callsign;
for(callsign in vehicles) {
if (vehicles[callsign].vehicle_type == "car") {
vehicles[callsign].kill();
}
}
car_index = 0;
}

function updateChase(r) {
if(!r) return;

Expand Down