1 $(document).ready(function () {
2 var map = L.map("map", {
3 attributionControl: false,
5 }).addLayer(new L.OSM.Mapnik());
11 map.setView([OSM.home.lat, OSM.home.lon], 12);
13 map.setView([0, 0], 0);
16 if ($("#map").hasClass("set_location")) {
17 var marker = L.marker([0, 0], {icon: getUserIcon()});
20 marker.setLatLng([OSM.home.lat, OSM.home.lon]);
24 map.on("click", function (e) {
25 if ($('#updatehome').is(':checked')) {
26 var zoom = map.getZoom(),
27 precision = zoomPrecision(zoom),
28 location = e.latlng.wrap();
30 $('#homerow').removeClass();
31 $('#home_lat').val(location.lat.toFixed(precision));
32 $('#home_lon').val(location.lng.toFixed(precision));
34 marker.setLatLng(e.latlng);
39 $("[data-user]").each(function () {
40 var user = $(this).data('user');
41 if (user.lon && user.lat) {
42 L.marker([user.lat, user.lon], {icon: getUserIcon(user.icon)}).addTo(map)
43 .bindPopup(user.description);