aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/main.js b/main.js
index 8d95f5b..fe7a96f 100644
--- a/main.js
+++ b/main.js
@@ -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) {