forked from cyclestreets/cyclescape-issuemap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
554 lines (477 loc) · 20.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Cyclescape Issues Map</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.mapbox.com/mapbox.js/v2.4.0/mapbox.js'></script>
<script src='https://api.mapbox.com/mapbox.js/plugins/leaflet-label/v0.2.1/leaflet.label.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v2.2.3/mapbox.css' rel='stylesheet' />
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-label/v0.2.1/leaflet.label.css' rel='stylesheet' />
<script src="scripts/leaflet-messagebox.js"></script>
<script src="scripts/leaflet.groupedlayercontrol.js"></script>
<script src="scripts/utilities.js"></script>
<script src="config.js"></script>
<link href='css/leaflet-messagebox.css' rel='stylesheet' />
<link href='css/leaflet.groupedlayercontrol.min.css' rel='stylesheet' />
<link href="css/style-overrides.css" rel='stylesheet' />
<style>
body { margin:0; padding:0;}
#map { position:absolute; top:0; bottom:0; width:100%;overflow:hidden}
</style>
</head>
<body onload="main()">
<div id='map'></div>
<script>
/* Cyclescape Issue Map Application
Version 0.5, September 2016
Author: George Coulouris (with an acknowledgement to Alex Ingram for the prototype)
Permission to use: MIT licence (http://choosealicense.com/licenses/mit)
*/
/* Constants */
deadlineWidth = 12;
noDeadlineWidth = 5;
rolloverWidth = 20;
lineOpacity = 0.5;
rolloverOpacity = 1;
dashArray = '1, 20';
thickDashArray = '15, 5';
thinDashArray = '10, 5';
areaFill = 0.15;
areaFillColor = 'gray';
circleMarkerRadius = 10;
var deadlines = [];
cyclescapeApiUrl = "http://www.cyclescape.org/api/issues/?order=size";
L.mapbox.accessToken = 'pk.eyJ1IjoibnV0dHl4YW5kZXIiLCJhIjoiOGJXbjNMWSJ9.ckqRbehjO-rU86vPSGzMpQ';
/*
Needed for access to the mapbox tile server only ?
L.mapbox.accessToken = null; // the code seems to work without the token even though
// it uses a couple of mapbox-specific functions
// but the token is needed to use the api.tiles.mapbox.com server
*/
function getUrlConfig() {
var title, center, configCenter = [], specialTag,
zoom, bbox, info, baseLayer, staleMargin, expiredMargin, showExpired, showStale,
categoryString, categories, overlaySpecs = [], auxOverlaySpecs = [];
if(title = urlParam('title')) config.mapTitle = title;
if(!(center = urlParam('center'))) center = urlParam('centre');
if(center) {
c = center.split(',');
configCenter[0] = parseFloat(c[0]); // convert string to float
configCenter[1] = parseFloat(c[1]); // convert string to float
config.mapCenter = configCenter
}
if(zoom = urlParam('zoom')) config.mapZoom = zoom;
if(baseLayer = urlParam('baselayer')) config.baseLayer = baseLayer;
if(bbox = urlParam('bbox')) config.bbox = bbox;
if(info = urlParam('info')) config.info = info;
if(staleMargin = urlParam('stalemargin')) config.staleMargin = staleMargin;
if(expiredMargin = urlParam('expiredmargin')) config.expiredMargin = expiredMargin;
if(showExpired = urlParam('showexpired')) config.showExpired = (showExpired == "true") ? true : false;
if(showStale = urlParam('showstale')) config.showStale = (showStale == "true") ? true : false;
function getSpecialTag (specialTag) {
var tag, name, otherName;
var specialTagFields = specialTag.split(':');
if(specialTagFields.length < 3) return null;
name = specialTagFields[1].split('*');
otherName = specialTagFields[2].split('*');
return {
'tag': '"' + specialTagFields[0] + '"',
'name': name[0],
'otherName': otherName[0],
'specialOnOff': (name.length>1)?'on':'off',
'otherOnOff': (otherName.length>1)?'on':'off'
};
}
if(!(specialTag1 = urlParam('specialtag1'))) specialTag1 = urlParam('filtertag1');
if(specialTag1)
config.firstMenu.specialTag = (specialTag1 == "none") ? null : getSpecialTag (specialTag1);
if(!(specialTag2 = urlParam('specialtag2'))) specialTag1 = urlParam('filtertag2');
if(specialTag2)
config.secondMenu.specialTag = (specialTag2 == "none") ? null : getSpecialTag (specialTag2);
if(!(categoryString = urlParam('categories'))) categoryString = urlParam('mainmenu');
if(categoryString) {
categories = categoryString.split('/');
if(categories.length > 0) {
for(var i in categories) {
overlaySpecs.push(processTags(categories[i]));
}
}
config.firstMenu.selectors = overlaySpecs
}
if(categoryString = urlParam('secondmenu')) {
if(categoryString == 'none') {
config.secondMenu = null;
} else {
var parts = categoryString.split(':');
if(parts.length > 1) {
config.secondMenu.name = parts[0];
categoryString = parts[1];
}
categories = categoryString.split('/');
if(categories.length > 0) {
for(var i in categories) {
auxOverlaySpecs.push(processTags(categories[i]));
}
}
config.secondMenu.selectors = auxOverlaySpecs;
}
}
}
// L.Browser.mobile = true; // force mobile mode for testing only
/* base map layers */
var mapboxAttribution = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
osmAttribution = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
cyclescapeAttribution = 'Issue data:<a href="http://blog.cyclescape.org/about/"> Cyclescape </a> | ',
cartoDbAttribution = 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Map tiles by CartoDB, under CC BY 3.0',
mapboxUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=' + L.mapbox.accessToken,
mapQuestUrl = 'http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png',
cartoDbLightUrl = 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png',
OSMUrl = "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
cycleMapUrl = 'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png';
mapnikBwUrl ='http://{s}.tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png';
// following URL found at http://korona.geog.uni-heidelberg.de/contact.html
// adminBoundariesUrl = 'http://129.206.66.245:8007/tms_b.ashx?x={x}&y={y}&z={z}';
adminBoundariesUrl = 'http://korona.geog.uni-heidelberg.de/tiles/adminb/x={x}&y={y}&z={z}';
var streets = L.tileLayer(mapboxUrl, {id: 'mapbox.streets',
attribution: L.Browser.mobile ? '' : cyclescapeAttribution + mapboxAttribution});
var cartoDbLight = L.tileLayer(cartoDbLightUrl,
{attribution: L.Browser.mobile ? '' : cyclescapeAttribution + cartoDbAttribution});
var mapQuest = L.tileLayer(mapQuestUrl,
{attribution: L.Browser.mobile ? '' : cyclescapeAttribution + osmAttribution});
var openStreetMap = L.tileLayer(OSMUrl,
{attribution: L.Browser.mobile ? '' : cyclescapeAttribution + osmAttribution, opacity:0.7});
var opencyclemap = L.tileLayer(cycleMapUrl,
{attribution: L.Browser.mobile ? '' : cyclescapeAttribution + osmAttribution, opacity:0.7});
var mapnik_BlackAndWhite = L.tileLayer(mapnikBwUrl,
{maxZoom: 18, attribution: L.Browser.mobile ? '' : cyclescapeAttribution + osmAttribution, opacity: 0.8});
var adminBoundaries = L.tileLayer(adminBoundariesUrl);
var thePopupOptions = {maxHeight: 300, maxWidth: 400, autoPan: true, className: "custom-popup"};
var UIOptions = {showStale: true, showExpired: true};
var baseLayers = {
"OSM": openStreetMap,
"Greyscale" : mapnik_BlackAndWhite,
"MapBox": streets,
"OpenCycleMap": opencyclemap
};
var baseOverlays = {
"Borough Boundaries" : adminBoundaries
};
var map, titleBoxControl, legendBoxControl, layerControl, deadlineListControl,
auxLayerControl, mapControl, theOverlays = [];
var ajaxCount = 0, initialOverlays = [];
function initialiseMap() {
var layer = config.baseLayer;
map = L.map('map', {
// map options
center: config.mapCenter,
zoom: config.mapZoom,
layers: [baseLayers[config.baseLayer] || streets, adminBoundaries],
// UI options
doubleClickZoom: false, // so rapid clicks on tickboxes don't zoom the map!
});
titleBoxControl = L.control.messagebox({position: 'topright', timeout: null}).addTo(map);
legendBoxControl = L.control.messagebox({position: 'bottomleft', timeout: null}).addTo(map);
// for displaying a list of issues with unexpired deadlines
deadlineListControl = L.control.messagebox({position: 'bottomleft', timeout: null}).addTo(map);
deadlineListControl.getContainer().classList.add('deadline-list-container');
layerControl = L.control.groupedLayers(null, null,
{collapsed: false, position: 'topright', groupCheckboxes: false,
title: config.firstMenu.name}).addTo(map);
if(config.secondMenu && ! L.Browser.mobile) {
auxLayerControl = L.control.groupedLayers(null, null,
{collapsed: true, position: 'topright', groupCheckboxes: true, title: config.secondMenu.name}).addTo(map);
}
mapControl = L.control.layers(baseLayers, baseOverlays, {collapsed: true, position: 'bottomright'}).addTo(map);
}
/* To invoke when a feature is represented by a single point */
function circleMarker(feature, latlng) {
return new L.CircleMarker(latlng, {radius: circleMarkerRadius});
}
/* To invoke when a feature is represented by a single point */
function iconMarker(feature, latlng) {
return new L.Marker(latlng, {});
}
/* Mouse Event handlers */
function featureHighlight(event) {
event.target.setStyle({opacity:rolloverOpacity});
}
function featureLowlight(event) {
event.target.setStyle(event.target.feature.issueStyle);
}
function defineStyle (aLayer) {
/*
Style depends on several parameters of features:
- thick solid line for issues with unexpired deadlines
- dashed thick line for issues with expired deadlines more than deadLineMargin days ago
- narrower solid line for issues without deadlines but with activity in the last staleMargin days
- narrower dashed line and no fill for issues with activity in the last staleMargin days
*/
var style = {fill: false, fillOpacity: areaFill, fillColor: areaFillColor,
weight: noDeadlineWidth, opacity: lineOpacity, lineCap: 'butt'};
if(aLayer.feature.geometry.type == 'Polygon') style.fill = true;
if(deadline = aLayer.feature.properties.deadline) {
style.weight = deadlineWidth;
if(datePassed(config.expiredMargin, deadline)) {
style.dashArray = thickDashArray;
}
}
if(latestActivity = aLayer.feature.properties.latest_activity_at) {
if(datePassed(config.staleMargin, latestActivity) || latestActivity==0) {
style.dashArray = thinDashArray;
}
}
return style;
}
/* called after each Cyclescape Issue is loaded */
function fixUp(event) {
var theOverlay = event.target;
var overlayGeojson = theOverlay.getGeoJSON();
for (i in overlayGeojson.features) {
var description, descriptionPrefix ='<table width=100%><tr>', descriptionPostfix = '', photo, deadline, deadlineDetails, external_url;
if ( photo = overlayGeojson.features[i].properties.photo_thumb_url) //assignment
descriptionPrefix +=
"<td><div class='thumbnail'><p align = 'left'><img width = 150 src = 'http://cyclescape.org/" + photo + "'</div></td>";
cyclescapeLink =
"<br/><div><a target= '_blank' href='" + overlayGeojson.features[i].properties.cyclescape_url + "'>" +
"<b>View discussions on Cyclescape</b></a></div>";
descriptionPrefix += '<td><div align = "right">' + cyclescapeLink;
description = "<div font-size = small>" + overlayGeojson.features[i].properties.description + '</div>';
if(external_url = overlayGeojson.features[i].properties.external_url) {
descriptionPrefix +=
"<a class='external' target='_blank' href='" + external_url +
"'><b>View consultation details</b></a><br/>";
}
if(deadline = overlayGeojson.features[i].properties.deadline) {
descriptionPrefix += '<b>Deadline: ' + customDateString(deadline) + '</b><br/>';
deadlineDetails = {
deadline: deadline,
title: overlayGeojson.features[i].properties.title,
external_url: external_url,
cyclescape_url: overlayGeojson.features[i].properties.cyclescape_url,
tags: overlayGeojson.features[i].properties.tags
}
deadlines.push(deadlineDetails);
}
descriptionPrefix += '</div></td></tr></table>';
if(creationDate = overlayGeojson.features[i].properties.created_at)
descriptionPostfix += '</b><i><b>Issue created:</b> ' + customDateString(creationDate);
if(author = overlayGeojson.features[i].properties.created_by)
descriptionPostfix += '<b> by:</b> ' + author;
if(latestActivity = overlayGeojson.features[i].properties.latest_activity_at)
descriptionPostfix += '<br/><b>Latest post:</b> ' + customDateString(latestActivity);
descriptionPostfix += '<br/><b>Tags:</b> '
var tags = overlayGeojson.features[i].properties.tags;
descriptionPostfix += tags[0];
for(j = 1; j < tags.length; j++) {
descriptionPostfix += ', ' + tags[j];
}
descriptionPostfix += '</i>';
overlayGeojson.features[i].properties.description =
descriptionPrefix + description + descriptionPostfix;
}
theOverlay.setGeoJSON(overlayGeojson);
theOverlay.setFilter(layerFilter);
// add the rollover labels to the features
theOverlay.eachLayer(function (layer) {
var labelContent = layer.feature.properties.title, deadline, latestActivity;
if(deadline = layer.feature.properties.deadline)
labelContent += '<br/><i><b>Deadline: ' + customDateString(deadline) + '</b></i>';
if(latestActivity = layer.feature.properties.latest_activity_at)
labelContent += '<br/><i>Latest post: ' + customDateString(latestActivity) + '</i>';
layer.feature.labelContent = labelContent;
layer.bindLabel(layer.feature.labelContent);
var style = defineStyle(layer);
layer.setStyle(style);
layer.feature.issueStyle = style;
layer.on('mouseover', featureHighlight);
layer.on('mouseout', featureLowlight);
}
);
ajaxCount -= 1;
if(ajaxCount == 0) allLayersReady();
}
function setUpOverlays(layerControl, menuSpec, options) {
var baseURL = cyclescapeApiUrl + '?order=size' + '&bbox=' + config.bbox;
var tagsUsed = [], otherFlag = false;
L.Util.setOptions(this, options);
for (var i in menuSpec.selectors) {
var spec = menuSpec.selectors[i];
var anOverlay;
var color = (this.options.coloursReversed) ?
colourTable[Math.abs(colourTable.length - i) % colourTable.length] :
colourTable[i % colourTable.length]; // % is modulo division
var returnedTags;
var aName = '<span class="leaflet-control-layer-menu-item" style= "color:' + color + '">' + spec.menuItem + '</span>';
var options = { popupOptions: thePopupOptions,
style: {color: color},
pointToLayer: circleMarker
};
// if(spec.menuItem == '<span class="leaflet-control-layer-menu-item">OTHER</>') {
if(spec.menuItem == 'OTHER') {
otherFlag = true;
break;
}
tagsUsed.push(spec.tags);
function setUp(specialTag, tags, excludedTags, initiallyOn, sectionName) {
var url = baseURL;
if(specialTag)
url += '&tags=[' + specialTag + (tags ? ',' + tags : '') +']';
else
url += tags ? '&tags=[' + tags +']' : '';
if(excludedTags) url += '&excluding_tags=[' + excludedTags + ']';
overlay = L.mapbox.featureLayer(null, options).loadURL(url);
ajaxCount += 1;
layerControl.addOverlay(overlay, aName, sectionName);
if(initiallyOn) initialOverlays.push(overlay);
overlay.on('ready', fixUp);
overlay.on('error', ajaxFailure);
theOverlays.push(overlay);
}
document.getElementById('map').style.cursor = 'wait';
if(menuSpec.specialTag) {
setUp(menuSpec.specialTag.tag, spec.tags, null,
(menuSpec.specialTag.specialOnOff=="on" && spec.onOff=="on"), menuSpec.specialTag.name);
setUp(null, spec.tags, menuSpec.specialTag.tag,
(menuSpec.specialTag.otherOnOff=="on" && spec.onOff=="on"), menuSpec.specialTag.otherName); // excluding the special tag
} else {
setUp(null, spec.tags, null, spec.onOff=="on", null);
}
}
// OTHER must go last
if(otherFlag) {
var allTags = "";
aName = '<span class="leaflet-control-layer-menu-item"><b>OTHER</b></span>';
for(i in tagsUsed) {
allTags += (i>0 ? ',' : '') + tagsUsed[i];
}
if(menuSpec.specialTag) {
setUp(menuSpec.specialTag.tag, null, allTags,
(menuSpec.specialTag.specialOnOff=="on"), menuSpec.specialTag.name);
setUp(null, null, allTags + ',' + menuSpec.specialTag.tag,
(menuSpec.specialTag.otherOnOff=="on"), menuSpec.specialTag.otherName); // excluding the special tag
} else {
setUp(null, null, allTags, true, null);
}
}
}
function ajaxFailure(event) {
alert('Failed to establish connection to Cyclescape server. Please try later.');
}
function allLayersReady() {
document.getElementById('map').style.cursor = 'default';
for(i in initialOverlays) map.addLayer(initialOverlays[i]);
if(!config.showExpired) document.getElementById("showExpired").click(); // turns off the "showExpired" option
if(!config.showStale) document.getElementById("showStale").click(); // turns off the "Show Stale" option
// make deadline list html
var deadlineListHtml = "<button id='closeButton'>X</button>" + "<h2>Upcoming and recent deadlines:</h2>";
deadlines.sort(function(a, b) {
return b.deadline - a.deadline;
});
for(i in deadlines) {
if(!datePassed(0, deadlines[i].deadline))
deadlineListHtml += deadLineHtml(deadlines[i]) + '<br/>';
else
break;
}
deadlineListHtml += '<hr/>';
for(i in deadlines) {
if(!datePassed(0, deadlines[i].deadline))
continue;
else if(!datePassed(config.expiredMargin, deadlines[i].deadline))
deadlineListHtml += '<i>' + deadLineHtml(deadlines[i]) + '</i><br/>';
else
break;
}
function deadLineHtml(deadlineRecord) {
var tags = deadlineRecord.tags.slice(0); // copy the elements of the array
for (i=tags.length-1; i>=0; i--) // remove 'consultation' tags
if(tags[i] == 'consultation') tags.splice(i,1);
return customDateString(deadlineRecord.deadline) + ': ' + deadlineRecord.title +
' (' + tags + ')<a class="external" target="_blank" href="' +
deadlineRecord.external_url + '"> Consultation' + '</a>' +
' | <a target="_blank" href="' +
deadlineRecord.cyclescape_url + '"> Discussion' + '</a>';
}
deadlineListControl.hide();
deadlineListControl.load( '<div id="deadline-list">' + deadlineListHtml + '</div>');
// close button for deadlineListControl
document.getElementById('closeButton').onclick =
function(e) {
deadlineListControl.hide();
};
}
function layerFilter(feature) {
var deadline, creationDate;
if(deadline = feature.properties.deadline) {
if(datePassed(config.expiredMargin, deadline))
return UIOptions.showExpired;
}
if(latestActivity = feature.properties.latest_activity_at) {
if(datePassed(config.staleMargin, latestActivity) || latestActivity==0 || feature.properties.closed) {
return UIOptions.showStale;
}
}
return true;
}
/* reset layer filters and handlers after a UI option change */
function setFilters(overlays) {
for( i in overlays) {
overlays[i].setFilter(layerFilter);
overlays[i].eachLayer(function (layer) {
layer.on('mouseover', featureHighlight);
layer.on('mouseout', featureLowlight);
layer.bindLabel(layer.feature.labelContent);
layer.setStyle(layer.feature.issueStyle);
});
}
}
function setStale(event) {
UIOptions.showStale = event.target.checked;
event.stopPropagation(event);
setFilters(theOverlays);
}
function setExpired(event) {
UIOptions.showExpired = event.target.checked;
event.stopPropagation(event);
setFilters(theOverlays);
}
function DeadlinesPopup() {
deadlineListControl.toggle();
}
function main() {
getUrlConfig(); // Get URL parameters to override the Default configuration (in config.js)
initialiseMap();
if(!L.Browser.mobile) {
titleBoxControl.show(config.mapTitle);
legendBoxControl.show(
'<div id = "legend-content-desktop" class = "legend-content">' +
'<img padding-top = 5 src = "images/Legend.png" align = "left">' +
'<div class="showExpired"><form><input id="showExpired" type="checkbox"/>Show</form></div>' +
'<div class="showStale"><nobr> >' + Math.round(config.staleMargin/30) +
' months<form><input id="showStale" type="checkbox"/>Show</form></nobr></div>' +
'<div class="infoLink"><a target="_blank" href="' + config.info + '">Further info</a></div>' +
'<div class="deadlineLink"><a href="#" onclick="DeadlinesPopup();return false;">Upcoming deadlines</a></div>' +
'</div>'
);
} else {
legendBoxControl.show(
'<div class = "legend-content-mobile">' +
'<div><form><input id="showExpired" type="checkbox"/>Show expired</form></div>' +
'<div ><form><input id="showStale" type="checkbox"/>Show stale</form></div>' +
'<div ><a target="_blank" href="' + config.info + '">Further info</a></div></div>'
);
}
// L.DomEvent.disableClickPropagation(document.getElementById('legend-content-desktop'));
document.getElementById("showStale").addEventListener ("click", setStale, false);
document.getElementById("showStale").checked=true;
document.getElementById("showExpired").addEventListener ("click", setExpired, false);
document.getElementById("showExpired").checked=true;
setUpOverlays(layerControl, config.firstMenu, {'coloursReversed': false});
if(auxLayerControl) setUpOverlays(auxLayerControl, config.secondMenu, {'coloursReversed': true});
}
</script>
</body>
</html>