debug: expose map instance as window._ifkMap for choropleth debugging
All checks were successful
Deploy Internet for Kids / Build & Push (push) Successful in 12s
Deploy Internet for Kids / Deploy (push) Successful in 5s
Deploy Internet for Kids / Health Check (push) Successful in 2s
Deploy Internet for Kids / Smoke Tests (push) Successful in 3s
Deploy Internet for Kids / IndexNow Ping (push) Successful in 7s
Deploy Internet for Kids / Promote to Latest (push) Successful in 1s
Deploy Internet for Kids / Rollback (push) Has been skipped
Deploy Internet for Kids / Audit (push) Successful in 1s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-04-03 15:45:27 +03:00
parent bdcbc6f8a8
commit cc5568f0a9

View File

@@ -51,7 +51,7 @@ function ifkInitMap() {
var byIsoNum = {};
countries.forEach(function(c) { byIsoNum[c.isoNum] = c; });
var map = new maplibregl.Map({
window._ifkMap = new maplibregl.Map({
container: 'ifk-world-map',
style: 'https://maps.clicksports.de/styles/klokantech-basic/style.json',
center: [10, 25],
@@ -62,9 +62,9 @@ function ifkInitMap() {
attributionControl: true
});
map.addControl(new maplibregl.NavigationControl({ showCompass: false }), 'top-right');
window._ifkMap.addControl(new maplibregl.NavigationControl({ showCompass: false }), 'top-right');
map.on('load', function() {
window._ifkMap.on('load', function() {
fetch('{{ "data/countries-110m.json" | relURL }}')
.then(function(r) { return r.json(); })
.then(function(topo) {
@@ -78,9 +78,9 @@ function ifkInitMap() {
f.properties.isoNum = id;
});
map.addSource('countries-choropleth', { type: 'geojson', data: geo });
window._ifkMap.addSource('countries-choropleth', { type: 'geojson', data: geo });
map.addLayer({
window._ifkMap.addLayer({
id: 'choropleth-fill',
type: 'fill',
source: 'countries-choropleth',
@@ -90,7 +90,7 @@ function ifkInitMap() {
}
});
map.addLayer({
window._ifkMap.addLayer({
id: 'choropleth-outline',
type: 'line',
source: 'countries-choropleth',
@@ -102,17 +102,17 @@ function ifkInitMap() {
var popup = new maplibregl.Popup({ closeButton: true, closeOnClick: false, maxWidth: '280px' });
map.on('mousemove', 'choropleth-fill', function(e) {
window._ifkMap.on('mousemove', 'choropleth-fill', function(e) {
var id = e.features[0].properties.isoNum;
var c = byIsoNum[id];
map.getCanvas().style.cursor = c ? 'pointer' : '';
window._ifkMap.getCanvas().style.cursor = c ? 'pointer' : '';
});
map.on('mouseleave', 'choropleth-fill', function() {
map.getCanvas().style.cursor = '';
window._ifkMap.on('mouseleave', 'choropleth-fill', function() {
window._ifkMap.getCanvas().style.cursor = '';
});
map.on('click', 'choropleth-fill', function(e) {
window._ifkMap.on('click', 'choropleth-fill', function(e) {
var id = e.features[0].properties.isoNum;
var c = byIsoNum[id];
if (!c) return;