aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2016-07-04 13:32:03 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2016-07-04 13:32:03 +0200
commitab2bb869a30cc10b2e4c064fd26c3790670b0c22 (patch)
treea4f198ef06f6f57e184a8847bbc671de41429a50 /js
parent6447b59ac51c3f399ae061ecb4e9275fc165f967 (diff)
downloadperl-software-in-gnu-guix-ab2bb869a30cc10b2e4c064fd26c3790670b0c22.tar
perl-software-in-gnu-guix-ab2bb869a30cc10b2e4c064fd26c3790670b0c22.tar.gz
null check to avoid occasional npe
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/js/reveal.js b/js/reveal.js
index c37566a..473a616 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -3090,17 +3090,21 @@
var iframe = event.target;
- // YouTube postMessage API
- if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) {
- iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' );
- }
- // Vimeo postMessage API
- else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) {
- iframe.contentWindow.postMessage( '{"method":"play"}', '*' );
- }
- // Generic postMessage API
- else {
- iframe.contentWindow.postMessage( 'slide:start', '*' );
+ if( iframe && iframe.contentWindow ) {
+
+ // YouTube postMessage API
+ if( /youtube\.com\/embed\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) {
+ iframe.contentWindow.postMessage( '{"event":"command","func":"playVideo","args":""}', '*' );
+ }
+ // Vimeo postMessage API
+ else if( /player\.vimeo\.com\//.test( iframe.getAttribute( 'src' ) ) && iframe.hasAttribute( 'data-autoplay' ) ) {
+ iframe.contentWindow.postMessage( '{"method":"play"}', '*' );
+ }
+ // Generic postMessage API
+ else {
+ iframe.contentWindow.postMessage( 'slide:start', '*' );
+ }
+
}
}