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 pathtimedclickable.js
More file actions
54 lines (47 loc) · 1.44 KB
/
timedclickable.js
File metadata and controls
54 lines (47 loc) · 1.44 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 ClickableArea from "./clickable.js";
("use strict");
export default class TimedClickableArea extends ClickableArea {
constructor(opts) {
super(opts);
this.restoreAnswers({});
this.renderTimedIcon(this.containerDiv);
this.hideButtons();
}
hideButtons() {
$(this.submitButton).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)
if (this.correctNum === 0 && this.incorrectNum === 0) {
this.correct = null;
}
switch (this.correct) {
case true:
return "T";
case false:
return "F";
default:
return null;
}
}
hideFeedback() {
$(this.feedBackDiv).hide();
}
}
if (typeof window.component_factory === "undefined") {
window.component_factory = {};
}
window.component_factory.clickablearea = function (opts) {
if (opts.timed) {
return new TimedClickableArea(opts);
}
return new ClickableArea(opts);
};