clean up variable declarations and indentation

This commit is contained in:
Hugh Rundle 2021-01-19 18:21:36 +11:00
parent 632534789d
commit f9c6b9274d

View file

@ -1,5 +1,5 @@
// add tile layer from OSM // add tile layer from OSM
var baseMap = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { const baseMap = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>', attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18, maxZoom: 18,
id: 'mapbox/dark-v10', id: 'mapbox/dark-v10',
@ -8,7 +8,7 @@ var baseMap = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/
accessToken: 'pk.eyJ1IjoiaHVnaHIiLCJhIjoiY2lxenRqMGQyMDJvdWZwbWd0d2JxeGswNiJ9.vfUQRJDzbJhaG_865TSkPA' accessToken: 'pk.eyJ1IjoiaHVnaHIiLCJhIjoiY2lxenRqMGQyMDJvdWZwbWd0d2JxeGswNiJ9.vfUQRJDzbJhaG_865TSkPA'
}); });
var baseRules = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', { const baseRules = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a><br>Incorporates Administrative Boundaries ©PSMA Australia Limited licensed by the Commonwealth of Australia under Creative Commons Attribution 4.0 International licence (CC BY 4.0).', attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a><br>Incorporates Administrative Boundaries ©PSMA Australia Limited licensed by the Commonwealth of Australia under Creative Commons Attribution 4.0 International licence (CC BY 4.0).',
maxZoom: 18, maxZoom: 18,
id: 'mapbox/light-v10', id: 'mapbox/light-v10',
@ -18,7 +18,7 @@ var baseRules = L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}
}); });
// attach map to #mapid div above and centre // attach map to #mapid div above and centre
var map = L.map('mapid', { const map = L.map('mapid', {
center: [-27.00, 133.000], center: [-27.00, 133.000],
zoom: 5, zoom: 5,
layers: [baseMap] layers: [baseMap]
@ -43,7 +43,7 @@ L.TopoJSON = L.GeoJSON.extend({
// ----------------------------------------------------------------- // -----------------------------------------------------------------
// library services fines overlay // library services fines overlay
var fines = new L.TopoJSON(libraryServices, { const fines = new L.TopoJSON(libraryServices, {
style: function(feature){ style: function(feature){
return { return {
fillColor: getFinesColor(feature.properties.fines), fillColor: getFinesColor(feature.properties.fines),
@ -64,7 +64,7 @@ onEachFeature: function onEachFeature(feature, layer) {
// fill patterns for loan period overlay // fill patterns for loan period overlay
var circles = new L.PatternCircle({ const circles = new L.PatternCircle({
color: '#000', color: '#000',
weight: 1, weight: 1,
radius: 2, radius: 2,
@ -74,7 +74,7 @@ var circles = new L.PatternCircle({
fillOpacity: 1 fillOpacity: 1
}); });
var loanTwo = new L.Pattern({ const loanTwo = new L.Pattern({
width: 8, width: 8,
height: 8 height: 8
}) })
@ -82,12 +82,12 @@ var loanTwo = new L.Pattern({
loanTwo.addShape(circles); loanTwo.addShape(circles);
loanTwo.addTo(map); loanTwo.addTo(map);
var loanThree = new L.StripePattern({ const loanThree = new L.StripePattern({
color: '#000' color: '#000'
}); });
loanThree.addTo(map); loanThree.addTo(map);
var loanFour = new L.StripePattern({ const loanFour = new L.StripePattern({
color: '#000', color: '#000',
weight: 6, weight: 6,
spaceWeight: 2, spaceWeight: 2,
@ -95,7 +95,7 @@ angle: 45
}); });
loanFour.addTo(map); loanFour.addTo(map);
var loanSix = new L.StripePattern({ const loanSix = new L.StripePattern({
color: '#000', color: '#000',
weight: 2, weight: 2,
spaceWeight: 6, spaceWeight: 6,
@ -111,7 +111,7 @@ return w == '2' ? loanTwo :
} }
// loan period overlay // loan period overlay
var loanPeriod = new L.TopoJSON(libraryServices, { const loanPeriod = new L.TopoJSON(libraryServices, {
style: function(feature){ style: function(feature){
return { return {
weight: 3, weight: 3,
@ -122,7 +122,6 @@ style: function(feature){
fillPattern: getLoanFillPattern(feature.properties.standard_loan_weeks) fillPattern: getLoanFillPattern(feature.properties.standard_loan_weeks)
} }
}, },
onEachFeature: function onEachFeature(feature, layer) { onEachFeature: function onEachFeature(feature, layer) {
layer.on({ layer.on({
mouseover: e => highlightFeature(e), mouseover: e => highlightFeature(e),
@ -262,16 +261,16 @@ const otherLibs = L.layerGroup([
// ++++++++++++++ // ++++++++++++++
// control layers // control layers
// ++++++++++++++ // ++++++++++++++
var baseMaps = { const baseMaps = {
"Libraries" : baseMap, "Libraries" : baseMap,
// "Languages" : baseLang, // "Languages" : baseLang,
"Rules" : baseRules, "Rules" : baseRules,
} }
// change the overlay name depending on the mode. // change the overlay name depending on the mode.
var modeButton = document.getElementById('mode-button'); const modeButton = document.getElementById('mode-button');
var overlayMaps = { const overlayMaps = {
"Settler Knowledge Centres" : branches, "Settler Knowledge Centres" : branches,
"Indigenous Knowledge Centres": ikcs, "Indigenous Knowledge Centres": ikcs,
"Worker Pacification Centres" : mechsAndSoA, "Worker Pacification Centres" : mechsAndSoA,
@ -326,7 +325,7 @@ function switchMode() {
modeButton.addEventListener('click', switchMode, false); modeButton.addEventListener('click', switchMode, false);
// add control layers // add control layers
var mapControl = L.control.layers( const mapControl = L.control.layers(
baseMaps, baseMaps,
overlayMaps, overlayMaps,
{ "collapsed" : false } { "collapsed" : false }
@ -336,7 +335,7 @@ var mapControl = L.control.layers(
L.control.scale().addTo(map); L.control.scale().addTo(map);
// info boxes // info boxes
var infoBoxes = { const infoBoxes = {
branches: L.control(), branches: L.control(),
fines: L.control(), fines: L.control(),
loanPeriod: L.control(), loanPeriod: L.control(),
@ -353,7 +352,7 @@ return f == 'no' ? '#4dac26' :
// highlight feature on mouse hover // highlight feature on mouse hover
function highlightFeature(e) { function highlightFeature(e) {
var layer = e.target; const layer = e.target;
layer.setStyle({ layer.setStyle({
weight: 6, weight: 6,
color: '#FF3961', color: '#FF3961',