/*!
- * reveal.js 2.0 r19
+ * reveal.js 2.0 r20
* http://lab.hakim.se/reveal-js
* MIT licensed
*
* Reads the current URL (hash) and navigates accordingly.
*/
function readURL() {
- // Break the hash down to separate components
- var bits = window.location.hash.slice(2).split('/');
-
- // Read the index components of the hash
- var h = parseInt( bits[0] ) || 0 ;
- var v = parseInt( bits[1] ) || 0 ;
+ var hash = window.location.hash;
+
+ // Attempt to parse the hash as either an index or name
+ var bits = hash.slice( 2 ).split( '/' ),
+ name = hash.replace( /#|\//gi, '' );
+
+ // If the first bit is invalid and there is a name we can
+ // assume that this is a named link
+ if( isNaN( parseInt( bits[0] ) ) && name.length ) {
+ // Find the slide with the specified name
+ var slide = document.querySelector( '#' + name );
+
+ if( slide ) {
+ // Find the position of the named slide and navigate to it
+ var indices = Reveal.getIndices( slide );
+ navigateTo( indices.h, indices.v );
+ }
+ // If the slide doesn't exist, navigate to the current slide
+ else {
+ navigateTo( indexh, indexv );
+ }
+ }
+ else {
+ // Read the index components of the hash
+ var h = parseInt( bits[0] ) || 0,
+ v = parseInt( bits[1] ) || 0;
- navigateTo( h, v );
+ navigateTo( h, v );
+ }
}
/**
addEventListeners: addEventListeners,
removeEventListeners: removeEventListeners,
- // Returns the indices of the current slide
- getIndices: function() {
- return {
- h: indexh,
- v: indexv
- };
+ // Returns the indices of the current, or specified, slide
+ getIndices: function( slide ) {
+ // By default, return the current indices
+ var h = indexh,
+ v = indexv;
+
+ // If a slide is specified, return the indices of that slide
+ if( slide ) {
+ var isVertical = !!slide.parentNode.nodeName.match( /section/gi );
+ var slideh = isVertical ? slide.parentNode : slide;
+
+ // Select all horizontal slides
+ var horizontalSlides = Array.prototype.slice.call( document.querySelectorAll( HORIZONTAL_SLIDES_SELECTOR ) );
+
+ // Now that we know which the horizontal slide is, get its index
+ h = Math.max( horizontalSlides.indexOf( slideh ), 0 );
+
+ // If this is a vertical slide, grab the vertical index
+ if( isVertical ) {
+ v = Math.max( Array.prototype.slice.call( slide.parentNode.children ).indexOf( slide ), 0 );
+ }
+ }
+
+ return { h: h, v: v };
},
// Returns the previous slide element, may be null
/*!
- * reveal.js 2.0 r19
+ * reveal.js 2.0 r20
* http://lab.hakim.se/reveal-js
* MIT licensed
*
}else{w=null;}if(w){w.classList.remove("present");}}function q(){if(!N.controls||!d.controls){return;}var ad=f();[d.controlsLeft,d.controlsRight,d.controlsUp,d.controlsDown].forEach(function(ae){ae.classList.remove("enabled");
});if(ad.left){d.controlsLeft.classList.add("enabled");}if(ad.right){d.controlsRight.classList.add("enabled");}if(ad.up){d.controlsUp.classList.add("enabled");
}if(ad.down){d.controlsDown.classList.add("enabled");}}function f(){var ad=document.querySelectorAll(k);var ae=document.querySelectorAll(b);return{left:l>0,right:l<ad.length-1,up:c>0,down:c<ae.length-1};
-}function H(){var af=window.location.hash.slice(2).split("/");var ae=parseInt(af[0])||0;var ad=parseInt(af[1])||0;L(ae,ad);}function g(){if(N.history){var ad="/";
+}function H(){var ai=window.location.hash;var ah=ai.slice(2).split("/"),af=ai.replace(/#|\//gi,"");if(isNaN(parseInt(ah[0]))&&af.length){var ad=document.querySelector("#"+af);
+if(ad){var aj=Reveal.getIndices(ad);L(aj.h,aj.v);}else{L(l,c);}}else{var ag=parseInt(ah[0])||0,ae=parseInt(ah[1])||0;L(ag,ae);}}function g(){if(N.history){var ad="/";
if(l>0||c>0){ad+=l;}if(c>0){ad+="/"+c;}window.location.hash=ad;}}function p(ae,ad){var af=document.createEvent("HTMLEvents",1,2);af.initEvent(ae,true,true);
r(af,ad);d.wrapper.dispatchEvent(af);}function t(){if(document.querySelector(b+".present")){var ae=document.querySelectorAll(b+".present .fragment:not(.visible)");
if(ae.length){ae[0].classList.add("visible");p("fragmentshown",{fragment:ae[0]});return true;}}else{var ad=document.querySelectorAll(k+".present .fragment:not(.visible)");
if(N.autoSlide){j=setTimeout(v,N.autoSlide);}}function L(ae,ad){a(ae,ad);}function z(){if(V()||M()===false){a(l-1,0);}}function i(){if(V()||t()===false){a(l+1,0);
}}function s(){if(V()||M()===false){a(l,c-1);}}function D(){if(V()||t()===false){a(l,c+1);}}function U(){if(M()===false){if(f().up){s();}else{var ad=document.querySelector(".reveal .slides>section.past:nth-child("+l+")");
if(ad){c=(ad.querySelectorAll("section").length+1)||0;l--;a();}}}}function v(){if(t()===false){f().down?D():i();}K();}function T(){if(V()){Y();}else{G();
-}}return{initialize:h,navigateTo:L,navigateLeft:z,navigateRight:i,navigateUp:s,navigateDown:D,navigatePrev:U,navigateNext:v,toggleOverview:T,addEventListeners:C,removeEventListeners:Q,getIndices:function(){return{h:l,v:c};
-},getPreviousSlide:function(){return w;},getCurrentSlide:function(){return E;},getQueryHash:function(){var ad={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ae){ad[ae.split("=").shift()]=ae.split("=").pop();
-});return ad;},addEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(ae,af,ad);
-}},removeEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(ae,af,ad);
+}}return{initialize:h,navigateTo:L,navigateLeft:z,navigateRight:i,navigateUp:s,navigateDown:D,navigatePrev:U,navigateNext:v,toggleOverview:T,addEventListeners:C,removeEventListeners:Q,getIndices:function(ad){var ah=l,af=c;
+if(ad){var ai=!!ad.parentNode.nodeName.match(/section/gi);var ag=ai?ad.parentNode:ad;var ae=Array.prototype.slice.call(document.querySelectorAll(k));ah=Math.max(ae.indexOf(ag),0);
+if(ai){af=Math.max(Array.prototype.slice.call(ad.parentNode.children).indexOf(ad),0);}}return{h:ah,v:af};},getPreviousSlide:function(){return w;},getCurrentSlide:function(){return E;
+},getQueryHash:function(){var ad={};location.search.replace(/[A-Z0-9]+?=(\w*)/gi,function(ae){ad[ae.split("=").shift()]=ae.split("=").pop();});return ad;
+},addEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).addEventListener(ae,af,ad);}},removeEventListener:function(ae,af,ad){if("addEventListener" in window){(d.wrapper||document.querySelector(".reveal")).removeEventListener(ae,af,ad);
}}};})();
\ No newline at end of file