Created
September 12, 2024 15:11
-
-
Save marcellamaki/b349270eedea392e3622f9bafed04821 to your computer and use it in GitHub Desktop.
Sample SCORM content
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
/scorm-package | |
/api/ | |
SCORM_API.js. // make sure this file is nested in the folder for this to work! | |
index.html | |
imsmanifest.xml |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<manifest identifier="com.example.scorm1.2.test" | |
version="1.2" | |
xmlns="http://www.imsproject.org/xsd/imscp_rootv1p1p2" | |
xmlns:adlcp="http://www.adlnet.org/xsd/adlcp_rootv1p2" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.imsproject.org/xsd/imscp_rootv1p1p2 | |
http://www.imsglobal.org/xsd/imscp_rootv1p1p2.xsd | |
http://www.adlnet.org/xsd/adlcp_rootv1p2 | |
http://www.adlnet.org/xsd/adlcp_rootv1p2.xsd"> | |
<organizations default="org1"> | |
<organization identifier="org1"> | |
<title>SCORM 1.2 Test Course</title> | |
<item identifier="item1" identifierref="resource1"> | |
<title>SCORM 1.2 Test Module</title> | |
</item> | |
</organization> | |
</organizations> | |
<resources> | |
<resource identifier="resource1" type="webcontent" href="index.html" adlcp:scormtype="sco"> | |
<file href="index.html"/> | |
<file href="api/SCORM_API.js"/> | |
</resource> | |
</resources> | |
</manifest> |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>SCORM 1.2 Test</title> | |
<script src="api/SCORM_API.js"></script> | |
<script> | |
let scorm = null; | |
window.onload = function () { | |
scorm = new ScormAPI(); | |
scorm.initialize(); // Initialize the SCORM API when the page loads | |
}; | |
window.onbeforeunload = function () { | |
scorm.terminate(); // Terminate the SCORM session before the page unloads | |
}; | |
function completeCourse() { | |
scorm.setLessonStatus('completed'); // Mark the course as completed | |
scorm.commit(); // Commit data to the LMS | |
alert('Course Completed!'); | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Welcome to SCORM 1.2 Content</h1> | |
<button onclick="completeCourse()">Complete Course</button> | |
</body> | |
</html> |
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
function ScormAPI() { | |
this.api = null; | |
this.initialize = function () { | |
this.api = this.getAPI(); | |
if (this.api) { | |
return this.api.LMSInitialize(""); | |
} | |
return false; | |
}; | |
this.terminate = function () { | |
if (this.api) { | |
return this.api.LMSFinish(""); | |
} | |
return false; | |
}; | |
this.setLessonStatus = function (status) { | |
if (this.api) { | |
return this.api.LMSSetValue("cmi.core.lesson_status", status); | |
} | |
return false; | |
}; | |
this.commit = function () { | |
if (this.api) { | |
return this.api.LMSCommit(""); | |
} | |
return false; | |
}; | |
this.getAPI = function () { | |
var win = window; | |
while (win.API == null && win.parent != null && win.parent != win) { | |
win = win.parent; | |
} | |
return win.API; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment