Skip to content

Commit

Permalink
don't require jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
bbttxu committed Jan 18, 2014
1 parent b577dfe commit 2475d16
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions assets/javascripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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 &copy; <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>, Imagery © <a href=\"http://cloudmade.com\">CloudMade</a>"
maxZoom: 18
).addTo map
L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
attribution: "Map data &copy; <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\">CC-BY-SA</a>, Imagery © <a href=\"http://cloudmade.com\">CloudMade</a>"
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

0 comments on commit 2475d16

Please sign in to comment.