Skip to content

Commit ed29d3e

Browse files
committed
- removed "Advanced" from the name
- added example text in textarea - replaced words per minute input with a slider - changed "Reading Level" to "Text Complexity" for clarity - implemented auto-analysis on page load - updated UI labels and descriptions for better usability
1 parent 17a9318 commit ed29d3e

File tree

1 file changed

+48
-15
lines changed

1 file changed

+48
-15
lines changed

tools/reading_time_estimator.html

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,32 @@
88
<meta name="keywords" content="reading time, estimator, words per minute, text analysis, readability, Flesch-Kincaid">
99
<script src="https://cdn.tailwindcss.com"></script>
1010
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.min.js"></script>
11-
<title>Advanced Reading Time Estimator</title>
11+
<title>Reading Time Estimator</title>
1212
</head>
1313
<body class="bg-gray-100 dark:bg-gray-900 flex justify-center items-center min-h-screen transition-colors duration-200">
1414
<div class="container mx-auto max-w-2xl p-5 bg-white dark:bg-gray-800 rounded-lg shadow-lg">
15-
<h1 class="text-3xl font-bold text-center mb-4 text-gray-800 dark:text-white">Advanced Reading Time Estimator</h1>
15+
<h1 class="text-3xl font-bold text-center mb-4 text-gray-800 dark:text-white">Reading Time Estimator</h1>
1616
<div class="mb-4">
1717
<label for="input" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Enter Text:</label>
18-
<textarea id="input" class="mt-1 p-3 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600" rows="5" placeholder="Paste your text here..."></textarea>
18+
<textarea id="input" class="mt-1 p-3 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600" rows="5">The Internet is a global network of interconnected computers that has revolutionized the way we communicate, access information, and conduct business. It was developed in the late 1960s as a project of the United States Department of Defense, originally called ARPANET. Today, the Internet connects billions of devices worldwide, enabling instant communication, information sharing, and a wide range of online services. Key technologies that power the Internet include TCP/IP protocols, the World Wide Web, and various applications like email, social media, and streaming platforms. As the Internet continues to evolve, it faces challenges related to privacy, security, and equal access, while also presenting new opportunities in areas such as artificial intelligence, the Internet of Things, and virtual reality.</textarea>
1919
</div>
2020
<div class="grid grid-cols-2 gap-4 mb-4">
21-
<div>
22-
<label for="wpm" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Words Per Minute:</label>
23-
<input type="number" id="wpm" min="1" max="1000" value="200" class="mt-1 p-2 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600">
21+
<div class="mb-4">
22+
<label for="readingSpeed" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Reading Speed:</label>
23+
<input type="range" id="readingSpeed" min="100" max="700" step="50" value="250" class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700">
24+
<div class="flex justify-between text-xs text-gray-600 dark:text-gray-400 px-2">
25+
<span>Slow</span>
26+
<span>Average</span>
27+
<span>Fast</span>
28+
</div>
29+
<p id="wpmDisplay" class="text-sm text-center mt-2 text-gray-600 dark:text-gray-400">250 WPM (Average)</p>
2430
</div>
2531
<div>
26-
<label for="readingLevel" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Reading Level:</label>
27-
<select id="readingLevel" class="mt-1 p-2 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600">
28-
<option value="1">Beginner</option>
29-
<option value="1.2">Intermediate</option>
30-
<option value="1.5" selected>Advanced</option>
32+
<label for="textComplexity" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Text Complexity:</label>
33+
<select id="textComplexity" class="mt-1 p-2 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm dark:bg-gray-700 dark:text-white dark:border-gray-600">
34+
<option value="1">Simple</option>
35+
<option value="1.2">Moderate</option>
36+
<option value="1.5">Complex</option>
3137
</select>
3238
</div>
3339
</div>
@@ -43,7 +49,7 @@ <h3 class="text-lg font-semibold text-gray-700 dark:text-gray-300">Top Keywords:
4349
</div>
4450
<div id="howToUseSection" class="my-6">
4551
<button onclick="toggleCollapse()" class="flex items-center justify-between w-full p-4 bg-blue-50 dark:bg-blue-900 border-l-4 border-blue-400 text-blue-700 dark:text-blue-300 cursor-pointer">
46-
<h2 class="font-semibold text-lg">How to Use Advanced Reading Time Estimator</h2>
52+
<h2 class="font-semibold text-lg">How to Use Reading Time Estimator</h2>
4753
<span id="collapseIcon" class="text-xl">+</span>
4854
</button>
4955
<div id="howToUseContent" class="hidden">
@@ -64,16 +70,43 @@ <h2 class="font-semibold text-lg">How to Use Advanced Reading Time Estimator</h2
6470
let readabilityChart;
6571
document.getElementById('estimate-time').addEventListener('click', analyzeText);
6672

73+
window.addEventListener('load', function() {
74+
updateWPMDisplay(readingSpeedSlider.value);
75+
analyzeText();
76+
});
77+
78+
const readingSpeedSlider = document.getElementById('readingSpeed');
79+
const wpmDisplay = document.getElementById('wpmDisplay');
80+
81+
function updateWPMDisplay(value) {
82+
let speedDescription;
83+
if (value < 200) speedDescription = "Slow";
84+
else if (value < 300) speedDescription = "Average";
85+
else if (value < 450) speedDescription = "Fast";
86+
else speedDescription = "Speed reader";
87+
88+
wpmDisplay.textContent = `${value} WPM (${speedDescription})`;
89+
}
90+
91+
readingSpeedSlider.addEventListener('input', function() {
92+
updateWPMDisplay(this.value);
93+
});
94+
95+
readingSpeedSlider.addEventListener('change', analyzeText);
96+
97+
// Initial display update
98+
updateWPMDisplay(readingSpeedSlider.value);
99+
67100
function analyzeText() {
68101
const input = document.getElementById('input').value.trim();
69102
if (!input) {
70103
alert("Please enter some text to analyze.");
71104
return;
72105
}
73-
const wpm = parseInt(document.getElementById('wpm').value) || 200;
74-
const readingLevel = parseFloat(document.getElementById('readingLevel').value);
106+
const wpm = parseInt(readingSpeedSlider.value);
107+
const textComplexity = parseFloat(document.getElementById('textComplexity').value);
75108
const wordCount = input.split(/\s+/).length;
76-
const readingTimeMinutes = (wordCount / wpm) * readingLevel;
109+
const readingTimeMinutes = (wordCount / wpm) * textComplexity;
77110
const resultContainer = document.getElementById('result');
78111
const statsContainer = document.getElementById('stats');
79112
resultContainer.textContent = `Estimated Reading Time: ${formatTime(readingTimeMinutes)}`;

0 commit comments

Comments
 (0)