āϏ⧁āĻĄā§‹āϕ⧁ āĻœā§‡āύāĻžāϰ⧇āϟāϰ

āĻŦāĻŋāĻ­āĻŋāĻ¨ā§āύ āĻ•āĻ āĻŋāύāϤāĻžāϰ āĻ¸ā§āϤāϰ⧇ āĻ…āϏ⧀āĻŽ āĻĢā§āϰāĻŋ āϏ⧁āĻĄā§‹āϕ⧁ āĻĒāĻžāϜāϞ āϤ⧈āϰāĻŋ āĻ•āϰ⧁āύāĨ¤ āχāĻ¨ā§āϟāĻžāϰ⧇āĻ•ā§āϟāĻŋāĻ­ āĻĢāĻŋāϚāĻžāϰ āϏāĻš āĻ…āύāϞāĻžāχāύ⧇ āϖ⧇āϞ⧁āύ āĻŦāĻž āĻ…āĻĢāϞāĻžāχāύ⧇ āϏāĻŽāĻžāϧāĻžāύ⧇āϰ āϜāĻ¨ā§āϝ āĻĒā§āϰāĻŋāĻ¨ā§āϟ āĻ•āϰ⧁āύāĨ¤ āĻāφāχ-āϚāĻžāϞāĻŋāϤ āĻšāĻŋāĻ¨ā§āϟāϏ āĻāĻŦāĻ‚ āĻ•āĻžāĻ¸ā§āϟāĻŽāĻžāχāϜāϝ⧋āĻ—ā§āϝ āĻ…āĻĒāĻļāύ āϏāĻš āύāϤ⧁āύ āĻĨ⧇āϕ⧇ āĻāĻ•ā§āϏāĻĒāĻžāĻ°ā§āϟāĻĻ⧇āϰ āϜāĻ¨ā§āϝ āωāĻĒāϝ⧁āĻ•ā§āϤāĨ¤

āĻ—ā§āϰāĻŋāĻĄā§‡āϰ āφāĻ•āĻžāϰ
4×4
āύāϤ⧁āύ āĻļāĻŋāĻ•ā§āώāĻžāĻ°ā§āĻĨā§€
9×9
āĻ•ā§āϞāĻžāϏāĻŋāĻ•
āĻ•āĻ āĻŋāύāϤāĻžāϰ āĻ¸ā§āϤāϰ
āϏāĻšāϜ ā§Ēā§Ģ-ā§Ģā§ĻāϟāĻŋ āϏ⧂āĻ¤ā§āϰ
āĻŽāĻžāĻāĻžāϰāĻŋ ā§Šā§Ģ-ā§Ēā§ĻāϟāĻŋ āϏ⧂āĻ¤ā§āϰ
āĻ•āĻ āĻŋāύ ⧍ā§Ģ-ā§Šā§ĻāϟāĻŋ āϏ⧂āĻ¤ā§āϰ
āĻāĻ•ā§āϏāĻĒāĻžāĻ°ā§āϟ ā§§ā§­-⧍ā§ĒāϟāĻŋ āϏ⧂āĻ¤ā§āϰ
āϗ⧇āĻŽ āĻŽā§‹āĻĄ
āĻ…āύāϞāĻžāχāύ⧇ āϏāĻŽāĻžāϧāĻžāύ āĻ•āϰ⧁āύ
āĻĒā§āϰāĻŋāĻ¨ā§āϟ āĻĢāϰāĻŽā§āϝāĻžāϟ
ā§Ļā§Ļ:ā§Ļā§Ļ
āĻ•āĻ āĻŋāύāϤāĻž: āϏāĻšāϜ
āĻ—ā§āϰāĻŋāĻĄ āϏāĻžāχāϜ: ā§¯Ã—ā§¯
āĻĒā§‚āϰāĻŖ āĻ•āϰāĻž: ā§Ļ/ā§Žā§§
āϭ⧁āϞ: 0
0
āϤ⧈āϰāĻŋ āĻ•āϰāĻž āĻšāϝāĻŧ⧇āϛ⧇
0
āϏāĻŽā§āĻĒāĻ¨ā§āύ
--:--
āϏ⧇āϰāĻž āϏāĻŽāϝāĻŧ
--:--
āĻ—āĻĄāĻŧ āϏāĻŽāϝāĻŧ
ā§Ļ%
āϏāĻĢāϞāϤāĻžāϰ āĻšāĻžāϰ

đŸŽ¯ āύāĻŽā§āύāĻž āĻĒāĻžāϜāϞ āϖ⧇āϞ⧁āύ

