From ca337345f29c189f0a308cf0b101cbe5b5b36e29 Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Wed, 22 Oct 2025 14:29:29 +0200 Subject: [PATCH] readonly fields --- debug | 1 - website/public/debug/lang/mix.html | 16 +++++++++++++++- website/public/debug/lang/mix.js | 19 +++++++++++++++++-- 3 files changed, 32 insertions(+), 4 deletions(-) delete mode 120000 debug diff --git a/debug b/debug deleted file mode 120000 index 202d88a..0000000 --- a/debug +++ /dev/null @@ -1 +0,0 @@ -/Users/user/Documents/dev/openfreemap/repo/website/public/debug \ No newline at end of file diff --git a/website/public/debug/lang/mix.html b/website/public/debug/lang/mix.html index d4735bf..2680a69 100644 --- a/website/public/debug/lang/mix.html +++ b/website/public/debug/lang/mix.html @@ -21,6 +21,13 @@ id="line1" class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono" /> +
@@ -32,6 +39,13 @@ id="line2" class="w-full px-3 py-1.5 text-sm border border-gray-600 rounded bg-gray-800 text-gray-100 focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 transition-all font-mono" /> +
@@ -89,4 +103,4 @@ - + \ No newline at end of file diff --git a/website/public/debug/lang/mix.js b/website/public/debug/lang/mix.js index 350b90d..6da0edd 100644 --- a/website/public/debug/lang/mix.js +++ b/website/public/debug/lang/mix.js @@ -13,6 +13,8 @@ const map = new maplibregl.Map({ const line1Input = document.getElementById('line1') const line2Input = document.getElementById('line2') const langInput = document.getElementById('lang') +const line1ExprInput = document.getElementById('line1-expr') +const line2ExprInput = document.getElementById('line2-expr') map.on('load', () => { const params = new URLSearchParams(window.location.search) @@ -41,6 +43,7 @@ function initializeInputListeners() { const handleInput = () => { updateParamsFromInputs() + updateExpressionDisplays() debouncedApplyConfig() } @@ -88,9 +91,10 @@ function applyConfiguration() { style, line1Config: line1 ?? '', line2Config: line2 ?? '', - langCode: lang || 'en', + langCode: lang, }) map.setStyle(style, { diff: true }) + updateExpressionDisplays() } function syncInputsFromParams() { @@ -113,6 +117,17 @@ function updateParamsFromInputs() { window.history.replaceState({}, '', newUrl) } +function updateExpressionDisplays() { + const { line1, line2, lang } = parseParams() + const langCode = lang + + const line1Expr = buildFieldAccessor(line1 ?? '', langCode) + const line2Expr = buildFieldAccessor(line2 ?? '', langCode) + + line1ExprInput.value = line1Expr ? JSON.stringify(line1Expr) : '' + line2ExprInput.value = line2Expr ? JSON.stringify(line2Expr) : '' +} + // ============================================ // 4. STYLE MODIFICATION // ============================================ @@ -165,7 +180,7 @@ function parseParams() { return { line1: params.get('line1'), line2: params.get('line2'), - lang: params.get('lang'), + lang: params.get('lang') || 'en', } }