Last active
October 16, 2015 20:58
-
-
Save jayme-github/becb38ac3577574df74e to your computer and use it in GitHub Desktop.
CouchPotato xREL
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 CouchPotato xREL | |
// @author jayme-github | |
// @namespace https://github.com/jayme-github/ | |
// @downloadURL https://gist.githubusercontent.com/jayme-github/becb38ac3577574df74e/raw/CouchPotato-xREL.user.js | |
// @version 0.1 | |
// @description add xREL search link to wanted page | |
// @match http://192.168.2.240:8083* | |
// @match http://127.0.0.1:8083* | |
// @require http://code.jquery.com/jquery-latest.min.js | |
// @copyright 2015+, jayme-github | |
// @grant GM_xmlhttpRequest | |
// ==/UserScript== | |
function add_xRel(event) { | |
console.log('xRel: ' + event.data.source); | |
setTimeout(function() { | |
$(".imdb.action.icon2").each(function() { | |
if ( !$(this).siblings('.xrel').length ) { | |
var imdbaction = $(this); | |
urlsplit = imdbaction.attr('href').split('/'); | |
imdbid = urlsplit[urlsplit.length - 2]; | |
//console.log(imdbid); | |
var xrel = GM_xmlhttpRequest({ | |
method: "GET", | |
url: "http://www.xrel.to/search-instant.html?_ac=11540&q=" + imdbid, | |
onload: function(response) { | |
xrelurl = $(response.responseText).find(".big").attr('href'); | |
$('<a title="xREL" href="'+xrelurl+'" target="_blank" class="xrel">xREL</a>').insertBefore($(imdbaction)); | |
} | |
}); | |
} | |
}); | |
}, 1000); | |
} | |
$(document).ready(function() { | |
$('.tab_home').click({source: "home"}, add_xRel); | |
$('.tab_wanted').click({source: "wanted"}, add_xRel); | |
$('.tab_manage').click({source: "manage"}, add_xRel); | |
add_xRel({data : {source: "main"}}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey.
Can you tell me something about this script?
Where can I put that into, to enable it CP?
What does it do?
Jus searching imdb within xrel? What is the output?
THX a lot