diff options
author | anekos | 2011-11-08 03:09:47 +0900 |
---|---|---|
committer | anekos | 2011-11-08 03:09:47 +0900 |
commit | 04c92c64b19124b2914c8748c39702a279ba4644 (patch) | |
tree | 353280de2c9719515fd1107966976f9880779fb5 | |
parent | d0dfb6055e9a17ea1b81b6226d4a40c6462a0781 (diff) | |
parent | 775926b1b29140d663e4e24ae8c25362f5def21b (diff) | |
download | vimperator-plugins-04c92c64b19124b2914c8748c39702a279ba4644.tar.bz2 |
Merge branch 'master' of github.com:vimpr/vimperator-plugins
-rw-r--r-- | nicolist.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/nicolist.js b/nicolist.js index 85bdb20..854a869 100644 --- a/nicolist.js +++ b/nicolist.js @@ -13,8 +13,8 @@ var INFO = <project name="Vimperator" minVersion="3.2"/> <item> <tags>:nicolist-add</tags> - <spec>:nicolist add <a>mylist-id</a></spec> - <description><p><a>mylist-id</a>で指定したマイリストに動画を追加します</p></description> + <spec>:nicolist add <a>mylist-id</a> <a>mylist-comment</a></spec> + <description><p><a>mylist-id</a>で指定したマイリストに動画を追加します。マイリストコメントの入力も可能です</p></description> </item> <item> <tags>:nicolist-delete</tags> @@ -46,14 +46,17 @@ commands.addUserCommand( 'マイリストに追加する', function (args) { let video_id = content.window.wrappedJSObject.video_id; - if (!video_id) + if (!video_id) { return liberator.echoerr('nicolist : watchページじゃない!'); + } + let [mylist_id, description] = args; + if (!description){ description = ''; } //undefinedが入っているとそれをマイリストコメントにしてしまうので。 let token = content.window.wrappedJSObject.so.variables.csrfToken; - let url = 'http://www.nicovideo.jp/api/mylist/add?group_id=' + args.literalArg + '&token=' + token + '&item_id=' + video_id; + let url = 'http://www.nicovideo.jp/api/mylist/add?group_id=' + mylist_id + '&token=' + token + '&item_id=' + video_id + '&description=' + description; liberator.echo('nicolist add : ' + JSON.parse(util.httpGet(url).responseText).status); }, { - literal: 0, + literal: 1, completer: mylistCompleter, } ), @@ -128,7 +131,7 @@ function mylistCompleter (context, args) { for ([k, v] in Iterator(JSON.parse(xhr.responseText).mylistgroup)) ]; }); - } else if (args.completeArg == 1){ + } else if (args.completeArg == 1 && !/add/.test(context.name)){ context.incomplete = true; context.title = ["id", "title"]; context.filters = [CompletionContext.Filter.textDescription]; |