From 233ef77be9131949b4561052364220d31b07b1d0 Mon Sep 17 00:00:00 2001
From: anekos
Date: Fri, 23 Sep 2011 19:54:24 +0900
Subject: subCommands を使うんやで
---
video-controller.js | 56 +++++++++++++++++++++--------------------------------
1 file changed, 22 insertions(+), 34 deletions(-)
(limited to 'video-controller.js')
diff --git a/video-controller.js b/video-controller.js
index 34c20f7..8fa22c1 100644
--- a/video-controller.js
+++ b/video-controller.js
@@ -1,5 +1,5 @@
/* NEW BSD LICENSE {{{
-Copyright (c) 2010, anekos.
+Copyright (c) 2010-2011, anekos.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
@@ -33,38 +33,17 @@ THE POSSIBILITY OF SUCH DAMAGE.
}}} */
// PLUGIN_INFO {{{
-let PLUGIN_INFO =
-
- VideoController
- VideoController
- Add :videocontrol command for HTML5 video.
- HTML5 Video のために :videocontrol コマンドを追加する。
- 1.1.0
- anekos
- new BSD License (Please read the source code comments of this plugin)
- 修正BSDライセンス (ソースコードのコメントを参照してください)
- https://github.com/vimpr/vimperator-plugins/raw/master/video-controller.js
- 2.3
- 2.3
-
-
-;
-// }}}
// INFO {{{
let INFO =
<>
-
anekos
New BSD License
-
+
-
:videocontrol
:videocontrol command arguments...
@@ -74,14 +53,14 @@ let INFO =
-
anekos
New BSD License
-
+
-
:videocontrol
:videocontrol command arguments...
@@ -105,6 +84,7 @@ let INFO =
}
let lastArgs = null;
+ let lastCommand = null;
let controlls = {
__proto__: null,
play: function (elem) {
@@ -126,7 +106,7 @@ let INFO =
HintName,
'Select video',
function (elem) {
- controlls[lastArgs[0]].apply(null, [elem].concat(lastArgs.slice(1)));
+ controlls[lastCommand].apply(null, [elem].concat(lastArgs));
},
function () '//video'
);
@@ -135,15 +115,23 @@ let INFO =
['videocontrol'],
'Control HTML5 Videos',
function (args) {
- lastArgs = args;
- hints.show(HintName);
},
{
- completer: function (context, args) {
- const completions = [[n, n] for (n in controlls)];
- context.title = ['Command', ''];
- context.completions = completions;
- }
+ subCommands: [
+ let (o = o) new Command(
+ [o[0] + '[' + o.slice(1) + ']'],
+ o + '