11/*! 
2-  * reveal.js 1.5 r1  
2+  * reveal.js 1.5 r2  
33 * http://lab.hakim.se/reveal-js 
44 * MIT licensed 
55 *  
@@ -12,10 +12,6 @@ var Reveal = (function(){
1212
1313		IS_TOUCH_DEVICE  =  ! ! (  'ontouchstart'  in  window  ) , 
1414
15- 		// The horizontal and verical index of the currently active slide 
16- 		indexh  =  0 , 
17- 		indexv  =  0 , 
18- 
1915		// Configurations defaults, can be overridden at initialization time  
2016		config  =  { 
2117			// Display controls in the bottom right corner 
@@ -50,6 +46,14 @@ var Reveal = (function(){
5046			transition : 'default'  // default/cube/page/concave/linear(2d) 
5147		} , 
5248
49+ 		// The horizontal and verical index of the currently active slide 
50+ 		indexh  =  0 , 
51+ 		indexv  =  0 , 
52+ 
53+ 		// The previous and current slide HTML elements 
54+ 		previousSlide , 
55+ 		currentSlide , 
56+ 
5357		// Slides may hold a data-state attribute which we pick up and apply  
5458		// as a class to the body. This list contains the combined state of  
5559		// all current slides. 
@@ -650,6 +654,9 @@ var Reveal = (function(){
650654	 * set indices.  
651655	 */ 
652656	function  slide (  h ,  v  )  { 
657+ 		// Remember where we were at before 
658+ 		previousSlide  =  currentSlide ; 
659+ 
653660		// Remember the state before this slide 
654661		var  stateBefore  =  state . concat ( ) ; 
655662
@@ -700,31 +707,30 @@ var Reveal = (function(){
700707		clearTimeout (  writeURLTimeout  ) ; 
701708		writeURLTimeout  =  setTimeout (  writeURL ,  1500  ) ; 
702709
703- 		// Only fire if the slide index is different from before 
704- 		if (  indexh  !==  indexhBefore  ||  indexv  !==  indexvBefore  )  { 
705- 			// Query all horizontal slides in the deck 
706- 			var  horizontalSlides  =  document . querySelectorAll (  HORIZONTAL_SLIDES_SELECTOR  ) ; 
710+ 		// Query all horizontal slides in the deck 
711+ 		var  horizontalSlides  =  document . querySelectorAll (  HORIZONTAL_SLIDES_SELECTOR  ) ; 
707712
708- 			// Find the previous and current horizontal slides 
709- 			var  previousHorizontalSlide  =  horizontalSlides [  indexhBefore  ] , 
710- 				currentHorizontalSlide  =  horizontalSlides [  indexh  ] ; 
713+ 		// Find the current horizontal slide and any possible vertical slides 
714+ 		// within it 
715+ 		var  currentHorizontalSlide  =  horizontalSlides [  indexh  ] , 
716+ 			currentVerticalSlides  =  currentHorizontalSlide . querySelectorAll (  'section'  ) ; 
711717
712- 			// Query all vertical slides inside of the previous and current horizontal slides 
713- 			var  previousVerticalSlides  =  previousHorizontalSlide . querySelectorAll (  'section'  ) ; 
714- 				currentVerticalSlides  =  currentHorizontalSlide . querySelectorAll (  'section'  ) ; 
718+ 		// Store references to the previous and current slides 
719+ 		currentSlide  =  currentVerticalSlides [  indexv  ]  ||  currentHorizontalSlide ; 
715720
716- 			// Dispatch an event notifying observers of the change in slide 
721+ 		// Dispatch an event if the slide changed 
722+ 		if (  indexh  !==  indexhBefore  ||  indexv  !==  indexvBefore  )  { 
717723			dispatchEvent (  'slidechanged' ,  { 
718- 				// Include the current indices in the event 
719724				'indexh' : indexh ,  
720725				'indexv' : indexv , 
721- 
722- 				// Passes direct references to the slide HTML elements, attempts to find 
723- 				// a vertical slide and falls back on the horizontal parent 
724- 				'previousSlide' : previousVerticalSlides [  indexvBefore  ]  ||  previousHorizontalSlide , 
725- 				'currentSlide' : currentVerticalSlides [  indexv  ]  ||  currentHorizontalSlide 
726+ 				'previousSlide' : previousSlide , 
727+ 				'currentSlide' : currentSlide 
726728			}  ) ; 
727729		} 
730+ 		else  { 
731+ 			// Ensure that the previous slide is never the same as the current 
732+ 			previousSlide  =  null ; 
733+ 		} 
728734	} 
729735
730736	/** 
@@ -980,9 +986,28 @@ var Reveal = (function(){
980986		navigateNext : navigateNext , 
981987		toggleOverview : toggleOverview , 
982988
989+ 		// Adds or removes all internal event listeners (such as keyboard) 
983990		addEventListeners : addEventListeners , 
984991		removeEventListeners : removeEventListeners , 
985992
993+ 		// Returns the indices of the current slide 
994+ 		getIndices : function ( )  { 
995+ 			return  {  
996+ 				h : indexh ,  
997+ 				v : indexv  
998+ 			} ; 
999+ 		} , 
1000+ 
1001+ 		// Returns the previous slide element, may be null 
1002+ 		getPreviousSlide : function ( )  { 
1003+ 			return  previousSlide 
1004+ 		} , 
1005+ 
1006+ 		// Returns the current slide element 
1007+ 		getCurrentSlide : function ( )  { 
1008+ 			return  currentSlide 
1009+ 		} , 
1010+ 
9861011		// Forward event binding to the reveal DOM element 
9871012		addEventListener : function (  type ,  listener ,  useCapture  )  { 
9881013			(  dom . wrapper  ||  document . querySelector (  '.reveal'  )  ) . addEventListener (  type ,  listener ,  useCapture  ) ; 
0 commit comments