From 44e4d125f9b0b24dfeebbe5e995395d8676e28d3 Mon Sep 17 00:00:00 2001 From: snaka Date: Sun, 24 May 2009 08:13:39 +0000 Subject: :pino コマンドに -list オプションを追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33541 d0d07461-0603-4401-acd4-de1884942a52 --- pino.js | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) (limited to 'pino.js') diff --git a/pino.js b/pino.js index d7faa9b..365996c 100644 --- a/pino.js +++ b/pino.js @@ -41,13 +41,16 @@ var PLUGIN_INFO = _libly.js snaka MIT style license - 1.2.4 + 1.3.0 で先頭のn件(デフォルト5件、グローバル変数で調整可能) - をバックグラウンドのタブで開きます。 - で補完候補の一覧にピンを立てた記事の一覧から選択することもできます。 - count を指定すると、その件数だけ開きます。 + :[count]pino: + そのままで先頭のn件(デフォルト5件、グローバル変数で調整可能) + をバックグラウンドのタブで開きます。 + で補完候補の一覧にピンを立てた記事の一覧から選択することもできます。 + count を指定すると、その件数だけ開きます。 + 以下のオプションが指定可能です。 + -list: + ピンの一覧を表示します。 == グローバル変数 == g:pinoOpenItemsCount: @@ -140,6 +146,18 @@ let self = liberator.plugins.pino = (function() { "Open livedoor Reader(and clone server) pinned item", function(args) { let pins = new Pins(); + + if (args["-list"]) { + let items = pins.items(); + let list =
{items.length} items.
    {[ +
  • {i.title}
  • + for each (i in items) + ].reduce(function(a, b) a + b)} +
; + liberator.echo(list, commandline.FORCE_MULTILINE); + return; + } + if (args.string == "") { let pin; let max = (args.count >= 1) ? args.count : openItemsCount(); @@ -150,11 +168,7 @@ let self = liberator.plugins.pino = (function() { for(let i = 0; i < max; i++) { if (!(pin = pins.shift())) break; - setTimeout( - function(link) liberator.open(link, openBehavior()), - 200 * i, - pin.link - ); + setTimeout(function(link) liberator.open(link, openBehavior()), 200 * i, pin.link); } } else { @@ -172,6 +186,9 @@ let self = liberator.plugins.pino = (function() { [i.link, i.title] for each (i in pins.items()) ]; }, + options: [ + [["-list", "-l"], commands.OPTION_NOARG] + ] }, true // for Debug ); @@ -318,5 +335,4 @@ self.api = {}; self.api[p] = self[p] for each (p in "items head remove".split(' ')) ]; - // vim: ts=2 sw=2 et fdm=marker -- cgit v1.2.3