aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-06-12 18:15:32 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-06-12 18:15:32 +0200
commitaf61d9d10baee982fe82132acc4cd2dd604a6c61 (patch)
tree68a58d7845137da9a29c2d0e03f3a96dfbfaa39c /js
parent06e76c1be3f17ab2663b1f3587e8418f9d524098 (diff)
downloadfosdem-2018-presentation-af61d9d10baee982fe82132acc4cd2dd604a6c61.tar
fosdem-2018-presentation-af61d9d10baee982fe82132acc4cd2dd604a6c61.tar.gz
rewrite youtube iframe embeds to force ?enablejsapi=1 (fixes #856)
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/js/reveal.js b/js/reveal.js
index c311fb0..f98d511 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1959,6 +1959,8 @@
updateSlideNumber();
updateSlidesVisibility();
+ formatEmbeddedContent();
+
}
/**
@@ -2543,6 +2545,21 @@
}
/**
+ * Enforces origin-specific format rules for embedded content.
+ */
+ function formatEmbeddedContent() {
+
+ // YouTube frames must include "?enablejsapi=1"
+ toArray( dom.slides.querySelectorAll( 'iframe[src*="youtube.com/embed/"]' ) ).forEach( function( el ) {
+ var src = el.getAttribute( 'src' );
+ if( !/enablejsapi\=1/gi.test( src ) ) {
+ el.setAttribute( 'src', src + ( !/\?/.test( src ) ? '?' : '' ) + 'enablejsapi=1' );
+ }
+ });
+
+ }
+
+ /**
* Start playback of any embedded content inside of
* the targeted slide.
*/