From 2475d16372c91981d4e0f1eb0b7234454f222ccd Mon Sep 17 00:00:00 2001 From: Adam Krawiec Date: Sat, 18 Jan 2014 13:49:12 -0600 Subject: [PATCH] don't require jquery --- assets/javascripts/main.coffee | 37 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/assets/javascripts/main.coffee b/assets/javascripts/main.coffee index 12590f8..5a40b1c 100644 --- a/assets/javascripts/main.coffee +++ b/assets/javascripts/main.coffee @@ -15,26 +15,29 @@ require ["jquery", "foundation"], ($) -> $(document).ready ()-> $(document).foundation() -require ["jquery", "leaflet"], ()-> - $(document).ready ()-> - map = L.map('map', {dragging: false}).setView([33.215194, -97.132788], 15) +require ["leaflet"], ()-> + + map = L.map('map', {dragging: false}).setView([33.215194, -97.132788], 15) - L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", - attribution: "Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © CloudMade" - maxZoom: 18 - ).addTo map + L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", + attribution: "Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © CloudMade" + maxZoom: 18 + ).addTo map - map.locate({setView: true, maxZoom: 17}) - map.locate({watch: true, maximumAge: 6000, setView: true}) + map.locate({setView: true, maxZoom: 17}) + map.locate({watch: true, maximumAge: 6000, setView: true}) - circle = L.circle([0, 0], 100 ).addTo(map); + options = + color: '#00f' + circle = L.circle([0, 0], 100, options ).addTo(map); - onLocationFound = (e) -> - radius = e.accuracy / 2 - circle.setLatLng(map.getCenter()); + onLocationFound = (e) -> + radius = e.accuracy / 2 + circle.setLatLng(map.getCenter()); + circle.setRadius radius - map.on "locationfound", onLocationFound + map.on "locationfound", onLocationFound - onLocationError = (e) -> - alert e.message - map.on "locationerror", onLocationError + onLocationError = (e) -> + alert e.message + map.on "locationerror", onLocationError