pastebin - collaborative debugging tool
kpaste.net RSS


Torrentz.eu: magnet and direct links
Posted by Anonymous on Sun 27th Dec 2015 11:48
raw | new post

  1. // ==UserScript==
  2. // @name          Torrentz.eu: magnet and direct links
  3. // @description   Automatically adds direct .torrent and magnet links on Torrentz.eu — So easy your mom could use it. Tested in Firefox and Chrome.
  4. // @author        bfredit
  5. // @include       *://torrentz.*
  6. // @include       *://tz.ai
  7. // @include       *://torrentz*.*
  8. // @match         *://torrentz.com/*
  9. // @match         *://torrentz.eu/*
  10. // @match         *://torrentz.ph/*
  11. // @match         *://torrentz.me/*
  12. // @match         *://torrentz.in/*
  13. // @match         *://torrentz.hk/*
  14. // @match         *://torrentz.de/*
  15. // @match         *://tz.ai/*
  16. // @icon          http://i.imgur.com/XN2jS.png
  17. // @screenshot    http://i.imgur.com/gYIlR.png
  18. // @screenshot    http://cl.ly/6kwz/b.png
  19. // @version       10000
  20. // /*@run-at    document-start*/
  21. //
  22. // @license     GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
  23. // @namespace https://greasyfork.org/users/2824
  24. // ==/UserScript==
  25. //
  26. // internal name: Quick Torrentz
  27. // formerly: Torrentz.eu for Your Mom
  28.  
  29. function bfr_t_activate() {
  30.         var $ = jQuery,
  31.         css = [
  32.         ".qt_links a{display: inline-block; width:10px ; height: 18px; margin-right: 4px; text-align: center; -webkit-border-radius: .3em; -moz-border-radius: 3px; border-radius: 3px; line-height:1em; text-decoration:none !important; vertical-align:top; }",
  33.         ".qt_links a:nth-child(-n+2){width:18px !important;background-image: url(http://i.imgur.com/1yfjx.png); background-repeat: no-repeat; background-position: 2px top}",
  34.         ".qt_links a:nth-child(3){right: -12px;}",
  35.         ".qt_links a:nth-child(4){right: -24px;}",
  36.         ".qt_cache:nth-child(n+3),.dnotblockmebro{position: absolute; display: none; }",
  37.         "dl:hover .qt_cache{display: inline-block}",
  38.  
  39.         ".qt_magnet{background-color: #FFB090; }",
  40.         ".qt_cache{background-color: #336699; } ",
  41.         ".qt_links a:hover{background-color: #FF5511;}",
  42.  
  43.         ".qt_separator{color:transparent !important; cursor:default !important;}",
  44.         "div.results > dl > dt {width: 648px !important; } ",
  45.         "div.results > dl > dd{width: 350px !important;} ",
  46.         "div.results > dl:hover > dd > span.v {position:relative;left: -70px; background: white;}",
  47.         //"div.results > dl:hover > dd > span.v:before {content: attr(title); }",
  48.  
  49.         ".qt_links{float: left; width: 70px; position:relative; top: -3px; opacity: .7; }",
  50.         "dl:hover .qt_links{opacity:1}",
  51.         ".u {background-repeat: no-repeat; background-position: 5px center}",
  52.         "span.Magnet   {background-image: url('http://upload.wikimedia.org/wikipedia/commons/c/c2/Magnet-icon.gif')}",
  53.         "span.Torrage {background-image: url('https://torrage.info/favicon.png')}",
  54.         "span.Torcache {background-image: url('https://torcache.net/favicon.ico')}",
  55.         "span.btcache   {background-image: url('http://www.btcache.me/app/btcache/View/images/favicon.ico')}"
  56.         ];
  57.         css = css.join("\n");
  58.         if (typeof GM_addStyle != "undefined") {
  59.                 GM_addStyle(css);
  60.         } else if (typeof PRO_addStyle != "undefined") {
  61.                 PRO_addStyle(css);
  62.         } else if (typeof addStyle != "undefined") {
  63.                 addStyle(css);
  64.         } else {
  65.                 var heads = document.getElementsByTagName("head");
  66.                 if (heads.length > 0) {
  67.                         var node = document.createElement("style");
  68.                         node.type = "text/css";
  69.                         node.appendChild(document.createTextNode(css));
  70.                         heads[0].appendChild(node);
  71.                 }
  72.         }
  73.         $(function (){
  74.                 function getHosts(hex) {
  75.                         return {
  76.                                 'Torrage':'https://torrage.info/torrent/'+hex+'.torrent',
  77.                                 'btcache':'http://btcache.me/torrent/'+hex+'.torrent',
  78.                                 'Torcache':'https://torcache.net/torrent/'+hex+'.torrent',
  79.                         }
  80.                 }
  81.                 $('.results h2, .download dd').filter(':contains(S'+'p'+'on'+'so'+'red)').parents('dl,.results').remove();
  82.  
  83.                 $('.download h2').each(function(){//needed to avoid html-to-dom on unnecessary pages
  84.                         var
  85.                                 $this = $(this),
  86.                                 name = $this.children('span').text(),
  87.                                 hex = document.location.pathname.substring(1).toUpperCase(),
  88.                                 linksString = ['<dl><dt><a href="magnet:?xt=urn:btih:'+hex+'&tr=udp%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%2Fannounce"><span class="u Magnet">Magnet Link</span> <span class="n">'+name+'</span></a></dt><dd>Magnet link</dd></dl>'],
  89.                                 hosts = getHosts(hex);
  90.  
  91.                         for(host in hosts)
  92.                                 linksString.push('<dl><dt><a href="'+hosts[host]+'"><span class="u '+host+'">'+host+'</span> <span class="n">'+name+'</span></a></dt><dd>.torrent Cache</dd></dl>');
  93.  
  94.                         //add space
  95.                         linksString.push('<dl><dt><a><span class="n qt_separator">Hey there! I didn\'t expect you here!</span></a></dt></dl>');
  96.                         $(linksString.join('')).insertAfter(this);
  97.                 });
  98.                 (function(a,b,c){document.cookie = a + '=' + escape(b + '|' + c) + ';expires=' + c + ';path=/'})('w'+'m_po'+'pundertz',Math.round(Math.random()*100+1),'124.000000');
  99.                 function addLinksToSearchResult() {
  100.                         var
  101.                                 $link = $(this),
  102.                                 hex = $link.attr('href').substring(1).toUpperCase(),
  103.                                 linksString = ['<span class="qt_links">'],
  104.                                 hosts = getHosts(hex);
  105.                         if($link.parents('dl').find('.qt_links').length) {
  106.                                 return;
  107.                         }
  108.                         linksString.push('<a class="qt_magnet" href="magnet:?xt=urn:btih:'+hex+'&tr=http%3A%2F%2Ftracker.publicbt.com%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com" title="Magnet link">');
  109.                         for(host in hosts)
  110.                                 linksString.push('<a class="qt_cache '+host+'" href="'+hosts[host]+'" title="'+host+': direct link to .torrent file">');
  111.  
  112.                         linksString.push('</span">');
  113.                         $(linksString.join('')).prependTo($link.parents('dl').children('dd'))
  114.                 }
  115.                 $('.dnotblockmebro').addClass('dont-use-scammy-ads i-wont-block-decent-ads');
  116.                 $('.results dt a').each(addLinksToSearchResult);
  117.                 $('.loader').parent('div[id]').add('#popular')
  118.                 .on('DOMSubtreeModified',function () {
  119.                         var $container = $(this).off('DOMSubtreeModified');
  120.                         setTimeout(function () {
  121.                                 $container
  122.                                 .find('dt a')
  123.                                 .each(addLinksToSearchResult)
  124.                         }, 1)
  125.                 });
  126.         });//on ready
  127. }
  128. // function setASAP (set, condition) {
  129. //      var checker = function (){
  130. //              if(condition()) {
  131. //                      clearInterval(interval);
  132. //                      set();
  133. //              }
  134. //      };
  135. //      var interval = setInterval(checker, 100);
  136. // }
  137. var scriptNode = document.createElement('script');
  138. scriptNode.setAttribute('type','text/javascript');
  139. scriptNode.textContent = '(' + bfr_t_activate.toString() + ')();';
  140. document.body.appendChild( scriptNode );

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at