aboutsummaryrefslogtreecommitdiff
path: root/src/background
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-08-13 16:37:47 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-08-13 16:37:47 +0900
commit41069cf527ed159d6c5ff89cc77867537025c9f5 (patch)
tree5e99b3f10e6b553b0f3b0d5afa811b6133bb9798 /src/background
parentbbc8ff515efaa39c7064307ebf30e2600c4d9a6c (diff)
implement gg/G commands
Diffstat (limited to 'src/background')
-rw-r--r--src/background/key-queue.js2
-rw-r--r--src/background/keys.js2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/background/key-queue.js b/src/background/key-queue.js
index cd8d865..e21399e 100644
--- a/src/background/key-queue.js
+++ b/src/background/key-queue.js
@@ -4,6 +4,8 @@ import * as actions from '../shared/actions';
const DEFAULT_KEYMAP = [
{ keys: [{ code: KeyboardEvent.DOM_VK_K }], action: [ actions.SCROLL_UP, 1 ]},
{ keys: [{ code: KeyboardEvent.DOM_VK_J }], action: [ actions.SCROLL_DOWN, 1 ]},
+ { keys: [{ code: KeyboardEvent.DOM_VK_G }, { code: KeyboardEvent.DOM_VK_G }], action: [ actions.SCROLL_TOP ]},
+ { keys: [{ code: KeyboardEvent.DOM_VK_G, shift: true }], action: [ actions.SCROLL_BOTTOM ]},
{ keys: [{ code: KeyboardEvent.DOM_VK_H }], action: [ actions.TABS_PREV, 1 ]},
{ keys: [{ code: KeyboardEvent.DOM_VK_L }], action: [ actions.TABS_NEXT, 1 ]},
]
diff --git a/src/background/keys.js b/src/background/keys.js
index 802340d..2fd00a2 100644
--- a/src/background/keys.js
+++ b/src/background/keys.js
@@ -10,7 +10,7 @@ const hasPrefix = (keys, prefix) => {
if (keys.length < prefix.length) {
return false;
}
- for (let i = 0; i < keys.length; ++i) {
+ for (let i = 0; i < prefix.length; ++i) {
if (!identifyKey(keys[i], prefix[i])) {
return false;
}