T411 - Download torrents from search

Simple script to download torrents directly from the search page on T411

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         T411 - Download torrents from search
// @name:fr      T411 - Download torrents from search
// @namespace    https://greasyfork.org/en/scripts/10550-t411-search-downloader
// @version      1.1.3
// @description  Simple script to download torrents directly from the search page on T411
// @description:fr  Ce script vous permet de télécharger des torrents directement depuis la page de recherche / les listes de torrents.
// @author       Mato
// @match        *://*.t411.al/torrents/search/*
// @match        *://*.t411.al/top/week/*
// @match        *://*.t411.al/top/today/*
// @match        *://*.t411.al/top/month/*
// @match        *://*.t411.al/my/bookmarks/*
// @grant        none
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

var icon = 'http://img15.hostingpics.net/pics/151761download512000000.png';

$(document).ready(function() {
    $data = $('table.results tbody tr');

    // nfo link differs if on bookmark page
    if (document.URL.match('bookmarks') !== null) {
        $nfoChild = 4;
    } else {
        $nfoChild = 3;
    }

    // add download column
    $('table.results thead tr th:last-child').after('<th>DL</th>');

    $.each($data, function(index, val) {
        $tid = $(val).find('td:nth-child(' + $nfoChild + ') a').attr('href').match(/\?id=(.+)/);

        $(val).find('td:last-child').after('<td><span style="float: right; padding-right: 10px;"><a href="' + window.location.origin + '/torrents/download/?id=' + $tid[1] + '"><img src="'+icon+'" title="Télécharger le torrent" alt="↓ Download" /></a></span></td>');
    });
});