91wii

www.91tvg.com

  1. // ==UserScript==
  2. // @name 91wii
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.00
  5. // @description www.91tvg.com
  6. // @author backrock12
  7. // @match https://www.91wii.com/thread*
  8. // @match https://www.91wii.com/*
  9. // @match https://www.91tvg.com/thread*
  10. // @match https://www.91tvg.com/*
  11. // @icon https://www.google.com/s2/favicons?domain=91wii.com
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function () {
  17. "use strict";
  18.  
  19. function find(str, cha, num) {
  20. if (cha == "") return -1;
  21. var x = str.indexOf(cha);
  22. if (num == 1) return x;
  23. for (var i = 0; i < num; i++) {
  24. x = str.indexOf(cha, x + 1);
  25. }
  26. return x;
  27. }
  28.  
  29. function gettitle(t, str1, str2, num = 1) {
  30. let lnum, rnum, title;
  31. // lnum = t.indexOf(str1);
  32. // rnum = t.indexOf(str2);
  33. if (str1 == str2) {
  34. lnum = find(t, str1, num);
  35. rnum = find(t, str2, num + 1);
  36. } else {
  37. lnum = find(t, str1, num);
  38. rnum = find(t, str2, num);
  39. }
  40.  
  41. // if (lnum < 0) lnum = 0;
  42. if (rnum < 0) rnum = 0;
  43. if (lnum > 0 || rnum > 0) {
  44. title = t.substring(lnum + 1, rnum);
  45. }
  46. if (str1 == null && str2) {
  47. title = t;
  48. if (str1 == null && rnum > 0) {
  49. title = title.substring(0, rnum);
  50. }
  51. }
  52. if (str2 == null && str1) {
  53. title = t;
  54. if (str2 == null && lnum > 0) {
  55. title = title.substring(lnum + 1);
  56. }
  57. }
  58. if (title) {
  59. title = title.replace("[TXT格式]", "").replace("\n", "");
  60. title = title.replace(/^\s*|\s*$/g, "");
  61. }
  62. if (title && title.indexOf("合购") > 0) {
  63. num++;
  64. title = gettitle(t, str1, str2, num);
  65. }
  66.  
  67. return title;
  68. }
  69.  
  70. function settitle(titleid, str1, str2) {
  71. const titleobj = document.querySelector(titleid);
  72. if (!titleobj) return;
  73. let t = gettitle(titleobj.innerText, str1, str2);
  74. console.log(t);
  75. if (t) {
  76. const strs = t.split("/");
  77. let htmltext = titleobj.outerHTML;
  78. for (let i = 0; i < strs.length; i++) {
  79. let urlname = strs[i];
  80. const url = "https://www.baidu.com/baidu?wd=" + urlname;
  81. const ahtml = `<a href=${url} target = "_blank">${urlname}</a>`;
  82. htmltext = htmltext.replace(urlname, ahtml);
  83. }
  84. titleobj.outerHTML = htmltext;
  85. console.log(htmltext);
  86. }
  87. return t;
  88. }
  89.  
  90.  
  91. function titleselect() {
  92. const titleid = "#thread_subject";
  93.  
  94. if (titleid) {
  95. let temp = null;
  96. temp = settitle(titleid, "[", "]");
  97. temp = temp | settitle(titleid, "《", "》");
  98. temp = temp | settitle(titleid, "<", ">");
  99. temp = temp | settitle(titleid, "(", ")");
  100.  
  101. if (!temp)
  102. temp = settitle(titleid, "", "(");
  103. if (!temp)
  104. if (!temp)
  105. temp = settitle(titleid, " ", " ");
  106. if (!temp) {
  107. temp = settitle(titleid, "", " ");
  108. }
  109. }
  110. }
  111.  
  112. function autoadd() {
  113. const number_id = 'body > form:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > b:nth-child(3)';
  114. const input_id = 'body > form:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(1) > input:nth-child(6)'
  115. const button_id = '.button';
  116.  
  117. const text = document.querySelector(number_id);
  118. if (!text) return;
  119. const numbertext = text.innerHTML.replace('= ?', '')
  120. const list = numbertext.split('+');
  121.  
  122. let re = 0;
  123. for (let index = 0; index < list.length; index++) {
  124. re += Number(list[index]);
  125. }
  126. const input = document.querySelector(input_id);
  127. input.value = re;
  128.  
  129. const button = document.querySelector(button_id);
  130. if (button) {
  131. setTimeout(() => {
  132. button.click();
  133. }, 1000)
  134. }
  135. }
  136.  
  137.  
  138. titleselect();
  139. autoadd();
  140.  
  141. const adlist = [
  142. ".bilibili-player-video-btn-jump-to-bilibili-qrcode",
  143. ".bilibili-player-video-btn-jump",
  144.  
  145. ];
  146. // adlist.forEach((e) => {
  147. // let r = document.querySelectorAll(e);
  148. // if (r.length > 0)
  149. // r.forEach((e) => {
  150. // e.innerText="";
  151. // });
  152. // });
  153.  
  154. // Your code here...
  155. })();