From 8e4790820937003ee6401fea49782ce98b429371 Mon Sep 17 00:00:00 2001 From: anekos Date: Wed, 6 Jan 2010 11:04:01 +0000 Subject: -filter オプションを追加 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36352 d0d07461-0603-4401-acd4-de1884942a52 --- zip-de-download.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'zip-de-download.js') diff --git a/zip-de-download.js b/zip-de-download.js index 6ddb4be..47a2804 100644 --- a/zip-de-download.js +++ b/zip-de-download.js @@ -1,5 +1,5 @@ let INFO = - @@ -22,7 +22,7 @@ let INFO =

:zipd :zipdownload - :zipdownload -list downloadPath + :zipdownload -list -filter=filter downloadPath

downloadPathへZIPでアーカイブする。 @@ -38,6 +38,9 @@ let INFO = -listオプションを指定すると、ダウンロードされるURLをリストする。 (ダウンロードはされない)

+

+ -filterオプションを指定すると、マッチするURLのアイテムのみダウンロードする。 +

@@ -47,7 +50,18 @@ let INFO =

ダウンロード先ディレクトリ。downloadPathを省略した場合に、使用される。

例 - :let g:zipDownloadDir=~/downloads + :let g:zipDownloadDir="~/downloads" +

+
+
+ + g:zipDownloadFilter + g:zipDownloadFilter + liberator.globalVariables.zipDownloadFilter + +

デフォルトのフィルタfilterを省略した場合に、使用される。

+

例 + :let g:zipDownloadFilter="\.(jpe?g|gif|png)$"

@@ -200,7 +214,7 @@ let SITE_INFO = [ return null; }, getURLs: function(info){ - let filter = new RegExp(info.filter ? info.filter : "."); + let filter = new RegExp(info.filter || liberator.globalVariables.zipDownloadFilter || "."); let i = 0; for (let elm in liberator.modules.util.evaluateXPath(info.xpath, content.document)){ let url; @@ -260,6 +274,9 @@ let SITE_INFO = [ if ("-xpath" in arg){ option.xpath = arg["-xpath"]; } + if ("-filter" in arg){ + option.filter = arg["-filter"]; + } if ("-list" in arg){ let [file, urls, comment] = self.download(arg[0], true, option); let xml = <> @@ -282,6 +299,7 @@ let SITE_INFO = [ [["-list","-l"], liberator.modules.commands.OPTION_NOARG], [["-append","-a"], liberator.modules.commands.OPTION_NOARG], [["-xpath","-x"], liberator.modules.commands.OPTION_STRING], + [["-filter","-f"], liberator.modules.commands.OPTION_STRING], ], completer: liberator.modules.completion.file }, true); -- cgit v1.2.3