Sleazy Fork is available in English.

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

Mint 2017.08.11.. Lásd a legutóbbi verzió

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