diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 34a380ea..0985cd5c 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -880,7 +880,7 @@ L.U.Map.include({ }) } - var filterFeatures = function () { + const filterFeatures = function () { let noResults = true this.eachDataLayer((datalayer) => { datalayer.eachFeature(function (feature) { diff --git a/umap/static/umap/js/umap.features.js b/umap/static/umap/js/umap.features.js index 2fac5fca..32460d97 100644 --- a/umap/static/umap/js/umap.features.js +++ b/umap/static/umap/js/umap.features.js @@ -140,7 +140,7 @@ L.U.FeatureMixin = { appendEditFieldsets: function (container) { const optionsFields = this.getShapeOptions() - var builder = new L.U.FormBuilder(this, optionsFields, { + let builder = new L.U.FormBuilder(this, optionsFields, { id: 'umap-feature-shape-properties', callback: this._redraw, }) @@ -148,7 +148,7 @@ L.U.FeatureMixin = { shapeProperties.appendChild(builder.build()) const advancedOptions = this.getAdvancedOptions() - var builder = new L.U.FormBuilder(this, advancedOptions, { + builder = new L.U.FormBuilder(this, advancedOptions, { id: 'umap-feature-advanced-properties', callback: this._redraw, }) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 7af18388..6ac6690f 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -340,7 +340,7 @@ L.U.Map.include({ 'umap-slideshow-enabled', this.options.slideshow && this.options.slideshow.active ) - for (var i in this._controls) { + for (const i in this._controls) { this.removeControl(this._controls[i]) } if (this.options.noControl) return @@ -357,7 +357,7 @@ L.U.Map.include({ }) } let name, status, control - for (var i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { + for (let i = 0; i < this.HIDDABLE_CONTROLS.length; i++) { name = this.HIDDABLE_CONTROLS[i] status = this.options[name + 'Control'] if (status === false) continue @@ -846,7 +846,7 @@ L.U.Map.include({ L.DomEvent.on( download, 'click', - function () { + () => { const type = types[typeInput.value] const content = type.formatter(this) let name = this.options.name || 'data' @@ -957,7 +957,7 @@ L.U.Map.include({ if (layerId) layer = map.datalayers[layerId] if (layer && clearFlag.checked) layer.empty() if (fileInput.files.length) { - var file + let file for (let i = 0, file; (file = fileInput.files[i]); i++) { type = type || L.Util.detectFileType(file) if (!type) { diff --git a/umap/static/umap/js/umap.layer.js b/umap/static/umap/js/umap.layer.js index 1da7fdde..2113ea15 100644 --- a/umap/static/umap/js/umap.layer.js +++ b/umap/static/umap/js/umap.layer.js @@ -644,7 +644,7 @@ L.U.DataLayer = L.Evented.extend({ _polygonToLayer: function (geojson, latlngs) { // Ensure no empty hole - // for (var i = latlngs.length - 1; i > 0; i--) { + // for (let i = latlngs.length - 1; i > 0; i--) { // if (!latlngs.slice()[i].length) latlngs.splice(i, 1); // } return new L.U.Polygon(this.map, latlngs, { geojson: geojson, datalayer: this }) @@ -984,14 +984,12 @@ L.U.DataLayer = L.Evented.extend({ L.DomEvent.on(a, 'click', L.DomEvent.stop).on( a, 'click', - function () { - this.restore(data.name) - }, + () => this.restore(data.name), this ) } - var versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), { + const versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), { callback: function () { this.map.xhr.get(this.getVersionsUrl(), { callback: function (data) { @@ -1073,8 +1071,8 @@ L.U.DataLayer = L.Evented.extend({ }, getNextFeature: function (feature) { - const id = this._index.indexOf(L.stamp(feature)), - nextId = this._index[id + 1] + const id = this._index.indexOf(L.stamp(feature)) + const nextId = this._index[id + 1] return nextId ? this._layers[nextId] : this.getNextBrowsable().getFeatureByIndex(0) }, @@ -1082,8 +1080,8 @@ L.U.DataLayer = L.Evented.extend({ if (this._index <= 1) { return null } - const id = this._index.indexOf(L.stamp(feature)), - previousId = this._index[id - 1] + const id = this._index.indexOf(L.stamp(feature)) + const previousId = this._index[id - 1] return previousId ? this._layers[previousId] : this.getPreviousBrowsable().getFeatureByIndex(-1) diff --git a/umap/static/umap/js/umap.slideshow.js b/umap/static/umap/js/umap.slideshow.js index b03ac6fe..f353cc54 100644 --- a/umap/static/umap/js/umap.slideshow.js +++ b/umap/static/umap/js/umap.slideshow.js @@ -13,8 +13,8 @@ L.U.Slideshow = L.Class.extend({ this.map = map this._id = null - let // current feature - current = null + // current feature + let current = null const self = this try { diff --git a/umap/static/umap/js/umap.ui.js b/umap/static/umap/js/umap.ui.js index 39416f2e..73158257 100644 --- a/umap/static/umap/js/umap.ui.js +++ b/umap/static/umap/js/umap.ui.js @@ -85,7 +85,7 @@ L.U.UI = L.Evented.extend({ this._alert.innerHTML = '' L.DomUtil.addClass(this.parent, 'umap-alert') L.DomUtil.addClass(this._alert, level_class) - const close = function () { + function close() { if (timeoutID !== this.ALERT_ID) { return } // Another alert has been forced diff --git a/umap/templates/umap/locale.js b/umap/templates/umap/locale.js index 374a6206..7dcf434b 100644 --- a/umap/templates/umap/locale.js +++ b/umap/templates/umap/locale.js @@ -1,3 +1,3 @@ -var locale = {{ locale|safe }}; -L.registerLocale("{{ locale_code }}", locale); -L.setLocale("{{ locale_code }}"); \ No newline at end of file +const locale = {{ locale|safe }} +L.registerLocale("{{ locale_code }}", locale) +L.setLocale("{{ locale_code }}")