yimuhe

1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接,去除名称中的链接,方便复制;添加 在javbus中查询 链接;添加磁力链

Versione datata 19/06/2024. Vedi la nuova versione l'ultima versione.

  1. // ==UserScript==
  2. // @name yimuhe
  3. // @namespace https://greasyfork.org/zh-CN/scripts/38740-yimuhe
  4. // @version 2.13.15
  5. // @description 1.去除javlibrary详情页面中下载url的重定向;高亮yimuhe的下载链接,去除名称中的链接,方便复制;添加 在javbus中查询 链接;添加磁力链
  6. // 2.破坏torrentkitty的脚本变量引用. 原先l8l1X变量是引用window,然后给加定时器,不停地添加页面的mousedown事件,导致鼠标点击任何地方都会跳转到广告页面
  7. // 3.给141jav每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接
  8. // 4.给javdb每个车牌号后面添加 在JavLib中查询 链接, 所有链接都添加可下载条件
  9. // 5.javbus详情页面加上的车牌号后面添加 在JavLib中查询; 删除磁力链中的onclick事件.
  10. // 6.去掉get.datapps.org网页点击链接后弹出广告窗口
  11. // 7.去掉https://www.77file.com 的弹出广告
  12. // 8.给skrbt网站添加 粘贴并搜索 按钮; 删除搜索结果页中的第一条广告;搜索结果页添加 复制磁链 和 点击磁链 按钮
  13. // @author xmlspy
  14.  
  15. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
  16.  
  17. // @include http*://www.hm1.lol/*
  18.  
  19. // @include http://*.javlib.com/*
  20. // @include http*://*.i71t.com/*
  21.  
  22. // @include http*:/*.torrentkitty.*/*
  23.  
  24. // @include http*://*.141jav.com/*
  25.  
  26. // @include http*://javdb003.com/*
  27. // @include http*://javdb004.com/*
  28.  
  29. // @include http*://*.seejav.men/*
  30. // @include http*://*.javbus.com/*
  31. // @include http*://*.busfan.shop/*
  32.  
  33. // @include http*://get.datapps.org/*
  34. // @include http*://www.77file.com/down/*
  35.  
  36. // @include http*://skrbtqx.top/*
  37.  
  38. // @run-at document-end
  39.  
  40. // @grant GM_xmlhttpRequest
  41. // @grant GM_getValue
  42. // @grant GM_setValue
  43. // @grant GM_addValueChangeListener
  44. // @grant GM_cookie.list
  45. // @grant GM_cookie.set
  46. // @grant GM.xmlhttpRequest
  47.  
  48. // @connect *
  49. // ==/UserScript==
  50.  
  51. (function () {
  52. 'use strict';
  53.  
  54. console.info('========= yimuhe ');
  55.  
  56. // var jq = $.noConflict();
  57. let wnacgDomain = 'www.hm1.lol';
  58. let wnacgRegx = 'hm1\.lol';
  59.  
  60. var javLibDomain = "i71t";
  61. var javLibUrl = "https://www." + javLibDomain + ".com";
  62. let javLibRegx = "(" + javLibDomain + "|javlib|javlibrary)";
  63.  
  64. let javdbDomain = "javdb003";
  65. let javdbUrl = "https://" + javdbDomain + ".com";
  66.  
  67. let jav141Domain = "141jav";
  68.  
  69. let javbusDomain = "busfan";
  70. const javabusUrl = "https://www." + javbusDomain + ".shop";
  71.  
  72. const datappsDomain = "datapps";
  73. //const datappsUrl="https://get.datapps.org";
  74.  
  75. const file77Domain = "77file";
  76.  
  77. const skrbtDomain = "skrbtqx";
  78. const skrbtHost = skrbtDomain + '.top';
  79. const skrbtUrl = "https://" + skrbtHost;
  80.  
  81.  
  82. class FakeCookie extends Map {
  83. constructor(fullCookieString) {
  84. super();
  85. this.fullCookieString = fullCookieString;
  86. }
  87.  
  88. get fullCookieString() {
  89. let result = '';
  90. this.forEach((value, key, self) => {
  91. result = result.concat(key).concat('=').concat(value).concat(';');
  92. });
  93. return result === '' ? result : result.substring(0, result.length - 1);
  94. }
  95. set fullCookieString(str) {
  96. if (str) {
  97. let items = str.split(';');
  98.  
  99. items.map((element, index) => element.trim())
  100. .filter((element, index, self) => self.indexOf(element) === index)//去重
  101. .forEach(element => {
  102. const pair = element.split('=');
  103. this.set(pair[0], pair[1]);
  104. });
  105. }
  106. }
  107.  
  108. /**
  109. * 把newCookie合并到当前实例中.如果newCookie中的key与当前的实例重复,这使用newCookie中的覆盖.
  110. * @param {String|FakeCookie} newCookie 要合并的新cookie,类型为String或者FakeCookie.
  111. * 如果类型为String,表示包含全部cookie内容的字符串;
  112. */
  113. merge(newCookie) {
  114. if (!newCookie) {
  115. return;
  116. }
  117.  
  118. let newFakeCookie;
  119. if ((typeof newCookie) === 'string') {
  120. newFakeCookie = new FakeCookie(newCookie);
  121. } else if (newCookie instanceof FakeCookie) {
  122. newFakeCookie = newCookie;
  123. } else {
  124. throw new TypeError('Invalid type.');
  125. }
  126. newFakeCookie.forEach((value, key, self) => this.set(key, value));
  127. }
  128. }
  129.  
  130. //////////////////////////////////////////////////////////////////////////////////////////////
  131. /////////////////// 紳士漫畫永久域名: wnacg.com紳士漫畫永久地址發佈頁: wnacg.date
  132. /////////////////////////////////////////////////////////////////////////////////////////////
  133. execute(wnacgRegx, (location) => {
  134. console.info('=======================================' + location);
  135. if (location.href.includes('photos-slide-aid')) {
  136. const nodeToObserve = document.querySelector('#img_list');
  137. $(nodeToObserve).css({
  138. 'width': '100%',
  139. 'display': 'flex',
  140. 'flex-wrap': 'wrap',
  141. 'justify-content': 'flex-start'
  142. });
  143. const observer = new MutationObserver((mutations, observer) => {
  144. // mutations.forEach((mutation) => {
  145. // if (mutation.type === 'childList') {
  146. // mutation.addedNodes.forEach((addedNode) => {
  147. // addedNode.querySelector('img').width='49%'
  148. // });
  149. // };
  150. // // $('#img_list>div>img').attr({ width: '49%' });
  151. // });
  152. // $('#img_list>div>img').attr({ width: '49%' });
  153. $('#img_list>div').css({
  154. 'flex': '1',
  155. 'background-color': '#cacaca',
  156. 'margin': '0 5px 5px 0',
  157. 'width': 'calc((100% - 10px) / 2)',
  158. 'min-width': 'calc((100% - 10px) / 2)',
  159. 'max-width': 'calc((100% - 10px) / 2)',
  160. });
  161. });
  162. observer.observe(nodeToObserve, {
  163. childList: true,
  164. attributes: false,
  165. //attributeFilter: false,
  166. attributeOldValue: false,
  167. characterData: false,
  168. characterDataOldValue: false,
  169. subtree: false
  170. });
  171. }
  172. });
  173.  
  174. //////////////////////////////////////////////////////////////////////////////////////////////
  175. /////////////////// javlibrary
  176. /////////////////////////////////////////////////////////////////////////////////////////////
  177.  
  178. // javlibrary, 所有页面
  179. execute(javLibRegx, function (location) {
  180. console.info("====yimuhe====去除javlibrary [xxx所发表的文章] 页面中下载url的重定向;高亮yimuhe的下载链接");
  181. // 删除广告
  182. $('.socialmedia,#bottombanner13,#topbanner11,#sidebanner11,#leftmenu > div > ul:nth-child(2) > li:nth-child(2)').remove();
  183.  
  184. // 调节UI
  185. $('#content').css('padding-top', '15px');
  186. $('#toplogo').css('height', '60px');
  187.  
  188. // 添加 打开skrbt 连接
  189. $('.advsearch').append(`&nbsp;&nbsp;<a href="${skrbtUrl}" target="_blank">打开skrbt</a>`);
  190. // 添加 粘贴并搜索 按钮
  191. const styleMap = {};
  192. $('#idsearchbutton')[0].computedStyleMap().forEach((value, key) => {
  193. styleMap[key] = value;
  194. });
  195. const $pasteAndSearchButton = $(`<input type="button" value="粘贴并搜索" id="pasteAndSearch"></input>`);
  196. $pasteAndSearchButton.css(styleMap);
  197. $pasteAndSearchButton.click(() => {
  198. navigator.clipboard.readText().then((clipText) => {
  199. if (clipText != null && $.trim(clipText) != '') {
  200. $('#idsearchbox').val(clipText);
  201. $('#idsearchbutton').click();
  202. }
  203. });
  204. });
  205. $('#idsearchbutton').parent().append($pasteAndSearchButton);
  206.  
  207. $.each($("a[href^='redirect.php?url']"), function (index, a) {
  208. //var origin = location.origin;
  209. //a.href = decodeURIComponent(a.href.replace(origin+"/cn/redirect.php?url=",""));
  210.  
  211. var url = getQueryVariable(a, 'url');
  212. a.href = decodeURIComponent(url);
  213. if (!a.href.startsWith('https')) {
  214. a.href = a.href.replace("http", "https");
  215. }
  216. a.text = a.text + " " + a.href + " ";
  217. if (a.href.includes("yimuhe")) {
  218. $(a).parentsUntil("tr").closest('.t').css('background-color', '#6B6C83');
  219. a.style = 'font-size:40px;';
  220. } else {
  221. a.style = 'font-size:20px;';
  222. }
  223. });
  224. });
  225.  
  226. // javlibrary, 详情 页面
  227. execute(javLibRegx + ".*\?v=.*", function (location) {
  228. console.info("====yimuhe====javlibrary详情页面中添加 在javbus中查询 链接;添加磁力链");
  229.  
  230. // 显示搜索结果
  231. // 重新获取车牌号,直接使用变量会串号
  232. setTimeout(getSearchResultFromSkrbt, 0,
  233. document.querySelector("#video_id > table > tbody > tr > td.text").innerText,
  234. (result) => {
  235. console.log('error');
  236. console.log(result);
  237. // if (result.result === 0) { // 成功
  238. if (!result.html) {
  239. result.html = "<p style='color:red'>获取磁链信息出现错误,请刷新页面!</p>"
  240. }
  241. const iframeString = `
  242. <iframe id="magnet_iframe"
  243. scrolling=“no"
  244. framebordering='0'
  245. width="100%"
  246. style="border:none;"
  247. >
  248. </iframe>`;
  249.  
  250. const htmlContent = `
  251. <!DOCTYPE html>
  252. <html lang="zh-CN">
  253.  
  254. <head>
  255. <meta charset="utf-8">
  256. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  257. <meta name="viewport" content="width=device-width, initial-scale=1">
  258.  
  259. <link href="https://lf3-cdn-tos.bytecdntp.com/cdn/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
  260. <!--[if lt IE 9]> <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/respond.js/1.4.2/respond.min.js"></script><![endif]-->
  261. <link rel="stylesheet" href="//b5.us.yaacdn.com/css/skrbt/style3.min.css">
  262. <link rel="stylesheet" href="https://lf3-cdn-tos.bytecdntp.com/cdn/font-awesome/4.7.0/css/font-awesome.min.css">
  263. </head>
  264.  
  265. <body style="margin-bottom:1px">
  266. <div class="container-fluid">
  267. <div class="row">
  268. <div class="col-md-6">
  269. ${result.html}
  270. </div>
  271. <div id="right-panel" class="col-md-4 col-lg-3"></div>
  272. <div class="col-md-1 col-lg-2"></div>
  273. </div>
  274. </div>
  275. </body>
  276.  
  277. </html>`;
  278.  
  279. const $iframe = $(iframeString);
  280. $iframe.attr('srcdoc', htmlContent);
  281.  
  282. if ($('.previewthumbs:eq(0)').length > 0) {
  283. $('.previewthumbs:eq(0)').after($iframe);
  284. } else {
  285. $('#video_favorite_edit:eq(0)').after($iframe);
  286. }
  287. $iframe.before('<hr class="grey"></hr>');
  288.  
  289. document.querySelector("#magnet_iframe").addEventListener('load', (e) => {
  290. const iframeDoc = e.target.contentDocument;
  291. const iframeWin = e.target.contentWindow;
  292. const $container = $(iframeDoc.querySelector('.col-md-6'));
  293. let buttonsHtml = '<span class="rrmiv"><button class="btn btn-danger copy" type="button">复制磁链</button></span>';
  294. buttonsHtml += '<span class="rrmiv"><button class="btn btn-danger click" type="button">点击磁链</button></span>';
  295. addButtonsForSkrbt(buttonsHtml, $container, el => {
  296. const classValue = $(el).attr('class');
  297. if (classValue.includes("copy")) {
  298. return 'copy';
  299. }
  300. if (classValue.includes("click")) {
  301. return 'click';
  302. }
  303. return 'other';
  304. });
  305. // onload="this.height=this.contentWindow.document.documentElement.scrollHeight"
  306.  
  307. e.target.height = e.target.contentWindow.document.documentElement.scrollHeight + 5;
  308. // console.log($container);
  309. });
  310.  
  311. const ifr = document.querySelector("#magnet_iframe");
  312. setInterval(() => ifr.height = ifr.contentWindow.document.documentElement.scrollHeight, 500);
  313. }
  314. );
  315.  
  316. // 添加 复制车牌 按钮
  317. let chePai = document.querySelector("#video_id > table > tbody > tr > td.text").innerText;
  318. let toAppendElement = document.querySelector("#video_id > table > tbody > tr > td.text");
  319. appendCopyButton(chePai, toAppendElement);
  320.  
  321. // 添加 javbus中查询 链接
  322. let trTag = document.querySelector("#video_id > table > tbody > tr");
  323. let javdbQueryId = "javdbQueryId";
  324. trTag.innerHTML = [trTag.innerHTML, '<td><a id="', javdbQueryId, '"href="', javabusUrl,
  325. '/', chePai, '">javbus中查询</a></td>'].join('');
  326.  
  327. // 添加 打开SkrBt 链接
  328. $(trTag).append(['<td><a target="_blank" ', 'href="', skrbtUrl, '/search?keyword=',
  329. chePai, '">打开SkrBT</a></td>'].join(''));
  330.  
  331. // 删除名称中的链接,否则很容易误点,又不容易复制文字
  332. const videoTitleNode = document.querySelector("#video_title > h3 > a");
  333. if (videoTitleNode) {
  334. const videoTitle = videoTitleNode.getInnerHTML();
  335. videoTitleNode.parentNode.innerText = videoTitle;
  336. }
  337. // #topbanner11,
  338.  
  339. });
  340.  
  341. //////////////////////////////////////////////////////////////////////////////////////////////
  342. /////////////////// skrbt
  343. /////////////////////////////////////////////////////////////////////////////////////////////
  344. let fakeCookie = new FakeCookie();
  345.  
  346. function getSkrbtRequestHeaders(otherHeaderObj) {
  347. return $.extend({
  348. "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",
  349. "Accept-Encoding": "gzip, deflate, br",
  350. "Accept-Language": "zh-CN,zh;q=0.9",
  351. "Cache-Control": "max-age=0",
  352. "Sec-Ch-Ua": '"Chromium";v="119", "Not?A_Brand";v="24"',
  353. "Sec-Ch-Ua-Mobile": "?0",
  354. "Sec-Ch-Ua-Platform": "Windows",
  355. "Sec-Fetch-Dest": "document",
  356. "Sec-Fetch-Mode": "navigate",
  357. "Sec-Fetch-Site": "same-origin",
  358. "Sec-Fetch-User": "?1",
  359. "Upgrade-Insecure-Requests": "1",
  360. "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"
  361. }, otherHeaderObj);
  362. }
  363.  
  364. function removeAdSkrbt($container) {
  365. $container.remove('.label.label-primary');
  366. $container.find('a.rrt.common-link[href^="http"]').parent().parent().remove();
  367. }
  368.  
  369. function getSearchResultFromSkrbt(chepai, callback) {
  370. const searchUrl = `${skrbtUrl}/search?keyword=${chepai}`;
  371.  
  372. function getResponseHeader(response, name) {
  373. if (response && response.responseHeaders && name) {
  374. // Convert the header string into an array
  375. // of individual headers
  376. var arr = response.responseHeaders.trim().split(/[\r\n]+/);
  377.  
  378. // Create a map of header names to values
  379. var headerMap = {};
  380. arr.forEach(function (line) {
  381. var parts = line.split(': ');
  382. var header = parts.shift();
  383. var value = parts.join(': ');
  384. headerMap[header] = value;
  385. });
  386.  
  387. return headerMap[name];
  388. }
  389. return null;
  390. }
  391.  
  392. function onResponseHeaderRecieved(response) {
  393. if (response.readyState === response.HEADERS_RECEIVED) {
  394. console.log(response.responseHeaders);
  395. const setCookie = getResponseHeader(response, 'Set-Cookie');
  396. fakeCookie.merge(setCookie);
  397. }
  398. }
  399.  
  400. const timeoutIds = [];
  401. function clearTimeouts() {
  402. timeoutIds.forEach(timeoutId => clearTimeout(timeoutId));
  403. }
  404.  
  405. function successHandler(response, callback) {
  406. clearTimeouts();
  407.  
  408. const $container = $(response.responseText).find('.col-md-6:eq(2)');
  409. removeAdSkrbt($container);
  410.  
  411. const data = $.map($container.find('.list-unstyled'), item => {
  412. const title = $(item).find('a.rrt.common-link').text();
  413. const detailHref = $(item).find('a.rrt.common-link').attr('href');
  414. const fileSize = $(item).find('li.rrmi > span:nth-child(2)').text();
  415. const fileCount = $(item).find('li.rrmi > span:nth-child(3)').text();
  416. const timeIncluded = $(item).find('li.rrmi > span:nth-child(4)').text();
  417. return {
  418. title: title,
  419. detailHref: detailHref, //明细页面地址
  420. fileSize: fileSize, // 文件总大小
  421. fileCount: fileCount, // 文件总数
  422. timeIncluded: timeIncluded // 收入时间
  423. };
  424. });
  425.  
  426. // 删除无用的布局
  427. $container.find('p:eq(0)').remove();
  428. $container.find('nav').remove();
  429.  
  430. callback({
  431. result: 0,
  432. data: data,
  433. html: $container.html()
  434. });
  435. }
  436.  
  437. // 1
  438. GM_xmlhttpRequest({
  439. method: "get",
  440. headers: getSkrbtRequestHeaders({
  441. "Referer": skrbtUrl
  442. }),
  443. url: searchUrl,
  444. onerror: function (e) {
  445. console.log(e);
  446. },
  447. onload: function (response) {
  448. console.log(response);
  449. if (response.finalUrl.includes('/search?')) {
  450. console.log('-----------OK');
  451. successHandler(response, callback);
  452. } else if (response.finalUrl.includes("/challenge")) {
  453. // 当前地址:
  454. // https://skrbtqx.top/recaptcha/v4/challenge?url=https://skrbtqx.top&s=1
  455. waitRecaptcha();
  456.  
  457. } else {
  458. console.log('错误');
  459. clearTimeouts();
  460. //TODO: 错误处理
  461. callback({ result: 1, message: '' });
  462. }
  463. },
  464. onreadystatechange: onResponseHeaderRecieved
  465. });// end GM_xmlhttpRequest
  466.  
  467. // 等待安全验证
  468. function waitRecaptcha() {
  469. var remain = 10;
  470. var startTime = new Date().getTime();
  471.  
  472. timeoutIds.unshift(setTimeout(timeoutHandler, 1000));
  473. timeoutIds.unshift(setTimeout(doChallange, 1000));
  474.  
  475. function timeoutHandler() {
  476. console.log('timeoutHandler');
  477. remain = remain - 1;
  478. console.log(`remain: ${remain}`);
  479. if (remain > 0) {
  480. timeoutIds.unshift(setTimeout(timeoutHandler, 1000));
  481. } else {
  482. doSubmit(randomString(100))
  483. }
  484. }
  485.  
  486. function doChallange() {
  487. console.log('doChallange');
  488. var aywcUid = genOrGetAywcUid();
  489. var genApi = skrbtUrl + "/anti/recaptcha/v4/gen?aywcUid=" + aywcUid + "&_=" + new Date().getTime();
  490. GM_xmlhttpRequest({
  491. method: "get",
  492. responseType: GM_xmlhttpRequest.RESPONSE_TYPE_JSON,
  493. headers: getSkrbtRequestHeaders({
  494. "Referer": `${skrbtUrl}/recaptcha/v4/challenge?url=${skrbtUrl}&s=1`
  495. }),
  496. url: genApi,
  497. onerror: function (e) {
  498. console.log(new Date() + ": " + e);
  499. timeoutIds.unshift(setTimeout(doChallange, 1000));
  500. console.log(e);
  501. },
  502. onload: function (response) {
  503. const genResult = response.response;
  504. if (genResult.errno == 0) {
  505. doSubmit(genResult.token);
  506. } else {
  507. timeoutIds.unshift(setTimeout(doChallange, 1000));
  508. }
  509. },
  510. onreadystatechange: onResponseHeaderRecieved
  511. });// end GM_xmlhttpRequest
  512. }
  513.  
  514. function doSubmit(token) {
  515. console.log('doSubmit');
  516. var costtime = new Date().getTime() - startTime;
  517. GM_xmlhttpRequest({
  518. method: "get",
  519. headers: getSkrbtRequestHeaders({
  520. "Referer": `${skrbtUrl}/recaptcha/v4/challenge?url=${skrbtUrl}&s=1`
  521. }),
  522. url: `${skrbtUrl}/anti/recaptcha/v4/verify?token=${token}&aywcUid=${genOrGetAywcUid()}&costtime=${costtime}`,
  523. onerror: function (e) {
  524. console.log(e);
  525. clearTimeouts();
  526. callback({ result: 2, message: '' });
  527. },
  528. onload: function (response) {
  529. console.log('-----doSubmit OK');
  530. console.log(response);
  531. if (response.finalUrl.includes('search?')) {
  532. successHandler(response, callback);
  533. } else {
  534. console.log('错误');
  535. clearTimeouts();
  536. // 返回错误
  537. callback({ result: 3, message: '' });
  538. }
  539. },
  540. onreadystatechange: onResponseHeaderRecieved
  541. });// end GM_xmlhttpRequest
  542. }
  543.  
  544. function genOrGetAywcUid() {
  545. const rootDomain = parseRootDomain();
  546. const unifyidKey = "aywcUid";
  547. // var aywcUid = $.cookie(unifyidKey);
  548. let aywcUid = fakeCookie.get(unifyidKey);
  549. if (isEmpty(aywcUid)) {
  550. aywcUid = randomString(10) + "_" + formatDate("yyyyMMddhhmmss", new Date());
  551. fakeCookie.set(unifyidKey, aywcUid);
  552. // $.cookie(unifyidKey, aywcUid, {
  553. // domain: rootDomain,
  554. // path: "/",
  555. // expires: 3650
  556. // })
  557. }
  558. return aywcUid
  559. }
  560.  
  561. function isEmpty(x) {
  562. if (x == null || x == undefined || x == "") {
  563. return true
  564. } else {
  565. return false
  566. }
  567. }
  568.  
  569. function randomString(len, charSet) {
  570. charSet = charSet || "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  571. var randomString = "";
  572. for (var i = 0; i < len; i++) {
  573. var randomPoz = Math.floor(Math.random() * charSet.length);
  574. randomString += charSet.substring(randomPoz, randomPoz + 1)
  575. }
  576. return randomString
  577. }
  578.  
  579. function formatDate(fmt, date) {
  580. var o = {
  581. "M+": date.getMonth() + 1,
  582. "d+": date.getDate(),
  583. "h+": date.getHours(),
  584. "m+": date.getMinutes(),
  585. "s+": date.getSeconds(),
  586. "q+": Math.floor((date.getMonth() + 3) / 3),
  587. "S": date.getMilliseconds()
  588. };
  589. if (/(y+)/.test(fmt)) {
  590. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length))
  591. }
  592. for (var k in o) {
  593. if (new RegExp("(" + k + ")").test(fmt)) {
  594. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)))
  595. }
  596. }
  597. return fmt
  598. }
  599.  
  600. function parseRootDomain() {
  601. return skrbtHost;
  602. // var rootDomain = skrbtHost;
  603. // tokens = rootDomain.split(".");
  604. // if (tokens.length != 1) {
  605. // rootDomain = tokens[tokens.length - 2] + "." + tokens[tokens.length - 1]
  606. // }
  607. // return rootDomain
  608. };
  609. }
  610. }; // end getSearchResultFromSkrbt
  611.  
  612. function addButtonsForSkrbt(buttonsHtml, delegateElement, buttonTypeCallback) {
  613. delegateElement.find('a.rrt.common-link').after(buttonsHtml);
  614.  
  615. delegateElement.click((event) => {
  616. const buttonType = buttonTypeCallback(event.target);
  617. if ('copy' !== buttonType && 'click' !== buttonType) {
  618. return;
  619. }
  620. let liNode = $(event.target).parent().parent();
  621.  
  622. const exeButtonClick = () => {
  623. if ('copy' === buttonType) {
  624. navigator.clipboard.writeText(liNode.find('.magnet').attr('href'));
  625. } else {
  626. // liNode.find('.magnet').trigger('click'); //不好使
  627. liNode.find('.magnet')[0].click();
  628. }
  629. };
  630.  
  631. if (liNode.find('.magnet').length != 0) { // 磁链已经添加过
  632. exeButtonClick();
  633. return;
  634. }
  635. let detailUrl = liNode.find('a.rrt.common-link').attr('href');
  636. detailUrl = `${skrbtUrl}${detailUrl}`;
  637.  
  638. //请求获取磁链
  639. GM_xmlhttpRequest({
  640. method: "get",
  641. headers: getSkrbtRequestHeaders({ "Referer": `${skrbtUrl}/search` }),
  642. url: detailUrl,
  643. onerror: function (e) {
  644. //失败后在页面提示
  645. liNode.append('<span id="errorTip">获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>');
  646. console.log(e);
  647. },
  648. onload: function (response) {
  649. liNode.find('#errorTip').remove();
  650. //成功后在页面添加磁链
  651. const magnet = $(response.responseText).find('#magnet').attr('href');
  652. console.log(response);
  653. if (magnet) {
  654. const aHtml = '<a class="magnet" href="' + magnet + '">' + magnet + '</a>';
  655. liNode.append(aHtml);
  656. exeButtonClick();
  657. } else {
  658. liNode.append('<span id="errorTip">获取磁链失败,等会儿再试一试! 若仍然有问题请刷新网页.</span>');
  659. }
  660. }
  661. });// end GM_xmlhttpRequest
  662. });
  663. }
  664.  
  665. // skrbt
  666. execute(skrbtDomain, (location) => {
  667. // 给所有页面添加 粘贴并搜索 按钮
  668. const html = `
  669. <span>&nbsp;</span>
  670. <span class="input-group-btn">
  671. <button class="btn btn-danger search-btn paste-search" type="button">
  672. <span class="glyphicon glyphicon-search"> 粘贴并搜索</span>
  673. </button>
  674. </span>`;
  675. $('.input-group-btn').last().after(html);
  676. const submitButton = $('button[type="submit"]').first();
  677. const searchInput = $('input[name="keyword"]').first();
  678. $('button.paste-search').first().click(() => {
  679. let clipPromise = navigator.clipboard.readText();
  680. clipPromise.then((clipText) => {
  681. if (clipText != null && $.trim(clipText) != '') {
  682. searchInput.val(clipText);
  683. submitButton.click();
  684. }
  685. });
  686. });
  687.  
  688. //搜索结果列表页面,每条结果添加 复制磁链 和 点击磁链 按钮
  689. if (location.href.includes("search")) {
  690. const $container = $('.col-md-6:eq(2)');
  691. removeAdSkrbt($container);
  692.  
  693. let buttonsHtml = '<span class="rrmiv"><button class="btn btn-danger copy" type="button">复制磁链</button></span>';
  694. buttonsHtml += '<span class="rrmiv"><button class="btn btn-danger click" type="button">点击磁链</button></span>'
  695. addButtonsForSkrbt(buttonsHtml, $('.col-md-6:eq(2)'), el => {
  696. const classValue = $(el).attr('class');
  697. if (classValue && classValue.includes("copy")) {
  698. return 'copy';
  699. }
  700. if (classValue && classValue.includes("click")) {
  701. return 'click';
  702. }
  703. return 'other';
  704. });
  705.  
  706. // 自动分页插件兼容
  707. const nodeToObserve = document.querySelectorAll('.col-md-6')[2];
  708. const observer = new MutationObserver((mutationRecords, observer) => {
  709. $('a.rrt.common-link').each((index, element) => {
  710. if ($(element).parent().find('.btn.btn-danger.copy').length === 0) {
  711. $(element).after(buttonsHtml);
  712. }
  713. });
  714. //删除广告
  715. removeAdSkrbt($('.col-md-6:eq(2)'));
  716. });
  717. observer.observe(nodeToObserve, {
  718. childList: true,
  719. attributes: false,
  720. //attributeFilter: false,
  721. attributeOldValue: false,
  722. characterData: false,
  723. characterDataOldValue: false,
  724. subtree: false
  725. });
  726. }
  727. });
  728.  
  729. //////////////////////////////////////////////////////////////////////////////////////////////
  730. /////////////////// javbus
  731. /////////////////////////////////////////////////////////////////////////////////////////////
  732.  
  733. //javbus
  734. execute(javbusDomain, (location) => {
  735. console.info("5.给javbus每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接; 删除磁力链中的onclick事件.");
  736.  
  737. //remove ads
  738. $('div.ad-box').remove();
  739.  
  740. // 调整样式
  741. $('.nav>li>a').attr('style', 'padding-left:8px;padding-right:8px;');
  742.  
  743. //添加skrbt链接
  744. $('.nav-title.nav-inactive:last,ul.nav.navbar-nav:first')
  745. .append(`
  746. <li class="hidden-md hidden-sm">
  747. <a href="${skrbtUrl}" target="_blank">打开skrbt</a>
  748. </li>
  749. `);
  750.  
  751. // 添加 粘贴并搜索 按钮
  752. const $pasteAndSearchButton = $(`<button class="btn btn-default" type="submit" id="pasteAndSearch">粘贴并搜索</button>`);
  753. const $searchButton = $('button[type="submit"]:first');
  754. $pasteAndSearchButton.click(() => {
  755. navigator.clipboard.readText().then((value) => {
  756. $('#search-input:first').val(value);
  757. $searchButton.click();
  758. });
  759. });
  760. $searchButton.after($pasteAndSearchButton);
  761. // $('.input-group-btn:first').append($pasteAndSearchButton);
  762.  
  763. let chePaiNode = document.querySelector("body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1) > span:nth-child(2)");
  764. if (chePaiNode) { // 明细页面
  765. // remove ads
  766. $('h4:has(span#urad2),div.row:has(script[src*="jads"])').remove();
  767. // // 添加skrbt链接
  768. // $('ul.nav.navbar-nav:first')
  769. // .append(`
  770. // <li class="hidden-sm">
  771. // <a href="${skrbtUrl}" target="_blank">**打开 skrbt**</a>
  772. // </li>
  773. // `);
  774.  
  775. const chePai = chePaiNode.innerText.trim();
  776. const toAppendElement = document.querySelector("body > div.container > div.row.movie > div.col-md-3.info > p:nth-child(1)");
  777.  
  778. appendCopyButton(chePai, toAppendElement);
  779. appendHrefJavLib(chePai, toAppendElement);
  780.  
  781. // 删除磁力链中的onclick事件
  782. $("#magnet-table").one("DOMNodeInserted", (e) => {
  783. $('td[onclick]').each((index, element) => {
  784. element.removeAttribute('onclick');
  785. });
  786. });
  787. } else if (location.href.includes('forum')) { //论坛页面
  788. // remove ads
  789. $('div.bcpic2,div.banner728,div.frame.move-span.cl.frame-1:last').remove();
  790. }
  791. });
  792.  
  793. execute(jav141Domain, function (location) {
  794. console.info("3.给141jav每个车牌号后面加上复制按钮;添加 在JavLib中查询 链接.");
  795. document.querySelectorAll('h5.title.is-4.is-spaced > a').forEach(function (element, index) {
  796. var chePai = element.innerText.trim();
  797.  
  798. appendCopyButton(chePai, element.parentElement);
  799. appendHrefJavLib(chePai, element.parentElement);
  800.  
  801. let markAsOwnerButton = document.createElement('button');
  802. markAsOwnerButton.dataset.type = 2;
  803. markAsOwnerButton.dataset.chePai = chePai;
  804. markAsOwnerButton.appendChild(document.createTextNode('设置为已拥有(javlib)'));
  805. element.parentElement.appendChild(markAsOwnerButton);
  806. markAsOwnerButton.onclick = function (event) {
  807. //debugger;
  808. GM_xmlhttpRequest({
  809. method: "GET",
  810. //responseType: "json",
  811. url: javLibUrl + "/cn/vl_searchbyid.php?keyword=" + event.target.dataset.chePai,
  812. onerror: function (e) {
  813. console.log(e);
  814. },
  815. onload: function (response) {
  816. if (response.status != 200) {
  817. console.log("失败。。。")
  818. return;
  819. }
  820.  
  821. let finalUrl = response.finalUrl;
  822. if (finalUrl.includes('vl_searchbyid.php')) {
  823. console.log("有多个结果或者没有结果")
  824. //有多个结果或者没有结果
  825.  
  826. } else {
  827. // 明细页面
  828. let patternAjaxid = /^var[ ]\$ajaxid.*;/m;
  829. let result = patternAjaxid.exec(response.responseText);
  830. let ajaxid = result[0].split('"')[1];
  831. let data = "type=" + event.target.dataset.type + "&targetid=" + ajaxid;
  832. //debugger;
  833.  
  834. GM_xmlhttpRequest({
  835. method: "POST",
  836. responseType: "json",
  837. headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" },
  838. url: javLibUrl + "/ajax/ajax_cv_favoriteadd.php",
  839. data: data,
  840. onerror: function (e) {
  841. console.log(e);
  842. },
  843. onload: function (response) {
  844. if (response.status != 200) {
  845. return;
  846. }
  847. let responseJson = JSON.parse(response.responseText);
  848. if (responseJson.ERROR != 1) {
  849. // 失败
  850. console.log("失败。" + response.responseText);
  851. }
  852. }
  853. });// end GM_xmlhttpRequest
  854. }// end else
  855. } // end onload
  856. });// end GM_xmlhttpRequest
  857. };
  858. });
  859. });
  860.  
  861. execute(javdbDomain, function (location) {
  862. console.info("4.给javdb添加 在JavLib中查询 链接.");
  863. document.querySelectorAll("a.button.is-white.copy-to-clipboard").forEach(function (element, index) {
  864. var chePai = element.getAttribute('data-clipboard-text');
  865. appendHrefJavLib(chePai, element.parentElement);
  866. });
  867.  
  868. console.info("javdb 每个查询链接都添加 可下载 条件");
  869. //document.querySelectorAll('div.tabs.is-boxed a').forEach(function(element,index){
  870. document.querySelectorAll('a').forEach(function (element, index) {
  871. console.info(index + element);
  872. let href = element.href;
  873. if (href.includes("video_codes")
  874. || href.includes("directors")
  875. || href.includes("makers")
  876. || href.includes("series")
  877. || href.includes("publishers")
  878. || href.includes("search")) {
  879. //element.href = href+"?f=download";
  880. element.href = appendUrlParam(href, "f=download")
  881. } else if (href.includes("actors")) {
  882. //element.href = href+"?t=d";
  883. element.href = appendUrlParam(href, "t=d")
  884. } else if (href.includes("tags")) {
  885. element.href = appendUrlParam(href, "c10=1")
  886. }
  887. });
  888.  
  889. document.querySelectorAll("div.tabs.is-boxed a").forEach((element, index) => {
  890. let href = element.href;
  891. element.href = href.replace('&f=download', '');
  892. });
  893. });
  894.  
  895.  
  896.  
  897. execute(datappsDomain, function (location) {
  898. console.info("6.去掉get.datapps.org网页点击链接后弹出广告窗口.");
  899. document.querySelectorAll('a[onclick="setpos();"]').forEach((element, index) => {
  900. element.removeAttribute("onclick");
  901. });
  902. });
  903.  
  904. execute(file77Domain, function (location) {
  905. console.info("7.去掉77file网页点击链接后弹出广告窗口.");
  906. document.querySelectorAll('input[value="验证下载"]').forEach((element, index) => {
  907. element.setAttribute("onclick", "check_code();");
  908. });
  909. });
  910.  
  911.  
  912.  
  913. execute("torrentkitty", (location) => {
  914. console.info("2.破坏torrentkitty的脚本变量引用. 原先l8l1X变量是引用window,然后给加定时器,不停地添加页面的mousedown事件,导致鼠标点击任何地方都会跳转到广告页面.");
  915. window.l8l1X = 1;
  916. });
  917.  
  918.  
  919.  
  920.  
  921. //////////////////////////////////////////////////////////////////////////////////////////////
  922. /////////////////// 公共方法
  923. /////////////////////////////////////////////////////////////////////////////////////////////
  924. function execute(regExpString, callback) {
  925. var href = window.location.href;
  926. var pattern = new RegExp(regExpString);
  927. if (pattern.test(href)) {
  928. callback(window.location);
  929. } else {
  930. console.info("输入的参数 %s 与 %s 不匹配", regExpString, href);
  931. }
  932. }
  933. function appendHrefJavLib(chePai, toAppendElement) {
  934. var openHref = document.createElement('a');
  935. openHref.href = javLibUrl + "/cn/vl_searchbyid.php?keyword=" + chePai;
  936. openHref.target = "_blank";
  937. openHref.innerText = "JavLib中查询";
  938. toAppendElement.appendChild(openHref);
  939. }
  940. function appendCopyButton(chePai, toAppendElement) {
  941. var copyButton = document.createElement('button');
  942. copyButton.innerHTML = "复 制";
  943. copyButton.setAttribute('id', 'copyButton');
  944. toAppendElement.appendChild(copyButton);
  945. document.addEventListener('click', (e) => {
  946. if (e.srcElement.getAttribute('id') === 'copyButton') {
  947. //console.log(e);
  948. copyToClipboard(chePai);
  949. }
  950.  
  951. });
  952. //copyButton.onclick=function(){
  953. // copyToClipboard(chePai);
  954. //};
  955. }
  956.  
  957. function getQueryVariable(anchor, variable) {
  958. var query = anchor.search.substring(1);
  959. var vars = query.split("&");
  960. for (var i = 0; i < vars.length; i++) {
  961. var pair = vars[i].split("=");
  962. if (pair[0] == variable) { return pair[1]; }
  963. }
  964. return false;
  965. }
  966. function appendUrlParam(url, param) {
  967. if (url.includes("?")) {
  968. return url + "&" + param;
  969. }
  970. return url + "?" + param;
  971. }
  972.  
  973.  
  974. function copyToClipboard(text) {
  975. try {
  976. navigator.clipboard.writeText(text).then(() => {
  977. console.log('复制成功')
  978. });
  979. } catch {
  980. var textArea = document.createElement("textarea");
  981. textArea.style.position = 'fixed';
  982. textArea.style.top = '0';
  983. textArea.style.left = '0';
  984. textArea.style.width = '2em';
  985. textArea.style.height = '2em';
  986. textArea.style.padding = '0';
  987. textArea.style.border = 'none';
  988. textArea.style.outline = 'none';
  989. textArea.style.boxShadow = 'none';
  990. textArea.style.background = 'transparent';
  991. textArea.value = text;
  992. document.body.appendChild(textArea);
  993. textArea.select();
  994.  
  995. try {
  996. var successful = document.execCommand('copy');
  997. var msg = successful ? '成功复制到剪贴板' : '该浏览器不支持点击复制到剪贴板';
  998. //alert(msg);
  999. } catch (err) {
  1000. alert('该浏览器不支持点击复制到剪贴板');
  1001. }
  1002.  
  1003. document.body.removeChild(textArea);
  1004. }
  1005. }
  1006. })();