use head.js to script load everything, fixes bug with inclusion of notes server js #57

This commit is contained in:
Hakim El Hattab 2012-07-09 20:51:04 -04:00
parent 32f0d328ff
commit e7c5de23d7
2 changed files with 61 additions and 57 deletions

View File

@ -264,12 +264,11 @@ linkify( 'a' );
</div> </div>
<!-- Optional libraries for code syntax highlighting and classList support in IE9 --> <!-- Optional libraries for code syntax highlighting and classList support in IE9 -->
<script src="lib/highlight/highlight.js"></script> <script src="lib/head/head.min.js"></script>
<script src="lib/polyfills/classList.js"></script>
<script src="js/reveal.js"></script>
<script> <script>
// Load the main reveal.js script
head.js( 'js/reveal.js', function() {
// Parse the query string into a key/value object // Parse the query string into a key/value object
var query = {}; var query = {};
@ -312,20 +311,17 @@ linkify( 'a' );
// Transition style // Transition style
transition: query.transition || 'default' // default/cube/page/concave/linear(2d) transition: query.transition || 'default' // default/cube/page/concave/linear(2d)
}); });
} );
// Load third party scripts
head.js( 'lib/highlight/highlight.js', 'lib/polyfills/classList.js', function() {
// Fire off syntax highlighting for potential code samples in the slides // Fire off syntax highlighting for potential code samples in the slides
hljs.initHighlightingOnLoad(); hljs.initHighlightingOnLoad();
} );
// If we're runnning the notes node server we need to include some // If we're runnning the notes server we need to include some additional JS
// additional JS
if( window.location.host === 'localhost:1947' ) { if( window.location.host === 'localhost:1947' ) {
var notes_socket = document.createElement( 'script' ); head.js( 'socket.io/socket.io.js', 'lib/slidenotes/client.js' );
notes_socket.setAttribute( 'src', 'socket.io/socket.io.js' );
document.body.appendChild( notes_socket );
var notes_client = document.createElement( 'script' );
notes_client.setAttribute( 'src', 'lib/slidenotes/client.js' );
document.body.appendChild( notes_client );
} }
</script> </script>

8
lib/head/head.min.js vendored Normal file

File diff suppressed because one or more lines are too long