X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/be931d0955fbd2379b1ffedb9abd32b1e8cb5915..82ff8ef58de69c881f63c0a2ef8f9e8a6ae483e0:/app/assets/javascripts/index/history.js diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index 4a2b96be4..8103f047e 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -1,3 +1,5 @@ +//= require jquery.simulate + OSM.History = function(map) { var page = {}; @@ -10,8 +12,9 @@ OSM.History = function(map) { unHighlightChangeset($(this).data("changeset").id); }) .on("click", "[data-changeset]", function (e) { - e.preventDefault(); - clickChangeset($(this).data("changeset").id); + if (!$(e.target).is('a')) { + clickChangeset($(this).data("changeset").id, e); + } }); var group = L.featureGroup() @@ -22,7 +25,7 @@ OSM.History = function(map) { unHighlightChangeset(e.layer.id); }) .on("click", function (e) { - clickChangeset(e.layer.id); + clickChangeset(e.layer.id, e); }); group.getLayerId = function(layer) { @@ -39,15 +42,15 @@ OSM.History = function(map) { $("#changeset_" + id).removeClass("selected"); } - function clickChangeset(id) { - OSM.router.route($("#changeset_" + id).find(".changeset_id").attr("href")); + function clickChangeset(id, e) { + $("#changeset_" + id).find("a.changeset_id").simulate("click", e); } - function loadData() { - var data = {}; + function update() { + var data = {list: '1'}; if (window.location.pathname === '/history') { - data = {bbox: map.getBounds().wrap().toBBoxString()}; + data.bbox = map.getBounds().wrap().toBBoxString(); } $.ajax({ @@ -59,6 +62,11 @@ OSM.History = function(map) { updateMap(); } }); + + var feedLink = $('link[type="application/atom+xml"]'), + feedHref = feedLink.attr('href').split('?')[0]; + + feedLink.attr('href', feedHref + '?bbox=' + data.bbox); } function loadMore(e) { @@ -118,18 +126,15 @@ OSM.History = function(map) { map.addLayer(group); if (window.location.pathname === '/history') { - map.on("moveend", loadData) + map.on("moveend", update); } - loadData(); + update(); }; page.unload = function() { map.removeLayer(group); - - if (window.location.pathname === '/history') { - map.off("moveend", loadData) - } + map.off("moveend", update); $("#history_tab").removeClass("current"); };