āĻĢā§āĻ˛ā§āϝāĻžāĻļ āĻ•āĻžāĻ°ā§āĻĄ āĻŽā§‡āĻ•āĻžāϰ

āĻāφāχ āϏāĻšāĻžāϝāĻŧāϤāĻžāϝāĻŧ āĻĒā§āϰāĻĢ⧇āĻļāύāĻžāϞ āĻĄāĻŋāϜāĻŋāϟāĻžāϞ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻ•āϰ⧁āύāĨ¤ āĻ¸ā§āĻĒ⧇āϏāĻĄ āϰāĻŋāĻĒāĻŋāϟāĻŋāĻļāύ, āĻāĻ•āĻžāϧāĻŋāĻ• āĻ…āĻ§ā§āϝāϝāĻŧāύ āĻŽā§‹āĻĄ, āĻŽāĻžāĻ˛ā§āϟāĻŋāĻŽāĻŋāĻĄāĻŋāϝāĻŧāĻž āϏāĻžāĻĒā§‹āĻ°ā§āϟ āĻāĻŦāĻ‚ āφāĻ‚āĻ•āĻŋ āĻ“ āϕ⧁āχāϜāϞ⧇āĻŸā§‡āϰ āĻŽāϤ⧋ āϜāύāĻĒā§āϰāĻŋāϝāĻŧ āĻĒā§āĻ˛ā§āϝāĻžāϟāĻĢāĻ°ā§āĻŽā§‡ āĻāĻ•ā§āϏāĻĒā§‹āĻ°ā§āϟ āĻ•āϰāĻžāϰ āϏ⧁āĻŦāĻŋāϧāĻž āϰāϝāĻŧ⧇āϛ⧇āĨ¤

āύāϤ⧁āύ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻ•āϰ⧁āύ

āφāĻĒāύāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻ•āϰāϤ⧇ āϏāĻžāĻŽāύ⧇ āĻ“ āĻĒāĻŋāĻ›āύ⧇āϰ āĻŦāĻŋāώāϝāĻŧāĻŦāĻ¸ā§āϤ⧁ āϝ⧋āĻ— āĻ•āϰ⧁āύ

āφāĻĒāύāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āĻĒā§āϰāĻŋāĻ­āĻŋāω āĻĻ⧇āĻ–āϤ⧇ āĻāĻ–āĻžāύ⧇ āĻ•ā§āϞāĻŋāĻ• āĻ•āϰ⧁āύ
āĻĒāĻŋāĻ›āύ⧇āϰ āĻĻāĻŋāĻ• āĻĻ⧇āĻ–āϤ⧇ āωāĻĒāϰ⧇ āĻŦāĻŋāώāϝāĻŧāĻŦāĻ¸ā§āϤ⧁ āϝ⧋āĻ— āĻ•āϰ⧁āύ
🔄
āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ
āĻ•ā§āϞāĻžāϏāĻŋāĻ• āĻĢā§āϞāĻŋāĻĒ āĻ•āĻžāĻ°ā§āĻĄ āĻ…āĻ§ā§āϝāϝāĻŧāύ
🧠
āĻ¸ā§āĻĒ⧇āϏāĻĄ āϰāĻŋāĻĒāĻŋāϟāĻŋāĻļāύ
āĻŦ⧈āĻœā§āĻžāĻžāύāĻŋāĻ•āĻ­āĻžāĻŦ⧇ āĻ…āĻĒāϟāĻŋāĻŽāĻžāχāϜāĻĄ āĻĒāĻ°ā§āϝāĻžāϞ⧋āϚāύāĻž
❓
āϕ⧁āχāϜ āĻŽā§‹āĻĄ
āĻŦāĻšā§ āύāĻŋāĻ°ā§āĻŦāĻžāϚāύ⧀ āĻĒāϰ⧀āĻ•ā§āώāĻž
đŸŽ¯
āĻŽā§āϝāĻžāϚ āϗ⧇āĻŽ
āĻļāĻŦā§āĻĻ āĻ“ āϏāĻ‚āĻœā§āĻžāĻž āĻŽā§‡āϞāĻžāύ⧋
āφāĻŽāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ
0 āϟāĻŋ āĻ•āĻžāĻ°ā§āĻĄ āφāϜ 0 āϟāĻŋ āĻ…āĻ§ā§āϝāϝāĻŧāύ āĻ•āϰāĻž āĻšāϝāĻŧ⧇āϛ⧇
📚 āĻāĻ–āύāĻ“ āϕ⧋āύ⧋ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻ•āϰāĻž āĻšāϝāĻŧāύāĻŋāĨ¤ āĻļ⧁āϰ⧁ āĻ•āϰāϤ⧇ "āĻ•āĻžāĻ°ā§āĻĄ āϤ⧈āϰāĻŋ āĻ•āϰ⧁āύ" āĻ āϝāĻžāύ!
0 āĻŽā§‹āϟ āĻ•āĻžāĻ°ā§āĻĄ
0 āĻ…āĻ§ā§āϝāϝāĻŧāύ āϧāĻžāϰāĻžāĻŦāĻžāĻšāĻŋāĻ•āϤāĻž (āĻĻāĻŋāύ)
0 āĻĻāĻ•ā§āώāϤāĻž āĻ…āĻ°ā§āϜāĻŋāϤ āĻ•āĻžāĻ°ā§āĻĄ
0% āϏāĻ āĻŋāĻ•āϤāĻžāϰ āĻšāĻžāϰ

