aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-11-26 17:08:43 -0500
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-11-26 17:08:43 -0500
commit75845a92c3a134e79853e00efa66585313c127d4 (patch)
tree35e20d38bb3c22efc47354cb7c4e3238e43253f3 /js
parent544020bb9673bb1f8421a3ae1ead801d6568e6af (diff)
parent08808abf0427245c210b9183fb69fc26bfa262b3 (diff)
downloadfreenode-live-2017-presentation-75845a92c3a134e79853e00efa66585313c127d4.tar
freenode-live-2017-presentation-75845a92c3a134e79853e00efa66585313c127d4.tar.gz
Merge branch 'dev' of https://github.com/theone1984/reveal.js into dev
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js114
1 files changed, 63 insertions, 51 deletions
diff --git a/js/reveal.js b/js/reveal.js
index dc43a40..f077b78 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -242,58 +242,70 @@ var Reveal = (function(){
}
- /**
- * Loads the dependencies of reveal.js. Dependencies are
- * defined via the configuration option 'dependencies'
- * and will be loaded prior to starting/binding reveal.js.
- * Some dependencies may have an 'async' flag, if so they
- * will load after reveal.js has been started up.
- */
- function load() {
-
- var scripts = [],
- scriptsAsync = [];
-
- for( var i = 0, len = config.dependencies.length; i < len; i++ ) {
- var s = config.dependencies[i];
-
- // Load if there's no condition or the condition is truthy
- if( !s.condition || s.condition() ) {
- if( s.async ) {
- scriptsAsync.push( s.src );
- }
- else {
- scripts.push( s.src );
- }
-
- // Extension may contain callback functions
- 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 ) {
- head.ready( proceed );
- // Load synchronous scripts
- head.js.apply( null, scripts );
- }
- else {
- proceed();
- }
-
- }
+ /**
+ * Loads the dependencies of reveal.js. Dependencies are
+ * defined via the configuration option 'dependencies'
+ * and will be loaded prior to starting/binding reveal.js.
+ * Some dependencies may have an 'async' flag, if so they
+ * will load after reveal.js has been started up.
+ */
+ function load() {
+ var scripts = [],
+ 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++ ) {
+ var s = config.dependencies[i];
+
+ // Load if there's no condition or the condition is truthy
+ if( !s.condition || s.condition() ) {
+ if( s.async ) {
+ scriptsAsync.push( s.src );
+ }
+ else {
+ scripts.push( s.src );
+ }
+
+ loadDependency(s);
+ }
+ }
+
+ if( scripts.length ) {
+ scriptsToApply = scripts.length;
+
+ // Load synchronous scripts
+ head.js.apply( null, scripts );
+ }
+ else {
+ proceed();
+ }
+
+ }
/**
* Starts up reveal.js by binding input events and navigating