From 924864fc7434518ee0ae688f9be9d3086ba4b3f5 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Thu, 17 Oct 2024 23:20:45 +0800 Subject: fix: don't apply dumbymap twice --- addon/index.mjs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'addon') diff --git a/addon/index.mjs b/addon/index.mjs index 77716b6..4de11e0 100644 --- a/addon/index.mjs +++ b/addon/index.mjs @@ -34,10 +34,20 @@ const simpleRender = window.mapclay.renderWith(config => ({ }, })) -window.generateMaps(document.querySelector('main') ?? document.body, { - crs: url.searchParams.get('crs') ?? 'EPSG:4326', - addBlocks, - initialLayout: 'sticky', - render: simpleRender, - autoMap: true, +if (!document.querySelector('.Dumby')) { + window.generateMaps(document.querySelector('main') ?? document.body, { + crs: url.searchParams.get('crs') ?? 'EPSG:4326', + addBlocks, + initialLayout: 'sticky', + render: simpleRender, + autoMap: true, + }) +} + +new window.MutationObserver((ms) => { + for (const m of ms) { + console.log(m) + } +}).observe(document.querySelector('#doc'), { + childList: true, }) -- cgit v1.2.3-70-g09d2