aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2011-07-12 23:20:13 +0900
committeranekos2011-07-12 23:20:13 +0900
commitc3a8c4be4252ed16f5b05834c642591a373af749 (patch)
treef220caa7f23c3d07561db9db63d7f48672f867a9
parent9975d6da4aaa195e0020ed6ab5f825fed24cdd23 (diff)
downloadvimperator-plugins-c3a8c4be4252ed16f5b05834c642591a373af749.tar.bz2
メニューを表示しているときは、j/k でメニューを選択できるようにした
-rw-r--r--google-plus-commando.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js
index 34295eb..1ed6b96 100644
--- a/google-plus-commando.js
+++ b/google-plus-commando.js
@@ -106,7 +106,8 @@ let INFO =
get commentEditor () let (e = root.querySelector('.editable')) (e && e.parentNode),
get comment() (self.commentEditor || self.commentButton),
get plusone () root.querySelector('[g\\:type="plusone"]'),
- get share () self.buttons[3]
+ get share () self.buttons[3],
+ get menu () root.querySelector('[role="menu"]')
};
return self;
}
@@ -115,8 +116,22 @@ let INFO =
};
const Commands = {
- next: function () plugins.feedSomeKeys_3.API.feed('j', ['vkeypress'], Elements.doc),
- prev: function () plugins.feedSomeKeys_3.API.feed('k', ['vkeypress'], Elements.doc),
+ next: function () {
+ let menus = A(Elements.doc.querySelectorAll('[tabindex="0"][role="menu"]'));
+ plugins.feedSomeKeys_3.API.feed.apply(
+ null,
+ menus.length === 1 ? ['<Down>', ['keypress'], menus[0]]
+ : ['j', ['vkeypress'], Elements.doc]
+ );
+ },
+ prev: function () {
+ let menus = A(Elements.doc.querySelectorAll('[tabindex="0"][role="menu"]'));
+ plugins.feedSomeKeys_3.API.feed.apply(
+ null,
+ menus.length === 1 ? ['<Up>', ['keypress'], menus[0]]
+ : ['k', ['vkeypress'], Elements.doc]
+ );
+ },
comment: function() Elements.currentEntry.click('comment'),
plusone: function() Elements.currentEntry.click('plusone'),
share: function() Elements.currentEntry.click('share'),