diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-11-10 10:39:59 -0500 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2012-11-10 10:39:59 -0500 |
commit | df4e1fd346558adafc6decc96ec9366d720d6896 (patch) | |
tree | 7ce92ec6aba3c8503f6cf836e2c9a786beae1426 /js | |
parent | f6c5ceb49053bb67c63d88a38261484a974812f7 (diff) | |
download | freenode-live-2017-presentation-df4e1fd346558adafc6decc96ec9366d720d6896.tar freenode-live-2017-presentation-df4e1fd346558adafc6decc96ec9366d720d6896.tar.gz |
write named links, rather than h/v index, to hash when available (closes #224)
Diffstat (limited to 'js')
-rw-r--r-- | js/reveal.js | 15 | ||||
-rw-r--r-- | js/reveal.min.js | 8 |
2 files changed, 14 insertions, 9 deletions
diff --git a/js/reveal.js b/js/reveal.js index 564c863..2507b22 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.2 r38 + * reveal.js 2.2 r39 * http://lab.hakim.se/reveal-js * MIT licensed * @@ -938,10 +938,15 @@ var Reveal = (function(){ if( config.history ) { var url = '/'; - // Only include the minimum possible number of components in - // the URL - if( indexh > 0 || indexv > 0 ) url += indexh; - if( indexv > 0 ) url += '/' + indexv; + // If the current slide has an ID, use that as a named link + if( currentSlide && typeof currentSlide.getAttribute( 'id' ) === 'string' ) { + url = '/' + currentSlide.getAttribute( 'id' ); + } + // Otherwise use the /h/v index + else { + if( indexh > 0 || indexv > 0 ) url += indexh; + if( indexv > 0 ) url += '/' + indexv; + } window.location.hash = url; } diff --git a/js/reveal.min.js b/js/reveal.min.js index 3167665..74627ea 100644 --- a/js/reveal.min.js +++ b/js/reveal.min.js @@ -1,5 +1,5 @@ /*! - * reveal.js 2.2 r38 + * reveal.js 2.2 r39 * http://lab.hakim.se/reveal-js * 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"); }}}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); -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; -}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; -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); +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"); +}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 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"); 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"); |