aboutsummaryrefslogtreecommitdiffstats
path: root/uuid.js
diff options
context:
space:
mode:
authorhogelog2009-01-17 23:14:40 +0000
committerhogelog2009-01-17 23:14:40 +0000
commitfa7800a9eef5b9d4ab419c08bf3f084bcb607dc7 (patch)
tree3665b9f21731d5a6c796f99a8a3783ffc3d893bf /uuid.js
parentec64e0e73dc08d7ee6a663d7e10f865b5d483f6e (diff)
downloadvimperator-plugins-fa7800a9eef5b9d4ab419c08bf3f084bcb607dc7.tar.bz2
* add uuid.js: generate UUID
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@28580 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'uuid.js')
-rw-r--r--uuid.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/uuid.js b/uuid.js
new file mode 100644
index 0000000..4eea7be
--- /dev/null
+++ b/uuid.js
@@ -0,0 +1,39 @@
+// PLUGIN_INFO//{{{
+var PLUGIN_INFO =
+<VimperatorPlugin>
+ <name>{NAME}</name>
+ <description>UUID generator</description>
+ <author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
+ <version>0.1</version>
+ <minVersion>2.0pre</minVersion>
+ <maxVersion>2.0pre</maxVersion>
+ <updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/uuid.js</updateURL>
+ <detail><![CDATA[
+
+== COMMANDS ==
+uuid:
+ generate and copy UUID
+
+== THANKS ==
+http://moz-addon.g.hatena.ne.jp/ZIGOROu/20080417/1208413079
+]]></detail>
+</VimperatorPlugin>;
+//}}}
+
+(function() {
+ const Ci = Components.interfaces;
+ services.add("uuid", "@mozilla.org/uuid-generator;1", Ci.nsIUUIDGenerator);
+ const UUID = services.get("uuid");
+
+ commands.add(['uuid'], 'generate and copy UUID',
+ function(args)
+ {
+ let uuid = UUID.generateUUID().number;
+ util.copyToClipboard(uuid);
+ liberator.echo("generate "+uuid);
+ },
+ {
+ argCount: '0',
+ });
+})();
+// vim: fdm=marker sw=4 ts=4 et: