Add 3 files
Browse files- README.md +7 -5
- index.html +571 -19
- prompts.txt +1 -0
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: meme-typing-speed-test
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: yellow
|
5 |
+
colorTo: yellow
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,571 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Meme Typing Speed Test</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<style>
|
9 |
+
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap');
|
10 |
+
|
11 |
+
body {
|
12 |
+
font-family: 'Comic Neue', cursive;
|
13 |
+
transition: background-image 0.5s ease-in-out;
|
14 |
+
background-size: cover;
|
15 |
+
background-position: center;
|
16 |
+
background-repeat: no-repeat;
|
17 |
+
min-height: 100vh;
|
18 |
+
}
|
19 |
+
|
20 |
+
.bg-overlay {
|
21 |
+
background-color: rgba(0, 0, 0, 0.6);
|
22 |
+
}
|
23 |
+
|
24 |
+
.text-display {
|
25 |
+
font-size: 1.2rem;
|
26 |
+
line-height: 1.8;
|
27 |
+
letter-spacing: 0.05em;
|
28 |
+
}
|
29 |
+
|
30 |
+
.correct {
|
31 |
+
color: #4ade80;
|
32 |
+
}
|
33 |
+
|
34 |
+
.incorrect {
|
35 |
+
color: #f87171;
|
36 |
+
text-decoration: underline;
|
37 |
+
}
|
38 |
+
|
39 |
+
.current {
|
40 |
+
background-color: rgba(74, 222, 128, 0.3);
|
41 |
+
border-left: 2px solid #4ade80;
|
42 |
+
}
|
43 |
+
|
44 |
+
.fade-in {
|
45 |
+
animation: fadeIn 0.5s;
|
46 |
+
}
|
47 |
+
|
48 |
+
@keyframes fadeIn {
|
49 |
+
from { opacity: 0; }
|
50 |
+
to { opacity: 1; }
|
51 |
+
}
|
52 |
+
|
53 |
+
.meme-caption {
|
54 |
+
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
|
55 |
+
animation: bounce 1s infinite alternate;
|
56 |
+
}
|
57 |
+
|
58 |
+
@keyframes bounce {
|
59 |
+
from { transform: translateY(0); }
|
60 |
+
to { transform: translateY(-5px); }
|
61 |
+
}
|
62 |
+
|
63 |
+
.result-card {
|
64 |
+
backdrop-filter: blur(10px);
|
65 |
+
background-color: rgba(255, 255, 255, 0.15);
|
66 |
+
}
|
67 |
+
</style>
|
68 |
+
</head>
|
69 |
+
<body class="bg-gray-900 text-white" id="app">
|
70 |
+
<div class="bg-overlay min-h-screen flex flex-col items-center justify-center p-4 md:p-8">
|
71 |
+
<div class="w-full max-w-4xl mx-auto">
|
72 |
+
<!-- Header -->
|
73 |
+
<header class="text-center mb-8 fade-in">
|
74 |
+
<h1 class="text-4xl md:text-5xl font-bold mb-2 text-yellow-300">Meme Typing Speed Test</h1>
|
75 |
+
<p class="text-lg md:text-xl text-gray-300">Type fast, get roasted, enjoy the memes!</p>
|
76 |
+
</header>
|
77 |
+
|
78 |
+
<!-- Stats Display -->
|
79 |
+
<div class="flex justify-between mb-6 bg-gray-800 rounded-lg p-4 shadow-lg">
|
80 |
+
<div class="text-center">
|
81 |
+
<p class="text-sm text-gray-400">Speed</p>
|
82 |
+
<p class="text-2xl font-bold" id="wpm">0</p>
|
83 |
+
<p class="text-xs">WPM</p>
|
84 |
+
</div>
|
85 |
+
<div class="text-center">
|
86 |
+
<p class="text-sm text-gray-400">Accuracy</p>
|
87 |
+
<p class="text-2xl font-bold" id="accuracy">100</p>
|
88 |
+
<p class="text-xs">%</p>
|
89 |
+
</div>
|
90 |
+
<div class="text-center">
|
91 |
+
<p class="text-sm text-gray-400">Time</p>
|
92 |
+
<p class="text-2xl font-bold" id="time">60</p>
|
93 |
+
<p class="text-xs">seconds</p>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
|
97 |
+
<!-- Meme Caption -->
|
98 |
+
<div class="text-center mb-6">
|
99 |
+
<p class="text-xl md:text-2xl font-bold meme-caption text-yellow-300" id="meme-caption">Ready to get roasted by your typing speed?</p>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
<!-- Typing Test Area -->
|
103 |
+
<div id="test-container" class="fade-in">
|
104 |
+
<div class="mb-6 p-4 bg-gray-800 rounded-lg shadow-lg">
|
105 |
+
<div id="text-display" class="text-display mb-4 h-24 overflow-y-auto"></div>
|
106 |
+
<input
|
107 |
+
type="text"
|
108 |
+
id="input-field"
|
109 |
+
class="w-full p-3 bg-gray-700 rounded-lg focus:outline-none focus:ring-2 focus:ring-yellow-400"
|
110 |
+
placeholder="Click here to start typing..."
|
111 |
+
autocomplete="off"
|
112 |
+
autocorrect="off"
|
113 |
+
autocapitalize="off"
|
114 |
+
spellcheck="false"
|
115 |
+
>
|
116 |
+
</div>
|
117 |
+
|
118 |
+
<div class="text-center">
|
119 |
+
<button id="start-btn" class="px-6 py-3 bg-yellow-400 hover:bg-yellow-500 text-gray-900 font-bold rounded-lg transition duration-200">
|
120 |
+
Start Test
|
121 |
+
</button>
|
122 |
+
</div>
|
123 |
+
</div>
|
124 |
+
|
125 |
+
<!-- Results (Hidden Initially) -->
|
126 |
+
<div id="results-container" class="hidden fade-in">
|
127 |
+
<div class="result-card rounded-lg p-6 mb-6 shadow-xl border border-gray-700">
|
128 |
+
<h2 class="text-3xl font-bold text-center mb-4 text-yellow-300">Your Results</h2>
|
129 |
+
|
130 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
131 |
+
<div class="bg-gray-800 p-4 rounded-lg">
|
132 |
+
<p class="text-sm text-gray-400">Final Speed</p>
|
133 |
+
<p class="text-3xl font-bold" id="final-wpm">0</p>
|
134 |
+
<p class="text-xs">Words Per Minute</p>
|
135 |
+
</div>
|
136 |
+
<div class="bg-gray-800 p-4 rounded-lg">
|
137 |
+
<p class="text-sm text-gray-400">Accuracy</p>
|
138 |
+
<p class="text-3xl font-bold" id="final-accuracy">100</p>
|
139 |
+
<p class="text-xs">% Correct</p>
|
140 |
+
</div>
|
141 |
+
<div class="bg-gray-800 p-4 rounded-lg">
|
142 |
+
<p class="text-sm text-gray-400">Meme Level</p>
|
143 |
+
<p class="text-3xl font-bold" id="meme-level">Snail</p>
|
144 |
+
<p class="text-xs">Speed Tier</p>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
|
148 |
+
<div class="text-center mb-6">
|
149 |
+
<p class="text-xl font-bold" id="final-caption">You type like a sloth on a lazy Sunday!</p>
|
150 |
+
</div>
|
151 |
+
|
152 |
+
<div class="flex flex-col md:flex-row justify-center gap-4">
|
153 |
+
<button id="restart-btn" class="px-6 py-3 bg-yellow-400 hover:bg-yellow-500 text-gray-900 font-bold rounded-lg transition duration-200">
|
154 |
+
Try Again
|
155 |
+
</button>
|
156 |
+
<button id="share-btn" class="px-6 py-3 bg-blue-500 hover:bg-blue-600 text-white font-bold rounded-lg transition duration-200">
|
157 |
+
Share Results
|
158 |
+
</button>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
</div>
|
162 |
+
</div>
|
163 |
+
</div>
|
164 |
+
|
165 |
+
<script>
|
166 |
+
// Sample texts for typing test
|
167 |
+
const sampleTexts = [
|
168 |
+
"The quick brown fox jumps over the lazy dog. Pack my box with five dozen liquor jugs. How vexingly quick daft zebras jump!",
|
169 |
+
"Crazy Fredrick bought many very exquisite opal jewels. The five boxing wizards jump quickly. My girl wove six dozen plaid jackets before she quit.",
|
170 |
+
"Jinxed wizards pluck ivy from the big quilt. Crazy Fredrick bought many very exquisite opal jewels. Sphinx of black quartz, judge my vow.",
|
171 |
+
"The quick onyx goblin jumps over the lazy dwarf. Pack my red box with five dozen quality jugs. How quickly daft jumping zebras vex!",
|
172 |
+
"Bright vixens jump; dozy fowl quack. Quick wafting zephyrs vex bold Jim. Two driven jocks help fax my big quiz. Five quacking zephyrs jolt my wax bed."
|
173 |
+
];
|
174 |
+
|
175 |
+
// Meme GIFs for different speed tiers
|
176 |
+
const memeGifs = {
|
177 |
+
slow: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExcGJhZ2J0dG9uY2J0d3F4dGJ5d3R6Z2V4eXJ2bGJ5b2VtZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3o7TKTD1P5JCDoQxKU/giphy.gif",
|
178 |
+
medium: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l0HU20BZ6LbSEITza/giphy.gif",
|
179 |
+
fast: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3o7aCTPPm4OHfRLSH6/giphy.gif",
|
180 |
+
ultra: "https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExb2V4dG5oZ2R4dW5tZ2J5eW1rZyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xT5LMHxhOfscxPfIfm/giphy.gif"
|
181 |
+
};
|
182 |
+
|
183 |
+
// Meme captions for different speed tiers
|
184 |
+
const memeCaptions = {
|
185 |
+
slow: [
|
186 |
+
"Your grandma types faster than this.",
|
187 |
+
"Are you typing with your nose?",
|
188 |
+
"I've seen sloths move faster.",
|
189 |
+
"Is your keyboard made of molasses?",
|
190 |
+
"At this rate, you'll finish by next Christmas."
|
191 |
+
],
|
192 |
+
medium: [
|
193 |
+
"Not bad... for a turtle.",
|
194 |
+
"You're trying, and that's what counts.",
|
195 |
+
"Speed: Average. Meme potential: High.",
|
196 |
+
"You type like a middle manager.",
|
197 |
+
"Could be worse... could be better."
|
198 |
+
],
|
199 |
+
fast: [
|
200 |
+
"WOOOSH! You're going places!",
|
201 |
+
"Someone's been practicing!",
|
202 |
+
"Now we're cooking with gas!",
|
203 |
+
"Look at you go, speed demon!",
|
204 |
+
"The keyboard is on fire!"
|
205 |
+
],
|
206 |
+
ultra: [
|
207 |
+
"HOLY MOLY! Are you a robot?",
|
208 |
+
"The Flash called, he wants his speed back.",
|
209 |
+
"You type faster than light travels.",
|
210 |
+
"Did you sell your soul for typing powers?",
|
211 |
+
"NASA wants to study your fingers."
|
212 |
+
]
|
213 |
+
};
|
214 |
+
|
215 |
+
// Final result captions
|
216 |
+
const resultCaptions = {
|
217 |
+
slow: [
|
218 |
+
"You type like a sloth on a lazy Sunday.",
|
219 |
+
"Your fingers move at geological speeds.",
|
220 |
+
"At least you're consistent... consistently slow.",
|
221 |
+
"Maybe try voice typing next time?",
|
222 |
+
"The good news: You can only improve from here!"
|
223 |
+
],
|
224 |
+
medium: [
|
225 |
+
"You're the typing equivalent of vanilla ice cream.",
|
226 |
+
"Not too hot, not too cold... just right.",
|
227 |
+
"You type like a reliable Honda Civic.",
|
228 |
+
"Perfectly adequate in every way.",
|
229 |
+
"You're the human equivalent of 60 WPM."
|
230 |
+
],
|
231 |
+
fast: [
|
232 |
+
"Look at you, you speedy little typist!",
|
233 |
+
"Your fingers dance across the keyboard!",
|
234 |
+
"You type like a caffeinated secretary.",
|
235 |
+
"The keyboard trembles at your approach!",
|
236 |
+
"You've clearly spent too much time online."
|
237 |
+
],
|
238 |
+
ultra: [
|
239 |
+
"ARE YOU EVEN HUMAN? This is insane!",
|
240 |
+
"Your fingers are a blur of typing fury!",
|
241 |
+
"The keyboard can't keep up with you!",
|
242 |
+
"You type faster than most people think!",
|
243 |
+
"Warning: Typing at this speed may cause spontaneous combustion."
|
244 |
+
]
|
245 |
+
};
|
246 |
+
|
247 |
+
// DOM elements
|
248 |
+
const textDisplay = document.getElementById('text-display');
|
249 |
+
const inputField = document.getElementById('input-field');
|
250 |
+
const startBtn = document.getElementById('start-btn');
|
251 |
+
const wpmDisplay = document.getElementById('wpm');
|
252 |
+
const accuracyDisplay = document.getElementById('accuracy');
|
253 |
+
const timeDisplay = document.getElementById('time');
|
254 |
+
const memeCaption = document.getElementById('meme-caption');
|
255 |
+
const testContainer = document.getElementById('test-container');
|
256 |
+
const resultsContainer = document.getElementById('results-container');
|
257 |
+
const finalWpm = document.getElementById('final-wpm');
|
258 |
+
const finalAccuracy = document.getElementById('final-accuracy');
|
259 |
+
const memeLevel = document.getElementById('meme-level');
|
260 |
+
const finalCaption = document.getElementById('final-caption');
|
261 |
+
const restartBtn = document.getElementById('restart-btn');
|
262 |
+
const shareBtn = document.getElementById('share-btn');
|
263 |
+
|
264 |
+
// Test variables
|
265 |
+
let currentText = '';
|
266 |
+
let timer;
|
267 |
+
let timeLeft = 60;
|
268 |
+
let isTyping = false;
|
269 |
+
let correctChars = 0;
|
270 |
+
let incorrectChars = 0;
|
271 |
+
let totalTyped = 0;
|
272 |
+
let wpm = 0;
|
273 |
+
let accuracy = 100;
|
274 |
+
let speedInterval;
|
275 |
+
let lastUpdateTime = 0;
|
276 |
+
let correctKeystrokes = 0;
|
277 |
+
let totalKeystrokes = 0;
|
278 |
+
|
279 |
+
// Initialize the app
|
280 |
+
function init() {
|
281 |
+
// Preload all GIFs
|
282 |
+
preloadGifs();
|
283 |
+
|
284 |
+
// Set up event listeners
|
285 |
+
startBtn.addEventListener('click', startTest);
|
286 |
+
inputField.addEventListener('input', checkTyping);
|
287 |
+
inputField.addEventListener('keydown', (e) => {
|
288 |
+
if (e.key === 'Enter') {
|
289 |
+
e.preventDefault();
|
290 |
+
}
|
291 |
+
});
|
292 |
+
restartBtn.addEventListener('click', resetTest);
|
293 |
+
shareBtn.addEventListener('click', shareResults);
|
294 |
+
|
295 |
+
// Display a random text sample
|
296 |
+
displaySampleText();
|
297 |
+
}
|
298 |
+
|
299 |
+
// Preload all GIFs to avoid loading delays
|
300 |
+
function preloadGifs() {
|
301 |
+
Object.values(memeGifs).forEach(url => {
|
302 |
+
const img = new Image();
|
303 |
+
img.src = url;
|
304 |
+
});
|
305 |
+
}
|
306 |
+
|
307 |
+
// Display a random sample text
|
308 |
+
function displaySampleText() {
|
309 |
+
currentText = sampleTexts[Math.floor(Math.random() * sampleTexts.length)];
|
310 |
+
textDisplay.innerHTML = '';
|
311 |
+
|
312 |
+
currentText.split('').forEach(char => {
|
313 |
+
const span = document.createElement('span');
|
314 |
+
span.textContent = char;
|
315 |
+
textDisplay.appendChild(span);
|
316 |
+
});
|
317 |
+
}
|
318 |
+
|
319 |
+
// Start the typing test
|
320 |
+
function startTest() {
|
321 |
+
if (isTyping) return;
|
322 |
+
|
323 |
+
isTyping = true;
|
324 |
+
timeLeft = 60;
|
325 |
+
correctChars = 0;
|
326 |
+
incorrectChars = 0;
|
327 |
+
totalTyped = 0;
|
328 |
+
wpm = 0;
|
329 |
+
accuracy = 100;
|
330 |
+
correctKeystrokes = 0;
|
331 |
+
totalKeystrokes = 0;
|
332 |
+
|
333 |
+
// Update UI
|
334 |
+
startBtn.classList.add('hidden');
|
335 |
+
inputField.value = '';
|
336 |
+
inputField.focus();
|
337 |
+
timeDisplay.textContent = timeLeft;
|
338 |
+
|
339 |
+
// Start timer
|
340 |
+
timer = setInterval(updateTimer, 1000);
|
341 |
+
|
342 |
+
// Start WPM calculation
|
343 |
+
lastUpdateTime = Date.now();
|
344 |
+
speedInterval = setInterval(calculateSpeed, 2000);
|
345 |
+
|
346 |
+
// Set initial meme
|
347 |
+
updateMeme();
|
348 |
+
}
|
349 |
+
|
350 |
+
// Update the timer
|
351 |
+
function updateTimer() {
|
352 |
+
timeLeft--;
|
353 |
+
timeDisplay.textContent = timeLeft;
|
354 |
+
|
355 |
+
if (timeLeft <= 0) {
|
356 |
+
finishTest();
|
357 |
+
}
|
358 |
+
}
|
359 |
+
|
360 |
+
// Calculate typing speed (WPM)
|
361 |
+
function calculateSpeed() {
|
362 |
+
const now = Date.now();
|
363 |
+
const timeElapsed = (now - lastUpdateTime) / 1000 / 60; // in minutes
|
364 |
+
const charsTyped = totalTyped;
|
365 |
+
|
366 |
+
if (timeElapsed > 0) {
|
367 |
+
// WPM = (correct characters / 5) / minutes
|
368 |
+
wpm = Math.round((correctChars / 5) / timeElapsed);
|
369 |
+
accuracy = totalTyped > 0 ? Math.round((correctKeystrokes / totalKeystrokes) * 100) : 100;
|
370 |
+
|
371 |
+
wpmDisplay.textContent = wpm;
|
372 |
+
accuracyDisplay.textContent = accuracy;
|
373 |
+
|
374 |
+
updateMeme();
|
375 |
+
}
|
376 |
+
|
377 |
+
lastUpdateTime = now;
|
378 |
+
correctChars = 0;
|
379 |
+
totalTyped = 0;
|
380 |
+
}
|
381 |
+
|
382 |
+
// Check typing against sample text
|
383 |
+
function checkTyping() {
|
384 |
+
if (!isTyping) return;
|
385 |
+
|
386 |
+
const inputText = inputField.value;
|
387 |
+
const currentChar = inputText[inputText.length - 1];
|
388 |
+
const expectedChar = currentText[inputText.length - 1];
|
389 |
+
|
390 |
+
totalTyped++;
|
391 |
+
totalKeystrokes++;
|
392 |
+
|
393 |
+
// Check if the character is correct
|
394 |
+
if (currentChar === expectedChar) {
|
395 |
+
correctChars++;
|
396 |
+
correctKeystrokes++;
|
397 |
+
} else {
|
398 |
+
incorrectChars++;
|
399 |
+
}
|
400 |
+
|
401 |
+
// Update the text display with correct/incorrect styling
|
402 |
+
updateTextDisplay(inputText);
|
403 |
+
}
|
404 |
+
|
405 |
+
// Update the text display with coloring
|
406 |
+
function updateTextDisplay(inputText) {
|
407 |
+
const textSpans = textDisplay.querySelectorAll('span');
|
408 |
+
|
409 |
+
textSpans.forEach((span, index) => {
|
410 |
+
// Reset classes
|
411 |
+
span.className = '';
|
412 |
+
|
413 |
+
// Already typed characters
|
414 |
+
if (index < inputText.length) {
|
415 |
+
if (inputText[index] === currentText[index]) {
|
416 |
+
span.classList.add('correct');
|
417 |
+
} else {
|
418 |
+
span.classList.add('incorrect');
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
// Current character
|
423 |
+
if (index === inputText.length) {
|
424 |
+
span.classList.add('current');
|
425 |
+
}
|
426 |
+
});
|
427 |
+
|
428 |
+
// Scroll to keep current character in view
|
429 |
+
const currentSpan = textDisplay.querySelector('.current');
|
430 |
+
if (currentSpan) {
|
431 |
+
currentSpan.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
// Update the meme based on current WPM
|
436 |
+
function updateMeme() {
|
437 |
+
let speedTier, randomCaption;
|
438 |
+
|
439 |
+
if (wpm <= 20) {
|
440 |
+
speedTier = 'slow';
|
441 |
+
randomCaption = memeCaptions.slow[Math.floor(Math.random() * memeCaptions.slow.length)];
|
442 |
+
} else if (wpm <= 50) {
|
443 |
+
speedTier = 'medium';
|
444 |
+
randomCaption = memeCaptions.medium[Math.floor(Math.random() * memeCaptions.medium.length)];
|
445 |
+
} else if (wpm <= 80) {
|
446 |
+
speedTier = 'fast';
|
447 |
+
randomCaption = memeCaptions.fast[Math.floor(Math.random() * memeCaptions.fast.length)];
|
448 |
+
} else {
|
449 |
+
speedTier = 'ultra';
|
450 |
+
randomCaption = memeCaptions.ultra[Math.floor(Math.random() * memeCaptions.ultra.length)];
|
451 |
+
}
|
452 |
+
|
453 |
+
// Update background
|
454 |
+
document.body.style.backgroundImage = `url(${memeGifs[speedTier]})`;
|
455 |
+
|
456 |
+
// Update caption
|
457 |
+
memeCaption.textContent = randomCaption;
|
458 |
+
}
|
459 |
+
|
460 |
+
// Finish the test and show results
|
461 |
+
function finishTest() {
|
462 |
+
clearInterval(timer);
|
463 |
+
clearInterval(speedInterval);
|
464 |
+
isTyping = false;
|
465 |
+
|
466 |
+
// Calculate final WPM and accuracy
|
467 |
+
const finalWpmValue = Math.max(0, wpm);
|
468 |
+
const finalAccuracyValue = Math.max(0, Math.min(100, accuracy));
|
469 |
+
|
470 |
+
// Determine speed tier
|
471 |
+
let speedTier, levelName, randomResultCaption;
|
472 |
+
|
473 |
+
if (finalWpmValue <= 20) {
|
474 |
+
speedTier = 'slow';
|
475 |
+
levelName = 'Snail';
|
476 |
+
randomResultCaption = resultCaptions.slow[Math.floor(Math.random() * resultCaptions.slow.length)];
|
477 |
+
} else if (finalWpmValue <= 50) {
|
478 |
+
speedTier = 'medium';
|
479 |
+
levelName = 'Average Joe';
|
480 |
+
randomResultCaption = resultCaptions.medium[Math.floor(Math.random() * resultCaptions.medium.length)];
|
481 |
+
} else if (finalWpmValue <= 80) {
|
482 |
+
speedTier = 'fast';
|
483 |
+
levelName = 'Speed Demon';
|
484 |
+
randomResultCaption = resultCaptions.fast[Math.floor(Math.random() * resultCaptions.fast.length)];
|
485 |
+
} else {
|
486 |
+
speedTier = 'ultra';
|
487 |
+
levelName = 'GOD MODE';
|
488 |
+
randomResultCaption = resultCaptions.ultra[Math.floor(Math.random() * resultCaptions.ultra.length)];
|
489 |
+
}
|
490 |
+
|
491 |
+
// Update final results
|
492 |
+
finalWpm.textContent = finalWpmValue;
|
493 |
+
finalAccuracy.textContent = finalAccuracyValue;
|
494 |
+
memeLevel.textContent = levelName;
|
495 |
+
finalCaption.textContent = randomResultCaption;
|
496 |
+
|
497 |
+
// Set final meme
|
498 |
+
document.body.style.backgroundImage = `url(${memeGifs[speedTier]})`;
|
499 |
+
|
500 |
+
// Show results container
|
501 |
+
testContainer.classList.add('hidden');
|
502 |
+
resultsContainer.classList.remove('hidden');
|
503 |
+
}
|
504 |
+
|
505 |
+
// Reset the test
|
506 |
+
function resetTest() {
|
507 |
+
clearInterval(timer);
|
508 |
+
clearInterval(speedInterval);
|
509 |
+
|
510 |
+
isTyping = false;
|
511 |
+
inputField.value = '';
|
512 |
+
|
513 |
+
// Reset displays
|
514 |
+
wpmDisplay.textContent = '0';
|
515 |
+
accuracyDisplay.textContent = '100';
|
516 |
+
timeDisplay.textContent = '60';
|
517 |
+
|
518 |
+
// Show test container
|
519 |
+
testContainer.classList.remove('hidden');
|
520 |
+
resultsContainer.classList.add('hidden');
|
521 |
+
|
522 |
+
// Reset start button
|
523 |
+
startBtn.classList.remove('hidden');
|
524 |
+
|
525 |
+
// Get new sample text
|
526 |
+
displaySampleText();
|
527 |
+
|
528 |
+
// Reset meme
|
529 |
+
memeCaption.textContent = "Ready to get roasted by your typing speed?";
|
530 |
+
document.body.style.backgroundImage = '';
|
531 |
+
}
|
532 |
+
|
533 |
+
// Share results
|
534 |
+
function shareResults() {
|
535 |
+
const finalWpmValue = finalWpm.textContent;
|
536 |
+
const finalAccuracyValue = finalAccuracy.textContent;
|
537 |
+
const levelName = memeLevel.textContent;
|
538 |
+
const caption = finalCaption.textContent;
|
539 |
+
|
540 |
+
const shareText = `I just scored ${finalWpmValue} WPM (${finalAccuracyValue}% accuracy) on the Meme Typing Speed Test! ${caption} Try it yourself!`;
|
541 |
+
|
542 |
+
if (navigator.share) {
|
543 |
+
navigator.share({
|
544 |
+
title: 'My Typing Speed Results',
|
545 |
+
text: shareText,
|
546 |
+
url: window.location.href
|
547 |
+
}).catch(err => {
|
548 |
+
console.log('Error sharing:', err);
|
549 |
+
fallbackShare(shareText);
|
550 |
+
});
|
551 |
+
} else {
|
552 |
+
fallbackShare(shareText);
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
// Fallback for browsers that don't support Web Share API
|
557 |
+
function fallbackShare(text) {
|
558 |
+
// Copy to clipboard
|
559 |
+
navigator.clipboard.writeText(text).then(() => {
|
560 |
+
alert('Results copied to clipboard! Paste it anywhere to share.');
|
561 |
+
}).catch(err => {
|
562 |
+
console.log('Could not copy text: ', err);
|
563 |
+
prompt('Copy this to share:', text);
|
564 |
+
});
|
565 |
+
}
|
566 |
+
|
567 |
+
// Initialize the app when the DOM is loaded
|
568 |
+
document.addEventListener('DOMContentLoaded', init);
|
569 |
+
</script>
|
570 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=GameDev102/meme-typing-speed-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
571 |
+
</html>
|
prompts.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Build a web-based typing speed test app that reacts to the user's typing speed in real-time by changing the background to a funny meme GIF. The app should track typing speed (WPM), accuracy, and adjust the background dynamically with a fade transition effect. Core Features: A real-time typing speed tracker (WPM), updated every 2 seconds. Threshold levels for speed: 0–20 WPM → Show slow meme GIF (e.g., a crawling snail or Patrick walking) 21–50 WPM → Show medium-speed meme (e.g., awkward run or someone “trying”) 51–80 WPM → Show fast meme (e.g., Naruto run, Sonic) 80+ WPM → Show ultra-fast meme (e.g., Giga Chad flying or Flash blur) Smooth CSS fade transitions between background GIFs. Show a live caption on screen that changes with typing speed, e.g.: “Your grandma types faster than this.” “WOOOSH! You’re going places.” Additional Features: Calculate final score: WPM, Accuracy, and a meme-style summary at the end. Optional: Let users download or share a GIF screenshot of their typing session. Responsive and mobile-friendly layout. Keep the UI clean and funny, and preload all GIFs to avoid lag during speed changes. Prioritize meme-worthy visual feedback and create an experience that’s fun to share on social media.
|