Merge branch 'refs/heads/fix-fragments-in-speakernotes' into fragments-in-notes-server

Conflicts:
	js/reveal.min.js

Need to generate a new minified version afterwards.
This commit is contained in:
Michael Kühnel 2012-10-24 17:48:50 +02:00
commit 5af915adaf
6 changed files with 50 additions and 88 deletions

View File

@ -132,6 +132,8 @@ Reveal.up();
Reveal.down();
Reveal.prev();
Reveal.next();
Reveal.prevFragment();
Reveal.nextFragment();
Reveal.toggleOverview();
// Retrieves the previous and current slide elements

View File

@ -1316,6 +1316,8 @@ var Reveal = (function(){
down: navigateDown,
prev: navigatePrev,
next: navigateNext,
prevFragment: previousFragment,
nextFragment: nextFragment,
// Deprecated aliases
navigateTo: slide,

79
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -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;

View File

@ -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() {

View File

@ -122,6 +122,17 @@
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>