2015-09-11 03:47:41 +02:00
|
|
|
// ==UserScript==
|
|
|
|
// @name TV Calendar Torrentz
|
|
|
|
// @description Make torrent search links
|
|
|
|
// @version 1.0
|
|
|
|
// @namespace http://www.adrian.kousz.ch/
|
2015-10-14 14:27:12 +02:00
|
|
|
// @require https://git.adrian.kousz.ch/adrian/userscripts/raw/master/lib.js
|
2015-09-11 03:47:41 +02:00
|
|
|
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
|
|
|
|
// @match http://www.pogdesign.co.uk/cat/*
|
|
|
|
// @grant none
|
|
|
|
// ==/UserScript==
|
|
|
|
|
|
|
|
AdiUserscriptLib.addButton('Search Torrentz', function () {
|
|
|
|
var regex = new RegExp('/cat/([^/]+)/Season-([0-9]+)/Episode-([0-9]+)')
|
2015-10-14 16:07:36 +02:00
|
|
|
var url = 'https://torrentz.eu/search?q={name}+S{season}E{episode}'
|
|
|
|
var X = AdiUserscriptLib
|
2015-09-11 03:47:41 +02:00
|
|
|
|
|
|
|
$('a').each(function () {
|
|
|
|
var matches = regex.exec(this.href)
|
|
|
|
if (matches) {
|
|
|
|
var replacements = {
|
|
|
|
name: matches[1].replace('-','+')
|
|
|
|
, season: X.pad(matches[2], 2, '0')
|
|
|
|
, episode: X.pad(matches[3], 2, '0')
|
|
|
|
}
|
|
|
|
this.href = X.interpolate(url, replacements)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|