From 0a5b187fc6376d8b14b9aa1e8bab7007e470bd0b Mon Sep 17 00:00:00 2001 From: Dwi Asharialdy Hambali Date: Mon, 23 Jan 2012 10:12:47 +0700 Subject: [PATCH] Extra shortcuts: to the first slide, to the last slide (overview) --- js/impress.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/js/impress.js b/js/impress.js index 231609d87..7f54978f0 100644 --- a/js/impress.js +++ b/js/impress.js @@ -274,11 +274,25 @@ return select(next); }; + var selectHome = function () { + return select(steps[0]); + }; + + var selectEnd = function () { + return select(steps[steps.length-1]); + }; + // EVENTS document.addEventListener("keydown", function ( event ) { - if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 34 ) || (event.keyCode >= 37 && event.keyCode <= 40) ) { + if ( event.keyCode == 9 || ( event.keyCode >= 32 && event.keyCode <= 40) ) { switch( event.keyCode ) { + case 35: ; // end + selectEnd(); + break; + case 36: ; // home + selectHome(); + break; case 33: ; // pg up case 37: ; // left case 38: // up