@@ -342,7 +342,8 @@ function updateVehicleInfo(index, position) {
342342
343343 }
344344
345- var ascent_text = position . gps_alt != 0 ? vehicles [ index ] . ascent_rate . toFixed ( 1 ) + ' m/s' : '' ;
345+ var imp = offline . get ( 'opt_imperial' ) ;
346+ var ascent_text = imp ? ( vehicles [ index ] . ascent_rate * 196.850394 ) . toFixed ( 1 ) + ' ft/min' : vehicles [ index ] . ascent_rate . toFixed ( 1 ) + ' m/s' ;
346347
347348 var coords_text ;
348349 var ua = navigator . userAgent . toLowerCase ( ) ;
@@ -358,6 +359,8 @@ function updateVehicleInfo(index, position) {
358359 } else {
359360 coords_text = roundNumber ( position . gps_lat , 6 ) + ', ' + roundNumber ( position . gps_lon , 6 ) ;
360361 }
362+
363+
361364 // start
362365 var a = '<div class="header"><span>' + vehicle_names [ index ] + '</span><i class="arrow"></i></div>'
363366 + '<div class="data">'
@@ -382,13 +385,13 @@ function updateVehicleInfo(index, position) {
382385 + '</div>' // left
383386 + '<div class="right">'
384387 + '<dl>'
385- + '<dt>' + ascent_text + '</dt><dd>rate</dd>'
386- + '<dt>' + position . gps_alt + ' m </dt><dd>altitude</dd>'
387- + '<dt>' + vehicles [ index ] . max_alt + ' m </dt><dd>max alt</dd>'
388+ + ( position . gps_alt != 0 ? '<dt>' + ascent_text + '</dt><dd>rate</dd>' : '' )
389+ + '<dt>' + ( ( imp ) ? parseInt ( 3.2808399 * position . gps_alt ) + ' ft' : position . gps_alt + ' m' ) + ' </dt><dd>altitude</dd>'
390+ + '<dt>' + ( ( imp ) ? parseInt ( 3.2808399 * vehicles [ index ] . max_alt ) + ' ft' : vehicles [ index ] . max_alt + ' m' ) + ' </dt><dd>max alt</dd>'
388391 + '' ;
389392 // mid for landscape
390- var l = '<dt>' + ascent_text + '</dt><dd>rate</dd>'
391- + '<dt>' + position . gps_alt + 'm ('+ vehicles [ index ] . max_alt + 'm )</dt><dd>altitude (max)</dd>'
393+ var l = ( position . gps_alt != 0 ? '<dt>' + ascent_text + '</dt><dd>rate</dd>' : '' )
394+ + '<dt>' + ( ( imp ) ? parseInt ( 3.2808399 * position . gps_alt ) + 'ft' : position . gps_alt + 'm' ) + ' ('+ ( ( imp ) ? parseInt ( 3.2808399 * vehicles [ index ] . max_alt ) + 'ft' : vehicles [ index ] . max_alt + 'm' ) + ' )</dt><dd>altitude (max)</dd>'
392395 + '<dt>' + position . gps_time + '</dt><dd>datetime</dd>'
393396 + '<dt>' + coords_text + '</dt><dd>coordinates</dd>'
394397 + habitat_data ( position . data )
@@ -906,6 +909,12 @@ function updatePredictions(r) {
906909 }
907910}
908911
912+ function refreshUI ( ) {
913+ for ( var i = 0 , ii = vehicle_names . length ; i < ii ; i ++ ) {
914+ updateVehicleInfo ( i , vehicles [ i ] . curr_position ) ;
915+ }
916+ }
917+
909918var status = "" ;
910919
911920function update ( response ) {
@@ -941,7 +950,7 @@ function update(response) {
941950 lastPPointer . push ( vehicles [ vehicle_index ] . curr_position ) ;
942951 }
943952
944- // store the in localStorage
953+ // store in localStorage
945954 offline . set ( 'positions' , lastPositions ) ;
946955
947956 if ( follow_vehicle != - 1 ) {
0 commit comments