From a2d748e9856f4f7fb3fb842dcaaf5c4d13e226f7 Mon Sep 17 00:00:00 2001 From: Dauren777 Date: Wed, 24 Jun 2026 12:00:25 +0000 Subject: [PATCH] =?UTF-8?q?v7:=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B7=D1=83=D0=BC,=20=D0=BD=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=B3=D0=B0=D1=86=D0=B8=D1=8F=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7?= =?UTF-8?q?=20findVillageData?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/app.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index b46cfb8..52ea89e 100644 --- a/js/app.js +++ b/js/app.js @@ -179,7 +179,7 @@ function initSelectors() { rayonSel.value = found.rayon; updateVillages(); villageSel.value = found.village; - map.setView(found.center, 13); + map.setView(found.center, 15); L.popup() .setLatLng(found.center) .setContent(`${found.village}
${found.oblast}, ${found.rayon}`) @@ -200,15 +200,10 @@ function initSelectors() { villageSel.addEventListener("change", function () { const name = this.value; if (!name) return; - const oblast = KZ_DATA.find((o) => o.oblast === oblastSel.value); - if (!oblast) return; - const rayon = oblast.rayons.find((r) => r.rayon === rayonSel.value); - if (!rayon) return; - const village = rayon.villages.find((v) => (typeof v === "string" ? v : v.name) === name); - const center = getVillageCenter(village) || (rayon ? rayon.center : null) || oblast.center; - if (center) { - map.setView(center, 14); - L.popup().setLatLng(center).setContent(`${name}
${oblast.oblast}, ${rayon.rayon}`).openOn(map); + const found = findVillageData(name); + if (found && found.center) { + map.setView(found.center, 15); + L.popup().setLatLng(found.center).setContent(`${found.village}
${found.oblast}, ${found.rayon}`).openOn(map); } });