This instructable will show you how to extract the source code from any Firefox addon. It requires nothing more than a ZIP extraction utility and a text editor if you choose to edit and repack the source.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Locating an Addon's XPI File
An XPI file is an addon packed into a single file. You need to get this file from the addons site without jumping right into the usual installation. Find the addon you want on the addons siteaddons site, and then locate its green installation button.
NOTE: Some addons require a license agreement to be accepted beforehand. In that case, the XPI file can be saved from the button on the license acceptance page, and not the addon page itself.
Instead of just clicking the button and having Firefox take over, right click and choose "Save Link As...". Once the file transfer is done, you will have the addon package right on your computer.
Step 2: Extracting XPI File
Now that the file is on your computer, open up your personal ZIP extraction utility, and point it to the XPI file. In reality, XPI files are merely ZIP files renamed, so you can go ahead and extract the contents to a folder someplace. Common files outputted are...
With these files present, you're ready to move on.
Step 3: Extracting the Main JAR Code
Most of the core addon code is present in a JAR file found in the /chrome/ directory. You'll find that just as XPI is a rename of ZIP, so is JAR (but to a lesser extent). Using the same extraction utility, you should be able to extract the main addon files from the JAR.
Step 4: That's It!
What you have now are most of the raw source files from the addon. You can modify them as you wish, and repackage them with the modifications. Opening XPI files in Firefox will install them for you.
Always respect an authors work, and make sure they allow you to use their code. Don't just take a popular addon, change the credits, and rehost it. That is just simply stealing.