From 0cd123b3dd4edbcad4b6f79fc93ffcf3a4caa0df Mon Sep 17 00:00:00 2001 From: Nick Krichevsky Date: Mon, 23 Feb 2015 14:13:02 -0500 Subject: [PATCH] Add page down and page up support for traversing windows --- popup.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/popup.js b/popup.js index c005b0a..588e893 100644 --- a/popup.js +++ b/popup.js @@ -301,7 +301,7 @@ document.addEventListener('DOMContentLoaded', function() { }); //Workaround to prevent letters from triggering events. filterInput.addEventListener('keydown', function(event){ - if (event.keyCode!=40 && event.keyCode!=38 && event.keyCode!=13){ + if (event.keyCode!=40 && event.keyCode!=38 && event.keyCode!=13 && event.keyCode!=33 && event.keyCode!=34){ event.stopPropagation(); } if (event.keyCode===16){ @@ -361,14 +361,15 @@ document.addEventListener('DOMContentLoaded', function() { shiftDown = true; } - //If down is pressed, traverse through tabs. - else if (event.keyCode===40){ + //If down is pressed, traverse through tabs. If page down is pressed, traverse through windows. + else if (event.keyCode===40 || event.keyCode===34){ event.preventDefault(); event.stopPropagation(); if (document.activeElement===filterInput){ filterInput.blur(); } - if (shiftDown){ + //If shift and down are pressed, or page down is pressed, traverse through windows + if (shiftDown || event.keyCode===34){ if (windowKeyIndex=0) windowList[windowKeyIndex].classList.remove('keyHover'); @@ -422,11 +423,11 @@ document.addEventListener('DOMContentLoaded', function() { } } //If up is pressed, traverse through tabs - else if (event.keyCode===38){ + else if (event.keyCode===38 || event.keyCode===33 ){ event.preventDefault(); event.stopPropagation(); - //If shift is down switch windows - if (shiftDown){ + //If shift is down, or page up is pressed, traverse windows + if (shiftDown || event.keyCode===33){ if (windowKeyIndex>0){ windowList[windowKeyIndex].classList.remove('keyHover'); if (tabKeyIndex>=0)