I love books and I love booko. So I decided to help Amazon help me check prices on booko with a little Tampermonkey script. It makes the ISBN-13 on Amazon a clickable link that will open a new tab to booko and search for that ISBN. Give it a go!
// ==UserScript==
// @name booko amazon ISBN link
// @namespace https://emacstragic.net/
// @version 0.1
// @description Make the ISBN-13 a clickable link to booko.
// @author Jason Lewis jason@NOdicksonSPAM.st
// @match https://www.amazon.com/*
// @copyright 2016+, emacstragic.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
//var hrefs = new Array();
var elements = $('#productDetailsTable > tbody > tr > td > div > ul > li');
elements.each(function() {
console.log($(this));
//console.log($(this)[0].innerText);
if ($(this)[0].innerText.indexOf('ISBN-13') !== -1 ) {
var isbn=$(this)[0].innerText.replace(/ISBN-13:\s*(\d{3}-\d{10})/,"$1");
console.log('isbn is: ' + isbn);
var url = 'https://booko.com.au/' + isbn;
var a = document.createElement("a");
var text = document.createTextNode('ISBN-13: ' + isbn);
a.setAttribute('href',url);
a.setAttribute('target','_blank');
a.appendChild(text);
var li = document.createElement("li");
li.appendChild(a);
$(this)[0].replaceWith(li);
}
});
})();
Leave a Reply