merge in support for stepped fragments in notes server
This commit is contained in:
commit
6794f543e0
3 changed files with 43 additions and 10 deletions
|
@ -6,8 +6,27 @@
|
||||||
var socketId = Math.random().toString().slice(2);
|
var socketId = Math.random().toString().slice(2);
|
||||||
|
|
||||||
console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId);
|
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 ) {
|
Reveal.addEventListener( 'slidechanged', function( event ) {
|
||||||
var nextindexh;
|
var nextindexh;
|
||||||
var nextindexv;
|
var nextindexv;
|
||||||
|
|
|
@ -18,6 +18,9 @@ io.sockets.on('connection', function(socket) {
|
||||||
socket.on('slidechanged', function(slideData) {
|
socket.on('slidechanged', function(slideData) {
|
||||||
socket.broadcast.emit('slidedata', slideData);
|
socket.broadcast.emit('slidedata', slideData);
|
||||||
});
|
});
|
||||||
|
socket.on('fragmentchanged', function(fragmentData) {
|
||||||
|
socket.broadcast.emit('fragmentdata', fragmentData);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.configure(function() {
|
app.configure(function() {
|
||||||
|
|
|
@ -112,16 +112,27 @@
|
||||||
// ignore data from sockets that aren't ours
|
// ignore data from sockets that aren't ours
|
||||||
if (data.socketId !== socketId) { return; }
|
if (data.socketId !== socketId) { return; }
|
||||||
|
|
||||||
if (data.markdown) {
|
if (data.markdown) {
|
||||||
notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes);
|
notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
notes.innerHTML = data.notes;
|
notes.innerHTML = data.notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv);
|
currentSlide.contentWindow.Reveal.slide(data.indexh, data.indexv);
|
||||||
nextSlide.contentWindow.Reveal.slide(data.nextindexh, data.nextindexv);
|
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>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue