Skip to content

Commit b6966ed

Browse files
authored
Merge pull request #28 from LukePrior/testing
Fixes
2 parents 2f9a377 + 18abf06 commit b6966ed

File tree

4 files changed

+258
-250
lines changed

4 files changed

+258
-250
lines changed

css/main.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ header .search form input[type='submit'] {
465465
#main .row .data img {
466466
position: absolute;
467467
z-index: 2;
468-
right: 30%;
468+
right: 35%;
469469
opacity: 0.6;
470470
width: 46px;
471471
height: 84px;
@@ -878,13 +878,13 @@ header .search form input[type='submit'] {
878878
}
879879
#main .data .left {
880880
float: left;
881-
width: 65%;
881+
width: 60%;
882882
padding-left: 5px;
883883
}
884884
#main .data .right {
885885
float: right;
886886
padding-right: 10px;
887-
width: 25%;
887+
width: 30%;
888888
}
889889
#main .data dl > dt {
890890
color: #000;

js/tracker.js

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@ var plot_options = {
116116
]
117117
};
118118

119-
//hide PWA taskbar count
120-
navigator.clearAppBadge();
121-
122119
// aprs overlay (not used)
123120
var overlayARPS = new L.tileLayer('http://{s}.tiles.tracker.habhub.org/aprs/tile_{z}_{x}_{y}.png', {
124121
subdomains: 'abc',
@@ -1138,8 +1135,14 @@ function updateVehicleInfo(vcallsign, newPosition) {
11381135
// style="top:80px"
11391136
// if (vehicle["vehicle_type"] == "car") {
11401137
if (elm.length === 0) {
1141-
$('.portrait').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1142-
$('.landscape').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1138+
if (vehicle.vehicle_type!="car") {
1139+
$('.portrait').prepend('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1140+
$('.landscape').prepend('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1141+
} else {
1142+
$('.portrait').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1143+
$('.landscape').append('<div class="row vehicle'+vehicle.uuid+'" data-vcallsign="'+vcallsign+'"></div>');
1144+
}
1145+
11431146

11441147

11451148
} else if(elm.attr('data-vcallsign') === undefined) {
@@ -1271,7 +1274,11 @@ function updateVehicleInfo(vcallsign, newPosition) {
12711274
// redraw canvas
12721275
if(wvar.mode != "Position" && vehicle.graph_data.length) {
12731276
var can = $('.vehicle'+vehicle.uuid+' .graph');
1274-
drawAltitudeProfile(can.get(0), can.get(1), vehicle.graph_data[0], vehicle.max_alt);
1277+
if (vehicle.vehicle_type!="car") {
1278+
drawAltitudeProfile(can.get(0), can.get(1), vehicle.graph_data[0], vehicle.max_alt, true);
1279+
} else {
1280+
drawAltitudeProfile(can.get(0), can.get(1), vehicle.graph_data[0], vehicle.max_alt, true);
1281+
}
12751282
}
12761283

12771284
// mark vehicles as redrawn
@@ -1422,7 +1429,7 @@ function updatePolyline(vcallsign, flag) {
14221429
}
14231430
}
14241431

1425-
function drawAltitudeProfile(c1, c2, series, alt_max) {
1432+
function drawAltitudeProfile(c1, c2, series, alt_max, chase) {
14261433
alt_max = (alt_max < 2000) ? 2000 : alt_max;
14271434
var alt_list = series.data;
14281435
var len = alt_list.length;
@@ -1443,12 +1450,21 @@ function drawAltitudeProfile(c1, c2, series, alt_max) {
14431450
c1.attr('width', cw1).attr('height', ch1);
14441451
c2.attr('width', cw2).attr('height', ch2);
14451452

1446-
ctx1.fillStyle = "#d6f0f9";
1447-
ctx1.lineWidth = 2 * ratio;
1448-
ctx1.strokeStyle= "#33B5F5";
1449-
ctx2.fillStyle = "#d6f0f9";
1450-
ctx2.lineWidth = 2 * ratio;
1451-
ctx2.strokeStyle= "#33B5F5";
1453+
if (chase) {
1454+
ctx1.fillStyle = "#d6f0f9";
1455+
ctx1.lineWidth = 2 * ratio;
1456+
ctx1.strokeStyle= "#33B5F5";
1457+
ctx2.fillStyle = "#d6f0f9";
1458+
ctx2.lineWidth = 2 * ratio;
1459+
ctx2.strokeStyle= "#33B5F5";
1460+
} else {
1461+
ctx1.fillStyle = "#f9d6d6";
1462+
ctx1.lineWidth = 2 * ratio;
1463+
ctx1.strokeStyle= "#f53333";
1464+
ctx2.fillStyle = "#f9d6d6";
1465+
ctx2.lineWidth = 2 * ratio;
1466+
ctx2.strokeStyle= "#f53333";
1467+
}
14521468

14531469
var xt1 = (cw1 - (2 * ratio)) / real_len;
14541470
var yt1 = (ch1 - (6 * ratio)) / alt_max;
@@ -2611,7 +2627,11 @@ function refresh() {
26112627
var mode = wvar.mode.toLowerCase();
26122628
mode = (mode == "position") ? "latest" : mode.replace(/ /g,"");
26132629

2614-
var data_str = "mode="+mode+"&type=positions&format=json&max_positions=" + max_positions + "&position_id=" + position_id + "&vehicles=" + encodeURIComponent(wvar.query);
2630+
if (wvar.query) {
2631+
var data_str = "mode=3days&type=positions&format=json&max_positions=" + max_positions + "&position_id=0&vehicles=" + encodeURIComponent(wvar.query);
2632+
} else {
2633+
var data_str = "mode="+mode+"&type=positions&format=json&max_positions=" + max_positions + "&position_id=" + position_id + "&vehicles=" + encodeURIComponent(wvar.query);
2634+
}
26152635

26162636
ajax_positions = $.ajax({
26172637
type: "GET",
@@ -2652,11 +2672,6 @@ function refresh() {
26522672
document.getElementById("timeperiod").disabled = false;
26532673
}
26542674
clearTimeout(periodical);
2655-
if (Object.keys(vehicles).length > 1) {
2656-
navigator.setAppBadge(Object.keys(vehicles).length); //show number of vehicles on PWA taskbar
2657-
} else {
2658-
navigator.clearAppBadge(); //hide
2659-
}
26602675
periodical = setTimeout(refresh, timer_seconds * 1000);
26612676
}
26622677
});

0 commit comments

Comments
 (0)