-
Notifications
You must be signed in to change notification settings - Fork 41
/
index.html
385 lines (362 loc) · 18.2 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<meta name="description" content="Touch typing trainer using N-grams as data source, with option to customize the auto-generated lesson and specify the minimum typing performance needed. There are sound/color effects as well.">
<meta name="keywords" content="ngrams, ngram type, ngram, n-gram, typing, touch typing, keyboard layout, colemak, dvorak, norman, workman">
<meta name="author" content="Ranel Padon">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="google-site-verification" content="RqOYH5UBWT4DVyfEYHXjrPThEWNS7JcCI5ZiYnd-JW4" />
<link rel="icon" type="image/x-icon" href="./favicon.ico">
<title>Ngram Type</title>
<!-- jQuery required by Bootstrap. -->
<!-- https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js -->
<script src="./assets/js/jquery-3.5.1.min.js"></script>
<!-- Darkly Bootstrap Theme! https://bootswatch.com/darkly/-->
<!-- https://bootswatch.com/4/darkly/bootstrap.min.css -->
<link rel="stylesheet" type="text/css" href="./assets/css/bootstrap-4.6.2--darkly.min.css">
<!-- https://bootswatch.com/4/_vendor/bootstrap/dist/js/bootstrap.bundle.min.js -->
<script src="./assets/js/bootstrap-4.6.2.min.js"></script>
<!-- https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css -->
<link rel="stylesheet" href="./assets/css/font-awesome-4.7.0.min.css">
<link rel="stylesheet" type="text/css" href="./app.css">
<!-- Ngrams Sources. -->
<script src="./ngrams/bigrams.js"></script>
<script src="./ngrams/trigrams.js"></script>
<script src="./ngrams/tetragrams.js"></script>
<script src="./ngrams/words.js"></script>
<!-- VueJS -->
<!-- Should use the development/unminified version so that the Vue DevTools could be used. -->
<!-- https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js -->
<script src="./assets/js/vue-2.6.12.js"></script>
<!-- Timer -->
<script src="./assets/js/moment.min.js"></script>
<script src="./assets/js/ez.countimer.js"></script>
<script>
$(document).ready(function() {
$('.timer').countimer({
autoStart: false,
});
});
</script>
</head>
<body>
<div id="app" class="d-flex flex-column">
<!--Navbar (sound toggle and timer) start-->
<nav class="navbar bg-dark justify-content-center">
<div class="container-fluid">
<div id="timer-wrapper" class="align-self-start">
<div class="timer well">
</div>
</div>
<div class="nav-item d-flex">
<div id="sound-togglers" class="collapse pr-4">
<div class="custom-control custom-switch">
<input
type="checkbox"
class="custom-control-input"
id="sound-correct-letter-toggler"
v-model="data.soundCorrectLetterEnabled"
>
<label class="custom-control-label" for="sound-correct-letter-toggler">Correct Letter</label>
</div>
<div class="custom-control custom-switch">
<input
type="checkbox"
class="custom-control-input"
id="sound-incorrect-letter-toggler"
v-model="data.soundIncorrectLetterEnabled"
>
<label class="custom-control-label" for="sound-incorrect-letter-toggler">Incorrect Letter</label>
</div>
<div class="custom-control custom-switch">
<input
type="checkbox"
class="custom-control-input"
id="sound-passed-threshold-toggler"
v-model="data.soundPassedThresholdEnabled"
>
<label class="custom-control-label" for="sound-passed-threshold-toggler">Passed Threshold</label>
</div>
<div class="custom-control custom-switch">
<input
type="checkbox"
class="custom-control-input"
id="sound-failed-threshold-toggler"
v-model="data.soundFailedThresholdEnabled"
>
<label class="custom-control-label" for="sound-failed-threshold-toggler">Failed Threshold</label>
</div>
</div>
<a href="#" class="align-self-start" data-toggle="collapse" data-target="#sound-togglers">
Sounds
</a>
</div>
</div>
</nav>
<!--Navbar end-->
<!--Lesson settings start-->
<div class="row justify-content-center mx-0">
<fieldset class="settings-module col-xl-2 col-lg-2 col-md-2 col-sm-4 col-xs-12">
<legend>Source</legend>
<div class="form-group">
<label class="col-form-label col-form-label-sm"> </label>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="bi-grams"
name="source-radio-group"
value="bigrams"
v-model="data.source"
>
<label class="custom-control-label" for="bi-grams">Bigrams</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="tri-grams"
name="source-radio-group"
value="trigrams"
v-model="data.source"
>
<label class="custom-control-label" for="tri-grams">Trigrams</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="tetra-grams"
name="source-radio-group"
value="tetragrams"
v-model="data.source"
>
<label class="custom-control-label" for="tetra-grams">Tetragrams</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="words"
name="source-radio-group"
value="words"
v-model="data.source"
>
<label class="custom-control-label" for="words">Words</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="custom_words"
name="source-radio-group"
value="custom_words"
v-model="data.source"
>
<label class="custom-control-label" for="custom_words">
<a
href="#"
data-toggle="modal"
data-target="#custom-words-modal"
:click="customWordsModalShow"
>
Custom
</a>
</label>
</div>
</div>
</fieldset>
<fieldset class="settings-module col-xl-2 col-lg-2 col-md-2 col-sm-4 col-xs-12">
<legend>Scope</legend>
<div class="form-group">
<label class="col-form-label col-form-label-sm"> </label>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="top-50"
name="scope-radio-group"
value="50"
v-model.number="data[data['source']].scope"
v-on:change="refreshPhrasesAndCurrentMetrics"
:disabled="data.source == 'custom_words'"
>
<label class="custom-control-label" for="top-50">Top 50</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="top-100"
name="scope-radio-group"
value="100"
v-model.number="data[data['source']].scope"
v-on:change="refreshPhrasesAndCurrentMetrics"
:disabled="data.source == 'custom_words'"
>
<label class="custom-control-label" for="top-100">Top 100</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="top-150"
name="scope-radio-group"
value="150"
v-model.number="data[data['source']].scope"
v-on:change="refreshPhrasesAndCurrentMetrics"
:disabled="data.source == 'custom_words'"
>
<label class="custom-control-label" for="top-150">Top 150</label>
</div>
<div class="custom-control custom-radio">
<input
type="radio"
class="custom-control-input"
id="top-200"
name="scope-radio-group"
value="200"
v-model.number="data[data['source']].scope"
v-on:change="refreshPhrasesAndCurrentMetrics"
:disabled="data.source == 'custom_words'"
>
<label class="custom-control-label" for="top-200">Top 200</label>
</div>
</div>
</fieldset>
<fieldset class="settings-module col-xl-2 col-lg-2 col-md-3 col-sm-4 col-xs-12">
<legend>Generator</legend>
<div class="form-group">
<label class="col-form-label col-form-label-sm">Combination</label>
<input v-model.number="data[data['source']].combination" v-on:change="refreshPhrases"
class="form-control form-control-sm" type="number" min="1">
<label class="col-form-label col-form-label-sm">Repetition</label>
<input v-model.number="data[data['source']].repetition" v-on:change="refreshPhrases"
class="form-control form-control-sm" type="number" min="1">
</div>
</fieldset>
<fieldset class="settings-module col-xl-2 col-lg-2 col-md-3 col-sm-4 col-xs-12">
<legend>Threshold</legend>
<div class="form-group">
<label class="col-form-label col-form-label-sm">WPM</label>
<input v-model.number="data[data['source']].minimumWPM" v-on:change="save"
class="form-control form-control-sm" type="number" min="1" max="500">
<label class="col-form-label col-form-label-sm">Accuracy</label>
<input v-model.number="data[data['source']].minimumAccuracy" class="form-control form-control-sm"
type="number" min="1" max="100" v-on:change="save">
</div>
</fieldset>
</div>
<!-- Modal for the custom texts. -->
<div id="custom-words-modal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
</div>
<div class="modal-body">
<p>Put the custom words here, separated by spaces/newlines.</p>
<textarea id="custom-words-modal--text-area" rows="10" class="w-100">
</textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" v-on:click="customWordsModalSubmit">OK</button>
</div>
</div>
</div>
</div>
<!-- Modal for the data reset warning. -->
<div id="data-reset-modal" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
Release Note
</div>
<div class="modal-body">
<p>
There are data schema changes to integrate the scoping of sources (i.e. the dynamic <b>Top 50</b>, <b>Top 100</b>, <b>Top 150</b>, or <b>Top 200</b>)
for more flexible and comprehensive training.
</p>
<p>
This means that your saved data will be reset, but you could easily replicate your previous settings.
Likewise, the data reset makes the code simpler/leaner by removing the back-compatibility hacks.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">OK</button>
</div>
</div>
</div>
</div>
<!--Lesson settings end-->
<!--Lesson start-->
<div class="px-4">
<div class="lesson-index center">
<h4 v-show="data[data['source']].phrases.length">
Lesson {{ data[data['source']].phrasesCurrentIndex + 1 }} / {{ data[data['source']].phrases.length }}
</h4>
<h4 v-show="!data[data['source']].phrases.length">
Click the "Custom" link to input words.
</h4>
</div>
<div class="expected-phrase word text-white bg-primary mb-3">
{{ expectedPhrase }}
</div>
<div class="form-group input-fields">
<label class="col-form-label col-form-label-lg"></label>
<input v-model="typedPhrase"
:class="{'form-control': true, 'form-control-lg': true, 'incorrect-input': !isInputCorrect}"
id="input-typing" type="text" autocorrect="off" autocapitalize="none"
placeholder="Re-type if failed, press <TAB> or <ESC> to reset" spellcheck="false"
v-on:keyup="keyHandler">
</div>
</div>
<!--Lesson end-->
<!--Stats start-->
<div class="center stats mt-auto">
<h4>WPM: {{ rawWPM }} </h4>
<h4>Accuracy: {{ accuracy }} % </h4>
<h4>Average WPM: {{ averageWPM }} </h4>
</div>
<!--Stats end-->
<!--Footer start-->
<footer>
<h3 class="title-wrapper center card-header"><a href="https://github.com/ranelpadon/ngram-type" target="_blank" class="title">
Ngram Type
</a></h3>
<div class="title-wrapper center footer-links mb-0">
<a class="title" href="https://github.com/ranelpadon/ngram-type#features" target="_blank">
<i class="fa fa-question-circle"></i>
<div class="label">
How to Use
</div>
</a>
<a class="title" href="https://github.com/ranelpadon/ngram-type/issues/new" target="_blank">
<i class="fa fa-wrench"></i>
<div class="label">
Suggest Improvements
</div>
</a>
<a class="title" href="https://ko-fi.com/ranelpadon" target="_blank">
<i class="fa fa-coffee"></i>
<div class="label">
Buy Me a Coffee
</div>
</a>
</div>
<div class="title-wrapper center powered-by mt-2">
<div class="label">
<a href="https://vuejs.org/" target="_blank">
Powered By
<img src=./media/images/vuejs.png />
</a>
</div>
</div>
</footer>
<!--Footer end-->
</div>
<script src="./app.js"></script>
</body>
</html>