Sleazy Fork is available in English.

bt4g添加磁力链接

在bt4g的搜索页面直接加入磁力链接

  1. // ==UserScript==
  2. // @name bt4g添加磁力链接
  3. // @namespace [email protected]
  4. // @version 0.1.1
  5. // @description 在bt4g的搜索页面直接加入磁力链接
  6. // @match *://*.bt4g.org/search/*
  7. // @author Xiccnd
  8.  
  9. // @license GPL-3.0 License
  10.  
  11. // @require https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js
  12. // @icon https://cdn.jsdelivr.net/gh/Xiccnd/Xiccnd-Pic@master/20220421113011992.1vh7zbll47r4.ico
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. $(function () {
  17.  
  18. 'use strict'
  19.  
  20. /*
  21. * 开启或关闭脚本功能
  22. * */
  23. //开启添加磁力链接
  24. xiccndAddMagnet()
  25.  
  26. /*
  27. * 添加磁力链接功能
  28. * */
  29. function xiccndAddMagnet() {
  30. //在标题后添加
  31. $('h5 a').on('mouseover', function () {//鼠标悬停事件
  32. //判断是否已添加a标签
  33. if (!($(this).next('button[value=magnetButton]').length > 0)) {
  34. //获取链接
  35. const URL = $(this).attr('href')
  36. //合成磁力链接
  37. const SRC = 'magnet:?xt=urn:btih:' + URL.substr(8)
  38. //生成按钮
  39. const BUTTON = '<button value="magnetButton" style="margin-left: 10px;">磁力链接</button>'
  40. //标题后添加按钮
  41. $(this).parent('h5').append(BUTTON)
  42. //按钮绑定事件
  43. $(this).next('button[value=magnetButton]').on('click', function () {
  44. //新窗口打开磁力链接
  45. window.open(SRC)
  46. }).on('mouseover', function () {
  47. $(this).css('cursor', 'pointer')
  48. })
  49. }
  50. }).trigger('mouseover')//全部触发
  51. }
  52. })