Torrentz.com - Infohash link from index sites

By daniel Rozenberg Last update Mar 21, 2007 — Installed 463 times.
// ==UserScript==
// @name           Torrentz.com - Infohash link from index sites
// @namespace      grease1 DOT daniboy AT antichef DOT com
// @description    This script will create a link from a torrent's infohash to Torrentz.com
// @include        http://demonoid.com/files/details/*
// @include        http://*.demonoid.com/files/details/*
// @include        http://isohunt.com/torrent_details/*
// @include        http://*.isohunt.com/torrent_details/*
// @include        http://mininova.org/det/*
// @include        http://*.mininova.org/det/*
// @include        http://torrentspy.com/torrent/*
// @include        http://*.torrentspy.com/torrent/*
// @date           2007-03-21
// @version        0.1
// @GM_version     0.6.7
// ==/UserScript==

/* On default, works for:
    - Demonoid.com
    - isoHunt.com
    - Mininova.org
    - TorrentSpy.org
*/

window.addEventListener('load', actOnLoad, false);

// This function will search for the hash (any 40 hexadecimal digits long string), and replace it
function actOnLoad() {
  
  var reHash = /[0-9a-f]{40}/gi;
  
  // UGLY!!! But it works, and does it's job for all sites ;)
  document.body.innerHTML = document.body.innerHTML.replace(reHash, "<a href=\"http://www.torrentz.com/$&\" target=\"_parent\">$&</a>");
  
}