2015-09-11 03:47:41 +02:00
|
|
|
// ==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
|
2015-09-11 17:45:50 +02:00
|
|
|
// @match http://torrentz.eu/*
|
|
|
|
// @match http://torrentz.me/*
|
2015-09-11 03:47:41 +02:00
|
|
|
// @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]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|