aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-06-20 15:08:47 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-06-20 15:08:47 +0200
commitb025787a010eae2b8744f99b29aae4e6af16a94a (patch)
treeccd3167222d5fca4b6e5e2b37fa7bc03b97c1544
parentb30575314dbdc0ccaeb3868f3edf34ec6fa0f2e3 (diff)
Minor refactoring.
Scope some variables tighter.
-rw-r--r--main.js49
1 files changed, 26 insertions, 23 deletions
diff --git a/main.js b/main.js
index eccca7a..d50fd81 100644
--- a/main.js
+++ b/main.js
@@ -3909,34 +3909,37 @@ const infoMetadataAccordions = [];
};
})();
- const modal = document.getElementById('measure-panel');
- modal.classList.add('modal');
- modal.setAttribute('role', 'dialog');
- modal.setAttribute('aria-hidden', 'true');
+ const [body, btn_close] = (function() {
+ const modal = document.getElementById('measure-panel');
+ modal.classList.add('modal');
+ modal.setAttribute('role', 'dialog');
+ modal.setAttribute('aria-hidden', 'true');
- const content = document.createElement('div');
- modal.appendChild(content);
- content.classList.add('modal-content');
+ const content = document.createElement('div');
+ modal.appendChild(content);
+ content.classList.add('modal-content');
- const header = document.createElement('div');
- content.appendChild(header);
- header.classList.add('modal-header');
+ const header = document.createElement('div');
+ content.appendChild(header);
+ header.classList.add('modal-header');
- const title = document.createElement('div');
- title.classList.add('h5');
- title.innerHTML = 'Mät i kartan';
- header.appendChild(title);
+ const title = document.createElement('div');
+ title.classList.add('h5');
+ title.innerHTML = 'Mät i kartan';
+ header.appendChild(title);
- const btn_close = document.createElement('button');
- btn_close.classList.add('btn-close');
- btn_close.type = 'button';
- btn_close.title = 'Stäng';
- btn_close.setAttribute('aria-label', btn_close.title);
- header.appendChild(btn_close);
+ const btn_close = document.createElement('button');
+ btn_close.classList.add('btn-close');
+ btn_close.type = 'button';
+ btn_close.title = 'Stäng';
+ btn_close.setAttribute('aria-label', btn_close.title);
+ header.appendChild(btn_close);
- const body = document.createElement('div');
- content.appendChild(body);
- body.classList.add('modal-body');
+ const body = document.createElement('div');
+ content.appendChild(body);
+ body.classList.add('modal-body');
+ return [body, btn_close];
+ })();
const getMeasureMode = (function() {
const btn_group = document.createElement('div');