Created
September 13, 2015 09:28
-
-
Save ZikiSoy/fc4449bd82aa64588c99 to your computer and use it in GitHub Desktop.
scripts
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 BtBook Utilities | |
// @namespace http://github.com/zikisoy | |
// @version 0.1 | |
// @description Add magnet link to BtBook! | |
// @author hmmm | |
// @match http://www.btbook.net/search/* | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// @grant GM_xmlhttpRequest | |
// @grant GM_openInTab | |
// @copyright 2014+, ZikiSoy | |
// ==/UserScript== | |
// a function that loads jQuery and calls a callback function when jQuery has finished loading | |
function addJQuery(callback) { | |
var script = document.createElement("script"); | |
//script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"); | |
script.setAttribute("src", "//code.jquery.com/jquery-1.11.0.min.js"); | |
script.addEventListener('load', function() { | |
var script = document.createElement("script"); | |
script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();"; | |
document.body.appendChild(script); | |
}); | |
document.body.appendChild(script); | |
} | |
addJQuery(function(){}); | |
var jQ=jQuery.noConflict(true); | |
jQ('.download').css('display', 'inline'); | |
/* | |
jQ('.item-title a').each(function() { | |
var it = jQ(this); | |
var link = it.attr('href'); | |
var pat = /detail\/(.*)\.html$/ | |
var hs = pat.exec(link); | |
console.log(hs); | |
if (hs[1]) { | |
it.after(' <a href="magnet:?xt=urn:btih:' + hs[1] + '">Download</a>'); | |
} | |
}) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment