X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c441a4dc15f2de78e6c43a51a850b394a25aa5a9..e2e61692ea04fc156221082aeddc21ea18facdec:/app/assets/javascripts/leaflet.map.js diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index 34c0bd449..ac31f7941 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -16,8 +16,6 @@ L.OSM.Map = L.Map.extend({ this.baseLayers = []; for (const layerDefinition of OSM.LAYER_DEFINITIONS) { - if (layerDefinition.apiKeyId && !OSM[layerDefinition.apiKeyId]) continue; - let layerConstructor = L.OSM.TileLayer; const layerOptions = {}; @@ -25,9 +23,7 @@ L.OSM.Map = L.Map.extend({ if (property === "credit") { layerOptions.attribution = makeAttribution(value); } else if (property === "nameId") { - layerOptions.name = I18n.t(`javascripts.map.base.${value}`); - } else if (property === "apiKeyId") { - layerOptions.apikey = OSM[value]; + layerOptions.name = OSM.i18n.t(`javascripts.map.base.${value}`); } else if (property === "leafletOsmId") { layerConstructor = L.OSM[value]; } else if (property === "leafletOsmDarkId" && OSM.isDarkMap() && L.OSM[value]) { @@ -47,7 +43,7 @@ L.OSM.Map = L.Map.extend({ this.noteLayer = new L.FeatureGroup(); this.noteLayer.options = { code: "N" }; - this.dataLayer = new L.OSM.DataLayer(null); + this.dataLayer = new L.OSM.DataLayer(null, { asynchronous: true }); this.dataLayer.options.code = "D"; this.gpsLayer = new L.OSM.GPS({ @@ -70,10 +66,10 @@ L.OSM.Map = L.Map.extend({ function makeAttribution(credit) { let attribution = ""; - attribution += I18n.t("javascripts.map.copyright_text", { + attribution += OSM.i18n.t("javascripts.map.copyright_text", { copyright_link: $("", { href: "/copyright", - text: I18n.t("javascripts.map.openstreetmap_contributors") + text: OSM.i18n.t("javascripts.map.openstreetmap_contributors") }).prop("outerHTML") }); @@ -83,7 +79,7 @@ L.OSM.Map = L.Map.extend({ attribution += $("", { href: "https://wiki.osmfoundation.org/wiki/Terms_of_Use", - text: I18n.t("javascripts.map.website_and_api_terms") + text: OSM.i18n.t("javascripts.map.website_and_api_terms") }).prop("outerHTML"); return attribution; @@ -94,7 +90,7 @@ L.OSM.Map = L.Map.extend({ for (const childId in credit.children) { children[childId] = makeCredit(credit.children[childId]); } - const text = I18n.t(`javascripts.map.${credit.id}`, children); + const text = OSM.i18n.t(`javascripts.map.${credit.id}`, children); if (credit.href) { const link = $("", { href: credit.href, @@ -155,7 +151,7 @@ L.OSM.Map = L.Map.extend({ [params.mlat, params.mlon] = OSM.cropLocation(marker.getLatLng(), this.getZoom()); } - let url = window.location.protocol + "//" + OSM.SERVER_URL + "/"; + let url = location.protocol + "//" + OSM.SERVER_URL + "/"; const query = new URLSearchParams(params), hash = OSM.formatHash(this); @@ -176,7 +172,7 @@ L.OSM.Map = L.Map.extend({ // and drops the last 4 bits of the full 64 bit Morton code. c1 = interlace(x >>> 17, y >>> 17), c2 = interlace((x >>> 2) & 0x7fff, (y >>> 2) & 0x7fff); - let str = window.location.protocol + "//" + window.location.hostname.replace(/^www\.openstreetmap\.org/i, "osm.org") + "/go/"; + let str = location.protocol + "//" + location.hostname.replace(/^www\.openstreetmap\.org/i, "osm.org") + "/go/"; for (let i = 0; i < Math.ceil((zoom + 8) / 3.0) && i < 5; ++i) { const digit = (c1 >> (24 - (6 * i))) & 0x3f;