Apply suggestions from code review

Co-authored-by: David Larlet <3556+davidbgk@users.noreply.github.com>
This commit is contained in:
Yohan Boniface 2024-05-14 17:09:17 +02:00 committed by Yohan Boniface
parent e6b4a54499
commit 9e2a29002a
2 changed files with 5 additions and 9 deletions

View file

@ -31,7 +31,7 @@ export default class Caption {
const p = DomUtil.create('p', 'datalayer-legend', container), const p = DomUtil.create('p', 'datalayer-legend', container),
legend = DomUtil.create('span', '', p), legend = DomUtil.create('span', '', p),
headline = DomUtil.create('strong', '', p) headline = DomUtil.create('strong', '', p)
datalayer.onceLoaded(function () { datalayer.onceLoaded(() => {
datalayer.renderLegend(legend) datalayer.renderLegend(legend)
if (datalayer.options.description) { if (datalayer.options.description) {
DomUtil.element({ DomUtil.element({
@ -89,8 +89,8 @@ export default class Caption {
const urls = { const urls = {
leaflet: 'http://leafletjs.com', leaflet: 'http://leafletjs.com',
django: 'https://www.djangoproject.com', django: 'https://www.djangoproject.com',
umap: 'http://wiki.openstreetmap.org/wiki/UMap', umap: 'https://umap-project.org/',
changelog: 'https://umap-project.readthedocs.io/en/master/changelog/', changelog: 'https://docs.umap-project.org/en/master/changelog/',
version: this.map.options.umap_version, version: this.map.options.umap_version,
} }
const creditHTML = translate( const creditHTML = translate(

View file

@ -912,15 +912,11 @@ U.Map = L.Map.extend({
}, },
openBrowser: function (mode) { openBrowser: function (mode) {
this.onceDatalayersLoaded(function () { this.onceDatalayersLoaded(() => this.browser.open(mode))
this.browser.open(mode)
})
}, },
openCaption: function () { openCaption: function () {
this.onceDatalayersLoaded(function () { this.onceDatalayersLoaded(() => this.caption.open())
this.caption.open()
})
}, },
eachDataLayer: function (method, context) { eachDataLayer: function (method, context) {