write named links, rather than h/v index, to hash when available (closes #224)
This commit is contained in:
parent
f6c5ceb490
commit
df4e1fd346
15
js/reveal.js
15
js/reveal.js
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* reveal.js 2.2 r38
|
* reveal.js 2.2 r39
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
|
@ -938,10 +938,15 @@ var Reveal = (function(){
|
||||||
if( config.history ) {
|
if( config.history ) {
|
||||||
var url = '/';
|
var url = '/';
|
||||||
|
|
||||||
// Only include the minimum possible number of components in
|
// If the current slide has an ID, use that as a named link
|
||||||
// the URL
|
if( currentSlide && typeof currentSlide.getAttribute( 'id' ) === 'string' ) {
|
||||||
if( indexh > 0 || indexv > 0 ) url += indexh;
|
url = '/' + currentSlide.getAttribute( 'id' );
|
||||||
if( indexv > 0 ) url += '/' + indexv;
|
}
|
||||||
|
// Otherwise use the /h/v index
|
||||||
|
else {
|
||||||
|
if( indexh > 0 || indexv > 0 ) url += indexh;
|
||||||
|
if( indexv > 0 ) url += '/' + indexv;
|
||||||
|
}
|
||||||
|
|
||||||
window.location.hash = url;
|
window.location.hash = url;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*!
|
/*!
|
||||||
* reveal.js 2.2 r38
|
* reveal.js 2.2 r39
|
||||||
* http://lab.hakim.se/reveal-js
|
* http://lab.hakim.se/reveal-js
|
||||||
* MIT licensed
|
* MIT licensed
|
||||||
*
|
*
|
||||||
|
@ -57,9 +57,9 @@ if(aw<0){aw=av+aw;}}aw=Math.max(Math.min(aw,av-1),0);for(var at=0;at<av;at++){va
|
||||||
}if(an.right){f.controlsRight.classList.add("enabled");}if(an.up){f.controlsUp.classList.add("enabled");}if(an.down){f.controlsDown.classList.add("enabled");
|
}if(an.right){f.controlsRight.classList.add("enabled");}if(an.up){f.controlsUp.classList.add("enabled");}if(an.down){f.controlsDown.classList.add("enabled");
|
||||||
}}}function h(){var an=document.querySelectorAll(m),ao=document.querySelectorAll(b);return{left:n>0,right:n<an.length-1,up:e>0,down:e<ao.length-1};}function K(){var at=window.location.hash;
|
}}}function h(){var an=document.querySelectorAll(m),ao=document.querySelectorAll(b);return{left:n>0,right:n<an.length-1,up:e>0,down:e<ao.length-1};}function K(){var at=window.location.hash;
|
||||||
var ar=at.slice(2).split("/"),ao=at.replace(/#|\//gi,"");if(isNaN(parseInt(ar[0],10))&&ao.length){var ap=document.querySelector("#"+ao);if(ap){var au=Reveal.getIndices(ap);
|
var ar=at.slice(2).split("/"),ao=at.replace(/#|\//gi,"");if(isNaN(parseInt(ar[0],10))&&ao.length){var ap=document.querySelector("#"+ao);if(ap){var au=Reveal.getIndices(ap);
|
||||||
a(au.h,au.v);}else{a(n,e);}}else{var aq=parseInt(ar[0],10)||0,an=parseInt(ar[1],10)||0;a(aq,an);}}function i(){if(T.history){var an="/";if(n>0||e>0){an+=n;
|
a(au.h,au.v);}else{a(n,e);}}else{var aq=parseInt(ar[0],10)||0,an=parseInt(ar[1],10)||0;a(aq,an);}}function i(){if(T.history){var an="/";if(H&&typeof H.getAttribute("id")==="string"){an="/"+H.getAttribute("id");
|
||||||
}if(e>0){an+="/"+e;}window.location.hash=an;}}function N(an){var ar=n,ap=e;if(an){var at=!!an.parentNode.nodeName.match(/section/gi);var aq=at?an.parentNode:an;
|
}else{if(n>0||e>0){an+=n;}if(e>0){an+="/"+e;}}window.location.hash=an;}}function N(an){var ar=n,ap=e;if(an){var at=!!an.parentNode.nodeName.match(/section/gi);
|
||||||
var ao=Array.prototype.slice.call(document.querySelectorAll(m));ar=Math.max(ao.indexOf(aq),0);if(at){ap=Math.max(Array.prototype.slice.call(an.parentNode.children).indexOf(an),0);
|
var aq=at?an.parentNode:an;var ao=Array.prototype.slice.call(document.querySelectorAll(m));ar=Math.max(ao.indexOf(aq),0);if(at){ap=Math.max(Array.prototype.slice.call(an.parentNode.children).indexOf(an),0);
|
||||||
}}return{h:ar,v:ap};}function w(){if(document.querySelector(b+".present")){var ao=document.querySelectorAll(b+".present .fragment:not(.visible)");if(ao.length){ao[0].classList.add("visible");
|
}}return{h:ar,v:ap};}function w(){if(document.querySelector(b+".present")){var ao=document.querySelectorAll(b+".present .fragment:not(.visible)");if(ao.length){ao[0].classList.add("visible");
|
||||||
s("fragmentshown",{fragment:ao[0]});return true;}}else{var an=document.querySelectorAll(m+".present .fragment:not(.visible)");if(an.length){an[0].classList.add("visible");
|
s("fragmentshown",{fragment:ao[0]});return true;}}else{var an=document.querySelectorAll(m+".present .fragment:not(.visible)");if(an.length){an[0].classList.add("visible");
|
||||||
s("fragmentshown",{fragment:an[0]});return true;}}return false;}function S(){if(document.querySelector(b+".present")){var ao=document.querySelectorAll(b+".present .fragment.visible");
|
s("fragmentshown",{fragment:an[0]});return true;}}return false;}function S(){if(document.querySelector(b+".present")){var ao=document.querySelectorAll(b+".present .fragment.visible");
|
||||||
|
|
Loading…
Reference in New Issue