return current fragment index through getIndices, replaces getCurrentFragmentIndex #395
This commit is contained in:
		
							
								
								
									
										25
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -1445,13 +1445,14 @@ var Reveal = (function(){ | |||||||
| 	 * index will be for this slide rather than the currently | 	 * index will be for this slide rather than the currently | ||||||
| 	 * active one | 	 * active one | ||||||
| 	 * | 	 * | ||||||
| 	 * @return {Object} { h: <int>, v: <int> } | 	 * @return {Object} { h: <int>, v: <int>, f: <int> } | ||||||
| 	 */ | 	 */ | ||||||
| 	function getIndices( slide ) { | 	function getIndices( slide ) { | ||||||
|  |  | ||||||
| 		// By default, return the current indices | 		// By default, return the current indices | ||||||
| 		var h = indexh, | 		var h = indexh, | ||||||
| 			v = indexv; | 			v = indexv, | ||||||
|  | 			f; | ||||||
|  |  | ||||||
| 		// If a slide is specified, return the indices of that slide | 		// If a slide is specified, return the indices of that slide | ||||||
| 		if( slide ) { | 		if( slide ) { | ||||||
| @@ -1470,7 +1471,14 @@ var Reveal = (function(){ | |||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		return { h: h, v: v }; | 		if( !slide && currentSlide ) { | ||||||
|  | 			var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); | ||||||
|  | 			if( visibleFragments.length ) { | ||||||
|  | 				f = visibleFragments.length; | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		return { h: h, v: v, f: f }; | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -2050,17 +2058,6 @@ var Reveal = (function(){ | |||||||
| 			return config; | 			return config; | ||||||
| 		}, | 		}, | ||||||
|  |  | ||||||
| 		// Returns an index (1-based) of the current fragment |  | ||||||
| 		getCurrentFragmentIndex : function() { |  | ||||||
| 			if( currentSlide ) { |  | ||||||
| 				var visibleFragments = currentSlide.querySelectorAll( '.fragment.visible' ); |  | ||||||
|  |  | ||||||
| 				if( visibleFragments.length ) { |  | ||||||
| 					return visibleFragments.length; |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
|  |  | ||||||
| 		// Helper method, retrieves query string as a key/value hash | 		// Helper method, retrieves query string as a key/value hash | ||||||
| 		getQueryHash: function() { | 		getQueryHash: function() { | ||||||
| 			var query = {}; | 			var query = {}; | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								js/reveal.min.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								js/reveal.min.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -10,7 +10,7 @@ | |||||||
| 			var nextindexh; | 			var nextindexh; | ||||||
| 			var nextindexv; | 			var nextindexv; | ||||||
|  |  | ||||||
| 			var fragmentindex = Reveal.getCurrentFragmentIndex(); | 			var fragmentindex = Reveal.getIndices().f; | ||||||
| 			if (typeof fragmentindex == 'undefined') { | 			if (typeof fragmentindex == 'undefined') { | ||||||
| 				fragmentindex = 0; | 				fragmentindex = 0; | ||||||
| 			} | 			} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user