Skip to content

Instantly share code, notes, and snippets.

@dobrosketchkun
Last active July 6, 2022 01:55
Show Gist options
  • Save dobrosketchkun/84a7f49ee2ef724b6d8e2db9ddaa0167 to your computer and use it in GitHub Desktop.
Save dobrosketchkun/84a7f49ee2ef724b6d8e2db9ddaa0167 to your computer and use it in GitHub Desktop.
userscript for tapermonkey, adds a link to search the title of the book on libgen
// ==UserScript==
// @name z-lib to libgen
// @namespace http://tampermonkey.net/
// @version 0.2
// @description z-lib to libgen
// @author dobrosketchkun
// @include https://*/*
// @icon https://www.google.com/s2/favicons?domain=3lib.net
// @grant none
// ==/UserScript==
(function() {
'use strict';
var asin = document.getElementsByClassName("footer-mailto")[0].getAttribute("href");
if (asin=="mailto: support@bookmail.org") {
var title = document.getElementsByClassName("col-sm-9")[0].childNodes[0].nextElementSibling.firstChild.data.trim();
var button = document.querySelector("div.bcNav");
var a = document.createElement("a");
a.setAttribute("href", "https://libgen.is/search.php?req=" + title + "&lg_topic=libgen&open=0&view=simple&res=25&phrase=1&column=def");
a.setAttribute("target", "_blank");
a.appendChild(document.createTextNode(" Search on libgen"));
button.appendChild(a);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment