aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-28 12:31:34 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-28 12:31:34 +0200
commitfbf999ec8125980f5dde6c20c056c6ad9cf245a7 (patch)
tree0b7808e3279afab93f1718c1a821f932e94d343b /js
parent1391253cb815e36e6956553791f3a25f74923c95 (diff)
downloadfreenode-live-2017-presentation-fbf999ec8125980f5dde6c20c056c6ad9cf245a7.tar
freenode-live-2017-presentation-fbf999ec8125980f5dde6c20c056c6ad9cf245a7.tar.gz
null check background
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/js/reveal.js b/js/reveal.js
index df1b1f5..aefb514 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2326,29 +2326,31 @@
// Show the corresponding background element
var indices = getIndices( slide );
var background = getSlideBackground( indices.h, indices.v );
- background.style.display = 'block';
+ if( background ) {
+ background.style.display = 'block';
- // If the background contains media, load it
- if( background.hasAttribute( 'data-loaded' ) === false ) {
- background.setAttribute( 'data-loaded', 'true' );
+ // If the background contains media, load it
+ if( background.hasAttribute( 'data-loaded' ) === false ) {
+ background.setAttribute( 'data-loaded', 'true' );
- var backgroundImage = slide.getAttribute( 'data-background-image' ),
- backgroundVideo = slide.getAttribute( 'data-background-video' );
+ var backgroundImage = slide.getAttribute( 'data-background-image' ),
+ backgroundVideo = slide.getAttribute( 'data-background-video' );
- // Images
- if( backgroundImage ) {
- background.style.backgroundImage = 'url('+ backgroundImage +')';
- }
- // Videos
- else if ( backgroundVideo ) {
- var video = document.createElement( 'video' );
+ // Images
+ if( backgroundImage ) {
+ background.style.backgroundImage = 'url('+ backgroundImage +')';
+ }
+ // Videos
+ else if ( backgroundVideo ) {
+ var video = document.createElement( 'video' );
- // Support comma separated lists of video sources
- backgroundVideo.split( ',' ).forEach( function( source ) {
- video.innerHTML += '<source src="'+ source +'">';
- } );
+ // Support comma separated lists of video sources
+ backgroundVideo.split( ',' ).forEach( function( source ) {
+ video.innerHTML += '<source src="'+ source +'">';
+ } );
- background.appendChild( video );
+ background.appendChild( video );
+ }
}
}
@@ -2366,7 +2368,9 @@
// Hide the corresponding background element
var indices = getIndices( slide );
var background = getSlideBackground( indices.h, indices.v );
- background.style.display = 'none';
+ if( background ) {
+ background.style.display = 'none';
+ }
}