aboutsummaryrefslogtreecommitdiffstats
path: root/uuid.js
diff options
context:
space:
mode:
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: