// ═══════════════════════════════════════════════════════ // Word Counter // ═══════════════════════════════════════════════════════ async function updateCounter() { const text = document.getElementById('counterInput').value; const d = await apiPost('/api/text/stats', { text }); if (d.success) { document.getElementById('counterResults').innerHTML = `
Characters
${d.characters}
No Spaces
${d.charactersNoSpaces}
Words
${d.words}
Sentences
${d.sentences}
Paragraphs
${d.paragraphs}
Lines
${d.lines}
Reading Time
${d.readingTime}
${d.topChars.length ? '
Top Characters
' + d.topChars.map(([ch,n]) => `${ch} ×${n}`).join('') + '
' : ''}`; } }