-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathSCORMFunctions.js
More file actions
40 lines (34 loc) · 1.42 KB
/
SCORMFunctions.js
File metadata and controls
40 lines (34 loc) · 1.42 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
// SCORM Functions
function loadPage() {
initializeAPI();
console.log("SCORM API initialized.");
}
function unloadPage() {
terminateAPI();
console.log("SCORM API terminated.");
}
function loadChapter(chapter) {
loadPage();
var completionStatus = API.LMSGetValue("cmi.core.lesson_status");
if (completionStatus === "completed") {
document.getElementById("completion-status").innerText = "This chapter has been completed.";
document.getElementById("complete-button").style.display = "none";
} else {
document.getElementById("completion-status").innerText = "This chapter has not been completed.";
document.getElementById("reset-button").style.display = "none";
}
}
function completeChapter(chapter) {
setProgress("completed");
alert(chapter + " completed! Progress recorded.");
document.getElementById("completion-status").innerText = "This chapter has been completed.";
document.getElementById("complete-button").style.display = "none";
document.getElementById("reset-button").style.display = "block";
}
function resetChapter(chapter) {
setProgress("incomplete");
alert(chapter + " reset to incomplete.");
document.getElementById("completion-status").innerText = "This chapter has not been completed.";
document.getElementById("complete-button").style.display = "block";
document.getElementById("reset-button").style.display = "none";
}