From: Michael Kühnel Date: Thu, 18 Oct 2012 22:04:40 +0000 (+0200) Subject: Add event listener 'fragmentshown' and 'fragmenthidden' X-Git-Tag: 2.1.0~10^2~1^2~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c46486b3df7db25912bc085c7d84612b0724a7cc;p=reveal.js.git Add event listener 'fragmentshown' and 'fragmenthidden' And emit 'fragmentchanged' with the appropriate fragmentData to show or hide fragments. --- diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js index 43dc126..757e6cd 100644 --- a/plugin/speakernotes/client.js +++ b/plugin/speakernotes/client.js @@ -8,6 +8,25 @@ console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId); + // Fires when a fragment is shown + Reveal.addEventListener( 'fragmentshown', function( event ) { + var fragmentData = { + showFragment : true, + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when a fragment is hidden + Reveal.addEventListener( 'fragmenthidden', function( event ) { + var fragmentData = { + hideFragment : true, + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { var nextindexh; var nextindexv;