diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-10-25 09:42:33 -0400 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-10-25 09:42:33 -0400 |
commit | 6794f543e0d8ff589fe5258a6923f1afffc1e0da (patch) | |
tree | 4e01bc032d6959ebb6af9d6ac898dddfe80338e5 | |
parent | 5d1bac5790086cbd28fbcacd8a4cadb6c6e2e403 (diff) | |
parent | b838522be43062bfeca2953506f514f5f88996fc (diff) | |
download | fosdem-2018-presentation-6794f543e0d8ff589fe5258a6923f1afffc1e0da.tar fosdem-2018-presentation-6794f543e0d8ff589fe5258a6923f1afffc1e0da.tar.gz |
merge in support for stepped fragments in notes server
-rw-r--r-- | plugin/notes-server/client.js | 23 | ||||
-rw-r--r-- | plugin/notes-server/index.js | 5 | ||||
-rw-r--r-- | plugin/notes-server/notes.html | 25 |
3 files changed, 43 insertions, 10 deletions
diff --git a/plugin/notes-server/client.js b/plugin/notes-server/client.js index d805601..156cb9a 100644 --- a/plugin/notes-server/client.js +++ b/plugin/notes-server/client.js @@ -6,8 +6,27 @@ var socketId = Math.random().toString().slice(2); console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId); - window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId) + window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId); + // Fires when a fragment is shown + Reveal.addEventListener( 'fragmentshown', function( event ) { + var fragmentData = { + fragment : 'next', + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when a fragment is hidden + Reveal.addEventListener( 'fragmenthidden', function( event ) { + var fragmentData = { + fragment : 'previous', + socketId : socketId + }; + socket.emit('fragmentchanged', fragmentData); + } ); + + // Fires when slide is changed Reveal.addEventListener( 'slidechanged', function( event ) { var nextindexh; var nextindexv; @@ -35,4 +54,4 @@ socket.emit('slidechanged', slideData); } ); -}());
\ No newline at end of file +}()); diff --git a/plugin/notes-server/index.js b/plugin/notes-server/index.js index 1fe5bab..8643f5d 100644 --- a/plugin/notes-server/index.js +++ b/plugin/notes-server/index.js @@ -18,6 +18,9 @@ io.sockets.on('connection', function(socket) { socket.on('slidechanged', function(slideData) { socket.broadcast.emit('slidedata', slideData); }); + socket.on('fragmentchanged', function(fragmentData) { + socket.broadcast.emit('fragmentdata', fragmentData); + }); }); app.configure(function() { @@ -52,4 +55,4 @@ var slidesLocation = "http://localhost" + ( opts.port ? ( ':' + opts.port ) : '' console.log( brown + "reveal.js - Speaker Notes" + reset ); console.log( "1. Open the slides at " + green + slidesLocation + reset ); console.log( "2. Click on the link your JS console to go to the notes page" ); -console.log( "3. Advance through your slides and your notes will advance automatically" );
\ No newline at end of file +console.log( "3. Advance through your slides and your notes will advance automatically" ); diff --git a/plugin/notes-server/notes.html b/plugin/notes-server/notes.html index 548bc12..d71d7f8 100644 --- a/plugin/notes-server/notes.html +++ b/plugin/notes-server/notes.html @@ -112,17 +112,28 @@ // ignore data from sockets that aren't ours if (data.socketId !== socketId) { return; } - if (data.markdown) { - notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes); - } - else { - notes.innerHTML = data.notes; - } + if (data.markdown) { + notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes); + } + else { + notes.innerHTML = data.notes; + } currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv); nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv); }); + socket.on('fragmentdata', function(data) { + // ignore data from sockets that aren't ours + if (data.socketId !== socketId) { return; } + + if (data.fragment === 'next') { + currentSlide.contentWindow.Reveal.nextFragment(); + } + else if (data.fragment === 'previous') { + currentSlide.contentWindow.Reveal.prevFragment(); + } + }); </script> </body> -</html>
\ No newline at end of file +</html> |