-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.html
More file actions
executable file
·56 lines (53 loc) · 1.79 KB
/
example.html
File metadata and controls
executable file
·56 lines (53 loc) · 1.79 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
<html>
<head>
<title>parsons</title>
<link rel="stylesheet" href="parsons.css"/>
<link href="lib/prettify.css" type="text/css" rel="stylesheet" />
<script src="lib/prettify.js"></script>
</head>
<body>
<div id="sortableTrash" class="sortable-code"></div>
<div id="sortable" class="sortable-code">
</div>
<div style="clear:both;"></div>
<p>
<a href="#" id="newInstanceLink">New instance</a>
<a href="#" id="feedbackLink">Get feedback</a>
</p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>
<script src="lib/underscore-min.js"></script>
<script src="lib/lis.js"></script>
<script src="parsons.js"></script>
<script>
var initial = 'def traverse_in_order(binary_node):\n' +
' if binary_node:\n' +
' foo\n' +
' foo-1\n';
var parson;
function displayErrors(fb) {
if(fb.errors.length > 0) {
alert(fb.errors[0]);
}
}
$(document).ready(function(){
parson = new ParsonsWidget({
'sortableId': 'sortable',
'trashId': 'sortableTrash',
'max_wrong_lines': 1,
'feedback_cb' : displayErrors
});
parson.init(initial);
parson.shuffleLines();
$("#newInstanceLink").click(function(event){
event.preventDefault();
parson.shuffleLines();
});
$("#feedbackLink").click(function(event){
event.preventDefault();
parson.getFeedback();
});
});
</script>
</body>
</html>