X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d0de36b6072b7e8ee0083e680ebf6a21d5b81ab8..ca35ac16e7aeb877d19cdea245e342337107b6ec:/app/assets/javascripts/index/history.js?ds=inline diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index cd012ee16..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 = {}; @@ -9,8 +11,10 @@ OSM.History = function(map) { .on("mouseout", "[data-changeset]", function () { unHighlightChangeset($(this).data("changeset").id); }) - .on("click", "[data-changeset]", function () { - clickChangeset($(this).data("changeset").id); + .on("click", "[data-changeset]", function (e) { + if (!$(e.target).is('a')) { + clickChangeset($(this).data("changeset").id, e); + } }); var group = L.featureGroup() @@ -21,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) { @@ -38,15 +42,15 @@ OSM.History = function(map) { $("#changeset_" + id).removeClass("selected"); } - function clickChangeset(id) { - OSM.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({ @@ -58,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) { @@ -117,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"); };