torrentz2快捷下载

在每条搜索结果左侧,添加磁链快捷下载按钮

  1. // ==UserScript==
  2. // @name torrentz2快捷下载
  3. // @namespace torrentz2
  4. // @version 0.0.2
  5. // @description 在每条搜索结果左侧,添加磁链快捷下载按钮
  6. // @author allence_frede
  7. // @include *://torrentz2is.me/search*
  8. // @grant none
  9. // @require https://code.jquery.com/jquery-3.6.0.min.js
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. var cl = 'magnet:?xt=urn:btih:'; //磁力链接协议头
  14. var icon = '<td style="display: none;"></td><td style="padding: 0;"><a href="[href]" title="磁链下载" style="width: 100%;height: 100%;cursor: pointer;display: flex;justify-content: center;align-items: center;"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAMAAAAsYw3eAAABCFBMVEX///90wNBurrxyusr07+7S0tNwuclyucdvsL5kprVemqf49PLt6Obq4+J1w9Nzvc1ttsVwtsTFwMBqsMBlrLu6s7KlpaVXjJiKk5WRk5RehIxjf4Z0gIRkeoBVdn3/UkijPjl9LSpvIBz4///y+Pj59vXn8vPw6+rv6unk4uLa3d1gydxcw9Vvvs/Uzc3Gy8rOxsXGxcXMw8Jrs8JoscBvsr9orryys7Owr7Bgoa9SnKtckqBglJ+VnJ6Ej5NEiJONkJGHjpB4hYlmgolPfoZ1eXp5eXlicndrc3ZSbHNpbnFhbXBWa3BWZ2tzXVxrS0qsRD+QQT5sNTKkNjDSNi+bMiu/MCtmIh41j/9jAAAAoElEQVQI1xXHRYLCQAAAwZ5JiOHuuu6Lu7s7/P8nQN0KINhPDKL/PDiXll/TKs2JHdTVj1cahlQCC+iVjLJeNxWpW0GSbulZh6IpRRYjpBT33AGFsNfTIamJMWAfikCbhC5mgBoXZo2IX0xf4D0mLB8h0xVXwRFztX7xNb5Hb/DR/Qo7+csdr59gy50Pz7zu0hcb5E/p/RNsM9l7qtnMhhufzxGJBl8ksAAAAABJRU5ErkJggg==" style="height: 12px;"></a></td>';
  15.  
  16. $(function () {
  17. //搜索结果增加一列显示磁链按钮
  18. $('.results>table>thead>tr').prepend('<th style="display: none;"></th><th width="70px">Magnet</th>')
  19. //搜索结果底部单元格调整跨列数,适配样式
  20. $('tbody>tr:last>td').attr('colspan', '100')
  21. //搜索结果一律在新页面打开
  22. $('form[id^=descid]').attr('target', '_blank')
  23. $('tbody>tr>td.td.hide>.tt-name').each(function () {
  24. //找到种子的HASH
  25. var hash = $(this).find('input[name=id]').val()
  26. //拼接磁链
  27. var magnet = cl + hash
  28. //追加按钮
  29. var icon_new = icon.replace('[href]',magnet)
  30. $(this).parent().before($(icon_new));
  31. });
  32. })
  33. })();