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 = L.map("small_map", {
25 attributionControl: false,
27 }).addLayer(new L.OSM.Mapnik());
29 L.control.zoom({position: 'topright'})
32 $("#small_map").on("resized", function () {
36 var params = $("#small_map").data();
37 if (params.type == "changeset") {
38 var bbox = L.latLngBounds([params.minlat, params.minlon],
39 [params.maxlat, params.maxlon]);
50 $("#browse_map .geolink").show();
52 $("a[data-editor=remote]").click(function () {
53 return remoteEditHandler(bbox);
56 updatelinks(map.getCenter(), 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
57 } else if (params.type == "note") {
58 var object = {type: params.type, id: params.id};
60 map.setView([params.lat, params.lon], 16);
62 L.marker([params.lat, params.lon], { icon: getUserIcon() }).addTo(map);
64 var bbox = map.getBounds();
67 $("#browse_map .geolink").show();
69 $("a[data-editor=remote]").click(function () {
70 return remoteEditHandler(bbox);
73 updatelinks(params, 16, null,
74 bbox.getWest(), bbox.getSouth(),
75 bbox.getEast(), bbox.getNorth(),
78 $("#object_larger_map").hide();
79 $("#object_edit").hide();
81 var object = {type: params.type, id: params.id};
83 if (!params.visible) {
84 object.version = params.version - 1;
87 addObjectToMap(object, map, {
89 callback: function(extent) {
91 $("#browse_map .geolink").show();
94 $("a.bbox[data-editor=remote]").click(function () {
95 return remoteEditHandler(extent);
98 $("a.object[data-editor=remote]").click(function () {
99 return remoteEditHandler(extent, params.type + params.id);
102 $("#object_larger_map").show();
103 $("#object_edit").show();
105 updatelinks(map.getCenter(),
113 $("#small_map").hide();
119 createMenu("area_edit", "area_edit_menu", "right");
120 createMenu("object_edit", "object_edit_menu", "right");