By Gautham Pai
—
Last update
May 24, 2008
—
Installed
91 times.
// ==UserScript==
// @name Search in Books iRead v 1.0
// @namespace http://buzypi.in/
// @description Search for an Amazon book in iRead
// @include http://amazon.com/*
// @include http://www.amazon.com/*
// @include http://www.amazon.co.*
// @include http://books.google.co*
// ==/UserScript==
function keyPressEvent(event){
var kcode = (event.keyCode)?event.keyCode:event.which;
var k = String.fromCharCode(kcode);
if((k == 'S' || k == 's') && event.ctrlKey && event.altKey){
searchInIRead();
}
}
function searchInIRead(){
var titleElement = document.getElementById('btAsinTitle');
var title = '';
if(titleElement != null)
title = titleElement.innerHTML;
else {
titleElement = document.getElementsByTagName('h2');
if(titleElement != null)
title = titleElement[0].innerHTML;
}
if(title != null && title != '')
document.location.href = "http://booksiread.org/search/book/"+title;
else
alert("Could not extract the title from this page.");
}
document.addEventListener("keypress", keyPressEvent, true);