aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-06-05 16:15:39 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-06-05 16:19:17 +0200
commit028184920b6bc380fceaa1c73f4fd4698247f106 (patch)
treefe6c06c31854eb241127e6d1d6de56cdc23b4242
parent722fb24ab2cf606a60b34991bb4e6f36b7e8ec18 (diff)
JS: Don't redirect an empty `layers=` parameter to the default layer selection.
-rw-r--r--main.js11
1 files changed, 3 insertions, 8 deletions
diff --git a/main.js b/main.js
index d857899..e72b95e 100644
--- a/main.js
+++ b/main.js
@@ -131,14 +131,9 @@ let baseMapLayer = 'topowebb_nedtonad';
if (!isNaN(z)) {
view.setZoom(z);
}
- if (params.has('layers')) {
- const layers = params.get('layers').split(' ');
- if (layers.length > 0 && !layers.some((l) => l.includes('.'))) {
- /* compat redirect/layer subst for old non-hierachical names */
- params.delete('layers');
- }
- }
- if (!params.has('layers')) {
+ if (!params.has('layers') || (!params.get('layers').match(/^\s*$/) &&
+ /* compat redirect/layer subst for old non-hierachical names */
+ !params.get('layers').split(' ').some((l) => l.includes('.')))) {
params.set('layers', [
'svk.ledningar',
'svk.stolpar',