root/lang/javascript/vimperator-plugins/branches/2.1/appinfo.js

Revision 34181, 1.4 kB (checked in by hogelog, 14 months ago)
  • firefox/thunderbird/songbird のGUIDなどのアプリケーション情報を調べるプラグイン appinfo.js
Line 
1// PLUGIN_INFO//{{{
2var PLUGIN_INFO =
3<VimperatorPlugin>
4    <name>{NAME}</name>
5    <description>show application information</description>
6    <author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
7    <version>0.0.1</version>
8    <minVersion>2.0pre</minVersion>
9    <maxVersion>2.1</maxVersion>
10    <license>CC0</license>
11    <detail><![CDATA[
12
13== COMMANDS ==
14appinfo [information]:
15    echo and copy mozilla information
16
17     ]]></detail>
18</VimperatorPlugin>;
19//}}}
20
21(function() {
22    const appinfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
23    commands.add(['appinfo'], 'show application information',
24        function(args) {
25            if (args.length==1) {
26                util.copyToClipboard(appinfo[args.string], true);
27            } else {
28                let descs = [[i,appinfo[i]] for(i in appinfo) if(i!="QueryInterface")];
29                let list = template.genericTable(descs, { title: ["Application Information", "Value"] });
30                commandline.echo(list, commandline.HL_INFOMSG);
31            }
32        },{
33            argCount: '?',
34            completer: function(context, args) {
35                context.title = ["Application Information", "Value"];
36                context.completions = [[i,appinfo[i]] for(i in appinfo) if(i!="QueryInterface")];
37            },
38        });
39})();
40// vim: fdm=marker sw=4 ts=4 et:
Note: See TracBrowser for help on using the browser.