Skip to content

Commit

Permalink
find specific API fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cybercussion committed Aug 5, 2015
1 parent 71d574f commit 8f11a66
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 36 deletions.
12 changes: 7 additions & 5 deletions QUnit-Tests/js/scorm.bot.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion QUnit-Tests/js/scorm.bot.pack.js

Large diffs are not rendered by default.

61 changes: 31 additions & 30 deletions QUnit-Tests/js/scorm/SCOBotBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,36 +156,6 @@ function SCOBotBase(options) {
return true; // altered Jan 3rd, 2015 - this conflicted with debugging off on setObjective for QUnit test
}

/**
* Find API
* API_1484_11 or API for SCORM 2004 or 1.2
* @param win {object} Window level
*/
function findAPI(win) {
if (settings.preferred_API === "findAPI") {
var attempts = 0, limit = 500;
while ((!win.API && !win.API_1484_11) && (win.parent) && (win.parent !== win) && (attempts <= limit)) {
attempts += 1;
win = win.parent;
}
if (win.API_1484_11) {//SCORM 2004-specific API.
API.version = "2004";
//Set version
API.path = win.API_1484_11;
} else if (win.API) {//SCORM 1.2-specific API
API.version = "1.2";
//Set version
API.path = win.API;
} else {
return false;
}
return true;
} else if (settings.preferred_API === "findSCORM12") {
return findSCORM12(win);
}
return findSCORM2004(win);
}

/**
* Find SCORM 2004
* API_1484_11
Expand Down Expand Up @@ -230,6 +200,37 @@ function SCOBotBase(options) {
return true;
}

/**
* Find API
* API_1484_11 or API for SCORM 2004 or 1.2
* @param win {object} Window level
*/
function findAPI(win) {
if (settings.preferred_API === "findAPI") { // search SCORM2004, then 1.2
var attempts = 0, limit = 500;
while ((!win.API && !win.API_1484_11) && (win.parent) && (win.parent !== win) && (attempts <= limit)) {
attempts += 1;
win = win.parent;
}
if (win.API_1484_11) {//SCORM 2004-specific API.
API.version = "2004";
//Set version
API.path = win.API_1484_11;
} else if (win.API) {//SCORM 1.2-specific API
API.version = "1.2";
//Set version
API.path = win.API;
} else {
return false;
}
return true;
}
if (settings.preferred_API === "findSCORM12") { // Specifically 1.2
return findSCORM12(win);
}
return findSCORM2004(win); // 2004
}

// SCORM Time centric to SCORM 2004 and 1.2 Compatibility
/**
* Centiseconds To ISO Duration
Expand Down

0 comments on commit 8f11a66

Please sign in to comment.