+var map, layers; // TODO: remove globals
+
+$(document).ready(function () {
+ var marker;
+ var params = OSM.mapParams();
+
+ map = L.map("map", {
+ attributionControl: false,
+ zoomControl: false,
+ layerControl: false
+ });
+
+ layers = mapLayers();
+
+ layers[0].layer.addTo(map);
+
+ $("#map").on("resized", function () {
+ map.invalidateSize();
+ });
+
+ L.control.zoom({position: 'topright'})
+ .addTo(map);
+
+ OSM.mapUI().addTo(map);
+
+ L.control.share({
+ getUrl: function(map) {
+ return setArgs('http://osm.org/', {
+ lon: map.getCenter().lng,
+ lat: map.getCenter().lat
+ });
+ }
+ }).addTo(map);
+
+ L.control.note({
+ position: 'topright'
+ }).addTo(map);
+
+ L.control.locate({
+ position: 'topright'
+ }).addTo(map);
+
+ L.control.scale().addTo(map);
+
+ map.on("moveend layeradd layerremove", updateLocation);