From a676aa169fdd07e62cb4d07537b7a687f7847ab1 Mon Sep 17 00:00:00 2001 From: trapezoid Date: Thu, 11 Jun 2009 16:11:22 +0000 Subject: ldrize_cooperation_fetch_flv.js: add pinned movie to mylist git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@33910 d0d07461-0603-4401-acd4-de1884942a52 --- ldrize_cooperation.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'ldrize_cooperation.js') diff --git a/ldrize_cooperation.js b/ldrize_cooperation.js index 70d165c..966fde4 100644 --- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Cooperation LDRize Mappings' -// Version: 0.24 -// Last Change: 08-May-2009. Jan 2008 +// Version: 0.25 +// Last Change: 12-Jun-2009. Jan 2008 // License: Creative Commons // Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid // @@ -68,7 +68,9 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ var handlerInfo = [ //{ // pattern: "http://www.nicovideo.jp/*", - // handler: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]], + // handler: { + // download: ["c:\\usr\\SmileDownloader\\SmileDownloader.exe",["%URL%"]] + // }, // wait: 5000 //}, //{ @@ -263,7 +265,9 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ } }); liberator.modules.commands.addUserCommand(["pindownload"],"Download pinned links by any software", - function(arg){ self.downloadLinksByProgram(self.getPinnedItems());},{}); + function(arg){ self.downloadLinksByProgram("download",self.getPinnedItems());},{}); + liberator.modules.commands.addUserCommand(["pindo"],"Do external command, with pinned links", + function(arg){ self.downloadLinksByProgram(arg.string, self.getPinnedItems());},{}); liberator.modules.commands.addUserCommand(["toggleldrizecooperation","toggleldrc"],"Toggle LDRize Cooperation", function(arg){ self.isEnable = !self.isEnable},{}); //Options @@ -309,20 +313,20 @@ if (liberator.plugins.LDRizeCooperation == undefined) (function(){ return [linkResult,viewResult ? viewResult.textContent : null]; }); }, - downloadLinksByProgram: function(links){ + downloadLinksByProgram: function(command, links){ var self = this; var count = 0; links.forEach(function([url,title]){ for each(let x in self.handlerInfo){ if(x.include.test(url)){ setTimeout(function(){ - if(typeof x.handler == "object"){ - let args = x.handler[1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title)); - liberator.modules.io.run(x.handler[0],args,false); - }else if(typeof x.handler == "string"){ - liberator.modules.io.run(x.handler,[url],false); - }else if(typeof x.handler == "function"){ - x.handler(url.toString(),title); + if(typeof x.handler[command] == "object"){ + let args = x.handler[command][1].map(function(s) s.replace(/%URL%/g,url).replace(/%TITLE%/g,title)); + liberator.modules.io.run(x.handler[command][0],args,false); + }else if(typeof x.handler[command] == "string"){ + liberator.modules.io.run(x.handler[command],[url],false); + }else if(typeof x.handler[command] == "function"){ + x.handler[command](url.toString(),title); } },x.wait != undefined ? x.wait * count++ : 0); return; -- cgit v1.2.3