🎲 āĻ•ā§āϞāĻžāϏāĻŋāĻ• āϏ⧁āĻĄā§‹āϕ⧁
āĻ…āύ⧁āĻļā§€āϞāύ⧇āϰ āϜāĻ¨ā§āϝ āϐāϤāĻŋāĻšā§āϝāĻŦāĻžāĻšā§€ ā§¯Ã—ā§¯ āĻĒāĻžāϜāϞ
🌱 āύāϤ⧁āύāĻĻ⧇āϰ āϜāĻ¨ā§āϝ āωāĻĒāϝ⧋āĻ—ā§€
āύāϤ⧁āύāĻĻ⧇āϰ āϜāĻ¨ā§āϝ āϏāĻšāϜ ā§Ē×ā§Ē āĻĒāĻžāϜāϞ
đŸ”Ĩ āĻāĻ•ā§āϏāĻĒāĻžāĻ°ā§āϟ āĻšā§āϝāĻžāϞ⧇āĻžā§āϜ
āĻ…āĻ­āĻŋāĻœā§āĻž āϖ⧇āϞ⧋āϝāĻŧāĻžāĻĄāĻŧāĻĻ⧇āϰ āϜāĻ¨ā§āϝ āĻ•āĻ āĻŋāύ āĻĒāĻžāϜāϞ
📅 āĻĻ⧈āύāĻŋāĻ• āĻĒāĻžāϜāϞ
āφāϜāϕ⧇āϰ āĻŦāĻŋāĻļ⧇āώ āϏ⧁āĻĄā§‹āϕ⧁ āĻšā§āϝāĻžāϞ⧇āĻžā§āϜ
âš–ī¸ āĻĒā§āϰāϤāĻŋāϏāĻŽ āĻĒā§āϝāĻžāϟāĻžāĻ°ā§āύ
āύāĻžāĻ¨ā§āĻĻāύāĻŋāĻ•āĻ­āĻžāĻŦ⧇ āĻ­āĻžāϰāϏāĻžāĻŽā§āϝāĻĒā§‚āĻ°ā§āĻŖ āĻĒāĻžāϜāϞ āĻĄāĻŋāϜāĻžāχāύ
đŸŽ¯ āϏāĻ°ā§āĻŦāύāĻŋāĻŽā§āύ āϏ⧂āĻ¤ā§āϰ
ā§§ā§­-āϏ⧂āĻ¤ā§āϰ⧇āϰ āϧāĻžāρāϧāĻž - āĻšā§‚āĻĄāĻŧāĻžāĻ¨ā§āϤ āĻšā§āϝāĻžāϞ⧇āĻžā§āϜ

🧠 āĻŽāĻ¸ā§āϤāĻŋāĻˇā§āĻ• āĻĒā§āϰāĻļāĻŋāĻ•ā§āώāĻŖ āϗ⧇āĻŽ āĻĒāĻ›āĻ¨ā§āĻĻ āĻ•āϰ⧇āύ?

āĻŽāĻžāύāϏāĻŋāĻ• āϏ⧁āĻ¸ā§āĻĨāϤāĻžāϰ āϜāĻ¨ā§āϝ āĻĒā§āϰāĻŋāĻŽāĻŋāϝāĻŧāĻžāĻŽ āϧāĻžāρāϧāĻžāϰ āĻŦāχ āĻāĻŦāĻ‚ āĻŽāĻ¸ā§āϤāĻŋāĻˇā§āĻ• āĻĒā§āϰāĻļāĻŋāĻ•ā§āώāĻŖ āĻ…ā§āϝāĻžāĻĒāϏ āφāĻŦāĻŋāĻˇā§āĻ•āĻžāϰ āĻ•āϰ⧁āύ

✨ Smart Nation's Core Infrastructure: WIA Code ✨

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

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

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

