Skip to content

Commit 823e13a

Browse files
authored
Sidebar changes (#254)
1 parent 859b2b7 commit 823e13a

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

img/splash/splash-narrow.png

77 KB
Loading

img/splash/splash-wide.png

63.4 KB
Loading

index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<div id="loading">
2828
<div>
2929
<img src="img/sondehub_logo.png" />
30+
<img src="img/splash/splash-wide.png" style="transform: translate(-50%,250%);"/>
3031
<div class="bar" style="display: none"><div class="complete"></div></div>
3132
</div>
3233
</div>
@@ -210,6 +211,13 @@ <h4>Visibility</h4>
210211
<input type="checkbox" id="opt_layers_launches">
211212
</div>
212213
</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>
213221
<h4>Other</h4>
214222
<hr/>
215223
<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: 35 additions & 5 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,24 @@ 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+
if (!($("#main .vehicle"+vehicles[serial].uuid).hasClass("follow"))) {
1065+
$("#main .vehicle"+vehicles[serial].uuid).hide();
1066+
}
1067+
}
1068+
}
1069+
} else {
1070+
for (let serial in vehicles) {
1071+
$("#main .vehicle"+vehicles[serial].uuid).show();
1072+
}
1073+
}
1074+
}
1075+
10561076
function title_case(s) {
10571077
return s.replace(/\w\S*/g, function(txt) {
10581078
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
@@ -1528,6 +1548,14 @@ function updateVehicleInfo(vcallsign, newPosition) {
15281548
$('.landscape').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
15291549
}
15301550

1551+
if (offline.get('opt_selective_sidebar')) {
1552+
if (map.getBounds().contains(vehicles[vcallsign].marker.getLatLng())) {
1553+
$("#main .vehicle"+vehicle.uuid).show();
1554+
} else {
1555+
$("#main .vehicle"+vehicle.uuid).hide();
1556+
}
1557+
}
1558+
15311559
} else if(elm.attr('data-vcallsign') === undefined) {
15321560
elm.attr('data-vcallsign', vcallsign);
15331561
}
@@ -3463,7 +3491,7 @@ function refresh() {
34633491
refreshSingle(wvar.query);
34643492
} else {
34653493
response = formatData(data, false);
3466-
update(response);
3494+
update(response, true);
34673495
$("#stTimer").attr("data-timestamp", response.fetch_timestamp);
34683496
}
34693497
$("#stText").text("");
@@ -3591,7 +3619,7 @@ function refreshSingle(serial) {
35913619
dataType: "json",
35923620
success: function(data, textStatus) {
35933621
response = formatData(data, false);
3594-
update(response);
3622+
update(response, true);
35953623
singleRecovery(serial);
35963624
$("#stText").text("");
35973625
},
@@ -3633,7 +3661,7 @@ function refreshSingleNew(serial) {
36333661
dataType: "json",
36343662
success: function(data, textStatus) {
36353663
response = formatData(data, false);
3636-
update(response);
3664+
update(response, true);
36373665
},
36383666
error: function() {
36393667
ajax_inprogress_single_new = false;
@@ -4348,14 +4376,16 @@ var ssdv = {};
43484376
var status = "";
43494377
var bs_idx = 0;
43504378

4351-
function update(response) {
4379+
function update(response, none) {
43524380
if (response === null ||
43534381
!response.positions ||
43544382
!response.positions.position ||
43554383
!response.positions.position.length) {
43564384

43574385
// if no vehicles are found, this will remove the spinner and put a friendly message
4358-
$("#main .empty").html("<span>No vehicles :(</span>");
4386+
if (none) {
4387+
$("#main .empty").html("<span>No vehicles :(</span>");
4388+
}
43594389

43604390
return;
43614391
}

0 commit comments

Comments
 (0)