aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-18 20:07:03 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-18 20:07:08 +0200
commitfea11d24bc7b93ef516fa52a04e32b5ae5e419de (patch)
tree8cc9ef68ffc9ed17cb950cab09542702bd3f6178 /js
parenta4b09aecda8f70837c44a18c846ab892a2c0800c (diff)
downloadfreenode-live-2017-presentation-fea11d24bc7b93ef516fa52a04e32b5ae5e419de.tar
freenode-live-2017-presentation-fea11d24bc7b93ef516fa52a04e32b5ae5e419de.tar.gz
add config option for postMessage features
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 81cbd16..a575956 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -89,6 +89,9 @@ var Reveal = (function(){
// Opens links in an iframe preview overlay
previewLinks: false,
+ // Flags if we should listen to and dispatch events through window.postMessage
+ postMessage: true,
+
// Focuses body when page changes visiblity to ensure keyboard shortcuts work
focusBodyOnPageVisiblityChange: true,
@@ -565,14 +568,16 @@ var Reveal = (function(){
*/
function setupPostMessage() {
- window.addEventListener( 'message', function ( event ) {
- var data = JSON.parse( event.data );
- var method = Reveal[data.method];
+ if( config.postMessage ) {
+ window.addEventListener( 'message', function ( event ) {
+ var data = JSON.parse( event.data );
+ var method = Reveal[data.method];
- if( typeof method === 'function' ) {
- method.apply( Reveal, data.args );
- }
- }, false );
+ if( typeof method === 'function' ) {
+ method.apply( Reveal, data.args );
+ }
+ }, false );
+ }
}
@@ -967,7 +972,7 @@ var Reveal = (function(){
// If we're in an iframe, post each reveal.js event to the
// parent window. Used by the notes plugin
- if( window.parent !== window.self ) {
+ if( config.postMessage && window.parent !== window.self ) {
// Remove arguments that can't be stringified (circular structures)
if( args && args.currentSlide ) delete args.currentSlide;
if( args && args.previousSlide ) delete args.previousSlide;