Greasy Fork

Anti-DMCA (Download DMCA'd Torrents from KAT)

Created by PXgamer & Dr.YeTii

目前为 2015-10-21 提交的版本。查看 最新版本

// ==UserScript==
// @name        Anti-DMCA (Download DMCA'd Torrents from KAT)
// @namespace   PXgamer
// @include     *kickass.so/*
// @include     *kickass.to/*
// @include     *kat.ph/*
// @include     *kat.cr/*
// @include     *kickassto.co/*
// @include     *katproxy.is/*
// @include     *thekat.tv/*
// @version     4.2
// @grant       none
// @description Created by PXgamer & Dr.YeTii
// ==/UserScript==

if ($('.alertfield').length==1) {
    var hash = $('#tab-technical .lightgrey').text().split(': ')[1];
    var name = window.location.pathname.split('/')[1];
    name = name.substring(0, name.lastIndexOf("-"));
    var trackers = [];
    $('#trackers_table tr').each(function() {
      trackers.push({'url':$('td:eq(0)', $(this)).text(), 'seed':$('td:eq(3)', $(this)).text(), 'leech':$('td:eq(4)', $(this)).text()});
    })
    trackers.sort(function(a, b) {
    var x = a['seed']; var y = b['seed'];
    return ((x < y) ? -1 : ((x > y) ? 1 : 0));
    });
    for (var i=0;i<trackers.length;i++){
      console.log(trackers[i].url + ' - ' + trackers[i].val);
    }
    var tracker = trackers[trackers.length-1].url;

    var values = '<div class="seedLeachContainer" title="These are the last updated values, they are likely not up to date"><div class="seedBlock"><span class="seedLeachIcon"></span>seeders: <strong itemprop="seeders">'+trackers[trackers.length-1].seed+'</strong></div><div class="leechBlock"><span class="seedLeachIcon"></span>leechers: <strong itemprop="leechers">'+trackers[trackers.length-1].leech+'</strong></div></div>';

    var style = '.alertfield {margin: 0px auto 5px;}'+
        '.siteButton.verifTorrentButton .buttonPic {margin-right: 0px;}'+
        '.siteButton.verifTorrentButton .buttonPicMagnet {linear-gradient(rgb(153, 135, 80), rgb(140, 122, 64)) repeat scroll 0% 0% transparent;padding-right: 1px;margin-right: 12px;}'+
        '.siteButton.verifTorrentButton:hover .buttonPicMagnet{linear-gradient(#857540, #7E6B2E) repeat scroll 0% 0% transparent;}'+
        '.siteButton.verifTorrentButton .buttonPicTorrent {margin-left: 3px;}'+
        '.px {margin-left: 5px;} .rotate .arrow-bg {-webkit-transform: rotate(180deg);-moz-transform: rotate(180deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=2);}'+
        '#123 { display : flex; align-items : center;}';
    
    var verified = '';
    if ($('.tabs.tabSwitcher').prev().text().indexOf('Torrent verified') >= 0) {
        verified = '<em title="Torrent is Verified" class="kaGiantButton px" data-nop=""><i class="ka ka-verify"></i></em>';
    }
    var boxopusURL = 'http://boxopus.com/landing/download?link=' + encodeURIComponent('magnet:?xt=urn:btih:'+hash+'&amp;dn='+name+'&amp;tr='+tracker);
    
    var buttonGroup = '<div id="123" class="buttonsline downloadButtonGroup clearleft novertpad"><style>'+style+'</style><a class="kaGiantButton ajaxLink px" href="/messenger/create/?text=Hey,%0Acheck%20out%20[torrent='+hash+']" title="Send in a Private Message"><i class="ka ka-message"></i></a><a class="kaGiantButton ajaxLink px" title="Add torrent to personal RSS" href="/bookmarks/add/rss/'+hash+'/"><i class="ka ka-rss"></i></a>'+verified+'<a href="magnet:?xt=urn:btih:'+hash+'&amp;dn='+name+'&amp;tr='+tracker+'" rel="nofollow" title="Magnet link download" class="kaGiantButton px" data-nop="" ><i class="ka ka-magnet"></i></a>'+
        '<a href="http://torcache.net/torrent/'+hash+'.torrent" class="siteButton kaGiantButton px" rel="nofollow" title="Torcache download"><span>Torcache</span></a>'+
        '<a href="http://thetorrent.org/'+hash+'.torrent" class="siteButton kaGiantButton px" rel="nofollow" title="TheTorrent download"><span>TheTorrent</span></a>'+
        '<a href="http://itorrents.org/torrent/'+hash+'.torrent" class="siteButton kaGiantButton px" rel="nofollow" title="iTorrents download"><span>iTorrents</span></a>'+
        '<a href="'+boxopusURL+'" target="_blank" class="siteButton kaGiantButton px" rel="nofollow" title="Boxopus download"><span>Boxopus</span></a>'+
        '<a title="More Locations" rel="nofollow" id="more" style="padding: 0px 7px 0px 10px ! important;" class="siteButton kaGiantButton px moreButton"><span class="more-arrow">Show More<div style="display: inline-block; width: 15px; background-image: url(&quot; https://openmerchantaccount.com/img/bottom-arrow.png&quot;); background-repeat: no-repeat; margin-bottom: -2px; background-position: center center; margin-left: 7px; background-size: 11px auto; height: 13px;" class="arrow-bg"></div></span></a>'+
        '<a href="/community/show/95496/" class="kaGiantButton px" title="More Information?"><i class="ka ka-faq"></i></a>'+
        '</div>'+
        `<div id="more-dialog" title="More Locations" style="display: none; margin: 0 auto; padding-bottom: 10px;">
             <a href="http://www.torrenthound.com/hash/`+hash+`/" class="siteButton kaGiantButton px" rel="nofollow" title="Torrent Hound"><span>TorrentHound</span></a>
             <a href="https://torrentproject.se/`+hash+`/" class="siteButton kaGiantButton px" rel="nofollow" title="Torrent Project"><span>TorrentProject</span></a>
             <a href="http://www.btcache.me/torrent/`+hash+`/" class="siteButton kaGiantButton px" rel="nofollow" title="BT Cache"><span>BTCache</span></a>
             <a href="http://torrage.info/torrent.php?h=`+hash+`/" class="siteButton kaGiantButton px" rel="nofollow" title="Torrage"><span>Torrage</span></a>
             <a href="https://torrentz.eu/`+hash+`/" class="siteButton kaGiantButton px" rel="nofollow" title="Torrentz"><span>Torrentz</span></a>
         </div>`;
    $('.alertfield').after(values+buttonGroup)
    
    $(document).delegate('#more', 'click', function() {
        $('#more-dialog').toggle(1000);
        $('.more-arrow').toggleClass('rotate');
		var cache = $('.more-arrow').children();
        if ($('.more-arrow').hasClass('rotate')) {
            $('.more-arrow').text('Show Less').append(cache);
        }
        else {
            $('.more-arrow').text('Show More').append(cache);
        }
    });
}