Goodreads Local Library Search

By Iain Mullan Last update Mar 21, 2009 — Installed 86 times.

Modified for isbn or title search with templating

in
Subscribe to Modified for isbn or title search with templating 2 posts, 2 voices



Yoni Samlan User

Love the script. Here's a modified version with a few changes that allows for URLs that don't just stick the title on the end (my library seems to care about the order of the request variables, which is totally ridiculous), and that allows you to search by ISBN13 if your library lets you (more accurate than a title search). You can still use it for just title searches by putting {{title}} in your base_url, this is just a little more flexible.

Here goes:

// ==UserScript==
// @name Goodreads ISBN/Title Library Search
// @namespace http://yonisamlan.com
// @include http://www.goodreads.com/book/show/*
// ==/UserScript==

//To use your own library here, just replace the library_name and base_url with ones that match yours.
//In the url, use {{title}} or {{isbn13}} to use those items in the search URL.

var library_name = "Minuteman Library"; //Eastern MA
var base_url = 'http://library.minlib.net/search/i?SEARCH={{isb...;

var title = document.getElementById('bookPageTitle').innerHTML;
var isbn13 = document.body.innerHTML.match(/isbn13: [\dX]{13}/)[0].replace("isbn13: ","");

var search_url = base_url.replace("{{isbn13}}",isbn13).replace("{{title}}",title);

var linksDiv = document.getElementById('affiliateLinks');

var full = document.createElement('span');
full.setAttribute('style', 'font-weight:bold');

var txtNode = document.createTextNode(library_name);
var link = document.createElement('a');
link.setAttribute('href', search_url);
link.setAttribute('target', '_blank');
link.appendChild(txtNode);

full.appendChild(document.createTextNode(' '));
full.appendChild(link);
full.appendChild(document.createTextNode(' | '));

linksDiv.insertBefore(full,linksDiv.childNodes[3]);

 
Iain Mullan Script's Author
FirefoxMacintosh

Hi Yoni!

Glad you liked the script. Amazingly i've only just come across your post (4 months late!). I would have expected UserScripts to send me email notification or something when someone comments on one of my scripts but nevermind ...

To be honest I didn't expect much general interest in this script anyway, I put it together mostly for myself and my family - so cool that you found it! I like your modifications too, I did consider trying to make it as generic/re-usable as possible but only had time to put together a quick-n-dirty version for personal use. Plus my raw Javascript skills aren't brilliant!

Cheers
Iain

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel