1 $(document).ready(function () {
2 function remoteEditHandler(bbox, select) {
3 var left = bbox.getWest() - 0.0001;
4 var top = bbox.getNorth() + 0.0001;
5 var right = bbox.getEast() + 0.0001;
6 var bottom = bbox.getSouth() - 0.0001;
9 $("#linkloader").load(function () { loaded = true; });
12 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom + "&select=" + select);
14 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom);
17 setTimeout(function () {
18 if (!loaded) alert(I18n.t('site.index.remote_failed'));
24 var map = createMap("small_map", {
26 panZoomControl: false,
27 attributionControl: false
30 var params = $("#small_map").data();
31 if (params.type == "changeset") {
32 var bbox = L.latLngBounds([params.minlat, params.minlon],
33 [params.maxlat, params.maxlon]);
39 $("#browse_map .geolink").show();
41 $("a[data-editor=remote]").click(function () {
42 return remoteEditHandler(bbox);
45 var centre = bbox.getCenter();
46 updatelinks(centre.lng, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
47 } else if (params.type == "note") {
48 var object = {type: params.type, id: params.id};
50 map.setView([params.lat, params.lon], 16);
52 L.marker([params.lat, params.lon], { icon: getUserIcon() }).addTo(map);
54 var bbox = map.getBounds();
57 $("#browse_map .geolink").show();
59 $("a[data-editor=remote]").click(function () {
60 return remoteEditHandler(bbox);
63 updatelinks(params.lon, params.lat, 16, null,
64 bbox.getWest(), bbox.getSouth(),
65 bbox.getEast(), bbox.getNorth(),
68 $("#object_larger_map").hide();
69 $("#object_edit").hide();
71 var object = {type: params.type, id: params.id};
73 if (!params.visible) {
74 object.version = params.version - 1;
77 addObjectToMap(object, {
79 callback: function(extent) {
81 $("#browse_map .geolink").show();
84 $("a.bbox[data-editor=remote]").click(function () {
85 return remoteEditHandler(extent);
88 $("a.object[data-editor=remote]").click(function () {
89 return remoteEditHandler(extent, params.type + params.id);
92 $("#object_larger_map").show();
93 $("#object_edit").show();
95 var centre = extent.getCenter();
96 updatelinks(centre.lng,
105 $("#small_map").hide();
111 createMenu("area_edit", "area_edit_menu", "right");
112 createMenu("object_edit", "object_edit_menu", "right");