Enable no-var linting rule and fix issues (#8602)

This commit is contained in:
Jon Koops
2022-10-20 21:18:26 +02:00
committed by GitHub
parent 43d4984974
commit 119785e3a9
160 changed files with 2460 additions and 2462 deletions

View File

@ -4,20 +4,20 @@ title: CanvasCircles
---
<script type='text/javascript'>
var map = L.map('map', {
const map = L.map('map', {
center: [0, 0],
zoom: 0
});
L.GridLayer.CanvasCircles = L.GridLayer.extend({
createTile(coords) {
var tile = document.createElement('canvas');
const tile = document.createElement('canvas');
var tileSize = this.getTileSize();
const tileSize = this.getTileSize();
tile.setAttribute('width', tileSize.x);
tile.setAttribute('height', tileSize.y);
var ctx = tile.getContext('2d');
const ctx = tile.getContext('2d');
// Draw whatever is needed in the canvas context
// For example, circles which get bigger as we zoom in
@ -32,7 +32,7 @@ title: CanvasCircles
return new L.GridLayer.CanvasCircles(opts);
};
var cavasGridLayer = L.gridLayer.canvasCircles();
const cavasGridLayer = L.gridLayer.canvasCircles();
map.addLayer(cavasGridLayer);
</script>

View File

@ -8,16 +8,16 @@ css: "#map {
---
<script type='text/javascript'>
var bounds = [[0, 0], [1570, 1910]];
const bounds = [[0, 0], [1570, 1910]];
var map = L.map('map', {
const map = L.map('map', {
crs: L.CRS.Simple,
maxZoom: 0,
minZoom: -4,
maxBounds: bounds
});
var image = L.imageOverlay('class-diagram.png', bounds).addTo(map);
const image = L.imageOverlay('class-diagram.png', bounds).addTo(map);
map.fitBounds(bounds);

View File

@ -4,14 +4,14 @@ title: Grid coordinates
---
<script type='text/javascript'>
var map = L.map('map', {
const map = L.map('map', {
center: [0, 0],
zoom: 0
});
L.GridLayer.DebugCoords = L.GridLayer.extend({
createTile(coords, done) {
var tile = document.createElement('div');
const tile = document.createElement('div');
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.outline = '1px solid red';
@ -27,7 +27,7 @@ title: Grid coordinates
return new L.GridLayer.DebugCoords(opts);
};
var debugCoordsGrid = L.gridLayer.debugCoords();
const debugCoordsGrid = L.gridLayer.debugCoords();
map.addLayer(debugCoordsGrid);
</script>

View File

@ -4,7 +4,7 @@ title: KittenLayer
---
<script type='text/javascript'>
var map = L.map('map', {
const map = L.map('map', {
crs: L.CRS.Simple,
center: [0, 0],
zoom: 5
@ -12,7 +12,7 @@ title: KittenLayer
L.TileLayer.Kitten = L.TileLayer.extend({
getTileUrl(coords) {
var i = Math.ceil(Math.random() * 4);
const i = Math.ceil(Math.random() * 4);
return `https://placekitten.com/256/256?image=${i}`;
},
getAttribution() {
@ -24,7 +24,7 @@ title: KittenLayer
return new L.TileLayer.Kitten();
};
var kittenTiles = L.tileLayer.kitten();
const kittenTiles = L.tileLayer.kitten();
map.addLayer(kittenTiles);
</script>

View File

@ -26,22 +26,22 @@ title: Grid coordinates
<script type='text/javascript'>
var trd = [63.41, 10.41];
const trd = [63.41, 10.41];
var map = L.map('map', {
const map = L.map('map', {
center: [40, 0],
zoom: 1
});
var positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
const positron = L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="https://carto.com/attribution">CARTO</a>'
}).addTo(map);
var marker = L.marker(trd).addTo(map);
const marker = L.marker(trd).addTo(map);
var pane = map.getPane('markerPane');
const pane = map.getPane('markerPane');
var paneCorner = document.createElement('div');
const paneCorner = document.createElement('div');
paneCorner.style.width = '12px';
paneCorner.style.height = '12px';
paneCorner.style.borderTop = '2px red solid';
@ -51,7 +51,7 @@ title: Grid coordinates
marker._icon.style.border = '1px solid blue';
var crsMarker = L.marker(map.unproject([0, 0]), {
const crsMarker = L.marker(map.unproject([0, 0]), {
icon: L.divIcon({
className: 'crsMarker',
iconAnchor: [0, 0]
@ -59,14 +59,14 @@ title: Grid coordinates
}).addTo(map);
var markerOffsetLine = L.polyline([[0, 0], [0, 0]], {color: 'skyblue'}).addTo(map);
var iconOffsetLine = L.polyline([[0, 0], [0, 0]], {color: 'blue'}).addTo(map);
const markerOffsetLine = L.polyline([[0, 0], [0, 0]], {color: 'skyblue'}).addTo(map);
const iconOffsetLine = L.polyline([[0, 0], [0, 0]], {color: 'blue'}).addTo(map);
function info() {
var pixelOrigin = map.getPixelOrigin();
var markerPixelCoords = map.project(trd, map.getZoom());
var markerAnchor = marker.options.icon.options.iconAnchor;
var markerOffset = marker._icon._leaflet_pos;
const pixelOrigin = map.getPixelOrigin();
const markerPixelCoords = map.project(trd, map.getZoom());
const markerAnchor = marker.options.icon.options.iconAnchor;
const markerOffset = marker._icon._leaflet_pos;
document.getElementById('info').innerHTML =
'<div style="color: green">CRS origin: 0,0</div>' +

View File

@ -26,7 +26,7 @@ title: Tilt handler
<script type='text/javascript'>
var trd = [63.41, 10.41];
const trd = [63.41, 10.41];
L.TiltHandler = L.Handler.extend({
addHooks() {
@ -39,8 +39,8 @@ title: Tilt handler
_tilt(ev) {
// Treat Gamma angle as horizontal pan (1 degree = 1 pixel) and Beta angle as vertical pan
var info;
var offset = L.point(ev.gamma, ev.beta);
const offset = L.point(ev.gamma, ev.beta);
let info;
if (offset) {
this._map.panBy(offset);
info = `${ev.gamma},${ev.beta}`;
@ -53,13 +53,13 @@ title: Tilt handler
L.Map.addInitHook('addHandler', 'tilt', L.TiltHandler);
var map = L.map('map', {
const map = L.map('map', {
center: [0, 0],
zoom: 1,
tilt: true
});
var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);

View File

@ -3,19 +3,19 @@ layout: tutorial_frame
title: Watermark control
---
<script type='text/javascript'>
var map = L.map('map', {
const map = L.map('map', {
center: [40, 0],
zoom: 1
});
var osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
const osm = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
L.Control.Watermark = L.Control.extend({
onAdd(map) {
var img = L.DomUtil.create('img');
const img = L.DomUtil.create('img');
img.src = '../../docs/images/logo.png';
img.style.width = '200px';
@ -32,6 +32,6 @@ title: Watermark control
return new L.Control.Watermark(opts);
};
var watermarkControl = L.control.watermark({position: 'bottomleft'}).addTo(map);
const watermarkControl = L.control.watermark({position: 'bottomleft'}).addTo(map);
</script>