+ OSM.loadSidebarContent = function (path, callback) {
+ var content_path = path;
+
+ map.setSidebarOverlaid(false);
+
+ clearTimeout(loaderTimeout);
+
+ loaderTimeout = setTimeout(function () {
+ $("#sidebar_loader").show();
+ }, 200);
+
+ // IE<10 doesn't respect Vary: X-Requested-With header, so
+ // prevent caching the XHR response as a full-page URL.
+ if (content_path.indexOf("?") >= 0) {
+ content_path += "&xhr=1";
+ } else {
+ content_path += "?xhr=1";
+ }
+
+ $("#sidebar_content")
+ .empty();
+
+ $.ajax({
+ url: content_path,
+ dataType: "html",
+ complete: function (xhr) {
+ clearTimeout(loaderTimeout);
+ $("#flash").empty();
+ $("#sidebar_loader").hide();
+
+ var content = $(xhr.responseText);
+
+ if (xhr.getResponseHeader("X-Page-Title")) {
+ var title = xhr.getResponseHeader("X-Page-Title");
+ document.title = decodeURIComponent(title);
+ }
+
+ $("head")
+ .find("link[type=\"application/atom+xml\"]")
+ .remove();
+
+ $("head")
+ .append(content.filter("link[type=\"application/atom+xml\"]"));
+
+ $("#sidebar_content").html(content.not("link[type=\"application/atom+xml\"]"));
+
+ if (callback) {
+ callback();
+ }
+ }
+ });
+ };
+
+ var params = OSM.mapParams();
+
+ map.attributionControl.setPrefix("");