aboutsummaryrefslogtreecommitdiff
path: root/plugin/notes/notes.html
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-07-26 10:03:59 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-07-26 10:03:59 -0400
commit53f1f110c8066b40c788b59e663d303446e3819d (patch)
tree7e6bed66ea1a11e8ccd13edc6002e2284e973df3 /plugin/notes/notes.html
parent03385d7245f8c0428b5f8d8578022fb3a60fdd12 (diff)
downloadfreenode-live-2017-presentation-53f1f110c8066b40c788b59e663d303446e3819d.tar
freenode-live-2017-presentation-53f1f110c8066b40c788b59e663d303446e3819d.tar.gz
ensure notes window fragment states are mirrored in main window #538
Diffstat (limited to 'plugin/notes/notes.html')
-rw-r--r--plugin/notes/notes.html24
1 files changed, 19 insertions, 5 deletions
diff --git a/plugin/notes/notes.html b/plugin/notes/notes.html
index 9151663..0ef285b 100644
--- a/plugin/notes/notes.html
+++ b/plugin/notes/notes.html
@@ -169,7 +169,8 @@
var notes = document.getElementById( 'notes' ),
currentSlide = document.getElementById( 'current-slide' ),
- nextSlide = document.getElementById( 'next-slide' );
+ nextSlide = document.getElementById( 'next-slide' ),
+ silenced = false;
window.addEventListener( 'message', function( event ) {
var data = JSON.parse( event.data );
@@ -184,10 +185,14 @@
}
}
+ silenced = true;
+
// Update the note slides
currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
+ silenced = false;
+
}, false );
var start = new Date(),
@@ -218,12 +223,21 @@
}, 1000 );
- // Navigate the main window when the notes slide changes
- currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) {
+ // Broadcasts the state of the notes window to synchronize
+ // the main window
+ function synchronizeMainWindow() {
- window.opener.Reveal.slide( event.indexh, event.indexv );
+ if( !silenced ) {
+ var indices = currentSlide.contentWindow.Reveal.getIndices();
+ window.opener.Reveal.slide( indices.h, indices.v, indices.f );
+ }
+
+ }
- } );
+ // Navigate the main window when the notes slide changes
+ currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
+ currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
}
else {