< Day Day Up > |
Link to other book review and shopping sites after reading Google's book excerpts. Google Print is a wonderful service, offering a fully searchable index into books before you buy them. But when you're ready to buy, there are a limited number of choices of online bookstores to which Google provides direct links. Of course, there's more on the Web than just shopping sites. All Consuming (http://www.allconsuming.net) specializes in aggregating third-party reviews of books that people have recently blogged. This hack adds a link from Google Print to the page on All Consuming that displays reviews of the book you're interested in. 6.9.1. The CodeThis user script runs on Google Print pages. It finds the ISBN of the book you're currently viewing and adds links to the pages on All Consuming just below the link to Froogle. Save the following user script as otherbookreviews.user.js: // ==UserScript== // @name Other Book Reviews // @namespace http://diveintomark.org/projects/greasemonkey/ // @description add links to AllConsuming.net in Google Print // @include http://print.google.com/print* // ==/UserScript== // based on Butler // http://diveintomark.org/projects/butler/ var elmFroogle = document.evaluate( "//a[contains(@href, 'froogle')]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; if (!elmFroogle) return; var sISBN = unescape(elmFroogle.href).split('q=')[1].split('&')[0]; var elmAllConsuming = document.createElement("a"); elmAllConsuming.href = 'http://allconsuming.net/item/asin/' + sISBN; elmAllConsuming.style.display = "block"; elmAllConsuming.innerHTML = "<br>Reviews @<br>AllConsuming.net"; elmFroogle.parentNode.insertBefore(elmAllConsuming, elmFroogle.nextSibling); 6.9.2. Running the HackAfter installing the user script (Tools Install This User Script), go to http://print.google.com and search for Romeo and Juliet. Click the link under Book Results titled "Romeo and Juliet by William Shakespeare." In the list on the left, you will see a new link to All Consuming, as shown in Figure 6-14. 6.9.3. Hacking the HackOf course, there are other online bookstores and book services, too. ISBN.nu is an independent site that tracks book prices at several different online shopping sites. To add an additional link to look up the current book on ISBN.nu, add the following lines to the end of the script: var elmISBNnu = document.createElement("a"); elmISBNnu.href = 'http://isbn.nu/' + sISBN; elmISBNnu.style.display = "block"; elmISBNnu.appendChild(document.createTextNode("ISBN.nu")); elmFroogle.parentNode.insertBefore(elmISBNnu, elmFroogle.nextSibling); Figure 6-14. AllConsuming.net link on Google Print |
< Day Day Up > |