aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2011-07-13 03:53:28 +0900
committeranekos2011-07-13 03:53:28 +0900
commitd853d84bc3fe4b508f270a9928ed1612460e6249 (patch)
treea99d52ba7349b259cddf043a29899c9b0cd4b05e
parent5ceba92120243943856fd7d03e91f11326ae70ed (diff)
downloadvimperator-plugins-d853d84bc3fe4b508f270a9928ed1612460e6249.tar.bz2
エントリ移動のマッピングを count 対応にした
-rw-r--r--google-plus-commando.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/google-plus-commando.js b/google-plus-commando.js
index a289ff2..052adac 100644
--- a/google-plus-commando.js
+++ b/google-plus-commando.js
@@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
// INFO {{{
let INFO =
<>
- <plugin name="GooglePlusCommando" version="1.1.0"
+ <plugin name="GooglePlusCommando" version="1.1.1"
href="http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/google-plus-commando.js"
summary="The handy commands for Google+"
lang="en-US"
@@ -58,6 +58,15 @@ let INFO =
function click (elem)
buffer.followLink(elem, liberator.CURRENT_TAB);
+ function withCount (command) {
+ return function (count) {
+ if (count < 1)
+ count = 1;
+ for (let i = 0; i < count; i++)
+ command();
+ };
+ }
+
const Conf = (function () {
let gv = liberator.globalVariables;
let conf = {};
@@ -116,22 +125,22 @@ let INFO =
};
const Commands = {
- next: function () {
+ next: withCount(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 () {
+ }),
+ prev: withCount(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'),
@@ -160,14 +169,16 @@ let INFO =
];
if (!gv)
return;
+ let func = Commands[cmd];
mappings.addUserMap(
[modes.NORMAL],
gv.split(/\s+/),
cmd + ' - Google plus Commando',
- function () {
- Commands[cmd]();
+ function (count) {
+ func(count);
},
{
+ count: func.length === 1,
matchingUrls: RegExp('^https://plus\\.google\\.com/*')
}
);