This repository was archived by the owner on Jun 7, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 222
Expand file tree
/
Copy pathtimedparsons.js
More file actions
43 lines (41 loc) · 1.27 KB
/
timedparsons.js
File metadata and controls
43 lines (41 loc) · 1.27 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
import Parsons from "./parsons";
export default class TimedParsons extends Parsons {
constructor(opts) {
super(opts);
// todo -- make this configurable
if (opts.timedfeedback) {
this.showfeedback = true;
} else {
this.showfeedback = false;
}
this.grader.showfeedback = this.showfeedback;
this.hideFeedback();
this.renderTimedIcon(this.containerDiv);
$(this.checkButton).hide();
$(this.helpButton).hide();
$(this.resetButton).hide();
}
renderTimedIcon(component) {
// renders the clock icon on timed components. The component parameter
// is the element that the icon should be appended to.
var timeIconDiv = document.createElement("div");
timeIconDiv.className = "timeTip";
timeIconDiv.title = "";
$(component).prepend(timeIconDiv);
}
checkCorrectTimed() {
return this.correct ? "T" : "F";
}
hideFeedback() {
$(this.messageDiv).hide();
}
}
if (typeof window.component_factory === "undefined") {
window.component_factory = {};
}
window.component_factory["parsons"] = function (opts) {
if (opts.timed) {
return new TimedParsons(opts);
}
return new Parsons(opts);
};