forked from JasonGross/tester
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-editor.shtml
More file actions
66 lines (64 loc) · 2.36 KB
/
list-editor.shtml
File metadata and controls
66 lines (64 loc) · 2.36 KB
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
<!DOCTYPE HTML>
<html manifest="cache.manifest" lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<!--#include virtual="html/common.html" -->
<script type="text/javascript">
$(function () {
var tests = urlParameters.getURLParameter('testList');
if (tests != '') {
tests = JSON.parse(decodeURIComponent(decodeURIComponent(tests)));
var prompts = '';
var responses = '';
var l = tests.length;
for (var i = 0; i < l; i++) {
prompts += tests[i][0] + "\n";
responses += tests[i][1] + "\n";
}
// set the textareas, chopping off the last \n
$('#prompts').attr('value', prompts.slice(0, prompts.length - 1));
$('#responses').attr('value', responses.slice(0, responses.length - 1));
}
$('#submit-button').click(function () {
var prompts = $('#prompts').attr('value').split(/\r\n|\r|\n/);
var responses = $('#responses').attr('value').split(/\r\n|\r|\n/);
var l = Math.max(prompts.length, responses.length);
tests = [];
for (var i = 0; i < l; i++) {
tests[i] = [prompts[i], responses[i]];
}
$('#testList').attr('value', encodeURIComponent(JSON.stringify(tests)));
return true;
});
});
</script>
<title>Vocabulary Tester v<!--#include virtual="VERSION" --></title>
</head>
<body>
<!--#include virtual="html/autoupdate.html" -->
<div class="only-when-cached">
<form action="tester.shtml" method="get">
<input type="hidden" name="testList" id="testList">
<input type="submit" value="Test Me!" id="submit-button">
</form>
<div style="display:table">
<div style="display:table-row">
<div style="display:table-cell">
List of prompts (one per line):
</div>
<div style="display:table-cell">
List of responses (one per line):
</div>
</div>
<div style="display:table-row">
<div style="display:table-cell">
<textarea rows="50" cols="35" id="prompts"></textarea>
</div>
<div style="display:table-cell">
<textarea rows="50" cols="35" id="responses"></textarea>
</div>
</div>
</div>
</div>
</body>
</html>