Hakim El Hattab
12 years ago
2 changed files with 43 additions and 43 deletions
@ -1,35 +1,35 @@ |
|||||
(function() { |
(function() { |
||||
// don't emit events from inside the previews themselves
|
// don't emit events from inside the previews themselves
|
||||
var qs = window.location.href.split('?'); |
var qs = window.location.href.split('?'); |
||||
if (qs.length > 1 && qs[1].match('receiver')) { return; } |
if (qs.length > 1 && qs[1].match('receiver')) { return; } |
||||
|
|
||||
var socket = io.connect(window.location.origin); |
var socket = io.connect(window.location.origin); |
||||
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); |
||||
|
|
||||
Reveal.addEventListener( 'slidechanged', function( event ) { |
Reveal.addEventListener( 'slidechanged', function( event ) { |
||||
var nextindexh; |
var nextindexh; |
||||
var nextindexv; |
var nextindexv; |
||||
var slideElement = event.currentSlide; |
var slideElement = event.currentSlide; |
||||
|
|
||||
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') { |
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') { |
||||
nextindexh = event.indexh; |
nextindexh = event.indexh; |
||||
nextindexv = event.indexv + 1; |
nextindexv = event.indexv + 1; |
||||
} else { |
} else { |
||||
nextindexh = event.indexh + 1; |
nextindexh = event.indexh + 1; |
||||
nextindexv = 0; |
nextindexv = 0; |
||||
} |
} |
||||
|
|
||||
var notes = slideElement.querySelector('aside.notes'); |
var notes = slideElement.querySelector('aside.notes'); |
||||
var slideData = { |
var slideData = { |
||||
notes : notes ? notes.innerHTML : '', |
notes : notes ? notes.innerHTML : '', |
||||
indexh : event.indexh, |
indexh : event.indexh, |
||||
indexv : event.indexv, |
indexv : event.indexv, |
||||
nextindexh : nextindexh, |
nextindexh : nextindexh, |
||||
nextindexv : nextindexv, |
nextindexv : nextindexv, |
||||
socketId : socketId |
socketId : socketId |
||||
}; |
}; |
||||
|
|
||||
socket.emit('slidechanged', slideData); |
socket.emit('slidechanged', slideData); |
||||
} ); |
} ); |
||||
}()); |
}()); |
||||
|
Loading…
Reference in new issue