|
@@ -5,28 +5,46 @@
|
|
|
|
|
|
var socket = io.connect(multiplex.url);
|
|
|
|
|
|
- Reveal.addEventListener( 'slidechanged', function( event ) {
|
|
|
- var nextindexh;
|
|
|
- var nextindexv;
|
|
|
- var slideElement = event.currentSlide;
|
|
|
-
|
|
|
- if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
|
|
|
- nextindexh = event.indexh;
|
|
|
- nextindexv = event.indexv + 1;
|
|
|
- } else {
|
|
|
- nextindexh = event.indexh + 1;
|
|
|
- nextindexv = 0;
|
|
|
- }
|
|
|
+ var notify = function( slideElement, indexh, indexv, origin ) {
|
|
|
+ if( typeof origin === 'undefined' && origin !== 'remote' ) {
|
|
|
+ var nextindexh;
|
|
|
+ var nextindexv;
|
|
|
+
|
|
|
+ var fragmentindex = Reveal.getCurrentFragmentIndex();
|
|
|
+ if (typeof fragmentindex == 'undefined') {
|
|
|
+ fragmentindex = 0;
|
|
|
+ }
|
|
|
|
|
|
- var slideData = {
|
|
|
- indexh : event.indexh,
|
|
|
- indexv : event.indexv,
|
|
|
- nextindexh : nextindexh,
|
|
|
- nextindexv : nextindexv,
|
|
|
- secret: multiplex.secret,
|
|
|
- socketId : multiplex.id
|
|
|
- };
|
|
|
+ if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
|
|
|
+ nextindexh = indexh;
|
|
|
+ nextindexv = indexv + 1;
|
|
|
+ } else {
|
|
|
+ nextindexh = indexh + 1;
|
|
|
+ nextindexv = 0;
|
|
|
+ }
|
|
|
|
|
|
- if( typeof event.origin === 'undefined' && event.origin !== 'remote' ) socket.emit('slidechanged', slideData);
|
|
|
+ var slideData = {
|
|
|
+ indexh : indexh,
|
|
|
+ indexv : indexv,
|
|
|
+ indexf : fragmentindex,
|
|
|
+ nextindexh : nextindexh,
|
|
|
+ nextindexv : nextindexv,
|
|
|
+ secret: multiplex.secret,
|
|
|
+ socketId : multiplex.id
|
|
|
+ };
|
|
|
+
|
|
|
+ socket.emit('slidechanged', slideData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ Reveal.addEventListener( 'slidechanged', function( event ) {
|
|
|
+ notify( event.currentSlide, event.indexh, event.indexv, event.origin );
|
|
|
} );
|
|
|
-}());
|
|
|
+
|
|
|
+ var fragmentNotify = function( event ) {
|
|
|
+ notify( Reveal.getCurrentSlide(), Reveal.getIndices().h, Reveal.getIndices().v, event.origin );
|
|
|
+ };
|
|
|
+
|
|
|
+ Reveal.addEventListener( 'fragmentshown', fragmentNotify );
|
|
|
+ Reveal.addEventListener( 'fragmenthidden', fragmentNotify );
|
|
|
+}());
|