Tuesday, February 7, 2006

Chickenfoot Script: Dump current HTML

I wrote a Chickenfoot script that dumps the current HTML of a page to a file. This has been really handy at work, so I thought I should share it. Basically, when you want to work on the HTML of a web page that is dynamically created by JavaScript, it helps to be able to dump the the HTML of the page to a file so you can work with it offline. (I think it makes more sense to edit the HTML in Emacs and refresh the browser than it does to edit the JavaScript and relaunch the entire webapp.)

Other seemingly sensible approaches fall short:

  1. Doing a "View Page Source," "Select All," "Copy," and "Paste" into an empty Emacs buffer doesn't cut it because you want the HTML that has been generated rather than the original HTML.

  2. Copying the DOM as XML from the DOM Inspector gives you the current state in XML rather than HTML. I think you can get this to work if you add an XHTML doctype to your output, but it hardly seems worth it because then you have to work in XHTML instead of HTML

  3. "Save Page As..." doesn't work on all pages, probably because it is trying to pull down all of the stylesheets and images in addition to dumping the HTML, which is something that my script does not do. Because I own the pages that I'm trying to dump with this script, I can copy all of the images and CSS into the folder that contains the HTML file that my script outputs. Since those are static files that do not change often, this works well, in practice, and is likely faster than "Save Page As..." would be if it worked, anyway.



My script also lets you scrub the <SCRIPT> tags from the HTML, which is often what you want in cases like this. Those tags often contain JavaScript to generate HTML for the page, but if the HTML has already been generated, then you don't want that JavaScript to run again when you load the dumped HTML in a web browser.

Saturday, January 21, 2006

Birthday Module for Google Personalized Homepage

I decided to create a Birthday Module to learn the Google Homepage API. I think that it's a handy widget to have on your home page, but I admit that entering the birthday data is a little difficult because you have to enter all of it in one box. Even though Google-provided modules, such as the Stock Market module, allow you to support a variable number of items through the module's preferences, that capability is not available to modules created with the Homepage API. (Hence, one box with a lot of data delimited by semicolons.)

Also, I have bundled a small Easter Egg with the Birthday Module -- try to be the first to find it and figure out how I hid it!

Sunday, January 15, 2006

Progress on TargetAlert 0.9

Last night, I made a considerable amount of progress on TargetAlert 0.9. In my last post, I mentioned that things were going slow because I was getting bogged down with XML serialization; however, I recently abandoned that approach for storing user prefs in favor of using JSON. This allowed me to dramatically reduce the amount of boilerplate serialization code I had to write, so hopefully I'll release TargetAlert 0.9 shortly after Chickenfoot 0.6 is out the door (which is more relevant than you might expect).

Sunday, January 8, 2006

TargetAlert 0.8.9.7 Released

I've received quite a bit of email from Firefox 1.5 users asking me to restore the option to have TargetAlert icons appear after a link when a user mouses over it, so I have done so in TargetAlert 0.8.9.7. (In 0.8.9.6, instead of displaying the icon at the end of the link, it would transform the cursor into the TargetAlert icon, which a number of users found annoying.) Ultimately, I would like to provide users with the option of converting the cursor, but simply rolling back the change was the quickest fix. This option is now planned for TargetAlert 0.9.

From the TargetAlert Roadmap, it may appear that everything is planned for version 0.9, as it has been for some time. You may be wondering why there hasn't been much progress. Well, the main reason is that the bulk of the code that needs to be written is not very much fun to write. Serializing XML and error-checking user input just aren't my idea of a good time. (Please remember that I work on TargetAlert for free, as a hobby, and that will continue to be the case until some people start clicking on my PayPal Donate link!)

Besides, I've recently been working on some other things that I find more entertaining.

Sunday, January 1, 2006

Google Web Search API in JavaScript

When I got back from India and started hacking on Firefox, I wrote a Python script to generate the JavaScript necessary to access the Google Web Search API as part of Google Dominoes. I never took the time to clean up the JavaScript code and publish it online before, but now that we have Chickenfoot, which makes it much easier to experiment with JavaScript APIs, I decided that it was finally time to make it publicly available. The Python script for converting the WSDL is called wsdl2js, and the JavaScript for the Google Search API is in Google Search.js. Happy hacking.

Saturday, December 17, 2005

Chickenfoot Posted on Reddit!

Chickenfoot was posted on reddit.com yesterday! I had no idea, and if jenn didn't call four times to tell me, I might have missed it -- thank you so much, jenn!

For those of you who don't know, reddit.com is a new site for tech news that is quickly growing in popularity. It has received high marks from Joel on Software and Paul Graham, as well as many other authors on the Web.

Right now, Chickenfoot is at the top of the hot list -- it's even listed above Matt Groening on the future of Futurama. I think I'll enjoy this brief stint as being more popular than the creator of The Simpsons :)

And if you want to help get the word out about Chickenfoot, then please head over to reddit and hit the little up arrow to the left of the title link (Chickenfoot for Firefox: Rewrite the Web) to give it a point -- I really appreciate your support!

Sunday, December 11, 2005

TargetAlert 0.8.9.6 Released

I released TargetAlert 0.8.9.6 this evening. The only new feature is the addition of the Slovak locale, which was voluntarily provided by Peter of www.slovaksoft.com. Thanks Peter!