From a134ed367d032ee8119aa3d3afece53cf44c77b9 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 11 Feb 2015 15:51:16 +0000 Subject: Add a workaround to allow the demos to be used without a webserver --- demo5.html | 8 +++++++- demo6.html | 8 +++++++- index.html | 17 +++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/demo5.html b/demo5.html index 1e59063..d4f5f05 100644 --- a/demo5.html +++ b/demo5.html @@ -35,7 +35,13 @@ // Load some GeoJSON exported from OpenStreetMap using the OverpassAPI // (http://overpass-turbo.eu/s/7yI) - getJSON("cafes.json", function(cafes) { + var url = "cafes.json"; + + if (document.URL.indexOf("file") === 0) { + url = "http://cbaines.net/maptime/cafes.json"; + } + + getJSON(url, function(cafes) { L.geoJson(cafes).addTo(map); }); diff --git a/demo6.html b/demo6.html index da7e434..fd42a78 100644 --- a/demo6.html +++ b/demo6.html @@ -41,7 +41,13 @@ popupAnchor: [16, 0] // point from which the }); - getJSON("cafes.json", function(cafes) { + var url = "cafes.json"; + + if (document.URL.indexOf("file") === 0) { + url = "http://cbaines.net/maptime/cafes.json"; + } + + getJSON(url, function(cafes) { // Coffee icon from // http://mapicons.nicolasmollet.com/markers/restaurants-bars/bars/coffee/ diff --git a/index.html b/index.html index 984edce..74f0d2a 100644 --- a/index.html +++ b/index.html @@ -66,6 +66,23 @@

+
+

Following Along

+ +

+ Either download the repository + zip + / + tgz +

+ +

+ Or, clone the repository +
+ git://git.cbaines.net/leaflet-workshop.git +

+
+

Be prepared to...