merge mutiplex fragment fix #395
This commit is contained in:
commit
3999430b81
11
js/reveal.js
11
js/reveal.js
|
@ -2050,6 +2050,17 @@ var Reveal = (function(){
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Returns an index (1-based) of the current fragment
|
||||||
|
getCurrentFragmentIndex : function() {
|
||||||
|
if( currentSlide ) {
|
||||||
|
var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' );
|
||||||
|
|
||||||
|
if( visibleFragments.length ) {
|
||||||
|
return visibleFragments.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Helper method, retrieves query string as a key/value hash
|
// Helper method, retrieves query string as a key/value hash
|
||||||
getQueryHash: function() {
|
getQueryHash: function() {
|
||||||
var query = {};
|
var query = {};
|
||||||
|
|
4
js/reveal.min.js
vendored
4
js/reveal.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -8,6 +8,6 @@
|
||||||
if (data.socketId !== socketId) { return; }
|
if (data.socketId !== socketId) { return; }
|
||||||
if( window.location.host === 'localhost:1947' ) return;
|
if( window.location.host === 'localhost:1947' ) return;
|
||||||
|
|
||||||
Reveal.slide(data.indexh, data.indexv, null, 'remote');
|
Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote');
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|
|
@ -5,28 +5,46 @@
|
||||||
|
|
||||||
var socket = io.connect(multiplex.url);
|
var socket = io.connect(multiplex.url);
|
||||||
|
|
||||||
Reveal.addEventListener( 'slidechanged', function( event ) {
|
var notify = function( slideElement, indexh, indexv, origin ) {
|
||||||
|
if( typeof origin === 'undefined' && origin !== 'remote' ) {
|
||||||
var nextindexh;
|
var nextindexh;
|
||||||
var nextindexv;
|
var nextindexv;
|
||||||
var slideElement = event.currentSlide;
|
|
||||||
|
var fragmentindex = Reveal.getCurrentFragmentIndex();
|
||||||
|
if (typeof fragmentindex == 'undefined') {
|
||||||
|
fragmentindex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
|
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
|
||||||
nextindexh = event.indexh;
|
nextindexh = indexh;
|
||||||
nextindexv = event.indexv + 1;
|
nextindexv = indexv + 1;
|
||||||
} else {
|
} else {
|
||||||
nextindexh = event.indexh + 1;
|
nextindexh = indexh + 1;
|
||||||
nextindexv = 0;
|
nextindexv = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
var slideData = {
|
var slideData = {
|
||||||
indexh : event.indexh,
|
indexh : indexh,
|
||||||
indexv : event.indexv,
|
indexv : indexv,
|
||||||
|
indexf : fragmentindex,
|
||||||
nextindexh : nextindexh,
|
nextindexh : nextindexh,
|
||||||
nextindexv : nextindexv,
|
nextindexv : nextindexv,
|
||||||
secret: multiplex.secret,
|
secret: multiplex.secret,
|
||||||
socketId : multiplex.id
|
socketId : multiplex.id
|
||||||
};
|
};
|
||||||
|
|
||||||
if( typeof event.origin === 'undefined' && event.origin !== 'remote' ) socket.emit('slidechanged', slideData);
|
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 );
|
||||||
}());
|
}());
|
Loading…
Reference in New Issue
Block a user