X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/2f222c49dd60ea505f2c1631efa02fbd9f0f5667..c3b17aa506d6d7347f438de73de746d087cd0d19:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index bb471490a..4dfc849fe 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 @@ -25,8 +25,6 @@ //= require qs/dist/qs $(document).ready(function () { - var loaderTimeout; - var map = new L.OSM.Map("map", { zoomControl: false, layerControl: false, @@ -39,11 +37,7 @@ $(document).ready(function () { map.setSidebarOverlaid(false); - clearTimeout(loaderTimeout); - - loaderTimeout = setTimeout(function () { - $("#sidebar_loader").show(); - }, 200); + $("#sidebar_loader").show().addClass("delayed-fade-in"); // IE<10 doesn't respect Vary: X-Requested-With header, so // prevent caching the XHR response as a full-page URL. @@ -60,9 +54,8 @@ $(document).ready(function () { url: content_path, dataType: "html", complete: function (xhr) { - clearTimeout(loaderTimeout); $("#flash").empty(); - $("#sidebar_loader").hide(); + $("#sidebar_loader").removeClass("delayed-fade-in").hide(); var content = $(xhr.responseText); @@ -160,12 +153,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); } @@ -383,6 +376,7 @@ $(document).ready(function () { "/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) }); @@ -395,7 +389,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; }