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();
38 if (params.type == "changeset") {
39 bbox = L.latLngBounds([params.minlat, params.minlon],
40 [params.maxlat, params.maxlon]);
51 $("#browse_map .geolink").show();
53 $("a[data-editor=remote]").click(function () {
54 return remoteEditHandler(bbox);
57 updatelinks(map.getCenter(), 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
58 } else if (params.type == "note") {
59 object = {type: params.type, id: params.id};
61 map.setView([params.lat, params.lon], 16);
63 L.marker([params.lat, params.lon], { icon: getUserIcon() }).addTo(map);
65 bbox = map.getBounds();
68 $("#browse_map .geolink").show();
70 $("a[data-editor=remote]").click(function () {
71 return remoteEditHandler(bbox);
74 updatelinks(params, 16, null,
75 bbox.getWest(), bbox.getSouth(),
76 bbox.getEast(), bbox.getNorth(),
79 $("#object_larger_map, #object_edit").hide();
81 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");