aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stella.js79
1 files changed, 44 insertions, 35 deletions
diff --git a/stella.js b/stella.js
index 3511cd0..001d150 100644
--- a/stella.js
+++ b/stella.js
@@ -39,7 +39,7 @@ let PLUGIN_INFO =
<name lang="ja">すてら</name>
<description>For Niconico/YouTube/Vimeo, Add control commands and information display(on status line).</description>
<description lang="ja">ニコニコ動画/YouTube/Vimeo 用。操作コマンドと情報表示(ステータスライン上に)追加します。</description>
- <version>0.26.8</version>
+ <version>0.27.0</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -744,8 +744,9 @@ Thanks:
get command () this._command,
get description () this._description,
get thumbnail () this._thumbnail,
- get completionItem () ({
- text: this.command,
+ get completionText () this.command,
+ completionItem: function (index) ({
+ text: [this.completionText, index + ': ' + this.description],
description: this.description,
thumbnail: this.thumbnail
})
@@ -1679,40 +1680,48 @@ Thanks:
true
);
- commands.addUserCommand(
- ['strel[ations]'],
- 'relations - Stella',
- function (args) {
- if (!self.isValid)
- return U.raiseNotSupportedPage();
-
- let arg = args.string;
- let url = self.player.has('makeURL', 'x') ? makeRelationURL(self.player, arg) : arg;
- liberator.open(url, args.bang ? liberator.NEW_TAB : liberator.CURRENT_TAB);
- },
- {
- argCount: '*',
- bang: true,
- completer: function (context, args) {
+ let (lastCompletions = []) {
+ commands.addUserCommand(
+ ['strel[ations]'],
+ 'relations - Stella',
+ function (args) {
if (!self.isValid)
- U.raiseNotSupportedPage();
- if (!self.player.has('relations', 'r'))
- U.raiseNotSupportedFunction();
-
- context.title = ['Tag/ID', 'Description'];
- context.keys = {text: 'text', description: 'description', thumbnail: 'thumbnail'};
- let process = Array.slice(context.process);
- context.process = [
- process[0],
- function (item, text)
- (item.thumbnail ? <><img src={item.thumbnail} style="margin-right: 0.5em; height: 3em;"/>{text}</>
- : process[1].apply(this, arguments))
- ];
- context.completions = self.player.relations.map(function (rel) rel.completionItem);
+ return U.raiseNotSupportedPage();
+
+ let arg = args.literalArg;
+ let index = (/^\d+:/)(arg) && parseInt(arg, 10);
+ if (index > 0)
+ arg = lastCompletions[index - 1].command;
+ let url = self.player.has('makeURL', 'x') ? makeRelationURL(self.player, arg) : arg;
+ liberator.open(url, args.bang ? liberator.NEW_TAB : liberator.CURRENT_TAB);
},
- },
- true
- );
+ {
+ literal: 0,
+ argCount: '*',
+ bang: true,
+ completer: function (context, args) {
+ if (!self.isValid)
+ U.raiseNotSupportedPage();
+ if (!self.player.has('relations', 'r'))
+ U.raiseNotSupportedFunction();
+
+ context.title = ['Tag/ID', 'Description'];
+ context.keys = {text: 'text', description: 'description', thumbnail: 'thumbnail'};
+ let process = Array.slice(context.process);
+ context.process = [
+ process[0],
+ function (item, text)
+ (item.thumbnail ? <><img src={item.thumbnail} style="margin-right: 0.5em; height: 3em;"/>{text}</>
+ : process[1].apply(this, arguments))
+ ];
+ lastCompletions = self.player.relations;
+ context.completions =
+ self.player.relations.map(function (rel, index) rel.completionItem(index + 1));
+ },
+ },
+ true
+ );
+ }
},
addPageInfo: function () {