fragment comments, remove debug code

This commit is contained in:
Hakim El Hattab committed 2013-11-18 09:14:01 -05:00
1 parent 8550186afc
commit 9d0ac52780
2 files changed
+16 -9

No files matched your search

+13 -6
View File
@@ -2272,8 +2272,13 @@ var Reveal = (function(){
/** /**
* Navigate to the specified slide fragment. * Navigate to the specified slide fragment.
* *
* @return {Boolean} true if there was a next fragment, * @param {Number} index The index of the fragment that
* false otherwise * 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 ) { function navigateFragment( index, offset ) {
@@ -2282,6 +2287,7 @@ var Reveal = (function(){
var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) ); var fragments = sortFragments( currentSlide.querySelectorAll( '.fragment' ) );
if( fragments.length ) { if( fragments.length ) {
// If no index is specified, find the current
if( typeof index !== 'number' ) { if( typeof index !== 'number' ) {
var lastVisibleFragment = sortFragments( currentSlide.querySelectorAll( '.fragment.visible' ) ).pop(); 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' ) { if( typeof offset === 'number' ) {
index += offset; index += offset;
} }
@@ -2302,6 +2309,7 @@ var Reveal = (function(){
toArray( fragments ).forEach( function( element, i ) { toArray( fragments ).forEach( function( element, i ) {
// Visible fragments
if( i < index ) { if( i < index ) {
if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element ); if( !element.classList.contains( 'visible' ) ) fragmentsShown.push( element );
element.classList.add( 'visible' ); element.classList.add( 'visible' );
@@ -2311,6 +2319,7 @@ var Reveal = (function(){
element.classList.add( 'current-fragment' ); element.classList.add( 'current-fragment' );
} }
} }
// Hidden fragments
else { else {
if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element ); if( element.classList.contains( 'visible' ) ) fragmentsHidden.push( element );
element.classList.remove( 'visible' ); element.classList.remove( 'visible' );
@@ -2320,13 +2329,11 @@ var Reveal = (function(){
} ); } );
if( offset < 0 && fragmentsHidden.length ) { if( fragmentsHidden.length ) {
console.log('hidden');
dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } ); dispatchEvent( 'fragmenthidden', { fragment: fragmentsHidden[0], fragments: fragmentsHidden } );
} }
if( offset > 0 && fragmentsShown.length ) { if( fragmentsShown.length ) {
console.log('shown');
dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } ); dispatchEvent( 'fragmentshown', { fragment: fragmentsShown[0], fragments: fragmentsShown } );
} }
+3 -3
View File
@@ -1,9 +1,9 @@
/*! /*!
* reveal.js 2.6.0-dev (2013-11-18, 09:03) * reveal.js 2.6.0-dev (2013-11-18, 09:12)
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
* Copyright (C) 2013 Hakim El Hattab, http://hakim.se * Copyright (C) 2013 Hakim El Hattab, http://hakim.se
*/ */
var Reveal=function(){"use strict";function a(a){if(b(),!dc.transforms2d&&!dc.transforms3d)return document.body.setAttribute("class","no-transforms"),void 0;window.addEventListener("load",C,!1);var d=Reveal.getQueryHash();"undefined"!=typeof d.dependencies&&delete d.dependencies,l($b,a),l($b,d),s(),c()}function b(){dc.transforms3d="WebkitPerspective"in document.body.style||"MozPerspective"in document.body.style||"msPerspective"in document.body.style||"OPerspective"in document.body.style||"perspective"in document.body.style,dc.transforms2d="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style,dc.requestAnimationFrameMethod=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,dc.requestAnimationFrame="function"==typeof dc.requestAnimationFrameMethod,dc.canvas=!!document.createElement("canvas").getContext,Ub=navigator.userAgent.match(/(iphone|ipod|android)/gi)}function c(){function a(){c.length&&head.js.apply(null,c),d()}for(var b=[],c=[],e=0,f=$b.dependencies.length;f>e;e++){var g=$b.dependencies[e];(!g.condition||g.condition())&&(g.async?c.push(g.src):b.push(g.src),"function"==typeof g.callback&&head.ready(g.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],g.callback))}b.length?(head.ready(a),head.js.apply(null,b)):a()}function d(){f(),e(),i(),cb(),X(!0),setTimeout(function(){cc.slides.classList.remove("no-transition"),_b=!0,u("ready",{indexh:Pb,indexv:Qb,currentSlide:Sb})},1)}function e(){var a=m(document.querySelectorAll(Xb));a.forEach(function(a){var b=m(a.querySelectorAll("section"));b.forEach(function(a,b){b>0&&a.classList.add("future")})})}function f(){cc.theme=document.querySelector("#theme"),cc.wrapper=document.querySelector(".reveal"),cc.slides=document.querySelector(".reveal .slides"),cc.slides.classList.add("no-transition"),cc.background=g(cc.wrapper,"div","backgrounds",null),cc.progress=g(cc.wrapper,"div","progress","<span></span>"),cc.progressbar=cc.progress.querySelector("span"),g(cc.wrapper,"aside","controls",'<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>'),cc.slideNumber=g(cc.wrapper,"div","slide-number",""),g(cc.wrapper,"div","state-background",null),g(cc.wrapper,"div","pause-overlay",null),cc.controls=document.querySelector(".reveal .controls"),cc.controlsLeft=m(document.querySelectorAll(".navigate-left")),cc.controlsRight=m(document.querySelectorAll(".navigate-right")),cc.controlsUp=m(document.querySelectorAll(".navigate-up")),cc.controlsDown=m(document.querySelectorAll(".navigate-down")),cc.controlsPrev=m(document.querySelectorAll(".navigate-prev")),cc.controlsNext=m(document.querySelectorAll(".navigate-next"))}function g(a,b,c,d){var e=a.querySelector("."+c);return e||(e=document.createElement(b),e.classList.add(c),null!==d&&(e.innerHTML=d),a.appendChild(e)),e}function h(){function a(a,b){var c={background:a.getAttribute("data-background"),backgroundSize:a.getAttribute("data-background-size"),backgroundImage:a.getAttribute("data-background-image"),backgroundColor:a.getAttribute("data-background-color"),backgroundRepeat:a.getAttribute("data-background-repeat"),backgroundPosition:a.getAttribute("data-background-position"),backgroundTransition:a.getAttribute("data-background-transition")},d=document.createElement("div");return d.className="slide-background",c.background&&(/^(http|file|\/\/)/gi.test(c.background)||/\.(svg|png|jpg|jpeg|gif|bmp)$/gi.test(c.background)?d.style.backgroundImage="url("+c.background+")":d.style.background=c.background),(c.background||c.backgroundColor||c.backgroundImage)&&d.setAttribute("data-background-hash",c.background+c.backgroundSize+c.backgroundImage+c.backgroundColor+c.backgroundRepeat+c.backgroundPosition+c.backgroundTransition),c.backgroundSize&&(d.style.backgroundSize=c.backgroundSize),c.backgroundImage&&(d.style.backgroundImage='url("'+c.backgroundImage+'")'),c.backgroundColor&&(d.style.backgroundColor=c.backgroundColor),c.backgroundRepeat&&(d.style.backgroundRepeat=c.backgroundRepeat),c.backgroundPosition&&(d.style.backgroundPosition=c.backgroundPosition),c.backgroundTransition&&d.setAttribute("data-background-transition",c.backgroundTransition),b.appendChild(d),d}r()&&document.body.classList.add("print-pdf"),cc.background.innerHTML="",cc.background.classList.add("no-transition"),m(document.querySelectorAll(Xb)).forEach(function(b){var c;c=r()?a(b,b):a(b,cc.background),m(b.querySelectorAll("section")).forEach(function(b){r()?a(b,b):a(b,c)})}),$b.parallaxBackgroundImage?(cc.background.style.backgroundImage='url("'+$b.parallaxBackgroundImage+'")',cc.background.style.backgroundSize=$b.parallaxBackgroundSize,setTimeout(function(){cc.wrapper.classList.add("has-parallax-background")},1)):(cc.background.style.backgroundImage="",cc.wrapper.classList.remove("has-parallax-background"))}function i(a){var b=dLine truncated var Reveal=function(){"use strict";function a(a){if(b(),!dc.transforms2d&&!dc.transforms3d)return document.body.setAttribute("class","no-transforms"),void 0;window.addEventListener("load",C,!1);var d=Reveal.getQueryHash();"undefined"!=typeof d.dependencies&&delete d.dependencies,l($b,a),l($b,d),s(),c()}function b(){dc.transforms3d="WebkitPerspective"in document.body.style||"MozPerspective"in document.body.style||"msPerspective"in document.body.style||"OPerspective"in document.body.style||"perspective"in document.body.style,dc.transforms2d="WebkitTransform"in document.body.style||"MozTransform"in document.body.style||"msTransform"in document.body.style||"OTransform"in document.body.style||"transform"in document.body.style,dc.requestAnimationFrameMethod=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,dc.requestAnimationFrame="function"==typeof dc.requestAnimationFrameMethod,dc.canvas=!!document.createElement("canvas").getContext,Ub=navigator.userAgent.match(/(iphone|ipod|android)/gi)}function c(){function a(){c.length&&head.js.apply(null,c),d()}for(var b=[],c=[],e=0,f=$b.dependencies.length;f>e;e++){var g=$b.dependencies[e];(!g.condition||g.condition())&&(g.async?c.push(g.src):b.push(g.src),"function"==typeof g.callback&&head.ready(g.src.match(/([\w\d_\-]*)\.?js$|[^\\\/]*$/i)[0],g.callback))}b.length?(head.ready(a),head.js.apply(null,b)):a()}function d(){f(),e(),i(),cb(),X(!0),setTimeout(function(){cc.slides.classList.remove("no-transition"),_b=!0,u("ready",{indexh:Pb,indexv:Qb,currentSlide:Sb})},1)}function e(){var a=m(document.querySelectorAll(Xb));a.forEach(function(a){var b=m(a.querySelectorAll("section"));b.forEach(function(a,b){b>0&&a.classList.add("future")})})}function f(){cc.theme=document.querySelector("#theme"),cc.wrapper=document.querySelector(".reveal"),cc.slides=document.querySelector(".reveal .slides"),cc.slides.classList.add("no-transition"),cc.background=g(cc.wrapper,"div","backgrounds",null),cc.progress=g(cc.wrapper,"div","progress","<span></span>"),cc.progressbar=cc.progress.querySelector("span"),g(cc.wrapper,"aside","controls",'<div class="navigate-left"></div><div class="navigate-right"></div><div class="navigate-up"></div><div class="navigate-down"></div>'),cc.slideNumber=g(cc.wrapper,"div","slide-number",""),g(cc.wrapper,"div","state-background",null),g(cc.wrapper,"div","pause-overlay",null),cc.controls=document.querySelector(".reveal .controls"),cc.controlsLeft=m(document.querySelectorAll(".navigate-left")),cc.controlsRight=m(document.querySelectorAll(".navigate-right")),cc.controlsUp=m(document.querySelectorAll(".navigate-up")),cc.controlsDown=m(document.querySelectorAll(".navigate-down")),cc.controlsPrev=m(document.querySelectorAll(".navigate-prev")),cc.controlsNext=m(document.querySelectorAll(".navigate-next"))}function g(a,b,c,d){var e=a.querySelector("."+c);return e||(e=document.createElement(b),e.classList.add(c),null!==d&&(e.innerHTML=d),a.appendChild(e)),e}function h(){function a(a,b){var c={background:a.getAttribute("data-background"),backgroundSize:a.getAttribute("data-background-size"),backgroundImage:a.getAttribute("data-background-image"),backgroundColor:a.getAttribute("data-background-color"),backgroundRepeat:a.getAttribute("data-background-repeat"),backgroundPosition:a.getAttribute("data-background-position"),backgroundTransition:a.getAttribute("data-background-transition")},d=document.createElement("div");return d.className="slide-background",c.background&&(/^(http|file|\/\/)/gi.test(c.background)||/\.(svg|png|jpg|jpeg|gif|bmp)$/gi.test(c.background)?d.style.backgroundImage="url("+c.background+")":d.style.background=c.background),(c.background||c.backgroundColor||c.backgroundImage)&&d.setAttribute("data-background-hash",c.background+c.backgroundSize+c.backgroundImage+c.backgroundColor+c.backgroundRepeat+c.backgroundPosition+c.backgroundTransition),c.backgroundSize&&(d.style.backgroundSize=c.backgroundSize),c.backgroundImage&&(d.style.backgroundImage='url("'+c.backgroundImage+'")'),c.backgroundColor&&(d.style.backgroundColor=c.backgroundColor),c.backgroundRepeat&&(d.style.backgroundRepeat=c.backgroundRepeat),c.backgroundPosition&&(d.style.backgroundPosition=c.backgroundPosition),c.backgroundTransition&&d.setAttribute("data-background-transition",c.backgroundTransition),b.appendChild(d),d}r()&&document.body.classList.add("print-pdf"),cc.background.innerHTML="",cc.background.classList.add("no-transition"),m(document.querySelectorAll(Xb)).forEach(function(b){var c;c=r()?a(b,b):a(b,cc.background),m(b.querySelectorAll("section")).forEach(function(b){r()?a(b,b):a(b,c)})}),$b.parallaxBackgroundImage?(cc.background.style.backgroundImage='url("'+$b.parallaxBackgroundImage+'")',cc.background.style.backgroundSize=$b.parallaxBackgroundSize,setTimeout(function(){cc.wrapper.classList.add("has-parallax-background")},1)):(cc.background.style.backgroundImage="",cc.wrapper.classList.remove("has-parallax-background"))}function i(a){var b=dLine truncated
},isLastSlide:function(){return Sb?Sb.nextElementSibling?!1:K(Sb)&&Sb.parentNode.nextElementSibling?!1:!0:!1},isReady:function(){return _b},addEventListener:function(a,b,c){"addEventListener"in window&&(cc.wrapper||document.querySelector(".reveal")).addEventListener(a,b,c)},removeEventListener:function(a,b,c){"addEventListener"in window&&(cc.wrapper||document.querySelector(".reveal")).removeEventListener(a,b,c)}}}(); },isReady:function(){return _b},addEventListener:function(a,b,c){"addEventListener"in window&&(cc.wrapper||document.querySelector(".reveal")).addEventListener(a,b,c)},removeEventListener:function(a,b,c){"addEventListener"in window&&(cc.wrapper||document.querySelector(".reveal")).removeEventListener(a,b,c)}}}();