-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathform.html
367 lines (298 loc) · 13.3 KB
/
form.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Steno Jig</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script src="type-jig.js"></script>
<script src="util.js"></script>
<script src="word-drill.js"></script>
<script src="number-sentences.js"></script>
<script src="steno-display.js"></script>
<script src="word-sets.js"></script>
<script src="plover-translations.js"></script>
<script src="chart.js"></script>
<link rel="stylesheet" type="text/css" href="font-roboto.css">
</head>
<body>
<div id="form" class="wrapper">
<h1>Choose a drill...</h1>
<div class="form-section">
<div class="caption"><strong>Settings</strong> that apply to all drills</div><br>
<div>
<label><input type="radio" name="hints" value="1" checked>Show hints</label>
<label><input type="radio" name="hints" value="fail">Hint on fail</label>
<label><input type="radio" name="hints" value="">No hints</label>
</div><br>
<div name="live_wpm">
<label><input id="live_wpm" type="checkbox" name="live_wpm" value="1">Show Live WPM</label>
</div><br>
<div name="show_timer">
<label><input id="show_timer" type="checkbox" name="show_timer" value="1" checked>Show Timer</label>
</div><br>
<div name="show_stats">
<label><input id="show_stats" type="checkbox" name="show_stats" value="1" checked>Show Stats at End of Exercise</label>
</div><br>
<div name="speed">
<label><input id="wpm" type="number" name="wpm" value="" step="5"> Speed (words per minute)
(or <input type="checkbox" id="cpm" value="1"> x5 chars per minute) </label>
</div><br>
<div name="alt">
<label>Alternate with: <input id="alternate" type="text" name="alternate"></label>
</div>
</div>
<div class="form-section">
<div class="caption">Custom <strong>text</strong></div>
<form class="drill-options" id="custom" action="form.html">
<textarea name="drill"></textarea><br>
<input type="checkbox" name="type" value="shuffled"> Shuffle words.<br>
Or <input type="checkbox" name="shuffleLines" value="shuffled"> shuffle lines.<br>
Repeat <input type="number" name="repeat" min="1" max="100" step="1" value="1"> times.<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Custom <strong>Finger Drills</strong></div>
<form class="drill-options" action="finger-drills.html">
Repeat strokes <input type="text" name="strokes" size="18">
<input type="number" name="iterations" value="20" step="5"> times.<br>
(e.g. "EFPLT/EFPLS/EFPLTS EBGD/EBGZ/EBGDZ": strokes separated by slashes, sets separated by spaces)<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Most used <strong>words</strong> (once, in random order)</div>
<form id="most-used" class="drill-options" action="form.html">
<input type="hidden" name="drill" value="NGSL_all_forms">
<input type="hidden" name="type" value="shuffled">
Drill
<input type="number" name="count" value="100" min="25" max="1000" step="25">
words from the range
<input type="number" name="first" value="0" min="0" max="8400" step="25">
to
<input type="number" name="last" value="100" min="100" max="1000" step="25">
<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption"><strong>Sentences</strong> extracted from <a href="https://www.gutenberg.org/">Project Gutenberg</a></div>
<form class="drill-options" action="short-sentences.html">
<p><b class="red">NEW</b>: top "0" words gives a set of nearly 200k sentences with unrestricted vocabulary.</p>
Drill sentences containing only the top
<input id="gutnum" type="number" name="top" value="0" min="0" max="8000" step="100">
most used words<br>
Drill Length:
<input type="number" name="word_count" value="100" min="50" max="1000" step="50">
words <small>(plus the rest of the last sentence.)</small>
<br>
<script>
document.write('<input type="hidden" name="seed" value="' + Math.random().toString() + '">')
document.getElementById('gutnum').addEventListener('input', function(evt) {
const num = evt.target, form = num.form
form.action = (num.value === '0') ? 'short-sentences.html' : 'gutenberg.html'
})
</script>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Randomly generated <strong>sentences</strong> using words from a <a href="https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists/Contemporary_fiction">Wiktionary top 2000 list</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA 3.0</a>) and sentence data from <a href="https://tatoeba.org">Tatoeba</a> (<a href="https://creativecommons.org/licenses/by/2.0/fr/">CC-BY 2.0 fr</a>)</div>
<form class="drill-options" action="markov.html">
Drill Length:
<input type="number" name="word_count" value="100" min="50" max="1000" step="50">
words <small>(plus the rest of the last sentence.)</small>
<br>
<script>document.write('<input type="hidden" name="seed" value="' + Math.random().toString() + '">')</script>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Emily's Symbol Dictionary (with spacing)</div>
<form class="drill-options" action="emilySymbols.html">
Drill Length:
<input type="number" name="word_count" value="100" min="50" max="1000" step="50">
words <small>(plus the rest of the last sentence.)</small>
<br>
<script>document.write('<input type="hidden" name="seed" value="' + Math.random().toString() + '">')</script>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption"><strong>Quotes</strong> from <a href="https://github.com/Miodec/monkeytype/blob/master/static/quotes/english.json">Monkeytype</a>.</div>
<form class="drill-options" action="monkeytype-quote.html">
Drill length:
<ul>
<li style="list-style:none"><input type="checkbox" name="length" value="short"><label for="length">Short (<100 characters)</label></li>
<li style="list-style:none"><input type="checkbox" name="length" value="medium"><label for="length">Medium (101-300 characters)</label></li>
<li style="list-style:none"><input type="checkbox" name="length" value="long"><label for="length">Long (301-600 characters)</label></li>
<li style="list-style:none"><input type="checkbox" name="length" value="thicc"><label for="length">Thicc (>600 characters)</label></li>
</ul>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Phonetic <strong>words</strong> that use exactly one starting <strong>consonant</strong> key, exactly one <strong>vowel</strong> key and exactly one ending <strong>consonant</strong>.</div>
<form class="drill-options" action="form.html">
<input type="hidden" name="drill" value="singleStrokeCVC">
<input type="hidden" name="type" value="randomly">
Drill Time:
<input type="number" name="timeLimit" value="3" min="1" max="60" size="3">
minutes.
<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption"><strong>Numbers</strong> 1-99 in simple sentences</div>
<form class="drill-options" action="form.html">
<input type="hidden" name="drill" value="NumberSentences">
<input type="hidden" name="type" value="randomly">
Drill Time:
<input type="number" name="timeLimit" value="3" min="1" max="60">
minutes.
<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Da Dreaded Dueling Digit Duo <strong>Finger Drills</strong></div>
<form class="drill-options" action="finger-drills.html">
Section <input type="number" name="section" value="1" min="1" max="27"><br>
Alternate <input type="number" name="iterations" value="20" step="5"> times.<br>
<button>Start Drill →</button>
</form>
</div>
<div class="form-section">
<div class="caption">Other drills.</div>
<ul>
<li><a href="two-key.html">Sentences which (mostly) only use two keys at once</a></li>
<li><a href="form.html?drill=shortAndLongA&type=shuffled&select=shuffled&hints=true">Short and Long A words</a></li>
<li><a href="form.html?drill=ST%20words&drill=SH%20words&drill=CH%20words&type=shuffled&hints=true">"st-", "sh-", and "ch-" words</a></li>
<li><a href="form.html?drill=-LD%20words&drill=-LT%20words&drill=-RT%20words&type=shuffled&hints=true">Simple "-ld", "-lt", and "-rt" words</a></li>
<li><a href="form.html?drill=%2bLD%20words&drill=%2bLT%20words&drill=%2bRT%20words&type=shuffled&hints=true">Extended "-ld", "-lt", and "-rt" words</a></li>
<li><a href="form.html?drill=-LD%20words&drill=-LT%20words&drill=-RT%20words&drill=%2bLD%20words&drill=%2bLT%20words&drill=%2bRT%20words&type=shuffled&hints=true">All "-ld", "-lt", and "-rt" words</a></li>
<li><a href="form.html?drill=d-/b-&type=randomly&timeLimit=3">D- and B- words</a></li>
<li><a href="form.html?drill=ite/ight&type=randomly&timeLimit=3">-ite/-ight words</a></li>
<li><a href="form.html?drill=nch&type=randomly&timeLimit=3">"nch" words</a></li>
<li><a href="form.html?drill=-ld/-lt&drill=-nj&type=randomly&timeLimit=5">"-nj" words mixed with "-ld/"/"-lt" ones.</a></li>
</ul>
<p><strong>Note</strong> on Finger Drills. Delete (plover v3) or disable (plover v4) all dictionaries but <code>commands.json</code> (in plover v3, delete all dictionaries and save to get the default config back). In plover v4, check out the plover-dict-control plugin which allows you to define strokes to switch dictionaries.</p>
</div>
</div>
<div id="lesson" class="wrapper" style="display: none">
<div id="leftside">
<h3 id="lesson-name" class="center"></h3>
<div id="drill-content">
<div id="answer"></div>
<div id="exercise"></div>
<div id="results"></div>
</div>
</div>
<textarea id="input"></textarea>
<div id="nav">
<p id="strokes"></p>
<p id="clock" class="clock"></p>
<p id="live-wpm-display" class="wpm"></p>
<p class="center"><a id="again" title="Enter">↺ Restart <span class="shortcutkey">(Enter 3x)</span></a></p>
<p class="center"><a id="back" title="LeftArrow">← Back to Menu <span class="shortcutkey">(LeftArrow)</span></a></p>
</div>
</div>
<script>
function runExercise(fields) {
if(fields.drill === 'NumberSentences') exercise = numberSentences(fields);
else {
if(fields.last) {
fields.choose = fields.count
fields.count = Math.max(+fields.choose, fields.last - fields.first)
}
exercise = wordDrill(fields);
}
if(exercise) {
if(fields.hints) {
var strokes = document.getElementById('strokes');
if(fields.floating_hints) {
strokes.style.position = 'fixed';
}
var translations = TypeJig.shortestTranslations(TypeJig.Translations.Plover);
var hints = new StenoDisplay(strokes, translations, true);
}
var options = fields;
displayOnly('lesson');
return setExercise(exercise.name, exercise, hints, options);
}
}
function getSettings(evt) {
const hintButtons = document.getElementsByName('hints')
for(var radio of hintButtons) {
if(radio.checked) {
hiddenField(this, 'hints', radio.value)
break
}
}
var live_wpm = document.getElementById('live_wpm')
if(live_wpm.checked) hiddenField(this, 'live_wpm', live_wpm.value)
var show_timer = document.getElementById('show_timer')
hiddenField(this, 'show_timer', show_timer.checked ? show_timer.value : 'no')
var wpm = document.getElementById('wpm')
var cpm = document.getElementById('cpm')
if(cpm.checked) hiddenField(this, 'cpm', 5*wpm.value)
else hiddenField(this, 'wpm', wpm.value);
var alternate = document.getElementById('alternate')
hiddenField(this, 'alternate', alternate.value)
}
function runCustom(evt) {
evt.preventDefault();
getSettings.call(this);
var fields = getFormFields(this);
if(storageAvailable('localStorage')) {
localStorage.custom = fields.drill
}
if(fields.shuffleLines) {
// Don't shuffle words.
delete(fields.type);
// Pre-shuffle lines.
fields.drill = shuffle(fields.drill.trim().split(/\n+/m)).join(' ');
}
let drill = fields.drill.trim().split(/\s+/m);
let n = +fields.repeat || 1;
TypeJig.WordSets.custom = [];
for(let i=0; i<n; ++i) TypeJig.WordSets.custom.push(...drill);
fields.drill = 'custom';
var jig = runExercise(fields);
}
window.onload = function() {
if(document.location.search !== '') {
runExercise(parseQueryString(document.location.search));
} else {
// Add event listeners to get settings before submitting.
var forms = document.querySelectorAll('form');
for(var i=0; i<forms.length; ++i) {
var form = forms[i]
if(form.id === 'custom') {
form.addEventListener('submit', runCustom);
} else {
if(form.elements.count && form.elements.last) {
const elts = form.elements
const setLast = function() {
const min = 1*elts.first.value + 1*elts.count.value
elts.last.value = Math.max(elts.last.value, min)
elts.last.min = min
}
elts.count.addEventListener('change', setLast)
elts.first.addEventListener('change', setLast)
elts.last.addEventListener('change', setLast)
}
form.addEventListener('submit', getSettings);
}
}
}
}
loadSettings()
if(storageAvailable('localStorage') && localStorage.custom != null) {
let custom = document.getElementById('custom')
custom.elements.drill.value = localStorage.custom
}
</script>
</body>
</html>