X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/605c700895e291fe88ba5821ab3c4ebbd829ad52..352d9365e4c2a70756d3cd2f14530a7f71201c36:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 0ceb015a7..c0decd6a6 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -1,12 +1,16 @@ //= require index/browse //= require index/export //= require index/key +//= require index/notes $(document).ready(function () { var marker; var params = OSM.mapParams(); var map = createMap("map"); + map.events.register("moveend", map, updateLocation); + map.events.register("changelayer", map, updateLocation); + if (!params.object_zoom) { if (params.bbox) { var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat); @@ -14,7 +18,7 @@ $(document).ready(function () { map.zoomToExtent(proj(bbox)); if (params.box) { - $(window).load(function() { addBoxToMap(bbox) }); + addBoxToMap(bbox); } } else { setMapCenter(new OpenLayers.LonLat(params.lon, params.lat), params.zoom); @@ -30,28 +34,11 @@ $(document).ready(function () { } if (params.object) { - var url = "/api/" + OSM.API_VERSION + "/" + params.object_type + "/" + params.object_id; - - if (params.object_type != "node") { - url += "/full"; - } - - $(window).load(function() { addObjectToMap(url, params.object_zoom) }); + addObjectToMap(params.object, params.object_zoom); } - map.events.register("moveend", map, updateLocation); - map.events.register("changelayer", map, updateLocation); - - updateLocation(); handleResize(); - $("#show_data").click(function (e) { - $.ajax({ url: $(this).attr('href'), success: function (sidebarHtml) { - startBrowse(sidebarHtml); - }}); - e.preventDefault(); - }); - $("body").on("click", "a.set_position", function () { var data = $(this).data(); var centre = new OpenLayers.LonLat(data.lon, data.lat); @@ -80,7 +67,7 @@ $(document).ready(function () { var extents = unproj(map.getExtent()); var expiry = new Date(); - updatelinks(lonlat.lon, lonlat.lat, zoom, layers, extents.left, extents.bottom, extents.right, extents.top, params.object_type, params.object_id); + updatelinks(lonlat.lon, lonlat.lat, zoom, layers, extents.left, extents.bottom, extents.right, extents.top, params.object); expiry.setYear(expiry.getFullYear() + 10); $.cookie("_osm_location", [lonlat.lon, lonlat.lat, zoom, layers].join("|"), {expires: expiry}); @@ -115,17 +102,6 @@ $(document).ready(function () { map.setCenter(centre, zoom); }); - $("#exportanchor").click(function (e) { - $.ajax({ url: $(this).data('url'), success: function (sidebarHtml) { - startExport(sidebarHtml); - }}); - e.preventDefault(); - }); - - if (window.location.pathname == "/export") { - $("#exportanchor").click(); - } - $("#search_form").submit(function () { var extent = unproj(map.getExtent());