- map.events.register("moveend", map, updateLocation);
- map.events.register("changelayer", map, updateLocation);
+ var map = L.map("map", {
+ zoomControl: false,
+ layerControl: false
+ });
+
+ map.attributionControl.setPrefix('');
+
+ var layers = [
+ new L.OSM.Mapnik({
+ attribution: '',
+ code: "M",
+ keyid: "mapnik",
+ name: I18n.t("javascripts.map.base.standard")
+ }),
+ new L.OSM.CycleMap({
+ attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
+ code: "C",
+ keyid: "cyclemap",
+ name: I18n.t("javascripts.map.base.cycle_map")
+ }),
+ new L.OSM.TransportMap({
+ attribution: "Tiles courtesy of <a href='http://www.opencyclemap.org/' target='_blank'>Andy Allan</a>",
+ code: "T",
+ keyid: "transportmap",
+ name: I18n.t("javascripts.map.base.transport_map")
+ }),
+ new L.OSM.MapQuestOpen({
+ attribution: "Tiles courtesy of <a href='http://www.mapquest.com/' target='_blank'>MapQuest</a> <img src='http://developer.mapquest.com/content/osm/mq_logo.png'>",
+ code: "Q",
+ keyid: "mapquest",
+ name: I18n.t("javascripts.map.base.mapquest")
+ })
+ ];
+
+ layers[0].addTo(map);
+
+ map.noteLayer = new L.LayerGroup({code: 'N'});
+ map.dataLayer = new L.OSM.DataLayer(null);
+
+ $("#sidebar").on("opened closed", function () {
+ map.invalidateSize();
+ });
+
+ var position = $('html').attr('dir') === 'rtl' ? 'topleft' : 'topright';
+
+ L.OSM.zoom({position: position})
+ .addTo(map);
+
+ L.control.locate({position: position})
+ .addTo(map);
+
+ var sidebar = L.OSM.sidebar('#map-ui')
+ .addTo(map);
+
+ L.OSM.layers({
+ position: position,
+ layers: layers,
+ sidebar: sidebar
+ }).addTo(map);
+
+ L.OSM.key({
+ position: position,
+ sidebar: sidebar
+ }).addTo(map);
+
+ L.OSM.share({
+ position: position,
+ getShortUrl: getShortUrl,
+ getUrl: getUrl,
+ sidebar: sidebar,
+ short: true
+ }).addTo(map);
+
+ L.OSM.note({
+ position: position,
+ sidebar: sidebar
+ }).addTo(map);
+
+ L.control.scale()
+ .addTo(map);
+
+ map.on('moveend layeradd layerremove', updateLocation);
+
+ map.markerLayer = L.layerGroup().addTo(map);