tianteng

各种开车网站的优化,javbus,javlib

2024-10-14 يوللانغان نەشرى. ئەڭ يېڭى نەشرىنى كۆرۈش.

  1. // ==UserScript==
  2. // @name tianteng
  3. // @namespace https://greasyfork.org/xmlspy
  4. // @version 2.0.6
  5. // @author xmlspy
  6. // @description 各种开车网站的优化,javbus,javlib
  7. // @license MIT
  8. // @match *://*/*
  9. // @require https://registry.npmmirror.com/jquery/3.7.1/files/dist/jquery.min.js#sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=
  10. // @require https://cdn.jsdelivr.net/npm/ldloader@3.0.3/index.min.js
  11. // @require https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3/dist/js/tabby.min.js
  12. // @resource ldbutton/index.min.css https://cdn.jsdelivr.net/npm/ldbutton@2.0.4/index.min.css
  13. // @resource ldloader/index.min.css https://cdn.jsdelivr.net/npm/ldloader@3.0.3/index.min.css
  14. // @resource tabbyjs/dist/css/tabby-ui.min.css https://cdn.jsdelivr.net/npm/tabbyjs@12.0.3/dist/css/tabby-ui.min.css
  15. // @connect *://*/*
  16. // @grant GM.setClipboard
  17. // @grant GM.xmlHttpRequest
  18. // @grant GM_addStyle
  19. // @grant GM_deleteValue
  20. // @grant GM_getResourceText
  21. // @grant GM_getValue
  22. // @grant GM_info
  23. // @grant GM_openInTab
  24. // @grant GM_setClipboard
  25. // @grant GM_setValue
  26. // @grant GM_xmlhttpRequest
  27. // @run-at document-start
  28. // ==/UserScript==
  29.  
  30. (function ($, Tabby, ldloader) {
  31. 'use strict';
  32.  
  33. var _GM = /* @__PURE__ */ (() => typeof GM != "undefined" ? GM : void 0)();
  34. var _GM_addStyle = /* @__PURE__ */ (() => typeof GM_addStyle != "undefined" ? GM_addStyle : void 0)();
  35. var _GM_deleteValue = /* @__PURE__ */ (() => typeof GM_deleteValue != "undefined" ? GM_deleteValue : void 0)();
  36. var _GM_getResourceText = /* @__PURE__ */ (() => typeof GM_getResourceText != "undefined" ? GM_getResourceText : void 0)();
  37. var _GM_getValue = /* @__PURE__ */ (() => typeof GM_getValue != "undefined" ? GM_getValue : void 0)();
  38. var _GM_info = /* @__PURE__ */ (() => typeof GM_info != "undefined" ? GM_info : void 0)();
  39. var _GM_openInTab = /* @__PURE__ */ (() => typeof GM_openInTab != "undefined" ? GM_openInTab : void 0)();
  40. var _GM_setClipboard = /* @__PURE__ */ (() => typeof GM_setClipboard != "undefined" ? GM_setClipboard : void 0)();
  41. var _GM_setValue = /* @__PURE__ */ (() => typeof GM_setValue != "undefined" ? GM_setValue : void 0)();
  42. var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  43. function getUrlParam(url, name) {
  44. const urlObj = new URL(url);
  45. return urlObj.searchParams.get(name);
  46. }
  47. function drawImage(ImgObj, maxWidth, maxHeight) {
  48. var image = new Image();
  49. image.src = ImgObj.src;
  50. var tempWidth;
  51. var tempHeight;
  52. if (image.width > 0 && image.height > 0) {
  53. if (image.width / image.height >= maxWidth / maxHeight) {
  54. if (image.width > maxWidth) {
  55. tempWidth = maxWidth;
  56. tempHeight = image.height * maxWidth / image.width;
  57. } else {
  58. tempWidth = image.width;
  59. tempHeight = image.height;
  60. }
  61. } else {
  62. if (image.height > maxHeight) {
  63. tempHeight = maxHeight;
  64. tempWidth = image.width * maxHeight / image.height;
  65. } else {
  66. tempWidth = image.width;
  67. tempHeight = image.height;
  68. }
  69. }
  70. ImgObj.height = tempHeight;
  71. ImgObj.width = tempWidth;
  72. ImgObj.alt = image.width + "×" + image.height;
  73. }
  74. }
  75. function appendCopyButton(chePai, toAppendElement, callback) {
  76. var copyButton = document.createElement("button");
  77. copyButton.innerHTML = "复 制";
  78. copyButton.setAttribute("id", "copyButton");
  79. toAppendElement.appendChild(copyButton);
  80. document.addEventListener("click", (e) => {
  81. if (e.target.getAttribute("id") === "copyButton") {
  82. _GM.setClipboard(chePai, "text");
  83. }
  84. });
  85. callback && callback(copyButton, chePai, toAppendElement);
  86. }
  87. function addPasteAndSearchButton($searchButton, $searchInput, callback) {
  88. const styleMap = { "margin-left": "5px" };
  89. $searchButton[0] && $searchButton[0].computedStyleMap().forEach((value, key) => {
  90. styleMap[key] = value;
  91. });
  92. let $pasteAndSearchButton = $(
  93. `<input type="button" value="粘贴&搜索" id="pasteAndSearch"></input>`
  94. );
  95. $pasteAndSearchButton.css(styleMap);
  96. $searchButton.after($pasteAndSearchButton);
  97. $pasteAndSearchButton.click(() => {
  98. navigator.clipboard.readText().then((clipText) => {
  99. if (clipText != null && $.trim(clipText) != "") {
  100. $searchInput.val($.trim(clipText));
  101. $searchButton.click();
  102. }
  103. });
  104. });
  105. return $pasteAndSearchButton;
  106. }
  107. let seq = 0;
  108. function debug(str, title) {
  109. {
  110. if (!str) {
  111. str = "";
  112. }
  113. if (!Array.isArray(str)) {
  114. str = [str];
  115. }
  116. seq++;
  117. console.log(
  118. `%ctianteng ${_GM_info.script.version}】 ${title ? title : "debug"}:`,
  119. "color: yellow;font-size: large;font-weight: bold;background-color: darkblue;",
  120. seq,
  121. ...str
  122. );
  123. }
  124. }
  125. function pasteAndSearchEventHandler(searchButton, searchInput, pasteAndSearchButton) {
  126. pasteAndSearchButton.on("click", () => {
  127. navigator.clipboard.readText().then((clipText) => {
  128. if (clipText != null && $.trim(clipText) != "") {
  129. searchInput.val($.trim(clipText));
  130. searchButton.trigger("click");
  131. }
  132. });
  133. });
  134. }
  135. function observe(target, options, callback) {
  136. return new MutationObserver(callback).observe(target, options);
  137. }
  138. function interceptEventListener(interceptorAdd, interceptorRemove) {
  139. const ep = EventTarget.prototype;
  140. if (!ep.addEventListenerOriginal) {
  141. ep.addEventListenerOriginal = ep.addEventListener;
  142. ep.addEventListener = function(type, callback, options) {
  143. if (this) {
  144. if (interceptorAdd) {
  145. const result = interceptorAdd(this, type, callback, options);
  146. if (result === true) {
  147. return;
  148. }
  149. }
  150. this.allListeners = this.allListeners || [];
  151. this.allListeners.push({ type, callback, options });
  152. this.addEventListenerOriginal.apply(this, arguments);
  153. } else {
  154. debug(
  155. `[this] is bad. type: ${type} callback: ${callback} options: ${options}`,
  156. "addEventListenerHook"
  157. );
  158. }
  159. };
  160. }
  161. if (!ep.removeEventListenerOriginal) {
  162. ep.removeEventListenerOriginal = ep.removeEventListener;
  163. ep.removeEventListener = function(type, callback, options) {
  164. if (this) {
  165. {
  166. debug(
  167. `[this] is bad. type: ${type} callback: ${callback} options: ${options}`,
  168. "removeEventListenerHook"
  169. );
  170. }
  171. }
  172. };
  173. }
  174. }
  175. function makeRequestHeaders(headers) {
  176. return $.extend(
  177. {
  178. Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
  179. "Accept-Encoding": "gzip, deflate, br",
  180. "Accept-Language": "zh-CN,zh;q=0.9",
  181. "Cache-Control": "max-age=0",
  182. "Sec-Ch-Ua": '"Chromium";v="119", "Not?A_Brand";v="24"',
  183. "Sec-Ch-Ua-Mobile": "?0",
  184. "Sec-Ch-Ua-Platform": "Windows",
  185. "Sec-Fetch-Dest": "document",
  186. "Sec-Fetch-Mode": "navigate",
  187. "Sec-Fetch-Site": "same-origin",
  188. "Sec-Fetch-User": "?1",
  189. "Upgrade-Insecure-Requests": "1",
  190. "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.160 Safari/537.36"
  191. },
  192. headers
  193. );
  194. }
  195. class HandlerExecutor {
  196. constructor(handler) {
  197. this.handler = handler;
  198. this.execute = this.execute.bind(this);
  199. this.checkCondition = this.checkCondition.bind(this);
  200. }
  201. execute() {
  202. if (!this.handler) {
  203. throw new Error("handler is not defined");
  204. }
  205. const { name, condition, handle } = this.handler;
  206. if (!name) {
  207. throw new Error("handler name is not defined");
  208. }
  209. if (condition === null || condition === void 0) {
  210. throw new Error("handler condition is not defined");
  211. }
  212. if (!handle) {
  213. throw new Error("handler handle is not defined");
  214. }
  215. const result = this.checkCondition(condition);
  216. if (result.success === true) {
  217. handle(condition, result.keyOrIndex);
  218. }
  219. return result;
  220. }
  221. /**
  222. *
  223. * @param {RegExp|Function|boolean|string|jQuery|Array<any>} condition
  224. * @returns {Result}
  225. */
  226. checkCondition(condition) {
  227. if ($.type(condition) === "regexp") {
  228. return new Result(condition.test(window.location.href));
  229. }
  230. if ($.isFunction(condition)) {
  231. return new Result(condition() === true);
  232. }
  233. if ($.type(condition) === "boolean") {
  234. return new Result(condition === true);
  235. }
  236. if ($.type(condition) === "string") {
  237. return new Result(document.querySelector(condition) != null);
  238. }
  239. if (condition instanceof $) {
  240. return new Result(condition.length > 0);
  241. }
  242. if ($.isPlainObject(condition)) {
  243. for (const key in condition) {
  244. if (this.checkCondition(condition[key]).success) {
  245. return new Result(true, key);
  246. }
  247. }
  248. }
  249. if ($.isArray(condition)) {
  250. for (const [index, value] of condition) {
  251. if (this.checkCondition(value).success) {
  252. return new Result(true, index);
  253. }
  254. }
  255. }
  256. return new Result(false);
  257. }
  258. }
  259. class Result {
  260. constructor(success, keyOrIndex) {
  261. this.success = success;
  262. this.keyOrIndex = keyOrIndex;
  263. }
  264. }
  265. class Handler {
  266. constructor() {
  267. if (this.constructor === Handler) {
  268. throw new TypeError("Can not construct abstract class.");
  269. }
  270. this.handle = this.handle.bind(this);
  271. }
  272. get name() {
  273. throw new Error("not implemented");
  274. }
  275. get condition() {
  276. throw new Error("not implemented");
  277. }
  278. handle(condition, keyOrIndex) {
  279. throw new Error("not implemented");
  280. }
  281. }
  282. class BaiduHandler extends Handler {
  283. get name() {
  284. return "百度";
  285. }
  286. get condition() {
  287. return /baidu\.com/;
  288. }
  289. handle(condition, keyOrIndex) {
  290. debug("添加 粘贴并搜索 按钮", this.name);
  291. const searchButton = $(`[type="submit"]`);
  292. const searchInput = $(`#kw`);
  293. if (searchButton.length === 0 || searchInput.length === 0) {
  294. debug("找不到搜索按钮或搜索输入框", this.name);
  295. debug("serachButton.length:{serachButton.length}", this.name);
  296. debug("searchInput.length:{searchInput.length}", this.name);
  297. return;
  298. }
  299. const pasteAndSearchButton = searchButton.clone();
  300. pasteAndSearchButton.val("粘贴&搜索").removeAttr("id").attr("type", "button");
  301. searchButton.parent().append(pasteAndSearchButton);
  302. searchButton.parent().css("width", "auto");
  303. _GM_addStyle(`
  304. #head_wrapper .s_form {
  305. width: auto;
  306. height: 100%;
  307. margin: 0 auto;
  308. text-align: center;
  309. }
  310. #head_wrapper .s_btn_wr .wrapper_new{
  311. width:auto;
  312. }
  313. `);
  314. pasteAndSearchEventHandler(searchButton, searchInput, pasteAndSearchButton);
  315. }
  316. }
  317. class OsChinaHandler extends Handler {
  318. get name() {
  319. return "开源中国";
  320. }
  321. get condition() {
  322. return /oschina\.net/;
  323. }
  324. handle(condition, keyword) {
  325. debug("修改首页某些链接无法中键点击问题.", "开源中国");
  326. $(`[data-href]`).each(function() {
  327. const $this = $(this);
  328. const href = $this.attr("data-href");
  329. const classCss = $this.attr("class");
  330. const title = $this.attr("title");
  331. const innerHtml = this.innerHTML;
  332. const html = `<a target="_blank" title="${title}" href="${href}" class="${classCss}">${innerHtml}</a>`;
  333. $this.replaceWith(html);
  334. });
  335. debug("删除url中的重定向.", "开源中国");
  336. $('a[href*="/action/GoToLink?url"]').each(function() {
  337. let href = $(this).attr("href");
  338. if (href) {
  339. let url = getUrlParam(href, "url");
  340. $(this).attr("href", url);
  341. }
  342. });
  343. }
  344. }
  345. class GiteeHandler extends Handler {
  346. get name() {
  347. return "gitee";
  348. }
  349. get condition() {
  350. return /gitee\.com/;
  351. }
  352. handle(condition, keyword) {
  353. debug("删除url中的重定向.", "gitee");
  354. $('a[href*="/link?target"]').each(function(index) {
  355. let href = $(this).attr("href");
  356. if (href) {
  357. let url = getUrlParam(href, "target");
  358. $(this).attr("href", url);
  359. }
  360. });
  361. }
  362. }
  363. class ZhihuHandler extends Handler {
  364. get name() {
  365. return "知乎";
  366. }
  367. get condition() {
  368. return /zhihu\.com/;
  369. }
  370. handle(condition, keyOrIndex) {
  371. debug("添加 粘贴并搜索 按钮", "知乎");
  372. const searchButton = $(`button[class*="SearchBar-searchButton"]`);
  373. const searchInput = $(`#Popover1-toggle`);
  374. addPasteAndSearchButton(searchButton, searchInput);
  375. }
  376. }
  377. class WnacgHandler extends Handler {
  378. get name() {
  379. return "绅士漫画";
  380. }
  381. get condition() {
  382. return $('head>title:contains("紳士漫畫")');
  383. }
  384. handle(condition, keyword) {
  385. if (location.href.includes("photos-index-aid")) {
  386. debug("明细页面添加搜索框", "紳士漫畫");
  387. const searchInput = `
  388. <div class="search" style="float:right;">
  389. <form id="album_search q-form" action="/search/" method="get" _lpchecked="1">
  390. <div class="input-append" id="q-input">
  391. <input type="text" class="search-query ui-autocomplete-input tips"
  392. name="q" value="" title="搜索漫畫" autocomplete="off"
  393. role="textbox" aria-autocomplete="list" aria-haspopup="true">
  394. <input style="display:none" type="radio" name="f" value="_all" checked="">
  395. <input style="display:none" name="s" value="create_time_DESC">
  396. <input style="display:none" name="syn" value="yes">
  397. <button type="" name=""></button>
  398. </div>
  399. </form>
  400. </div>
  401. `;
  402. $("#bodywrap").prepend(searchInput);
  403. }
  404. if (location.href.includes("photos-slide-aid")) {
  405. debug("下拉阅读页面,图片由一列改为两列", "紳士漫畫");
  406. const nodeToObserve = document.querySelector("#img_list");
  407. $(nodeToObserve).css({
  408. width: "100%",
  409. display: "flex",
  410. "flex-wrap": "wrap",
  411. "justify-content": "flex-start",
  412. "overflow-x": "hidden"
  413. });
  414. const imgWidth = document.documentElement.clientWidth / 2 - 10;
  415. const imgHeight = document.documentElement.clientHeight - 50;
  416. new MutationObserver((mutations, observer) => {
  417. $("#img_list>div").css({
  418. flex: "1",
  419. "background-color": "#cacaca",
  420. margin: "0 5px 5px 0",
  421. width: "calc((100% - 10px) / 2)",
  422. "min-width": "calc((100% - 10px) / 2)",
  423. "max-width": "calc((100% - 10px) / 2)"
  424. });
  425. $("#img_list>div>img").on("load", (e) => {
  426. drawImage(e.target, imgWidth, imgHeight);
  427. });
  428. }).observe(nodeToObserve, { childList: true });
  429. }
  430. if ($("input.search-query").length > 0) {
  431. debug("为搜索框后面添加 粘贴&搜索 按钮", "紳士漫畫");
  432. const searchInput = $("[name=q]");
  433. const searchButton = $("#q-input > button");
  434. const pasteAndSearchButton = $(
  435. `<button style="float:right;height:30px;">粘贴&amp;搜索</button>`
  436. );
  437. $("#bodywrap").prepend(pasteAndSearchButton);
  438. pasteAndSearchEventHandler(searchButton, searchInput, pasteAndSearchButton);
  439. }
  440. }
  441. }
  442. const domainConfig = {
  443. javbus: { url: "https://www.seejav.help" },
  444. javlib: { url: "https://www.o83h.com" },
  445. ciligege: { url: "https://www.ciligege2.com" },
  446. // https://tellme.pw/btsow https://btsow.com
  447. btsow: { url: "https://btsow.motorcycles" },
  448. btsearch: { url: "https://www.btsearch.love" },
  449. // 最新地址發布(請收藏):u9a9.link ,永久域名 u9a9.com,u9a9.net,u9a9.ru,u9a9.xyz,u9a9.org,u9a9.me
  450. // Email: u9a9.com#protonmail.com
  451. u9a9: { url: "https://y.u9a9y.xyz" },
  452. skrbt: { url: "https://skrbtlz.top" }
  453. };
  454. domainConfig.javbus.searchUrl = `${domainConfig.javbus.url}/search?q=%s`;
  455. domainConfig.javlib.searchUrl = `${domainConfig.javlib.url}/search?q=%s`;
  456. domainConfig.ciligege.searchUrl = `${domainConfig.ciligege.url}/search/%s/1`;
  457. domainConfig.btsow.searchUrl = `${domainConfig.btsow.url}/search/%s`;
  458. domainConfig.btsearch.searchUrl = `${domainConfig.btsearch.url}/search?q=%s`;
  459. domainConfig.u9a9.searchUrl = `${domainConfig.u9a9.url}/?type=2&search=%s`;
  460. domainConfig.skrbt.searchUrl = `${domainConfig.skrbt.url}/search?keyword=%s`;
  461. class FakeCookie extends Map {
  462. constructor(fullCookieString) {
  463. super();
  464. this.fullCookieString = fullCookieString;
  465. }
  466. get fullCookieString() {
  467. let result = "";
  468. this.forEach((value, key, self) => {
  469. result = result.concat(key).concat("=").concat(value).concat(";");
  470. });
  471. return result === "" ? result : result.substring(0, result.length - 1);
  472. }
  473. set fullCookieString(str) {
  474. if (str) {
  475. let items = str.split(";");
  476. items.map((element, index) => element.trim()).filter((element, index, self) => self.indexOf(element) === index).forEach((element) => {
  477. const pair = element.split("=");
  478. this.set(pair[0], pair[1]);
  479. });
  480. }
  481. }
  482. /**
  483. * 把newCookie合并到当前实例中.如果newCookie中的key与当前的实例重复,这使用newCookie中的覆盖.
  484. * @param {String|FakeCookie} newCookie 要合并的新cookie,类型为String或者FakeCookie.
  485. * 如果类型为String,表示包含全部cookie内容的字符串;
  486. */
  487. merge(newCookie) {
  488. if (!newCookie) {
  489. return;
  490. }
  491. let newFakeCookie;
  492. if (typeof newCookie === "string") {
  493. newFakeCookie = new FakeCookie(newCookie);
  494. } else if (newCookie instanceof FakeCookie) {
  495. newFakeCookie = newCookie;
  496. } else {
  497. throw new TypeError("Invalid type.");
  498. }
  499. newFakeCookie.forEach((value, key, self) => this.set(key, value));
  500. }
  501. }
  502. let fakeCookie = new FakeCookie();
  503. function getSearchResultFromSkrbt(chepai, callback) {
  504. const skrbtUrl = domainConfig.skrbt.url;
  505. const searchUrl = domainConfig.skrbt.searchUrl.replace("%s", chepai);
  506. function getResponseHeader(response, name) {
  507. if (response && response.responseHeaders && name) {
  508. var arr = response.responseHeaders.trim().split(/[\r\n]+/);
  509. var headerMap = {};
  510. arr.forEach(function(line) {
  511. var parts = line.split(": ");
  512. var header = parts.shift();
  513. var value = parts.join(": ");
  514. headerMap[header] = value;
  515. });
  516. return headerMap[name];
  517. }
  518. return null;
  519. }
  520. function onResponseHeaderRecieved(response) {
  521. if (response.readyState === response.HEADERS_RECEIVED) {
  522. console.log(response.responseHeaders);
  523. const setCookie = getResponseHeader(response, "Set-Cookie");
  524. fakeCookie.merge(setCookie);
  525. }
  526. }
  527. const timeoutIds = [];
  528. function clearTimeouts() {
  529. timeoutIds.forEach((timeoutId) => clearTimeout(timeoutId));
  530. }
  531. function successHandler(response, callback2) {
  532. clearTimeouts();
  533. const $container = $(response.responseText).find(".col-md-6:eq(2)");
  534. const data = $.map($container.find(".list-unstyled"), (item) => {
  535. const title = $(item).find("a.rrt.common-link").html();
  536. const detailHref = $(item).find("a.rrt.common-link").attr("href");
  537. const fileSize = $(item).find("li.rrmi > span:nth-child(2)").text();
  538. const fileCount = $(item).find("li.rrmi > span:nth-child(3)").text();
  539. const timeIncluded = $(item).find("li.rrmi > span:nth-child(4)").text();
  540. return {
  541. name: title,
  542. detailUrl: domainConfig.skrbt.url + detailHref,
  543. //明细页面地址
  544. size: fileSize,
  545. // 文件总大小
  546. fileCount,
  547. // 文件总数
  548. date: timeIncluded
  549. // 收入时间
  550. };
  551. });
  552. callback2({
  553. result: 0,
  554. data
  555. // html: $container.html(),
  556. });
  557. }
  558. _GM_xmlhttpRequest({
  559. method: "get",
  560. headers: makeRequestHeaders({ Referer: skrbtUrl }),
  561. url: searchUrl,
  562. onerror: function(e) {
  563. console.log(e);
  564. },
  565. onload: function(response) {
  566. console.log(response);
  567. if (response.finalUrl.includes("/search?")) {
  568. console.log("-----------OK");
  569. successHandler(response, callback);
  570. } else if (response.finalUrl.includes("/challenge")) {
  571. waitRecaptcha();
  572. } else {
  573. console.log("错误");
  574. clearTimeouts();
  575. callback({ result: 1, message: "" });
  576. }
  577. },
  578. onreadystatechange: onResponseHeaderRecieved
  579. });
  580. function waitRecaptcha() {
  581. var remain = 10;
  582. var startTime = (/* @__PURE__ */ new Date()).getTime();
  583. timeoutIds.unshift(setTimeout(timeoutHandler, 1e3));
  584. timeoutIds.unshift(setTimeout(doChallange, 1e3));
  585. function timeoutHandler() {
  586. console.log("timeoutHandler");
  587. remain = remain - 1;
  588. console.log(`remain: ${remain}`);
  589. if (remain > 0) {
  590. timeoutIds.unshift(setTimeout(timeoutHandler, 1e3));
  591. } else {
  592. doSubmit(randomString(100));
  593. }
  594. }
  595. function doChallange() {
  596. console.log("doChallange");
  597. var aywcUid = genOrGetAywcUid();
  598. var genApi = skrbtUrl + "/anti/recaptcha/v4/gen?aywcUid=" + aywcUid + "&_=" + (/* @__PURE__ */ new Date()).getTime();
  599. _GM_xmlhttpRequest({
  600. method: "get",
  601. responseType: _GM_xmlhttpRequest.RESPONSE_TYPE_JSON,
  602. headers: makeRequestHeaders({
  603. Referer: `${skrbtUrl}/recaptcha/v4/challenge?url=${skrbtUrl}&s=1`
  604. }),
  605. url: genApi,
  606. onerror: function(e) {
  607. console.log(/* @__PURE__ */ new Date() + ": " + e);
  608. timeoutIds.unshift(setTimeout(doChallange, 1e3));
  609. console.log(e);
  610. },
  611. onload: function(response) {
  612. const genResult = response.response;
  613. if (genResult.errno == 0) {
  614. doSubmit(genResult.token);
  615. } else {
  616. timeoutIds.unshift(setTimeout(doChallange, 1e3));
  617. }
  618. },
  619. onreadystatechange: onResponseHeaderRecieved
  620. });
  621. }
  622. function doSubmit(token) {
  623. console.log("doSubmit");
  624. var costtime = (/* @__PURE__ */ new Date()).getTime() - startTime;
  625. _GM_xmlhttpRequest({
  626. method: "get",
  627. headers: makeRequestHeaders({
  628. Referer: `${skrbtUrl}/recaptcha/v4/challenge?url=${skrbtUrl}&s=1`
  629. }),
  630. url: `${skrbtUrl}/anti/recaptcha/v4/verify?token=${token}&aywcUid=${genOrGetAywcUid()}&costtime=${costtime}`,
  631. onerror: function(e) {
  632. console.log(e);
  633. clearTimeouts();
  634. callback({ result: 2, message: "" });
  635. },
  636. onload: function(response) {
  637. console.log("-----doSubmit OK");
  638. console.log(response);
  639. if (response.finalUrl.includes("search?")) {
  640. successHandler(response, callback);
  641. } else {
  642. console.log("错误");
  643. clearTimeouts();
  644. callback({ result: 3, message: "" });
  645. }
  646. },
  647. onreadystatechange: onResponseHeaderRecieved
  648. });
  649. }
  650. function genOrGetAywcUid() {
  651. const unifyidKey = "aywcUid";
  652. let aywcUid = fakeCookie.get(unifyidKey);
  653. if (isEmpty(aywcUid)) {
  654. aywcUid = randomString(10) + "_" + formatDate("yyyyMMddhhmmss", /* @__PURE__ */ new Date());
  655. fakeCookie.set(unifyidKey, aywcUid);
  656. }
  657. return aywcUid;
  658. }
  659. function isEmpty(x) {
  660. if (x == null || x == void 0 || x == "") {
  661. return true;
  662. } else {
  663. return false;
  664. }
  665. }
  666. function randomString(len, charSet) {
  667. charSet = charSet || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  668. var randomString2 = "";
  669. for (var i = 0; i < len; i++) {
  670. var randomPoz = Math.floor(Math.random() * charSet.length);
  671. randomString2 += charSet.substring(randomPoz, randomPoz + 1);
  672. }
  673. return randomString2;
  674. }
  675. function formatDate(fmt, date) {
  676. var o = {
  677. "M+": date.getMonth() + 1,
  678. "d+": date.getDate(),
  679. "h+": date.getHours(),
  680. "m+": date.getMinutes(),
  681. "s+": date.getSeconds(),
  682. "q+": Math.floor((date.getMonth() + 3) / 3),
  683. S: date.getMilliseconds()
  684. };
  685. if (/(y+)/.test(fmt)) {
  686. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  687. }
  688. for (var k in o) {
  689. if (new RegExp("(" + k + ")").test(fmt)) {
  690. fmt = fmt.replace(
  691. RegExp.$1,
  692. RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length)
  693. );
  694. }
  695. }
  696. return fmt;
  697. }
  698. }
  699. }
  700. const magnetTabsConfig = {
  701. id: "tianteng-magnet-tabs",
  702. tabs: [
  703. {
  704. id: "tianteng-tab-skrbt",
  705. title: "SKRBT",
  706. url: domainConfig.skrbt.searchUrl,
  707. default: true,
  708. type: 1
  709. },
  710. {
  711. id: "tianteng-tab-btsow",
  712. title: "BTSOW",
  713. url: domainConfig.btsow.searchUrl,
  714. extractor: function(doc, itemCallback) {
  715. const data = [];
  716. $("div.data-list>.row[class=row]", doc).each(function(index, item) {
  717. const detailUrl = "https:" + $("a", item).attr("href");
  718. const name = $("a>div:first", item).html();
  719. let magnet = $("a", item).attr("href").split("/magnet/detail/hash/")[1];
  720. magnet = `magnet:?xt=urn:btih:${magnet}`;
  721. const size = $(item).children("div").first().text().replace("文件大小:", "");
  722. const date = $(item).children("div").last().text().replace("时间:", "");
  723. const record = {
  724. detailUrl,
  725. name,
  726. magnet,
  727. size,
  728. date
  729. };
  730. data.push(record);
  731. itemCallback && itemCallback(record, index, item);
  732. });
  733. return data;
  734. }
  735. },
  736. {
  737. id: "tianteng-tab-ciligege",
  738. title: "CiLiGeGe",
  739. url: domainConfig.ciligege.searchUrl,
  740. extractor: function(doc, itemCallback) {
  741. const data = [];
  742. $("div.bt-list>.bt-card", doc).each(function(index, item) {
  743. const detailUrl = domainConfig.ciligege.url + $("a", item).attr("href");
  744. const name = $("a", item).html();
  745. let magnet = $("a", item).attr("href").replace("/search/", "");
  746. magnet = `magnet:?xt=urn:btih:${magnet}`;
  747. const size = $("div.bt-card-body>span", item).first().text().replace("文件大小:", "");
  748. const date = $("div.bt-card-body>span", item).last().text().replace("时间:", "");
  749. const record = {
  750. detailUrl,
  751. name,
  752. magnet,
  753. size,
  754. date
  755. };
  756. data.push(record);
  757. itemCallback && itemCallback(record, index, item);
  758. });
  759. return data;
  760. }
  761. },
  762. {
  763. id: "tianteng-tab-u9a9",
  764. title: "U9A9",
  765. url: domainConfig.u9a9.searchUrl,
  766. extractor: function(doc, itemCallback) {
  767. const data = [];
  768. $("tbody>tr", doc).each(function(index, item) {
  769. const a = $("td", item).eq(1).find("a");
  770. const detailUrl = domainConfig.u9a9.url + a.attr("href");
  771. const name = a.html();
  772. let magnet = $("td", item).eq(2).find("a").eq(1).attr("href");
  773. const size = $("td", item).eq(3).text();
  774. const date = $("td", item).eq(4).text();
  775. const record = {
  776. detailUrl,
  777. name,
  778. magnet,
  779. size,
  780. date
  781. };
  782. data.push(record);
  783. itemCallback && itemCallback(record, index, item);
  784. });
  785. return data;
  786. }
  787. }
  788. ]
  789. };
  790. class MagnetTab {
  791. /**
  792. *
  793. * @param {string} chepai 车牌号
  794. * @param {Function} onAttach 回调函数,function(tabContainer),
  795. * 参数tabContainer是整个MagnetTab的根节点,可以在此函数中把tabContainer插入到页面中
  796. * @param {object} tabsConfig 配置
  797. */
  798. constructor(chepai, onAttach, tabsConfig) {
  799. _GM_addStyle(_GM_getResourceText("tabbyjs/dist/css/tabby-ui.min.css"));
  800. this.chepai = chepai;
  801. if (tabsConfig) {
  802. this.tabsConfig = tabsConfig;
  803. } else {
  804. this.tabsConfig = magnetTabsConfig;
  805. }
  806. this.onAttach = onAttach;
  807. this.init();
  808. }
  809. getConfig(id) {
  810. for (let i = 0; this.tabsConfig.tabs.length; i++) {
  811. const config = this.tabsConfig.tabs[i];
  812. if (id === config.id) {
  813. return config;
  814. }
  815. }
  816. return null;
  817. }
  818. /**
  819. *
  820. * <ul id="tianteng-magnet-tabs">
  821. * <li><a data-tabby-default href="#tianteng-tab-skrbt">tab上的文字</a></li>
  822. * <li><a href="#hermione">tab上的文字</a></li>
  823. * <li><a href="#neville">tab上的文字</a></li>
  824. * </ul>
  825. *
  826. * <div id="tianteng-tab-skrbt">tab内容,是个table</div>
  827. * <div id="hermione">tab内容,是个table</div>
  828. * <div id="neville">tab内容,是个table</div>
  829. */
  830. init() {
  831. this.handleButtonClick();
  832. const fragment = document.createDocumentFragment();
  833. const ul = document.createElement("ul");
  834. ul.id = this.tabsConfig.id;
  835. fragment.append(ul);
  836. let defaultTabConfig;
  837. let defaultTab;
  838. let defaultTabContent;
  839. this.tabsConfig.tabs.forEach((tab, index, array) => {
  840. const li = document.createElement("li");
  841. const a = document.createElement("a");
  842. a.href = `#${tab.id}`;
  843. a.text = tab.title;
  844. li.append(a);
  845. ul.append(li);
  846. const div = document.createElement("div");
  847. div.id = tab.id;
  848. div.dataset["tiantengTabConfig"] = JSON.stringify(tab);
  849. div.dataset["tiantengChepai"] = this.chepai;
  850. div.tiantengTabConfig = tab;
  851. fragment.append(div);
  852. if (tab.default === true) {
  853. a.dataset["tabbyDefault"] = "";
  854. defaultTabConfig = tab;
  855. defaultTab = a;
  856. defaultTabContent = div;
  857. }
  858. });
  859. const tabsContainer = document.createElement("div");
  860. tabsContainer.id = "tianteng-tabs-container";
  861. tabsContainer.append(fragment);
  862. this.onAttach(tabsContainer);
  863. $(tabsContainer).before(`
  864. <style id='tianteng-tab-style'>
  865. #tianteng-tabs-container {
  866. background-color:white;
  867. margin-top:10px;
  868. margin-bottom:10px;
  869. padding:12px;
  870. }
  871. #tianteng-tabs-container strong,
  872. #tianteng-tabs-container em,
  873. #tianteng-tabs-container .high-light,
  874. #tianteng-tabs-container .highlight{
  875. font-weight:normal;
  876. color:#F00;
  877. }
  878. #tianteng-tabs-container tr:hover{
  879. background-color:#d7e7f4;
  880. }
  881. #tianteng-tabs-container th,
  882. #tianteng-tabs-container td{
  883. text-align:center;
  884. padding:10px,10px !important;
  885. }
  886. </style>`);
  887. _GM_addStyle(_GM_getResourceText("ldloader/index.min.css"));
  888. _GM_addStyle(_GM_getResourceText("ldbutton/index.min.css"));
  889. this.tabby = new Tabby(`#${this.tabsConfig.id}`);
  890. document.addEventListener(
  891. "tabby",
  892. (event) => {
  893. const tab = event.detail.tab;
  894. const content = event.detail.content;
  895. this.currentTabConfig = content.tiantengTabConfig;
  896. this.buildHtml(tab, content);
  897. },
  898. false
  899. );
  900. this.currentTabConfig = defaultTabConfig;
  901. this.buildHtml(defaultTab, defaultTabContent);
  902. }
  903. buildHtml(tab, tabContent) {
  904. if ($(tabContent).data("tiantengStatus") === "ok") {
  905. return;
  906. }
  907. let tabConfig = tabContent.tiantengTabConfig;
  908. let tableHtml = `
  909. <table class="tianteng-magnet-table"
  910. style="border-collapse: collapse;text-align:center;width:100%;">
  911. <thead style="position:sticky;top:0;background-color:#f5f5f5;">
  912. <tr>
  913. <th style="border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: none; border-bottom: none; text-align:left;">
  914. 磁力名称</th>
  915. <th style="border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: none; border-bottom: none;">
  916. 档案大小</th>
  917. <th style="border-left: 1px solid #ccc; border-right: 1px solid #ccc; border-top: none; border-bottom: none;">
  918. 分享日期</th>
  919. </tr>
  920. </thead>
  921. <tbody class="tianteng-magnet-tbody">
  922. {{tbody}}
  923. </tbody>
  924. </table>`;
  925. const searchUrl = tabConfig.url.replace("%s", this.chepai);
  926. if (tabConfig.type === 1 && tabConfig.id === "tianteng-tab-skrbt") {
  927. getSearchResultFromSkrbt(this.chepai, function(data) {
  928. if (data.result == 0) {
  929. let tbodyHtml = "";
  930. data.data.forEach(function(record, index, array) {
  931. tbodyHtml += `
  932. <tr>
  933. <td style="border: 1px solid #ccc; text-align:left; width:70%;">
  934. <a style="color:#333" target="_blank"
  935. title="打开磁链明细页面"
  936. href="${record.detailUrl}">
  937. ${record.name}
  938. </a>
  939. <button class="btn btn-danger tianteng-copy ld-ext-right"
  940. type="button"
  941. data-tianteng-magnet-url="${record.detailUrl}"
  942. data-tianteng-magnet="${record.magnet}">
  943. 复制磁链
  944. <div class="ld ldld bare"
  945. style="width:1em;height:1em">
  946. </div>
  947. </button>
  948. <button class="btn btn-danger tianteng-click ld-ext-right"
  949. type="button"
  950. data-tianteng-magnet-url="${record.detailUrl}"
  951. data-tianteng-magnet="${record.magnet}">
  952. 打开磁链
  953. <div class="ld ldld bare"
  954. style="width:1em;height:1em">
  955. </div>
  956. </button>
  957. </td>
  958. <td style="border: 1px solid #ccc;">${record.size}</td>
  959. <td style="border: 1px solid #ccc;">${record.date}</td>
  960. </tr>
  961. `;
  962. });
  963. tableHtml = tableHtml.replace("{{tbody}}", tbodyHtml);
  964. $(tabContent).append(tableHtml);
  965. $(tabContent).data("tiantengStatus", "ok");
  966. }
  967. });
  968. } else {
  969. _GM_xmlhttpRequest({
  970. method: "GET",
  971. url: searchUrl,
  972. headers: makeRequestHeaders({ Referer: searchUrl }),
  973. onerror: function() {
  974. debug(arguments, "onerror");
  975. },
  976. ontimeout: function() {
  977. debug(arguments, "ontimeout");
  978. },
  979. onreadystatechange: function() {
  980. debug(arguments, "onreadystatechange");
  981. },
  982. onabort: function() {
  983. debug(arguments, "onabort");
  984. },
  985. onloadstart: function() {
  986. debug(arguments, "onloadstart");
  987. },
  988. onprogress: function() {
  989. debug(arguments, "onprogress");
  990. },
  991. onload: function(response) {
  992. debug(arguments, "onload");
  993. const doc = $(response.responseText);
  994. let tbodyHtml = "";
  995. tabConfig.extractor(doc, (record, index, item) => {
  996. tbodyHtml += `
  997. <tr>
  998. <td style="border: 1px solid #ccc; text-align:left; width:70%;">
  999. <a style="color:#333" target="_blank"
  1000. title="打开磁链明细页面"
  1001. href="${record.detailUrl}">
  1002. ${record.name}
  1003. </a>
  1004. <button class="btn btn-danger tianteng-copy"
  1005. type="button"
  1006. data-tianteng-magnet="${record.magnet}">复制磁链</button>
  1007. <button class="btn btn-danger tianteng-click"
  1008. type="button"
  1009. data-tianteng-magnet="${record.magnet}">打开磁链</button>
  1010. </td>
  1011. <td style="border: 1px solid #ccc;">${record.size}</td>
  1012. <td style="border: 1px solid #ccc;">${record.date}</td>
  1013. </tr>
  1014. `;
  1015. });
  1016. tableHtml = tableHtml.replace("{{tbody}}", tbodyHtml);
  1017. $(tabContent).append(tableHtml);
  1018. $(tabContent).data("tiantengStatus", "ok");
  1019. }
  1020. });
  1021. }
  1022. }
  1023. // end buildHtml
  1024. /**
  1025. * 复制磁链 和 打开磁链 按钮点击事件
  1026. */
  1027. handleButtonClick() {
  1028. $(document).on("click", "button.tianteng-click, button.tianteng-copy", (e) => {
  1029. if (this.currentTabConfig.type === 1 && this.currentTabConfig.id === "tianteng-tab-skrbt") {
  1030. const button = e.target;
  1031. const magnet = button.dataset["tiantengMagnet"];
  1032. if (magnet !== "undefined") {
  1033. if ($(button).attr("class").includes("tianteng-copy")) {
  1034. _GM_setClipboard(magnet, "text");
  1035. } else {
  1036. _GM_openInTab(magnet);
  1037. }
  1038. e.preventDefault();
  1039. e.stopImmediatePropagation();
  1040. e.stopPropagation();
  1041. return false;
  1042. } else {
  1043. const buttons = $(".tianteng-magnet-tbody .ld-ext-right");
  1044. const ldld = new ldloader({ root: buttons.toArray() });
  1045. buttons.attr("disabled", true);
  1046. ldld.toggle();
  1047. _GM_xmlhttpRequest({
  1048. method: "get",
  1049. headers: makeRequestHeaders({ Referer: `${domainConfig.skrbt.url}/search` }),
  1050. url: button.dataset["tiantengMagnetUrl"],
  1051. onerror: function(e2) {
  1052. console.log("获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.");
  1053. buttons.attr("disabled", false);
  1054. ldld.off();
  1055. },
  1056. onload: function(response) {
  1057. buttons.attr("disabled", false);
  1058. ldld.off();
  1059. const magnet2 = $(response.responseText).find("#magnet").attr("href");
  1060. if (magnet2) {
  1061. button.dataset["tiantengMagnet"] = magnet2;
  1062. if ($(button).attr("class").includes("tianteng-copy")) {
  1063. button.nextElementSibling.dataset["tiantengMagnet"] = magnet2;
  1064. _GM_setClipboard(magnet2, "text");
  1065. } else {
  1066. button.previousElementSibling.dataset["tiantengMagnet"] = magnet2;
  1067. _GM_openInTab(magnet2);
  1068. }
  1069. e.preventDefault();
  1070. e.stopImmediatePropagation();
  1071. e.stopPropagation();
  1072. } else {
  1073. console.log("获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.");
  1074. console.log(response);
  1075. }
  1076. }
  1077. });
  1078. }
  1079. } else {
  1080. const button = e.target;
  1081. const magnet = button.dataset["tiantengMagnet"];
  1082. if ($(button).attr("class").includes("tianteng-copy")) {
  1083. _GM_setClipboard(magnet, "text");
  1084. } else {
  1085. _GM_openInTab(magnet);
  1086. }
  1087. e.preventDefault();
  1088. e.stopImmediatePropagation();
  1089. e.stopPropagation();
  1090. return false;
  1091. }
  1092. });
  1093. }
  1094. }
  1095. class JavlibHandler extends Handler {
  1096. get name() {
  1097. return "javlib";
  1098. }
  1099. get condition() {
  1100. return $('head>title:contains("JAVLibrary")');
  1101. }
  1102. handle(condition, keyOrIndex) {
  1103. debug("所有页面", "Javlib");
  1104. debug("删除广告", "Javlib");
  1105. $(".socialmedia,#bottombanner13,#topbanner11,#sidebanner11").remove();
  1106. $("#leftmenu>div>ul:nth-child(2)>li:nth-child(2)").remove();
  1107. debug("调节UI", "Javlib");
  1108. $("#content").css("padding-top", "10px");
  1109. $("#toplogo").css("height", "50px");
  1110. $("#toplogo").find('img[src*="logo-top"]').attr("height", "40");
  1111. debug("添加 粘贴&搜索 按钮", "Javlib");
  1112. const styleMap = {};
  1113. $("#idsearchbutton")[0] && $("#idsearchbutton")[0].computedStyleMap().forEach((value, key) => {
  1114. styleMap[key] = value;
  1115. });
  1116. const $pasteAndSearchButton = $(
  1117. `<input type="button" value="粘贴&搜索" id="pasteAndSearch"></input>`
  1118. );
  1119. $pasteAndSearchButton.css(styleMap);
  1120. $pasteAndSearchButton.on("click", () => {
  1121. navigator.clipboard.readText().then((clipText) => {
  1122. if (clipText != null && $.trim(clipText) != "") {
  1123. $("#idsearchbox").val(clipText);
  1124. $("#idsearchbutton").trigger("click");
  1125. }
  1126. });
  1127. });
  1128. $("#idsearchbutton").parent().append($pasteAndSearchButton);
  1129. debug("添加 打开skrbt 连接", "Javlib");
  1130. $(".advsearch").append(
  1131. `&nbsp;&nbsp;
  1132. <a href="${domainConfig.skrbt.url}"
  1133. target="_blank"
  1134. class="tianteng-search-anchor"
  1135. title="打开后自动搜索剪贴板中的内容">打开skrbt</a>`
  1136. );
  1137. debug("删除url重定向", "Javlib");
  1138. $.each($("a[href^='redirect.php?url']"), function(index, a) {
  1139. var url = getUrlParam(a.href, "url");
  1140. a.href = url;
  1141. if (!a.href.startsWith("https")) {
  1142. a.href = a.href.replace("http", "https");
  1143. }
  1144. a.text = a.text + " " + a.href + " ";
  1145. if (a.href.includes("yimuhe")) {
  1146. $(a).parentsUntil("tr").closest(".t").css("background-color", "#6B6C83");
  1147. a.style = "font-size:20px;";
  1148. } else {
  1149. a.style = "font-size:20px;";
  1150. }
  1151. });
  1152. if (/.*\?v=.*/.test(location.href)) {
  1153. debug("详情页面", "Javlib");
  1154. debug("添加 复制车牌 按钮", "Javlib");
  1155. let chePai = document.querySelector("#video_id > table > tbody > tr > td.text").innerText;
  1156. let toAppendElement = document.querySelector("#video_id > table > tbody > tr > td.text");
  1157. appendCopyButton(chePai, toAppendElement);
  1158. debug("添加 javbus中查询 链接", "Javlib");
  1159. let trTag = document.querySelector("#video_id > table > tbody > tr");
  1160. let javdbQueryId = "javdbQueryId";
  1161. trTag.innerHTML = [
  1162. trTag.innerHTML,
  1163. '<td><a id="',
  1164. javdbQueryId,
  1165. '"href="',
  1166. domainConfig.javbus.url,
  1167. "/",
  1168. chePai,
  1169. '">javbus中查询</a></td>'
  1170. ].join("");
  1171. debug("添加 用SkrBt搜索 链接", "Javlib");
  1172. $(trTag).append(`
  1173. <td>
  1174. <a
  1175. class="tianteng-search-anchor"
  1176. href="${domainConfig.skrbt.url}/search?keyword=${chePai}"
  1177. data-tianteng-keyword="${chePai}">
  1178. SkrBt搜索
  1179. </a>
  1180. </td>
  1181. `);
  1182. $(".tianteng-search-anchor").on("click mouseup", function() {
  1183. const keyword = $(this).data("tiantengKeyword");
  1184. if (keyword) {
  1185. _GM_setValue("tiantengKeyword", keyword);
  1186. }
  1187. });
  1188. debug("删除名称中的链接", "Javlib");
  1189. const videoTitleNode = document.querySelector("#video_title > h3 > a");
  1190. if (videoTitleNode) {
  1191. const videoTitle = videoTitleNode.getInnerHTML();
  1192. videoTitleNode.parentNode.innerText = videoTitle;
  1193. }
  1194. debug("添加磁链tab", "Javlib");
  1195. new MagnetTab(chePai, (fragment) => {
  1196. $("#video_favorite_edit").after(fragment);
  1197. });
  1198. }
  1199. }
  1200. }
  1201. class JavbusHandler extends Handler {
  1202. get name() {
  1203. return "javbus";
  1204. }
  1205. get condition() {
  1206. return {
  1207. a1: $('head>title:contains("JavBus")'),
  1208. // /genre/hd , /genre/sub
  1209. a2: $("body > nav > div > div.navbar-header.mh50 > a > img[alt='JavBus']"),
  1210. // 论坛
  1211. luntan: "#toptb.jav-nav"
  1212. };
  1213. }
  1214. handle(condition, keyOrIndex) {
  1215. debug(`keyOrIndex:${keyOrIndex}`);
  1216. debug("添加 粘贴&搜索 按钮", "javbus");
  1217. const searchButton = $(`button[onclick="searchs('search-input')"]:first`);
  1218. const searchInput = $("#search-input:first");
  1219. addPasteAndSearchButton(searchButton, searchInput);
  1220. $(".nav>li>a").attr("style", "padding-left:8px;padding-right:8px;");
  1221. debug("添加 打开skrbt 链接", "javbus");
  1222. $(".nav-title.nav-inactive:last,ul.nav.navbar-nav:first").append(`
  1223. <li class="hidden-md hidden-sm">
  1224. <a href="${domainConfig.skrbt.url}" target="_blank">打开skrbt</a>
  1225. </li>
  1226. `);
  1227. debug("添加 打开今日新帖 按钮", "javbus");
  1228. let todayNewButton = $(
  1229. `<button id="tiantengNewButton"
  1230. class="jav-button btn btn-default ld-ext-right"
  1231. title="打开老司机福利讨论区的今日新帖,最多30个"
  1232. style="margin-top:7px;">
  1233.  
  1234. <span>打开今日新帖</span>
  1235. <div class="ld ldld bare"
  1236. style="width:1em;height:1em">
  1237. </div>
  1238. </button>`
  1239. );
  1240. _GM_addStyle(_GM_getResourceText("ldloader/index.min.css"));
  1241. _GM_addStyle(_GM_getResourceText("ldbutton/index.min.css"));
  1242. $(".nav-title.nav-inactive:last,ul.nav.navbar-nav:first").append(todayNewButton);
  1243. let loading = new ldloader({ root: "#tiantengNewButton" });
  1244. todayNewButton.on("click", function() {
  1245. if (loading.running) {
  1246. debug("正在加载数据,忽略点击...", "javbus");
  1247. return;
  1248. }
  1249. loading.toggle();
  1250. todayNewButton.attr("disabled", "true");
  1251. const origin = location.origin;
  1252. const talkUrl = `${origin}/forum/forum.php?mod=forumdisplay&fid=2&filter=author&orderby=dateline&dateline=86400`;
  1253. const now = /* @__PURE__ */ new Date();
  1254. const today = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
  1255. async function getPostData(url, date, pageNum) {
  1256. const r = await _GM.xmlHttpRequest({
  1257. url,
  1258. headers: {
  1259. Accept: `text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7`,
  1260. "Accept-Encoding": "gzip, deflate, br",
  1261. "Accept-Language": "zh-CN,zh;q=0.9",
  1262. "Cache-Control": "max-age=0"
  1263. }
  1264. }).catch((e) => {
  1265. loading.off();
  1266. todayNewButton.attr("disabled", false);
  1267. console.error(e);
  1268. debug(e, "javbus");
  1269. alert("获取数据出现错误!!");
  1270. });
  1271. const data = $(r.responseXML);
  1272. const result = [];
  1273. $(".post_inforight", data).each(function() {
  1274. const date2 = $("span.dateline>span", $(this)).attr("title");
  1275. if (date2 === today) {
  1276. let postUrl = $("a.s", $(this)).attr("href");
  1277. result.push(`${origin}/forum/${postUrl}`);
  1278. }
  1279. });
  1280. return result;
  1281. }
  1282. getPostData(talkUrl).then(function(urlArray) {
  1283. if (urlArray.length === 0) {
  1284. debug("没有新的帖子", "javbus");
  1285. alert("没有新的帖子.");
  1286. }
  1287. $(urlArray).each(function() {
  1288. _GM_openInTab(this, true);
  1289. });
  1290. loading.off();
  1291. todayNewButton.attr("disabled", false);
  1292. });
  1293. });
  1294. let chePaiNode = document.querySelector(
  1295. "body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1) > span:nth-child(2)"
  1296. );
  1297. if (chePaiNode) {
  1298. debug("添加复制车牌号按钮", "javbus");
  1299. const chePai = chePaiNode.innerText.trim();
  1300. const toAppendElement = document.querySelector(
  1301. "body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1)"
  1302. );
  1303. appendCopyButton(
  1304. chePai,
  1305. toAppendElement,
  1306. (copyButton) => copyButton.className = "jav-button btn btn-default"
  1307. );
  1308. debug("删除磁力链接中的onclick事件", "javbus");
  1309. setInterval(() => $("#magnet-table td").removeAttr("onclick"), 1e3);
  1310. debug("添加 在javlibrary中打开", "javabus");
  1311. const javLibLink = `<a href="${domainConfig.javlib.url}/cn/vl_searchbyid.php?keyword=${chePai}">在javlib中打开</a>`;
  1312. $(toAppendElement).append(javLibLink);
  1313. new MagnetTab(chePai, (fragment) => {
  1314. $("div.row.movie").after(fragment);
  1315. });
  1316. }
  1317. if (location.href.includes("mod=viewthread")) {
  1318. let toAlienMagnet = function(magnet, alien) {
  1319. alien = alien ? alien : "-";
  1320. let part1 = magnet.slice(0, 21);
  1321. let part2 = magnet.slice(21);
  1322. return `${part1}${alien}${part2}`;
  1323. }, toNormalMagnet = function(magnet, alien) {
  1324. alien = alien ? alien : "-";
  1325. return magnet.replace(alien, "");
  1326. }, getMagnetRegExp = function(alien) {
  1327. if (alien) {
  1328. return new RegExp(
  1329. `(?:magnet:\\?xt=urn:btih:)?(?:(?:[0-9a-f]{1}${alien}[0-9a-f]{39})|(?:[2-7a-zA-Z]${alien}[2-7a-zA-Z]{31}))`,
  1330. "gim"
  1331. );
  1332. } else {
  1333. return /(?:magnet:\?xt=urn:btih:)?(?:[0-9a-fA-F]{40}|[2-7a-zA-Z]{32})/gim;
  1334. }
  1335. }, completeMagnet = function(magnet) {
  1336. if (!magnet) {
  1337. return magnet;
  1338. }
  1339. if (magnet.length === 32 || magnet.length === 40) {
  1340. return `magnet:?xt=urn:btih:${magnet}`;
  1341. }
  1342. return magnet;
  1343. };
  1344. debug("调整样式", "论坛明细页面");
  1345. _GM_addStyle(`
  1346. #p_btn {
  1347. padding:0;
  1348. }
  1349. .mtw {
  1350. margin-top: 0px !important;
  1351. }
  1352. .mbm {
  1353. margin-bottom: 10px !important;
  1354. }
  1355. .pi {
  1356. overflow: hidden;
  1357. margin-bottom: 0;
  1358. padding: 0;
  1359. height: 16px;
  1360. border-bottom: 1px dashed #CDCDCD;
  1361. }
  1362. .pct {
  1363. padding-bottom: 0;
  1364. }
  1365. .t_fsz {
  1366. min-height: auto;
  1367. }
  1368. .nthread_postinfo {
  1369. margin: 0 -16px;
  1370. border-top: 10px solid #f5f5f5;
  1371. padding: 10px 40px;
  1372. }
  1373. .pcb .cm .psth {
  1374. margin-bottom: 0px;
  1375. }
  1376. .pcb .psth {
  1377. width: 100%;
  1378. font-size: 17px !important;
  1379. line-height: 28px;
  1380. font-weight: normal;
  1381. color: #454545;
  1382. background: none;
  1383. border-bottom: 1px solid #CECECE;
  1384. padding: 0;
  1385. margin: 10px 0 0;
  1386. }
  1387. .pstl {
  1388. clear: left;
  1389. padding: 0em 0;
  1390. }
  1391. hin .pob {
  1392. padding-bottom: 0px !important;
  1393. }
  1394. .plc{padding-top:14px}
  1395. `);
  1396. debug("为磁链添加按钮", "论坛明细页面");
  1397. $(document).on("click", 'button[class*="tianteng-button"]', function(e) {
  1398. let button = $(e.target);
  1399. let buttonType = button.data("tiantengButton");
  1400. if (buttonType === "copy") {
  1401. let magnet = button.data("tiantengMagnet");
  1402. _GM.setClipboard(toNormalMagnet(magnet), "text");
  1403. return;
  1404. }
  1405. if (buttonType === "click") {
  1406. let magnet = button.data("tiantengMagnet");
  1407. setTimeout(() => window.open(toNormalMagnet(magnet)), 500);
  1408. return;
  1409. }
  1410. if (buttonType === "copyAll") {
  1411. let postId = button.data("tiantengPostId");
  1412. let magnets = "";
  1413. $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each(function() {
  1414. let magnet = $(this).data("tiantengMagnet");
  1415. magnets = magnets + toNormalMagnet(magnet) + "\n";
  1416. });
  1417. _GM.setClipboard(magnets, "text");
  1418. return;
  1419. }
  1420. if (buttonType === "clickAll") {
  1421. let postId = button.data("tiantengPostId");
  1422. $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each(function() {
  1423. let magnet = $(this).data("tiantengMagnet");
  1424. magnet = toNormalMagnet(magnet);
  1425. setTimeout(() => window.open(toNormalMagnet(magnet)), 500);
  1426. });
  1427. return;
  1428. }
  1429. if (buttonType === "copyAllNot") {
  1430. let postId = button.data("tiantengPostMessageId");
  1431. let magnets = "";
  1432. $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each(function() {
  1433. let magnet = $(this).data("tiantengMagnet");
  1434. magnets = magnets + toNormalMagnet(magnet) + "\n";
  1435. });
  1436. _GM.setClipboard(magnets, "text");
  1437. return;
  1438. }
  1439. if (buttonType === "clickAllNot") {
  1440. let postId = button.data("tiantengPostMessageId");
  1441. $(`[data-tianteng-button="copy"]`, $(`#${postId}`)).each(function() {
  1442. let magnet = $(this).data("tiantengMagnet");
  1443. magnet = toNormalMagnet(magnet);
  1444. setTimeout(() => window.open(toNormalMagnet(magnet)), 500);
  1445. });
  1446. return;
  1447. }
  1448. });
  1449. let magnetRegExp = getMagnetRegExp();
  1450. $(`div[id^="post_"] a[href^="magnet:?xt=urn:btih:"]`).each(function() {
  1451. let magnetAlien = completeMagnet($(this).attr("href"));
  1452. magnetAlien = toAlienMagnet(magnetAlien);
  1453. let html = this.outerHTML.replace(
  1454. magnetRegExp,
  1455. (match, offset, str) => toAlienMagnet(completeMagnet(match), "@")
  1456. );
  1457. html = html.replace("href", `data-tianteng-status="ok" href`);
  1458. html = `${html}
  1459. <button style="margin:0;padding:3px;"
  1460. class="jav-button tianteng-button"
  1461. data-tianteng-button="copy"
  1462. data-tianteng-magnet="${magnetAlien}"
  1463. type="button">复制磁链
  1464. </button>
  1465. <button style="margin:0;padding:3px;"
  1466. class="jav-button tianteng-button"
  1467. data-tianteng-button="click"
  1468. data-tianteng-magnet="${magnetAlien}"
  1469. type="button">打开磁链
  1470. </button>`;
  1471. this.outerHTML = html;
  1472. });
  1473. $('div[id^="post_"]').each(function() {
  1474. const treeWalker = document.createTreeWalker(this, NodeFilter.SHOW_TEXT);
  1475. while (treeWalker.nextNode()) {
  1476. const node = treeWalker.currentNode;
  1477. if (node.nodeValue && magnetRegExp.test(node.nodeValue)) {
  1478. node.nodeValue = node.nodeValue.replace(
  1479. magnetRegExp,
  1480. (match, offset, str) => toAlienMagnet(completeMagnet(match), "tianteng")
  1481. );
  1482. }
  1483. }
  1484. });
  1485. $('div[id^="post_"]').each(function() {
  1486. let magnetAlienRegExp = getMagnetRegExp("tianteng");
  1487. let html = this.innerHTML;
  1488. html = html.replace(magnetAlienRegExp, function(match) {
  1489. match = toNormalMagnet(match, "tianteng");
  1490. let magnetAlien = toAlienMagnet(match);
  1491. return `
  1492. <a href="${match}" data-tianteng-status="ok">${match}</a>
  1493. <button style="margin:0;padding:3px;"
  1494. class="jav-button tianteng-button"
  1495. data-tianteng-button="copy"
  1496. data-tianteng-magnet="${magnetAlien}"
  1497. type="button">复制磁链
  1498. </button>
  1499. <button style="margin:0;padding:3px;"
  1500. class="jav-button tianteng-button"
  1501. data-tianteng-button="click"
  1502. data-tianteng-magnet="${magnetAlien}"
  1503. type="button">打开磁链
  1504. </button>`;
  1505. });
  1506. magnetAlienRegExp = getMagnetRegExp("@");
  1507. html = html.replace(magnetAlienRegExp, function(match) {
  1508. return toNormalMagnet(match, "@");
  1509. });
  1510. this.innerHTML = html;
  1511. const postId = $(this).attr("id");
  1512. const id = postId.replace("post_", "");
  1513. const postMessageId = `postmessage_${id}`;
  1514. if ($(`[data-tianteng-button="copy"]`, $(`#${postId}`)).length > 0) {
  1515. let allButtonHtml = `
  1516. <button style="margin:0;padding:5px;"
  1517. class="jav-button tianteng-button"
  1518. data-tianteng-button="copyAll"
  1519. data-tianteng-post-id="${postId}"
  1520. data-tianteng-post-message-id="${postMessageId}"
  1521. type="button">复制所有磁链
  1522. </button>
  1523. <button style="margin:0;padding:5px;"
  1524. class="jav-button tianteng-button"
  1525. data-tianteng-button="clickAll"
  1526. data-tianteng-post-id="${postId}"
  1527. data-tianteng-post-message-id="${postMessageId}"
  1528. type="button">打开所有磁链
  1529. </button>
  1530. <button style="margin:0;padding:5px;margin-left:10px;"
  1531. class="jav-button tianteng-button"
  1532. data-tianteng-button="copyAllNot"
  1533. data-tianteng-post-id="${postId}"
  1534. data-tianteng-post-message-id="${postMessageId}"
  1535. type="button">复制所有磁链(不含点评)
  1536. </button>
  1537. <button style="margin:0;padding:5px;"
  1538. class="jav-button tianteng-button"
  1539. data-tianteng-button="clickAllNot"
  1540. data-tianteng-post-id="${postId}"
  1541. data-tianteng-post-message-id="${postMessageId}"
  1542. type="button">打开所有磁链(不含点评)
  1543. </button>`;
  1544. $(`#${postMessageId}`).prepend(allButtonHtml + "<br><br>");
  1545. $(`#${postMessageId}`).append("<br><br>" + allButtonHtml);
  1546. }
  1547. });
  1548. }
  1549. }
  1550. }
  1551. class BtsowHandler extends Handler {
  1552. get name() {
  1553. return "BTSOW";
  1554. }
  1555. get condition() {
  1556. return $('head>title:contains("BTSOW")');
  1557. }
  1558. handle(condition, keyOrIndex) {
  1559. function allPages() {
  1560. const form = $("form.fullsearch-form");
  1561. form.each(function() {
  1562. const me = $(this);
  1563. if ($(".tianteng-paste-search", me).length === 0) {
  1564. const searchButton = $(`:submit`, me);
  1565. const pasteAndSearchButton = $(`
  1566. <button type="button" class="btn btn-default tianteng-paste-search">
  1567. 粘贴&搜索
  1568. </button>`);
  1569. searchButton.after(pasteAndSearchButton);
  1570. }
  1571. });
  1572. }
  1573. function searchPage() {
  1574. if (location.pathname.startsWith("/search")) {
  1575. debug("添加 复制磁链,打开磁链 按钮", "btsow-搜索结果列表");
  1576. let buttonsHtml = `
  1577. <button class="btn btn-danger copy" type="button">复制磁链</button>
  1578. <button class="btn btn-danger click" type="button">打开磁链</button>`;
  1579. $("div.data-list>div.row>a>div.file").each((index, el) => {
  1580. if ($(el).find("button.copy").length === 0) {
  1581. $(el).append(buttonsHtml);
  1582. }
  1583. });
  1584. }
  1585. }
  1586. debug("添加 粘贴&搜索 按钮", "btsow-所有页面");
  1587. allPages();
  1588. $(document).on("click", "button.tianteng-paste-search", function(e) {
  1589. const me = $(this);
  1590. navigator.clipboard.readText().then((text) => {
  1591. if (text != null && $.trim(text) != "") {
  1592. me.parent().prev().val($.trim(text));
  1593. me.parentsUntil(".container")[2].submit();
  1594. }
  1595. });
  1596. e.preventDefault();
  1597. e.stopImmediatePropagation();
  1598. e.stopPropagation();
  1599. return false;
  1600. });
  1601. searchPage();
  1602. if (location.pathname.startsWith("/search")) {
  1603. debug("添加 复制磁链,打开磁链 按钮", "btsow-搜索结果列表");
  1604. $(document).on("click", "button.copy, button.click", function(e) {
  1605. let magnet = $(this).parent().parent().attr("href").split("/")[6];
  1606. magnet = `magnet:?xt=urn:btih:${magnet}`;
  1607. if ($(this).attr("class").includes("copy")) {
  1608. _GM_setClipboard(magnet, "text");
  1609. } else if ($(this).attr("class").includes("click")) {
  1610. _GM_openInTab(magnet);
  1611. }
  1612. e.preventDefault();
  1613. e.stopImmediatePropagation();
  1614. e.stopPropagation();
  1615. });
  1616. }
  1617. const nodeToObserve = document.querySelector("body");
  1618. new MutationObserver((mutationRecords, observer) => {
  1619. allPages();
  1620. searchPage();
  1621. }).observe(nodeToObserve, { childList: true });
  1622. }
  1623. }
  1624. class SkrbtHandler extends Handler {
  1625. get name() {
  1626. return "skrbt";
  1627. }
  1628. get condition() {
  1629. return $(`head>link[rel='shortcut icon'][href*='skrbt']`);
  1630. }
  1631. handle(condition, keyOrIndex) {
  1632. debug("添加 粘贴&搜索 按钮", "skrbt");
  1633. const $searchButton = $("button.search-btn");
  1634. const $searchInput = $(`input.search-input[name='keyword']`);
  1635. const $pasteAndSearchButton = addPasteAndSearchButton($searchButton, $searchInput);
  1636. $pasteAndSearchButton.removeAttr("style");
  1637. $pasteAndSearchButton.css("margin-left", "3px");
  1638. $pasteAndSearchButton.attr("class", $searchButton.attr("class"));
  1639. if (location.pathname === "/") {
  1640. const keyword = _GM_getValue("tiantengKeyword", null);
  1641. if (keyword) {
  1642. debug("搜索存储的内容", "skrbt-首页");
  1643. _GM_deleteValue("tiantengKeyword");
  1644. $searchInput.val(keyword);
  1645. $searchButton.click();
  1646. } else {
  1647. debug("搜索剪贴板中的内容", "skrbt-首页");
  1648. $pasteAndSearchButton.click();
  1649. }
  1650. }
  1651. debug("删除广告", "skrbt");
  1652. function removeAd() {
  1653. const $container = $(".col-md-6:eq(2)");
  1654. $container.remove(".label.label-primary");
  1655. $container.find('a.rrt.common-link[href^="http"]').parent().parent().remove();
  1656. }
  1657. removeAd();
  1658. if (location.href.includes("search")) {
  1659. debug("添加 复制磁链和打开磁链 按钮", "skrbt-搜索结果列表页面");
  1660. let buttonsHtml = `
  1661. <span class="rrmiv"><button class="btn btn-danger tianteng-button-copy" type="button">复制磁链</button></span>
  1662. <span class="rrmiv"><button class="btn btn-danger tianteng-button-click" type="button">打开磁链</button></span>`;
  1663. addButtonsForSkrbt(buttonsHtml, $(".col-md-6:eq(2)"), (el) => {
  1664. const classValue = $(el).attr("class");
  1665. if (classValue && classValue.includes("tianteng-button-copy")) {
  1666. return "copy";
  1667. }
  1668. if (classValue && classValue.includes("tianteng-button-click")) {
  1669. return "click";
  1670. }
  1671. return "other";
  1672. });
  1673. const nodeToObserve = document.querySelectorAll(".col-md-6")[2];
  1674. new MutationObserver((mutationRecords, observer) => {
  1675. $("a.rrt.common-link").each((index, el) => {
  1676. if ($(el).parent().find(".btn.btn-danger.tianteng-button-copy").length === 0) {
  1677. $(el).after(buttonsHtml);
  1678. }
  1679. });
  1680. removeAd();
  1681. }).observe(nodeToObserve, { childList: true });
  1682. }
  1683. }
  1684. }
  1685. function addButtonsForSkrbt(buttonsHtml, delegateElement, buttonTypeCallback) {
  1686. delegateElement.find("a.rrt.common-link").after(buttonsHtml);
  1687. delegateElement.on("click", '[class*="tianteng-button"]', (event) => {
  1688. const buttonType = buttonTypeCallback(event.target);
  1689. if ("copy" !== buttonType && "click" !== buttonType) {
  1690. return;
  1691. }
  1692. let liNode = $(event.target).parent().parent();
  1693. const exeButtonClick = (e) => {
  1694. if ("copy" === buttonType) {
  1695. navigator.clipboard.writeText(liNode.find(".magnet").attr("href"));
  1696. } else {
  1697. _GM_openInTab(liNode.find(".magnet").attr("href"));
  1698. }
  1699. e.preventDefault();
  1700. e.stopImmediatePropagation();
  1701. e.stopPropagation();
  1702. return false;
  1703. };
  1704. if (liNode.find(".magnet").length != 0) {
  1705. return exeButtonClick(event);
  1706. }
  1707. let detailUrl = liNode.find("a.rrt.common-link").attr("href");
  1708. detailUrl = `${location.origin}${detailUrl}`;
  1709. $.get(detailUrl, function(data, textStatus, jqXHR) {
  1710. liNode.find("#errorTip").remove();
  1711. const magnet = $(data).find("#magnet").attr("href");
  1712. if (magnet) {
  1713. const aHtml = '<a class="magnet" href="' + magnet + '">' + magnet + "</a>";
  1714. liNode.append(aHtml);
  1715. return exeButtonClick(event);
  1716. } else {
  1717. liNode.append(
  1718. '<span id="errorTip">1.获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>'
  1719. );
  1720. event.preventDefault();
  1721. event.stopImmediatePropagation();
  1722. event.stopPropagation();
  1723. return false;
  1724. }
  1725. }).fail(function(e) {
  1726. liNode.append(
  1727. '<span id="errorTip">2.获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>'
  1728. );
  1729. event.preventDefault();
  1730. event.stopImmediatePropagation();
  1731. event.stopPropagation();
  1732. console.log(e);
  1733. return false;
  1734. });
  1735. });
  1736. }
  1737. class JinManTianTangHandler extends Handler {
  1738. get name() {
  1739. return "禁漫天堂";
  1740. }
  1741. get condition() {
  1742. return $(`head>title`)[0] && $(`head>title`)[0].text.endsWith("禁漫天堂");
  1743. }
  1744. handle(condition, keyOrIndex) {
  1745. observe(document, { childList: true, subtree: true }, () => {
  1746. debug(" 删除广告", "禁漫天堂");
  1747. $(".top-nav, .div-bf-pv").remove();
  1748. $("#Comic_Top_Nav").css("top", "-1px");
  1749. $("div.e8c78e-4_b").remove();
  1750. if (location.pathname === "/albums") {
  1751. const childNodes = document.querySelector("#wrapper > div.container").childNodes;
  1752. var forEach = Array.prototype.forEach;
  1753. forEach.call(childNodes, function(node) {
  1754. if (node.nodeName === "#text" && node.nodeValue.includes("中間廣告")) {
  1755. node.nodeValue = "";
  1756. }
  1757. });
  1758. }
  1759. });
  1760. }
  1761. }
  1762. debug(document.querySelector("title"));
  1763. if (location.href.includes("ahri8.top")) {
  1764. interceptEventListener((target, type, callback, options) => {
  1765. if (target.className && target.className.includes && target.className.includes("apo")) {
  1766. debug("禁止点击广告", "松鼠症倉庫");
  1767. return true;
  1768. }
  1769. });
  1770. }
  1771. $(() => {
  1772. const handlerList = [
  1773. BaiduHandler,
  1774. OsChinaHandler,
  1775. GiteeHandler,
  1776. ZhihuHandler,
  1777. WnacgHandler,
  1778. JavlibHandler,
  1779. JavbusHandler,
  1780. BtsowHandler,
  1781. SkrbtHandler,
  1782. JinManTianTangHandler
  1783. ];
  1784. const executor = new HandlerExecutor();
  1785. for (const handler of handlerList) {
  1786. const instance = new handler();
  1787. const className = instance.constructor.name;
  1788. executor.handler = instance;
  1789. const result = executor.execute();
  1790. const resultJson = JSON.stringify(result);
  1791. debug(`执行 ${instance.name}(${className}), result: ${resultJson}`, "main");
  1792. }
  1793. });
  1794.  
  1795. })(jQuery, Tabby, ldloader);