Skip to content

Commit 71a67d3

Browse files
authored
Merge pull request #383 from projecthorus/testing
fix up about page and duration length
2 parents ebdc2a0 + 1fd4be4 commit 71a67d3

File tree

2 files changed

+41
-32
lines changed

2 files changed

+41
-32
lines changed

js/app.js

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}
189195
window.onhashchange = load_hash;
190196

@@ -220,6 +226,8 @@ for(var idx in params) {
220226
function 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

10951106
check_version()
10961107
update_check = setInterval(check_version, 15 * 60 * 1000)
1097-
1098-
startAjax()
1108+
load_hash();
1109+
startAjax();
10991110
load();

js/sondehub.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,9 +1144,7 @@ function load() {
11441144
}
11451145
});
11461146

1147-
// if we there is enough screen space open aboutbox on startup
1148-
if(!is_mobile && !offline.get('opt_nowelcome') && $(window).width() > 900) $('.nav li.about').click();
1149-
1147+
11501148
}, 500);
11511149
}
11521150

0 commit comments

Comments
 (0)