Last night I “repaired” a bookmarklet allowing you to search for material in your local library from Amazon.com using John Udell’s code from his LibraryLookup bookmarklet generator. Here’s the code if you live in Toronto: Amazon > Toronto Public Library search. Just drag the link to your bookmark bar (the link bar below your address form in the browser in which you are currently reading this post).
How I “Repaired” the Javascript
Wish I could say I am a brilliant javascripter, but that couldn’t be farther from the truth. But, I am very stubborn and had to get this to work after having dinner with someone who’s brother wrote an Amazon bookmarklet for his local library. While most library’s do an excellent job of returning a specific search, Amazon has done a great job of enabling you to “browse” the collection in an “e-tail” environment in place of a “retail” location like Barnes and Noble or Indigo/Chapters.
I knew I had read about Amazon to local library search before but didn’t have much interest because neither Richmond city nor Henrico county had a great library system to search. Toronto has an excellent public library system. If you live here, you should read the Wikipedia entry. It is an impressive institution and, according to Wikipedia, has the largest circulation in North America and the second-highest number of visits per year, in the world, after the Hong Kong library system.
Anyway, on with the fix so you can try to build one for your local system as well.
1. Visit the LibraryLookup Project homepage.
2. Start by visiting the system software links in the 3rd paragraph (Innovative, Voyager, iPac, DRA, and Talis at the time of this post). Chances are your local library system already has a search tool. You can search for your city (or college or university) by using your browser’s page search function to locate the existing link by keyword.
If it isn’t there, then you can do the following:
3. Visit your library’s website and do a quick search for a book you know they have in circulation. Look at the URL. For example, from Toronto:
http://hip.tpl.toronto.on.ca/ipac20/ipac.jsp?session=E18H87367I106.731071&profile=
rs&source=~!rs&view=subscriptionsummary&uri=full=1100021~!3135138~!3&ri=
1&aspect=subtab37&menu=search&ipp=20&spp=20&staffonly=&term=steven+brust&index=
GW&uindex=&aspect=subtab37&menu=search&ri=1
Please note the bold text where it says ‘ipac’ as this is rather important. Your library’s may say something different.
4. Go to the LibraryLookup Generator page. Enter your library’s base URL. That actually didn’t work for the TPL as the search page results have a different parameter. I couldn’t use ‘http://www.torontopubliclibrary.ca’ and had to do a search and replace that with the beginning of the search result page ‘http://hip.tpl.toronto.on.ca’. Simply putting that in the Base URL page might work (and does with the TPL system).
I didn’t catch the simple fix and ended up replacing the ‘index’ text to ’session’ to match the TPL system’s search URL text. I only mention this because there could be some recent changes by your library system from an existing bookmarklet and a quick comparison between the two existing URLs might show you the answer.
5. Visit Amazon.com (or Amazon.ca if you’re in Canada) and dig down to an individual book (or dvd, cd or whatever) entry and click on the bookmarklet link in your browser. The only requirement for the bookmarklet to work is the Amazon page must list an ISBN number. If there is no ISBN number, the script won’t respond even to give a failed response. If the material isn’t available in the library sytem, the bookmarklet, through the library, will generate a page saying the search failed to generate any matches.
6. The current javascript in the bookmarklet (in Firefox on a Mac) will open a pop-up page in the background. So, you might have to move the main browser window aside to see your results.
Anyway, enjoy. Hopefully you can use this to help yourself. But, do buy something from Amazon now and then. They do have a great site for perusing and we should support their endeavor so they don’t eventually get bought out by Walmart and we know how that would end. Nothing, ever, with questionable language.
If anything is missing from this, tell me in the comments and I’ll get an email letting me know to add info.