]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/embed.js.erb
Use location instead of window.location and document.location
[rails.git] / app / assets / javascripts / embed.js.erb
index 34a8b68bcf8740e880fcb6e7574ce8adc169e75b..7596e89a438dd3aa29ff17dedc4057167f05a12c 100644 (file)
@@ -16,7 +16,7 @@ I18n.default_locale = <%= I18n.default_locale.to_json %>;
 I18n.fallbacks = true;
 
 window.onload = function () {
-  const args = Object.fromEntries(new URLSearchParams(window.location.search));
+  const args = Object.fromEntries(new URLSearchParams(location.search));
 
   const tileOptions = {
     mapnik: {
@@ -32,7 +32,7 @@ window.onload = function () {
 <% end %>
   };
 
-  var map = L.map("map");
+  const map = L.map("map");
   map.attributionControl.setPrefix("");
   map.removeControl(map.attributionControl);
 
@@ -80,7 +80,7 @@ L.Control.OSMReportAProblem = L.Control.Attribution.extend({
   },
 
   onAdd: function (map) {
-    var container = L.Control.Attribution.prototype.onAdd.call(this, map);
+    const container = L.Control.Attribution.prototype.onAdd.call(this, map);
 
     map.on("moveend", this._update, this);