diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/markdown/example.html | 97 | ||||
-rw-r--r-- | plugin/markdown/example.md | 29 | ||||
-rw-r--r-- | plugin/notes/notes.html | 32 | ||||
-rw-r--r-- | plugin/notes/notes.js | 4 | ||||
-rw-r--r-- | plugin/zoom-js/zoom.js | 47 |
5 files changed, 171 insertions, 38 deletions
diff --git a/plugin/markdown/example.html b/plugin/markdown/example.html new file mode 100644 index 0000000..b4e7f91 --- /dev/null +++ b/plugin/markdown/example.html @@ -0,0 +1,97 @@ +<!doctype html> +<html lang="en"> + + <head> + <meta charset="utf-8"> + + <title>reveal.js - Markdown Demo</title> + + <link rel="stylesheet" href="../../css/reveal.css"> + <link rel="stylesheet" href="../../css/theme/default.css" id="theme"> + </head> + + <body> + + <div class="reveal"> + + <div class="slides"> + + <!-- Use external markdown resource, and separate slides by three newlines; vertical slides by two newlines --> + <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section> + + <!-- Slides are separated by three dashes (quick 'n dirty regular expression) --> + <section data-markdown data-separator="---"> + <script type="text/template"> + ## Demo 1 + Slide 1 + --- + ## Demo 1 + Slide 2 + --- + ## Demo 1 + Slide 3 + </script> + </section> + + <!-- Slides are separated by newline + three dashes + newline, vertical slides identical but two dashes --> + <section data-markdown data-separator="^\n---\n$" data-vertical="^\n--\n$"> + <script type="text/template"> + ## Demo 2 + Slide 1.1 + + -- + + ## Demo 2 + Slide 1.2 + + --- + + ## Demo 2 + Slide 2 + </script> + </section> + + <!-- No "extra" slides, since there are no separators defined (so they'll become horizontal rulers) --> + <section data-markdown> + <script type="text/template"> + A + + --- + + B + + --- + + C + </script> + </section> + + </div> + </div> + + <script src="../../lib/js/head.min.js"></script> + <script src="../../js/reveal.js"></script> + + <script> + + Reveal.initialize({ + controls: true, + progress: true, + history: true, + center: true, + + theme: Reveal.getQueryHash().theme, + transition: Reveal.getQueryHash().transition || 'default', + + // Optional libraries used to extend on reveal.js + dependencies: [ + { src: '../../lib/js/classList.js', condition: function() { return !document.body.classList; } }, + { src: 'showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: 'markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } } + ] + }); + + </script> + + </body> +</html> diff --git a/plugin/markdown/example.md b/plugin/markdown/example.md new file mode 100644 index 0000000..e988dd9 --- /dev/null +++ b/plugin/markdown/example.md @@ -0,0 +1,29 @@ +# Markdown Demo + + + +## External 1.1 + +Content 1.1 + + +## External 1.2 + +Content 1.2 + + + +## External 2 + +Content 2.1 + + + +## External 3.1 + +Content 3.1 + + +## External 3.2 + +Content 3.2 diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html index af2fbfc..50d172a 100644 --- a/plugin/notes/notes.html +++ b/plugin/notes/notes.html @@ -29,16 +29,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.5); - -moz-transform: scale(0.5); - -ms-transform: scale(0.5); - -o-transform: scale(0.5); - transform: scale(0.5); + -moz-transform: scale(0.5); + -ms-transform: scale(0.5); + -o-transform: scale(0.5); + transform: scale(0.5); } #wrap-next-slide { @@ -55,16 +55,16 @@ border: none; -webkit-transform-origin: 0 0; - -moz-transform-origin: 0 0; - -ms-transform-origin: 0 0; - -o-transform-origin: 0 0; - transform-origin: 0 0; + -moz-transform-origin: 0 0; + -ms-transform-origin: 0 0; + -o-transform-origin: 0 0; + transform-origin: 0 0; -webkit-transform: scale(0.35); - -moz-transform: scale(0.35); - -ms-transform: scale(0.35); - -o-transform: scale(0.35); - transform: scale(0.35); + -moz-transform: scale(0.35); + -ms-transform: scale(0.35); + -o-transform: scale(0.35); + transform: scale(0.35); } .slides { diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 7c83366..63de05a 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -5,7 +5,9 @@ var RevealNotes = (function() { function openNotes() { - var notesPopup = window.open( 'plugin/notes/notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); + var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path + jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path + var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1120,height=850' ); // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { diff --git a/plugin/zoom-js/zoom.js b/plugin/zoom-js/zoom.js index 6b29f56..b67ae16 100644 --- a/plugin/zoom-js/zoom.js +++ b/plugin/zoom-js/zoom.js @@ -1,29 +1,34 @@ // Custom reveal.js integration (function(){ - document.querySelector( '.reveal' ).addEventListener( 'click', function( event ) { - if( event.altKey ) { + var isEnabled = true; + + document.querySelector( '.reveal' ).addEventListener( 'mousedown', function( event ) { + if( event.altKey && isEnabled ) { event.preventDefault(); zoom.to({ element: event.target, pan: false }); } } ); + + Reveal.addEventListener( 'overviewshown', function() { isEnabled = false; } ); + Reveal.addEventListener( 'overviewhidden', function() { isEnabled = true; } ); })(); /*! * zoom.js 0.2 (modified version for use with reveal.js) * http://lab.hakim.se/zoom-js * MIT licensed - * + * * Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se */ var zoom = (function(){ // The current zoom level (scale) var level = 1; - + // The current mouse position, used for panning var mouseX = 0, mouseY = 0; - + // Timeout before pan is activated var panEngageTimeout = -1, panUpdateInterval = -1; @@ -36,7 +41,7 @@ var zoom = (function(){ 'msTransform' in document.body.style || 'OTransform' in document.body.style || 'transform' in document.body.style; - + if( supportsTransforms ) { // The easing that will be applied when we zoom in/out document.body.style.transition = 'transform 0.8s ease'; @@ -45,7 +50,7 @@ var zoom = (function(){ document.body.style.MozTransition = '-moz-transform 0.8s ease'; document.body.style.WebkitTransition = '-webkit-transform 0.8s ease'; } - + // Zoom out if the user hits escape document.addEventListener( 'keyup', function( event ) { if( level !== 1 && event.keyCode === 27 ) { @@ -62,21 +67,21 @@ var zoom = (function(){ }, false ); /** - * Applies the CSS required to zoom in, prioritizes use of CSS3 + * Applies the CSS required to zoom in, prioritizes use of CSS3 * transforms but falls back on zoom for IE. - * - * @param {Number} pageOffsetX - * @param {Number} pageOffsetY - * @param {Number} elementOffsetX - * @param {Number} elementOffsetY - * @param {Number} scale + * + * @param {Number} pageOffsetX + * @param {Number} pageOffsetY + * @param {Number} elementOffsetX + * @param {Number} elementOffsetY + * @param {Number} scale */ function magnify( pageOffsetX, pageOffsetY, elementOffsetX, elementOffsetY, scale ) { if( supportsTransforms ) { var origin = pageOffsetX +'px '+ pageOffsetY +'px', transform = 'translate('+ -elementOffsetX +'px,'+ -elementOffsetY +'px) scale('+ scale +')'; - + document.body.style.transformOrigin = origin; document.body.style.OTransformOrigin = origin; document.body.style.msTransformOrigin = origin; @@ -121,7 +126,7 @@ var zoom = (function(){ } /** - * Pan the document when the mosue cursor approaches the edges + * Pan the document when the mosue cursor approaches the edges * of the window. */ function pan() { @@ -129,7 +134,7 @@ var zoom = (function(){ rangeX = window.innerWidth * range, rangeY = window.innerHeight * range, scrollOffset = getScrollOffset(); - + // Up if( mouseY < rangeY ) { window.scroll( scrollOffset.x, scrollOffset.y - ( 1 - ( mouseY / rangeY ) ) * ( 14 / level ) ); @@ -159,7 +164,7 @@ var zoom = (function(){ return { /** * Zooms in on either a rectangle or HTML element. - * + * * @param {Object} options * - element: HTML element to zoom in on * OR @@ -232,7 +237,7 @@ var zoom = (function(){ if( currentOptions && currentOptions.element ) { scrollOffset.x -= ( window.innerWidth - ( currentOptions.width * currentOptions.scale ) ) / 2; } - + magnify( scrollOffset.x, scrollOffset.y, 0, 0, 1 ); level = 1; @@ -241,11 +246,11 @@ var zoom = (function(){ // Alias magnify: function( options ) { this.to( options ) }, reset: function() { this.out() }, - + zoomLevel: function() { return level; } } - + })(); |