]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/user.js
Replace use of I18n in javascript with OSM.i18n
[rails.git] / app / assets / javascripts / user.js
index 2af9e18cbd06b37b2e9f8165bc2aad7baae08ce4..77a71097b1d41d899372c043e5341ba8f1ce2e27 100644 (file)
@@ -6,7 +6,7 @@
   });
 }());
 
   });
 }());
 
-$(document).ready(function () {
+$(function () {
   const defaultHomeZoom = 12;
   let map, marker, deleted_lat, deleted_lon;
 
   const defaultHomeZoom = 12;
   let map, marker, deleted_lat, deleted_lon;
 
@@ -26,9 +26,9 @@ $(document).ready(function () {
       icon: "icon geolocate",
       iconLoading: "icon geolocate",
       strings: {
       icon: "icon geolocate",
       iconLoading: "icon geolocate",
       strings: {
-        title: I18n.t("javascripts.map.locate.title"),
+        title: OSM.i18n.t("javascripts.map.locate.title"),
         popup: function (options) {
         popup: function (options) {
-          return I18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance });
+          return OSM.i18n.t("javascripts.map.locate." + options.unit + "Popup", { count: options.distance });
         }
       }
     }).addTo(map);
         }
       }
     }).addTo(map);
@@ -210,10 +210,10 @@ $(document).ready(function () {
   });
 
   $("input[name=legale]").change(function () {
   });
 
   $("input[name=legale]").change(function () {
-    const url = $(this).data("url");
-
-    $("#contributorTerms").html("<div class='spinner-border' role='status'><span class='visually-hidden'>" + I18n.t("browse.start_rjs.loading") + "</span></div>");
-    $("#contributorTerms").load(url);
+    $("#contributorTerms").html("<div class='spinner-border' role='status'><span class='visually-hidden'>" + OSM.i18n.t("browse.start_rjs.loading") + "</span></div>");
+    fetch($(this).data("url"))
+      .then(r => r.text())
+      .then(html => { $("#contributorTerms").html(html); });
   });
 
   $("#read_ct").on("click", function () {
   });
 
   $("#read_ct").on("click", function () {