aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2012-07-09 20:51:04 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2012-07-09 20:51:04 -0400
commite7c5de23d7dc318babaee0fda69f4246a186f01a (patch)
tree999b0bef7c6f55b89a1a3171b9f33e57e6fc73a4
parent32f0d328ff1e7e7f46b7513798fa67322ed469b5 (diff)
downloadperl-software-in-gnu-guix-e7c5de23d7dc318babaee0fda69f4246a186f01a.tar
perl-software-in-gnu-guix-e7c5de23d7dc318babaee0fda69f4246a186f01a.tar.gz
use head.js to script load everything, fixes bug with inclusion of notes server js #57
-rw-r--r--index.html92
-rw-r--r--lib/head/head.min.js8
2 files changed, 52 insertions, 48 deletions
diff --git a/index.html b/index.html
index 68c5e4f..4441cce 100644
--- a/index.html
+++ b/index.html
@@ -264,68 +264,64 @@ linkify( 'a' );
</div>
<!-- Optional libraries for code syntax highlighting and classList support in IE9 -->
- <script src="lib/highlight/highlight.js"></script>
- <script src="lib/polyfills/classList.js"></script>
-
- <script src="js/reveal.js"></script>
-
+ <script src="lib/head/head.min.js"></script>
+
<script>
- // Parse the query string into a key/value object
- var query = {};
+ // Load the main reveal.js script
+ head.js( 'js/reveal.js', function() {
+ // Parse the query string into a key/value object
+ var query = {};
- location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) {
- query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
- } );
+ location.search.replace( /[A-Z0-9]+?=(\w*)/gi, function(a) {
+ query[ a.split( '=' ).shift() ] = a.split( '=' ).pop();
+ } );
- // Fires when a slide with data-state=customevent is activated
- Reveal.addEventListener( 'customevent', function() {
- alert( '"customevent" has fired' );
- } );
+ // Fires when a slide with data-state=customevent is activated
+ Reveal.addEventListener( 'customevent', function() {
+ alert( '"customevent" has fired' );
+ } );
- // Fires each time a new slide is activated
- Reveal.addEventListener( 'slidechanged', function( event ) {
- // event.previousSlide, event.currentSlide, event.indexh, event.indexv
- } );
+ // Fires each time a new slide is activated
+ Reveal.addEventListener( 'slidechanged', function( event ) {
+ // event.previousSlide, event.currentSlide, event.indexh, event.indexv
+ } );
- Reveal.initialize({
- // Display controls in the bottom right corner
- controls: true,
+ Reveal.initialize({
+ // Display controls in the bottom right corner
+ controls: true,
- // Display a presentation progress bar
- progress: true,
+ // Display a presentation progress bar
+ progress: true,
- // If true; each slide will be pushed to the browser history
- history: true,
+ // If true; each slide will be pushed to the browser history
+ history: true,
- // Loops the presentation, defaults to false
- loop: false,
+ // Loops the presentation, defaults to false
+ loop: false,
- // Flags if mouse wheel navigation should be enabled
- mouseWheel: true,
+ // Flags if mouse wheel navigation should be enabled
+ mouseWheel: true,
- // Apply a 3D roll to links on hover
- rollingLinks: true,
+ // Apply a 3D roll to links on hover
+ rollingLinks: true,
- // UI style
- theme: query.theme || 'default', // default/neon
+ // UI style
+ theme: query.theme || 'default', // default/neon
- // Transition style
- transition: query.transition || 'default' // default/cube/page/concave/linear(2d)
- });
-
- // Fire off syntax highlighting for potential code samples in the slides
- hljs.initHighlightingOnLoad();
+ // Transition style
+ 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
+ hljs.initHighlightingOnLoad();
+ } );
- // If we're runnning the notes node server we need to include some
- // additional JS
+ // If we're runnning the notes server we need to include some additional JS
if( window.location.host === 'localhost:1947' ) {
- var notes_socket = document.createElement( 'script' );
- 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 );
+ head.js( 'socket.io/socket.io.js', 'lib/slidenotes/client.js' );
}
</script>
diff --git a/lib/head/head.min.js b/lib/head/head.min.js
new file mode 100644
index 0000000..6242b0f
--- /dev/null
+++ b/lib/head/head.min.js
@@ -0,0 +1,8 @@
+/**
+ Head JS The only script in your <HEAD>
+ Copyright Tero Piirainen (tipiirai)
+ License MIT / http://bit.ly/mit-license
+ Version 0.96
+
+ http://headjs.com
+*/(function(a){function z(){d||(d=!0,s(e,function(a){p(a)}))}function y(c,d){var e=a.createElement("script");e.type="text/"+(c.type||"javascript"),e.src=c.src||c,e.async=!1,e.onreadystatechange=e.onload=function(){var a=e.readyState;!d.done&&(!a||/loaded|complete/.test(a))&&(d.done=!0,d())},(a.body||b).appendChild(e)}function x(a,b){if(a.state==o)return b&&b();if(a.state==n)return k.ready(a.name,b);if(a.state==m)return a.onpreload.push(function(){x(a,b)});a.state=n,y(a.url,function(){a.state=o,b&&b(),s(g[a.name],function(a){p(a)}),u()&&d&&s(g.ALL,function(a){p(a)})})}function w(a,b){a.state===undefined&&(a.state=m,a.onpreload=[],y({src:a.url,type:"cache"},function(){v(a)}))}function v(a){a.state=l,s(a.onpreload,function(a){a.call()})}function u(a){a=a||h;var b;for(var c in a){if(a.hasOwnProperty(c)&&a[c].state!=o)return!1;b=!0}return b}function t(a){return Object.prototype.toString.call(a)=="[object Function]"}function s(a,b){if(!!a){typeof a=="object"&&(a=[].slice.call(a));for(var c=0;c<a.length;c++)b.call(a,a[c],c)}}function r(a){var b;if(typeof a=="object")for(var c in a)a[c]&&(b={name:c,url:a[c]});else b={name:q(a),url:a};var d=h[b.name];if(d&&d.url===b.url)return d;h[b.name]=b;return b}function q(a){var b=a.split("/"),c=b[b.length-1],d=c.indexOf("?");return d!=-1?c.substring(0,d):c}function p(a){a._done||(a(),a._done=1)}var b=a.documentElement,c,d,e=[],f=[],g={},h={},i=a.createElement("script").async===!0||"MozAppearance"in a.documentElement.style||window.opera,j=window.head_conf&&head_conf.head||"head",k=window[j]=window[j]||function(){k.ready.apply(null,arguments)},l=1,m=2,n=3,o=4;i?k.js=function(){var a=arguments,b=a[a.length-1],c={};t(b)||(b=null),s(a,function(d,e){d!=b&&(d=r(d),c[d.name]=d,x(d,b&&e==a.length-2?function(){u(c)&&p(b)}:null))});return k}:k.js=function(){var a=arguments,b=[].slice.call(a,1),d=b[0];if(!c){f.push(function(){k.js.apply(null,a)});return k}d?(s(b,function(a){t(a)||w(r(a))}),x(r(a[0]),t(d)?d:function(){k.js.apply(null,b)})):x(r(a[0]));return k},k.ready=function(b,c){if(b==a){d?p(c):e.push(c);return k}t(b)&&(c=b,b="ALL");if(typeof b!="string"||!t(c))return k;var f=h[b];if(f&&f.state==o||b=="ALL"&&u()&&d){p(c);return k}var i=g[b];i?i.push(c):i=g[b]=[c];return k},k.ready(a,function(){u()&&s(g.ALL,function(a){p(a)}),k.feature&&k.feature("domloaded",!0)});if(window.addEventListener)a.addEventListener("DOMContentLoaded",z,!1),window.addEventListener("load",z,!1);else if(window.attachEvent){a.attachEvent("onreadystatechange",function(){a.readyState==="complete"&&z()});var A=1;try{A=window.frameElement}catch(B){}!A&&b.doScroll&&function(){try{b.doScroll("left"),z()}catch(a){setTimeout(arguments.callee,1);return}}(),window.attachEvent("onload",z)}!a.readyState&&a.addEventListener&&(a.readyState="loading",a.addEventListener("DOMContentLoaded",handler=function(){a.removeEventListener("DOMContentLoaded",handler,!1),a.readyState="complete"},!1)),setTimeout(function(){c=!0,s(f,function(a){a()})},300)})(document) \ No newline at end of file