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", {
25 controls: [ new OpenLayers.Control.Navigation() ]
28 var params = $("#small_map").data();
29 if (params.type == "changeset") {
30 var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat);
31 var centre = bbox.getCenterLonLat();
33 map.zoomToExtent(proj(bbox));
37 $("#browse_map .geolink").show();
39 $("a[data-editor=remote]").click(function () {
40 return remoteEditHandler(bbox);
43 updatelinks(centre.lon, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
45 var url = "/api/" + OSM.API_VERSION + "/" + params.type + "/" + params.id;
47 if (params.type != "node") {
49 } else if (!params.visible) {
50 var previous_version = params.version - 1;
51 url += "/" + previous_version;
54 $("#object_larger_map").hide();
55 $("#object_edit").hide();
57 addObjectToMap(url, true, function(extent) {
59 $("#browse_map .geolink").show();
62 extent.transform(map.getProjectionObject(), map.displayProjection);
64 var centre = extent.getCenterLonLat();
66 $("a.bbox[data-editor=remote]").click(function () {
67 return remoteEditHandler(extent);
70 $("a.object[data-editor=remote]").click(function () {
71 return remoteEditHandler(extent, params.type + params.id);
74 $("#object_larger_map").show();
75 $("#object_edit").show();
77 updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, params.type, params.id);
79 $("#small_map").hide();
84 createMenu("area_edit", "area_edit_menu", "right");
85 createMenu("object_edit", "object_edit_menu", "right");