aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--addon/index.mjs1
-rw-r--r--addon/manifest.json5
-rw-r--r--src/dumbymap.mjs7
3 files changed, 7 insertions, 6 deletions
diff --git a/addon/index.mjs b/addon/index.mjs
index 323edf1..2494ec4 100644
--- a/addon/index.mjs
+++ b/addon/index.mjs
@@ -12,6 +12,7 @@ const simpleRender = window.mapclay.renderWith(config => ({
12})) 12}))
13 13
14window.generateMaps(document.querySelector('main') ?? document.body, { 14window.generateMaps(document.querySelector('main') ?? document.body, {
15 crs: url.searchParams.get('crs') ?? 'EPSG:4326',
15 initialLayout: '', 16 initialLayout: '',
16 render: simpleRender, 17 render: simpleRender,
17}) 18})
diff --git a/addon/manifest.json b/addon/manifest.json
index e97ae50..2d7b1ed 100644
--- a/addon/manifest.json
+++ b/addon/manifest.json
@@ -12,7 +12,7 @@
12 "content_scripts": [ 12 "content_scripts": [
13 { 13 {
14 "matches": [ 14 "matches": [
15 "*://*.mozilla.org/*", 15 "*://developer.mozilla.org/*",
16 "*://hackmd.io/*", 16 "*://hackmd.io/*",
17 "*://*.ptt.cc/*" 17 "*://*.ptt.cc/*"
18 ], 18 ],
@@ -29,6 +29,7 @@
29 "permissions": [ 29 "permissions": [
30 "activeTab", 30 "activeTab",
31 "tabs", 31 "tabs",
32 "scripting" 32 "scripting",
33 "https://epsg.io/*"
33 ] 34 ]
34} 35}
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 55d29d3..cbd44b2 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -241,10 +241,10 @@ export const generateMaps = (container, {
241 register(proj4) 241 register(proj4)
242 fromEPSGCode(crs).then(() => resolve()) 242 fromEPSGCode(crs).then(() => resolve())
243 }) 243 })
244 const addGeoSchemeByText = new Promise(resolve => { 244 const addGeoSchemeByText = (async () => {
245 const coordPatterns = /(-?\d+\.?\d*)([,\x2F\uFF0C])(-?\d+\.?\d*)/ 245 const coordPatterns = /(-?\d+\.?\d*)([,\x2F\uFF0C])(-?\d+\.?\d*)/
246 const re = new RegExp(coordPatterns, 'g') 246 const re = new RegExp(coordPatterns, 'g')
247 htmlHolder.querySelectorAll('p') 247 htmlHolder.querySelectorAll('.dumby-block')
248 .forEach(p => { 248 .forEach(p => {
249 replaceTextNodes(p, re, match => { 249 replaceTextNodes(p, re, match => {
250 const a = document.createElement('a') 250 const a = document.createElement('a')
@@ -253,8 +253,7 @@ export const generateMaps = (container, {
253 return a 253 return a
254 }) 254 })
255 }) 255 })
256 resolve() 256 })()
257 })
258 257
259 Promise.all([setCRS, addGeoSchemeByText]).then(() => { 258 Promise.all([setCRS, addGeoSchemeByText]).then(() => {
260 Array.from(container.querySelectorAll(geoLinkSelector)) 259 Array.from(container.querySelectorAll(geoLinkSelector))