wkgo download seeds

增加页面顶部底部按钮和一键下种按钮

Stan na 22-09-2024. Zobacz najnowsza wersja.

  1. // ==UserScript==
  2. // @name wkgo download seeds
  3. // @namespace websiteEnhancement
  4. // @author You
  5. // @version 2024.9.3
  6. // @description 增加页面顶部底部按钮和一键下种按钮
  7. // @create 2023-9-21
  8. // @include *wkgo*
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM.getValue
  12. // @grant GM.setValue
  13. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  14. // @license MIT
  15. // @run-at document-end
  16. // ==/UserScript==
  17. ;
  18. (async function (loadJS) {
  19. Array.prototype.push = function (...items) {
  20. let len = this.length >>> 0;
  21. let argCount = items.length >>> 0;
  22. if (len + argCount > 2 ** 53 - 1) {
  23. throw new TypeError("Invalid array length");
  24. }
  25. for (let i = 0; i < argCount; i++) {
  26. this[len + i] = items[i];
  27. }
  28. this.length = len + argCount;
  29. return this.length;
  30. };
  31. ["https://cdn.jsdelivr.net/gh/sodiray/radash@master/cdn/radash.min.js",
  32. "https://update.greasyfork.org/scripts/483173/1301961/GM_config_cnjames.js",
  33. "https://update.sleazyfork.org/scripts/476583/common_libs_of_array.js"
  34. ].reduce((p, url) => { return p.then(() => loadJS(url)) }, Promise.resolve())
  35. .then(v => {
  36. withJQuery(function ($, win) {
  37.  
  38. win.funcDownload = function () {
  39. $("a:contains(.torrent)").each((i, element) => {
  40.  
  41. let url = $(element).attr('href');
  42. let filename = $(element).text().trim();
  43. if (filename.indexOf('torrent') == -1)
  44. return true;
  45. console.log("download file name:", $(element).text())
  46. createSuperLabel(url, url, filename, win)
  47. });
  48. }
  49. win.funcList = function () { }
  50. win.funcDetail = function () { }
  51. const reg = /(\d{6,})/
  52. win.__compareKey = function (cache, curr) {
  53. if (cache === curr)
  54. return true
  55. ///thread-6638382-
  56. let result=reg.exec(cache)
  57. if (result&& result.length>1)
  58. return result[1] === curr
  59. return false
  60. }
  61. win.fixValue = function (value) {
  62. let result=reg.exec(value)
  63. if (result&& result.length>1)
  64. return result[1]
  65. return value
  66. }
  67. $('table a').removeAttr('style')
  68.  
  69. autoFind(() => /wkgo.xyz\/forum[-\d]*.html/.test(win.location.href) || /wkgo.xyz\/forum.php\?mod=forumdisplay/.test(win.location.href), 'wkgo', 'a.s.xst', el => el.text(), $, {}, win, funcDownload, funcList, funcDetail);
  70.  
  71. })
  72. })
  73.  
  74.  
  75. })(function (FILE_URL, async = true) {
  76. return new Promise((resolve, reject) => {
  77. let scriptEle = document.createElement("script");
  78. scriptEle.setAttribute("src", FILE_URL);
  79. scriptEle.setAttribute("type", "text/javascript");
  80. scriptEle.setAttribute("async", async);
  81. // success event
  82. scriptEle.addEventListener("load", () => {
  83. resolve(FILE_URL)
  84. });
  85. // error event
  86. scriptEle.addEventListener("error", (ev) => {
  87. reject(ev);
  88. });
  89. if (document.currentScript)
  90. document.currentScript.insertBefore(scriptEle)
  91. else
  92. (document.head || document.getElementsByTagName('head')[0]).appendChild(scriptEle);
  93. })
  94. });