//= require leaflet.contextmenu
//= require index/contextmenu
//= require index/search
-//= require index/browse
+//= require index/layers/data
//= require index/export
-//= require index/notes
+//= require index/layers/notes
//= require index/history
//= require index/note
//= require index/new_note
OSM.initializeContextMenu(map);
if (OSM.STATUS !== "api_offline" && OSM.STATUS !== "database_offline") {
- OSM.initializeNotes(map);
+ OSM.initializeNotesLayer(map);
if (params.layers.indexOf(map.noteLayer.options.code) >= 0) {
map.addLayer(map.noteLayer);
}
- OSM.initializeBrowse(map);
+ OSM.initializeDataLayer(map);
if (params.layers.indexOf(map.dataLayer.options.code) >= 0) {
map.addLayer(map.dataLayer);
}
}
}
- var placement = $("html").attr("dir") === "rtl" ? "right" : "left";
- $(".leaflet-control .control-button").tooltip({ placement: placement, container: "body" });
+ $(".leaflet-control .control-button").tooltip({ placement: "left", container: "body" });
var expiry = new Date();
expiry.setYear(expiry.getFullYear() + 10);
});
if (Cookies.get("_osm_welcome") !== "hide") {
- $(".welcome").addClass("visible");
+ $(".welcome").removeAttr("hidden");
}
$(".welcome .btn-close").on("click", function () {
- $(".welcome").removeClass("visible");
+ $(".welcome").hide();
Cookies.set("_osm_welcome", "hide", { secure: true, expires: expiry, path: "/", samesite: "lax" });
});
});
}
});
-
- $(".colour-preview-box").each(function () {
- $(this).css("background-color", $(this).data("colour"));
- });
}
page.unload = function () {
return page;
};
+ OSM.OldBrowse = function () {
+ var page = {};
+
+ page.pushstate = page.popstate = function (path) {
+ OSM.loadSidebarContent(path);
+ };
+
+ return page;
+ };
+
var history = OSM.History(map);
OSM.router = OSM.Router(map, {
"/user/:display_name/history": history,
"/note/:id": OSM.Note(map),
"/node/:id(/history)": OSM.Browse(map, "node"),
+ "/node/:id/history/:version": OSM.OldBrowse(),
"/way/:id(/history)": OSM.Browse(map, "way"),
+ "/way/:id/history/:version": OSM.OldBrowse(),
"/relation/:id(/history)": OSM.Browse(map, "relation"),
+ "/relation/:id/history/:version": OSM.OldBrowse(),
"/changeset/:id": OSM.Changeset(map),
"/query": OSM.Query(map)
});
OSM.router.load();
$(document).on("click", "a", function (e) {
- if (e.isDefaultPrevented() || e.isPropagationStopped()) {
+ if (e.isDefaultPrevented() || e.isPropagationStopped() || $(e.target).data("turbo")) {
return;
}
if (OSM.router.route(this.pathname + this.search + this.hash)) {
e.preventDefault();
+ if (this.pathname !== "/directions") {
+ $("header").addClass("closed");
+ }
}
});
+
+ $(document).on("click", "#sidebar_content .btn-close", function () {
+ OSM.router.route("/" + OSM.formatHash(map));
+ });
});