From 1a8b95fa09be6cb33963670ede9678f48d056568 Mon Sep 17 00:00:00 2001 From: anekos Date: Fri, 5 Feb 2010 10:29:42 +0000 Subject: fopen を書き直し&ヘルプを追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36628 d0d07461-0603-4401-acd4-de1884942a52 --- lo.js | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 113 insertions(+), 36 deletions(-) (limited to 'lo.js') diff --git a/lo.js b/lo.js index 831ee3a..db09d17 100644 --- a/lo.js +++ b/lo.js @@ -56,36 +56,105 @@ let PLUGIN_INFO = // }}} // INFO {{{ let INFO = - - anekos - New BSD License - -

-

- - :lopen - :lo - :linkopen - :lopen! -where=where link - -

- Open selected link. - When used "!", open links in foreground. -

-

The values of where option

-
-
f, n, t
Open the link in new tab.
-
b
Open the link in new background tab.
-
c
Open the link in current tab.
-
w
Open the link in window.
-
-
-
-
; +<> + + anekos + New BSD License + +

+

+ + :fo + :fopen + :filteropen + :fopen! -where=where -interval=interval filter + +

+ Open the links selected with filter. + interval is the interval of link opening. +

+

The values of where option

+
+
f, n, t
Open the link in new tab.
+
b
Open the link in new background tab.
+
c
Open the link in current tab.
+
w
Open the link in window.
+
+
+
+ + :lopen + :lo + :linkopen + :lopen! -where=where link + +

+ Open selected link. + When used "!", open links in foreground. +

+

The values of where option

+
+
f, n, t
Open the link in new tab.
+
b
Open the link in new background tab.
+
c
Open the link in current tab.
+
w
Open the link in window.
+
+
+
+
+ + anekos + New BSD License + +

+

+ + :fo + :fopen + :filteropen + :fopen! -where=where -interval=interval filter + +

+ filter で選択されたリンクを開きます。 + interval はリンクを開く間隔です。 +

+

where オプションの値

+
+
f, n, t
新しいタブに開く
+
b
バックグラウンドの新しいタブに開く
+
c
現在のタブに開く
+
w
新しいウインドウに開く
+
+
+
+ + :lopen + :lo + :linkopen + :lopen! -where=where link + +

+ 選択されたリンク(link)を開きます。 +

+

where オプションの値

+
+
f, n, t
新しいタブに開く
+
b
バックグラウンドの新しいタブに開く
+
c
現在のタブに開く
+
w
新しいウインドウに開く
+
+
+
+
+; // }}} // Usage: @@ -119,7 +188,7 @@ let INFO = (link.href && link.href.indexOf('http') == 0); function lmatch (re, link) - (isHttpLink(link) && (link.href.match(re) || link.textContent.toString().match(re))); + ((link.href.match(re) || link.textContent.toString().match(re))); function getLinks () Array.slice(content.document.links).filter(isHttpLink); @@ -131,7 +200,7 @@ let INFO = } function filteredLinks (word) { - let links = Array.slice(content.document.links); + let links = getLinks(); if (word.match(/^\s*$/)) return links; let re = makeRegExp(word); @@ -162,9 +231,12 @@ let INFO = let [i, links] = [1, filteredLinks(args.join(''))]; if (!links.length) return; + liberator.open(links[0].href, where); + if (links.length <= 1) return; + let interval = (args['-interval'] || liberator.globalVariables.fopen_default_interval || 1) * 1000; foihandle = setInterval(function () { try { @@ -178,14 +250,17 @@ let INFO = }, { bang: true, - argCount: '1', + literal: 0, options: [ [['-interval', '-i'], commands.OPTION_INT], - [['-where', '-w'], commands.OPTION_STRING], + [['-where', '-w'], commands.OPTION_STRING, null, WHERE_COMPLETIONS] ], completer: function (context, arg) { context.title = ['URL', 'Text Content']; - context.completions = filteredLinks(context.filter).map(function (it) ([it.href, it.textContent])); + // 本来の補完の絞り込みを抑止 + let filter = context.filter; + context.filter = ""; + context.completions = filteredLinks(filter).map(function (it) ([it.href, it.textContent])); }, }, true @@ -196,7 +271,9 @@ let INFO = 'Stop filtered open', function () { clearInterval(foihandle); - } + }, + {}, + true ); } -- cgit v1.2.3