@@ -2,12 +2,13 @@ require.config({
22 paths : {
33 leaflet : "/bower_components/leaflet/dist/leaflet" ,
44 handlebars : "/bower_components/handlebars/handlebars.amd" ,
5- jquery : "/bower_components/jquery/dist/jquery.min"
5+ jquery : "/bower_components/jquery/dist/jquery.min" ,
6+ omnivore : "/bower_components/leaflet-omnivore/leaflet-omnivore" ,
67 }
78} ) ;
89
910
10- require ( [ "leaflet" , "handlebars" , "jquery" ] , function ( L , handlebars , $ ) {
11+ require ( [ "leaflet" , "handlebars" , "jquery" , "omnivore" ] , function ( L , handlebars , $ , omnivore ) {
1112 "use strict" ;
1213 // create a map in the "map" div, set the view to a given place and zoom
1314 var map = L . map ( "map" ) . setView ( [ 52.505 , 10.09 ] , 4 ) ;
@@ -18,17 +19,15 @@ require(["leaflet", "handlebars", "jquery"], function(L, handlebars, $){
1819 } ) . addTo ( map ) ;
1920
2021
21- // Selected countries
22- var countries ;
23- $ . getJSON ( "countries/codeforfreedom-countries.geojson" , function ( data ) {
24- countries = data ;
25- } )
26- . done ( function ( ) {
27- L . geoJson ( countries , { style : {
28- fillColor : "#d8c92d" ,
29- color : "#4cba6a"
30- } } ) . addTo ( map ) ;
31- } ) ;
22+ var countriesLayer = L . geoJson ( null , { style :
23+ {
24+ fillColor : "#d8c92d" ,
25+ color : "#4cba6a"
26+ }
27+ }
28+ ) . addTo ( map ) ;
29+
30+ omnivore . topojson ( "/countries/codeforfreedom-countries.topojson" , null , countriesLayer ) . addTo ( map ) ;
3231
3332
3433 // People from everywhere
@@ -41,7 +40,7 @@ require(["leaflet", "handlebars", "jquery"], function(L, handlebars, $){
4140 } ) ;
4241
4342 var mappedPeople = [ ] ;
44- var source = $ ( "# popup-template") . html ( ) ;
43+ var source = document . getElementById ( " popup-template") . innerHTML ;
4544 var template = handlebars . compile ( source ) ;
4645
4746 function addPeople ( data ) {
0 commit comments