@@ -107,21 +107,25 @@ function load_hash(no_refresh) {
107107
108108 switch ( k ) {
109109 case "mt" :
110- if ( baseMaps . hasOwnProperty ( v ) ) {
110+ if ( baseMaps . hasOwnProperty ( v ) && map ) {
111111 map . removeLayer ( baseMaps [ selectedLayer ] ) ;
112112 selectedLayer = v ;
113113 map . addLayer ( baseMaps [ v ] ) ;
114114 }
115115 break ;
116116 case "mz" :
117- map . setZoom ( parseInt ( v ) ) ;
117+ if ( map ) {
118+ map . setZoom ( parseInt ( v ) ) ;
119+ }
118120 break ;
119121 case "mc" :
120122 def . zoom = false ;
121123 manual_pan = true ;
122124 v = v . split ( ',' ) ;
123125 var latlng = new L . LatLng ( v [ 0 ] , v [ 1 ] ) ;
124- map . panTo ( latlng ) ;
126+ if ( map ) {
127+ map . panTo ( latlng ) ;
128+ }
125129 break ;
126130 case "f" :
127131 refocus = ( follow_vehicle != v ) ;
@@ -157,34 +161,36 @@ function load_hash(no_refresh) {
157161 if ( wvar [ k ] != def [ k ] ) refresh = true ;
158162 } ) ;
159163
160- if ( wvar [ "box" ] != def [ "box" ] ) {
161- if ( ! def [ "box" ] ) {
162- $ ( ".flatpage" ) . hide ( )
163- } else {
164- $ ( ".flatpage" ) . hide ( )
165- $ ( "#" + def [ "box" ] ) . show ( )
166- }
167- checkSize ( ) ;
168- wvar [ "box" ] = def [ "box" ] ;
169-
170- }
164+
171165
172166 $ . extend ( true , wvar , def ) ;
167+ if ( map ) {
168+ if ( wvar [ "box" ] != def [ "box" ] ) {
169+ if ( ! def [ "box" ] ) {
170+ $ ( ".flatpage" ) . hide ( )
171+ } else {
172+ $ ( ".flatpage" ) . hide ( )
173+ $ ( "#" + def [ "box" ] ) . show ( )
174+ }
175+ checkSize ( ) ;
176+ wvar [ "box" ] = def [ "box" ] ;
177+
178+ }
179+ // force refresh
180+ if ( ! no_refresh ) {
181+ if ( refresh ) {
182+ zoomed_in = false ;
183+ clean_refresh ( wvar . mode , true ) ;
184+ }
185+ else if ( refocus ) {
186+ $ ( ".row.active" ) . removeClass ( 'active' ) ;
187+ $ ( ".vehicle" + vehicles [ wvar . focus ] . uuid ) . addClass ( 'active' ) ;
188+ followVehicle ( wvar . focus , manual_pan , true ) ;
189+ }
190+ }
173191
174- // force refresh
175- if ( ! no_refresh ) {
176- if ( refresh ) {
177- zoomed_in = false ;
178- clean_refresh ( wvar . mode , true ) ;
179- }
180- else if ( refocus ) {
181- $ ( ".row.active" ) . removeClass ( 'active' ) ;
182- $ ( ".vehicle" + vehicles [ wvar . focus ] . uuid ) . addClass ( 'active' ) ;
183- followVehicle ( wvar . focus , manual_pan , true ) ;
184- }
192+ lhash_update ( ) ;
185193 }
186-
187- lhash_update ( ) ;
188194}
189195window . onhashchange = load_hash ;
190196
@@ -220,6 +226,8 @@ for(var idx in params) {
220226function trackerInit ( ) {
221227 // update current position if we geolocation is available
222228 if ( currentPosition ) updateCurrentPosition ( currentPosition . lat , currentPosition . lon ) ;
229+
230+
223231
224232 if ( currentPosition && manual_pan == false ) {
225233 coords = [ currentPosition . lat , currentPosition . lon ]
@@ -230,6 +238,9 @@ function trackerInit() {
230238 $ ( 'header,#main' ) . show ( ) ; // interface elements
231239 checkSize ( ) ;
232240
241+ // if we there is enough screen space open aboutbox on startup
242+ if ( ! is_mobile && ! offline . get ( 'opt_nowelcome' ) && $ ( window ) . width ( ) > 900 ) $ ( '.nav li.about' ) . click ( ) ;
243+
233244
234245 if ( is_mobile || wvar . enabled ) $ ( ".nav .wvar" ) . hide ( ) ;
235246
@@ -1094,6 +1105,6 @@ function update_countdown(){
10941105
10951106check_version ( )
10961107update_check = setInterval ( check_version , 15 * 60 * 1000 )
1097-
1098- startAjax ( )
1108+ load_hash ( ) ;
1109+ startAjax ( ) ;
10991110load ( ) ;
0 commit comments