Skip to content

Commit bbc17fb

Browse files
authored
Merge pull request #27 from sh13y/revert-21-v2.0.0
Revert "added statistics"
2 parents a251eff + d9d56be commit bbc17fb

1 file changed

Lines changed: 0 additions & 41 deletions

File tree

src/views/index.ejs

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,6 @@
8888
</button>
8989
</div>
9090

91-
<div id="statusBar" style="
92-
padding: 0.5rem;
93-
display: flex;
94-
justify-content: space-around;
95-
align-items: center;
96-
background: var(--burnt-sienna);
97-
border: 2px solid var(--cambridge-blue);
98-
color: var(--eggshell);"
99-
>
100-
<span id="charCount">Characters: 0</span>
101-
<span id="readingTime">Estimated Reading Time: 0</span>
102-
<span id="wordCount">Words: 0</span>
103-
</div>
10491

10592
<footer>
10693
<div class="footer-content">
@@ -165,12 +152,10 @@
165152
166153
socket.on('loadNote', (note) => {
167154
document.getElementById('notepad').value = note.content;
168-
updateCounts();
169155
});
170156
171157
socket.on('noteUpdated', (content) => {
172158
const textarea = document.getElementById('notepad');
173-
updateCounts();
174159
const cursorPosition = textarea.selectionStart;
175160
176161
if (textarea.value !== content) {
@@ -210,8 +195,6 @@
210195
211196
document.getElementById('notepad').addEventListener('input', debounce(() => {
212197
const content = document.getElementById('notepad').value;
213-
updateCounts();
214-
socket.emit('updateNote', { url, content });
215198
216199
if (content !== lastContent) {
217200
lastContent = content;
@@ -330,30 +313,6 @@
330313
.catch(err => console.log('ServiceWorker registration failed:', err));
331314
});
332315
}
333-
334-
// Word, Character Count & Estimated Reading Time
335-
const notepad = document.getElementById('notepad');
336-
const charCountElem = document.getElementById('charCount');
337-
const wordCountElem = document.getElementById('wordCount');
338-
// const readingTime = document.getElementById('readingTime');
339-
340-
function updateCounts() {
341-
const text = notepad.value;
342-
const charCount = text.length;
343-
const wordCount = text.trim().split(/\s+/).filter(Boolean).length;
344-
345-
const minutes = wordCount / 200;
346-
const totalSeconds = Math.round(minutes * 60);
347-
const mins = Math.floor(totalSeconds / 60);
348-
const secs = totalSeconds % 60;
349-
350-
charCountElem.textContent = `Characters: ${charCount}`;
351-
readingTime.textContent = `Reading time: ${mins > 0 ? `${mins} min ` : ""}${secs} sec`;
352-
wordCountElem.textContent = `Words: ${wordCount}`;
353-
}
354-
355-
notepad.addEventListener('input', updateCounts);
356-
window.addEventListener('load', updateCounts);
357316
</script>
358317
</body>
359318
</html>

0 commit comments

Comments
 (0)