Merge changeset <ol>s on Load more

This commit is contained in:
Anton Khorev 2022-10-26 15:02:49 +03:00
parent 3d0b94abda
commit 34a8d08209
2 changed files with 58 additions and 3 deletions

View file

@ -43,6 +43,18 @@ OSM.History = function (map) {
$("#changeset_" + id).find("a.changeset_id").simulate("click", e);
}
function displayFirstChangesets(html) {
$("#sidebar_content .changesets").html(html);
}
function displayMoreChangesets(html) {
$("#sidebar_content .changeset_more").replaceWith(html);
var oldList = $("#sidebar_content .changesets ol").first();
var newList = oldList.next("ol");
newList.children().appendTo(oldList);
newList.remove();
}
function update() {
var data = { list: "1" };
@ -58,7 +70,7 @@ OSM.History = function (map) {
method: "GET",
data: data,
success: function (html) {
$("#sidebar_content .changesets").html(html);
displayFirstChangesets(html);
updateMap();
}
});
@ -73,8 +85,8 @@ OSM.History = function (map) {
$(this).hide();
div.find(".loader").show();
$.get($(this).attr("href"), function (data) {
div.replaceWith(data);
$.get($(this).attr("href"), function (html) {
displayMoreChangesets(html);
updateMap();
});
}