clean up initialization, conditionally load classList polyfill prior to reveal.js

This commit is contained in:
Hakim El Hattab 2012-07-20 22:41:08 -04:00
parent 0ef90e0dcf
commit c513500269
1 changed files with 9 additions and 10 deletions

View File

@ -251,20 +251,20 @@ function linkify( selector ) {
<a class="down" href="#">&#x25BC;</a> <a class="down" href="#">&#x25BC;</a>
</aside> </aside>
<!-- Displays presentation progress, max value changes via JS to reflect # of slides --> <!-- Presentation progress bar -->
<div class="progress"><span></span></div> <div class="progress"><span></span></div>
</div> </div>
<!-- Optional libraries for code syntax highlighting and classList support in IE9 -->
<script src="lib/js/head.min.js"></script> <script src="lib/js/head.min.js"></script>
<script> <script>
// Load the main reveal.js script // Load reveal.js as well as a classList polyfill if needed
head.js( 'js/reveal.js', function() { head.js( !document.body.classList ? 'lib/js/classList.js' : null )
.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 = {};
location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) { location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) {
query[ a.split( '=' ).shift() ] = a.split( '=' ).pop(); query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
} ); } );
@ -289,13 +289,12 @@ function linkify( selector ) {
theme: query.theme || 'default', // default/neon/beige theme: query.theme || 'default', // default/neon/beige
transition: query.transition || 'default' // default/cube/page/concave/linear(2d) transition: query.transition || 'default' // default/cube/page/concave/linear(2d)
}); });
} ); } );
// Load third party scripts // Load highlight.js for syntax highlighting of code samples
head.js( 'lib/js/classList.js' ); head.js( 'lib/js/highlight.js', function() {
head.js( 'lib/js/highlight.js', function() { hljs.initHighlightingOnLoad();
// Fire off syntax highlighting for potential code samples in the slides
hljs.initHighlightingOnLoad();
} ); } );
// If we're runnning the notes server we need to include some additional JS // If we're runnning the notes server we need to include some additional JS