From bd1239a496bb46ae7c9e4eb9b678a3a37819503d Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Wed, 30 Sep 2026 09:43:08 +0000 Subject: [PATCH] The credit's fold clock starts once the basemap credit has joined geoBoundaries --- plugin-designs/cities-internet/connectivity-map.vue | 9 +++++++-- plugin-designs/gospel-resources/resources-map.vue | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugin-designs/cities-internet/connectivity-map.vue b/plugin-designs/cities-internet/connectivity-map.vue index 007f969b5..3d5e0d680 100644 --- a/plugin-designs/cities-internet/connectivity-map.vue +++ b/plugin-designs/cities-internet/connectivity-map.vue @@ -107,12 +107,17 @@ function foldCredit(triesLeft = 60) { const box = mapEl.value if (!box) return const shown = box.querySelector('.maplibregl-ctrl-attrib.maplibregl-compact-show, .mapboxgl-ctrl-attrib.mapboxgl-compact-show') - if (shown) { + // The clock starts once the STYLE's own credit has joined geoBoundaries (it arrives with the style's + // sources), so the first expanded show names the basemap too; measured, the fold otherwise came while + // only "geoBoundaries" had shown. After 30 s it starts anyway. + const inner = shown && shown.querySelector('.maplibregl-ctrl-attrib-inner, .mapboxgl-ctrl-attrib-inner') + const full = !!(inner && inner.textContent.replace('geoBoundaries', '').replace(/[|\s]/g, '').length) + if (shown && (full || triesLeft <= 0)) { creditTimer = setTimeout(() => { creditTimer = 0; shown.classList.remove('maplibregl-compact-show', 'mapboxgl-compact-show') }, CREDIT_FOLD_MS) return } const credit = box.querySelector('.maplibregl-ctrl-attrib, .mapboxgl-ctrl-attrib') - if (credit && !/attrib-empty/.test(credit.className)) return + if (!shown && credit && !/attrib-empty/.test(credit.className)) return if (triesLeft > 0) creditTimer = setTimeout(() => foldCredit(triesLeft - 1), 500) } function addCompactCredit(map, gl) { diff --git a/plugin-designs/gospel-resources/resources-map.vue b/plugin-designs/gospel-resources/resources-map.vue index bec6b55a6..fabe6f5ef 100644 --- a/plugin-designs/gospel-resources/resources-map.vue +++ b/plugin-designs/gospel-resources/resources-map.vue @@ -150,12 +150,17 @@ function foldCredit(triesLeft = 60) { const box = mapEl.value if (!box) return const shown = box.querySelector('.maplibregl-ctrl-attrib.maplibregl-compact-show, .mapboxgl-ctrl-attrib.mapboxgl-compact-show') - if (shown) { + // The clock starts once the STYLE's own credit has joined geoBoundaries (it arrives with the style's + // sources), so the first expanded show names the basemap too; measured, the fold otherwise came while + // only "geoBoundaries" had shown. After 30 s it starts anyway. + const inner = shown && shown.querySelector('.maplibregl-ctrl-attrib-inner, .mapboxgl-ctrl-attrib-inner') + const full = !!(inner && inner.textContent.replace('geoBoundaries', '').replace(/[|\s]/g, '').length) + if (shown && (full || triesLeft <= 0)) { creditTimer = setTimeout(() => { creditTimer = 0; shown.classList.remove('maplibregl-compact-show', 'mapboxgl-compact-show') }, CREDIT_FOLD_MS) return } const credit = box.querySelector('.maplibregl-ctrl-attrib, .mapboxgl-ctrl-attrib') - if (credit && !/attrib-empty/.test(credit.className)) return + if (!shown && credit && !/attrib-empty/.test(credit.className)) return if (triesLeft > 0) creditTimer = setTimeout(() => foldCredit(triesLeft - 1), 500) } function addCompactCredit(map, gl) {