** var result = doLMSInitialize();
** if (result != true)
** {
-** // handle error
-** }
+ ** // handle error
+ ** }
**
*******************************************************************************/
if (api == null) {
console.error("Unable to locate the LMS's API Implementation.\nLMSFinish was not successful.");
return "false";
- }
- else {
+ } else {
// call the LMSFinish function that should be implemented by the API
var result = api.LMSFinish("");
if (api == null) {
console.error("Unable to locate the LMS's API Implementation.\nLMSGetValue was not successful.");
return "";
- }
- else {
+ } else {
var value = api.LMSGetValue(name);
var errCode = api.LMSGetLastError().toString();
if (errCode != _NoError) {
var errDescription = api.LMSGetErrorString(errCode);
console.error("LMSGetValue(" + name + ") failed. \n" + errDescription);
return "";
- }
- else {
+ } else {
return value.toString();
}
if (api == null) {
console.error("Unable to locate the LMS's API Implementation.\nLMSSetValue was not successful.");
return;
- }
- else {
+ } else {
var result = api.LMSSetValue(name, value);
if (result.toString() != "true") {
var err = ErrorHandler();
if (api == null) {
console.error("Unable to locate the LMS's API Implementation.\nLMSCommit was not successful.");
return "false";
- }
- else {
+ } else {
var result = api.LMSCommit("");
if (result != "true") {
var err = ErrorHandler();
if (api == null) {
console.error("Unable to locate the LMS's API Implementation.\nLMSIsInitialized() failed.");
return false;
- }
- else {
+ } else {
var value = api.LMSGetValue("cmi.core.student_name");
var errCode = api.LMSGetLastError().toString();
if (errCode == _NotInitialized) {
return false;
- }
- else {
+ } else {
return true;
}
}
try {
while ((win.API == null) && (win.parent != null) && (win.parent != win)) {
findAPITries++;
+ if (win.fluidbook !== undefined || win.parent.fluidbook !== undefined) {
+ console.error('quiz is embeded in a fluidbook -- we do not want quiz interact with fluidbook scorm');
+ return null;
+ }
// Note: 7 is an arbitrary number, but should be more than sufficient
if (findAPITries > 7) {
console.error("Error finding API -- too deeply nested.");
*******************************************************************************/
function getAPI() {
var theAPI = findAPI(window);
- if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) {
+ if ((theAPI == null) && (window.opener != null) && (typeof (window.opener) != "undefined")) {
theAPI = findAPI(window.opener);
}
if (theAPI == null) {
}
return theAPI
}
+
var startTime;
function startTimer() {