aboutsummaryrefslogtreecommitdiffstats
path: root/main.js
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 /main.js
parentc2ed0e77b747d3ef66c8ad3e84b0831b646c6ca1 (diff)
ESLint: Remove unused variables.
And also fix `isVisible()` along the way.
Diffstat (limited to 'main.js')
-rw-r--r--main.js41
1 files changed, 18 insertions, 23 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();