@@ -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 ( / v e h i c l e ( \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 ( / v e h i c l e ( \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 ( / v e h i c l e ( \d + ) / ) [ 1 ] ) ) ;
483+ followVehicle ( e . attr ( 'data-vcallsign' ) ) ;
483484 }
484485 } ) ;
485486
0 commit comments