@@ -436,6 +436,14 @@ function load() {
436436 overlay . draw = function ( ) { } ;
437437 overlay . setMap ( map ) ;
438438
439+ // status message boxes
440+ var statusElm = new google . maps . StatusTextControl ( {
441+ map : map ,
442+ position : google . maps . ControlPosition . RIGHT_BOTTOM ,
443+ text : "<span id='stText'></span><span> Updated: </span><i class='friendly-dtime' id='stTimer'>never</i>"
444+ } ) ;
445+
446+
439447 google . maps . event . addListener ( map , 'zoom_changed' , function ( ) {
440448 updateZoom ( ) ;
441449 } ) ;
@@ -494,10 +502,6 @@ function load() {
494502 if ( offline . get ( 'opt_layers_aprs' ) ) map . overlayMapTypes . setAt ( "1" , overlayAPRS ) ;
495503}
496504
497- function unload ( ) {
498- google . maps . Unload ( ) ;
499- }
500-
501505function panTo ( vcallsign ) {
502506 if ( ! vcallsign ) return ;
503507
@@ -2087,11 +2091,9 @@ function refresh() {
20872091 if ( ajax_inprogress ) {
20882092 periodical = setTimeout ( refresh , 2000 ) ;
20892093 }
2090- //status = '<img src="spinner.gif" width="16" height="16" alt="" /> Refreshing ...';
2091- //$('#status_bar').html(status);
20922094
2093- //if(typeof _gaq == 'object') _gaq.push(['_trackEvent', 'ajax', 'refresh', 'Vehicles'] );
2094- //
2095+ $ ( "#stText" ) . text ( "checking |" ) ;
2096+
20952097 var mode = wvar . mode . toLowerCase ( ) ;
20962098 mode = ( mode == "position" ) ? "latest" : mode . replace ( / / g, "" ) ;
20972099
@@ -2104,10 +2106,21 @@ function refresh() {
21042106 dataType : "json" ,
21052107 success : function ( response , textStatus ) {
21062108 ajax_inprogress = true ;
2109+ $ ( "#stText" ) . text ( "loading |" ) ;
2110+ response . fetch_timestamp = Date . now ( ) ;
21072111 update ( response ) ;
2112+ $ ( "#stText" ) . text ( "" ) ;
2113+ $ ( "#stTimer" ) . attr ( "data-timestamp" , response . fetch_timestamp ) ;
21082114 } ,
21092115 error : function ( ) {
2110- if ( ! zoomed_in && offline . get ( 'opt_offline' ) ) update ( offline . get ( 'positions' ) ) ;
2116+ $ ( "#stText" ) . text ( "error |" ) ;
2117+
2118+ if ( ! zoomed_in && offline . get ( 'opt_offline' ) ) {
2119+ var data = offline . get ( 'positions' ) ;
2120+ update ( data ) ;
2121+ $ ( "#stText" ) . text ( "no connection |" ) ;
2122+ $ ( "#stTimer" ) . attr ( "data-timestamp" , data . fetch_timestamp ) ;
2123+ }
21112124 } ,
21122125 complete : function ( request , textStatus ) {
21132126 periodical = setTimeout ( refresh , timer_seconds * 1000 ) ;
0 commit comments