Greasy Fork

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

Created by PXgamer & Dr.YeTii

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

// ==UserScript==
// @name        Anti-DMCA (Download DMCA'd Torrents from KAT)
// @namespace   PXgamer
// @include     *kickass.so/*
// @include     *kickass.to/*
// @include     *kat.ph/*
// @include     *kat.cr/*
// @version     4.0
// @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;}'+
        '#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 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 class="siteButton kaGiantButton px moreButton" style="padding: 0px 0px 0px 10px !important;" id="more" rel="nofollow" title="More Locations"><span>Show More</span><i style="transform: scale(0.9); color: white; box-shadow: none; background: transparent; margin-left: -2px; margin-right: 0px !important;" class="ka ka16 ka-arrow2-up foldClose ka-180 more-arrow moreButton"></i></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>
         </div>`;
    $('.alertfield').after(values+buttonGroup)
    
    $(document).delegate('#more', 'click', function() {
          $('#more-dialog').toggle();
          $('.more-arrow').toggleClass('ka-180');
          if ($('.more-arrow').hasClass('ka-180')) {
              $('#more span').text('Show More');
          }
          else {
              $('#more span').text('Hide More');
          }
    });
}