diff options
author | teramako | 2009-02-18 14:58:08 +0000 |
---|---|---|
committer | teramako | 2009-02-18 14:58:08 +0000 |
commit | 933dc405a105717e0dd0f466c092f892b827d6ed (patch) | |
tree | db5b7578ab2f3be2805c16ea18481cafae29446c /pluginManager.js | |
parent | bd056c444764ca9720d4988dab31ba446b893004 (diff) | |
download | vimperator-plugins-933dc405a105717e0dd0f466c092f892b827d6ed.tar.bz2 |
pm install の補完機能追加
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@30247 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'pluginManager.js')
-rw-r--r-- | pluginManager.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/pluginManager.js b/pluginManager.js index 31233ac..145b0a7 100644 --- a/pluginManager.js +++ b/pluginManager.js @@ -768,6 +768,36 @@ HTMLStack.prototype = { // {{{ // }}} // -------------------------------------------------------- +// CODEREPOS_PLUGINS +// -----------------------------------------------------{{{ +var CODEREPOS = (function(){ + const codeURL = 'http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/'; + const indexURL = 'http://vimperator.kurinton.net/plugins/info.xml'; + var public = { + plugins: [], + init: function(){ + this.plugins = []; + util.httpGet(indexURL, function(xhr){ + let xml = new XMLList(xhr.responseText); + let plugins = xml.plugin; + for (let i=0, length = plugins.length(); i < length; i++){ + public.plugins.push(new CodeReposPlugin(plugins[i])); + } + }); + } + }; + function CodeReposPlugin(xml){ + this.name = tags.name(xml); + this.URL = tags.updateURL(xml); + this.description = tags.description(xml); + this.version = tags.version(xml); + } + public.init(); + return public; +})(); +// }}} + +// -------------------------------------------------------- // Vimperator Command // -----------------------------------------------------{{{ commands.addUserCommand(['plugin[help]'], 'list Vimperator plugins', @@ -858,6 +888,15 @@ commands.addUserCommand(['pluginmanager', 'pm'], 'Manage Vimperator plugins', (plugin.items.description || '-') ]).filter(function(row) row[0].toLowerCase().indexOf(context.filter.toLowerCase()) >= 0); + } else if (args[0] == "install"){ + context.title = ["PluginName", "Name: Description"]; + context.completions = CODEREPOS.plugins.filter(function($_) + $_.URL.toLowerCase().indexOf(context.filter.toLowerCase()) >= 0 + ).filter(function($_){ + return !getPlugins().some(function(installed){ + return installed.items.updateURL ? installed.items.updateURL == $_.URL : false; + }); + }).map(function(plugin) [plugin.URL, plugin.name + ": " + plugin.description]); } } } |