X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/12a7c9d023bcca01657e357b2ed28cc6bcd20e06..e2cb2327f9e5a3a107dbe249e4fe503cbde45d24:/app/assets/javascripts/index.js diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index 011f3b282..783c4da8d 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -104,38 +104,55 @@ $(document).ready(function () { var position = $("html").attr("dir") === "rtl" ? "topleft" : "topright"; - L.OSM.zoom({ position: position }) - .addTo(map); + function addControlGroup(controls) { + controls.forEach(function (control) { + control.addTo(map); + }); - L.OSM.locate({ position: position }) - .addTo(map); + var firstContainer = controls[0].getContainer(); + $(firstContainer).find(".control-button").first() + .addClass("control-button-first"); - L.OSM.layers({ - position: position, - layers: map.baseLayers, - sidebar: sidebar - }).addTo(map); - - L.OSM.key({ - position: position, - sidebar: sidebar - }).addTo(map); - - L.OSM.share({ - "position": position, - "sidebar": sidebar, - "short": true - }).addTo(map); - - L.OSM.note({ - position: position, - sidebar: sidebar - }).addTo(map); - - L.OSM.query({ - position: position, - sidebar: sidebar - }).addTo(map); + var lastContainer = controls[controls.length - 1].getContainer(); + $(lastContainer).find(".control-button").last() + .addClass("control-button-last"); + } + + addControlGroup([ + L.OSM.zoom({ position: position }), + L.OSM.locate({ position: position }) + ]); + + addControlGroup([ + L.OSM.layers({ + position: position, + layers: map.baseLayers, + sidebar: sidebar + }), + L.OSM.key({ + position: position, + sidebar: sidebar + }), + L.OSM.share({ + "position": position, + "sidebar": sidebar, + "short": true + }) + ]); + + addControlGroup([ + L.OSM.note({ + position: position, + sidebar: sidebar + }) + ]); + + addControlGroup([ + L.OSM.query({ + position: position, + sidebar: sidebar + }) + ]); L.control.scale() .addTo(map); @@ -175,11 +192,11 @@ $(document).ready(function () { }); 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" }); }); @@ -228,8 +245,8 @@ $(document).ready(function () { }); function remoteEditHandler(bbox, object) { - var loaded = false, - url, + var remoteEditHost = "http://127.0.0.1:8111", + osmHost = location.protocol + "//" + location.host, query = { left: bbox.getWest() - 0.0001, top: bbox.getNorth() + 0.0001, @@ -237,25 +254,31 @@ $(document).ready(function () { bottom: bbox.getSouth() - 0.0001 }; - url = "http://127.0.0.1:8111/load_and_zoom?"; - - if (object) query.select = object.type + object.id; - - var iframe = $("