first commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<!-- ═══════════════ WORD COUNTER ═══════════════ -->
|
||||
<div class="page" id="page-counter">
|
||||
<button class="back-btn" onclick="showPage('home')">← Back to Tools</button>
|
||||
<div class="section-header">
|
||||
<h2><i class="fas fa-calculator" style="color:var(--cyan)"></i> Word & Character Counter</h2>
|
||||
<p>Get detailed text statistics as you type.</p>
|
||||
</div>
|
||||
<div style="max-width:720px;">
|
||||
<textarea id="counterInput" placeholder="Start typing or paste text here..." oninput="updateCounter()" style="min-height:200px;"></textarea>
|
||||
<div id="counterResults" style="margin-top:16px;"></div>
|
||||
<div class="api-usage">
|
||||
<button class="api-usage-toggle" onclick="toggleApiUsage(this)"><span><i class="fas fa-terminal"></i> API Usage <span class="badge">REST</span></span><i class="fas fa-chevron-down"></i></button>
|
||||
<div class="api-usage-body">
|
||||
<div class="api-baseurl-note">All examples use <code>BASE_URL</code> — set it to your deployment URL.</div>
|
||||
<div class="api-endpoint">
|
||||
<span class="api-method post">POST</span><span class="api-path">/api/text/stats</span>
|
||||
<div class="api-desc">Get detailed text statistics: characters, words, sentences, reading time, and top character frequency.</div>
|
||||
<div class="api-code"><button class="api-code-copy" onclick="copyApiCode(this)">Copy</button><span class="kw">const</span> <span class="var">BASE_URL</span> = <span class="str">"http://localhost:3000"</span>;
|
||||
|
||||
<span class="kw">const</span> res = <span class="kw">await</span> <span class="fn">fetch</span>(<span class="var">`${BASE_URL}/api/text/stats`</span>, {
|
||||
method: <span class="str">"POST"</span>,
|
||||
headers: { <span class="str">"Content-Type"</span>: <span class="str">"application/json"</span> },
|
||||
body: JSON.<span class="fn">stringify</span>({ text: <span class="str">"Hello world. This is a test."</span> })
|
||||
});
|
||||
<span class="kw">const</span> data = <span class="kw">await</span> res.<span class="fn">json</span>();
|
||||
<span class="cm">// → { success: true, characters: 28, charactersNoSpaces: 23,
|
||||
// words: 6, sentences: 2, paragraphs: 1, lines: 1,
|
||||
// readingTime: "1 min", topChars: [["l",3], ["s",3], ...] }</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user