// ==UserScript== // @name Magnetize // @description Turn Links into magnet: URIs // @version 1.0 // @namespace http://www.adrian.kousz.ch/ // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js // @match http://torrentz.eu/* // @match http://torrentz.me/* // @grant none // ==/UserScript== $('document').ready(function () { var magnetUriPrefix = 'magnet:?xt=urn:btih:' var regex = /[0-9a-f]{40}/i $('a').each(function () { var matches = regex.exec(this.href) if (matches) { this.href = magnetUriPrefix + matches[0] } }) })