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.lon, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
47 } else if (params.type == "note") {
48 var centre = new OpenLayers.LonLat(params.lon, params.lat);
50 setMapCenter(centre, 16);
51 addMarkerToMap(centre);
53 var bbox = unproj(map.getExtent());
56 $("#browse_map .geolink").show();
58 $("a[data-editor=remote]").click(function () {
59 return remoteEditHandler(bbox);
62 updatelinks(centre.lon, centre.lat, 16, null, bbox.left, bbox.bottom, bbox.right, bbox.top)
64 $("#object_larger_map").hide();
65 $("#object_edit").hide();
67 var object = {type: params.type, id: params.id};
69 if (!params.visible) {
70 object.version = params.version - 1;
73 addObjectToMap(object, true, function(extent) {
75 $("#browse_map .geolink").show();
78 $("a.bbox[data-editor=remote]").click(function () {
79 return remoteEditHandler(extent);
82 $("a.object[data-editor=remote]").click(function () {
83 return remoteEditHandler(extent, params.type + params.id);
86 $("#object_larger_map").show();
87 $("#object_edit").show();
89 var centre = extent.getCenter();
90 updatelinks(centre.lng,
99 $("#small_map").hide();
104 createMenu("area_edit", "area_edit_menu", "right");
105 createMenu("object_edit", "object_edit_menu", "right");