aboutsummaryrefslogtreecommitdiff
path: root/js/reveal.js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-11-18 09:14:01 -0500
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-11-18 09:14:01 -0500
commit9d0ac527802370597a5f1ab1b3f0dd5b039d33b8 (patch)
treef6ac519353adb35ee529b347db1bc6158fa5f483 /js/reveal.js
parent8550186afce516c4d4eb64103c540edd53a890d3 (diff)
downloadfreenode-live-2017-presentation-9d0ac527802370597a5f1ab1b3f0dd5b039d33b8.tar
freenode-live-2017-presentation-9d0ac527802370597a5f1ab1b3f0dd5b039d33b8.tar.gz
fragment comments, remove debug code
Diffstat (limited to 'js/reveal.js')
-rw-r--r--js/reveal.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js
index dae1c8d..c25daa9 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -2272,8 +2272,13 @@ var Reveal = (function(){
/**
* Navigate to the specified slide fragment.
*
- * @return {Boolean} true if there was a next fragment,
- * false otherwise
+ * @param {Number} index The index of the fragment that
+ * should be shown, 1-based, 0 means all are invisible
+ * @param {Number} offset Integer offset to apply to the
+ * fragment index
+ *
+ * @return {Boolean} true if a change was made in any
+ * fragments visibility as part of this call
*/
function navigateFragment( index, offset ) {
@@ -2282,6 +2287,7 @@ var Reveal = (function(){
var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) );
if( fragments.length ) {
+ // If no index is specified, find the current
if( typeof index !== 'number' ) {
var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop();
@@ -2293,6 +2299,7 @@ var Reveal = (function(){
}
}
+ // If an offset is specified, apply it to the index
if( typeof offset === 'number' ) {
index += offset;
}
@@ -2302,6 +2309,7 @@ var Reveal = (function(){
toArray( fragments ).forEach( function( element, i ) {
+ // Visible fragments
if( i < index ) {
if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element );
element.classList.add( 'visible' );
@@ -2311,6 +2319,7 @@ var Reveal = (function(){
element.classList.add( 'current-fragment' );
}
}
+ // Hidden fragments
else {
if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element );
element.classList.remove( 'visible' );
@@ -2320,13 +2329,11 @@ var Reveal = (function(){
} );
- if( offset < 0 && fragmentsHidden.length ) {
- console.log('hidden');
+ if( fragmentsHidden.length ) {
dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } );
}
- if( offset > 0 && fragmentsShown.length ) {
- console.log('shown');
+ if( fragmentsShown.length ) {
dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } );
}