đŸ’Ŧ āĻšā§āϝāĻžāϟāϜāĻŋāĻĒāĻŋāϟāĻŋ
āϏāĻ°ā§āĻŦāĻžāϧāĻŋāĻ• āĻŦāĻšā§āĻŽā§āĻ–ā§€ â€ĸ āϏāĻžāϧāĻžāϰāĻŖ āĻ•āĻžāĻœā§‡āϰ āϜāĻ¨ā§āϝ āϏ⧇āϰāĻž
🧠 āĻ•ā§āϞāĻĄ
āϏ⧇āϰāĻž āϝ⧁āĻ•ā§āϤāĻŋ āĻĒā§āϰāϝāĻŧā§‹āĻ— â€ĸ āĻŦāĻŋāĻļā§āϞ⧇āώāϪ⧇āϰ āϜāĻ¨ā§āϝ āύāĻŋāϖ⧁āρāϤ
✨ āĻœā§‡āĻŽāĻŋāύāĻŋ āĻĢā§āϰāĻŋ
āĻĻ⧈āύāĻŋāĻ• āĻĢā§āϰāĻŋ āϏ⧀āĻŽāĻž â€ĸ āĻ…āĻ¨ā§āϤāĻ°ā§āύāĻŋāĻ°ā§āĻŽāĻŋāϤ āĻšā§āϝāĻžāϟ
`; printWindow.document.write(html); printWindow.document.close(); printWindow.print(); } // ========== CONTROL FUNCTIONS ========== function selectGridSize(size) { document.querySelectorAll('.grid-btn').forEach(btn => btn.classList.remove('active')); event.target.classList.add('active'); gameState.gridSize = size; document.getElementById('currentSize').textContent = `${size}×${size}`; // Reset number pad generateNumberPad(); } function selectDifficulty(difficulty) { document.querySelectorAll('.difficulty-btn').forEach(btn => btn.classList.remove('active')); event.target.classList.add('active'); gameState.difficulty = difficulty; document.getElementById('currentDifficulty').textContent = difficulty.charAt(0).toUpperCase() + difficulty.slice(1); } function selectMode(mode) { document.querySelectorAll('.control-group:last-child .grid-btn').forEach(btn => btn.classList.remove('active')); event.target.classList.add('active'); gameState.mode = mode; } function loadSamplePuzzle(type) { if (SAMPLE_PUZZLES[type]) { const sample = SAMPLE_PUZZLES[type]; gameState.currentPuzzle = copyGrid(sample.puzzle); gameState.solution = copyGrid(sample.solution); gameState.userGrid = copyGrid(sample.puzzle); gameState.gridSize = sample.size; gameState.difficulty = sample.difficulty; gameState.isCompleted = false; gameState.moves = []; gameState.errors = 0; // Update UI document.getElementById('currentSize').textContent = `${sample.size}×${sample.size}`; document.getElementById('currentDifficulty').textContent = sample.difficulty.charAt(0).toUpperCase() + sample.difficulty.slice(1); displayPuzzle(); resetTimer(); showNotification(`Loaded ${type} puzzle`, 'success'); } else { // Generate puzzle based on type if (type === 'daily') { generateNewPuzzle(); } else if (type === 'challenging') { gameState.difficulty = 'expert'; selectDifficulty('expert'); generateNewPuzzle(); } else { generateNewPuzzle(); } } } // ========== TIMER FUNCTIONS ========== function startTimer() { if (gameState.timer) return; gameState.startTime = Date.now(); gameState.timer = setInterval(updateTimer, 1000); } function stopTimer() { if (gameState.timer) { clearInterval(gameState.timer); gameState.timer = null; } } function resetTimer() { stopTimer(); gameState.startTime = null; document.getElementById('timer').textContent = '00:00'; } function updateTimer() { if (!gameState.startTime) return; const elapsed = Math.floor((Date.now() - gameState.startTime) / 1000); const minutes = Math.floor(elapsed / 60); const seconds = elapsed % 60; document.getElementById('timer').textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; } function getElapsedTime() { if (!gameState.startTime) return '00:00'; const elapsed = Math.floor((Date.now() - gameState.startTime) / 1000); const minutes = Math.floor(elapsed / 60); const seconds = elapsed % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; } // ========== STATISTICS FUNCTIONS ========== function updateStats(action) { const stats = gameState.stats; if (action === 'generated') { stats.totalGenerated++; } else if (action === 'completed') { stats.totalCompleted++; const time = Date.now() - gameState.startTime; stats.totalTime += time; const difficulty = gameState.difficulty; if (!stats.bestTimes[difficulty] || time < stats.bestTimes[difficulty]) { stats.bestTimes[difficulty] = time; } } // Save to localStorage localStorage.setItem('sudokuStats', JSON.stringify(stats)); // Update display updateStatsDisplay(); } function updateStatsDisplay() { const stats = gameState.stats; document.getElementById('totalPuzzles').textContent = stats.totalGenerated; document.getElementById('completedPuzzles').textContent = stats.totalCompleted; // Best time for current difficulty const bestTime = stats.bestTimes[gameState.difficulty]; document.getElementById('bestTime').textContent = bestTime ? formatTime(bestTime) : '--:--'; // Average time const avgTime = stats.totalCompleted > 0 ? stats.totalTime / stats.totalCompleted : 0; document.getElementById('averageTime').textContent = avgTime > 0 ? formatTime(avgTime) : '--:--'; // Success rate const successRate = stats.totalGenerated > 0 ? Math.round((stats.totalCompleted / stats.totalGenerated) * 100) : 0; document.getElementById('successRate').textContent = `${successRate}%`; } function formatTime(milliseconds) { const seconds = Math.floor(milliseconds / 1000); const minutes = Math.floor(seconds / 60); const remainingSeconds = seconds % 60; return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`; } function updateGameInfo() { const size = gameState.gridSize; const filled = countFilledCells(); const total = size * size; document.getElementById('filledCells').textContent = `${filled}/${total}`; document.getElementById('errorCount').textContent = gameState.errors; // Start timer if first move if (filled > countClues(gameState.currentPuzzle) && !gameState.timer && !gameState.isCompleted) { startTimer(); } } function countFilledCells() { return gameState.userGrid.flat().filter(cell => cell !== 0).length; } // ========== UTILITY FUNCTIONS ========== 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); } 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); } } 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 ========== function openAIModal() { const modal = document.getElementById('aiModal'); modal.classList.add('show'); if (aiModalState.apiKey && aiModalState.currentView === 'gemini') { showGeminiChat(); } else { showAISelector(); } updateAPIKeyStatus(); } function closeAIModal() { const modal = document.getElementById('aiModal'); modal.classList.remove('show'); setTimeout(() => { aiModalState.currentView = 'selector'; showAISelector(); }, 300); } 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'; } 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'm here to help with Sudoku: â€ĸ Solving strategies and techniques â€ĸ Tips for different difficulty levels â€ĸ Understanding Sudoku rules and logic â€ĸ Improving your solving speed â€ĸ Custom puzzle generation advice â€ĸ WIA Code system questions What would you like to know about Sudoku?`); } } 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'; } function selectAI(aiType) { switch(aiType) { case 'chatgpt': const toolContext = `I need help with Sudoku puzzles and solving strategies. I'm using the Sudoku Generator on WIA Code platform to practice different difficulty levels and improve my solving skills.`; const chatUrl = `https://chat.openai.com/?q=${encodeURIComponent(toolContext)}`; window.open(chatUrl, '_blank'); closeAIModal(); trackEvent('ai_selection', { ai_type: 'chatgpt' }); break; case 'claude': const claudeContext = `I need help with Sudoku puzzles and solving strategies. I'm using the Sudoku Generator on WIA Code platform to practice different difficulty levels and improve my solving skills.`; 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; } } function saveGeminiApiKey() { const apiKey = document.getElementById('geminiApiKeyInput').value.trim(); if (apiKey) { localStorage.setItem('geminiApiKey', apiKey); aiModalState.apiKey = apiKey; showGeminiChat(); updateAPIKeyStatus(); } else { alert('āĻ…āύ⧁āĻ—ā§āϰāĻš āĻ•āϰ⧇ āĻāĻ•āϟāĻŋ āĻŦ⧈āϧ āĻāĻĒāĻŋāφāχ āϕ⧀ āĻĒā§āϰāĻŦ⧇āĻļ āĻ•āϰāĻžāύ'); } } 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; } 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 { 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: User is playing Sudoku puzzles on WIA Code Sudoku Generator. Current game state: - Grid size: ${gameState.gridSize}×${gameState.gridSize} - Difficulty: ${gameState.difficulty} - Progress: ${countFilledCells()}/${gameState.gridSize * gameState.gridSize} cells filled - Errors: ${gameState.errors} Sudoku rules: Fill grid so each row, column, and ${Math.sqrt(gameState.gridSize)}×${Math.sqrt(gameState.gridSize)} box contains numbers 1-${gameState.gridSize} exactly once. User question: ${message}` }] }], 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.'); } } } // ========== INITIALIZATION ========== document.addEventListener('āĻĄāĻŋāĻ“āĻāĻŽ āĻ•āύāĻŸā§‡āĻ¨ā§āϟ āϞ⧋āĻĄā§‡āĻĄ', function() { // Initialize game updateStatsDisplay(); generateNumberPad(); // Generate first puzzle generateNewPuzzle(); // Event listeners 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(); } // Number keys for number selection if (e.key >= '1' && e.key <= '9') { const num = parseInt(e.key); if (num <= gameState.gridSize) { selectNumber(num); } } if (e.key === '0' || e.key === 'āĻŽā§āϛ⧇ āĻĢ⧇āϞ⧁āύ' || e.key === 'āĻŦā§āϝāĻžāĻ•āĻ¸ā§āĻĒ⧇āϏ') { if (gameState.selectedCell && document.activeElement.tagName !== 'āχāύāĻĒ⧁āϟ') { selectNumber(0); } } }); updateAPIKeyStatus(); updateCurrentYear(); updateToolCount(); trackEvent('page_view', { tool: TOOL_CONFIG.name, category: TOOL_CONFIG.category }); }); // ========== DYNAMIC TOOL COUNT ========== async function updateToolCount() { try { const response = await fetch('/api/tool-count.php'); const data = await response.json(); document.querySelectorAll('.dynamic-tools-count').forEach(el => { el.textContent = `${data.count}+ 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} ${data.count}+ ${suffix}`; }); } catch (error) { 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}`; }); } } 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 });