diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-11-09 11:40:25 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2017-11-09 11:40:25 +0100 |
commit | 3d1d7683b2d68f4df3dfcec2a39055c30a2719a2 (patch) | |
tree | 432e32dc7727445f6b2b238942e29a39c24b52e0 /js | |
parent | 376d140b2a431985c4362de92b69e27d476fec36 (diff) | |
download | fosdem-2018-presentation-3d1d7683b2d68f4df3dfcec2a39055c30a2719a2.tar fosdem-2018-presentation-3d1d7683b2d68f4df3dfcec2a39055c30a2719a2.tar.gz |
reconfiguring no longer unloads iframes on current slide
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/js/reveal.js b/js/reveal.js index d5e684a..641a59a 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1274,6 +1274,8 @@ a[ i ] = b[ i ]; } + return a; + } /** @@ -2509,7 +2511,7 @@ // Start or stop embedded content depending on global config if( config.autoPlayMedia === false ) { - stopEmbeddedContent( currentSlide ); + stopEmbeddedContent( currentSlide, { unloadIframes: false } ); } else { startEmbeddedContent( currentSlide ); @@ -3535,7 +3537,12 @@ * * @param {HTMLElement} element */ - function stopEmbeddedContent( element ) { + function stopEmbeddedContent( element, options ) { + + options = extend( { + // Defaults + unloadIframes: true + }, options || {} ); if( element && element.parentNode ) { // HTML5 media elements @@ -3566,13 +3573,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' ); + } ); + } } } |