Merge branch 'dev' of https://github.com/theone1984/reveal.js into dev
This commit is contained in:
commit
75845a92c3
46
js/reveal.js
46
js/reveal.js
@ -242,6 +242,7 @@ var Reveal = (function(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the dependencies of reveal.js. Dependencies are
|
* Loads the dependencies of reveal.js. Dependencies are
|
||||||
* defined via the configuration option 'dependencies'
|
* defined via the configuration option 'dependencies'
|
||||||
@ -250,9 +251,33 @@ var Reveal = (function(){
|
|||||||
* will load after reveal.js has been started up.
|
* will load after reveal.js has been started up.
|
||||||
*/
|
*/
|
||||||
function load() {
|
function load() {
|
||||||
|
|
||||||
var scripts = [],
|
var scripts = [],
|
||||||
scriptsAsync = [];
|
scriptsAsync = [],
|
||||||
|
scriptsToApply = 0;
|
||||||
|
|
||||||
|
// Called once synchronous scripts finish loading
|
||||||
|
function proceed() {
|
||||||
|
if( scriptsAsync.length ) {
|
||||||
|
// Load asynchronous scripts
|
||||||
|
head.js.apply( null, scriptsAsync );
|
||||||
|
}
|
||||||
|
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadDependency(s) {
|
||||||
|
head.ready( s.src.match( /([\w\d_\-]*)\.?js$|[^\\\/]*$/i )[0], function() {
|
||||||
|
// Extension may contain callback functions
|
||||||
|
if( typeof s.callback === 'function' ) {
|
||||||
|
s.callback.apply(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
scriptsToApply--;
|
||||||
|
if (scriptsToApply === 0) {
|
||||||
|
proceed();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
for( var i = 0, len = config.dependencies.length; i < len; i++ ) {
|
for( var i = 0, len = config.dependencies.length; i < len; i++ ) {
|
||||||
var s = config.dependencies[i];
|
var s = config.dependencies[i];
|
||||||
@ -266,25 +291,12 @@ var Reveal = (function(){
|
|||||||
scripts.push( s.src );
|
scripts.push( s.src );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extension may contain callback functions
|
loadDependency(s);
|
||||||
if( typeof s.callback === 'function' ) {
|
|
||||||
head.ready( s.src.match( /([\w\d_\-]*)\.?js$|[^\\\/]*$/i )[0], s.callback );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Called once synchronous scripts finish loading
|
|
||||||
function proceed() {
|
|
||||||
if( scriptsAsync.length ) {
|
|
||||||
// Load asynchronous scripts
|
|
||||||
head.js.apply( null, scriptsAsync );
|
|
||||||
}
|
|
||||||
|
|
||||||
start();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( scripts.length ) {
|
if( scripts.length ) {
|
||||||
head.ready( proceed );
|
scriptsToApply = scripts.length;
|
||||||
|
|
||||||
// Load synchronous scripts
|
// Load synchronous scripts
|
||||||
head.js.apply( null, scripts );
|
head.js.apply( null, scripts );
|
||||||
|
Loading…
Reference in New Issue
Block a user