From f2161e868d57f0b5fc5cef453582b9f6eecd510b Mon Sep 17 00:00:00 2001 From: Zsolt Ero Date: Wed, 22 Oct 2025 12:42:58 +0200 Subject: [PATCH] work --- website/public/debug/lang/mix.html | 5 +---- website/public/debug/lang/mix.js | 27 ++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/website/public/debug/lang/mix.html b/website/public/debug/lang/mix.html index dca462a..144e9fe 100644 --- a/website/public/debug/lang/mix.html +++ b/website/public/debug/lang/mix.html @@ -20,7 +20,6 @@ type="text" 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" - placeholder="underscore,colon,name,latin" /> @@ -32,7 +31,6 @@ type="text" 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" - placeholder="nonlatin" /> @@ -44,7 +42,6 @@ type="text" id="lang" 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 text-center" - placeholder="en" maxlength="5" /> @@ -85,4 +82,4 @@ - \ No newline at end of file + diff --git a/website/public/debug/lang/mix.js b/website/public/debug/lang/mix.js index 4058a03..ecc9038 100644 --- a/website/public/debug/lang/mix.js +++ b/website/public/debug/lang/mix.js @@ -25,11 +25,10 @@ map.on('load', () => { url.searchParams.set('lang', 'en') window.history.replaceState({}, '', url) } - syncInputsFromParams() applyConfiguration() initializeInputListeners() - initializeModal() + // initializeModal() }) // ============================================ @@ -37,9 +36,16 @@ map.on('load', () => { // ============================================ function initializeInputListeners() { - line1Input.addEventListener('input', updateParamsFromInputs) - line2Input.addEventListener('input', updateParamsFromInputs) - langInput.addEventListener('input', updateParamsFromInputs) + const debouncedApplyConfig = debounce(applyConfiguration, 1000) + + const handleInput = () => { + updateParamsFromInputs() + debouncedApplyConfig() + } + + line1Input.addEventListener('input', handleInput) + line2Input.addEventListener('input', handleInput) + langInput.addEventListener('input', handleInput) } function initializeModal() { @@ -135,6 +141,17 @@ function modifyStyle({ style, line1Config, line2Config, langCode }) { // 5. UTILITY FUNCTIONS // ============================================ +function debounce(func, delay) { + let timeoutId + + return function (...args) { + clearTimeout(timeoutId) + timeoutId = setTimeout(() => { + func.apply(this, args) + }, delay) + } +} + function parseParams() { const params = new URLSearchParams(window.location.search) return {