- function loadData() {
- $.ajax({
- url: window.location.pathname,
- method: "GET",
- data: {bbox: map.getBounds().wrap().toBBoxString()},
- success: function(html, status, xhr) {
- $('#sidebar_content .changesets').html(html);
+ function displayMoreChangesets(html) {
+ $("#sidebar_content .changeset_more").replaceWith(html);
+ const oldList = $("#sidebar_content .changesets ol").first();
+ const newList = oldList.next("ol");
+ newList.children().appendTo(oldList);
+ newList.remove();
+ }
+
+ function update() {
+ const data = new URLSearchParams();
+
+ if (window.location.pathname === "/history") {
+ data.set("bbox", map.getBounds().wrap().toBBoxString());
+ const feedLink = $("link[type=\"application/atom+xml\"]"),
+ feedHref = feedLink.attr("href").split("?")[0];
+ feedLink.attr("href", feedHref + "?" + data);
+ }
+
+ data.set("list", "1");
+
+ fetch(window.location.pathname + "?" + data)
+ .then(response => response.text())
+ .then(function (html) {
+ displayFirstChangesets(html);