📤 āφāĻĒāύāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϰāĻĒā§āϤāĻžāύāĻŋ āĻ•āϰ⧁āύ

āϜāύāĻĒā§āϰāĻŋāϝāĻŧ āĻ…āĻ§ā§āϝāϝāĻŧāύ āĻĒā§āĻ˛ā§āϝāĻžāϟāĻĢāĻ°ā§āĻŽā§‡ āφāĻĒāύāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āϰāĻĒā§āϤāĻžāύāĻŋ āĻ•āϰ⧁āύ āĻŦāĻž āĻ…āĻĢāϞāĻžāχāύ āĻŦā§āϝāĻŦāĻšāĻžāϰ⧇āϰ āϜāĻ¨ā§āϝ āĻĄāĻžāωāύāϞ⧋āĻĄ āĻ•āϰ⧁āύāĨ¤

🎴
āφāύāĻ•āĻŋ
āĻāĻĒāĻŋāϕ⧇āϜāĻŋ āĻĢāϰāĻŽā§āϝāĻžāϟ
📚
āϕ⧁āχāϜāϞ⧇āϟ
āϏāĻŋāĻāϏāĻ­āĻŋ āĻĢāϰāĻŽā§āϝāĻžāϟ
📊
āϏāĻŋāĻāϏāĻ­āĻŋ āĻĢāĻžāχāϞ
āĻ¸ā§āĻĒā§āϰ⧇āĻĄāĻļā§€āϟ
💾
āĻœā§‡āϏāύ
āĻŦā§āϝāĻžāĻ•āφāĻĒ āĻĢāϰāĻŽā§āϝāĻžāϟ
đŸ–¨ī¸
āĻĒāĻŋāĻĄāĻŋāĻāĻĢ āĻĒā§āϰāĻŋāĻ¨ā§āϟ āĻ•āϰ⧁āύ
āϭ⧌āϤ āĻ•āĻžāĻ°ā§āĻĄ
🌐
āĻ…āύāϞāĻžāχāύ⧇ āĻļ⧇āϝāĻŧāĻžāϰ āĻ•āϰ⧁āύ
āĻĒāĻžāĻŦāϞāĻŋāĻ• āϞāĻŋāĻ™ā§āĻ•
Supports CSV, JSON, TXT, and APKG files from Anki, Quizlet, and other platforms

