Sleazy Fork is available in English.

tianteng

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

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