Skip to content

Instantly share code, notes, and snippets.

@unger1984
Created August 2, 2018 08:54
Show Gist options
  • Select an option

  • Save unger1984/582e4ad727d71add18e7a305a030bd59 to your computer and use it in GitHub Desktop.

Select an option

Save unger1984/582e4ad727d71add18e7a305a030bd59 to your computer and use it in GitHub Desktop.
SCORM 2004 Player/Wrapper
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var API_1484_11 = {};
(function ($) {
$(document).ready(function () {
setupScormApi()
// TODO Write path to index file
$('#content').attr('src', "LINK_TO_SCORM_INDEX.HTML")
});
function setupScormApi() {
API_1484_11.Initialize = Initialize;
API_1484_11.Commit = Commit;
API_1484_11.Terminate = Terminate;
API_1484_11.GetValue = GetValue;
API_1484_11.SetValue = SetValue;
API_1484_11.GetErrorString = GetErrorString;
API_1484_11.GetDiagnostic = GetDiagnostic;
API_1484_11.GetLastError = GetLastError;
// window.open("1.2_simple/index_lms.html", "popupname","resizable,scrollbars,status");
}
function Initialize(parameter) {
displayLog('Initialize ' + parameter)
return true
};
function Commit(parameter) {
displayLog('Commit ' + parameter)
return true
};
function Terminate(parameter) {
displayLog('Terminate ' + parameter)
return true
}
function GetValue(name) {
displayLog('GetValue ' + name)
return "";
}
function SetValue(name, value) {
displayLog('SetValue ' + name + ' = ' + value)
return true
};
function GetErrorString() {
displayLog('GetErrorString')
return ''
};
function GetDiagnostic() {
displayLog('GetDiagnostic')
return ''
};
function GetLastError() {
displayLog('GetLastError')
return 0
}
function displayLog(textToDisplay) {
var loggerWindow = document.getElementById("logDisplay");
var item = document.createElement("div");
item.innerText = textToDisplay;
loggerWindow.appendChild(item);
var height = $('#logDisplay')[0].scrollHeight;
$('#logDisplay').scrollTop(height);
}
})(jQuery);
</script>
</head>
<body style="display: flex; flex-direction: column; align-items: center; justify-content: center">
<iframe id="content" name="content" style="border: 1px solid blue; flex: 5; align-self: stretch"
frameborder="0"></iframe>
<div id="logDisplay" style="flex: 1; align-self: stretch; border: 1px solid red; padding: 5px; overflow-y: scroll;
overflow-x: hidden;">
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment