Permalink
Browse files

First commit mate!

  • Loading branch information...
0 parents commit 4b76c1af6c8a0c5b5fcdacdfacaf33f547445f60 @bogomil committed May 26, 2011
Showing with 79 additions and 0 deletions.
  1. +43 −0 JPersona/JPersona.js
  2. +1 −0 JPersona/Readme.md
  3. +9 −0 JPersona/main.js
  4. +26 −0 Readme.md
43 JPersona/JPersona.js
@@ -0,0 +1,43 @@
+//define contstants
+const {Cu} = require("chrome");
+
+//import LightweightThemeManager - the one responsible for handling Personas.
+const lwtm = Cu.import('resource://gre/modules/LightweightThemeManager.jsm').LightweightThemeManager;
+
+//define class element
+var JPersona =
+{
+ //define function element
+ getBGColor: function (args, callback)
+ {
+
+ var bgcolor;
+ if (lwtm.currentTheme)
+ {
+ bgcolor = lwtm.currentTheme.accentcolor;
+ callback(bgcolor);
+ }else
+ {
+ callback(null);
+ }
+ },
+ getTextColor: function(args,callback)
+ {
+ var textcolor;
+ if (lwtm.currentTheme)
+ {
+ textcolor = lwtm.currentTheme.textcolor;
+ callback(textcolor);
+ }else
+ {
+ callback(null);
+ }
+
+
+ }
+
+}
+//export object to be visible from your code
+exports.JPersona = JPersona;
+
+
1 JPersona/Readme.md
@@ -0,0 +1 @@
+In this folder you can find an example how to create a custom JetPack (addon SDK) lib with class structure and how to use it from your main.js
9 JPersona/main.js
@@ -0,0 +1,9 @@
+//import the object
+const jp = require('JPersona');
+
+//execute a function
+jp.JPersona.getTextColor("bgcolor",function(jcolor){
+
+ console.log(jcolor);
+
+});
26 Readme.md
@@ -0,0 +1,26 @@
+__About__
+
+Here you can find some cool JetPack examples and hacks. Watch the repo, the changes will be a lot :)
+
+__Follow__
+
+You can follow me on twitter: https://twitter.com/bogomep and identi.ca: http://identi.ca/bogomep
+
+
+__The License__
+
+All files in this REPO are under this LICENSE:
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
+
+ Everyone is permitted to copy and distribute verbatim or modified
+ copies of this license document, and changing it is allowed as long
+ as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.

0 comments on commit 4b76c1a

Please sign in to comment.