function renderFaq(lang) { const container = document.getElementById('faqContainer'); if (!container) return; const faqs = faqData[lang] || faqData.tr; container.innerHTML = faqs.map((item, idx) =>
${item.a}
).join(''); document.querySelectorAll('.faq-question').forEach(btn => { btn.addEventListener('click', function() { const answer = this.nextElementSibling; const isOpen = answer.classList.contains('open'); document.querySelectorAll('.faq-answer').forEach(a => a.classList.remove('open')); document.querySelectorAll('.faq-question').forEach(b => b.setAttribute('aria-expanded', 'false')); if (!isOpen) { answer.classList.add('open'); this.setAttribute('aria-expanded', 'true'); } }); }); } // Language switcher document.getElementById('langTr').addEventListener('click', () => applyLanguage('tr')); document.getElementById('langEn').addEventListener('click', () => applyLanguage('en')); // Hamburger menu const hamburger = document.getElementById('hamburgerBtn'); const navLinks = document.getElementById('navLinks'); hamburger.addEventListener('click', function(e) { e.stopPropagation(); navLinks.classList.toggle('active'); const expanded = navLinks.classList.contains('active'); this.setAttribute('aria-expanded', expanded); }); // Close mobile menu when clicking a link navLinks.querySelectorAll('a').forEach(link => { link.addEventListener('click', () => { if (window.innerWidth <= 768) { navLinks.classList.remove('active'); hamburger.setAttribute('aria-expanded', 'false'); } }); }); // Close mobile menu when clicking outside document.addEventListener('click', function(e) { if (!hamburger.contains(e.target) && !navLinks.contains(e.target)) { navLinks.classList.remove('active'); hamburger.setAttribute('aria-expanded', 'false'); } }); // License modal const modal = document.getElementById('licenseModal'); const licenseText = document.getElementById('licenseText'); const openBtn = document.getElementById('openLicenseBtn'); const closeBtn = document.getElementById('closeLicenseBtn'); function openLicense() { licenseText.textContent = currentLang === 'tr' ? licenseTextTr : licenseTextEn; modal.classList.add('active'); document.body.style.overflow = 'hidden'; } function closeLicense() { modal.classList.remove('active'); document.body.style.overflow = ''; } openBtn.addEventListener('click', openLicense); closeBtn.addEventListener('click', closeLicense); modal.addEventListener('click', function(e) { if (e.target === modal) closeLicense(); }); // Initialize applyLanguage(currentLang); })(); function renderFaq(lang) { const container = document.getElementById('faqContainer'); if (!container) return; const faqs = faqData[lang] || faqData.tr; container.innerHTML = faqs.map((item, idx) =>
${item.a}
).join(''); document.querySelectorAll('.faq-question').forEach(btn => { btn.addEventListener('click', function() { const answer = this.nextElementSibling; const isOpen = answer.classList.contains('open'); document.querySelectorAll('.faq-answer').forEach(a => a.classList.remove('open')); document.querySelectorAll('.faq-question').forEach(b => b.setAttribute('aria-expanded', 'false')); if (!isOpen) { answer.classList.add('open'); this.setAttribute('aria-expanded', 'true'); } }); }); } // Language switcher document.getElementById('langTr').addEventListener('click', () => applyLanguage('tr')); document.getElementById('langEn').addEventListener('click', () => applyLanguage('en')); // Hamburger menu const hamburger = document.getElementById('hamburgerBtn'); const navLinks = document.getElementById('navLinks'); hamburger.addEventListener('click', function(e) { e.stopPropagation(); navLinks.classList.toggle('active'); const expanded = navLinks.classList.contains('active'); this.setAttribute('aria-expanded', expanded); }); // Close mobile menu when clicking a link navLinks.querySelectorAll('a').forEach(link => { link.addEventListener('click', () => { if (window.innerWidth <= 768) { navLinks.classList.remove('active'); hamburger.setAttribute('aria-expanded', 'false'); } }); }); // Close mobile menu when clicking outside document.addEventListener('click', function(e) { if (!hamburger.contains(e.target) && !navLinks.contains(e.target)) { navLinks.classList.remove('active'); hamburger.setAttribute('aria-expanded', 'false'); } }); // License modal const modal = document.getElementById('licenseModal'); const licenseText = document.getElementById('licenseText'); const openBtn = document.getElementById('openLicenseBtn'); const closeBtn = document.getElementById('closeLicenseBtn'); function openLicense() { licenseText.textContent = currentLang === 'tr' ? licenseTextTr : licenseTextEn; modal.classList.add('active'); document.body.style.overflow = 'hidden'; } function closeLicense() { modal.classList.remove('active'); document.body.style.overflow = ''; } openBtn.addEventListener('click', openLicense); closeBtn.addEventListener('click', closeLicense); modal.addEventListener('click', function(e) { if (e.target === modal) closeLicense(); }); // Initialize applyLanguage(currentLang); })();