I can't believe I ate the whole thing...

Sunday, November 09, 2008

Alternative Gift Registry

So, Jess introduced me to the Alternative Gift Registry (link), and asked me to create a bookmarklet. Having never done one before, I thought it sounded interesting. Well, I took a stab at it, and tried to gather information and populate their Add A Gift form automatically, but it didn't work too well. Then Jess suggested I create a form of my own and try to post it to the registry myself, avoiding any nasty timing issues. A great idea, for sure! So, I got it to work (at least in Safari — I haven't been able to test other browsers yet. I think it should work for IE, but again, I haven't tested...

Anyway, here's the bookmarklet. It requires that you have a registry id. You should enter it in the following box and then bookmark the link after it. Otherwise, it won't work as you expected...
Bookmarklet

So, here's how it works. You select some text on a page, and then click the bookmarklet that you just copied. You'll get a popup window that will default the title of the page as the item name and the selected text as the description for the item. This accepts HTML, so you can select images and links and really anything else. If you select images or links, the script is smart enough to fix the links so that they'll work on the registry page. You can edit either of these fields, and then enter a sort order and quantity value. Click the Add Gift or Add Gift and View Registry button, and the item will be added.

I'll be contacting AGR directly to give them this head start (since they would be able to generate the bookmarklet a little bit easier for you directly from your registry page), but I thought I'd post this here first so people can start using it.

If you get any errors, leave a comment to this post. If you want to add to this script, feel free to do so, but let me know of any additions!