1 $(document).ready(function () {
4 function setLocation(e) {
5 $("#latitude").val(e.latlng.lat);
6 $("#longitude").val(e.latlng.lng);
9 removeMarkerFromMap(marker);
12 marker = addMarkerToMap(e.latlng, null, I18n.t('diary_entry.edit.marker_text'));
15 $("#usemap").click(function (e) {
21 var params = $("#map").data();
22 var centre = [params.lat, params.lon];
23 var map = createMap("map");
25 map.setView(centre, params.zoom);
27 if ($("#latitude").val() && $("#longitude").val()) {
28 marker = addMarkerToMap(centre, null, I18n.t('diary_entry.edit.marker_text'));
31 map.on("click", setLocation);