X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e6987d7dd3f976e2551fc11dcebd7184b0680a0d..42224790b56acea5c653f3085c374f28d56e590d:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 783c4da8d..2b29992e9 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -1,7 +1,7 @@ //= require_self //= require leaflet.sidebar //= require leaflet.sidebar-pane -//= require leaflet.locatecontrol/src/L.Control.Locate +//= require leaflet.locatecontrol/dist/L.Control.Locate.umd //= require leaflet.locate //= require leaflet.layers //= require leaflet.key @@ -12,9 +12,9 @@ //= 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 @@ -160,12 +160,12 @@ $(document).ready(function () { 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); } @@ -175,8 +175,7 @@ $(document).ready(function () { } } - 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); @@ -347,10 +346,6 @@ $(document).ready(function () { }); } }); - - $(".colour-preview-box").each(function () { - $(this).css("background-color", $(this).data("colour")); - }); } page.unload = function () { @@ -360,6 +355,16 @@ $(document).ready(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, { @@ -374,8 +379,11 @@ $(document).ready(function () { "/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) }); @@ -388,7 +396,7 @@ $(document).ready(function () { OSM.router.load(); $(document).on("click", "a", function (e) { - if (e.isDefaultPrevented() || e.isPropagationStopped()) { + if (e.isDefaultPrevented() || e.isPropagationStopped() || $(e.target).data("turbo")) { return; }