summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Baines <cb15g11@soton.ac.uk>2014-09-01 22:00:31 +0100
committerChristopher Baines <cb15g11@soton.ac.uk>2014-09-01 22:00:31 +0100
commitafe8e55ce120743983f8b6c4fc411d609ad73f6a (patch)
treecefae089593c8a774a4326b840212fdcd2a38153 /src
parentae935ace2ae7658b14445768b869cc32b38fa162 (diff)
downloadleaflet-soton-afe8e55ce120743983f8b6c4fc411d609ad73f6a.tar
leaflet-soton-afe8e55ce120743983f8b6c4fc411d609ad73f6a.tar.gz
Fix interactive bus stops
They previously only worked if the bus routes were displayed. This commit also checks for the existance of the route and sidebar classes before attempting to use them.
Diffstat (limited to 'src')
-rw-r--r--src/leaflet-soton.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js
index 98a4f09..3cbb300 100644
--- a/src/leaflet-soton.js
+++ b/src/leaflet-soton.js
@@ -470,7 +470,7 @@ SELECT * WHERE {\
layer.addData(data[layerName]);
}
- if (options.busRoutes) {
+ if ("Route" in L) {
var routeLayer = new L.Route(options.busRoutes ? data.busRoutes : emptyFeatureCollection, data.busStops, {
routeOptions: {
onEachFeature: function(feature, layer) {
@@ -494,7 +494,7 @@ SELECT * WHERE {\
});
routeLayer.addTo(map);
- if (options.busRouteControl) {
+ if (options.busRoutes && options.busRouteControl) {
var routeControl = new L.Control.Route(routeLayer, "sidebar", {
routeMasterSort: function(a, b) {
var refs = {