diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-12 15:46:16 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-12 16:09:28 +0800 |
commit | 49b0b5eeab42fbd93bd2458c32c6170ab3edd0bf (patch) | |
tree | 6135bc9357e350f8ca7e8bb48619fe927480fa9f /src/dumbymap.mjs | |
parent | 1d631dd1a43d1c7ecb91fcc1f619e6666fdc37f8 (diff) |
refactor: add external class in generateMaps()
Diffstat (limited to 'src/dumbymap.mjs')
-rw-r--r-- | src/dumbymap.mjs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs index e5dd2cd..4a11bcb 100644 --- a/src/dumbymap.mjs +++ b/src/dumbymap.mjs | |||
@@ -177,10 +177,18 @@ export const generateMaps = (container, { | |||
177 | } | 177 | } |
178 | }) | 178 | }) |
179 | 179 | ||
180 | /** Create GeoLinks and DocLinks */ | 180 | /** Create DocLinks */ |
181 | container.querySelectorAll(docLinkSelector) | 181 | container.querySelectorAll(docLinkSelector) |
182 | .forEach(utils.createDocLink) | 182 | .forEach(utils.createDocLink) |
183 | 183 | ||
184 | /** Add external symbol on anchors */ | ||
185 | container.querySelectorAll('a') | ||
186 | .forEach(a => { | ||
187 | if (a.href.startsWith('http') && !a.href.startsWith(window.location.origin)) { | ||
188 | a.classList.add('external') | ||
189 | } | ||
190 | }) | ||
191 | |||
184 | /** Set CRS and GeoLinks */ | 192 | /** Set CRS and GeoLinks */ |
185 | register(proj4) | 193 | register(proj4) |
186 | fromEPSGCode(crs).then(projection => { | 194 | fromEPSGCode(crs).then(projection => { |