Tibs Manor

Thursday, August 10, 2006

BGGreaseMonkey

(Download the script here.)

I ran into an annoyance with emailing my Flickr contacts a few days ago, which prompted me to install the GreaseMonkey Firefox extension, along with a script that solved the problem. If you read the comments on that page you'll see that I found a small bug and fixed it. From there it was a short step to wanting to write my own GreaseMonkey script for something. I settled on (surprise!) an enhancement to BoardGameGeek.

But first - what is GreaseMonkey, you may be asking? It basically allows you to execute JavaScript on existing webpages. There's a wealth of scripts available at userscripts.org, and if you know JavaScript you can write your own. You can fully modify the DOM, adding and removing elements from the page as you see fit. It also includes a way to make requests over http. So for instance, you could have a script that:

Anyway, my script takes an individual game profile page on BGG, and adds a link to do a price search. When you click the link, the script extracts the name and id of the game, queries a number of online retailers, and displays the results. Click the image below to see an animation of this in action. The problem is that as far as I know, none of these retailers have a way to search via BGG id, and so I have to make do with text searches. For a fairly unique name like Candamir or Tempus this works out pretty well, but searching for something like Ra on most of these sites will return hundreds of results. Even the fairly unique names can have problems on some retailers if there are multiple language editions, or a "ding & dent" special.

The script does display the name of the game, so if you search for "Ra" and the script finds "Affenraffen", you'll instantly see the issue. I added a way to edit the store-specific id's for each game, which is an annoying manual process to be sure. Best case scenario would be if I had some cheap webhosting with PHP or JSP or something and a database...that could keep a repository of user-corrected id's, and I could modify the GM script to work in conjunction with that. But even as it stands now, I tend to revisit pages over and over when I'm compiling a game order, so it's still worth the time for me to manually correct a few entries. And as I said, for some games it works great right out of the box.

(Download the script here.)

1 Comments:

  • Sorry about that - fixed it and re-uploaded to userscripts.org, if you reinstall the script it should work now.

    By Blogger Tom, at 10:18 PM  

Post a Comment

<< Home