Skip to content

Commit 8f11a66

Browse files
committed
find specific API fix
1 parent 71d574f commit 8f11a66

File tree

3 files changed

+39
-36
lines changed

3 files changed

+39
-36
lines changed

QUnit-Tests/js/scorm.bot.min.js

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QUnit-Tests/js/scorm.bot.pack.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QUnit-Tests/js/scorm/SCOBotBase.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,36 +156,6 @@ function SCOBotBase(options) {
156156
return true; // altered Jan 3rd, 2015 - this conflicted with debugging off on setObjective for QUnit test
157157
}
158158

159-
/**
160-
* Find API
161-
* API_1484_11 or API for SCORM 2004 or 1.2
162-
* @param win {object} Window level
163-
*/
164-
function findAPI(win) {
165-
if (settings.preferred_API === "findAPI") {
166-
var attempts = 0, limit = 500;
167-
while ((!win.API && !win.API_1484_11) && (win.parent) && (win.parent !== win) && (attempts <= limit)) {
168-
attempts += 1;
169-
win = win.parent;
170-
}
171-
if (win.API_1484_11) {//SCORM 2004-specific API.
172-
API.version = "2004";
173-
//Set version
174-
API.path = win.API_1484_11;
175-
} else if (win.API) {//SCORM 1.2-specific API
176-
API.version = "1.2";
177-
//Set version
178-
API.path = win.API;
179-
} else {
180-
return false;
181-
}
182-
return true;
183-
} else if (settings.preferred_API === "findSCORM12") {
184-
return findSCORM12(win);
185-
}
186-
return findSCORM2004(win);
187-
}
188-
189159
/**
190160
* Find SCORM 2004
191161
* API_1484_11
@@ -230,6 +200,37 @@ function SCOBotBase(options) {
230200
return true;
231201
}
232202

203+
/**
204+
* Find API
205+
* API_1484_11 or API for SCORM 2004 or 1.2
206+
* @param win {object} Window level
207+
*/
208+
function findAPI(win) {
209+
if (settings.preferred_API === "findAPI") { // search SCORM2004, then 1.2
210+
var attempts = 0, limit = 500;
211+
while ((!win.API && !win.API_1484_11) && (win.parent) && (win.parent !== win) && (attempts <= limit)) {
212+
attempts += 1;
213+
win = win.parent;
214+
}
215+
if (win.API_1484_11) {//SCORM 2004-specific API.
216+
API.version = "2004";
217+
//Set version
218+
API.path = win.API_1484_11;
219+
} else if (win.API) {//SCORM 1.2-specific API
220+
API.version = "1.2";
221+
//Set version
222+
API.path = win.API;
223+
} else {
224+
return false;
225+
}
226+
return true;
227+
}
228+
if (settings.preferred_API === "findSCORM12") { // Specifically 1.2
229+
return findSCORM12(win);
230+
}
231+
return findSCORM2004(win); // 2004
232+
}
233+
233234
// SCORM Time centric to SCORM 2004 and 1.2 Compatibility
234235
/**
235236
* Centiseconds To ISO Duration

0 commit comments

Comments
 (0)