commit 60e33f59d62fee97cdff16f25c88f46c66ed2e90
parent 1ac0eeb5ddb072423c964bfa5752daa6f4c153e6
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Sun, 5 Jan 2020 12:29:48 +0100
fix lint errors (block-scoped-var)
Diffstat:
6 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/src/lib/clipboardCopy/index.js b/src/lib/clipboardCopy/index.js
@@ -26,8 +26,9 @@ function showNotification(message, mouseEvent) {
function copyToClipboard(s, mouseEvent) {
let success = false;
+ let ta;
try {
- var ta = document.createElement('textarea');
+ ta = document.createElement('textarea');
ta.value = s;
document.body.appendChild(ta);
ta.select();
diff --git a/src/lib/leaflet.control.elevation-profile/index.js b/src/lib/leaflet.control.elevation-profile/index.js
@@ -824,6 +824,10 @@ const ElevationProfile = L.Class.extend({
minDist = null,
mouseLatlng = e.latlng,
i, sampleLatlng, dist, di;
+ let nextDist,
+ nextSampleDist,
+ prevDist,
+ prevSampleDist;
for (i = 0; i < this.samples.length; i++) {
sampleLatlng = this.samples[i];
dist = sqrDist(sampleLatlng, mouseLatlng);
@@ -836,12 +840,12 @@ const ElevationProfile = L.Class.extend({
if (nearestInd !== null) {
ind = nearestInd;
if (nearestInd > 0) {
- var prevDist = sqrDist(mouseLatlng, this.samples[nearestInd - 1]),
- prevSampleDist = sqrDist(this.samples[nearestInd], this.samples[nearestInd - 1]);
+ prevDist = sqrDist(mouseLatlng, this.samples[nearestInd - 1]);
+ prevSampleDist = sqrDist(this.samples[nearestInd], this.samples[nearestInd - 1]);
}
if (nearestInd < this.samples.length - 1) {
- var nextDist = sqrDist(mouseLatlng, this.samples[nearestInd + 1]),
- nextSampleDist = sqrDist(this.samples[nearestInd], this.samples[nearestInd + 1]);
+ nextDist = sqrDist(mouseLatlng, this.samples[nearestInd + 1]);
+ nextSampleDist = sqrDist(this.samples[nearestInd], this.samples[nearestInd + 1]);
}
if (nearestInd === 0) {
diff --git a/src/lib/leaflet.control.jnx/hash-state.js b/src/lib/leaflet.control.jnx/hash-state.js
@@ -39,10 +39,11 @@ L.Control.JNX.include({
}
if (values && values.length === 4) {
+ let south, west, north, east;
try {
- var south = validateFloatRange(values[0], -86, 86),
- west = validateFloat(values[1]),
- north = validateFloatRange(values[2], -86, 86),
+ south = validateFloatRange(values[0], -86, 86);
+ west = validateFloat(values[1]);
+ north = validateFloatRange(values[2], -86, 86);
east = validateFloat(values[3]);
} catch (e) {
if (e.message === 'INVALID VALUE') {
diff --git a/src/lib/leaflet.control.track-list/lib/parsers/gpx.js b/src/lib/leaflet.control.track-list/lib/parsers/gpx.js
@@ -90,8 +90,9 @@ function parseGpx(txt, name, preferNameFromFile) {
txt = stripBom(txt);
// remove namespaces
txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2');
+ let dom;
try {
- var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ dom = (new DOMParser()).parseFromString(txt, "text/xml");
} catch (e) {
return null;
}
diff --git a/src/lib/leaflet.control.track-list/lib/parsers/kml.js b/src/lib/leaflet.control.track-list/lib/parsers/kml.js
@@ -89,8 +89,9 @@ function parseKml(txt, name) {
txt = stripBom(txt);
txt = txt.replace(/<([^ >]+):([^ >]+)/g, '<$1_$2');
+ let dom;
try {
- var dom = (new DOMParser()).parseFromString(txt, "text/xml");
+ dom = (new DOMParser()).parseFromString(txt, "text/xml");
} catch (e) {
return null;
}
@@ -106,8 +107,9 @@ function parseKml(txt, name) {
function parseKmz(txt, name) {
var uncompressed;
+ let unzipper;
try {
- var unzipper = new JSUnzip(txt);
+ unzipper = new JSUnzip(txt);
} catch (e) {
return null;
}
diff --git a/src/lib/leaflet.control.track-list/lib/parsers/zip.js b/src/lib/leaflet.control.track-list/lib/parsers/zip.js
@@ -4,8 +4,9 @@ import {decode866} from './codePages';
import parseGeoFile from '../parseGeoFile';
function parseZip(txt, _unused_name) {
+ let unzipper;
try {
- var unzipper = new JSUnzip(txt);
+ unzipper = new JSUnzip(txt);
} catch (e) {
return null;
}