🏠 Home 

PT站点魔力计算器-细分标色

在使用NexusPHP架构的PT站点显示每个种子的A值和每GB的A值,同时显示B值。


安装此脚本?
  1. // ==UserScript==
  2. // @name PT站点魔力计算器-细分标色
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.0.8
  5. // @description 在使用NexusPHP架构的PT站点显示每个种子的A值和每GB的A值,同时显示B值。
  6. // @author neoblackxt, LaneLau
  7. // @require https://cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
  8. // @require https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js
  9. // @match *://*/mybonus.php*
  10. // @match *://*/torrents.php*
  11. // @match *://*/special.php*
  12. // @match *://*/search.php*
  13. // @match *://*.avgv.cc/AV*
  14. // @match *://*.avgv.cc/GV*
  15. // @match *://*.avgv.cc/LES*
  16. // @match *://*.avgv.cc/movie*
  17. // @match *://*.avgv.cc/teleplay*
  18. // @match *://pt.soulvoice.club/special*
  19. // @match *://pt.btschool.club/userdetails*
  20. // @match *://*/userdetails.php?id=*
  21. // @license GPL License
  22. // @grant GM_setValue
  23. // @grant GM_getValue
  24. // ==/UserScript==
  25. function run() {
  26. var $ = jQuery;
  27. let host = window.location.host.match(/\b[^\.]+\.[^\.]+$/)[0]
  28. let isMybonusPage = window.location.toString().indexOf("mybonus.php")!=-1
  29. let argsReady = true;
  30. let T0 = GM_getValue(host + ".T0");
  31. let N0 = GM_getValue(host + ".N0");
  32. let B0 = GM_getValue(host + ".B0");
  33. let L = GM_getValue(host + ".L");
  34. if(!(T0 && N0 && B0 &&L)){
  35. argsReady = false
  36. if(!isMybonusPage){
  37. alert("未找到魔力值参数,请打开魔力值系统说明获取(/mybonus.php)");
  38. }
  39. }
  40. if (isMybonusPage){
  41. T0 = parseInt($("li:has(b:contains('T0'))")[1].innerText.split(" = ")[1]);
  42. N0 = parseInt($("li:has(b:contains('N0'))")[1].innerText.split(" = ")[1]);
  43. B0 = parseInt($("li:has(b:contains('B0'))")[1].innerText.split(" = ")[1]);
  44. L = parseInt($("li:has(b:contains('L'))")[1].innerText.split(" = ")[1]);
  45. GM_setValue(host + ".T0",T0);
  46. GM_setValue(host + ".N0",N0);
  47. GM_setValue(host + ".B0",B0);
  48. GM_setValue(host + ".L",L);
  49. let A = parseFloat($("div:contains(' (A = ')")[0].innerText.split(" = ")[1]);
  50. if(!argsReady){
  51. if(T0 && N0 && B0 && L){
  52. alert("魔力值参数已更新")
  53. }else{
  54. alert("魔力值参数获取失败")
  55. }
  56. }
  57. // function calcB(A){
  58. // return B0*(2/Math.PI)*Math.atan(A/L)
  59. // }
  60. let data = []
  61. for (let i=0; i<25*L; i=i+L/4){
  62. data.push([i,calcB(i)])
  63. }
  64. $("table+h1").before('<div id="main" style="width: 600px;height:400px; margin:auto;"></div>')
  65. var myChart = echarts.init(document.getElementById('main'));
  66. // 指定图表的配置项和数据
  67. var option = {
  68. title: {
  69. text: 'B - A 图',
  70. top: 'bottom',
  71. left: 'center'
  72. },
  73. tooltip: {
  74. trigger: 'axis',
  75. axisPointer: {
  76. type: 'cross'
  77. },
  78. backgroundColor: 'rgba(255, 255, 255, 0.8)',
  79. position: function (pos, params, el, elRect, size) {
  80. var obj = { top: 10 };
  81. obj[['left', 'right'][+(pos[0] < size.viewSize[0] / 2)]] = 30;
  82. return obj;
  83. },
  84. extraCssText: 'width: 170px'
  85. },
  86. xAxis: {
  87. name: 'A',
  88. },
  89. yAxis: {
  90. name: 'B'
  91. },
  92. axisPointer: {
  93. label: {
  94. backgroundColor: '#777'
  95. }
  96. },
  97. series: [
  98. {
  99. type: 'line',
  100. data: data,
  101. symbol: 'none'
  102. },
  103. {
  104. type: 'line',
  105. data:[[A,calcB(A)]],
  106. symbolSize: 6
  107. }
  108. ]
  109. };
  110. // 使用刚指定的配置项和数据显示图表。
  111. myChart.setOption(option);
  112. }
  113. function calcA(T, S, N) {
  114. var c1 = 1 - Math.pow(10, -(T / T0));
  115. // 当断种时,显示续种后的实际值,因为当前状态值无意义
  116. N = N ? N : 1;
  117. // 当前状态值,加入做种后实际值会小于当前值
  118. // TODO: 改为双行显示为当前值和实际值
  119. var c2 = 1 + Math.pow(2, .5) * Math.pow(10, -(N - 1) / (N0 - 1));
  120. return c1 * S * c2;
  121. }
  122. function calcB(A){
  123. return B0*(2/Math.PI)*Math.atan(A/L)
  124. }
  125. function makeA($this, i_T, i_S, i_N) {
  126. var time = $this.children('td:eq(' + i_T + ')').find("span").attr("title");
  127. var T = (new Date().getTime() - new Date(time).getTime()) / 1e3 / 86400 / 7;
  128. var size = $this.children('td:eq(' + i_S + ')').text().trim();
  129. var size_tp = 1;
  130. var S = size.replace(/[KMGT]B/, function (tp) {
  131. if (tp == "KB") {
  132. size_tp = 1 / #### / ####;
  133. } else if (tp == "MB") {
  134. size_tp = 1 / ####;
  135. } else if (tp == "GB") {
  136. size_tp = 1;
  137. } else if (tp == "TB") {
  138. size_tp = ####;
  139. }
  140. return "";
  141. });
  142. S = parseFloat(S) * size_tp;
  143. var number = $this.children('td:eq(' + i_N + ')').text().trim();
  144. var N = parseInt(number);
  145. var A = calcA(T, S, N).toFixed(2);
  146. var B = calcB(A).toFixed(2);
  147. var ave = (A / S).toFixed(2);
  148. if ((A > S * 2) && (N > 0)) {
  149. //标色A大于体积2倍且不断种的种子
  150. return '<span style="color:#FF0000;font-weight:900;">' + B + '|' + A + '@' +ave + '</span>'
  151. }else if ((A > S * 1) && (N > 0)) {
  152. //标色A大于体积1倍且不断种的种子
  153. return '<span style="color:#FF00FF;font-weight:900;">' + B + '|' + A + '@' +ave + '</span>'
  154. }else if ((A > S * 0.5) && (N > 0)) {
  155. //标色A小于体积0.5倍且不断种的种子
  156. return '<span style="color:####6CC;font-weight:900;">' + B + '|' + A + '@' +ave + '</span>'
  157. }else {
  158. return '<span style="color:#e6e6e6;font-weight:900;">' + B + '|' + A + '@' +ave + "</span>"
  159. }
  160. }
  161. var i_T, i_S, i_N
  162. $('.torrents:last-of-type>tbody>tr').each(function (row) {
  163. var $this = $(this);
  164. if (row == 0) {
  165. $this.children('td').each(function (col) {
  166. if ($(this).find('img.time').length) {
  167. i_T = col
  168. } else if ($(this).find('img.size').length) {
  169. i_S = col
  170. } else if ($(this).find('img.seeders').length) {
  171. i_N = col
  172. }
  173. })
  174. if (!i_T || !i_S || !i_N) {
  175. alert('未能找到数据列')
  176. return
  177. }
  178. $this.children("td:last").before("<td class=\"colhead\" title=\"B值|A值@每GB的A值\">B|A@A/GB</td>");
  179. } else {
  180. var textA = makeA($this, i_T, i_S, i_N)
  181. $this.children("td:last").before("<td class=\"rowfollow\">" + textA + "</td>");
  182. }
  183. });
  184. }
  185. run()