diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Gruntfile.js | 2 | ||||
-rw-r--r-- | README.md | 45 | ||||
-rw-r--r-- | bower.json | 4 | ||||
-rw-r--r-- | css/reveal.css | 2 | ||||
-rw-r--r-- | css/reveal.scss | 2 | ||||
-rw-r--r-- | css/theme/beige.css | 3 | ||||
-rw-r--r-- | css/theme/black.css | 3 | ||||
-rw-r--r-- | css/theme/blood.css | 3 | ||||
-rw-r--r-- | css/theme/league.css | 3 | ||||
-rw-r--r-- | css/theme/moon.css | 3 | ||||
-rw-r--r-- | css/theme/night.css | 3 | ||||
-rw-r--r-- | css/theme/serif.css | 3 | ||||
-rw-r--r-- | css/theme/simple.css | 3 | ||||
-rw-r--r-- | css/theme/sky.css | 3 | ||||
-rw-r--r-- | css/theme/solarized.css | 3 | ||||
-rw-r--r-- | css/theme/template/theme.scss | 2 | ||||
-rw-r--r-- | css/theme/white.css | 3 | ||||
-rw-r--r-- | demo.html | 6 | ||||
-rw-r--r-- | js/reveal.js | 219 | ||||
-rw-r--r-- | package.json | 4 | ||||
-rw-r--r-- | plugin/markdown/example.html | 7 | ||||
-rw-r--r-- | plugin/markdown/example.md | 5 | ||||
-rwxr-xr-x | plugin/math/math.js | 8 | ||||
-rw-r--r-- | plugin/multiplex/package.json | 2 | ||||
-rw-r--r-- | plugin/notes/notes.js | 19 | ||||
-rw-r--r-- | plugin/print-pdf/print-pdf.js | 2 | ||||
-rw-r--r-- | plugin/search/search.js | 1 |
28 files changed, 247 insertions, 119 deletions
@@ -8,6 +8,7 @@ out/ log/*.log tmp/** node_modules/ +package-lock.json .sass-cache css/reveal.min.css -js/reveal.min.js
\ No newline at end of file +js/reveal.min.js diff --git a/Gruntfile.js b/Gruntfile.js index c30fd40..b6ef63b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,7 +12,7 @@ module.exports = function(grunt) { banner: '/*!\n' + ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' + - ' * http://lab.hakim.se/reveal-js\n' + + ' * http://revealjs.com\n' + ' * MIT licensed\n' + ' *\n' + ' * Copyright (C) 2017 Hakim El Hattab, http://hakim.se\n' + @@ -1,6 +1,6 @@ # reveal.js [](https://travis-ci.org/hakimel/reveal.js) <a href="https://slides.com?ref=github"><img src="https://s3.amazonaws.com/static.slid.es/images/slides-github-banner-320x40.png?1" alt="Slides" width="160" height="20"></a> -A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/). +A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://revealjs.com/). reveal.js comes with a broad range of features including [nested slides](https://github.com/hakimel/reveal.js#markup), [Markdown contents](https://github.com/hakimel/reveal.js#markdown), [PDF export](https://github.com/hakimel/reveal.js#pdf-export), [speaker notes](https://github.com/hakimel/reveal.js#speaker-notes) and a [JavaScript API](https://github.com/hakimel/reveal.js#api). There's also a fully featured visual editor and platform for sharing reveal.js presentations at [slides.com](https://slides.com?ref=github). @@ -105,7 +105,7 @@ The presentation markup hierarchy needs to be `.reveal > .slides > section` wher ### Markdown -It's possible to write your slides using Markdown. To enable Markdown, add the `data-markdown` attribute to your `<section>` elements and wrap the contents in a `<textarea data-template>` like the example below. +It's possible to write your slides using Markdown. To enable Markdown, add the `data-markdown` attribute to your `<section>` elements and wrap the contents in a `<textarea data-template>` like the example below. You'll also need to add the `plugin/markdown/marked.js` and `plugin/markdown/markdown.js` scripts (in that order) to your HTML file. This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) modified to use [marked](https://github.com/chjj/marked) to support [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown). Sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks). @@ -242,7 +242,7 @@ Reveal.initialize({ // Flags if speaker notes should be visible to all viewers showNotes: false, - // Global override for autolaying embedded media (video/audio/iframe) + // Global override for autoplaying embedded media (video/audio/iframe) // - null: Media will only autoplay if data-autoplay is present // - true: All media will autoplay, regardless of individual setting // - false: No media will autoplay, regardless of individual setting @@ -525,6 +525,37 @@ Reveal.isPaused(); Reveal.isAutoSliding(); ``` +### Custom Key Bindings + +Custom key bindings can be added and removed using the following Javascript API. Custom key bindings will override the default keyboard bindings, but will in turn be overridden by the user defined bindings in the ``keyboard`` config option. + +```javascript +Reveal.addKeyBinding( binding, callback ); +Reveal.removeKeyBinding( keyCode ); +``` + +For example + +```javascript +// The binding parameter provides the following properties +// keyCode: the keycode for binding to the callback +// key: the key label to show in the help overlay +// description: the description of the action to show in the help overlay +Reveal.addKeyBinding( { keyCode: 84, key: 'T', description: 'Start timer' }, function() { + // start timer +} ) + +// The binding parameter can also be a direct keycode without providing the help description +Reveal.addKeyBinding( 82, function() { + // reset timer +} ) +``` + +This allows plugins to add key bindings directly to Reveal so they can + +* make use of Reveal's pre-processing logic for key handling (for example, ignoring key presses when paused); and +* be included in the help overlay (optional) + ### Slide Changed Event A 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes. @@ -646,7 +677,7 @@ Reveal.initialize({ }); ``` -Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://lab.hakim.se/reveal-js/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg¶llaxBackgroundSize=2100px%20900px). +Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://revealjs.com/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg¶llaxBackgroundSize=2100px%20900px). @@ -706,7 +737,7 @@ You can also add relative navigation links, similar to the built in reveal.js co ### Fragments -Fragments are used to highlight individual elements on a slide. Every element with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://lab.hakim.se/reveal-js/#/fragments +Fragments are used to highlight individual elements on a slide. Every element with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://revealjs.com/#/fragments The default fragment style is to start out invisible and fade in. This style can be changed by appending a different class to the fragment: @@ -883,7 +914,7 @@ Reveal.initialize({ ## PDF Export -Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home) and to be serving the presention from a webserver. +Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home) and to be serving the presentation from a webserver. Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300. ### Page size @@ -903,7 +934,7 @@ To enable the PDF print capability in your presentation, the special print style ``` ### Instructions -1. Open your presentation with `print-pdf` included in the query string i.e. http://localhost:8000/?print-pdf. You can test this with [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf). +1. Open your presentation with `print-pdf` included in the query string i.e. http://localhost:8000/?print-pdf. You can test this with [revealjs.com?print-pdf](http://revealjs.com?print-pdf). * If you want to include [speaker notes](#speaker-notes) in your export, you can append `showNotes=true` to the query string: http://localhost:8000/?print-pdf&showNotes=true 1. Open the in-browser print dialog (CTRL/CMD+P). 1. Change the **Destination** setting to **Save as PDF**. @@ -1,11 +1,11 @@ { "name": "reveal.js", - "version": "3.5.0", + "version": "3.6.0", "main": [ "js/reveal.js", "css/reveal.css" ], - "homepage": "http://lab.hakim.se/reveal-js/", + "homepage": "http://revealjs.com", "license": "MIT", "description": "The HTML Presentation Framework", "authors": [ diff --git a/css/reveal.css b/css/reveal.css index 8acd961..3392753 100644 --- a/css/reveal.css +++ b/css/reveal.css @@ -1,6 +1,6 @@ /*! * reveal.js - * http://lab.hakim.se/reveal-js + * http://revealjs.com * MIT licensed * * Copyright (C) 2017 Hakim El Hattab, http://hakim.se diff --git a/css/reveal.scss b/css/reveal.scss index 8f5ac5b..1a87624 100644 --- a/css/reveal.scss +++ b/css/reveal.scss @@ -1,6 +1,6 @@ /*! * reveal.js - * http://lab.hakim.se/reveal-js + * http://revealjs.com * MIT licensed * * Copyright (C) 2017 Hakim El Hattab, http://hakim.se diff --git a/css/theme/beige.css b/css/theme/beige.css index 002ec63..d2d0ca6 100644 --- a/css/theme/beige.css +++ b/css/theme/beige.css @@ -156,7 +156,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/black.css b/css/theme/black.css index 7378b6b..83f6eee 100644 --- a/css/theme/black.css +++ b/css/theme/black.css @@ -152,7 +152,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/blood.css b/css/theme/blood.css index 0b5c26c..30e4b09 100644 --- a/css/theme/blood.css +++ b/css/theme/blood.css @@ -155,7 +155,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/league.css b/css/theme/league.css index be213b6..e35d668 100644 --- a/css/theme/league.css +++ b/css/theme/league.css @@ -158,7 +158,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/moon.css b/css/theme/moon.css index 567078d..c7705d9 100644 --- a/css/theme/moon.css +++ b/css/theme/moon.css @@ -156,7 +156,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/night.css b/css/theme/night.css index 945f980..5aca9c0 100644 --- a/css/theme/night.css +++ b/css/theme/night.css @@ -150,7 +150,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/serif.css b/css/theme/serif.css index 7f4efa4..72298a9 100644 --- a/css/theme/serif.css +++ b/css/theme/serif.css @@ -152,7 +152,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/simple.css b/css/theme/simple.css index 0fcd486..40d1238 100644 --- a/css/theme/simple.css +++ b/css/theme/simple.css @@ -155,7 +155,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/sky.css b/css/theme/sky.css index 1c02f7f..f4b0ad5 100644 --- a/css/theme/sky.css +++ b/css/theme/sky.css @@ -159,7 +159,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/solarized.css b/css/theme/solarized.css index 2bd7051..3affa6e 100644 --- a/css/theme/solarized.css +++ b/css/theme/solarized.css @@ -156,7 +156,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; diff --git a/css/theme/template/theme.scss b/css/theme/template/theme.scss index da37fcb..58dc727 100644 --- a/css/theme/template/theme.scss +++ b/css/theme/template/theme.scss @@ -169,8 +169,10 @@ body { box-shadow: 0px 0px 6px rgba(0,0,0,0.3); } + .reveal code { font-family: monospace; + text-transform: none; } .reveal pre code { diff --git a/css/theme/white.css b/css/theme/white.css index a2b8bb8..edc5a60 100644 --- a/css/theme/white.css +++ b/css/theme/white.css @@ -152,7 +152,8 @@ body { box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.3); } .reveal code { - font-family: monospace; } + font-family: monospace; + text-transform: none; } .reveal pre code { display: block; @@ -44,7 +44,7 @@ <h1>Reveal.js</h1> <h3>The HTML Presentation Framework</h3> <p> - <small>Created by <a href="http://hakim.se">Hakim El Hattab</a> / <a href="http://twitter.com/hakimel">@hakimel</a></small> + <small>Created by <a href="http://hakim.se">Hakim El Hattab</a> and <a href="https://github.com/hakimel/reveal.js/graphs/contributors">contributors</a></small> </p> </section> @@ -83,7 +83,7 @@ <section> <h2>Slides</h2> <p> - Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at <a href="http://slides.com" target="_blank">http://slides.com</a>. + Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at <a href="https://slides.com" target="_blank">https://slides.com</a>. </p> </section> @@ -369,7 +369,7 @@ Reveal.addEventListener( 'customevent', function() { <section style="text-align: left;"> <h1>THE END</h1> <p> - - <a href="http://slides.com">Try the online editor</a> <br> + - <a href="https://slides.com">Try the online editor</a> <br> - <a href="https://github.com/hakimel/reveal.js">Source code & documentation</a> </p> </section> diff --git a/js/reveal.js b/js/reveal.js index 4992a01..e944572 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,6 +1,6 @@ /*! * reveal.js - * http://lab.hakim.se/reveal-js + * http://revealjs.com * MIT licensed * * Copyright (C) 2017 Hakim El Hattab, http://hakim.se @@ -26,7 +26,7 @@ var Reveal; // The reveal.js version - var VERSION = '3.5.0'; + var VERSION = '3.6.0'; var SLIDES_SELECTOR = '.slides section', HORIZONTAL_SLIDES_SELECTOR = '.slides>section', @@ -289,7 +289,10 @@ 'B , .': 'Pause', 'F': 'Fullscreen', 'ESC, O': 'Slide overview' - }; + }, + + // Holds custom key code mappings + registeredKeyBindings = {}; /** * Starts up the presentation if the client is capable. @@ -461,6 +464,8 @@ */ function start() { + loaded = true; + // Make sure we've got all the DOM elements we need setupDOM(); @@ -488,8 +493,6 @@ // Enable transitions now that we're loaded dom.slides.classList.remove( 'no-transition' ); - loaded = true; - dom.wrapper.classList.add( 'ready' ); dispatchEvent( 'ready', { @@ -1014,14 +1017,22 @@ */ function configure( options ) { - var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length; - - dom.wrapper.classList.remove( config.transition ); + var oldTransition = config.transition; // New config options may be passed when this method // is invoked through the API after initialization if( typeof options === 'object' ) extend( config, options ); + // Abort if reveal.js hasn't finished loading, config + // changes will be applied automatically once loading + // finishes + if( loaded === false ) return; + + var numberOfSlides = dom.wrapper.querySelectorAll( SLIDES_SELECTOR ).length; + + // Remove the previously configured transition class + dom.wrapper.classList.remove( oldTransition ); + // Force linear transition based on browser capabilities if( features.transforms3d === false ) config.transition = 'linear'; @@ -1254,6 +1265,38 @@ } /** + * Add a custom key binding with optional description to + * be added to the help screen. + */ + function addKeyBinding( binding, callback ) { + + if( typeof binding === 'object' && binding.keyCode ) { + registeredKeyBindings[binding.keyCode] = { + callback: callback, + key: binding.key, + description: binding.description + }; + } + else { + registeredKeyBindings[binding] = { + callback: callback, + key: null, + description: null + }; + } + + } + + /** + * Removes the specified custom key binding. + */ + function removeKeyBinding( keyCode ) { + + delete registeredKeyBindings[keyCode]; + + } + + /** * Extend object a with the properties of object b. * If there's a conflict, object b takes precedence. * @@ -1266,6 +1309,8 @@ a[ i ] = b[ i ]; } + return a; + } /** @@ -1292,7 +1337,7 @@ if( value === 'null' ) return null; else if( value === 'true' ) return true; else if( value === 'false' ) return false; - else if( value.match( /^[\d\.]+$/ ) ) return parseFloat( value ); + else if( value.match( /^-?[\d\.]+$/ ) ) return parseFloat( value ); } return value; @@ -1738,6 +1783,13 @@ html += '<tr><td>' + key + '</td><td>' + keyboardShortcuts[ key ] + '</td></tr>'; } + // Add custom key bindings that have associated descriptions + for( var binding in registeredKeyBindings ) { + if( registeredKeyBindings[binding].key && registeredKeyBindings[binding].description ) { + html += '<tr><td>' + registeredKeyBindings[binding].key + '</td><td>' + registeredKeyBindings[binding].description + '</td></tr>'; + } + } + html += '</table>'; dom.overlay.innerHTML = [ @@ -2401,16 +2453,7 @@ // Dispatch an event if the slide changed var slideChanged = ( indexh !== indexhBefore || indexv !== indexvBefore ); - if( slideChanged ) { - dispatchEvent( 'slidechanged', { - 'indexh': indexh, - 'indexv': indexv, - 'previousSlide': previousSlide, - 'currentSlide': currentSlide, - 'origin': o - } ); - } - else { + if (!slideChanged) { // Ensure that the previous slide is never the same as the current previousSlide = null; } @@ -2438,6 +2481,16 @@ } } + if( slideChanged ) { + dispatchEvent( 'slidechanged', { + 'indexh': indexh, + 'indexv': indexv, + 'previousSlide': previousSlide, + 'currentSlide': currentSlide, + 'origin': o + } ); + } + // Handle embedded content if( slideChanged || !previousSlide ) { stopEmbeddedContent( previousSlide ); @@ -2501,7 +2554,7 @@ // Start or stop embedded content depending on global config if( config.autoPlayMedia === false ) { - stopEmbeddedContent( currentSlide ); + stopEmbeddedContent( currentSlide, { unloadIframes: false } ); } else { startEmbeddedContent( currentSlide ); @@ -2738,10 +2791,10 @@ // Show the horizontal slide if it's within the view distance if( distanceX < viewDistance ) { - showSlide( horizontalSlide ); + loadSlide( horizontalSlide ); } else { - hideSlide( horizontalSlide ); + unloadSlide( horizontalSlide ); } if( verticalSlidesLength ) { @@ -2754,10 +2807,10 @@ distanceY = x === ( indexh || 0 ) ? Math.abs( ( indexv || 0 ) - y ) : Math.abs( y - oy ); if( distanceX + distanceY < viewDistance ) { - showSlide( verticalSlide ); + loadSlide( verticalSlide ); } else { - hideSlide( verticalSlide ); + unloadSlide( verticalSlide ); } } @@ -3156,14 +3209,9 @@ * * @param {HTMLElement} slide Slide to show */ - /** - * Called when the given slide is within the configured view - * distance. Shows the slide element and loads any content - * that is set to load lazily (data-src). - * - * @param {HTMLElement} slide Slide to show - */ - function showSlide( slide ) { + function loadSlide( slide, options ) { + + options = options || {}; // Show the slide element slide.style.display = config.display; @@ -3195,8 +3243,7 @@ // Show the corresponding background element - var indices = getIndices( slide ); - var background = getSlideBackground( indices.h, indices.v ); + var background = getSlideBackground( slide ); if( background ) { background.style.display = 'block'; @@ -3243,7 +3290,7 @@ background.appendChild( video ); } // Iframes - else if( backgroundIframe ) { + else if( backgroundIframe && options.excludeIframes !== true ) { var iframe = document.createElement( 'iframe' ); iframe.setAttribute( 'allowfullscreen', '' ); iframe.setAttribute( 'mozallowfullscreen', '' ); @@ -3272,19 +3319,18 @@ } /** - * Called when the given slide is moved outside of the - * configured view distance. + * Unloads and hides the given slide. This is called when the + * slide is moved outside of the configured view distance. * * @param {HTMLElement} slide */ - function hideSlide( slide ) { + function unloadSlide( slide ) { // Hide the slide element slide.style.display = 'none'; // Hide the corresponding background element - var indices = getIndices( slide ); - var background = getSlideBackground( indices.h, indices.v ); + var background = getSlideBackground( slide ); if( background ) { background.style.display = 'none'; } @@ -3376,6 +3422,13 @@ _appendParamToIframeSource( 'src', 'player.vimeo.com/', 'api=1' ); _appendParamToIframeSource( 'data-src', 'player.vimeo.com/', 'api=1' ); + // Always show media controls on mobile devices + if( isMobileDevice ) { + toArray( dom.slides.querySelectorAll( 'video, audio' ) ).forEach( function( el ) { + el.controls = true; + } ); + } + } /** @@ -3520,7 +3573,12 @@ * * @param {HTMLElement} element */ - function stopEmbeddedContent( element ) { + function stopEmbeddedContent( element, options ) { + + options = extend( { + // Defaults + unloadIframes: true + }, options || {} ); if( element && element.parentNode ) { // HTML5 media elements @@ -3551,13 +3609,15 @@ } }); - // Lazy loading iframes - toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { - // Only removing the src doesn't actually unload the frame - // in all browsers (Firefox) so we set it to blank first - el.setAttribute( 'src', 'about:blank' ); - el.removeAttribute( 'src' ); - } ); + if( options.unloadIframes === true ) { + // Unload lazy-loaded iframes + toArray( element.querySelectorAll( 'iframe[data-src]' ) ).forEach( function( el ) { + // Only removing the src doesn't actually unload the frame + // in all browsers (Firefox) so we set it to blank first + el.setAttribute( 'src', 'about:blank' ); + el.removeAttribute( 'src' ); + } ); + } } } @@ -3839,31 +3899,19 @@ * defined, have a background element so as long as the * index is valid an element will be returned. * - * @param {number} x Horizontal background index + * @param {mixed} x Horizontal background index OR a slide + * HTML element * @param {number} y Vertical background index * @return {(HTMLElement[]|*)} */ function getSlideBackground( x, y ) { - // When printing to PDF the slide backgrounds are nested - // inside of the slides - if( isPrintingPDF() ) { - var slide = getSlide( x, y ); - if( slide ) { - return slide.slideBackgroundElement; - } - - return undefined; - } - - var horizontalBackground = dom.wrapper.querySelectorAll( '.backgrounds>.slide-background' )[ x ]; - var verticalBackgrounds = horizontalBackground && horizontalBackground.querySelectorAll( '.slide-background' ); - - if( verticalBackgrounds && verticalBackgrounds.length && typeof y === 'number' ) { - return verticalBackgrounds ? verticalBackgrounds[ y ] : undefined; + var slide = typeof x === 'number' ? getSlide( x, y ) : x; + if( slide ) { + return slide.slideBackgroundElement; } - return horizontalBackground; + return undefined; } @@ -4392,7 +4440,7 @@ // If there's a condition specified and it returns false, // ignore this event - if( typeof config.keyboardCondition === 'function' && config.keyboardCondition() === false ) { + if( typeof config.keyboardCondition === 'function' && config.keyboardCondition(event) === false ) { return true; } @@ -4457,7 +4505,31 @@ } - // 2. System defined key bindings + // 2. Registered custom key bindings + if( triggered === false ) { + + for( key in registeredKeyBindings ) { + + // Check if this binding matches the pressed key + if( parseInt( key, 10 ) === event.keyCode ) { + + var action = registeredKeyBindings[ key ].callback; + + // Callback function + if( typeof action === 'function' ) { + action.apply( null, [ event ] ); + } + // String shortcuts to reveal.js API + else if( typeof action === 'string' && typeof Reveal[ action ] === 'function' ) { + Reveal[ action ].call(); + } + + triggered = true; + } + } + } + + // 3. System defined key bindings if( triggered === false ) { // Assume true and try to prove false @@ -5104,6 +5176,11 @@ isOverview: isOverview, isPaused: isPaused, isAutoSliding: isAutoSliding, + isSpeakerNotes: isSpeakerNotes, + + // Slide preloading + loadSlide: loadSlide, + unloadSlide: unloadSlide, // Adds or removes all internal event listeners (such as keyboard) addEventListeners: addEventListeners, @@ -5212,6 +5289,12 @@ } }, + // Adds a custom key binding + addKeyBinding: addKeyBinding, + + // Removes a custom key binding + removeKeyBinding: removeKeyBinding, + // Programatically triggers a keyboard event triggerKey: function( keyCode ) { onDocumentKeyDown( { keyCode: keyCode } ); diff --git a/package.json b/package.json index daa5f1d..614a4e3 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "reveal.js", - "version": "3.5.0", + "version": "3.6.0", "description": "The HTML Presentation Framework", - "homepage": "http://lab.hakim.se/reveal-js", + "homepage": "http://revealjs.com", "subdomain": "revealjs", "main": "js/reveal.js", "scripts": { diff --git a/plugin/markdown/example.html b/plugin/markdown/example.html index 36f6a51..300e39e 100644 --- a/plugin/markdown/example.html +++ b/plugin/markdown/example.html @@ -99,6 +99,13 @@ </script> </section> + <!-- Images --> + <section data-markdown> + <script type="text/template"> +  + </script> + </section> + </div> </div> diff --git a/plugin/markdown/example.md b/plugin/markdown/example.md index 6f6f577..89c7534 100644 --- a/plugin/markdown/example.md +++ b/plugin/markdown/example.md @@ -29,3 +29,8 @@ Content 3.1 ## External 3.2 Content 3.2 + + +## External 3.3 + + diff --git a/plugin/math/math.js b/plugin/math/math.js index e3b4089..7867376 100755 --- a/plugin/math/math.js +++ b/plugin/math/math.js @@ -9,15 +9,15 @@ var RevealMath = window.RevealMath || (function(){ var options = Reveal.getConfig().math || {}; options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js'; options.config = options.config || 'TeX-AMS_HTML-full'; + options.tex2jax = options.tex2jax || { + inlineMath: [['$','$'],['\\(','\\)']] , + skipTags: ['script','noscript','style','textarea','pre'] }; loadScript( options.mathjax + '?config=' + options.config, function() { MathJax.Hub.Config({ messageStyle: 'none', - tex2jax: { - inlineMath: [['$','$'],['\\(','\\)']] , - skipTags: ['script','noscript','style','textarea','pre'] - }, + tex2jax: options.tex2jax, skipStartupTypeset: true }); diff --git a/plugin/multiplex/package.json b/plugin/multiplex/package.json index 368bfd6..bbed77a 100644 --- a/plugin/multiplex/package.json +++ b/plugin/multiplex/package.json @@ -2,7 +2,7 @@ "name": "reveal-js-multiplex", "version": "1.0.0", "description": "reveal.js multiplex server", - "homepage": "http://lab.hakim.se/reveal-js", + "homepage": "http://revealjs.com", "scripts": { "start": "node index.js" }, diff --git a/plugin/notes/notes.js b/plugin/notes/notes.js index 80fb6e2..3f00eb6 100644 --- a/plugin/notes/notes.js +++ b/plugin/notes/notes.js @@ -131,22 +131,9 @@ var RevealNotes = (function() { } // Open the notes when the 's' key is hit - document.addEventListener( 'keydown', function( event ) { - // Disregard the event if the target is editable or a - // modifier is present - if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; - - // Disregard the event if keyboard is disabled - if ( Reveal.getConfig().keyboard === false ) return; - - if( event.keyCode === 83 ) { - event.preventDefault(); - openNotes(); - } - }, false ); - - // Show our keyboard shortcut in the reveal.js help overlay - if( window.Reveal ) Reveal.registerKeyboardShortcut( 'S', 'Speaker notes view' ); + Reveal.addKeyBinding({keyCode: 83, key: 'S', description: 'Speaker notes view'}, function() { + openNotes(); + } ); } diff --git a/plugin/print-pdf/print-pdf.js b/plugin/print-pdf/print-pdf.js index 9ffc261..15ce43e 100644 --- a/plugin/print-pdf/print-pdf.js +++ b/plugin/print-pdf/print-pdf.js @@ -2,7 +2,7 @@ * phantomjs script for printing presentations to PDF. * * Example: - * phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf + * phantomjs print-pdf.js "http://revealjs.com?print-pdf" reveal-demo.pdf * * @author Manuel Bieh (https://github.com/manuelbieh) * @author Hakim El Hattab (https://github.com/hakimel) diff --git a/plugin/search/search.js b/plugin/search/search.js index b0be2be..f7e5c2f 100644 --- a/plugin/search/search.js +++ b/plugin/search/search.js @@ -200,6 +200,7 @@ function Hilitor(id, tag) toggleSearch(); } }, false ); + if( window.Reveal ) Reveal.registerKeyboardShortcut( 'Ctrl-Shift-F', 'Search' ); closeSearch(); return { open: openSearch }; })(); |