comments & typo correction
This commit is contained in:
parent
11ee006f9d
commit
833e298617
1 changed files with 31 additions and 11 deletions
40
js/reveal.js
40
js/reveal.js
|
@ -18,9 +18,11 @@
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*
|
||||||
|
*
|
||||||
/**
|
* #############################################################################
|
||||||
|
*
|
||||||
|
*
|
||||||
* Reveal.js is an easy to use HTML based slideshow enhanced by
|
* Reveal.js is an easy to use HTML based slideshow enhanced by
|
||||||
* sexy CSS 3D transforms.
|
* sexy CSS 3D transforms.
|
||||||
*
|
*
|
||||||
|
@ -62,31 +64,39 @@
|
||||||
* - Presentation overview via keyboard shortcut
|
* - Presentation overview via keyboard shortcut
|
||||||
*
|
*
|
||||||
* @author Hakim El Hattab | http://hakim.se
|
* @author Hakim El Hattab | http://hakim.se
|
||||||
* @version 1.0
|
* @version 1.1
|
||||||
*/
|
*/
|
||||||
var Reveal = (function(){
|
var Reveal = (function(){
|
||||||
|
|
||||||
var HORIZONTAL_SLIDES_SELECTOR = '#main>section',
|
var HORIZONTAL_SLIDES_SELECTOR = '#main>section',
|
||||||
VERTICAL_SLIDES_SELECTOR = 'section.present>section',
|
VERTICAL_SLIDES_SELECTOR = 'section.present>section',
|
||||||
|
|
||||||
|
// The horizontal and verical index of the currently active slide
|
||||||
indexh = 0,
|
indexh = 0,
|
||||||
indexv = 0,
|
indexv = 0,
|
||||||
|
|
||||||
|
// Configurations options, including;
|
||||||
|
// > {Boolean} controls
|
||||||
|
// > {String} theme
|
||||||
|
// > {Boolean} rollingLinks
|
||||||
config = {},
|
config = {},
|
||||||
|
|
||||||
|
// Cached references to DOM elements
|
||||||
dom = {};
|
dom = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates the main program logic.
|
* Starts up the slideshow by applying configuration
|
||||||
|
* options and binding various events.
|
||||||
*/
|
*/
|
||||||
function initialize( options ) {
|
function initialize( options ) {
|
||||||
// Gather references to DOM elements
|
// Cache references to DOM elements
|
||||||
dom.controls = document.querySelector( '.controls' );
|
dom.controls = document.querySelector( '.controls' );
|
||||||
dom.controlsLeft = document.querySelector( '.controls .left' );
|
dom.controlsLeft = document.querySelector( '.controls .left' );
|
||||||
dom.controlsRight = document.querySelector( '.controls .right' );
|
dom.controlsRight = document.querySelector( '.controls .right' );
|
||||||
dom.controlsUp = document.querySelector( '.controls .up' );
|
dom.controlsUp = document.querySelector( '.controls .up' );
|
||||||
dom.controlsDown = document.querySelector( '.controls .down' );
|
dom.controlsDown = document.querySelector( '.controls .down' );
|
||||||
|
|
||||||
// Add event listeners
|
// Bind all view events
|
||||||
document.addEventListener('keydown', onDocumentKeyDown, false);
|
document.addEventListener('keydown', onDocumentKeyDown, false);
|
||||||
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
document.addEventListener('touchstart', onDocumentTouchStart, false);
|
||||||
window.addEventListener('hashchange', onWindowHashChange, false);
|
window.addEventListener('hashchange', onWindowHashChange, false);
|
||||||
|
@ -95,7 +105,7 @@ var Reveal = (function(){
|
||||||
dom.controlsUp.addEventListener('click', preventAndForward( navigateUp ), false);
|
dom.controlsUp.addEventListener('click', preventAndForward( navigateUp ), false);
|
||||||
dom.controlsDown.addEventListener('click', preventAndForward( navigateDown ), false);
|
dom.controlsDown.addEventListener('click', preventAndForward( navigateDown ), false);
|
||||||
|
|
||||||
// Default options
|
// Fall back on default options
|
||||||
config.rollingLinks = options.rollingLinks === undefined ? true : options.rollingLinks;
|
config.rollingLinks = options.rollingLinks === undefined ? true : options.rollingLinks;
|
||||||
config.controls = options.controls === undefined ? false : options.controls;
|
config.controls = options.controls === undefined ? false : options.controls;
|
||||||
config.theme = options.theme === undefined ? 'default' : options.theme;
|
config.theme = options.theme === undefined ? 'default' : options.theme;
|
||||||
|
@ -120,6 +130,9 @@ var Reveal = (function(){
|
||||||
/**
|
/**
|
||||||
* Prevents an events defaults behavior calls the
|
* Prevents an events defaults behavior calls the
|
||||||
* specified delegate.
|
* specified delegate.
|
||||||
|
*
|
||||||
|
* @param {Function} delegate The method to call
|
||||||
|
* after the wrapper has been executed
|
||||||
*/
|
*/
|
||||||
function preventAndForward( delegate ) {
|
function preventAndForward( delegate ) {
|
||||||
return function( event ) {
|
return function( event ) {
|
||||||
|
@ -135,6 +148,9 @@ var Reveal = (function(){
|
||||||
*/
|
*/
|
||||||
function onDocumentKeyDown( event ) {
|
function onDocumentKeyDown( event ) {
|
||||||
|
|
||||||
|
// FFT: Use document.querySelector( ':focus' ) === null
|
||||||
|
// instead of checking contentEditable?
|
||||||
|
|
||||||
if( event.keyCode >= 37 && event.keyCode <= 40 && event.target.contentEditable === 'inherit' ) {
|
if( event.keyCode >= 37 && event.keyCode <= 40 && event.target.contentEditable === 'inherit' ) {
|
||||||
|
|
||||||
switch( event.keyCode ) {
|
switch( event.keyCode ) {
|
||||||
|
@ -339,7 +355,7 @@ var Reveal = (function(){
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the page URL (hash) to reflect the current
|
* Updates the page URL (hash) to reflect the current
|
||||||
* navigational state.
|
* state.
|
||||||
*/
|
*/
|
||||||
function writeURL() {
|
function writeURL() {
|
||||||
var url = '/';
|
var url = '/';
|
||||||
|
@ -353,12 +369,13 @@ var Reveal = (function(){
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate to the nexy slide fragment.
|
* Navigate to the next slide fragment.
|
||||||
*
|
*
|
||||||
* @return {Boolean} true if there was a next fragment,
|
* @return {Boolean} true if there was a next fragment,
|
||||||
* false otherwise
|
* false otherwise
|
||||||
*/
|
*/
|
||||||
function nextFragment() {
|
function nextFragment() {
|
||||||
|
// Vertical slides:
|
||||||
if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
|
if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
|
||||||
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
||||||
if( verticalFragments.length ) {
|
if( verticalFragments.length ) {
|
||||||
|
@ -366,6 +383,7 @@ var Reveal = (function(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Horizontal slides:
|
||||||
else {
|
else {
|
||||||
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment:not(.visible)' );
|
||||||
if( horizontalFragments.length ) {
|
if( horizontalFragments.length ) {
|
||||||
|
@ -384,6 +402,7 @@ var Reveal = (function(){
|
||||||
* false otherwise
|
* false otherwise
|
||||||
*/
|
*/
|
||||||
function previousFragment() {
|
function previousFragment() {
|
||||||
|
// Vertical slides:
|
||||||
if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
|
if( document.querySelector( VERTICAL_SLIDES_SELECTOR + '.present' ) ) {
|
||||||
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
var verticalFragments = document.querySelectorAll( VERTICAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
||||||
if( verticalFragments.length ) {
|
if( verticalFragments.length ) {
|
||||||
|
@ -391,6 +410,7 @@ var Reveal = (function(){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Horizontal slides:
|
||||||
else {
|
else {
|
||||||
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
var horizontalFragments = document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR + '.present .fragment.visible' );
|
||||||
if( horizontalFragments.length ) {
|
if( horizontalFragments.length ) {
|
||||||
|
|
Loading…
Reference in a new issue