diff --git a/TextStatistics/krispytoes101/README.md b/TextStatistics/krispytoes101/README.md new file mode 100644 index 000000000..805b9c989 --- /dev/null +++ b/TextStatistics/krispytoes101/README.md @@ -0,0 +1,38 @@ + +# Text Statistics + +Text Statistics is a simple web application that analyzes text and displays useful statistics in real time. + +## Features + +- Word count +- Total character count +- Character count without spaces +- Sentence count +- Paragraph count +- Estimated reading time +- Clear text button +- Real-time updates while typing + +## Technologies Used + +- HTML5 +- CSS3 +- JavaScript + +## How to Run + +1. Download or clone the repository. +2. Open the TextStatistics folder. +3. Open the index.html file in a web browser. +4. Enter text in the text area to see the statistics. + +No additional libraries or installations are required. + +## Screenshot + +![alt text](image.png) + +## Author + +GitHub: [krispytoes101](https://github.com/krispytoes101) diff --git a/TextStatistics/krispytoes101/index.html b/TextStatistics/krispytoes101/index.html new file mode 100644 index 000000000..bd617d569 --- /dev/null +++ b/TextStatistics/krispytoes101/index.html @@ -0,0 +1,55 @@ + + + + + + + Text Statistics + + + + +
+

Text Statistics

+

Analyze your text instantly.

+ + + +
+
+

0

+

Words

+
+ +
+

0

+

Characters

+
+ +
+

0

+

Without Spaces

+
+ +
+

0

+

Sentences

+
+ +
+

0

+

Paragraphs

+
+ +
+

0

+

Reading Time (min)

+
+
+ + +
+ + + + diff --git a/TextStatistics/krispytoes101/screenshot.png b/TextStatistics/krispytoes101/screenshot.png new file mode 100644 index 000000000..76b402fdf Binary files /dev/null and b/TextStatistics/krispytoes101/screenshot.png differ diff --git a/TextStatistics/krispytoes101/script.js b/TextStatistics/krispytoes101/script.js new file mode 100644 index 000000000..0c42e6dc3 --- /dev/null +++ b/TextStatistics/krispytoes101/script.js @@ -0,0 +1,41 @@ + +const textInput = document.getElementById("textInput"); +const clearButton = document.getElementById("clearButton"); + +function analyzeText() { + const text = textInput.value; + + const words = text.trim() === "" + ? [] + : text.trim().split(/\s+/); + + const characters = text.length; + + const noSpaces = text.replace(/\s/g, "").length; + + const sentences = text.trim() === "" + ? 0 + : (text.match(/[.!?]+(?=\s|$)/g) || []).length; + + const paragraphs = text.trim() === "" + ? 0 + : text.trim().split(/\n\s*\n/).length; + + const readingTime = Math.ceil(words.length / 200); + + document.getElementById("words").textContent = words.length; + document.getElementById("characters").textContent = characters; + document.getElementById("noSpaces").textContent = noSpaces; + document.getElementById("sentences").textContent = sentences; + document.getElementById("paragraphs").textContent = paragraphs; + document.getElementById("readingTime").textContent = readingTime; +} + +textInput.addEventListener("input", analyzeText); + +clearButton.addEventListener("click", function() { + textInput.value = ""; + analyzeText(); +}); + +analyzeText(); diff --git a/TextStatistics/krispytoes101/style.css b/TextStatistics/krispytoes101/style.css new file mode 100644 index 000000000..b658132fd --- /dev/null +++ b/TextStatistics/krispytoes101/style.css @@ -0,0 +1,83 @@ + +* { + box-sizing: border-box; +} + +body { + font-family: Arial, sans-serif; + background: #eef2f7; + margin: 0; + padding: 30px; +} + +.container { + max-width: 750px; + margin: 40px auto; + padding: 30px; + background: white; + border-radius: 12px; + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); +} + +h1 { + color: #263b60; + margin-bottom: 5px; +} + +textarea { + width: 100%; + height: 200px; + padding: 15px; + margin: 20px 0; + border: 1px solid #ccc; + border-radius: 8px; + font-size: 16px; + resize: vertical; +} + +.stats { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 15px; +} + +.stat { + background: #eef3fa; + padding: 15px; + text-align: center; + border-radius: 8px; +} + +.stat h2 { + color: #315b9a; + margin: 5px; +} + +.stat p { + color: #555; + margin: 5px; +} + +button { + background: #315b9a; + color: white; + border: none; + padding: 12px 22px; + margin-top: 20px; + border-radius: 6px; + cursor: pointer; +} + +button:hover { + background: #203f70; +} + +@media (max-width: 550px) { + .stats { + grid-template-columns: repeat(2, 1fr); + } + + .container { + padding: 18px; + } +}