Last active
June 9, 2022 17:56
-
-
Save guilhermeprokisch/a4b01d4b37db989978c89a05c1c183c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Amazon to Z-library | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Add link to libgen on all ebook products | |
// @author Nobody | |
// @match https://www.amazon.*/* | |
// @match https://www.amazon.com/* | |
// @match https://www.amazon.com.br/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var button = document.querySelector("#tmmSwatches > ul"); | |
var name = document.querySelector("h1 > span#ebooksProductTitle, h1 > span#productTitle"); | |
name = encodeURI(name.innerText.replace(/ *\([^)]*\) */g, "")) | |
var li = document.createElement("li"); | |
li.setAttribute("class", "swatchElement unselected"); | |
li.setAttribute("style", '"width: 122px'); | |
var span0 = document.createElement("span"); | |
span0.setAttribute("class", "a-list-item"); | |
var span1 = document.createElement("span"); | |
span1.setAttribute("class", "a-button a-spacing-mini a-button-toggle format"); | |
var span2 = document.createElement("span"); | |
span2.setAttribute("class", "a-button-inner"); | |
var span3 = document.createElement("span"); | |
span3.innerHTML = "See on Z-library"; | |
var br = document.createElement("br"); | |
var span4 = document.createElement("span"); | |
span4.setAttribute("class", "a-color-secondary"); | |
var span5 = document.createElement("span"); | |
span5.setAttribute("class", "a-size-base a-color-secondary"); | |
span5.appendChild(document.createTextNode("$ 0.00")) | |
li.appendChild(span0); | |
span0.appendChild(span1); | |
span1.appendChild(span2); | |
span3.appendChild(br) | |
span3.appendChild(span4) | |
span4.appendChild(span5) | |
var a = document.createElement("a"); | |
a.setAttribute("href", "https://b-ok.cc/s/?q=" + name); | |
a.setAttribute("class", "a-button-text"); | |
a.setAttribute("target", "_blank"); | |
a.setAttribute("role", "button"); | |
a.appendChild(span3); | |
span2.appendChild(a); | |
button.appendChild(li); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment