diff --git a/forum.html b/forum.html index ebce572..b7f78ca 100644 --- a/forum.html +++ b/forum.html @@ -33,7 +33,7 @@

Forum

-

Thread

+

Thread

diff --git a/forum.js b/forum.js index 12534d9..d434a6b 100644 --- a/forum.js +++ b/forum.js @@ -4,6 +4,13 @@ document.addEventListener("DOMContentLoaded", () => { const nameEl = document.getElementById("forum-name"); const msgEl = document.getElementById("forum-message"); const list = document.getElementById("forum-posts"); + const countEl = document.getElementById("forum-count"); + const refreshCount = () => { + if (!countEl) return; + const n = list.children.length; + countEl.textContent = n + (n === 1 ? " post" : " posts"); + }; + refreshCount(); if (!postBtn || !nameEl || !msgEl || !list) return; postBtn.addEventListener("click", () => { @@ -26,6 +33,10 @@ document.addEventListener("DOMContentLoaded", () => { when.textContent = new Date().toLocaleTimeString(); li.appendChild(when); list.appendChild(li); + refreshCount(); + + nameEl.value = ""; + msgEl.value = ""; }); }); diff --git a/styles.css b/styles.css index da763c5..2c9e5aa 100644 --- a/styles.css +++ b/styles.css @@ -90,3 +90,7 @@ h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; } } .forum-time { margin-left: 8px; color: #888; font-size: 0.85em; } + +.forum-count { font-size: 0.6em; color: #888; font-weight: normal; margin-left: 8px; } + +.forum-count { font-size: 0.6em; color: #888; font-weight: normal; margin-left: 8px; }