1 $(document).ready(function () {
4 function setLocation(e) {
5 $("#latitude").val(e.latlng.lat);
6 $("#longitude").val(e.latlng.lng);
9 map.removeLayer(marker);
12 marker = L.marker(e.latlng, {icon: getUserIcon()}).addTo(map)
13 .bindPopup(I18n.t('diary_entry.edit.marker_text'));
16 $("#usemap").click(function (e) {
22 var params = $("#map").data();
23 var centre = [params.lat, params.lon];
26 attributionControl: false,
28 }).addLayer(new L.OSM.Mapnik());
33 $("#map").on("resized", function () {
37 map.setView(centre, params.zoom);
39 if ($("#latitude").val() && $("#longitude").val()) {
40 marker = L.marker(centre, {icon: getUserIcon()}).addTo(map)
41 .bindPopup(I18n.t('diary_entry.edit.marker_text'));
44 map.on("click", setLocation);