Goodreads Plus RED

Add "Search RED" button to Goodreads

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name Goodreads Plus RED
// @namespace 
// @version 0.1
// @description Add "Search RED" button to Goodreads
// @author 
// @include http*://www.goodreads.com/* 
// @include http*://goodreads.com/*
// @grant none
// ==/UserScript==

console.log("[M+] Tweaking Goodreads...");

// Grab book title (and only title)
var bookTitle = document.getElementById("bookTitle").innerHTML.trim().split('<', 1);
console.log("Book title: " + bookTitle);
var REDSearchUrl = "https://redacted.ch/torrents.php?groupname=" + bookTitle + "&order_by=time&order_way=desc&group_results=1&filter_cat%5B3%5D=1&filter_cat%5B4%5D=1&filter_cat%5B7%5D=1&action=advanced&searchsubmit=1";

// Add 'Search RED' button
var buttonBar = document.getElementById("buyButtonContainer");
if (buttonBar === null || buttonBar == "null") {
buttonBar = document.getElementById("asyncBuyButtonContainer");
}
var buttonUl = buttonBar.getElementsByTagName("ul");
var REDButton = document.createElement("li");
REDButton.innerHTML = '<a id="REDLink" href="' + REDSearchUrl + '" target="_blank" class="buttonBar">Search RED</a>';
REDButton.className = "Button";
buttonUl[0].appendChild(REDButton);

console.log("[M+] 'Search RED' button added!");