aboutsummaryrefslogtreecommitdiffstats
path: root/main.js
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-01-14 00:23:53 +0100
committerGuilhem Moulin <guilhem@fripost.org>2024-01-14 04:14:17 +0100
commitede24258052a37ab6db54553a3d4d846b1870b6c (patch)
tree76e890299bda5af56f21dd775e2a8a4e4d89f5e8 /main.js
parenta95bd079fd3b2639c0c1e4b0b637fa67c0a2e4ac (diff)
Add an example with a page containg the map in an <iframe>.
Diffstat (limited to 'main.js')
-rw-r--r--main.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/main.js b/main.js
index b5df865..b15a7dd 100644
--- a/main.js
+++ b/main.js
@@ -329,3 +329,10 @@ document.getElementById('layer-topowebb_nedtonad').onchange = function(event) {
const layer = event.target.checked ? 'topowebb_nedtonad' : 'topowebb';
baseMapSource.setUrl('https://minkarta.lantmateriet.se/map/topowebbcache?LAYER=' + layer);
};
+
+map.on('singleclick', function (event) {
+ const size = map.getSize();
+ if (window.location !== window.parent.location && (size[0] < 576 || size[1] < 576)) {
+ return window.open(window.location, '_blank');
+ }
+});