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];
24 var map = createMap("map");
26 map.setView(centre, params.zoom);
28 if ($("#latitude").val() && $("#longitude").val()) {
29 marker = L.marker(centre, {icon: getUserIcon()}).addTo(map)
30 .bindPopup(I18n.t('diary_entry.edit.marker_text'));
33 map.on("click", setLocation);