-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
worksheet theme waits for document ready before init
The base start-exam.js used to use jQuery's load function to wait for the document to be loaded before doing the init stuff. The worksheet theme didn't do anything, so there could be a timing problem if the code ran before the page had finished loading. This adds a function Numbas.util.document_ready, which uses the native document.readyState property to wait until the page has finished loading, and changes both versions of start-exam.js to use it.
- Loading branch information
1 parent
524661e
commit e35aadb
Showing
3 changed files
with
45 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
// 'base' gives the third-party libraries on which Numbas depends | ||
Numbas.queueScript('base',['jquery','localisation','seedrandom','knockout','sarissa'],function() { | ||
}); | ||
|
||
|
||
Numbas.queueScript('start-exam',['base','exam','settings'],function() { | ||
for(var name in Numbas.custom_part_types) { | ||
Numbas.partConstructors[name] = Numbas.parts.CustomPart; | ||
}; | ||
|
||
Numbas.init = function() { | ||
for(var x in Numbas.extensions) { | ||
Numbas.activateExtension(x); | ||
} | ||
var job = Numbas.schedule.add; | ||
|
||
job(Numbas.xml.loadXMLDocs); //load in all the XML and XSLT files | ||
|
||
job(function() { | ||
var store = Numbas.store = new Numbas.storage.scorm.SCORMStorage(); //The storage object manages communication between the LMS and the exam | ||
Numbas.display.init(); | ||
}); | ||
}; | ||
}); | ||
|
||
// 'base' gives the third-party libraries on which Numbas depends | ||
Numbas.queueScript('base',['jquery','localisation','seedrandom','knockout','sarissa'],function() { | ||
}); | ||
|
||
|
||
Numbas.queueScript('start-exam',['base','exam','settings'],function() { | ||
for(var name in Numbas.custom_part_types) { | ||
Numbas.partConstructors[name] = Numbas.parts.CustomPart; | ||
}; | ||
|
||
Numbas.init = function() { | ||
Numbas.util.document_ready(function() { | ||
for(var x in Numbas.extensions) { | ||
Numbas.activateExtension(x); | ||
} | ||
var job = Numbas.schedule.add; | ||
|
||
job(Numbas.xml.loadXMLDocs); //load in all the XML and XSLT files | ||
|
||
job(function() { | ||
var store = Numbas.store = new Numbas.storage.scorm.SCORMStorage(); //The storage object manages communication between the LMS and the exam | ||
Numbas.display.init(); | ||
}); | ||
}); | ||
}; | ||
}); | ||
|