-
Notifications
You must be signed in to change notification settings - Fork 12
/
local-snap-ag.html
150 lines (140 loc) · 6.25 KB
/
local-snap-ag.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Snap! Build Your Own Blocks</title>
<!-- Snap JS Files-->
<script src="snap/FileSaver.min.js"></script>
<script src="snap/morphic.js"></script>
<script src="snap/widgets.js"></script>
<script src="snap/blocks.js"></script>
<script src="snap/threads.js"></script>
<script src="snap/objects.js"></script>
<script src="snap/gui.js"></script>
<script src="snap/paint.js"></script>
<script src="snap/lists.js"></script>
<script src="snap/byob.js"></script>
<script src="snap/xml.js"></script>
<script src="snap/store.js"></script>
<script src="snap/locale.js"></script>
<script src="snap/cloud.js"></script>
<script src="snap/sha512.js"></script>
<script src="snap/tables.js"></script>
<!-- AG Snap Modifications -->
<script src="ag-files/snap-edx-overrides.js"></script>
<script src="ag-files/snap-local-cloud.js"></script>
<!-- Autograder custom display -->
<link rel="stylesheet" type="text/css" href="ag-files/AG_status_bar.css" />
<link rel="stylesheet" type="text/css" href="ag-files/hintstyle.css" />
<!-- Autograder + edX Utilties -->
<script src="lib/jschannel.js"></script>
<script src="lib/jquery-1.11.3.min.js"></script>
<script src="lib/underscore-min.js"></script>
<!-- Main autograder components -->
<script src='ag-files/ag-util.js'></script>
<script src='ag-files/spriteEventLog.js'></script>
<script src='ag-files/scriptAnalysis.js'></script>
<script src="ag-files/AGAgent.js"></script>
<script src='ag-files/feedbackLog.js'></script>
<script src="ag-files/AGFormatting.js"></script>
<script src="ag-files/AG_EDX.js"></script>
<!-- Load snap + AG additions, similar to snap.html -->
<script>
//loadTestJS();
var world, world_canvas;
window.onload = function () {
//loadTestJS();
var ide, grade_button;
world_canvas = document.getElementById('world')
world = new WorldMorph(world_canvas);
ide = new IDE_Morph();
// This is a change for snap.html
ide.logoURL = 'snap/snap_logo_sm.png';
ide.openIn(world);
// Start Snap Environment Loop
loop();
// AUTOGRADER ADDITIONS:
// Set Snap! to small stage mode
ide.toggleStageSize(true);
// Initialize AGSB button.
grade_button = document.getElementById("autograding_button");
grade_button.addEventListener('click', button_listener);
world_canvas.addEventListener("mouseup", update_listener);
// Load a remote specified file that contains the AG test
loadTestJS();
};
function loop() {
requestAnimationFrame(loop);
world.doOneCycle();
}
function loadTestJS() {
var query = queryString.parse(location.hash.slice(1)),
problem_js = query.test_file,
tag = document.createElement('script');
if (problem_js) {
tag.src = problem_js;
tag.onload = function () {
// Note modify the global so we can keep file paths the same
// while dev'ing.
starter_path = problem_js.split('/')[0] + '/' + starter_path;
initializeSnapAdditions(world, id);
};
document.head.appendChild(tag);
}
}
</script>
</head>
<body style="margin: 0;">
<canvas id="world" tabindex="1" style="position: absolute;" ></canvas>
<!-- Snap Autograding Button -->
<div id="autograding_bar">
<div tabindex="0" class="onclick-menu" id='onclick-menu' style="display:inline-block">
<span title="Menu">☰</span>
<div class='hover_darken'></div>
<nav id="navigation" class="site-navigation" role="navigation">
<ul id="dropdown-closed" class="bubble">
<li class="menu-item-sub-menu" id="enabled-button">
<a id="undo-button">Revert To Last Attempt</a>
</li>
<li class="menu-item-sub-menu" id="enabled-button">
<a id="revert-button">Revert To Best Attempt</a>
</li>
<li class="menu-item-sub-menu" id="enabled-button">
<a id="reset-button">Reset</a>
</li>
<li class="menu-divider-sub-menu" id='menu-divider'></li>
<li class="menu-item-sub-menu" id='enabled-button' onclick="openPopup();">
<a id="help-button">Help</a>
</li>
</ul>
</nav>
</div>
<div id="autograding_button" style="display:inline-block;">
<span></span>
<div class='hover_darken'></div>
</div>
<div id="numtips" style="display:inline-block"></div>
</div>
<!-- Snap Autograding Menu -->
<!-- Autograding Menu Help Button -->
<div class="overlay is-hidden" id="overlay">
<p class="help-text" id="full-screen-arrow">↘</p>
<p class="help-text" id="full-screen-help">This full-screen button will pop out the Snap! window.</p>
<p class="help-text" id="menu-item-arrow">↗</p>
<p class="help-text" id="menu-item-help">The first two menu items will revert your current Snap! state to one of your previous attempts, depending on whether you wish to revert to your last graded attempt or to your best attempt.</br></br>The 'Reset' button will revert to a blank Snap! project, or to a provided starter file if one is given for this problem.</p>
<p class="help-text" id="ag-button-arrow">↑</p>
<p class="help-text" id="ag-button-help">Clicking this button will grade your current attempt and send the results to edX.</p>
</div>
<div style="display:inline-block" class="view-results"
id="circle" onclick="openResults();">Results
</div>
<div class="overlay is-hidden" id="ag-output">
<div class="popup-content" id="ag-results">
<span class="button-close" onclick="closeResults();" id="popup">X</span>
<div id="toggle-correct-tests"></div>
<p id="comment"></p>
</div>
</div>
</div>
</body>
</html>