broadcasting fragments state in multiplex plugin (#394)

This commit is contained in:
tkaczmarzyk
2013-04-05 20:45:17 +02:00
parent 3040bc2917
commit c12b780736
4 changed files with 69 additions and 24 deletions

View File

@ -645,6 +645,13 @@ var Reveal = (function(){
}
/**
* Returns last element of an array
*/
function lastElem(array) {
return array.slice(-1)[0];
}
/**
* Applies JavaScript-controlled layout rules to the
* presentation.
@ -2045,6 +2052,26 @@ var Reveal = (function(){
return config;
},
// Returns an index (1-based) of the current fragment
getCurrentFragmentIndex : function() {
var visibleFragments;
// vertical slides:
if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
visibleFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
}
// Horizontal slides:
else {
visibleFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
}
if( visibleFragments.length) {
return visibleFragments.length;
} else {
return undefined;
}
},
// Helper method, retrieves query string as a key/value hash
getQueryHash: function() {
var query = {};

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long