diff options
author | Christopher Baines <mail@cbaines.net> | 2015-02-11 15:51:16 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2015-02-11 15:51:16 +0000 |
commit | a134ed367d032ee8119aa3d3afece53cf44c77b9 (patch) | |
tree | a29e95ca438f710e7e3b472d3b20d596d91b5590 | |
parent | 46f880c5f8f506b686c66c45d1f64c9d3f75cb9c (diff) | |
download | leaflet-workshop-a134ed367d032ee8119aa3d3afece53cf44c77b9.tar leaflet-workshop-a134ed367d032ee8119aa3d3afece53cf44c77b9.tar.gz |
Add a workaround to allow the demos to be used without a webserver
-rw-r--r-- | demo5.html | 8 | ||||
-rw-r--r-- | demo6.html | 8 | ||||
-rw-r--r-- | index.html | 17 |
3 files changed, 31 insertions, 2 deletions
@@ -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); }); @@ -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/ @@ -67,6 +67,23 @@ </section> <section> + <h2>Following Along</h2> + + <p> + Either download the repository + <a href="http://git.cbaines.net/?p=leaflet-workshop.git;a=snapshot;h=HEAD;sf=zip">zip</a> + / + <a href="http://git.cbaines.net/?p=leaflet-workshop.git;a=snapshot;h=HEAD;sf=tgz">tgz</a> + </p> + + <p> + Or, clone the repository + <br> + <a href="http://git.cbaines.net/?p=leaflet-workshop.git;a=summary">git://git.cbaines.net/leaflet-workshop.git</a> + </p> + </section> + + <section> <h2>Be prepared to...</h2> <ul> <li>Make a basic map</li> |