ensure notes window fragment states are mirrored in main window #538
parent
03385d7245
commit
53f1f110c8
|
@ -1898,8 +1898,9 @@ var Reveal = (function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !slide && currentSlide ) {
|
if( !slide && currentSlide ) {
|
||||||
var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' );
|
var hasFragments = currentSlide.querySelectorAll( '.fragment' ).length > 0;
|
||||||
if( visibleFragments.length ) {
|
if( hasFragments ) {
|
||||||
|
var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' );
|
||||||
f = visibleFragments.length;
|
f = visibleFragments.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -169,7 +169,8 @@
|
||||||
|
|
||||||
var notes = document.getElementById( 'notes' ),
|
var notes = document.getElementById( 'notes' ),
|
||||||
currentSlide = document.getElementById( 'current-slide' ),
|
currentSlide = document.getElementById( 'current-slide' ),
|
||||||
nextSlide = document.getElementById( 'next-slide' );
|
nextSlide = document.getElementById( 'next-slide' ),
|
||||||
|
silenced = false;
|
||||||
|
|
||||||
window.addEventListener( 'message', function( event ) {
|
window.addEventListener( 'message', function( event ) {
|
||||||
var data = JSON.parse( event.data );
|
var data = JSON.parse( event.data );
|
||||||
|
@ -184,10 +185,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
silenced = true;
|
||||||
|
|
||||||
// Update the note slides
|
// Update the note slides
|
||||||
currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
|
currentSlide.contentWindow.Reveal.slide( data.indexh, data.indexv, data.indexf );
|
||||||
nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
|
nextSlide.contentWindow.Reveal.slide( data.nextindexh, data.nextindexv );
|
||||||
|
|
||||||
|
silenced = false;
|
||||||
|
|
||||||
}, false );
|
}, false );
|
||||||
|
|
||||||
var start = new Date(),
|
var start = new Date(),
|
||||||
|
@ -218,12 +223,21 @@
|
||||||
|
|
||||||
}, 1000 );
|
}, 1000 );
|
||||||
|
|
||||||
|
// Broadcasts the state of the notes window to synchronize
|
||||||
|
// the main window
|
||||||
|
function synchronizeMainWindow() {
|
||||||
|
|
||||||
|
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
|
// Navigate the main window when the notes slide changes
|
||||||
currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', function( event ) {
|
currentSlide.contentWindow.Reveal.addEventListener( 'slidechanged', synchronizeMainWindow );
|
||||||
|
currentSlide.contentWindow.Reveal.addEventListener( 'fragmentshown', synchronizeMainWindow );
|
||||||
window.opener.Reveal.slide( event.indexh, event.indexv );
|
currentSlide.contentWindow.Reveal.addEventListener( 'fragmenthidden', synchronizeMainWindow );
|
||||||
|
|
||||||
} );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue