fix: resolve map provider from ?provider url param + carry it through staging iframes
This commit is contained in:
parent
c7260faaa3
commit
a7450520ee
13 changed files with 81 additions and 24 deletions
|
|
@ -44,6 +44,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -146,9 +151,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
|
|
@ -30,8 +30,10 @@ function unwrapConfig(profileConfig) {
|
|||
export function resolveMapProvider(profileConfig) {
|
||||
const cfg = unwrapConfig(profileConfig)
|
||||
const fromConfig = cfg?.provider
|
||||
const fromUrl = typeof location !== 'undefined'
|
||||
? new URLSearchParams(location.search).get('provider') : undefined
|
||||
const fromWindow = typeof window !== 'undefined' ? window.MAP_PROVIDER : undefined
|
||||
const raw = String(fromConfig || fromWindow || DEFAULT_PROVIDER).toLowerCase().trim()
|
||||
const raw = String(fromConfig || fromUrl || fromWindow || DEFAULT_PROVIDER).toLowerCase().trim()
|
||||
return MAP_PROVIDERS.includes(raw) ? raw : DEFAULT_PROVIDER
|
||||
}
|
||||
|
||||
|
|
|
|||
9
public/doxa-maps/cities-internet/index.html
generated
9
public/doxa-maps/cities-internet/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/country-posters/index.html
generated
9
public/doxa-maps/country-posters/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/demo-map/index.html
generated
9
public/doxa-maps/demo-map/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
9
public/doxa-maps/doxa-research-map/index.html
generated
9
public/doxa-maps/doxa-research-map/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/doxa-simple-map/index.html
generated
9
public/doxa-maps/doxa-simple-map/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/gospel-resources/index.html
generated
9
public/doxa-maps/gospel-resources/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/index.html
generated
9
public/doxa-maps/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/key-cities/index.html
generated
9
public/doxa-maps/key-cities/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/my-upg-100-list/index.html
generated
9
public/doxa-maps/my-upg-100-list/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
9
public/doxa-maps/template-bundle/index.html
generated
9
public/doxa-maps/template-bundle/index.html
generated
|
|
@ -176,6 +176,11 @@ function withTk(href) {
|
|||
if (!TK) return href
|
||||
return href + (href.includes('?') ? '&' : '?') + 'tk=' + encodeURIComponent(TK)
|
||||
}
|
||||
// Carry the page's ?provider= into the embedded map iframe so the engine choice propagates.
|
||||
function withProvider(href) {
|
||||
const p = typeof location !== 'undefined' ? new URLSearchParams(location.search).get('provider') : null
|
||||
return p ? href + (href.includes('?') ? '&' : '?') + 'provider=' + encodeURIComponent(p) : href
|
||||
}
|
||||
|
||||
// ── Load the semantic tree (inline-first; fetch = dev fallback) ──────────────
|
||||
async function loadTree() {
|
||||
|
|
@ -278,9 +283,9 @@ function renderStage() {
|
|||
<div class="stage-head">
|
||||
<span class="sctag"><${esc(nd.element || nd.label)}></span>
|
||||
<span class="sckind">${esc(nd.kind)}</span>
|
||||
<a class="popout" href="${esc(withTk(nd.href))}" target="_blank" rel="noopener">open ↗</a>
|
||||
<a class="popout" href="${esc(withProvider(withTk(nd.href)))}" target="_blank" rel="noopener">open ↗</a>
|
||||
</div>
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withTk(nd.href))}"></iframe></div>`
|
||||
<div class="map-slot"><iframe allowfullscreen src="${esc(withProvider(withTk(nd.href)))}"></iframe></div>`
|
||||
// keep the sidebar highlight in sync
|
||||
document.querySelectorAll('#treeNav .node').forEach((b) =>
|
||||
b.classList.toggle('active', b.dataset.key === activeKey))
|
||||
|
|
|
|||
Loading…
Reference in a new issue