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 pathtimedfitb.js
More file actions
54 lines (52 loc) · 1.62 KB
/
timedfitb.js
File metadata and controls
54 lines (52 loc) · 1.62 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
import FITB from "./fitb.js";
export default class TimedFITB extends FITB {
constructor(opts) {
super(opts);
this.renderTimedIcon(this.containerDiv);
this.hideButtons();
this.needsReinitialization = true;
}
hideButtons() {
$(this.submitButton).hide();
$(this.compareButton).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() {
// Returns if the question was correct, incorrect, or skipped (return null in the last case)
switch (this.correct) {
case true:
return "T";
case false:
return "F";
default:
return null;
}
}
hideFeedback() {
for (var i = 0; i < this.blankArray.length; i++) {
$(this.blankArray[i]).removeClass("input-validation-error");
}
this.feedBackDiv.style.display = "none";
}
reinitializeListeners() {
for (let blank of this.blankArray) {
$(blank).change(this.recordAnswered.bind(this));
}
}
}
if (typeof window.component_factory === "undefined") {
window.component_factory = {};
}
window.component_factory.fillintheblank = function (opts) {
if (opts.timed) {
return new TimedFITB(opts);
}
return new FITB(opts);
};