Skip to content

Commit 8f8d47c

Browse files
committed
only show visible sondes on sidebar
1 parent 68c82e9 commit 8f8d47c

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ <h4>Visibility</h4>
211211
<input type="checkbox" id="opt_layers_launches">
212212
</div>
213213
</div>
214+
<div class="row option">
215+
<span><b>Only show visible on sidebar</b></span>
216+
<div class="switch off" id="sw_selective_sidebar">
217+
<span class="thumb"></span>
218+
<input type="checkbox" id="opt_selective_sidebar">
219+
</div>
220+
</div>
214221
<h4>Other</h4>
215222
<hr/>
216223
<div class="row option">

js/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ $(window).ready(function() {
722722
'#sw_hide_horizon',
723723
'#sw_hide_titles',
724724
'#sw_layers_launches',
725+
'#sw_selective_sidebar',
725726
"#sw_nowelcome",
726727
"#sw_interpolate",
727728
];
@@ -820,6 +821,9 @@ $(window).ready(function() {
820821
if(on) map.overlayMapTypes.setAt("1", overlayAPRS);
821822
else map.overlayMapTypes.setAt("1", null);
822823
break;
824+
case "opt_selective_sidebar":
825+
sidebar_update();
826+
break;
823827
case "opt_layers_launches":
824828
if(on) {
825829
map.removeLayer(launches);

js/tracker.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ function load() {
878878

879879
map.on('moveend', function (e) {
880880
lhash_update();
881+
sidebar_update();
881882
});
882883

883884
map.on('baselayerchange', function (e) {
@@ -926,6 +927,7 @@ function load() {
926927

927928
map.on('moveend', function() {
928929
lhash_update();
930+
sidebar_update();
929931
});
930932
map.on('baselayerchange', function() {
931933
lhash_update();
@@ -1053,6 +1055,22 @@ function panToRecovery(rcallsign) {
10531055
}
10541056
}
10551057

1058+
function sidebar_update() {
1059+
if (offline.get('opt_selective_sidebar')) {
1060+
for (let serial in vehicles) {
1061+
if (map.getBounds().contains(vehicles[serial].marker.getLatLng())) {
1062+
$("#main .vehicle"+vehicles[serial].uuid).show();
1063+
} else {
1064+
$("#main .vehicle"+vehicles[serial].uuid).hide();
1065+
}
1066+
}
1067+
} else {
1068+
for (let serial in vehicles) {
1069+
$("#main .vehicle"+vehicles[serial].uuid).show();
1070+
}
1071+
}
1072+
}
1073+
10561074
function title_case(s) {
10571075
return s.replace(/\w\S*/g, function(txt) {
10581076
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
@@ -1528,6 +1546,14 @@ function updateVehicleInfo(vcallsign, newPosition) {
15281546
$('.landscape').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
15291547
}
15301548

1549+
if (offline.get('opt_selective_sidebar')) {
1550+
if (map.getBounds().contains(vehicles[vcallsign].marker.getLatLng())) {
1551+
$("#main .vehicle"+vehicle.uuid).show();
1552+
} else {
1553+
$("#main .vehicle"+vehicle.uuid).hide();
1554+
}
1555+
}
1556+
15311557
} else if(elm.attr('data-vcallsign') === undefined) {
15321558
elm.attr('data-vcallsign', vcallsign);
15331559
}

0 commit comments

Comments
 (0)