📚 āĻļāĻŋāĻ•ā§āώāĻžāĻŽā§‚āϞāĻ• āĻ­ā§āϰāĻŽāĻŖ āĻŦāĻž āĻŦāĻŋāĻĻ⧇āĻļ⧇ āĻĒāĻĄāĻŧāĻžāĻļā§‹āύāĻžāϰ āĻĒāϰāĻŋāĻ•āĻ˛ā§āĻĒāύāĻž āĻ•āϰāϛ⧇āύ?

āφāĻ¨ā§āϤāĻ°ā§āϜāĻžāϤāĻŋāĻ• āĻļāĻŋāĻ•ā§āώāĻž āĻ…āĻ­āĻŋāĻœā§āĻžāϤāĻž āĻāĻŦāĻ‚ āĻļāĻŋāĻ•ā§āώāĻžāĻŽā§‚āϞāĻ• āĻ­ā§āϰāĻŽāϪ⧇āϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ āφāĻĒāύāĻžāϰ āĻļ⧇āĻ–āĻžāϰ āĻŽāĻžāύ āωāĻ¨ā§āύāϤ āĻ•āϰ⧁āύ

✨ Smart Nation's Core Infrastructure: WIA Code ✨

āĻĄā§āϰ⧋āĻ¨Âˇāϰ⧋āĻŦāϟ āĻĄā§‡āϞāĻŋāĻ­āĻžāϰāĻŋ, āĻ¸ā§āĻŦāϝāĻŧāĻ‚āĻ•ā§āϰāĻŋāϝāĻŧ āĻĄā§āϰāĻžāχāĻ­āĻŋāĻ‚, āϜāϰ⧁āϰāĻŋ āωāĻĻā§āϧāĻžāϰ āĻāĻŦāĻ‚ āφāϰāĻ“ āĻ…āύ⧇āĻ• āĻ•āĻŋāϛ⧁ - āφāĻĒāύāĻžāϰ āĻĻ⧇āĻļ⧇āϰ āϜāĻ¨ā§āϝ ā§Šā§Ļ āĻĻāĻŋāύ āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻŦāĻŋāύāĻžāĻŽā§‚āĻ˛ā§āϝ⧇ āĻ­āĻŦāĻŋāĻˇā§āϝāϤ⧇āϰ āĻ…āĻ­āĻŋāĻœā§āĻžāϤāĻž āύāĻŋāύ!

āĻĄāĻŦā§āϞāĻŋāωāφāχāĻ āϕ⧋āĻĄ āϏāĻŽā§āĻĒāĻ°ā§āϕ⧇ āφāϰāĻ“ āϜāĻžāύ⧁āύ

🤖 āφāĻĒāύāĻžāϰ āĻāφāχ āϏāĻšāĻ•āĻžāϰ⧀ āĻŦ⧇āϛ⧇ āύāĻŋāύ

