Manual review of Lebab for let/const conversions

This commit is contained in:
David Larlet 2023-05-22 15:12:23 -04:00
parent 56ce9ae22c
commit 8d6185c476
No known key found for this signature in database
7 changed files with 20 additions and 22 deletions

View file

@ -880,7 +880,7 @@ L.U.Map.include({
}) })
} }
var filterFeatures = function () { const filterFeatures = function () {
let noResults = true let noResults = true
this.eachDataLayer((datalayer) => { this.eachDataLayer((datalayer) => {
datalayer.eachFeature(function (feature) { datalayer.eachFeature(function (feature) {

View file

@ -140,7 +140,7 @@ L.U.FeatureMixin = {
appendEditFieldsets: function (container) { appendEditFieldsets: function (container) {
const optionsFields = this.getShapeOptions() 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', id: 'umap-feature-shape-properties',
callback: this._redraw, callback: this._redraw,
}) })
@ -148,7 +148,7 @@ L.U.FeatureMixin = {
shapeProperties.appendChild(builder.build()) shapeProperties.appendChild(builder.build())
const advancedOptions = this.getAdvancedOptions() const advancedOptions = this.getAdvancedOptions()
var builder = new L.U.FormBuilder(this, advancedOptions, { builder = new L.U.FormBuilder(this, advancedOptions, {
id: 'umap-feature-advanced-properties', id: 'umap-feature-advanced-properties',
callback: this._redraw, callback: this._redraw,
}) })

View file

@ -340,7 +340,7 @@ L.U.Map.include({
'umap-slideshow-enabled', 'umap-slideshow-enabled',
this.options.slideshow && this.options.slideshow.active this.options.slideshow && this.options.slideshow.active
) )
for (var i in this._controls) { for (const i in this._controls) {
this.removeControl(this._controls[i]) this.removeControl(this._controls[i])
} }
if (this.options.noControl) return if (this.options.noControl) return
@ -357,7 +357,7 @@ L.U.Map.include({
}) })
} }
let name, status, control 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] name = this.HIDDABLE_CONTROLS[i]
status = this.options[name + 'Control'] status = this.options[name + 'Control']
if (status === false) continue if (status === false) continue
@ -846,7 +846,7 @@ L.U.Map.include({
L.DomEvent.on( L.DomEvent.on(
download, download,
'click', 'click',
function () { () => {
const type = types[typeInput.value] const type = types[typeInput.value]
const content = type.formatter(this) const content = type.formatter(this)
let name = this.options.name || 'data' let name = this.options.name || 'data'
@ -957,7 +957,7 @@ L.U.Map.include({
if (layerId) layer = map.datalayers[layerId] if (layerId) layer = map.datalayers[layerId]
if (layer && clearFlag.checked) layer.empty() if (layer && clearFlag.checked) layer.empty()
if (fileInput.files.length) { if (fileInput.files.length) {
var file let file
for (let i = 0, file; (file = fileInput.files[i]); i++) { for (let i = 0, file; (file = fileInput.files[i]); i++) {
type = type || L.Util.detectFileType(file) type = type || L.Util.detectFileType(file)
if (!type) { if (!type) {

View file

@ -644,7 +644,7 @@ L.U.DataLayer = L.Evented.extend({
_polygonToLayer: function (geojson, latlngs) { _polygonToLayer: function (geojson, latlngs) {
// Ensure no empty hole // 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); // if (!latlngs.slice()[i].length) latlngs.splice(i, 1);
// } // }
return new L.U.Polygon(this.map, latlngs, { geojson: geojson, datalayer: this }) 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( L.DomEvent.on(a, 'click', L.DomEvent.stop).on(
a, a,
'click', 'click',
function () { () => this.restore(data.name),
this.restore(data.name)
},
this this
) )
} }
var versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), { const versionsContainer = L.DomUtil.createFieldset(container, L._('Versions'), {
callback: function () { callback: function () {
this.map.xhr.get(this.getVersionsUrl(), { this.map.xhr.get(this.getVersionsUrl(), {
callback: function (data) { callback: function (data) {
@ -1073,8 +1071,8 @@ L.U.DataLayer = L.Evented.extend({
}, },
getNextFeature: function (feature) { getNextFeature: function (feature) {
const id = this._index.indexOf(L.stamp(feature)), const id = this._index.indexOf(L.stamp(feature))
nextId = this._index[id + 1] const nextId = this._index[id + 1]
return nextId ? this._layers[nextId] : this.getNextBrowsable().getFeatureByIndex(0) return nextId ? this._layers[nextId] : this.getNextBrowsable().getFeatureByIndex(0)
}, },
@ -1082,8 +1080,8 @@ L.U.DataLayer = L.Evented.extend({
if (this._index <= 1) { if (this._index <= 1) {
return null return null
} }
const id = this._index.indexOf(L.stamp(feature)), const id = this._index.indexOf(L.stamp(feature))
previousId = this._index[id - 1] const previousId = this._index[id - 1]
return previousId return previousId
? this._layers[previousId] ? this._layers[previousId]
: this.getPreviousBrowsable().getFeatureByIndex(-1) : this.getPreviousBrowsable().getFeatureByIndex(-1)

View file

@ -13,8 +13,8 @@ L.U.Slideshow = L.Class.extend({
this.map = map this.map = map
this._id = null this._id = null
let // current feature // current feature
current = null let current = null
const self = this const self = this
try { try {

View file

@ -85,7 +85,7 @@ L.U.UI = L.Evented.extend({
this._alert.innerHTML = '' this._alert.innerHTML = ''
L.DomUtil.addClass(this.parent, 'umap-alert') L.DomUtil.addClass(this.parent, 'umap-alert')
L.DomUtil.addClass(this._alert, level_class) L.DomUtil.addClass(this._alert, level_class)
const close = function () { function close() {
if (timeoutID !== this.ALERT_ID) { if (timeoutID !== this.ALERT_ID) {
return return
} // Another alert has been forced } // Another alert has been forced

View file

@ -1,3 +1,3 @@
var locale = {{ locale|safe }}; const locale = {{ locale|safe }}
L.registerLocale("{{ locale_code }}", locale); L.registerLocale("{{ locale_code }}", locale)
L.setLocale("{{ locale_code }}"); L.setLocale("{{ locale_code }}")