diff options
| author | Guilhem Moulin <guilhem@fripost.org> | 2026-10-16 01:03:26 +0200 |
|---|---|---|
| committer | Guilhem Moulin <guilhem@fripost.org> | 2026-10-16 01:08:20 +0200 |
| commit | a52e0350f0b6d83a4c7ddd22f4f926241e078d33 (patch) | |
| tree | 1013ebd1d9768b38d2ab912e8a83af86778eed3d /main.js | |
| parent | 8f4cbb4636ad5abefbf1eca3a28360305cd526c2 (diff) | |
Also show layer selection and legend buttons in <iframe/>.
Diffstat (limited to 'main.js')
| -rw-r--r-- | main.js | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -271,13 +271,18 @@ if (window.location !== window.parent.location) { } /* layer selection button and legend */ -if (window.location === window.parent.location) { +(function(is_iframe) { const buttons = Object.fromEntries([ - {id: 'layer-selection', title: 'Lagerval', bi: 'stack'}, - {id: 'map-legend', title: 'Teckenförklaring', bi: 'list-task'}, - {id: 'measure', title: 'Mät i kartan', bi: 'rulers'}, - {id: 'age-filter', title: 'Filtrera objekt efter ålder', bi: 'clock-history'}, + { id: 'layer-selection', title: 'Lagerval', bi: 'stack' }, + { id: 'map-legend', title: 'Teckenförklaring', bi: 'list-task' }, + { id: 'measure', title: 'Mät i kartan', bi: 'rulers', + create: !is_iframe }, + { id: 'age-filter', title: 'Filtrera objekt efter ålder', + bi: 'clock-history', create: !is_iframe }, ].map(function(x) { + if (x['create'] === false) { + return null; + } const div = document.createElement('div'); MENU.appendChild(div); div.id = x.id + '-button'; @@ -295,7 +300,7 @@ if (window.location === window.parent.location) { btn.appendChild(i); i.classList.add('bi', 'bi-' + x.bi); return [x.id, btn] - })); + }).filter(x => x != null)); Object.entries(buttons).forEach(function([id, btn]) { const panel = document.getElementById(id + '-panel'); @@ -319,7 +324,7 @@ if (window.location === window.parent.location) { }; } }); -} +})(window.location !== window.parent.location); /* fullscreen control */ if (window.location === window.parent.location) { |
