自动获取磁链接并自动离线下载

Verzia zo dňa 05.02.2017. Pozri najnovšiu verziu.

  1. // ==UserScript==
  2. // @name 挊
  3. // @namespace 撸
  4. // @description 自动获取磁链接并自动离线下载
  5.  
  6. // @include http*://avmo.pw/*
  7. // @include http*://avso.pw/*
  8. // @include http*://avxo.pw/*
  9. // @include http*://www.av28.com/*/movie/*
  10.  
  11. // @include http*://*javlibrary.com/*
  12. // @include http*://*javlib.com/*
  13. // @include http*://*javl10.com/*
  14. // @include http*://*jav11b.com/*
  15.  
  16. // @include http*://www.libredmm.com/products/*
  17.  
  18. // @include http*://www.javbus.com/*
  19. // @include http*://www.javbus.me/*
  20. // @include http*://www.javbus2.com/*
  21. // @include http*://www.javbus3.com/*
  22. // @include http*://www.javbus5.com/*
  23.  
  24. // @include http*://www.icpmp.com/fanhao/*.html
  25. // @include http*://blog.jav4you.com/*
  26. // @include http*://*1pondo.tv/*/index.htm
  27. // @include http*://www.jade-net-home.com/products/*
  28.  
  29. // @include http*://pan.baidu.com/disk/home*
  30. // @include http*://115.com/?tab=offline&mode=wangpan
  31. // @include http*://www.furk.net/users/files/add
  32.  
  33. // @version 1.46
  34. // @run-at document-end
  35. // @grant GM_xmlhttpRequest
  36. // @grant GM_setClipboard
  37. // @grant GM_setValue
  38. // @grant GM_getValue
  39. // @grant GM_addStyle
  40. // @grant GM_registerMenuCommand
  41. // ==/UserScript==
  42.  
  43. var main = {
  44. //av信息查询 类
  45. jav: {
  46. type: 0,
  47. re: /(avmo|avso|avxo|av28).*movie.*/,
  48. insert_where: "#movie-share",
  49. vid: function () {
  50. return document.querySelector(".header").nextElementSibling.innerHTML;
  51. }
  52. },
  53. javlibrary: {
  54. type: 0,
  55. re: /(javlibrary|javlib|javl10|jav11b).*\?v=.*/,
  56. insert_where: "#video_favorite_edit",
  57. vid: function () {
  58. return document.querySelector("#video_id").getElementsByClassName("text")[0].innerHTML;
  59. }
  60. },
  61. javbus: {
  62. type: 0,
  63. re: /javbus/,
  64. insert_where: "#star-div",
  65. vid: function () {
  66. return document.querySelector(".header").nextElementSibling.textContent;
  67. }
  68. },
  69. fanhaoku: {
  70. type: 0,
  71. re: /icpmp/,
  72. insert_where: ".mod_film",
  73. vid: function () {
  74. return document.querySelector(".title_inner").title;
  75. }
  76. },
  77. libredmm: {
  78. type: 0,
  79. re: /libredmm/,
  80. insert_where: ".container",
  81. vid: function () {
  82. return location.href.match(/products\/(.*)/)[1];
  83. }
  84. },
  85. blogjav4you: {
  86. type: 0,
  87. re: /blog\.jav4you\.com/,
  88. insert_where: ".posttext",
  89. vid: function () {
  90. return document.querySelector(".posttitle a").textContent.match(/\[(.*)\]/)[1];
  91. },
  92. },
  93. pondo1: {
  94. type: 0,
  95. re: /1pondo\.tv.*\/index.htm/,
  96. insert_where: ".hdg3",
  97. vid: function () {
  98. return location.pathname.split("/")[3];
  99. },
  100. },
  101. jadenethome:{
  102. type:0,
  103. re:/jade-net-home/,
  104. insert_where:".detailStory",
  105. vid:function(){
  106. return document.querySelector("#detailRight dl dd").textContent;
  107. }
  108. },
  109. dmm: {
  110. type: 0,
  111. re: /dmm\.co\.jp/,
  112. insert_where: ".lh4",
  113. vid: function () {
  114. var result = location.href.replace(/.*cid=/, "").replace(/\/\??.*/, "").match(/[^h_0-9].*/);
  115. return result[0] ? result[0].replace("00", "") : "";
  116. }
  117. },
  118.  
  119. //网盘下载 类
  120. //这些 $ 是真正的 jquery
  121. baidu: {
  122. type: 1,
  123. re: /pan\.baidu\.com/,
  124. fill_form: function (magnet) {
  125. document.querySelector(".g-button[data-button-id=b13]").click();
  126. setTimeout(function () {
  127. document.querySelector("#_disk_id_2").click();
  128. setTimeout(function () {
  129. document.querySelector("#share-offline-link").value = magnet;
  130. document.querySelector(".g-button[data-button-id=b65]").click();
  131. }, 500);
  132. }, 1500);
  133. }
  134. },
  135. 115: {
  136. type: 1,
  137. re: /115\.com/,
  138. fill_form: function (link) {
  139. var rsc = setInterval(function () {
  140. if (document.readyState == "compvare") {
  141. clearInterval(rsc);
  142. setTimeout(function () {
  143. Core["OFFL5Plug"].OpenLink();
  144. setTimeout(function () {
  145. $("#js_offline_new_add").val(link);
  146. }, 300);
  147. }, 1000);
  148. }
  149. }, 400);
  150. }
  151. },
  152. varv: {
  153. type: 1,
  154. re: /cloud\.varv\.com/,
  155. fill_form: function (link) {
  156. setTimeout(function () {
  157. $("#offline-btn").click();
  158. setTimeout(function () {
  159. $("#offline_clear_compvare").prev().click();
  160. setTimeout(function () {
  161. $("#offline-add-link").val(link);
  162. }, 500);
  163. }, 1000);
  164. }, 2000);
  165. }
  166. },
  167. furk: {
  168. type: 1,
  169. re: /www\.furk\.net/,
  170. fill_form: function (link) {
  171. setTimeout(function () {
  172. $("#url").val(link.replace("magnet:?xt=urn:btih:", ""));
  173. }, 1500);
  174. }
  175. },
  176. 360: {
  177. type: 1,
  178. re: /yunpan\.360\.cn\/my/,
  179. fill_form: function (link) {
  180. yunpan.cmdCenter.showOfflineDia();
  181. setTimeout(function () {
  182. $(".offdl-btn-create").click();
  183. setTimeout(function () {
  184. $("#offdlUrl").val(link);
  185. }, 500);
  186. }, 1000);
  187. }
  188. },
  189. uc: {
  190. type: 1,
  191. re: /disk\.yun\.uc\.cn\//,
  192. fill_form: function (link) {
  193. setTimeout(function () {
  194. $("#newuclxbtn_index").click();
  195. setTimeout(function () {
  196. $("#uclxurl").val(link);
  197. }, 1000);
  198. }, 1200);
  199. }
  200. },
  201.  
  202. };
  203.  
  204. var offline_sites = {
  205. baidu: {
  206. url: "http://pan.baidu.com/disk/home",
  207. name: "百度云",
  208. enable: true
  209. },
  210. 115: {
  211. name: "115离线",
  212. url: "http://115.com/?tab=offline&mode=wangpan",
  213. enable: true,
  214. },
  215. varv: {
  216. name: "乐视云",
  217. url: "http://cloud.varv.com/webdisk/home/index",
  218. enable: false
  219. },
  220. 360: {
  221. name: "360云",
  222. url: "http://yunpan.360.cn/my/",
  223. enable: false
  224. },
  225. uc: {
  226. name: "UC离线",
  227. url: "http://disk.yun.uc.cn/",
  228. enable: false
  229. },
  230. furk: {
  231. name: "Furk",
  232. url: "https://www.furk.net/users/files/add",
  233. enable: true
  234. },
  235. };
  236. var common = {
  237. add_style: function () {
  238. GM_addStyle([
  239. "#nong-table{border-collapse: initial !important;background-color: white !important;text-align: center !important;margin:10px auto;color:#666 !important;font-size:13px;text-align:center !important;border: 1px solid #cfcfcf !important;border-radius: 10px !important;}",
  240. "#nong-table a {margin-right: 5px !important;color:blue}",
  241. "#nong-table a:hover {color:#d20f00 !important;}",
  242. "#nong-table th,#nong-table td{text-align: inherit !important;height:30px;padding:0 1em 0 !important;}",
  243. ".nong-row{text-align: inherit !important;height:30px;padding:0 1em 0 !important;border: 1px solid #EFEFEF !important;}",
  244. ".nong-row:hover{background-color: #dae8ff !important;}",
  245. ".nong-offline-download{color: rgb(0, 180, 30) !important;}",
  246. ".nong-offline-download:hover{color:red !important;}",
  247. ].join(""));
  248. },
  249. handle_copy_event: function (event) {
  250. event.target.innerHTML = "成功";
  251. GM_setClipboard(event.target.href);
  252. setTimeout(function () {
  253. event.target.innerHTML = "复制";
  254. }, 1000);
  255. event.preventDefault(); //阻止跳转
  256. },
  257. handle_dl_event: function (event) {
  258. var mag = event.target.parentElement.parentElement.parentElement.getAttribute("mag");
  259. console.info("磁链接", mag);
  260. //console.log(0);
  261. GM_setValue("magnet", mag);
  262. },
  263.  
  264. reg_event: function () {
  265. var selector_event_map = [{
  266. selector: ".nong-copy",
  267. type: "click",
  268. fn: this.handle_copy_event
  269. }, {
  270. selector: ".nong-offline-download",
  271. type: "click",
  272. fn: this.handle_dl_event
  273. }];
  274. selector_event_map.forEach(function (obj) {
  275. Array.from(document.querySelectorAll(obj.selector)).forEach(function (elem) {
  276. elem.addEventListener(obj.type, obj.fn);
  277. })
  278. });
  279. /*
  280. for (var obj of selector_event_map) {
  281. for (var elem of document.querySelectorAll(obj.selector)) {
  282. //console.log(elem, obj.type, obj.fn);
  283. elem.addEventListener(obj.type, obj.fn);
  284. }
  285. }*/
  286. },
  287. parsetext: function (text) {
  288. var doc = null;
  289. try {
  290. doc = document.implementation.createHTMLDocument("");
  291. doc.documentElement.innerHTML = text;
  292. return doc;
  293. }
  294. catch (e) {
  295. alert("parse error");
  296. }
  297. },
  298. };
  299. var magnet_table = {
  300. template: {
  301. create_head: function (src) {
  302. var a = document.createElement("tr");
  303. a.className = "nong-row";
  304. a.id = "nong-head";
  305. var head_str = [
  306. "大小",
  307. "操作",
  308. "离线下载"
  309. ];
  310. var th_list = [document.createElement("th"), document.createElement("th"), document.createElement("th"), document.createElement("th")];
  311.  
  312. var select_box = document.createElement("select");
  313. var option_str = my_search.search_name_string;
  314. //console.log("get", GM_getValue("search_index"));
  315. var index = GM_getValue("search_index", 0);
  316. var op_value = 0;
  317. option_str.forEach(function (str) {
  318. var op = document.createElement("option");
  319. op.value = op_value;
  320. op.textContent = str;
  321. if (index == op_value) {
  322. op.setAttribute("selected", "selected");
  323. }
  324. op_value++;
  325. select_box.appendChild(op);
  326. });
  327. /*
  328. for (var str of option_str) {
  329. var op = document.createElement("option");
  330. op.value = op_value;
  331. op.textContent = str;
  332. if (index == op_value) {
  333. op.setAttribute("selected", "selected");
  334. }
  335. op_value++;
  336. select_box.appendChild(op);
  337. }*/
  338. select_box.addEventListener("change", function (e) {
  339. GM_setValue("search_index", this.value);
  340. run();
  341. });
  342. th_list[0].appendChild(select_box);
  343.  
  344. th_list[1].appendChild(document.createElement("a"));
  345. th_list[1].lastChild.setAttribute("href", src);
  346. th_list[1].lastChild.setAttribute("target", "_blank");
  347. th_list[1].lastChild.textContent = head_str[0];
  348.  
  349. th_list[2].appendChild(document.createElement("a"));
  350. th_list[2].lastChild.textContent = head_str[1];
  351.  
  352. th_list[3].appendChild(document.createElement("a"));
  353. th_list[3].lastChild.textContent = head_str[2];
  354.  
  355. th_list.forEach(function (th) {
  356. a.appendChild(th);
  357. });
  358. /*
  359. for (var th of th_list) {
  360. a.appendChild(th);
  361. }
  362. */
  363. return a;
  364. },
  365. create_row: function (data) {
  366. var tr = document.createElement("tr");
  367. tr.className = "nong-row";
  368. tr.setAttribute("mag", data.mag);
  369. var td = document.createElement("td");
  370. var list = [this.create_info(data.title, data.mag), this.create_size(data.size, data.src), this.create_operation(data.mag), this.create_offline()];
  371. list.forEach(function (elem) {
  372. var c = td.cloneNode(true);
  373. c.appendChild(elem);
  374. tr.appendChild(c);
  375. });
  376. /*
  377. for (var elem of [this.create_info(data.title, data.mag), this.create_size(data.size, data.src), this.create_operation(data.mag), this.create_offline()]) {
  378. var c = td.cloneNode(true);
  379. c.appendChild(elem);
  380. tr.appendChild(c);
  381. }
  382. */
  383. return tr;
  384. },
  385. create_row_for_sukebei: function (data) {
  386. var tr = document.createElement("tr");
  387. tr.className = "nong-row";
  388. tr.setAttribute("mag", data.mag);
  389. var td = document.createElement("td");
  390. var append_elems = [
  391.  
  392. (function (title, src, self) {
  393. return self.create_info(title, src);
  394. })(data.title, data.src, this),
  395.  
  396. (function (size, src, self) {
  397. return self.create_size(size, src);
  398. })(data.size, data.src, this),
  399.  
  400. (function (torrent_url, self) {
  401. var operate = self.create_operation(torrent_url);
  402. operate.firstChild.textContent = "种子";
  403. operate.firstChild.setAttribute("class", "nong-copy-sukebei");
  404. operate.firstChild.setAttribute("target", "_blank");
  405. return operate;
  406. })(data.torrent_url, this),
  407.  
  408. (function (self) {
  409. var div = document.createElement("div");
  410. div.textContent = "暂不支持离线下载";
  411. return div;
  412. })(this)];
  413. append_elems.forEach(function (elem) {
  414. var c = td.cloneNode(true);
  415. c.appendChild(elem);
  416. tr.appendChild(c);
  417. });
  418. /*
  419. for (var elem of append_elems) {
  420. var c = td.cloneNode(true);
  421. c.appendChild(elem);
  422. tr.appendChild(c);
  423. }
  424. */
  425. return tr;
  426. },
  427. create_info: function (title, mag) {
  428. var a = this.info.cloneNode(true);
  429. a.firstChild.textContent = title.length < max_title_length ? title : title.substr(0, max_title_length) + "...";
  430. a.firstChild.href = mag;
  431. a.title = title;
  432. return a;
  433. },
  434. create_size: function (size, src) {
  435. var a = this.size.cloneNode(true);
  436. a.textContent = size;
  437. a.href = src;
  438. return a;
  439. },
  440. create_operation: function (mag) {
  441. var a = this.operation.cloneNode(true);
  442. a.firstChild.href = mag;
  443. return a;
  444. },
  445. create_offline: function () {
  446. var a = this.offline.cloneNode(true);
  447. a.className = "nong-offline";
  448. return a;
  449. },
  450.  
  451. info: (function () {
  452. var a = document.createElement("div");
  453. var b = document.createElement("a");
  454. b.textContent = "name";
  455. b.href = "src";
  456. b.target = "_blank";
  457. a.appendChild(b);
  458. return a;
  459. })(),
  460. size: function () {
  461. var a = document.createElement("a");
  462. a.textContent = "size";
  463. return a;
  464. }(),
  465. operation: (function () {
  466. var a = document.createElement("div");
  467. var copy = document.createElement("a");
  468. copy.className = "nong-copy";
  469. copy.textContent = "复制";
  470. a.appendChild(copy);
  471. return a;
  472. })(),
  473. offline: (function () {
  474. var a = document.createElement("div");
  475. var b = document.createElement("a");
  476. b.className = "nong-offline-download";
  477. b.target = "_blank";
  478. for (var k in offline_sites) {
  479. if (offline_sites[k].enable) {
  480. var c = b.cloneNode(true);
  481. c.href = offline_sites[k].url;
  482. c.textContent = offline_sites[k].name;
  483. a.appendChild(c);
  484. }
  485. }
  486. return a;
  487. })(),
  488. },
  489. generate_head: function () {
  490. var tab = document.createElement("table");
  491. tab.id = "nong-table";
  492. tab.appendChild(this.template.create_head("https://greasyfork.org/zh-CN/scripts/8392-%E6%8C%8A"));
  493. return tab;
  494. },
  495. generate: function (src, data) {
  496. //console.log(src);
  497. //console.log(data);
  498. var tab = document.querySelector("#nong-table");
  499. tab.querySelector("#nong-head th a").href = src;
  500. if (src.match("sukebei.nyaa.se")) {
  501. data.forEach((d) => {
  502. tab.appendChild(this.template.create_row_for_sukebei(d));
  503. });
  504. /*
  505. for (var d of data) {
  506. tab.appendChild(this.template.create_row_for_sukebei(d));
  507. }
  508. */
  509. }
  510. else {
  511. data.forEach((d) => {
  512. tab.appendChild(this.template.create_row(d));
  513. });
  514. /*
  515. for (var d of data) {
  516. tab.appendChild(this.template.create_row(d));
  517. }
  518. */
  519. }
  520. return tab;
  521. },
  522.  
  523. };
  524. var my_search = {
  525. current: function (kw, cb) {
  526. var search = my_search[GM_getValue("search_index", 0)];
  527. try {
  528. return search(kw, cb);
  529. }
  530. catch (e) {
  531. this.search_error();
  532. }
  533. },
  534. search_error: function (r) {
  535. alert("搜索出现错误,请检查网络");
  536. },
  537. search_name_string: ["btso", "btdb", "sukebei.nyaa", "btkitty"],
  538. 0: function (kw, cb) {
  539. GM_xmlhttpRequest({
  540. method: "GET",
  541. url: "https://btso.pw/search/" + kw,
  542. onload: function (result) {
  543. var doc = common.parsetext(result.responseText);
  544. var data = [];
  545. var t = doc.getElementsByClassName("data-list")[0];
  546. if (t) {
  547. Array.from(t.getElementsByTagName("a")).forEach(function (elem) {
  548. if (!elem.className.match("btn")) {
  549. data.push({
  550. "title": elem.title,
  551. "mag": "magnet:?xt=urn:btih:" + elem.outerHTML.replace(/.*hash\//, "").replace(/" .*\n.*\n.*\n.*/, ""),
  552. "size": elem.nextElementSibling.textContent,
  553. "src": elem.href,
  554. });
  555. }
  556. });
  557. }
  558. else {
  559. data.push({
  560. "title": "没有找到磁链接",
  561. "mag": "",
  562. "size": "0",
  563. "src": result.finalUrl,
  564. });
  565. }
  566. cb(result.finalUrl, data);
  567. },
  568. onerror: function (e) {
  569. console.error(e);
  570. throw "search error";
  571. }
  572. });
  573. },
  574. 1: function (kw, cb) {
  575. GM_xmlhttpRequest({
  576. method: "GET",
  577. url: "https://btdb.in/q/" + kw + "/",
  578. onload: function (result) {
  579. var doc = common.parsetext(result.responseText);
  580. var data = [];
  581. var t = doc.getElementsByClassName("item-title");
  582. if (t) {
  583. Array.from(t).forEach(function (elem) {
  584. data.push({
  585. "title": elem.firstChild.title,
  586. "mag": elem.nextElementSibling.firstElementChild.href,
  587. "size": elem.nextElementSibling.children[1].textContent,
  588. "src": "https://btdb.in" + elem.firstChild.getAttribute("href"),
  589. });
  590. });
  591. }
  592. else {
  593. data.push({
  594. "title": "没有找到磁链接",
  595. "mag": "",
  596. "size": "0",
  597. "src": result.finalUrl,
  598. });
  599. }
  600.  
  601. cb(result.finalUrl, data);
  602. },
  603. onerror: function (e) {
  604. console.error(e);
  605. throw "search error";
  606. }
  607. });
  608. },
  609. 2: function (kw, cb) {
  610. GM_xmlhttpRequest({
  611. method: "GET",
  612. url: "https://sukebei.nyaa.se/?page=search&cats=0_0&filter=0&term=" + kw,
  613. onload: function (result) {
  614. var doc = common.parsetext(result.responseText);
  615. var data = [];
  616. var t = doc.getElementsByClassName("tlistrow");
  617. if (t) {
  618. Array.from(t).forEach(function (elem) {
  619. data.push({
  620. "title": elem.querySelector(".tlistname a").textContent,
  621. "mag": "",
  622. "torrent_url": "https:" + elem.querySelector(".tlistdownload a").getAttribute("href"),
  623. "size": elem.querySelector(".tlistsize").textContent,
  624. "src": "https:" + elem.querySelector(".tlistname a").getAttribute("href"),
  625. });
  626. });
  627. }
  628. else {
  629. data.push({
  630. "title": "没有找到磁链接",
  631. "mag": "",
  632. "torrent_url": "",
  633. "size": "0",
  634. "src": result.finalUrl,
  635. });
  636. }
  637.  
  638. cb(result.finalUrl, data);
  639. },
  640. onerror: function (e) {
  641. console.error(e);
  642. throw "search error";
  643. }
  644. });
  645. },
  646. 3: function (kw, cb) {
  647. GM_xmlhttpRequest({
  648. method: "POST",
  649. url: "http://btkitty.bid/",
  650. data: "keyword=" + kw,
  651. headers: {
  652. "Content-Type": "application/x-www-form-urlencoded"
  653. },
  654. onload: function (result) {
  655. var doc = common.parsetext(result.responseText);
  656. var data = [];
  657. var t = doc.getElementsByClassName("list-con");
  658. if (t) {
  659.  
  660. Array.from(t).forEach(function (elem) {
  661. data.push({
  662. "title": elem.querySelector("dt a").textContent,
  663. "mag": elem.querySelector("dd a").href,
  664. "size": elem.querySelector(".option span:nth-child(3) b").textContent,
  665. "src": elem.querySelector("dt a").href,
  666. });
  667. });
  668. }
  669. else {
  670. data.push({
  671. "title": "没有找到磁链接",
  672. "mag": "",
  673. "size": "0",
  674. "src": result.finalUrl,
  675. });
  676. }
  677. cb(result.finalUrl, data);
  678. },
  679. onerror: function (e) {
  680. console.error(e);
  681. throw "search error";
  682. }
  683. })
  684. },
  685.  
  686. };
  687.  
  688. var display_table = function (vid, insert_where) {
  689. common.add_style();
  690. if (!document.querySelector("#nong-head")) {
  691. var tab_with_head = magnet_table.generate_head();
  692. if (typeof insert_where === "string") {
  693. var elem = document.querySelector(insert_where);
  694. //console.log("display_table", tab, elem);
  695. if (elem) {
  696. elem.parentElement.insertBefore(tab_with_head, elem);
  697. }
  698. }
  699. else if (typeof insert_where === "function") {
  700. insert_where(tab_with_head);
  701. }
  702. else {
  703. console.error("插入表格错误");
  704. return;
  705. }
  706. }
  707. else {
  708. var head = document.querySelector("#nong-head");
  709. Array.from(document.querySelectorAll(".nong-row")).forEach(function (row) {
  710. if (row !== head) {
  711. row.parentElement.removeChild(row);
  712. }
  713. });
  714. }
  715. my_search.current(vid, function (data, src) {
  716. var tab = magnet_table.generate(data, src);
  717. common.reg_event();
  718. });
  719. };
  720.  
  721. var vid_mode = function (v) {
  722. var vid = "";
  723. try {
  724. vid = v.vid();
  725. }
  726. catch (error) {
  727. vid = "";
  728. console.error("没有找到番号", v.vid.toString());
  729. }
  730. if (vid) {
  731. console.info("番号:", vid);
  732. display_table(vid, v.insert_where);
  733. }
  734. };
  735.  
  736. var dl_mode = function (v) {
  737.  
  738. var mag = GM_getValue("magnet", "");
  739. //console.info(1, "开始离线下载", mag);
  740. if (mag) {
  741. var script = document.createElement("script");
  742. script.setAttribute("type", "text/javascript");
  743. script.innerHTML = "(" + v.fill_form.toString() + ")(\"" + mag + "\")";
  744. document.body.appendChild(script);
  745. //console.info(info);
  746. }
  747. GM_setValue("magnet", "");
  748. };
  749.  
  750. var run = function () {
  751. max_title_length = GM_getValue("max_title_length", 40);
  752. var main_keys = Object.keys(main);
  753. for (var i = 0; i < main_keys.length; i++) {
  754. var v = main[main_keys[i]];
  755.  
  756. if (v.re && v.re.test(location.href)) {
  757. if (v.type === 0) {
  758.  
  759. //----
  760.  
  761. //for javlibrary
  762. if (main_keys[i] === "javlibrary") {
  763. if (document.querySelector("#adultwarningprompt")) {
  764. document.querySelectorAll("#adultwarningprompt input")[0].click();
  765. }
  766. }
  767. //----
  768.  
  769. vid_mode(v);
  770. }
  771. else if (v.type == 1) {
  772. dl_mode(v);
  773. }
  774. break;
  775. }
  776. }
  777. };
  778. var max_title_length = GM_getValue("max_title_length", 40);
  779. var set_max_title_length = function () {
  780. var len = prompt("请输入你想要的标题长度", GM_getValue("max_title_length", 40));
  781. if (len !== null && len !== "") {
  782. GM_setValue("max_title_length", len);
  783. run();
  784. }
  785. };
  786.  
  787. GM_registerMenuCommand("挊-标题长度", set_max_title_length);
  788. run();
  789.  
  790.  
  791.