tkrkt
6/8/2017 - 5:02 AM

[userscript] [OReilly] Add Amazon link into O'Reilly Japan

[userscript] [OReilly] Add Amazon link into O'Reilly Japan

// ==UserScript==
// @name         [O'Reilly] O'Reilly Japan to Amazon
// @description  Add Amazon link into O'Reilly Japan
// @namespace    https://gist.github.com/tkrkt
// @version      1
// @match        https://www.oreilly.co.jp/books/*
// @grant        none
// ==/UserScript==

const container = document.querySelector('#buy_print_book');
const book = document.querySelector('#content .title [itemprop=name]');
if (container && book) {
    const link = document.createElement('a');
    link.href = `http://www.google.com/search?hl=ja&q=${book.textContent}+amazon&btnI`;
    link.textContent = "I'm Feeling Amazon";
    container.appendChild(link);
    console.error(link);
}