1 $(document).ready(function () {
2 function remoteEditHandler(bbox, select) {
3 var left = bbox.left - 0.0001;
4 var top = bbox.top + 0.0001;
5 var right = bbox.right + 0.0001;
6 var bottom = bbox.bottom - 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 var params = $("#small_map").data();
27 if (params.type == "changeset") {
28 var bbox = L.latLngBounds([params.minlat, params.minlon],
29 [params.maxlat, params.maxlon]);
35 $("#browse_map .geolink").show();
37 $("a[data-editor=remote]").click(function () {
38 return remoteEditHandler(bbox);
41 var centre = bbox.getCenter();
42 updatelinks(centre.lng, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
44 $("#object_larger_map").hide();
45 $("#object_edit").hide();
47 var object = {type: params.type, id: params.id};
49 if (!params.visible) {
50 object.version = params.version - 1;
53 addObjectToMap(object, true, function(extent) {
55 $("#browse_map .geolink").show();
58 $("a.bbox[data-editor=remote]").click(function () {
59 return remoteEditHandler(extent);
62 $("a.object[data-editor=remote]").click(function () {
63 return remoteEditHandler(extent, params.type + params.id);
66 $("#object_larger_map").show();
67 $("#object_edit").show();
69 var centre = extent.getCenter();
70 updatelinks(centre.lng, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, object);
72 $("#small_map").hide();
77 createMenu("area_edit", "area_edit_menu", "right");
78 createMenu("object_edit", "object_edit_menu", "right");