-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
deploy: 912c7df
- Loading branch information
1 parent
bfa6893
commit 6d4ed0a
Showing
372 changed files
with
1,986 additions
and
1,832 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SCORM API Wrapper | ||
var findAPITries = 0; | ||
var API = null; | ||
|
||
function findAPI(win) { | ||
while ((win.API == null) && (win.parent != null) && (win.parent != win)) { | ||
findAPITries++; | ||
if (findAPITries > 7) { | ||
return null; | ||
} | ||
win = win.parent; | ||
} | ||
return win.API; | ||
} | ||
|
||
function getAPI() { | ||
var theAPI = findAPI(window); | ||
if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) { | ||
theAPI = findAPI(window.opener); | ||
} | ||
if (theAPI == null) { | ||
alert("Unable to find an API adapter"); | ||
} | ||
return theAPI; | ||
} | ||
|
||
function initializeAPI() { | ||
API = getAPI(); | ||
if (API != null) { | ||
API.LMSInitialize(""); | ||
} | ||
} | ||
|
||
function terminateAPI() { | ||
if (API != null) { | ||
API.LMSFinish(""); | ||
} | ||
} | ||
|
||
function setProgress(progress) { | ||
if (API != null) { | ||
API.LMSSetValue("cmi.core.lesson_status", progress); | ||
API.LMSCommit(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// SCORM API Wrapper | ||
var findAPITries = 0; | ||
var API = null; | ||
|
||
function findAPI(win) { | ||
while ((win.API == null) && (win.parent != null) && (win.parent != win)) { | ||
findAPITries++; | ||
if (findAPITries > 7) { | ||
return null; | ||
} | ||
win = win.parent; | ||
} | ||
return win.API; | ||
} | ||
|
||
function getAPI() { | ||
var theAPI = findAPI(window); | ||
if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) { | ||
theAPI = findAPI(window.opener); | ||
} | ||
if (theAPI == null) { | ||
alert("Unable to find an API adapter"); | ||
} | ||
return theAPI; | ||
} | ||
|
||
function initializeAPI() { | ||
API = getAPI(); | ||
if (API != null) { | ||
API.LMSInitialize(""); | ||
} | ||
} | ||
|
||
function terminateAPI() { | ||
if (API != null) { | ||
API.LMSFinish(""); | ||
} | ||
} | ||
|
||
function setProgress(progress) { | ||
if (API != null) { | ||
API.LMSSetValue("cmi.core.lesson_status", progress); | ||
API.LMSCommit(""); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.