Lists of Bests GreaseMonkey Script
|
It started out with wanting to learn enough GreaseMonkey in order to complete the following task: 'Write a GreaseMonkey script that, if you are on a URL that starts with http://www.listsofbests.com/list/, it will automatically replace the contents of that web page with a simple numerical list of all the books in the given list.' |
Thanks to everybody who responded via comments to that and the followup post. In particular Tyler Trafford, who helped me specifically with problems I was having with my script as it evolved and then worked out how to add the final touches to get it all going with the asynchronous nature of GM_xmlhttpRequest().
Here's the script as it currently looks. If anybody wants to try it, then they will need to install the GreaseMonkey add-on. I can't remember if I had to then restart Firefox. If it's been successfully installed, there will be a little monkey icon in the bottom right of the status bar in Firefox.
To install the script, just right click on the link and select "View User Script Source". At the top of that page, you will see an Install button. Clicking on that will automatically install it.
Now, if you go to any of the specific lists under http://www.listsofbests.com and you have this GreaseMonkey script enabled, the webpage will be dynamically reworked to convert it into just a single numeric list containing the list entries. No having to load multiple pages for the longer lists. No having to wade through all the surronding webpage bling to get to what you want.
From there it's easy to "Select All" and Copy and Paste the text to another file.
What it even nicer is that this works for any of the lists on this site, not just the book ones. It works for Music, Movies, Places, People and More.
I'm sure that further tweaks could be done to this script, but it seems to work well as it is, and this whole exercise has inspired me to try to write some more scripts to get the meaty parts out of other web pages in a simpler format.
[Technorati Tag: GreaseMonkey]
( Sep 29 2007, 09:33:11 AM PDT ) [Listen] Permalink
Comments are closed for this entry.














