amazon logo loves booko logo

Automatically lookup amazon books on booko

by

in

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);
        }
    });
})();

Comments

One response to “Automatically lookup amazon books on booko”

  1. spacebat Avatar
    spacebat

    I remember BookBurro on greasemonkey back in the day. There is a successor for Firefox that might be useful in extending your tampermonkey script http://userscripts-mirror.org/scripts/show/65482

Leave a Reply

Your email address will not be published. Required fields are marked *