-
-
Save lightningdb/cfee260c3b7af7e65fce to your computer and use it in GitHub Desktop.
javascript: var asin_elements, asin;asin_elements = document.getElementsByName('ASIN'); if (asin_elements.length == 0) { asin_elements = document.getElementsByName('ASIN.0'); };if (asin_elements.length == 0) { alert('Sorry, this doesn\'t appear to be an Amazon book page.'); }else { asin = asin_elements[0].value; if (asin.match(/\D/) === null) { var x = window.open('http://www.goodreads.com/review/isbn/'+ asin, 'add_review'); } else { var x = window.open('https://www.goodreads.com/search?q='+ asin); } x.focus();} |
@csababorzasi Thanks. I don't currently have time to create one for LibraryThing, as I don't use it so would have to get familiar with it, but I imagine it would have a similar method for finding books, so it should be relatively easy to modify the script. Let me know how you go.
Hi @lightningdb, finally I was able to do it and it works fine, see code below. I just changed the links, that's it. First I used the links reverse that's why I didn't get it. Thanks again for making the code available, it's a great help!
javascript: var asin_elements, asin;
asin_elements = document.getElementsByName('ASIN');
if (asin_elements.length == 0) {
asin_elements = document.getElementsByName('ASIN.0');
};
if (asin_elements.length == 0) {
alert('Sorry, this doesn't appear to be an Amazon book page.');
} else {
asin = asin_elements[0].value;
if (asin.match(/\D/) === null) {
var x = window.open('https://www.librarything.com/addbooks' + asin, 'add_review');
} else {
var x = window.open('https://www.librarything.com/addbooks?search=' + asin);
}
x.focus();
}
Terrific! Glad you were able to make something work :)
This wasn't working for me with Kindle books kept loading goodreads and saying Page Unavailable An unexpected error occurred. We will investigate this problem as soon as possible — please check back soon!
So I changed the following URLs and seems to be working now. Tested on Kindle, Paperback and Hardback and goodreads loads each time.
Changed:
var x = window.open('https://www.goodreads.com/search?q='+ asin);
To:
var x = window.open('https://www.goodreads.com/book/isbn?isbn='+ asin);
Working Bookmarklet:
javascript: var asin_elements, asin;asin_elements = document.getElementsByName('ASIN'); if (asin_elements.length == 0) { asin_elements = document.getElementsByName('ASIN.0'); };if (asin_elements.length == 0) { alert('Sorry, this doesn\'t appear to be an Amazon book page.'); }else { asin = asin_elements[0].value; if (asin.match(/\D/) === null) { var x = window.open('http://www.goodreads.com/review/isbn/'+ asin, 'add_review'); } else { var x = window.open('https://www.goodreads.com/book/isbn?isbn='+ asin); } x.focus();}
Awesome, thanks @SirGryphin
Thank you very much, I much appreciate it for making this public!
Yet, would you be able to make a similar one for LibraryThing as well (https://www.librarything.com/)? I want to add my kindle library title to LibraryThing, tried changing the search address but it doesn't work this way.