magnet-isohunt

magnet and torrent links for isohunt lists

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @author       @leoncastro
// @namespace    https://greasyfork.org/
// @name         magnet-isohunt
// @version      0.1
// @description  magnet and torrent links for isohunt lists
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js
// @include      https://isohunt.to/*
// @grant        GM_xmlhttpRequest
// @run-at       document-end
// ==/UserScript==

$('.table-torrents thead tr').append('<th class="links-row"><span class="glyphicon glyphicon-magnet"></span></th>');
$('.table-torrents .title-row').each(function(i,e){
 $(this).parent().append('<td class="links-row"></td>');
 var e=$(this), a=e.find('a')[0].getAttribute('href');
 GM_xmlhttpRequest({method:'GET',url:a,onload:function(r){
  var m=r.responseText.match(/\"magnet:[^\"]*\"/igm);
  var d=r.responseText.match(/\"https:\/\/torrent\.isohunt\.to\/download\.php\?id=[^\"]*\"/igm);
  var t='';
  if(m&&m[0])
   t+='<a href='+m[0]+'><span class="glyphicon glyphicon-magnet"></span></a><br>';
  if(d&&d[0])
   t+='<a href='+d[0]+'><span class="glyphicon glyphicon-download"></span></a><br>';
  $( e.parent().find('.links-row')[0] ).html(t);
 }});
});
$('.table-torrents tfooter tr').append('<td>&nbsp;</td>');