I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Wednesday 20 February 2008

Firefox extensions

I have been fooling around with firefox extensions and tried one of my own. There are a few easy things to remember: create a chrome directory with the following structure:
  • chrome ->
    • content ->
      • - extensionname.js
      • - extensionname.xul
      • - overlay.xul
    • locale->
      • en-US->
        • - extensionname.dtd
        • - extensionname.properties
        • - overlay.dtd
      • skins->
  • components->
  • defaults->
    • preferences->
  • - chrome.manifest
  • - install.rdf
Here is a little summary of the purpose of all these files: - the content directory contains the core of the extension, an overlay.xul file which defines some modifications to an existing xul file. The extensionname.xul file contains a xul file for the visualisation of the application, and the extensionname.js contains javascript code used for interaction purposes - the locale contains dtd and property files for the possible localisation of the extension. For each possibility, there is a directory with the name of the locale. The dtd are used for xul files, while the properties files are for javascript files. - the defaults directory is used for things related with the user profile, - while the components contains possible XPCOM components. Finally, install.rdf gives some information about the extension, while the manifest file chrome.manifest indicates on which xul file the overlay is applied and the place where the extension is to be found. To simplify the work, I use a templating method to generate extensions from some definition files. To package the extension once the install.rdf and the manifest file have been correctly edited, you only need to zip it with an ".xpi" as file extension.