aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2012-10-24 21:30:52 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2012-10-24 21:30:52 -0400
commit747c4c4b3d7862d5c6889438b96bd7ad408b24bc (patch)
tree5ad3e861c3d1defceb166acb83ce18f55671e6b5 /js
parentaefe981040ea8c5c7875d9da1ac860def44a19e8 (diff)
downloadperl-software-in-gnu-guix-747c4c4b3d7862d5c6889438b96bd7ad408b24bc.tar
perl-software-in-gnu-guix-747c4c4b3d7862d5c6889438b96bd7ad408b24bc.tar.gz
fix keyboard navigation in ie9 (closes #202)
Diffstat (limited to 'js')
-rw-r--r--js/reveal.js11
-rw-r--r--js/reveal.min.js7
2 files changed, 12 insertions, 6 deletions
diff --git a/js/reveal.js b/js/reveal.js
index cb0205e..fcc064d 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -1088,9 +1088,14 @@ var Reveal = (function(){
* @param {Object} event
*/
function onDocumentKeyDown( event ) {
- // Disregard the event if the target is editable or a
- // modifier is present
- if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
+ // Check if there's a focused element that could be using
+ // the keyboard
+ var activeElement = document.activeElement;
+ var hasFocus = !!( document.activeElement && ( document.activeElement.type || document.activeElement.href || document.activeElement.contentEditable !== 'inherit' ) );
+
+ // Disregard the event if there's a focused element or a
+ // keyboard modifier key is present
+ if ( hasFocus || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
var triggered = true;
diff --git a/js/reveal.min.js b/js/reveal.min.js
index 278d5e8..958d271 100644
--- a/js/reveal.min.js
+++ b/js/reveal.min.js
@@ -64,10 +64,11 @@ if(am.length){am[am.length-1].classList.remove("visible");r("fragmenthidden",{fr
if(al.length){al[al.length-1].classList.remove("visible");r("fragmenthidden",{fragment:al[al.length-1]});return true;}}return false;}function O(){clearTimeout(k);
if(Y){k=setTimeout(x,Y);}}function B(){if(L()||Q()===false){a(m-1,0);}}function j(){if(L()||v()===false){a(m+1,0);}}function u(){if(L()||Q()===false){a(m,e-1);
}}function F(){if(L()||v()===false){a(m,e+1);}}function Z(){if(Q()===false){if(g().up){u();}else{var al=document.querySelector(".reveal .slides>section.past:nth-child("+m+")");
-if(al){e=(al.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}O();}function ah(am){if(document.querySelector(":focus")!==null||am.shiftKey||am.altKey||am.ctrlKey||am.metaKey){return;
-}var al=true;switch(am.keyCode){case 80:case 33:Z();break;case 78:case 34:x();break;case 72:case 37:B();break;case 76:case 39:j();break;case 75:case 38:u();
+if(al){e=(al.querySelectorAll("section").length+1)||0;m--;a();}}}}function x(){if(v()===false){g().down?F():j();}O();}function ah(an){var am=document.activeElement;
+var ao=!!(document.activeElement&&(document.activeElement.type||document.activeElement.href||document.activeElement.contentEditable!=="inherit"));if(ao||an.shiftKey||an.altKey||an.ctrlKey||an.metaKey){return;
+}var al=true;switch(an.keyCode){case 80:case 33:Z();break;case 78:case 34:x();break;case 72:case 37:B();break;case 76:case 39:j();break;case 75:case 38:u();
break;case 74:case 40:F();break;case 36:a(0);break;case 35:a(Number.MAX_VALUE);break;case 32:L()?ae():x();break;case 13:L()?ae():al=false;break;case 66:case 190:aa();
-break;case 70:ab();break;default:al=false;}if(al){am.preventDefault();}else{if(am.keyCode===27&&T){X();am.preventDefault();}}O();}function A(al){ac.startX=al.touches[0].clientX;
+break;case 70:ab();break;default:al=false;}if(al){an.preventDefault();}else{if(an.keyCode===27&&T){X();an.preventDefault();}}O();}function A(al){ac.startX=al.touches[0].clientX;
ac.startY=al.touches[0].clientY;ac.startCount=al.touches.length;if(al.touches.length===2&&R.overview){ac.startSpan=S({x:al.touches[1].clientX,y:al.touches[1].clientY},{x:ac.startX,y:ac.startY});
}}function af(aq){if(!ac.handled){var ao=aq.touches[0].clientX;var an=aq.touches[0].clientY;if(aq.touches.length===2&&ac.startCount===2&&R.overview){var ap=S({x:aq.touches[1].clientX,y:aq.touches[1].clientY},{x:ac.startX,y:ac.startY});
if(Math.abs(ac.startSpan-ap)>ac.threshold){ac.handled=true;if(ap<ac.startSpan){I();}else{ae();}}aq.preventDefault();}else{if(aq.touches.length===1&&ac.startCount!==2){var am=ao-ac.startX,al=an-ac.startY;