Sean Cogan
Sean Cogan

Reputation: 2586

How do I create a Firefox addon from a Greasemonkey script?

I have a Greasemonkey script written in JavaScript, with a CSS component, and I'd like to publish them as a single Firefox addon. I've tried using the Addon Builder with the Addon SDK, but I haven't had any success. I've also tried the User Script Compiler, to no avail. I'm just hoping someone could explain to me a simple way to package the .js file and the .css file as a Firefox addon, or how to user the Addon Builder to do this, since apparently what I've tried hasn't worked. Please, let me know if you need any more information from me, and thanks for your help!

EDIT: This is my main.js file in the Addon Builder.

 var data = require("self").data;
 var pageMod = require("page-mod");
 pageMod.PageMod({
   include: "[http://www.trello.com/board/*", "https://www.trello.com/board/*"],
   contentScriptWhen: 'end',
   contentScriptFile: data.url("scrumello_beta.js")
 });

Upvotes: 0

Views: 1249

Answers (2)

Sean Cogan
Sean Cogan

Reputation: 2586

I just wanted to let everyone know that I was able to resolve this question with Wladimir's help, and also a realization that my team and I made. I will not be posting my scrumello_beta.js file since it had nothing to do with the problem, and also since I cannot post company code. Our problem was how we were injecting our Javascript, which we resolved on our own. Thanks for all that tried to help me, I just wanted to give a bit of closure and let you all know that we're making progress now.

Upvotes: -1

Wladimir Palant
Wladimir Palant

Reputation: 57651

Your match pattern is wrong. If you take a look at the documentation, you have to specify the protocol unless you are using a host-based pattern. The following will work:

include: "http://www.trello.com/board/*",

If you want to include HTTPS connections as well then you should specify two patterns:

include: ["http://www.trello.com/board/*", "https://www.trello.com/board/*"],

Other than that your main.js seems fine. The error message you get appears to be bug 750138 which is a bad interaction with the Add-on Builder Helper extension. Reinstalling the helper extension supposedly makes the issue go away.

Upvotes: 3

Related Questions