diff options
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/js/reveal.js b/js/reveal.js index c80eee4..cc93aa8 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -12,7 +12,7 @@ var Reveal = (function(){ var SLIDES_SELECTOR = '.reveal .slides section', HORIZONTAL_SLIDES_SELECTOR = '.reveal .slides>section', VERTICAL_SLIDES_SELECTOR = '.reveal .slides>section.present>section', - HOME_SLIDE_SELECTOR = '.reveal .slides>section:first-child', + HOME_SLIDE_SELECTOR = '.reveal .slides>section:first-of-type', // Configurations defaults, can be overridden at initialization time config = { @@ -191,9 +191,15 @@ var Reveal = (function(){ // Force a layout when the whole page, incl fonts, has loaded window.addEventListener( 'load', layout, false ); + var query = Reveal.getQueryHash(); + + // Do not accept new dependencies via query config to avoid + // the potential of malicious script injection + if( typeof query['dependencies'] !== 'undefined' ) delete query['dependencies']; + // Copy options over to our config object extend( config, options ); - extend( config, Reveal.getQueryHash() ); + extend( config, query ); // Hide the address bar in mobile browsers hideAddressBar(); @@ -2011,10 +2017,15 @@ var Reveal = (function(){ } } ); + // iframe embeds + toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) { + el.contentWindow.postMessage( 'slide:start', '*' ); + }); + // YouTube embeds toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { if( el.hasAttribute( 'data-autoplay' ) ) { - el.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); + el.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' ); } }); } @@ -2035,10 +2046,15 @@ var Reveal = (function(){ } } ); + // iframe embeds + toArray( slide.querySelectorAll( 'iframe' ) ).forEach( function( el ) { + el.contentWindow.postMessage( 'slide:stop', '*' ); + }); + // YouTube embeds toArray( slide.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) { if( !el.hasAttribute( 'data-ignore' ) && typeof el.contentWindow.postMessage === 'function' ) { - el.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); + el.contentWindow.postMessage( '{"event":"command","func":"pauseVideo","args":""}', '*' ); } }); } |