By Tanel
—
Last update
Aug 13, 2007
—
Installed
246 times.
// ==UserScript==
// @name TorrentChecker
// @namespace iisonly (iisonly@gmail.com)
// @description Checks Torrent files (leecher/seeder status) with http://torrent-check.t00lz.de
// @include *
// ==/UserScript==
var linkscount = document.getElementsByTagName('a').length;
for(var i = 0; i < linkscount; i++){
var url = document.getElementsByTagName('a')[i].href;
var start = url.length-8;
if(url.substr(start,8) == ".torrent" || url.substr(0,28) == "http://www.mininova.org/get/"){
if(GM_getValue("confirm", true).toString()=="1") {
document.getElementsByTagName('a')[i].href='javascript:if(confirm("Do you want to check this torrent with torrent-check.t00lz.de?")){window.open("http://torrent-check.t00lz.de/url/' + encodeURIComponent(url.substr(7,url.length-7)) + '",\'\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=600\');}else{ location.href="'+ encodeURIComponent(url) +'";}void(0);';
}
else
document.getElementsByTagName('a')[i].href='javascript:window.open("http://torrent-check.t00lz.de/url/' + encodeURIComponent(url.substr(7,url.length-7)) + '",\'\', \'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=600\');void(0);';
}
}
function confirmtrue(){
return GM_setValue("confirm", 1)
}
function confirmfalse(){
return GM_setValue("confirm", 0)
}
function prompt_torrent(){
var url = prompt("Insert torrent URL.", "http://");
if(url!=null && url != ""){
window.open("http://torrent-check.t00lz.de/url/" + encodeURIComponent(url.substr(7,url.length-7)),'', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=900,height=600');
}
return null;
}
GM_registerMenuCommand("TorrentChecker : confirm ON", confirmtrue);
GM_registerMenuCommand("TorrentChecker : confirm OFF", confirmfalse);
GM_registerMenuCommand("TorrentChecker : Insert URL", prompt_torrent);