-
Notifications
You must be signed in to change notification settings - Fork 1
/
practice.html
486 lines (439 loc) · 27.3 KB
/
practice.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="TemplateMo">
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Tốc ký</title>
<!-- Bootstrap core CSS -->
<link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Additional CSS Files -->
<link rel="stylesheet" href="assets/css/fontawesome.css">
<link rel="stylesheet" href="assets/css/templatemo-host-cloud.css">
<link rel="stylesheet" href="assets/css/owl.css">
<link rel="stylesheet" href="assets/css/practice.css">
<link rel="stylesheet" href="assets/css/keyboard.css">
<link rel="stylesheet" href="assets/css/keyboard-steno.css">
<!--
Host Cloud Template
https://templatemo.com/tm-541-host-cloud
-->
</head>
<body>
<!-- ***** Preloader Start ***** -->
<!-- <div id="preloader">
<div class="jumper">
<div></div>
<div></div>
<div></div>
</div>
</div> -->
<!-- ***** Preloader End ***** -->
<!-- Header -->
<div>
<header class="header">
<nav class="navbar navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="index.html">
<h2>Tốc <em>Ký</em></h2>
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive"
aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="index.html">Trang chủ
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="rules.html">Học quy tắc</a>
</li>
<li class="nav-item active">
<a class="nav-link" disable="true" href="practice.html">Luyện tập</a>
</li>
<li class="nav-item">
<a class="nav-link" href="gamelogin.html">Trò chơi</a>
</li>
<li class="nav-item">
<a class="nav-link" href="news.html">Tin tức</a>
</li>
</ul>
</div>
<div class="functional-buttons">
<ul>
<li><a href="Profile.html">HCI-19</a></li>
<li><a href="#">Đăng xuất</a></li>
</ul>
</div>
</div>
</nav>
</header>
</div>
<!-- End Header -->
<!-- Page Content -->
<!-- Heading Starts Here -->
<div class="page-heading header-text">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>Luyện tập</h1>
<p><a href="index.html">Home</a> / <span>Luyện tập</span></p>
</div>
</div>
</div>
</div>
<!-- Heading Ends Here -->
<!-- Body -->
<div class="body-training">
<div class="container-fluid row">
<div class="col-sm-2 lession">
<p id="lession-list">Danh sách các bài luyện tập</p>
<div class="list-group">
<a class="list-group-item active" href="#" style="width: 98%"><i class="fa fa-play">
</i>
<strong style="font-weight: bold; font-size: 14px;">Luyện tập gõ từ</strong>
<small>Top 200 từ</small>
</a>
<a class="list-group-item" href="practice1.html"><i class="fa fa-play-circle"></i>
<strong style="font-weight: bold; font-size: 14px;">Luyện tập gõ câu</strong>
<small>Top 200 từ</small>
</a>
<a class="list-group-item" href="#"><i class="fa fa-forward"></i>
<strong style="font-weight: bold; font-size: 14px;">Luyện tập gõ từ tiếng Viêt nâng cao</strong>
<small>Top 1000 từ</small>
</a>
<a class="list-group-item" href="#"><i class="fa fa-forward"></i>
<strong style="font-weight: bold; font-size: 14px;">Luyện tập gõ từ tiếng Anh nâng cao</strong>
<small>Top 1000 từ</small>
</a>
<a class="list-group-item" href="#"><i class="fa fa-chart"></i>
<strong style="font-weight: bold; font-size: 14px;">Xếp hạng</strong></a>
</div>
</div>
<div class="col-sm-10 training-area">
<div class="main row">
<div class="col-md-8">
<div style="margin-left:-2px; display: inline;">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenuButton"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Tiếng việt
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Tiếng Anh</a>
</div>
</div>
<span style="font-size: 14px; margin: 10px 0px 0px 10px;">Chuyển đổi ngôn ngữ</span>
</div>
<span style="display:block; margin: 10px 0px -30px 0px;">Văn bản: </span>
<div class="text-area row" id="type">
</div>
<div class="row" style="margin-top: 20px; display: flex; flex-direction: column;">
<div style="display: flex; justify-content: flex-end; margin-right: 94px;">
<button class="btn btn-primary btn-style" id="time-count"
style="width:10%;">1:00</button>
<button class="btn btn-primary btn-style"
style="width:7%; height:40px; margin-left: 2px;" onclick="return reset(event)"><i
class="fa fa-undo"></i>
</button>
</div>
<div>
<textarea class="typing" id="typing" type="text" onkeydown="return onKeyDown(event)"
onkeyup="return typing(event)"></textarea>
</div>
</div>
<!-- Keyboard -->
<div class="keyboard-base">
<div class="key" id="key" onkeypress="myFunction()">~</div>
<div class="key keyhighlight" id="key1">1</div>
<div class="key keyhighlight" id="key2">2</div>
<div class="key keyhighlight" id="key3">3</div>
<div class="key keyhighlight" id="key4">4</div>
<div class="key keyhighlight" id="key5">5</div>
<div class="key keyhighlight" id="key6">6</div>
<div class="key keyhighlight" id="key7">7</div>
<div class="key keyhighlight" id="key8">8</div>
<div class="key keyhighlight" id="key9">9</div>
<div class="key keyhighlight" id="key0">0</div>
<div class="key">-</div>
<div class="key">+</div>
<div class="key delete">Delete</div>
<div class="key tab">Tab</div>
<div class="key key-base-parent" id="keyq" style="background-color: black; color: white;">S<div class="key-base">Q</div>
</div>
<div class="key key-base-parent" id="keyw" style="background-color: black; color: white;">K<div class="key-base">W</div></div>
<div class="key key-base-parent" id="keye" style="background-color: black; color: white;">R<div class="key-base">E</div></div>
<div class="key key-base-parent" id="keyr" style="background-color: black; color: white;">N<div class="key-base">R</div></div>
<div class="key key-base-parent" id="keyt" style="background-color: black; color: white;">H<div class="key-base">R</div></div>
<div class="key" id="">Y</div>
<div class="key key-base-parent" id="keyu" style="background-color: black; color: white;">*<div class="key-base">U</div></div>
<div class="key key-base-parent" id="keyi" style="background-color: black; color: white;">W<div class="key-base">I</div></div>
<div class="key key-base-parent" id="keyo" style="background-color: black; color: white;">J<div class="key-base">O</div></div>
<div class="key key-base-parent" id="keyp" style="background-color: black; color: white;">N<div class="key-base">P</div></div>
<div class="key key-base-parent" id="key[" style="background-color: black; color: white;">T<div class="key-base">[</div></div>
<div class="key">]</div>
<div class="key backslash">\</div>
<div class="key capslock">CapsLock</div>
<div class="key key-base-parent" id="keya" style="background-color: black; color: white;">T<div class="key-base">A</div></div>
<div class="key key-base-parent" id="keys" style="background-color: black; color: white;">P<div class="key-base">S</div></div>
<div class="key key-base-parent" id="keyd" style="background-color: black; color: white;">H<div class="key-base">D</div></div>
<div class="key key-base-parent" id="keyf" style="background-color: black; color: white;">N<div class="key-base">F</div></div>
<div class="key key-base-parent" id="keyg" style="background-color: black; color: white;">S<div class="key-base">G</div></div>
<div class="key" id="">H</div>
<div class="key key-base-parent" id="keyj" style="background-color: black; color: white;">I<div class="key-base">J</div></div>
<div class="key key-base-parent" id="keyk" style="background-color: black; color: white;">Y<div class="key-base">K</div></div>
<div class="key key-base-parent" id="keyl" style="background-color: black; color: white;">J<div class="key-base">L</div></div>
<div class="key key-base-parent" id="key;" style="background-color: black; color: white;">G<div class="key-base">;</div></div>
<div class="key key-base-parent" id="key'" style="background-color: black; color: white;">K<div class="key-base">'</div></div>
<div class="key return">Return</div>
<div class="key leftshift" id="keyShift1">Shift</div>
<div class="key" id="">Z</div>
<div class="key" id="">X</div>
<div class="key key-base-parent" id="keyc" style="background-color: black; color: white;">U<div class="key-base">C</div></div>
<div class="key key-base-parent" id="keyv" style="background-color: black; color: white;">O<div class="key-base">V</div></div>
<div class="key" id="">B</div>
<div class="key key-base-parent" id="keyn" style="background-color: black; color: white;">E<div class="key-base">N</div></div>
<div class="key key-base-parent" id="keym" style="background-color: black; color: white;">A<div class="key-base">M</div></div>
<div class="key">,</div>
<div class="key">.</div>
<div class="key">/</div>
<div class="key rightshift" id="keyShift1">Shift</div>
<div class="key leftctrl" id="keyControl1">Ctrl</div>
<div class="key">Alt</div>
<div class="key command">Command</div>
<div class="key space">Space</div>
<div class="key command">command</div>
<div class="key">Alt</div>
<div class="key rightctrl" id="keyControl1">Ctrl</div>
<div class="key">Fn</div>
</div>
<!-- <button class="btn btn-primary">Kết thúc luyện tập </button> -->
</div>
<div class="col-md-4">
<div class="option">
<div>Các từ đã gõ:</div>
<div id="key-pressed">
</div>
<div class="keyboard">
<div class="keyboard-base-game-sh">
<div class="key-sh space-sh" id="key" onkeypress="myFunction()"
style="width: 97.5%; background: #2bbd52;"></div>
<div class="key-sh" id="key-steno-q" style="background-color: black; color: white;">
S
</div>
<div class="key-sh" id="key-steno-w" style="background-color: black; color: white;">
K</div>
<div class="key-sh" id="key-steno-e" style="background-color: black; color: white;">
R</div>
<div class="key-sh" id="key-steno-r" style="background-color: black; color: white;">
N</div>
<div class="key-sh" id="key-steno-t" style="background-color: black; color: white;">
H</div>
<div class="key-sh" id="key-steno-u" style="background-color: black; color: white;">
*</div>
<div class="key-sh" id="key-steno-i" style="background-color: black; color: white;">
W</div>
<div class="key-sh" id="key-steno-o" style="background-color: black; color: white;">
J</div>
<div class="key-sh" id="key-steno-p" style="background-color: black; color: white;">
N</div>
<div class="key-sh" id="key-steno-[" style="background-color: black; color: white;">
T</div>
<div class="key-sh" id="key-steno-a" style="background-color: black; color: white;">
T</div>
<div class="key-sh" id="key-steno-s" style="background-color: black; color: white;">
P</div>
<div class="key-sh" id="key-steno-d" style="background-color: black; color: white;">
H</div>
<div class="key-sh" id="key-steno-f" style="background-color: black; color: white;">
N</div>
<div class="key-sh" id="key-steno-g" style="background-color: black; color: white;">
S</div>
<div class="key-sh" id="key-steno-j" style="background-color: black; color: white;">
I</div>
<div class="key-sh" id="key-steno-k" style="background-color: black; color: white;">
Y</div>
<div class="key-sh" id="key-steno-l" style="background-color: black; color: white;">
J</div>
<div class="key-sh" id="key-steno-;" style="background-color: black; color: white;">
G</div>
<div class="key-sh" id="key-steno-'" style="background-color: black; color: white;">
K</div>
<div class="key-sh" id="blank"></div>
<div class="key-sh" id="blank"></div>
<div class="key-sh" id="blank"></div>
<div class="key-sh" id="key-steno-c" style="background-color: black; color: white;">
U</div>
<div class="key-sh" id="key-steno-v" style="background-color: black; color: white;">
O</div>
<div class="key-sh" id="key-steno-n" style="background-color: black; color: white;">
E</div>
<div class="key-sh" id="key-steno-m" style="background-color: black; color: white;">
A</div>
</div>
</div>
</div>
<!-- <div id="key-pressed" hidden="true" >-->
<!-- <h3 id="result">Kết quả</h3>-->
<!-- -->
<!-- <span id = "wpm"><h1>0 WPM</h1></span>-->
<!-- <hr />-->
<!-- <span id=""><h6>Số từ đã gõ <span id="word-pressed-result">0</span></h6></span>-->
<!-- <hr />-->
<!-- <span id = "collect-word"><h6>Từ gõ đúng<span id="word-collect-result">0</span></h6></span>-->
<!-- <hr />-->
<!-- <span id = "wrong-word"><h6>Từ gõ sai<span id="word-wrong-result">0</span></h6></span>-->
<!-- <hr />-->
<!-- <span id = "ratio-word"><h6>Tỉ lệ gõ chính xác<span id="ratio-word-result">0%</span></h6></span>-->
<!-- <hr />-->
<!-- <!– <tbody>-->
<!-- <tr>-->
<!-- <td>-->
<!-- 5 WPM-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>-->
<!-- Số từ đã gõ-->
<!-- </td>-->
<!-- -->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>-->
<!-- Số từ gõ đúng-->
<!-- </td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td>-->
<!-- Số từ gõ sai-->
<!-- </td>-->
<!-- </tr>-->
<!-- </tbody> –>-->
<!-- </div>-->
</div>
</div>
</div>
</div>
</div>
<!-- End Keyboard -->
<!-- Footer Starts Here -->
<footer>
<div class="container">
</div>
</footer>
<!-- Footer Ends Here -->
<!-- Bootstrap core JavaScript -->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Additional Scripts -->
<script src="assets/js/custom.js"></script>
<script src="assets/js/owl.js"></script>
<script src="assets/js/accordions.js"></script>
<script language="text/Javascript">
cleared[0] = cleared[1] = cleared[2] = 0; //set a cleared flag for each field
function clearField(t) { //declaring the array outside of the
if (!cleared[t.id]) { // function makes it static and global
cleared[t.id] = 1; // you could use true and false, but that's more typing
t.value = ''; // with more chance of typos
t.style.color = '#fff';
}
}
</script>
<script>
let key = [];
let time = 60000;
let timeCount;
let a = 0;
let wordCount = 0;
let word = "";
let resetWord = false;
//On key down
function onKeyDown(e) {
// if(resetWord) {
// word.forEach(x => {
// document.getElementById("key" + x).style.backgroundColor = "black";
// document.getElementById("key-steno-" + x).style.backgroundColor = "black";
// })
// word = [];
// resetWord = false;
// }
// word.push(e.key);
}
//Typing
function typing(e) {
word = word + e.key;
if (e.code === "Space") {
let now = new Date();
document.querySelector("#typing").value = ""
a = a + 1;
wordCount = wordCount + 1;
let beforeWord = document.querySelector(`span[word = '${wordCount - 1}']`);
let currentWord = document.querySelector(`span[word = '${wordCount}']`);
currentWord.style.background = "rgb(221, 221, 221)";
beforeWord.style.background = "";
if (a === 1) {
var x = setInterval(() => {
time = time - 1000;
if (time < 1000) {
time = 0;
clearInterval(x)
}
document.querySelector("#time-count").innerHTML = millisToMinutesAndSeconds(time);
}, 1000)
}
let time1 = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds()
document.getElementById("key-pressed").innerText += time1 + ": " + word+"\n";
word = ""
} else {
// word.forEach(x => {
// document.getElementById("key" + x).style.backgroundColor = "red";
// document.getElementById("key-steno-" + x).style.backgroundColor = "red";
// })
// resetWord = true;
// Đổi màu
if (key.length === 0) {
document.getElementById("key" + e.key).style.backgroundColor = "red";
document.getElementById("key-steno-" + e.key).style.backgroundColor = "red";
key.push(e.key);
}
if (e.key !== key[0]) {
document.getElementById("key" + key[0]).style.backgroundColor = "black";
document.getElementById("key-steno-" + key[0]).style.backgroundColor = "black";
key.shift();
document.getElementById("key" + e.key).style.backgroundColor = "red";
document.getElementById("key-steno-" + e.key).style.backgroundColor = "red";
key.push(e.key)
}
}
}
function millisToMinutesAndSeconds(millis) {
var minutes = Math.floor(millis / 60000);
var seconds = ((millis % 60000) / 1000).toFixed(0);
return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
}
function reset(e) {
time = 60000;
}
let stringDemo = "Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur Excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum"
let node = document.createElement("span");
let textList = stringDemo.split(" ");
let i = 0;
for (i = 0; i < textList.length; i++) {
let node = document.createElement("span");
let textnode = document.createTextNode(textList[i]);
node.setAttribute("word", i)
node.appendChild(textnode)
if (i == 0) {
node.style.background = "#dddddd"
}
document.getElementsByClassName("text-area")[0].appendChild(node)
}
</script>
</body>
</html>