aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authoruriel <aa@bb.cc>2013-10-31 00:49:07 +0200
committeruriel <aa@bb.cc>2013-10-31 00:49:07 +0200
commitdda885b71abcf0ecc753bcda3e639f6aea352632 (patch)
tree2d68945c5c9a8facaaad184bfe86333a185254dd /js
parent7b63cda19d0811073a6246d4d36ea7438fed6bce (diff)
downloadfosdem-2018-presentation-dda885b71abcf0ecc753bcda3e639f6aea352632.tar
fosdem-2018-presentation-dda885b71abcf0ecc753bcda3e639f6aea352632.tar.gz
move the slide-number out of the controls to a proper position and little fix to the updating event.
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js60
1 files changed, 27 insertions, 33 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 9718aef..136dc93 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -350,8 +350,10 @@ var Reveal = (function(){
'<div class="navigate-left"></div>' +
'<div class="navigate-right"></div>' +
'<div class="navigate-up"></div>' +
- '<div class="navigate-down"></div>' +
- '<div class="slide-number"></div>' );
+ '<div class="navigate-down"></div>' );
+
+ // slide number
+ createSingletonNode( dom.wrapper, 'div', 'slide-number', '' );
// State background element [DEPRECATED]
createSingletonNode( dom.wrapper, 'div', 'state-background', null );
@@ -370,7 +372,7 @@ var Reveal = (function(){
dom.controlsPrev = toArray( document.querySelectorAll( '.navigate-prev' ) );
dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) );
- dom.slideNumbers = toArray(document.querySelectorAll( '.slide-number' ));
+ dom.slideNumber = document.querySelector( '.slide-number' );
}
/**
@@ -595,12 +597,6 @@ var Reveal = (function(){
dom.controlsPrev.forEach( function( el ) { el.addEventListener( eventName, onNavigatePrevClicked, false ); } );
dom.controlsNext.forEach( function( el ) { el.addEventListener( eventName, onNavigateNextClicked, false ); } );
} );
-
- if( config.showSlideNumber ) {
- ['ready', 'slidechanged'].forEach( function(eventName) {
- document.addEventListener( eventName, onSlideChanged, false );
- } );
- }
}
/**
@@ -636,12 +632,6 @@ var Reveal = (function(){
dom.controlsPrev.forEach( function( el ) { el.removeEventListener( eventName, onNavigatePrevClicked, false ); } );
dom.controlsNext.forEach( function( el ) { el.removeEventListener( eventName, onNavigateNextClicked, false ); } );
} );
-
- if( config.showSlideNumber ) {
- ['ready', 'slidechanged'].forEach( function(eventName) {
- document.removeEventListener( eventName, onSlideChanged, false );
- } );
- }
}
/**
@@ -1548,6 +1538,7 @@ var Reveal = (function(){
updateControls();
updateProgress();
updateBackground();
+ updateSlideNumber();
// Update the URL hash
writeURL();
@@ -1580,7 +1571,7 @@ var Reveal = (function(){
updateControls();
updateProgress();
updateBackground();
-
+ updateSlideNumber();
}
/**
@@ -1790,6 +1781,26 @@ var Reveal = (function(){
}
/**
+ * Updates the slide number div to reflect the current slide.
+ */
+ function updateSlideNumber() {
+
+ // Update slide number if enabled
+ if( config.showSlideNumber && dom.slideNumber)
+ {
+ var element = dom.slideNumber;
+
+ // change the number of the page using 'indexh - indexv' format
+ var indexString = ( indexh + 1 ).toString();
+ if( indexv > 0 ) {
+ indexString += ' - ' + indexv.toString();
+ }
+
+ element.innerHTML = indexString;
+ }
+ }
+
+ /**
* Updates the state of all control/navigation arrows.
*/
function updateControls() {
@@ -2651,23 +2662,6 @@ var Reveal = (function(){
}
- /**
- * Invoked when slide changed and on the first time slides are ready
- */
- function onSlideChanged( event ) {
- var element = dom.slideNumbers;
-
- // change the number of the page using 'indexh/indexv' format
- var indexString = ( event.indexh + 1 ).toString();
- if( indexv > 0 ) {
- indexString += ' / ' + indexv.toString();
- }
-
- element.forEach( function( elm ) {
- elm.innerHTML = indexString;
- } );
- }
-
// --------------------------------------------------------------------//
// ------------------------------- API --------------------------------//