From 9b094fcfe7397a2f8aff38af1c31a5c70a45cb61 Mon Sep 17 00:00:00 2001 From: RedGrox Date: Tue, 19 May 2026 20:40:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=8F=D0=B7=D1=8B=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/app.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/html/js/app.js b/html/js/app.js index eb98fef..a9913c7 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -27,14 +27,20 @@ function toggleLang() { currentLang = currentLang === 'en' ? 'ru' : 'en'; const t = translations[currentLang]; - document.getElementById('title').textContent = t.title; - document.getElementById('desc').textContent = t.desc; - document.getElementById('button').textContent = t.button; - document.getElementById('aboutTitle').textContent = t.aboutTitle; - document.getElementById('aboutText').textContent = t.aboutText; - document.getElementById('projectsTitle').textContent = t.projectsTitle; - document.getElementById('contactTitle').textContent = t.contactTitle; - document.getElementById('contactText').textContent = t.contactText; + tryToggleTextContent('title', t.title); + tryToggleTextContent('desc', t.desc); + tryToggleTextContent('button', t.button); + tryToggleTextContent('aboutTitle', t.aboutTitle); + tryToggleTextContent('aboutText', t.aboutText); + tryToggleTextContent('projectsTitle', t.projectsTitle); + tryToggleTextContent('contactTitle', t.contactTitle); + tryToggleTextContent('contactText', t.contactText); +} + +function tryToggleTextContent(elementId, textContent) { + let el = document.getElementById(elementId); + if (el != null) + el.textContent = textContent; } // Background animation