1 $(document).ready(function () {
2 function remoteEditHandler(bbox, select) {
3 var left = bbox.getWestLng() - 0.0001;
4 var top = bbox.getNorthLat() + 0.0001;
5 var right = bbox.getEastLng() + 0.0001;
6 var bottom = bbox.getSouthLat() - 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);
48 $("#object_larger_map").hide();
49 $("#object_edit").hide();
51 var object = {type: params.type, id: params.id};
53 if (!params.visible) {
54 object.version = params.version - 1;
57 addObjectToMap(object, true, function(extent) {
59 $("#browse_map .geolink").show();
62 $("a.bbox[data-editor=remote]").click(function () {
63 return remoteEditHandler(extent);
66 $("a.object[data-editor=remote]").click(function () {
67 return remoteEditHandler(extent, params.type + params.id);
70 $("#object_larger_map").show();
71 $("#object_edit").show();
73 var centre = extent.getCenter();
74 updatelinks(centre.lng,
83 $("#small_map").hide();
88 createMenu("area_edit", "area_edit_menu", "right");
89 createMenu("object_edit", "object_edit_menu", "right");