Monday, February 16, 2009

Greasemonkey Hawaii State Library Lookup

John Udell wrote a Greasemonkey script called LibraryLookup several years ago that I modified to work with the University Of Hawaii's library system. LibraryLookup works in the background when you visit pages on Amazon.com and puts up an indicator if your local library has the book you are browsing.

Later, I attempted to get this script to work with the Hawaii State Public Library System (HSPLS). I quickly found out that the HSPLS was using an ipac system (good! that is on the supported list) but for some reason they have turned off searching by ISBN (are you kidding me!?). I sent someone in their IT staff an email at the time and they responded by saying it was something they would be turning back on soon. A couple years later I checked and still no ISBN search. I sent another email and the response was something about upgrading to a different catalog system. John's script worked by looking for the ISBN, and while I could see ways to get it to work by Title and Author, I never took the time to actually adapt it to do so - until now. My script does an initial search by "Author Keywords" and "Title Keywords" and then looks at the content of the resulting page for an ISBN match. Here is the code:



So to use the code download it to your computer and name it something like hspls.user.js. Then, if you have Greasemonkey installed and open the file with your browser, it should ask you if you want to install the script. After installing the script, whenever you visit a book's page on amazon.com the script will check the HSPLS's site to determine if they have the book. When it finishes this lookup it will append a link to the Amazon page right after the book's title. The link will contain either the text HSPLS(Yes) or HSPLS(No:#). In the case of Yes, an exact ISBN match was found. In the case of No, the ISBN was not found and the # will contain the number of books that were found given the search term that was submitted. The following screen shot shows an example where the lookup failed but indicated 6 possible fuzzy matches:



Ok, that was a bad example! One of the fuzzy matches is the actual book under a different ISBN, oh well. Did I just spend 2 hours of my day off polishing up that script? Yes, I guess I did.

No comments:

Post a Comment