March 26, 2006
I have been using Sage as my feed reader. It’s a great Firefox extension, and it’s very easy to develp with. It took me a little while to get started, so here are my brief notes on how to start hacking your local Sage copy. Thanks to Thomas Themel from the Sage mailing list for getting me started.
Before you start, setup your Firefox for development. Particularly you will need to install the Extension Developer extension. This will allow you to reload you extension during development without having to close and re-start Firefox each time.
Install Sage and bounce Firefox. The .xpi file you downloaded is just a zip file. Installing it unpacks it into your extensions directory.
Go into your profile directory. On Linux this is, from your home directory, .mozilla/firefox/default.XY/extensions/NUMBER/chrome. The NUMBER will be the most recent by date, as sage is the most recent extension you have installled.
Create a new sage directory.
Move sage.jar to the new sage directory.
Run jar xvf sage.jar (assuming you have the jar tool – it comes with any recent version of java). You might be able to use something like WinZip for this. This extracts the files in sage.jar into the current directory.
Rename sage.jar to sage.jar.old
Edit chrome.manifest: replace all jar: references with relative URLs, like changing
content sage jar:chrome/sage.jar!/content/
content sage chrome/sage/content/
In install.rdf comment out the <em:file> section.
In your profile directory, .mozilla/firefox/default.XY edit (or create) user.js and add:
to turn on Sage’s logging.
You are ready to go. Edit one of the files in the new sage directory.
To reload changes, use the Extension Developer plugin, and do ‘Reload all chrome’
Much more information on Extension Development is available from the MozillaZine extension development center
Happy Hacking !
March 20, 2006
I’ve started using Sage as my feed reader. It’s a very nice Firefox plugin, but was missing a few things I wanted. Coincidentally I’d been wanting to learn more about Firefox plugins, and I had a free weekend (update: more like a few weeks!)…
Here is a patch to apply to the most recent version of Sage from CVS, as of this post. This patch should be applied from within src/. This patch adds:
- A count of unread items by the feed name, with a setting to turn it on / off.
- A timeout on the request of each thread. This defaults to 5 seconds and is configurable via the settings screen.
- The name of the creator of each post, if there is one, in the feed item list box (bottom of sidebar). This is particularly useful for group blogs.
Or install the full extension directly (save the file locally, then File/Open it). Note that this is the latest version from CVS, not the released version, so you’re on your own if it goes wrong (it’s the version I use all the time, so hopefully it’ll be fine!).
Note that Sage 1.4 doesn’t currently respect the preference not to automatically update feed titles. If you use custom feed titles this will overwrite them.
Update: The patch and full version should work in English, French, German, Spanish and Japanese. Further translations welcome.
If you install it, your sage will look like this:
More technical details on the patch follow…
I added a couple of methods to commonfunc.js, one to get the unread item count for a feed, another to update it. The update method gets called from updatechecker.js when the feeds are updated, and from various parts of sage.js when one or more items are marked as read / unread.
I had originally wanted to put the getUnreadItemCount and updateUnreadItemCount methods in sageFeed.js, but this is only accessible via the idl, and I could not figure out how to pass the resource (lastResource) into the idl.
I save the number of updated items as a preference, because I couldn’t think of another easy way to store persistent data.
I hope you like the patch.