aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-06-12 13:40:18 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-06-12 13:49:45 +0200
commit000f1f83533a70249ee73a378bb8d14dafa1e26f (patch)
treec6edf9798804bc630d18f798ccf0f2ebc81468c2
parentc2ed0e77b747d3ef66c8ad3e84b0831b646c6ca1 (diff)
ESLint: Remove unused variables.
And also fix `isVisible()` along the way.
-rw-r--r--main.js41
-rw-r--r--src/layers.js32
2 files changed, 34 insertions, 39 deletions
diff --git a/main.js b/main.js
index 7fa3e95..2740ee4 100644
--- a/main.js
+++ b/main.js
@@ -372,7 +372,7 @@ if (window.location !== window.parent.location) {
btn.appendChild(i);
i.classList.add('bi', 'bi-box-arrow-up-right');
- btn.onclick = function(event) {
+ btn.onclick = function() {
const coordinates = view.getCenter();
const url = new URL(window.location.href);
const searchParams = new URLSearchParams(url.hash.substring(1));
@@ -416,7 +416,7 @@ if (window.location === window.parent.location) {
return;
}
const btn = buttons[id];
- btn.onclick = function(event) {
+ btn.onclick = function() {
if (btn.getAttribute('aria-expanded') === 'true') {
panel.setAttribute('aria-hidden', 'true');
btn.setAttribute('aria-expanded', 'false');
@@ -512,7 +512,7 @@ if (window.location === window.parent.location) {
i.classList.add('bi', 'bi-download');
menu.appendChild(div);
- btn.onclick = function(event) {
+ btn.onclick = function() {
map.once('rendercomplete', function() {
const canvas0 = document.createElement('canvas');
const size = map.getSize();
@@ -570,7 +570,7 @@ if (window.location === window.parent.location) {
});
const backdrop = document.getElementById('info-modal-backdrop');
- backdrop.onclick = function(event) {
+ backdrop.onclick = function() {
modal.hide();
};
@@ -613,7 +613,7 @@ if (window.location === window.parent.location) {
});
});
- btn.onclick = function(event) {
+ btn.onclick = function() {
infoMetadataAccordions.forEach((x) => x.element.replaceChildren());
modal.show();
Promise.allSettled(Object.entries(mapLayers).map(function([grp,lyr]) {
@@ -647,7 +647,7 @@ if (window.location === window.parent.location) {
const ul = x.element;
const groupnames = new Set();
const last_updated = [];
- x.items.forEach(function([groupname, _]) {
+ x.items.forEach(function([groupname]) {
const layer_group = metadata[groupname];
if (layer_group == null) {
return;
@@ -782,7 +782,7 @@ if (window.location === window.parent.location) {
/* we're all set, show the control container now */
container.setAttribute('aria-hidden', 'false');
-view.on('change', function(event) {
+view.on('change', function() {
featureOverlayLayer.setVisible(false);
Popover.getInstance(popup)?.dispose();
@@ -1217,7 +1217,7 @@ const [mapLayers, featureOverlayLayer] = (function() {
});
const isVisible = function(groupname) {
return Object.keys(layers).some((layername) =>
- layername.startsWith(layername + '.') && styles[lyr] !== undefined);
+ layername.startsWith(groupname + '.') && styles[layername] !== undefined);
};
const canWebGL2 = !!document.createElement('canvas').getContext('webgl2');
@@ -1975,7 +1975,7 @@ const infoMetadataAccordions = [];
type_choice.operator[0].onchange = input_quantity.onchange
= type_choice.unit[0].onchange
- = function(event) {
+ = function() {
const d = type_choice._update_helptext();
if (d != null) {
/* propagate to interval tab */
@@ -2054,13 +2054,13 @@ const infoMetadataAccordions = [];
};
/* make sure that from_date ≤ to_date */
- date1.onchange = function(event) {
+ date1.onchange = function() {
if (date1.value !== '' && (date2.value === '' || date1.value > date2.value)) {
date2.value = date1.value;
}
propagate_to_relative();
};
- date2.onchange = function(event) {
+ date2.onchange = function() {
if (date2.value !== '' && (date1.value === '' || date1.value > date2.value)) {
date1.value = date2.value;
}
@@ -2107,7 +2107,7 @@ const infoMetadataAccordions = [];
btn_apply.setAttribute('form', form.id);
footer.appendChild(btn_apply);
- btn_cancel.onclick = function(event) {
+ btn_cancel.onclick = function() {
/* deactivate deactivate the filter but preserve its settings */
age_filter_settings.active = false;
Object.values(mapLayers).forEach(function(lyr) {
@@ -2126,9 +2126,7 @@ const infoMetadataAccordions = [];
form.onsubmit = function(event) {
event.preventDefault();
- const [filter_type, filter_settings] = Object.entries(type_choices).filter(function([id, x]) {
- return x.radio.checked;
- })[0];
+ const [filter_type, filter_settings] = Object.entries(type_choices).filter( (x) => x[1].radio.checked )[0];
let param;
age_filter_settings._min_ts = age_filter_settings._max_ts = null;
switch (filter_type) {
@@ -2202,7 +2200,7 @@ const infoMetadataAccordions = [];
});
const backdrop = document.getElementById('age-filter-modal-backdrop');
- backdrop.onclick = function(event) {
+ backdrop.onclick = function() {
modal.hide();
};
@@ -2230,7 +2228,7 @@ const infoMetadataAccordions = [];
backdrop.classList.remove('modal-backdrop', 'show');
});
- btn.onclick = function(event) {
+ btn.onclick = function() {
dialog_setup();
modal.show();
};
@@ -2267,9 +2265,6 @@ const infoMetadataAccordions = [];
/* detach popover tip */
popoverTip.classList.add('popover-detached');
const rect = popoverTip.getBoundingClientRect();
- const maxHeight = document.getElementById('map').getBoundingClientRect().height - 1 - rect.top -
- popoverTip.getElementsByClassName('popover-header')[0].getBoundingClientRect().height;
-
const style = popoverTip.style;
style.display = 'none'; /* avoid reflows between the following assignments */
style.position = 'absolute';
@@ -2325,7 +2320,7 @@ const infoMetadataAccordions = [];
featureOverlayLayer.setVisible(false);
source.setUrls(urls);
}
- featureOverlayLayer.setStyle(function(feature, resolution) {
+ featureOverlayLayer.setStyle(function(feature) {
if (feature.getId() === id && feature.getProperties().layer === layer) {
return featureOverlayStyle;
} else {
@@ -2392,7 +2387,7 @@ const infoMetadataAccordions = [];
const btnExpandTitle = 'Förstora';
const btnExpandTitle2 = 'Förminska';
btnExpand.setAttribute('aria-label', btnExpand.title);
- btnExpand.onclick = function(event) {
+ btnExpand.onclick = function() {
if (popover?.tip == null) {
return;
}
@@ -2415,7 +2410,7 @@ const infoMetadataAccordions = [];
btnClose.setAttribute('type', 'button');
btnClose.title = 'Stäng';
btnClose.setAttribute('aria-label', btnClose.title);
- btnClose.onclick = function(event) {
+ btnClose.onclick = function() {
featureOverlayLayer.setVisible(false);
featureOverlayLayer.changed();
popover?.dispose();
diff --git a/src/layers.js b/src/layers.js
index b914e17..6f72dfc 100644
--- a/src/layers.js
+++ b/src/layers.js
@@ -410,7 +410,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 17,
fill: new Fill({
@@ -455,7 +455,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 16,
fill: new Fill({
@@ -548,7 +548,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 11,
fill: new Fill({
@@ -591,7 +591,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 15,
fill: new Fill({
@@ -630,7 +630,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 14,
fill: new Fill({
@@ -668,7 +668,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 13,
fill: new Fill({
@@ -771,7 +771,7 @@ export const layers = {
['Senast uppdaterat', 'SenasteUppdaterat'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 10,
fill: new Fill({
@@ -1147,7 +1147,7 @@ export const layers = {
['Areal', 'geom_area', { fn: 'area' }],
],
legend: { zoomLevel: 2 },
- style: [1, 1.5, 2, 3, 3.5, 4, 5, 5, 6, 7, 8, 10].map(function(width, z) {
+ style: [1, 1.5, 2, 3, 3.5, 4, 5, 5, 6, 7, 8, 10].map(function(width) {
return new Style({
zIndex: 23,
fill: new Fill({
@@ -1777,7 +1777,7 @@ export const layers = {
['Skogsmarksareal', 'SKOG_HA', { unit: 'ha' }],
],
legend: { zoomLevel: 6, type: 'point' },
- style: [undefined, undefined, undefined, undefined].concat([3, 4, 6, 8, 12, 16, 20, 24].map(function(width, z) {
+ style: [undefined, undefined, undefined, undefined].concat([3, 4, 6, 8, 12, 16, 20, 24].map(function(width) {
return new Style({
zIndex: 12,
image: new CircleStyle({
@@ -2317,7 +2317,7 @@ export const layers = {
}),
});
})
- .concat([7, 8, 9, 10, 11].map(function(width) {
+ .concat([7, 8, 9, 10, 11].map(function() {
const patternCanvas = document.createElement('canvas');
const patternContext = patternCanvas.getContext('2d');
patternCanvas.width = 16;
@@ -2389,7 +2389,7 @@ export const layers = {
}),
});
})
- .concat([6, 7, 8, 9, 10, 11].map(function(width) {
+ .concat([6, 7, 8, 9, 10, 11].map(function() {
const patternCanvas = document.createElement('canvas');
const patternContext = patternCanvas.getContext('2d');
patternCanvas.width = 16;
@@ -2466,7 +2466,7 @@ export const layers = {
}),
});
})
- .concat([6, 7, 8, 9, 10, 11].map(function(width) {
+ .concat([6, 7, 8, 9, 10, 11].map(function() {
const patternCanvas = document.createElement('canvas');
const patternContext = patternCanvas.getContext('2d');
patternCanvas.width = 16;
@@ -2531,7 +2531,7 @@ export const layers = {
}),
});
})
- .concat([6, 7, 8, 9, 10, 11].map(function(width) {
+ .concat([6, 7, 8, 9, 10, 11].map(function() {
const patternCanvas = document.createElement('canvas');
const patternContext = patternCanvas.getContext('2d');
patternCanvas.width = 16;
@@ -2694,7 +2694,7 @@ export const layers = {
['Källor', 'KALLOR'],
],
legend: { zoomLevel: 1 },
- style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width, z) {
+ style: [.5, 1, 1.5, 1.5, 2, 2, 2.5, 2.5, 3, 3.5, 4, 5].map(function(width) {
return new Style({
zIndex: 4,
fill: new Fill({
@@ -3074,7 +3074,7 @@ export const layers = {
['Aktualitet', 'AKTUALITET'],
],
legend: { zoomLevel: 0 },
- style: [1, 1.5, 2, 3, 3.5, 4, 5, 5, 6, 7, 8, 10].map(function(width, z) {
+ style: [1, 1.5, 2, 3, 3.5, 4, 5, 5, 6, 7, 8, 10].map(function(width) {
return new Style({
zIndex: 4,
fill: new Fill({
@@ -3105,7 +3105,7 @@ export const layers = {
['Ledlängd', 'geom_length', { fn: 'length' }],
],
legend: { zoomLevel: 2, type: 'linestring' },
- style: [.75, 1, 1.5, 2, 3, 4, 5, 5, 6, 7, 8, 10].map(function(width, z) {
+ style: [.75, 1, 1.5, 2, 3, 4, 5, 5, 6, 7, 8, 10].map(function(width) {
return new Style({
zIndex: 7,
stroke: new Stroke({