Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions TextStatistics/krispytoes101/README.md
Original file line number Diff line number Diff line change
@@ -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)
55 changes: 55 additions & 0 deletions TextStatistics/krispytoes101/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Text Statistics</title>
<link rel="stylesheet" href="style.css">
</head>
<body>

<div class="container">
<h1>Text Statistics</h1>
<p>Analyze your text instantly.</p>

<textarea id="textInput" placeholder="Start typing or paste your text here..."></textarea>

<div class="stats">
<div class="stat">
<h2 id="words">0</h2>
<p>Words</p>
</div>

<div class="stat">
<h2 id="characters">0</h2>
<p>Characters</p>
</div>

<div class="stat">
<h2 id="noSpaces">0</h2>
<p>Without Spaces</p>
</div>

<div class="stat">
<h2 id="sentences">0</h2>
<p>Sentences</p>
</div>

<div class="stat">
<h2 id="paragraphs">0</h2>
<p>Paragraphs</p>
</div>

<div class="stat">
<h2 id="readingTime">0</h2>
<p>Reading Time (min)</p>
</div>
</div>

<button id="clearButton">Clear Text</button>
</div>

<script src="script.js"></script>
</body>
</html>
Binary file added TextStatistics/krispytoes101/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions TextStatistics/krispytoes101/script.js
Original file line number Diff line number Diff line change
@@ -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();
83 changes: 83 additions & 0 deletions TextStatistics/krispytoes101/style.css
Original file line number Diff line number Diff line change
@@ -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;
}
}