From afe8e55ce120743983f8b6c4fc411d609ad73f6a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 1 Sep 2014 22:00:31 +0100 Subject: 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. --- src/leaflet-soton.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 = { -- cgit v1.2.3