đŸ’Ŧ āĻšā§āϝāĻžāϟāϜāĻŋāĻĒāĻŋāϟāĻŋ
āϏāĻ°ā§āĻŦāĻžāϧāĻŋāĻ• āĻŦāĻšā§āĻŽā§āĻ–ā§€ â€ĸ āĻ•āĻ¨ā§āĻŸā§‡āĻ¨ā§āϟ āϤ⧈āϰāĻŋāϰ āϜāĻ¨ā§āϝ āϏ⧇āϰāĻž
🧠 āĻ•ā§āϞāĻĄ
āϏ⧇āϰāĻž āϝ⧁āĻ•ā§āϤāĻŋ āĻĒā§āϰāĻĻāĻžāύ â€ĸ āĻĒāĻĄāĻŧāĻžāĻļā§‹āύāĻžāϰ āĻ•ā§ŒāĻļāϞ⧇āϰ āϜāĻ¨ā§āϝ āύāĻŋāϖ⧁āρāϤ
✨ āĻœā§‡āĻŽāĻŋāύāĻŋ āĻŦāĻŋāύāĻžāĻŽā§‚āĻ˛ā§āϝ⧇
āĻĻ⧈āύāĻŋāĻ• āĻĢā§āϰāĻŋ āϏ⧀āĻŽāĻž â€ĸ āĻ…āĻ¨ā§āϤāĻ°ā§āύāĻŋāĻ°ā§āĻŽāĻŋāϤ āĻšā§āϝāĻžāϟ
`); printWindow.document.close(); printWindow.print(); showNotification('āĻĒā§āϰāĻŋāĻ¨ā§āϟ āĻĒā§āϰāĻŋāĻ­āĻŋāω āĻ–ā§‹āϞāĻž āĻšāϝāĻŧ⧇āϛ⧇', 'success'); } // Share online function shareOnline() { const shareData = { title: 'āφāĻŽāĻžāϰ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ', text: `Check out my ${flashcards.length} flashcards created with WIA Code Flash Card Maker!`, url: window.location.href }; if (navigator.share) { navigator.share(shareData); } else { const text = `${shareData.text}\n\n${shareData.url}`; copyToClipboard(text); showNotification('Share link copied to clipboard!', 'success'); } } // Handle import function handleImport() { const file = document.getElementById('importFile').files[0]; if (!file) return; const reader = new FileReader(); reader.onload = function(e) { try { const content = e.target.result; let importedCards = []; if (file.name.endsWith('.json')) { importedCards = JSON.parse(content); } else if (file.name.endsWith('.csv')) { importedCards = parseCSV(content); } else if (file.name.endsWith('.txt')) { importedCards = parseTXT(content); } if (importedCards.length > 0) { flashcards = flashcards.concat(importedCards); saveData(); updateDeckDisplay(); updateStats(); showNotification(`Imported ${importedCards.length} flashcards!`, 'success'); } else { showNotification('āĻĢāĻžāχāϞ⧇ āϕ⧋āύ⧋ āĻŦ⧈āϧ āĻĢā§āĻ˛ā§āϝāĻžāĻļāĻ•āĻžāĻ°ā§āĻĄ āĻĒāĻžāĻ“āϝāĻŧāĻž āϝāĻžāϝāĻŧāύāĻŋ', 'error'); } } catch (error) { showNotification('Error importing file: ' + error.message, 'error'); } }; reader.readAsText(file); } // Parse CSV import function parseCSV(content) { const lines = content.split('\n').filter(line => line.trim()); const cards = []; for (let i = 1; i < lines.length; i++) { // Skip header const parts = lines[i].split(','); if (parts.length >= 2) { cards.push({ id: Date.now().toString() + i, front: parts[0].replace(/"/g, '').trim(), back: parts[1].replace(/"/g, '').trim(), tags: parts[2] ? parts[2].replace(/"/g, '').split(';').map(t => t.trim()) : [], created: new Date().toISOString(), interval: 0, easiness: 2.5, repetitions: 0, nextReview: new Date().toISOString() }); } } return cards; } // Parse TXT import (tab-separated) function parseTXT(content) { const lines = content.split('\n').filter(line => line.trim()); const cards = []; lines.forEach((line, i) => { const parts = line.split('\t'); if (parts.length >= 2) { cards.push({ id: Date.now().toString() + i, front: parts[0].trim(), back: parts[1].trim(), tags: parts[2] ? parts[2].split(' ').filter(t => t.trim()) : [], created: new Date().toISOString(), interval: 0, easiness: 2.5, repetitions: 0, nextReview: new Date().toISOString() }); } }); return cards; } // ========== UTILITY FUNCTIONS ========== // Download file function downloadFile(content, filename, mimeType) { const blob = new Blob([content], { type: mimeType }); const url = URL.createObjectURL(blob); const link = document.createElement('a'); link.href = url; link.download = filename; document.body.appendChild(link); link.click(); document.body.removeChild(link); URL.revokeObjectURL(url); } // Save data to localStorage function saveData() { localStorage.setItem('flashcards', JSON.stringify(flashcards)); localStorage.setItem('studyStats', JSON.stringify(studyStats)); } // Copy to clipboard function copyToClipboard(text) { navigator.clipboard.writeText(text).then(() => { showNotification('Copied to clipboard!', 'success'); }).catch(() => { // Fallback for older browsers const textArea = document.createElement('textarea'); textArea.value = text; document.body.appendChild(textArea); textArea.select(); document.execCommand('copy'); document.body.removeChild(textArea); showNotification('Copied to clipboard!', 'success'); }); } // Show notification toast function showNotification(message, type = 'success') { const toast = document.createElement('div'); toast.className = `toast ${type}`; toast.textContent = message; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, 3000); return toast; } // Show OTA section function showOTA() { const otaContainer = document.getElementById('otaContainer'); if (otaContainer && (otaContainer.style.display === 'none' || !otaContainer.style.display)) { otaContainer.style.display = 'block'; setTimeout(() => { const otaHeader = document.querySelector('.ota-header h3'); if (otaHeader) { otaHeader.style.animation = 'pulse 1s ease-in-out'; } }, 100); } } // Analytics tracking function trackEvent(eventName, data = {}) { if (typeof gtag !== 'undefined') { gtag('event', eventName, { 'event_category': TOOL_CONFIG.category, 'event_label': TOOL_CONFIG.name, ...data }); } } // ========== AI ASSISTANT FUNCTIONS ========== // AI ëǍë‹Ŧ 뗴揰 function openAIModal() { const modal = document.getElementById('aiModal'); modal.classList.add('show'); if (aiModalState.apiKey && aiModalState.currentView === 'gemini') { showGeminiChat(); } else { showAISelector(); } updateAPIKeyStatus(); } // AI ëǍë‹Ŧ ë‹Ģ기 function closeAIModal() { const modal = document.getElementById('aiModal'); modal.classList.remove('show'); setTimeout(() => { aiModalState.currentView = 'selector'; showAISelector(); }, 300); } // AI ė„ íƒ 화면 í‘œė‹œ function showAISelector() { document.getElementById('aiModalTitle').textContent = 'Choose Your AI Assistant'; document.getElementById('aiSelector').style.display = 'flex'; document.getElementById('geminiChat').style.display = 'none'; document.getElementById('apiKeySetup').style.display = 'none'; aiModalState.currentView = 'selector'; } // Gemini ėą„íŒ… 화면 í‘œė‹œ function showGeminiChat() { document.getElementById('aiModalTitle').innerHTML = '✨ Gemini AI Assistant'; document.getElementById('aiSelector').style.display = 'none'; document.getElementById('geminiChat').style.display = 'flex'; document.getElementById('apiKeySetup').style.display = 'none'; aiModalState.currentView = 'gemini'; const chatMessages = document.getElementById('chatMessages'); if (!chatMessages.innerHTML.trim()) { addMessage('assistant', `Hello! I can help you with: â€ĸ Creating effective flashcard content â€ĸ Study techniques and memorization strategies â€ĸ Spaced repetition optimization â€ĸ Converting notes into flashcard format â€ĸ Memory improvement tips What would you like to know about flashcards or studying?`); } } // API 키 네렕 화면 í‘œė‹œ function showAPIKeySetup() { document.getElementById('aiModalTitle').textContent = 'āĻœā§‡āĻŽāĻŋāύāĻŋ āĻāĻĒāĻŋāφāχ āϏ⧇āϟāφāĻĒ āĻ•āϰ⧁āύ'; document.getElementById('aiSelector').style.display = 'none'; document.getElementById('geminiChat').style.display = 'none'; document.getElementById('apiKeySetup').style.display = 'block'; aiModalState.currentView = 'setup'; } // AI ė„ íƒ 래ëĻŦ function selectAI(aiType) { const cardCount = flashcards.length; switch(aiType) { case 'chatgpt': let chatContext = `I'm using a Flash Card Maker tool on WIA Code platform. `; if (cardCount > 0) { chatContext += `I have ${cardCount} flashcards created. `; } chatContext += `Can you help me with flashcard creation strategies, study techniques, or memory improvement methods?`; const chatUrl = `https://chat.openai.com/?q=${encodeURIComponent(chatContext)}`; window.open(chatUrl, '_blank'); closeAIModal(); trackEvent('ai_selection', { ai_type: 'chatgpt' }); break; case 'claude': let claudeContext = `I'm using a Flash Card Maker tool. `; if (cardCount > 0) { claudeContext += `I have ${cardCount} flashcards in my deck. `; } claudeContext += `Please help me with effective flashcard design, spaced repetition strategies, or study optimization techniques.`; const claudeUrl = `https://claude.ai/chat?q=${encodeURIComponent(claudeContext)}`; window.open(claudeUrl, '_blank'); closeAIModal(); trackEvent('ai_selection', { ai_type: 'claude' }); break; case 'gemini': if (!aiModalState.apiKey) { showAPIKeySetup(); } else { showGeminiChat(); } trackEvent('ai_selection', { ai_type: 'gemini' }); break; } } // API 키 ė €ėžĨ function saveGeminiApiKey() { const apiKey = document.getElementById('geminiApiKeyInput').value.trim(); if (apiKey) { localStorage.setItem('geminiApiKey', apiKey); aiModalState.apiKey = apiKey; showGeminiChat(); updateAPIKeyStatus(); } else { alert('āĻ…āύ⧁āĻ—ā§āϰāĻš āĻ•āϰ⧇ āĻāĻ•āϟāĻŋ āĻŦ⧈āϧ āĻāĻĒāĻŋāφāχ āϕ⧀ āĻĒā§āϰāĻŦ⧇āĻļ āĻ•āϰāĻžāύ'); } } // API 키 ėƒíƒœ ė—…ë°ė´íŠ¸ function updateAPIKeyStatus() { const statusEl = document.getElementById('apiKeyStatus'); if (aiModalState.apiKey) { statusEl.innerHTML = 'āĻāĻĒāĻŋāφāχ āϕ⧀ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āĻ•āϰ⧁āύ'; } else { statusEl.textContent = 'āϕ⧋āύ⧋ āĻāĻĒāĻŋāφāχ āϕ⧀ āϏ⧇āϟ āĻ•āϰāĻž āĻšāϝāĻŧāύāĻŋ'; } } // ėą„íŒ… ëŠ”ė‹œė§€ ėļ”ę°€ function addMessage(type, content) { const chatMessages = document.getElementById('chatMessages'); const messageDiv = document.createElement('div'); messageDiv.className = `message ${type}`; if (type === 'user') { messageDiv.innerHTML = `You: ${content}`; } else { messageDiv.innerHTML = `✨ Gemini:
${content.replace(/\n/g, '
')}`; } chatMessages.appendChild(messageDiv); chatMessages.scrollTop = chatMessages.scrollHeight; } // Gemini뗐 ëŠ”ė‹œė§€ ė „ė†Ą async function sendToGemini() { const input = document.getElementById('geminiInput'); const message = input.value.trim(); if (!message) return; addMessage('user', message); input.value = ''; const loadingMsg = document.createElement('div'); loadingMsg.className = 'message assistant'; loadingMsg.innerHTML = '✨ Gemini:
Thinking...'; loadingMsg.id = 'loading-message'; document.getElementById('chatMessages').appendChild(loadingMsg); try { let context = `Context: User is using a Flash Card Maker on WIA Code platform. `; if (flashcards.length > 0) { context += `Current deck has ${flashcards.length} flashcards. `; const recentCard = flashcards[flashcards.length - 1]; context += `Most recent card: "${recentCard.front}" -> "${recentCard.back}". `; } context += `User question: ${message}`; const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=${aiModalState.apiKey}`, { method: 'āĻĒā§‹āĻ¸ā§āϟ', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ contents: [{ parts: [{ text: context }] }], generationConfig: { temperature: 0.7, maxOutputTokens: 1000 } }) }); const data = await response.json(); document.getElementById('loading-message').remove(); if (data.candidates && data.candidates[0] && data.candidates[0].content) { const reply = data.candidates[0].content.parts[0].text; addMessage('assistant', reply); } else { addMessage('assistant', 'Sorry, I could not generate a response. Please try again.'); } } catch (error) { document.getElementById('loading-message')?.remove(); if (error.message.includes('āĻāĻĒāĻŋāφāχ āϕ⧀')) { addMessage('error', 'Invalid API key. Please check your API key and try again.'); showAPIKeySetup(); } else { addMessage('error', 'Failed to connect to Gemini. Please check your internet connection and try again.'); } } } // ========== EVENT LISTENERS ========== document.addEventListener('āĻĄāĻŋāĻ“āĻāĻŽ āĻ•āύāĻŸā§‡āĻ¨ā§āϟ āϞ⧋āĻĄā§‡āĻĄ', function() { // Initialize updateStats(); updateDeckDisplay(); updatePreview(); // AI 버íŠŧ ė´ë˛¤íŠ¸ document.getElementById('aiBtn').addEventListener('click', openAIModal); // ëǍë‹Ŧ 뙏ëļ€ í´ëĻ­ė‹œ ë‹Ģ기 document.getElementById('aiModal').addEventListener('click', function(e) { if (e.target === this) { closeAIModal(); } }); // í‚¤ëŗ´ë“œ ė´ë˛¤íŠ¸ document.addEventListener('keydown', function(e) { if (e.key === 'āĻāĻ¨ā§āϟāĻžāϰ') { const geminiInput = document.getElementById('geminiInput'); if (document.activeElement === geminiInput) { sendToGemini(); } } if (e.key === 'āĻāĻ¸ā§āϕ⧇āĻĒ') { closeAIModal(); } // Study mode keyboard shortcuts if (!document.getElementById('studyInterface').classList.contains('hidden')) { if (e.key === ' ') { e.preventDefault(); flipCard('studyCard'); } else if (e.key === 'āĻĄāĻžāύ āϤ⧀āϰ' || e.key === 'āĻāĻ¨ā§āϟāĻžāϰ') { e.preventDefault(); nextCard(); } } }); // 봈揰 API 키 ėƒíƒœ ė—…ë°ė´íŠ¸ updateAPIKeyStatus(); updateCurrentYear(); updateToolCount(); }); // Track analytics events document.querySelectorAll('a[href*="wia"]').forEach(link => { link.addEventListener('click', function() { trackEvent('wia_link_click', { link: link.textContent }); }); }); // ========== DYNAMIC TOOL COUNT ========== async function updateToolCount() { try { const fallbackCount = 333; document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${fallbackCount}+ free online tools in 206 languages. No signup, no fees, just tools that work.`; }); document.querySelectorAll('.dynamic-count').forEach(el => { const prefix = el.getAttribute('data-text') || ''; const suffix = el.getAttribute('data-suffix') || ''; const icon = el.textContent.split(' ')[0] || ''; el.textContent = `${icon} ${prefix} ${fallbackCount}+ ${suffix}`; }); } catch (error) { console.log('āϟ⧁āϞ āϏāĻ‚āĻ–ā§āϝāĻž āĻāĻĒāĻŋāφāχ āωāĻĒāϞāĻŦā§āϧ āύāϝāĻŧ'); } } function updateCurrentYear() { const currentYear = new Date().getFullYear(); document.querySelectorAll('.current-year').forEach(el => { el.textContent = currentYear; }); } // ========== ANALYTICS ========== window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-XXXXXXXXX'); trackEvent('page_view', { tool: TOOL_CONFIG.name, category: TOOL_CONFIG.category });