22var is_mobile = false ;
33
44if (
5- navigator . userAgent . match ( / A n d r o i d / i)
6- || navigator . userAgent . match ( / i P h o n e / i)
7- || navigator . userAgent . match ( / i P o d / i)
8- || navigator . userAgent . match ( / i P a d / i)
9- || navigator . userAgent . match ( / W i n d o w s P h o n e / i)
10- || navigator . userAgent . match ( / w e b O S / i)
11- || navigator . userAgent . match ( / B l a c k B e r r y / i)
5+ navigator . userAgent . match ( / A n d r o i d / i) ||
6+ navigator . userAgent . match ( / i P h o n e / i) ||
7+ navigator . userAgent . match ( / i P o d / i) ||
8+ navigator . userAgent . match ( / i P a d / i) ||
9+ navigator . userAgent . match ( / W i n d o w s P h o n e / i) ||
10+ navigator . userAgent . match ( / w e b O S / i) ||
11+ navigator . userAgent . match ( / B l a c k B e r r y / i)
1212 ) is_mobile = true ;
1313
1414// wvar detection
@@ -23,7 +23,8 @@ var wvar = {
2323 latestonly : is_mobile ,
2424 focus : "" ,
2525 docid : ""
26- }
26+ } ;
27+
2728var params = window . location . search . substring ( 1 ) . split ( '&' ) ;
2829
2930for ( var idx in params ) {
@@ -62,14 +63,14 @@ var loadComplete = function(e) {
6263 // swapCache may throw exception if the isn't a previous cache
6364 try {
6465 window . applicationCache . swapCache ( ) ;
65- } catch ( e ) { }
66+ } catch ( v ) { }
6667
6768 window . location . reload ( ) ;
6869 return ;
6970 }
7071
7172 $ ( '#loading .complete' ) . stop ( true , true ) . animate ( { width : 200 } , { complete : trackerInit } ) ;
72- }
73+ } ;
7374
7475var hysplit = { } ;
7576var hysplit_data = { } ;
@@ -94,7 +95,7 @@ var refresh_hysplit = function() {
9495
9596 if ( refresh ) refreshUI ( ) ;
9697 } ) ;
97- }
98+ } ;
9899
99100// loads the tracker interface
100101function trackerInit ( ) {
@@ -140,7 +141,7 @@ var GPS_alt = null;
140141var GPS_speed = null ;
141142var CHASE_enabled = null ;
142143var CHASE_listenerSent = false ;
143- var CHASE_timer = 0
144+ var CHASE_timer = 0 ;
144145var callsign = "" ;
145146
146147function checkSize ( ) {
@@ -228,9 +229,9 @@ var positionUpdateHandle = function(position) {
228229 var hours = Math . floor ( delta_ts / 3600 ) ;
229230 var minutes = Math . floor ( delta_ts / 60 ) % 60 ;
230231 var ts_str = ( delta_ts >= 60 ) ?
231- ( ( hours ) ?hours + 'h ' :'' )
232- + ( ( minutes ) ?minutes + 'm' :'' )
233- + ' ago'
232+ ( ( hours ) ?hours + 'h ' :'' ) +
233+ ( ( minutes ) ?minutes + 'm' :'' ) +
234+ ' ago'
234235 : 'just now' ;
235236 $ ( '#cc_timestamp' ) . text ( ts_str ) ;
236237 } , 30000 ) ;
@@ -239,12 +240,13 @@ var positionUpdateHandle = function(position) {
239240 }
240241
241242 // save position and update only if different is available
242- if ( CHASE_timer < ( new Date ( ) ) . getTime ( )
243- && (
244- GPS_lat != lat
245- || GPS_lon != lon
246- || GPS_alt != alt
247- || GPS_speed != speed )
243+ if ( CHASE_timer < ( new Date ( ) ) . getTime ( ) &&
244+ (
245+ GPS_lat != lat ||
246+ GPS_lon != lon ||
247+ GPS_alt != alt ||
248+ GPS_speed != speed
249+ )
248250 )
249251 {
250252 GPS_lat = lat ;
@@ -255,7 +257,7 @@ var positionUpdateHandle = function(position) {
255257 $ ( '#cc_timestamp' ) . text ( 'just now' ) ;
256258
257259 // update look angles once we get position
258- if ( follow_vehicle != null ) { update_lookangles ( follow_vehicle ) ; }
260+ if ( follow_vehicle !== null ) { update_lookangles ( follow_vehicle ) ; }
259261
260262 if ( CHASE_enabled ) {
261263 ChaseCar . updatePosition ( callsign , position ) ;
@@ -292,12 +294,12 @@ var positionUpdateHandle = function(position) {
292294 $('#app_name b').html('mobile<br/>tracker');
293295 });
294296 */
295- }
297+ } ;
296298
297299var twoZeroPad = function ( n ) {
298300 n = String ( n ) ;
299301 return ( n . length < 2 ) ? '0' + n : n ;
300- }
302+ } ;
301303
302304// updates timebox
303305var updateTimebox = function ( date ) {
@@ -322,7 +324,7 @@ var updateTimebox = function(date) {
322324 z = date . getTimezoneOffset ( ) / - 60 ;
323325
324326 elm . find ( ".local" ) . text ( "Local: " + a + '-' + b + '-' + c + ' ' + e + ':' + f + ':' + g + " UTC" + ( ( z < 0 ) ?"-" :"+" ) + z ) ;
325- }
327+ } ;
326328
327329var format_time_friendly = function ( start , end ) {
328330 var dt = Math . floor ( ( end - start ) / 1000 ) ;
@@ -337,7 +339,7 @@ var format_time_friendly = function(start, end) {
337339 dt = Math . floor ( dt / 3600 ) ;
338340 return Math . floor ( dt / 24 ) + 'd ' + ( dt % 24 ) + 'h' ;
339341 }
340- }
342+ } ;
341343
342344// runs every second
343345var updateTime = function ( date ) {
@@ -346,7 +348,7 @@ var updateTime = function(date) {
346348 if ( elm . length > 0 ) updateTimebox ( date ) ;
347349
348350 // update friendly delta time fields
349- var elm = $ ( ".friendly-dtime" ) ;
351+ elm = $ ( ".friendly-dtime" ) ;
350352 if ( elm . length > 0 ) {
351353 var now = new Date ( ) . getTime ( ) ;
352354
@@ -357,7 +359,7 @@ var updateTime = function(date) {
357359 if ( str ) e . text ( str + ' ago' ) ;
358360 } ) ;
359361 }
360- }
362+ } ;
361363
362364
363365$ ( window ) . ready ( function ( ) {
@@ -373,18 +375,18 @@ $(window).ready(function() {
373375 listScroll = new iScroll ( 'main' , { hScrollbar : false , hScroll : false , snap : false , scrollbarClass : 'scrollStyle' } ) ;
374376
375377 $ ( '#telemetry_graph' ) . on ( 'click' , '.graph_label' , function ( ) {
376- var e = $ ( this ) ;
378+ var e = $ ( this ) , h ;
377379 if ( e . hasClass ( 'active' ) ) {
378380 e . removeClass ( 'active' ) ;
379- var h = $ ( '#map' ) . height ( ) + $ ( '#telemetry_graph' ) . height ( ) ;
381+ h = $ ( '#map' ) . height ( ) + $ ( '#telemetry_graph' ) . height ( ) ;
380382
381383 plot_open = false ;
382384
383385 //analytics
384386 if ( typeof _gaq == 'object' ) _gaq . push ( [ '_trackEvent' , 'UI' , 'Collapse' , 'Telemetry Graph' ] ) ;
385387 } else {
386388 e . addClass ( 'active' ) ;
387- var h = $ ( '#map' ) . height ( ) - $ ( '#telemetry_graph' ) . height ( ) ;
389+ h = $ ( '#map' ) . height ( ) - $ ( '#telemetry_graph' ) . height ( ) ;
388390
389391 plot_open = true ;
390392
@@ -394,7 +396,7 @@ $(window).ready(function() {
394396 $ ( '#map' ) . stop ( null , null ) . animate ( { 'height' : h } , function ( ) {
395397 if ( map ) google . maps . event . trigger ( map , 'resize' ) ;
396398
397- if ( plot_open && follow_vehicle != null && vehicles [ follow_vehicle ] . graph_data_updated ) updateGraph ( follow_vehicle , true ) ;
399+ if ( plot_open && follow_vehicle !== null && vehicles [ follow_vehicle ] . graph_data_updated ) updateGraph ( follow_vehicle , true ) ;
398400 } ) ;
399401 } ) ;
400402
@@ -430,7 +432,7 @@ $(window).ready(function() {
430432 // hand cursor for dragging the vehicle list
431433 $ ( "#main" ) . on ( "mousedown" , ".row" , function ( ) {
432434 $ ( "#main" ) . addClass ( "drag" ) ;
433- } )
435+ } ) ;
434436 $ ( "body" ) . on ( "mouseup" , function ( ) {
435437 $ ( "#main" ) . removeClass ( "drag" ) ;
436438 } ) ;
@@ -463,7 +465,7 @@ $(window).ready(function() {
463465 listScroll . refresh ( ) ;
464466
465467 // disable following only we are collapsing the followed vehicle
466- if ( follow_vehicle != null && follow_vehicle == e . attr ( 'data-vcallsign' ) ) {
468+ if ( follow_vehicle !== null && follow_vehicle == e . attr ( 'data-vcallsign' ) ) {
467469 stopFollow ( ) ;
468470 }
469471 } else {
@@ -506,7 +508,7 @@ $(window).ready(function() {
506508 if ( typeof _gaq == 'object' ) _gaq . push ( [ '_trackEvent' , 'UI Menubar' , 'Open Page' , pretty_name ] ) ;
507509 }
508510 checkSize ( ) ;
509- } )
511+ } ) ;
510512
511513 // toggle functionality for switch button
512514 $ ( "#sw_chasecar" ) . click ( function ( ) {
@@ -670,7 +672,7 @@ $(window).ready(function() {
670672
671673 try {
672674 applicationCache . update ( ) ;
673- } catch ( e ) {
675+ } catch ( v ) {
674676 force_check_cache = false ;
675677 alert ( "There is no applicationCache available" ) ;
676678 }
@@ -762,13 +764,13 @@ $(window).ready(function() {
762764 var id = switches [ i ] [ 0 ] ;
763765 var name = switches [ i ] [ 1 ] ;
764766
765- var html = '<div class="row option">'
766- + '<span><b>' + name + '</b></span>'
767- + '<div class="switch off" id="sw_weather_' + id + '">'
768- + '<span class="thumb"></span>'
769- + '<input type="checkbox" id="opt_weather_' + id + '">'
770- + '</div>'
771- + '</div>' ;
767+ var html = '<div class="row option">' +
768+ '<span><b>' + name + '</b></span>' +
769+ '<div class="switch off" id="sw_weather_' + id + '">' +
770+ '<span class="thumb"></span>' +
771+ '<input type="checkbox" id="opt_weather_' + id + '">' +
772+ '</div>' +
773+ '</div>' ;
772774
773775 elm . append ( html ) ;
774776 }
0 commit comments