Skip to content

Commit a71ede5

Browse files
restructured vehicles code, no longer array object
1 parent 8ec920b commit a71ede5

File tree

4 files changed

+168
-135
lines changed

4 files changed

+168
-135
lines changed

embed-preview.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@
102102
var p = $("iframe").contents()[0].defaultView;
103103

104104
if(elm.prop("checked")) {
105-
p.embed.vlist = true;
105+
p.wvar.vlist = true;
106106
elm.prop("checked", true);
107107
} else {
108-
p.embed.vlist = false;
108+
p.wvar.vlist = false;
109109
elm.prop("checked", false);
110110
}
111111

js/app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ var positionUpdateHandle = function(position) {
255255
$('#cc_timestamp').text('just now');
256256

257257
// update look angles once we get position
258-
if(follow_vehicle > -1) { update_lookangles(follow_vehicle); }
258+
if(follow_vehicle != null) { update_lookangles(follow_vehicle); }
259259

260260
if(CHASE_enabled) {
261261
ChaseCar.updatePosition(callsign, position);
@@ -394,7 +394,7 @@ $(window).ready(function() {
394394
$('#map').stop(null,null).animate({'height': h}, function() {
395395
if(map) google.maps.event.trigger(map, 'resize');
396396

397-
if(plot_open && follow_vehicle != -1 && vehicles[follow_vehicle].graph_data_updated) updateGraph(follow_vehicle, true);
397+
if(plot_open && follow_vehicle != null && vehicles[follow_vehicle].graph_data_updated) updateGraph(follow_vehicle, true);
398398
});
399399
});
400400

@@ -406,7 +406,7 @@ $(window).ready(function() {
406406
event.stopPropagation();
407407

408408
var elm = $(this);
409-
var name = vehicle_names[elm.attr('data-index')]
409+
var name = elm.attr('data-vcallsign');
410410

411411
if(elm.hasClass("active")) {
412412
elm.removeClass('active');
@@ -448,7 +448,8 @@ $(window).ready(function() {
448448
// follow vehicle by clicking on data
449449
$('#main').on('click', '.row .data', function() {
450450
var e = $(this).parent();
451-
followVehicle(parseInt(e.attr('class').match(/vehicle(\d+)/)[1]));
451+
452+
followVehicle(e.attr('data-vcallsign'));
452453
});
453454

454455
// expand/collapse data when header is clicked
@@ -462,7 +463,7 @@ $(window).ready(function() {
462463
listScroll.refresh();
463464

464465
// disable following only we are collapsing the followed vehicle
465-
if(follow_vehicle == parseInt(e.attr('class').match(/vehicle(\d+)/)[1])) {
466+
if(follow_vehicle != null && follow_vehicle == e.attr('data-vcallsign')) {
466467
stopFollow();
467468
}
468469
} else {
@@ -479,7 +480,7 @@ $(window).ready(function() {
479480
}
480481

481482
// pan to selected vehicle
482-
followVehicle(parseInt(e.attr('class').match(/vehicle(\d+)/)[1]));
483+
followVehicle(e.attr('data-vcallsign'));
483484
}
484485
});
485486

js/plot_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function updateLegend() {
7272
}
7373
}
7474

75-
if(follow_vehicle != -1 && vehicles[follow_vehicle].positions.length) {
75+
if(follow_vehicle != null && vehicles[follow_vehicle].positions.length) {
7676
// adjust index for null data points
7777
var null_count = 0;
7878
var data_ref = vehicles[follow_vehicle].graph_data[0];

0 commit comments

Comments
 (0)