From c7941e6fd3553e93c4f171500b14a2ad5c9b0d89 Mon Sep 17 00:00:00 2001 From: trapezoid Date: Thu, 19 Jun 2008 14:48:05 +0000 Subject: CVS HEADに対応 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@14270 d0d07461-0603-4401-acd4-de1884942a52 --- direct_bookmark.js | 26 ++++++++++------------- sbmcommentsviewer.js | 59 +++++++++++++++++++--------------------------------- 2 files changed, 32 insertions(+), 53 deletions(-) diff --git a/direct_bookmark.js b/direct_bookmark.js index 7ceef06..4902a1b 100644 --- a/direct_bookmark.js +++ b/direct_bookmark.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Direct Post to Social Bookmarks' -// Version: 0.10 -// Last Change: 05-Jun-2008. Jan 2008 +// Version: 0.11 +// Last Change: 19-Jun-2008. Jan 2008 // License: Creative Commons // Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid // Parts: @@ -553,20 +553,16 @@ }, {}); liberator.commands.addUserCommand(['sbm'],"Post to Social Bookmark", function(arg){ - var res = liberator.commands.parseArgs(arg, this.args); - var comment = arg; + var comment = ""; var targetServices = useServicesByPost; - if(res){ - if(res.opts.length > 0){ - res.opts.forEach(function(opt){ - switch(opt[0]){ - case '-s': - if (opt[1]) targetServices = opt[1]; - break; - } - }); - comment = res.args.join(" "); + for(var opt in arg){ + switch(opt){ + case '-s': + if (arg[opt]) targetServices = arg[opt]; + break; + case 'arguments': + if(arg[opt].length > 0) comment = arg[opt].join(" "); } } @@ -610,7 +606,7 @@ return [0, [[match_result[1] + "[" + tag + "]","Tag"] for each (tag in liberator.plugins.direct_bookmark.tags) if (m.test(tag) && match_result[1].indexOf('[' + tag + ']') < 0)]]; }, - args: [ + options: [ [['-s','-service'], liberator.commands.OPTION_STRING], ] } diff --git a/sbmcommentsviewer.js b/sbmcommentsviewer.js index abfbe4e..49abdc4 100644 --- a/sbmcommentsviewer.js +++ b/sbmcommentsviewer.js @@ -3,7 +3,7 @@ * @name SBM Comments Viewer * @description List show Social BookMark Comments * @description-ja ソーシャル・ブックマーク・コメントを表示します - * @version 0.1a + * @version 0.1b * ==/VimperatorPlugin== * * Usage: @@ -441,43 +441,26 @@ commands.addUserCommand(['viewSBMComments'], 'SBM Comments Viewer', //{{{ var format = (liberator.globalVariables.def_sbm_format || 'id,timestamp,tags,comment').split(','); var countOnly = false, openToBrowser = false; var url = buffer.URL; - var res = liberator.commands.parseArgs(arg, this.args); - if (res){ - if (res.args.length > 0){ - res.args.forEach(function(arg){ - switch(arg){ - case '-c': - case '-count': - countOnly = true; - break; - case '-b': - case '-browser': - openToBrowser = true; - break; - default: - url = arg; - } - }); - } - if (res.opts.length > 0){ - res.opts.forEach(function(opt){ - switch(opt[0]){ - case '-t': - if (opt[1]) types = opt[1]; - break; - case '-f': - if (opt[1]) format = opt[1]; - break; - case '-c': - countOnly = true; - break; - case '-b': - openToBrowser = true; - break; - } - }); + for (var opt in arg){ + switch(opt){ + case '-c': + case '-count': + countOnly = true; + break; + case '-b': + case '-browser': + openToBrowser = true; + break; + case '-t': + if (arg[opt]) types = arg[opt]; + break; + case '-f': + if (arg[opt]) format = arg[opt]; + break; + case "arguments": + if (arg[opt].length > 0) url = arg[opt][0]; + break; } - if (res.args[0]) url = res.args[0]; } for (var i=0; i