]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index.js
Translate step distance units
[rails.git] / app / assets / javascripts / index.js
index 9888b3a7e5fc0abaefb76c141e289e1ce297f390..9220e12059c9edf5a24865d9585b470a5ba412a9 100644 (file)
@@ -24,7 +24,7 @@
 //= require index/home
 //= require router
 
-$(document).ready(function () {
+$(function () {
   const map = new L.OSM.Map("map", {
     zoomControl: false,
     layerControl: false,
@@ -37,7 +37,7 @@ $(document).ready(function () {
 
     map.setSidebarOverlaid(false);
 
-    $("#sidebar_loader").show().addClass("delayed-fade-in");
+    $("#sidebar_loader").prop("hidden", false).addClass("delayed-fade-in");
 
     // Prevent caching the XHR response as a full-page URL
     // https://github.com/openstreetmap/openstreetmap-website/issues/5663
@@ -53,7 +53,7 @@ $(document).ready(function () {
     fetch(content_path, { headers: { "accept": "text/html", "x-requested-with": "XMLHttpRequest" } })
       .then(response => {
         $("#flash").empty();
-        $("#sidebar_loader").removeClass("delayed-fade-in").hide();
+        $("#sidebar_loader").removeClass("delayed-fade-in").prop("hidden", true);
 
         const title = response.headers.get("X-Page-Title");
         if (title) document.title = decodeURIComponent(title);
@@ -380,6 +380,11 @@ $(document).ready(function () {
       return;
     }
 
+    // Open local anchor links as normal.
+    if ($(this).attr("href")?.startsWith("#")) {
+      return;
+    }
+
     // Ignore cross-protocol and cross-origin links.
     if (location.protocol !== this.protocol || location.host !== this.host) {
       return;
@@ -393,7 +398,7 @@ $(document).ready(function () {
     }
   });
 
-  $(document).on("click", "#sidebar_content .btn-close", function () {
+  $(document).on("click", "#sidebar .sidebar-close-controls button", function () {
     OSM.router.route("/" + OSM.formatHash(map));
   });
 });