115优化大师(精简版)

保留离线下载和其它功能,去掉文件管理和播放优化。

  1. // ==UserScript==
  2. // @name 115优化大师(精简版)
  3. // @author zxf10608
  4. // @version 7.5.1
  5. // @icon https://115.com/favicon.ico
  6. // @namespace https://gf.qytechs.cn/zh-CN/scripts/408466
  7. // @description 保留离线下载和其它功能,去掉文件管理和播放优化。
  8. // @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
  9. // @require https://gf.qytechs.cn/scripts/398240-gm-config-zh-cn/code/GM_config_zh-CN.js
  10. // @require https://gf.qytechs.cn/scripts/412267-base64-v1-0/code/base64_v10.js
  11. // @require https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js
  12. // @resource toastrCss https://cdn.jsdelivr.net/npm/toastr@2.1.4/build/toastr.min.css
  13. // @match http*://*/*
  14. // @match http*://*.115.com/*
  15. // @exclude http*://*.115.com/bridge*
  16. // @exclude http*://*.115.com/*/static*
  17. // @exclude http*://*.baidu.com/*
  18. // @exclude http*://*.iqiyi.com/*
  19. // @exclude http*://*.qq.com/*
  20. // @exclude http*://*.youku.com/*
  21. // @exclude http*://*.bilibili.com/
  22. // @exclude http*://*.pptv.com/*
  23. // @exclude http*://*.fun.tv/*
  24. // @exclude http*://*.sohu.com/*
  25. // @exclude http*://*.le.com/*
  26. // @exclude http*://*.tudou.com/*
  27. // @exclude http*://*.bilibili.com/*
  28. // @exclude http*://music.163.com/*
  29. // @exclude http*://github.com/*
  30. // @exclude http*://gitee.com/*
  31. // @exclude http*://btcache.me/*
  32. // @exclude http*://*.jd.com/*
  33. // @exclude http*://*.taobao.com/*
  34. // @exclude http*://*.tmall.com/*
  35. // @exclude http*://*.vip.com/*
  36. // @exclude http*://*.pinduoduo.com/*
  37. // @grant GM_setValue
  38. // @grant GM_getValue
  39. // @grant GM_addStyle
  40. // @grant GM_download
  41. // @grant GM_openInTab
  42. // @grant GM_setClipboard
  43. // @grant GM_getResourceText
  44. // @grant GM_xmlhttpRequest
  45. // @grant GM_registerMenuCommand
  46. // @connect 115.com
  47. // @connect *
  48. // @grant unsafeWindow
  49. // @grant window.open
  50. // @grant window.close
  51. // @run-at document-start
  52. // @compatible chrome
  53. // @license GPL License
  54. // ==/UserScript==
  55.  
  56. (function() {
  57. 'use strict';
  58. var newVersion = 'v7.5.1';
  59.  
  60. if (typeof GM_config == 'undefined') {
  61. alert('115优化大师:\n网络异常,相关库文件加载失败,脚本无法使用,请刷新网页重新加载!');
  62. return;
  63. } else {
  64. console.log('115优化大师:相关库文件加载成功!');
  65. }
  66.  
  67. function config() {
  68. var windowCss = '#Cfg .nav-tabs {margin: 20 2} #Cfg .config_var textarea{width: 310px; height: 50px;} #Cfg .inline {padding-bottom:0px;} #Cfg .config_header a:hover {color:#1e90ff;} #Cfg .config_var {margin-left: 10%;margin-right: 10%;} #Cfg input[type="checkbox"] {margin: 3px 3px 3px 0px;} #Cfg input[type="text"] {width: 53px;} #Cfg {background-color: lightblue;} #Cfg .reset_holder {float: left; position: relative; bottom: -1em;} #Cfg .saveclose_buttons {margin: .7em;} #Cfg .section_desc {font-size: 10pt;}';
  69.  
  70. GM_registerMenuCommand('设置', opencfg);
  71. function opencfg() {
  72. GM_config.open();
  73. }
  74.  
  75. GM_config.init({
  76. id: 'Cfg',
  77. title: GM_config.create('a', {
  78. href: 'https://gf.qytechs.cn/zh-CN/scripts/408466',
  79. target: '_blank',
  80. className: 'setTitle',
  81. textContent: '115优化大师',
  82. title: '作者:zxf10608 版本:' + newVersion + ' 点击访问主页'
  83. }),
  84. isTabs: true,
  85. skin: 'tab',
  86. css: windowCss,
  87. frameStyle: {
  88. height: '550px',
  89. width: '445px',
  90. zIndex: '2147483648',
  91. },
  92. fields: {
  93. // 离线升级
  94. offline_Down: {
  95. section: ['离线升级', '升级离线下载功能'],
  96. label: '启用一键离线下载',
  97. labelPos: 'right',
  98. type: 'checkbox',
  99. default: true,
  100. },
  101. offline_result: {
  102. label: '任务添加后显示离线结果',
  103. labelPos: 'right',
  104. type: 'checkbox',
  105. default: true,
  106. },
  107. open_List: {
  108. label: '离线后自动打开任务列表',
  109. labelPos: 'right',
  110. type: 'checkbox',
  111. default: false,
  112. },
  113. open_search: {
  114. label: '离线成功后开启视频搜索',
  115. labelPos: 'right',
  116. type: 'checkbox',
  117. default: true,
  118. line: 'start',
  119. },
  120. search_result: {
  121. label: '显示视频搜索结果',
  122. labelPos: 'right',
  123. type: 'checkbox',
  124. default: true,
  125. },
  126. open_Popup: {
  127. label: '搜到视频自动播放',
  128. labelPos: 'right',
  129. type: 'checkbox',
  130. default: false,
  131. line: 'end',
  132. },
  133. fuzzy_find: {
  134. label: '启用下载地址模糊匹配',
  135. labelPos: 'right',
  136. type: 'checkbox',
  137. default: false,
  138. },
  139. diy_folder: {
  140. label: '自定义离线下载文件夹',
  141. labelPos: 'right',
  142. type: 'checkbox',
  143. default: false,
  144. line: 'start',
  145. },
  146. save_folder: {
  147. label: '设置文件夹',
  148. labelPos: 'right',
  149. type: 'button',
  150. line: 'end',
  151. click: function() {
  152. setFolder();
  153. }
  154. },
  155. reminder2: {
  156. label: '温馨提示',
  157. labelPos: 'right',
  158. type: 'button',
  159. click: function() {
  160. alert('1、显示离线下载结果有10s延时,用于服务器响应时间。\n2、为避免通知弹窗过多,最多只显示3个视频搜索结果,更多请自行到115查看。\n3、“启用下载地址模糊匹配”后,能根据哈希值或纯文本模糊匹配磁力链接和迅雷专用链,如在磁力搜索引擎、资源网等有奇效,但在某些网页有一定几率误识别,请谨慎开启。');
  161. }
  162. },
  163. // 其他设置
  164. hide_sidebar: {
  165. section: ['更多设置', '优化浏览体验'],
  166. label: '隐藏网盘侧边栏',
  167. labelPos: 'right',
  168. type: 'checkbox',
  169. default: false,
  170. },
  171. show_Alidity: {
  172. label: '显示上次登录(不可用)时间',
  173. labelPos: 'right',
  174. type: 'checkbox',
  175. default: false,
  176. },
  177. show_Star: {
  178. label: '网盘顶部增加星标按钮',
  179. labelPos: 'right',
  180. type: 'checkbox',
  181. default: false,
  182. },
  183. show_Offline: {
  184. label: '网盘顶部增加云下载按钮',
  185. labelPos: 'right',
  186. type: 'checkbox',
  187. default: true,
  188. },
  189. show_Task: {
  190. label: '网盘顶部增加链接任务按钮',
  191. labelPos: 'right',
  192. type: 'checkbox',
  193. default: true,
  194. },
  195. show_Update: {
  196. label: '更新后弹出更新日志',
  197. labelPos: 'right',
  198. type: 'checkbox',
  199. default: false,
  200. },
  201. toastr: {
  202. label: '通知弹出位置',
  203. labelPos: 'left',
  204. type: 'select',
  205. 'options': ['左上', '右上', '中上', '全铺'],
  206. default: '右上',
  207. },
  208. http_ua: {
  209. label: '数据请求UA标识(非必要勿改)',
  210. type: 'textarea',
  211. default: ''
  212. },
  213. },
  214. events: {
  215. save: function() {
  216. GM_config.close();
  217. location.reload();
  218. }
  219. },
  220. });
  221. }
  222. config();
  223.  
  224. var G = GM_config;
  225. var localHref = window.location.href;
  226. var show_result = G.get('offline_result');
  227. var down_reg = /^(magnet|thunder|ftp|ed2k):/i;
  228. var UA = G.get('http_ua') != '' ? G.get('http_ua') : navigator.userAgent;
  229. var sign_url = 'http://115.com/?ct=offline&ac=space';
  230. var task_del = 'https://115.com/web/lixian/?ct=lixian&ac=task_del';
  231. var add_url = 'http://115.com/web/lixian/?ct=lixian&ac=add_task_url';
  232. var add_urls = 'http://115.com/web/lixian/?ct=lixian&ac=add_task_urls';
  233. var lists_url = 'http://115.com/web/lixian/?ct=lixian&ac=task_lists';
  234. var a_list = `<br><a target="_blank" class="openList" href="javascript:void(0);" style="color:blue;" title="点击打开离线链接任务列表">打开任务列表</a>`;
  235. console.log('115脚本UA:' + UA);
  236.  
  237. function notice() {
  238. GM_addStyle(GM_getResourceText('toastrCss'));
  239. if (G.get('toastr') == '全铺' || localHref.indexOf('https://captchaapi.115.com') != -1) {
  240. GM_addStyle('.toast{font-size:15px!important;} .toast-title{font-size:16px!important;text-align:center}');
  241. } else {
  242. GM_addStyle('.toast{font-size:15px!important;width:360px!important;} .toast-title{font-size:16px!important;text-align:center}');
  243. }
  244. var place = { '左上': 'toast-top-left', '右上': 'toast-top-right', '中上': 'toast-top-center' }[G.get('toastr')] || 'toast-top-full-width';
  245. toastr.options = {
  246. "closeButton": true,
  247. "debug": false,
  248. "progressBar": true,
  249. "timeOut": 8000,
  250. "extendedTimeOut": 8000,
  251. "positionClass": place,
  252. "allowHtml": true,
  253. "newestOnTop": false,
  254. };
  255. }
  256. notice();
  257.  
  258. function AjaxCall(href, callback) {
  259. GM_xmlhttpRequest({
  260. method: "GET",
  261. url: href,
  262. headers: {
  263. "User-Agent": UA,
  264. Origin: "https://115.com",
  265. },
  266. onload: function(data) {
  267. if (data.readyState == 4 && data.status == 200) {
  268. var htmlTxt = data.responseText;
  269. callback(null, htmlTxt);
  270. }
  271. },
  272. onerror: function(error) {
  273. callback(error);
  274. },
  275. ontimeout: function(error) {
  276. callback(error);
  277. },
  278. });
  279. }
  280.  
  281. function setFolder() {
  282. var old_cid = GM_getValue('offlineFolder') || '';
  283. var new_cid = prompt('请输入离线下载保存文件夹的cid值:\n ※ 获取cid值方法:打开需要保存到的网盘文件夹,复制地址栏中"cid="后面的一串数字,以"&"截止,如https://115.com/?cid=012345678912345678&...,cid值则为 012345678912345678。该项不填或填无效值则保存至默认文件夹(云下载)。※', old_cid);
  284. if (/^(\d{17,19}|0)$/.test(new_cid)) {
  285. GM_setValue('offlineFolder', new_cid);
  286. alert('设置成功,现cid值为:\n' + new_cid);
  287. } else if (new_cid == '') {
  288. GM_setValue('offlineFolder', '');
  289. alert('未输入cid值,保存至默认文件夹(云下载)。');
  290. } else if (new_cid == null) {
  291. console.log('已点击取消');
  292. } else {
  293. alert('设置失败,cid值无效,请重新输入!\n(该值除根目录为 0 外,其他文件夹均为17至19位纯数字)');
  294. setFolder();
  295. }
  296. }
  297.  
  298. function getRightUrl(url) {
  299. var newUrl = url;
  300. if (/^thunder/i.test(url)) {
  301. var key = url.replace(/thunder:\/\//i, '');
  302. var temp = decode64(key);
  303. newUrl = decodeURIComponent(temp.slice(2, -2));
  304. }
  305. if (/^magnet/i.test(newUrl)) {
  306. var hash = newUrl.split('&')[0].substring(20) || newUrl.substring(20);
  307. if (hash.length == 32) {
  308. hash = base32To16(hash);
  309. }
  310. newUrl = 'magnet:?xt=urn:btih:' + hash;
  311. } else if (/^\/\//.test(url)) {
  312. newUrl = location.protocol + url;
  313. } else if (/^\/(?!\/)/.test(url)) {
  314. newUrl = location.protocol + '//' + location.host + url;
  315. }
  316. return newUrl;
  317. }
  318.  
  319. function base32To16(str) {
  320. if (str.length % 8 !== 0 || /[0189]/.test(str)) {
  321. return str;
  322. }
  323. str = str.toUpperCase();
  324. var bin = "", newStr = "", i;
  325. for (i = 0; i < str.length; i++) {
  326. var charCode = str.charCodeAt(i);
  327. if (charCode < 65) charCode -= 24;
  328. else charCode -= 65;
  329. charCode = '0000' + charCode.toString(2);
  330. charCode = charCode.substr(charCode.length - 5);
  331. bin += charCode;
  332. }
  333. for (i = 0; i < bin.length; i += 4) {
  334. newStr += parseInt(bin.substring(i, i + 4), 2).toString(16);
  335. }
  336. return newStr;
  337. }
  338.  
  339. function repeat(link) {
  340. var result = false;
  341. var A = link.slice(0, 60);
  342. if ($('.115offline').length == 0) return result;
  343. $('.115offline').each(function() {
  344. var B = $(this).data('href').slice(0, 60);
  345. if (A.toLowerCase() == B.toLowerCase()) {
  346. result = true;
  347. return false;
  348. }
  349. });
  350. return result;
  351. }
  352.  
  353. function searchTask(json, link) {
  354. var dataEl = false;
  355. for (var i = 0; i < json.tasks.length; i++) {
  356. if (json.tasks[i].url == link || json.tasks[i].url == decodeURIComponent(link)) {
  357. dataEl = json.tasks[i];
  358. break;
  359. }
  360. }
  361. return dataEl;
  362. }
  363.  
  364. function verify() {
  365. var time = new Date().getTime();
  366. var w = 335;
  367. var h = 500;
  368. var t = (window.screen.availHeight - h) / 2;
  369. var l = (window.screen.availWidth - w) / 2;
  370. var link = 'https://captchaapi.115.com/?ac=security_code&type=web&cb=Close911_' + time;
  371. var a = confirm('立即打开验证账号弹窗?');
  372. if (a) {
  373. var blocked = false;
  374. try {
  375. var wroxWin = window.open(link, '请验证账号', 'height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + ',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no');
  376. if (wroxWin == null) {
  377. blocked = true;
  378. }
  379. } catch (e) {
  380. blocked = true;
  381. }
  382. if (blocked) {
  383. alert('验证弹窗已被拦截,请允许本页面弹出式窗口!');
  384. }
  385. }
  386. }
  387.  
  388. var offline = function() {
  389. return {
  390. getSign: function(key, save_name) {
  391. return new Promise(function(resolve, reject) {
  392. if (/^\w+=/.test(key)) {
  393. resolve(key);
  394. return;
  395. }
  396.  
  397. var UserID = GM_getValue('115ID') || '';
  398. var cid = G.get('diy_folder') ? GM_getValue('offlineFolder') : '';
  399. var title = save_name ? save_name : '';
  400. GM_xmlhttpRequest({
  401. method: 'GET',
  402. url: sign_url,
  403. responseType: 'json',
  404. headers: {
  405. "User-Agent": UA,
  406. Origin: "https://115.com",
  407. },
  408. onload: function(result) {
  409. if (result.responseText.indexOf('html') != -1) {
  410. toastr.error('请先登录(不可用)115网盘账号!', '离线任务添加失败。');
  411. setTimeout(function() {
  412. var a = confirm('立即打开115网盘登录(不可用)页面?');
  413. if (a) {
  414. GM_openInTab('https://115.com/?mode=login', false);
  415. }
  416. }, 3000);
  417. return;
  418. }
  419. var data = {
  420. uid: UserID,
  421. sign: result.response.sign,
  422. time: result.response.time,
  423. wp_path_id: cid,
  424. savepath: title
  425. };
  426.  
  427. if ($.isPlainObject(key)) {
  428. var value = $.param($.extend(data, key));
  429. } else {
  430. var value = $.param(data) + `&url=${key}`;
  431. }
  432. resolve(value);
  433. },
  434. onerror: function(error) {
  435. reject(error);
  436. },
  437. });
  438. });
  439. },
  440.  
  441. getData: function(herf, key, save_name) {
  442. return offline.getSign(key, save_name).then(function(value) {
  443. return new Promise(function(resolve, reject) {
  444. GM_xmlhttpRequest({
  445. method: 'POST',
  446. data: value,
  447. url: herf,
  448. responseType: 'json',
  449. headers: {
  450. "User-Agent": UA,
  451. "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
  452. "Accept": "application/json, text/javascript, */*; q=0.01",
  453. Origin: "https://115.com",
  454. "X-Requested-With": "XMLHttpRequest"
  455. },
  456. onload: function(result) {
  457. resolve(result.response);
  458. },
  459. onerror: function(error) {
  460. reject(error);
  461. },
  462. });
  463. });
  464. });
  465. },
  466.  
  467. check: function(link, link2, one) {
  468. if (document.hidden) {
  469. GM_setValue('noTimeOut', true);
  470. toastr.options.timeOut = 0;
  471. } else {
  472. GM_setValue('noTimeOut', false);
  473. toastr.options.timeOut = 12000;
  474. }
  475.  
  476. var c = 1;
  477. var retry = false;
  478. var txt2 = '5秒后自动重试,请稍等。';
  479. function add(retry, txt2) {
  480. if (c == 6) {
  481. console.log('离线结果查询异常。离线任务数量过多,请清空后再试。');
  482. toastr.warning('离线任务数量过多,请清空后再试。', '离线结果查询异常!');
  483. return;
  484. }
  485.  
  486. var key = '';
  487. var lists_url2 = lists_url + '&page=' + c;
  488. console.log('离线任务数据地址:' + lists_url2);
  489. offline.getData(lists_url2, key).then(function(json) {
  490. console.log('离线任务列表第' + c + '页:');
  491. console.log(json);
  492. if (json.state) {
  493. var dataEl = searchTask(json, link);
  494. if (dataEl) {
  495. var name = dataEl.del_path == '' ? dataEl.name : dataEl.del_path.slice(0, -1);
  496. var a_del = `&nbsp;&nbsp;<a target="_blank" class="delTask" data=${dataEl.info_hash} href="javascript:void(0);" style="color:blue;" title="删除该离线任务">删除任务</a>`;
  497. if (dataEl.status != -1) {
  498. if (dataEl.move == -1) {
  499. toastr.warning('空间不足,请到115扩容', '离线下载异常!');
  500. return;
  501. }
  502. var down_result = dataEl.percentDone.toFixed(0);
  503. var cid = dataEl.file_id || 0;
  504. if (down_result >= 99 && cid != 0) {
  505. var txt = `文件(夹)名:${name},大小:${change(dataEl.size)}。`;
  506. resultMark(link2, 3);
  507. if (one) {
  508. console.log(txt + '离线下载已完成。');
  509. return;
  510. }
  511.  
  512. if (show_result && !retry) {
  513. toastr.success(txt + a_list + a_del, '离线下载已完成', { timeOut: 5000 });
  514. }
  515.  
  516. if (G.get('open_search')) {
  517. offline.search(dataEl.name, cid, function(search_result, video, j, num) {
  518. if (search_result) {
  519. if (G.get('search_result')) {
  520. var videoTxt = JSON.stringify(video);
  521. var txt = `文件名:${video.name},大小:${video.size},时长:${tranTime(video.time)}。`;
  522. var h1 = `<br><a target="_blank" class="115play" data=${videoTxt} href="javascript:void(0);" style="color:blue;" title="播放该视频">播放</a>`;
  523. var h2 = `&nbsp;&nbsp;<a target="_blank" class="115down" data=${videoTxt} one="1" href="javascript:void(0);" style="color:blue;" title="下载该视频">下载</a>`;
  524. var h3 = `&nbsp;&nbsp;<a target="_blank" class="115del" data=${videoTxt} href="javascript:void(0);" style="color:blue;" title="删除该视频文件夹">删除</a>`;
  525. var h4 = `&nbsp;&nbsp;<a target="_blank" class="115newName" data=${videoTxt} href="javascript:void(0);" style="color:blue;" title="重命名该视频">重命名</a>`;
  526. var h5 = `&nbsp;&nbsp;<a target="_blank" class="openFolder" data=${cid} href="javascript:void(0);" style="color:blue;" title="查看所属文件列表">查看</a>`;
  527. toastr.success(txt + h1 + h2 + h3 + h4 + h5, `发现第 ${j} 个视频(共 ${num} 个)`);
  528. }
  529.  
  530. if (G.get('open_Popup') && j == 1) {
  531. setTimeout(function() {
  532. var type = '115play';
  533. palyData(video, type);
  534. }, 500);
  535. }
  536. } else {
  537. if (dataEl.move == 2 || dataEl.move == 0 || dataEl.status == 0) {
  538. var txt = '离线数据取回网盘中。';
  539. } else {
  540. var txt = '未发现任何视频文件。';
  541. }
  542. var h1 = `<br><a target="_blank" class="openFolder" data=${cid} href="javascript:void(0);" style="color:blue;" title="点击打开所属文件列表">打开文件列表</a>`;
  543. toastr.warning(txt + txt2 + h1, '视频搜索无结果!');
  544.  
  545. if (!retry) {
  546. setTimeout(function() {
  547. retry = true;
  548. txt2 = '';
  549. toastr.clear();
  550. console.log('重试搜索结果:');
  551. add(retry, txt2);
  552. }, 5000);
  553. }
  554. }
  555. });
  556. }
  557. } else if (show_result) {
  558. resultMark(link2, 4);
  559. if (one) {
  560. console.log(`文件(夹)名:${name},已离线下载 ${down_result}%。`);
  561. return;
  562. }
  563. var txt = `文件(夹)名:${name},下载进度为:<span style="color:purple;">${down_result}%</span>。`;
  564. toastr.warning(txt + a_list + a_del, '离线下载中...');
  565. }
  566. } else if (show_result) {
  567. resultMark(link2, 4);
  568. if (one) {
  569. console.log(`文件(夹)名:${name},离线下载失败。`);
  570. return;
  571. } else if (dataEl.err == 10016) {
  572. var txt = '文件含违规内容,已自动拦截。';
  573. } else {
  574. var txt = '未知原因,请到115网盘查看。';
  575. var a_del = '';
  576. }
  577. toastr.error(txt + a_list + a_del, '离线下载失败!', { timeOut: 8000 });
  578. return;
  579. }
  580. } else {
  581. console.log('第' + c + '页查询失败,无匹配数据');
  582. if (c == json.page_count) {
  583. console.log('离线链接对比异常,已搜索所有离线列表页面,无返回结果。');
  584. toastr.warning('搜索参数错误。', '离线结果查询异常!', { timeOut: 5000 });
  585. return;
  586. }
  587. c++;
  588. add();
  589. }
  590. } else {
  591. toastr.error('查询离线结果失败。', '服务器错误!');
  592. return;
  593. }
  594. });
  595. }
  596. add(retry, txt2);
  597. },
  598.  
  599. addButton: function() {
  600. $('[href]').each(function() {
  601. var url = $(this).attr('href');
  602. var reg1 = /\.(torrent|rar|zip|7z|mp4|rmvb|mkv|avi)$/i;
  603. var $El = $(this).parent().filter('li,td,th,:header').find('[Searched]');
  604.  
  605. if ((!down_reg.test(url) && !reg1.test(url)) || $(this).is('[Searched]') || $El.length > 1 || ($El.length = 1 && url.indexOf($El.attr('Searched')) != -1)) {
  606. return;
  607. }
  608.  
  609. if (down_reg.test(url)) {
  610. $(this).attr('Searched', url.split(':')[0]);
  611. } else if (/torrent$/i.test(url)) {
  612. $(this).attr('Searched', 'torrent');
  613. } else {
  614. $(this).attr('Searched', 'other');
  615. }
  616.  
  617. var link = getRightUrl(url);
  618. if (repeat(link)) {
  619. return;
  620. }
  621.  
  622. $(this).css('display', 'inline-block');
  623. $(this).after('<img src="https://cdn.jsdelivr.net/gh/zxf10608/JavaScript/icon/115logo.ico" class="115offline" data-href=' + link + ' style="z-index:9123456789;display:inline-block;cursor:pointer;margin:0px 5px 2px;border-radius:50%;border:0px;vertical-align:middle;outline:none!important;padding:0px!important;height:20px!important;width:20px!important;left:0px!important;top:0px!important;" title="使用115网盘离线下载,右键复制地址\n' + link + '">');
  624. });
  625. },
  626.  
  627. addLink: function() {
  628. $('a,button,span,li').each(function() {
  629. var reg1 = /(^|\/|&|-|\.|\?|=|:|#|_|@)([a-f0-9]{40}|[a-z2-7]{32})(?!\w)/i;
  630. var reg2 = /[a-z]{40}|[a-z]{32}/i;
  631.  
  632. if ($(this).next().addBack().is('[Searched],[href*="google"],[href*="motelppp.com"],[href*="bvmqkla.de"]') || $(this).find('img').length > 0) {
  633. return;
  634. }
  635.  
  636. var url = getAttribute(this);
  637. if (url.length > 0) {
  638. for (var i = 0; i < url.length; i++) {
  639. if (down_reg.test(url[i]) || (reg1.test(url[i]) && !reg2.test(url[i].match(reg1)[2]))) {
  640. if (down_reg.test(url[i])) {
  641. var value = url[i].split(':')[0];
  642. var templink = url[i];
  643. } else {
  644. var value = 'magnet';
  645. var templink = 'magnet:?xt=urn:btih:' + url[i].match(reg1)[2];
  646. }
  647. var link = getRightUrl(templink);
  648. if (repeat(link)) {
  649. return;
  650. }
  651. $(this).attr('Searched', value);
  652. $(this).after('<img src="https://cdn.jsdelivr.net/gh/zxf10608/JavaScript/icon/115logo.ico" class="115offline" data-href=' + link + ' style="z-index:9123456789;display:inline-block;cursor:pointer;margin:0px 5px 2px;border-radius:50%;border:0px;vertical-align:middle;outline:none!important;padding:0px!important;height:20px!important;width:20px!important;left:0px!important;top:0px!important;" title="使用115网盘离线下载2,右键复制地址\n' + link + '">');
  653. return;
  654. }
  655. }
  656. }
  657. });
  658. },
  659.  
  660. addSelect: function() {
  661. if ($('.115offline').length < 3) return;
  662.  
  663. $('.115offline:not([Sed])').each(function() {
  664. $(this).attr('Sed', 1);
  665. var url = $(this).data('href');
  666. $(this).after('<input type="checkbox" class="115select" value=' + url + ' title="长按shift键,连续选择" style="z-index:9123456789;display:inline-block;cursor:pointer;height:16px!important;width:16px!important;margin:0px 2px 1px;border-radius:50%;border:0px;vertical-align:middle;outline:none!important;padding:0px!important;left:0px!important;top:0px!important;" />');
  667. });
  668.  
  669. var sel = $('.115offline').length > 10 ? $('.115select:eq(-1),.115select:eq(0)') : $('.115select:eq(-1)');
  670. sel.each(function() {
  671. if ($(this).is('[batched]')) return;
  672. $(this).attr('batched', 1);
  673. $(this).after('<img src="https://cdn.jsdelivr.net/gh/zxf10608/JavaScript/icon/batch_down00.png" class="115offline_batch" style="z-index:9123456789;display:inline-block;cursor:pointer;margin:0px 1px 2px;border:0px;vertical-align:middle;outline:none!important;padding:0px!important;height:23px!important;width:23px!important;left:0px!important;top:0px!important;" title="使用115网盘批量离线下载所选地址,右键可全选等">');
  674. $(this).parent().css('overflow', 'visible');
  675. });
  676. },
  677.  
  678. search: function(name, cid, callback) {
  679. var title = new Array();
  680. title[0] = name.replace(/(\.|-|_)?(f?hd|sd|720p|1080p|full|mp4|avi|mkv|wmv|rmvb|rm|flv|f4v)/gi, ' ');
  681. title[1] = title[0].replace(/\/|&|-|\.|\?|=|:|#|_|@/g, ' ');
  682. title[2] = '.';
  683.  
  684. var a = 0;
  685. function add2() {
  686. if (a == 3) {
  687. console.log('该文件夹无视频文件。');
  688. callback(false);
  689. return;
  690. }
  691. var searchLink = 'https://webapi.115.com/files/search?cid=' + cid + '&search_value=' + encodeURIComponent(title[a]) + '&type=4';
  692. AjaxCall(searchLink, function(error, htmlTxt) {
  693. if (typeof htmlTxt == 'undefined') {
  694. a++;
  695. add2();
  696. } else {
  697. var json = JSON.parse(htmlTxt);
  698. if (a == 2 && json.folder.name == '云下载') {
  699. callback(false);
  700. return;
  701. }
  702.  
  703. if (json.count > 0) {
  704. var num = json.count;
  705. for (var i = 0; i < num; i++) {
  706. var $dataEh = json.data[i];
  707. var video = {};
  708. video['name'] = name2($dataEh.n);
  709. video['pid'] = $dataEh.pc;
  710. video['cid'] = $dataEh.cid;
  711. video['fid'] = $dataEh.fid;
  712. video['size'] = change($dataEh.s);
  713. video['sha'] = $dataEh.sha;
  714. video['time'] = $dataEh.play_long;
  715.  
  716. callback(true, video, i + 1, num);
  717. console.log('第' + a + '次搜索结果' + i + ':' + $dataEh.n + ' ' + video.size);
  718. if (i == 2) {
  719. return;
  720. }
  721. }
  722. } else {
  723. a++;
  724. add2();
  725. }
  726. }
  727. });
  728. }
  729. add2();
  730. }
  731. };
  732. }();
  733.  
  734. function change(number) {
  735. var size = "";
  736. if (number < 1024 * 1024 * 1024) {
  737. size = (number / (1024 * 1024)).toFixed(2) + "MB";
  738. } else {
  739. size = (number / (1024 * 1024 * 1024)).toFixed(2) + "GB";
  740. }
  741. var sizeStr = size + "";
  742. var index = sizeStr.indexOf(".");
  743. var dou = sizeStr.substr(index + 1, 2);
  744. if (dou == "00") {
  745. return sizeStr.substring(0, index) + sizeStr.substr(index + 3, 2);
  746. }
  747. return size;
  748. }
  749.  
  750. function name2(txt) {
  751. var newName = txt.replace(/\.(?!\w{2,4}$)/g, '_').replace(/\s/g, '&nbsp;');
  752. return newName;
  753. }
  754.  
  755. function tranTime(num) {
  756. var showTime = '';
  757. if (num > 3600) { showTime += ' ' + parseInt(num / 3600) + ' 小时'; num = num % 3600; }
  758. if (num > 60) { showTime += ' ' + parseInt(num / 60) + ' 分'; num = num % 60; }
  759. return showTime += ' ' + parseInt(num) + ' 秒';
  760. }
  761.  
  762. function clickOne(el, t) {
  763. var time = t ? t : 5000;
  764. if (el.attr('clicked') == 1) {
  765. console.log('5s内不可点击该按钮');
  766. return false;
  767. } else {
  768. el.attr('clicked', 1);
  769. el.css('opacity', '0.2');
  770. setTimeout(function() {
  771. el.attr('clicked', 0);
  772. el.css('opacity', '0.7');
  773. }, time);
  774. return true;
  775. }
  776. }
  777.  
  778. function resultMark(el, type) {
  779. if (el.length == 0 || !show_result) return;
  780.  
  781. var urls = [];
  782. var color = { 1: '#00CCFF', 2: '#DA70D6', 3: '#AEDD81', 4: '#EB7347' }[type];
  783. for (var i = 0; i < el.length; i++) {
  784. urls.push(el[i].url);
  785. $('.115offline').each(function() {
  786. var link = $(this).data('href');
  787. var $al = $(this).prev();
  788. var m = $al.attr('marked');
  789. if ((el[i].url == link || el[i].url == decodeURIComponent(link)) && m != 3) {
  790. $al.attr('marked', type).css('background-color', color);
  791. $al.find('[style]').removeAttr('style');
  792. return false;
  793. }
  794. });
  795. }
  796. return urls;
  797. }
  798.  
  799. function getAttribute(e) {
  800. var data = [];
  801. $.each(e.attributes, function() {
  802. if (this.specified && this.value.length > 30) {
  803. data.push(this.value);
  804. }
  805. });
  806. if ($(e).text().length > 25) data.push($(e).text());
  807. return data;
  808. }
  809.  
  810. function right_menu() {
  811. $('body').append(`
  812. <div class="115menu" style="width:97px;height:85px;z-index:9123456789;overflow:hidden;position:absolute;display:none;background-color:#D0D0D0">
  813. <ul style="padding:5px 7px;margin:0px;list-style:none;">
  814. <li><a href="javascript:;" class="right_menu00">全选</a></li>
  815. <li><a href="javascript:;" class="right_menu01">反选</a></li>
  816. <li><a href="javascript:;" class="right_menu02">复制所选</a></li>
  817. <li><a href="javascript:;" class="right_menu11">复制地址</a></li>
  818. <li><a href="javascript:;" class="right_menu12">种子下载1</a></li>
  819. <li><a href="javascript:;" class="right_menu13">种子下载2</a></li>
  820. </ul>
  821. </div>`);
  822. $('.115menu a').css({ 'line-height': '25px', 'text-decoration': 'none', 'color': '#2C3E50', 'padding': '1px 5px', 'font-size': '16px', 'font-family': 'arial' });
  823. $('.115menu a').hover(function() {
  824. $(this).css({ 'background-color': '#2777F8', 'color': '#FFF' });
  825. }, function() {
  826. $(this).css({ 'background-color': '', 'color': '#2C3E50' });
  827. });
  828. }
  829.  
  830. function palyData(video, type) {
  831. var link = 'https://115.com/?ct=play&ac=location&pickcode=' + video.pid + '&hls=1';
  832. GM_openInTab(link, false);
  833. }
  834.  
  835. $(document).ready(function() {
  836. if (localHref.indexOf('https://115.com/') != -1) {
  837. if (typeof (unsafeWindow.USER_ID) != 'undefined') {
  838. GM_setValue('115ID', unsafeWindow.USER_ID);
  839. console.log('115账号已登录(不可用),账号ID获取成功!');
  840. } else {
  841. console.log('115账号未登录(不可用),账号ID获取失败!');
  842. }
  843.  
  844. var $topEl = $('#js_top_panel_box [id="js_filter_btn"]').addClass('btn-line');
  845. if (G.get('show_Star')) {
  846. $topEl.after('<a href="javascript:;" file_dialog_menu="star" class="button btn-line" id="js_star_list_btn"><i class="icon-operate"></i><span>星标</span></a>');
  847. }
  848. if (G.get('show_Offline')) {
  849. $topEl.after('<a href="javascript:;" file_dialog_menu="offline" class="button btn-line" id="js_offline_list_btn"><i class="icon-operate"></i><span>云下载</span></a>');
  850. }
  851. if (G.get('show_Task')) {
  852. $topEl.after('<a href="javascript:;" file_dialog_menu="task" class="button btn-line" id="js_task_list_btn"><i class="icon-operate"></i><span>链接任务</span></a>');
  853. }
  854. if (G.get('hide_sidebar')) {
  855. $('#js_left_panel_box').hide();
  856. }
  857. }
  858.  
  859. if (localHref.indexOf('https://captchaapi.115.com') != -1) {
  860. var t_close;
  861. $('body').on('click', '.vcode-hint', function() {
  862. t_close = setTimeout(function() {
  863. console.log('验证正确');
  864. window.open('', '_self');
  865. window.close();
  866. }, 200);
  867. return false;
  868. });
  869. $('.vcode-hint').on('DOMNodeInserted', function(e) {
  870. console.log('验证错误!');
  871. clearTimeout(t_close);
  872. });
  873. }
  874.  
  875. if (localHref.indexOf('https://115.com/?cid=0&offset=0&mode=wangpan') != -1) {
  876. window.onload = function() {
  877. if (G.get('show_Alidity') && typeof unsafeWindow.USER_ID != 'undefined') {
  878. var login_info = 'http://passportapi.115.com/app/1.0/web/9.2/login_log/login_devices';
  879. AjaxCall(login_info, function(error, htmlTxt) {
  880. var json = JSON.parse(htmlTxt);
  881. if (json.state == 1) {
  882. var time = json.data.last.utime;
  883. var date = new Date(time * 1000);
  884. var loginTime = formatDate(date, "yyyy年MM月dd日 HH:mm");
  885. toastr.success('上次登录(不可用)时间:' + loginTime, { timeOut: 5000 });
  886. console.log('登录(不可用)时间:\n' + loginTime);
  887. } else {
  888. var txt = json.error || '网络错误,未知时间!';
  889. toastr.warning('上次登录(不可用)时间:' + txt, { timeOut: 5000 });
  890. }
  891. });
  892. }
  893. }
  894. }
  895.  
  896. var oldVer = GM_getValue('version') || '';
  897. if (G.get('show_Update') && oldVer != newVersion) {
  898. var txt = `115优化大师 ${newVersion} 更新日志:\n更新日期:2025327 \n1、优化“生成播放列表”功能;\n2、更新官方HTML5播放地址; \n3、升级部分依赖库版本;\n4、部分代码逻辑优化。`;
  899. setTimeout(function() {
  900. alert(txt);
  901. }, 2000);
  902. GM_setValue('version', newVersion);
  903. }
  904. });
  905.  
  906. function formatDate(date, format) {
  907. if (!(date instanceof Date)) {
  908. date = new Date(date);
  909. }
  910. const o = {
  911. "M+": date.getMonth() + 1,
  912. "d+": date.getDate(),
  913. "H+": date.getHours(),
  914. "m+": date.getMinutes(),
  915. "s+": date.getSeconds(),
  916. "q+": Math.floor((date.getMonth() + 3) / 3),
  917. "S": date.getMilliseconds()
  918. };
  919. if (/(y+)/.test(format)) {
  920. format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  921. }
  922. for (const k in o) {
  923. if (new RegExp("(" + k + ")").test(format)) {
  924. format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  925. }
  926. }
  927. return format;
  928. }
  929.  
  930. $(document).ready(function() {
  931. $(document).on('click', function(e) {
  932. $('.115menu').hide();
  933. });
  934.  
  935. $('body').on('click', '.115offline', function(e) {
  936. if (!clickOne($(this))) return;
  937. var link = $(this).data('href');
  938. var save_name = '';
  939. offline.getData(add_url, link, save_name).then(function(json) {
  940. console.log('离线任务添加结果:');
  941. console.log(json);
  942. var errNum = json.errcode || json.error_code || '';
  943. var link2 = [{'url': link}];
  944. if (json.state) {
  945. if (show_result) {
  946. var txt = '10秒后显示离线结果。';
  947. } else {
  948. var txt = link;
  949. if (G.get('open_List')) {
  950. setTimeout(function() {
  951. GM_openInTab('https://115.com/?tab=offline&mode=wangpan', false);
  952. }, 2000);
  953. }
  954. }
  955. resultMark(link2, 1);
  956. toastr.info(txt, '离线任务添加成功。', { timeOut: 10000 });
  957. setTimeout(function() {
  958. offline.check(link, link2);
  959. }, 10000);
  960. } else if (errNum == 10008) {
  961. toastr.warning('任务已存在,无需重复添加。', '离线任务添加无效!', { timeOut: 5000 });
  962. if (G.get('open_List')) {
  963. setTimeout(function() {
  964. GM_openInTab('https://115.com/?tab=offline&mode=wangpan', false);
  965. }, 2000);
  966. }
  967. resultMark(link2, 1);
  968. offline.check(link, link2);
  969. } else if (errNum == 911) {
  970. toastr.warning('账号异常,请验证账号。', '离线下载失败!', { timeOut: 5000 });
  971. setTimeout(function() {
  972. verify();
  973. }, 1000);
  974. } else {
  975. resultMark(link2, 2);
  976. toastr.warning(json.error_msg, '离线任务添加失败!', { timeOut: 12000 });
  977. }
  978. console.log('离线链接:' + link + ' 添加结果:' + json.state + ' 原因:' + json.error_msg);
  979. }, function(error) {
  980. toastr.error('服务器繁忙,请稍后再试。', '离线任务添加异常!');
  981. console.log(error);
  982. });
  983. return false;
  984. });
  985.  
  986. $('body').on('click', '.115offline_batch', function() {
  987. var l = $('.115select:checked').length;
  988. if (l < 10 && !clickOne($('.115offline_batch'))) {
  989. return;
  990. } else if (l < 2 || l > 100) {
  991. toastr.warning('单次选中数量限 <span style="color:red;">2-99</span> 个。', '批量离线操作无效!', { timeOut: 6000 });
  992. return;
  993. } else if (l > 10) {
  994. toastr.info('所选中地址较多,服务器需要较长时间响应,请稍等10s以上,未弹出结果前勿重复点击。', '温馨提示。', { timeOut: 10000 });
  995. if (!clickOne($('.115offline_batch'), 10000)) return;
  996. }
  997.  
  998. var links = {};
  999. $('.115select:checked').each(function(e) {
  1000. links['url[' + e + ']'] = $(this).attr('value');
  1001. });
  1002.  
  1003. offline.getData(add_urls, links).then(function(json) {
  1004. console.log('批量离线任务添加结果:');
  1005. console.log(json);
  1006. var errNum = json.errcode || json.error_code || '';
  1007.  
  1008. if (json.state) {
  1009. var s = 0, e = 0, f = 0;
  1010. var success_result = [], exist_result = [], all_result = [], fail_result = [];
  1011. for (var n = 0; n < json.result.length; n++) {
  1012. var dataEl = json.result[n];
  1013. if (dataEl.state) {
  1014. s++;
  1015. success_result.push(dataEl);
  1016. all_result.push(dataEl);
  1017. } else if (dataEl.errcode == 10008) {
  1018. e++;
  1019. exist_result.push(dataEl);
  1020. all_result.push(dataEl);
  1021. } else {
  1022. f++;
  1023. fail_result.push(dataEl);
  1024. }
  1025. }
  1026.  
  1027. var txt2 = '10秒后显示离线结果。';
  1028. var error = fail_result.length > 0 ? fail_result[0].error_msg : '任务已存在';
  1029. if (f + e == json.result.length) {
  1030. var txt1 = `有 <span style="color:red;">${f + e}</span> 个任务创建失败,原因:${error}。`;
  1031. toastr.warning(txt1 + a_list, '批量离线任务添加失败。', { timeOut: 10000 });
  1032. } else if (f + e > 0) {
  1033. if (e > 0) txt2 = '新建任务' + txt2;
  1034. var txt1 = `有 <span style="color:purple;">${s}</span> 个任务创建成功。有 <span style="color:red;">${f + e}</span> 个任务创建失败,原因:${error}。`;
  1035. toastr.info(txt1 + txt2 + a_list, '批量离线任务添加成功。', { timeOut: 10000 });
  1036. } else {
  1037. var txt1 = `有 <span style="color:purple;">${s}</span> 个任务创建成功。`;
  1038. toastr.info(txt1 + txt2 + a_list, '批量离线任务添加成功。', { timeOut: 10000 });
  1039. }
  1040.  
  1041. var success_links = resultMark(success_result, 1);
  1042. var exist_links = resultMark(exist_result, 1);
  1043. resultMark(fail_result, 2);
  1044.  
  1045. if (s + e > 20) {
  1046. toastr.warning('离线数量大于20,请自行到115查看。' + a_list, '未查询离线结果!', { timeOut: 6000 });
  1047. return;
  1048. }
  1049.  
  1050. if (s > 0) {
  1051. setTimeout(function() {
  1052. for (let h = 0; h < s; h++) {
  1053. var one = (all_result[0].url == success_links[h]) ? false : true;
  1054. var url2 = [{'url': success_links[h]}];
  1055. offline.check(success_links[h], url2, one);
  1056. }
  1057. }, 10000);
  1058. }
  1059. if (e > 0) {
  1060. for (let i = 0; i < e; i++) {
  1061. var one = (all_result[0].url == exist_links[i]) ? false : true;
  1062. var url2 = [{'url': exist_links[i]}];
  1063. offline.check(exist_links[i], url2, one);
  1064. }
  1065. }
  1066.  
  1067. if (f != json.result.length && G.get('open_List')) {
  1068. setTimeout(function() {
  1069. GM_openInTab('https://115.com/?tab=offline&mode=wangpan', false);
  1070. }, 2000);
  1071. }
  1072. } else if (errNum == 911) {
  1073. toastr.warning('账号异常,请验证账号。', '批量离线下载失败!', { timeOut: 5000 });
  1074. setTimeout(function() {
  1075. verify();
  1076. }, 1000);
  1077. } else {
  1078. toastr.warning(json.error_msg + a_list, '批量离线任务添加失败!', { timeOut: 12000 });
  1079. }
  1080. }, function(error) {
  1081. toastr.error('服务器繁忙,请稍后再试。', '批量离线任务添加异常!');
  1082. console.log(error);
  1083. });
  1084. return false;
  1085. });
  1086.  
  1087. $('body').on('click', '.115select', function(e) {
  1088. if (e.shiftKey) {
  1089. var first = $('.115select').index($('.115select:checked').first());
  1090. var me = $('.115select').index($(this));
  1091. var last = $('.115select').index($('.115select:checked').last());
  1092. var Min = Math.min(first, me, last);
  1093. var Max = Math.max(first, me, last);
  1094.  
  1095. for (var i = Min; i <= Max; i++) {
  1096. $('.115select').eq(i).prop('checked', true);
  1097. }
  1098. }
  1099. });
  1100.  
  1101. $('body').on('click', '.openList:not([click="1"]), .openFolder:not([click="1"])', function() {
  1102. $(this).attr('click', '1');
  1103. if ($(this).is('.openList')) {
  1104. var txt = 'tab=offline';
  1105. } else {
  1106. var fID = $(this).attr('data');
  1107. var txt = 'cid=' + fID + '&offset=0';
  1108. }
  1109. GM_openInTab('https://115.com/?' + txt + '&mode=wangpan', false);
  1110. return false;
  1111. });
  1112.  
  1113. $('body').on('contextmenu', '.115offline, .115offline_batch', function(e) {
  1114. $('.115menu').css({ left: e.pageX + 'px', top: e.pageY + 'px' });
  1115. $('.115menu').show();
  1116. var link = $(this).data('href') || '';
  1117. if ($(this).is('.115offline_batch')) {
  1118. $('.115menu [class^="right_menu0"]').show();
  1119. $('.115menu [class^="right_menu1"]').hide();
  1120. } else if (/^magnet/i.test(link)) {
  1121. $('.115menu').attr('data-href', link);
  1122. $('.115menu [class^="right_menu1"]').show();
  1123. $('.115menu [class^="right_menu0"]').hide();
  1124. } else {
  1125. $('.115menu').hide();
  1126. GM_setClipboard(link);
  1127. toastr.success('下载地址复制成功!');
  1128. }
  1129. return false;
  1130. });
  1131.  
  1132. $('body').on('click', '[class^="right_menu0"]', function() {
  1133. if ($(this).is('.right_menu00')) {
  1134. $('.115select').prop('checked', true);
  1135. } else if ($(this).is('.right_menu01')) {
  1136. $('.115select').each(function() {
  1137. if ($(this).prop('checked')) {
  1138. $(this).prop('checked', false);
  1139. } else {
  1140. $(this).prop('checked', true);
  1141. }
  1142. });
  1143. } else {
  1144. if ($('.115select:checked').length == 0) {
  1145. toastr.warning('复制失败,未选中任何链接!');
  1146. return;
  1147. }
  1148. var urls = [];
  1149. $('.115select:checked').each(function() {
  1150. urls.push($(this).attr('value'));
  1151. });
  1152. GM_setClipboard(urls.join('\r\n'));
  1153. toastr.success(urls.length + ' 个下载地址复制成功!');
  1154. }
  1155. return false;
  1156. });
  1157.  
  1158. $('body').on('click', '[class^="right_menu1"]', function() {
  1159. var link = $(this).parents('.115menu').data('href');
  1160. var hash = link.match(/[a-f0-9]{40}/i)[0].toUpperCase();
  1161. if ($(this).is('.right_menu11')) {
  1162. GM_setClipboard(link);
  1163. toastr.success('下载地址复制成功!');
  1164. } else if ($(this).is('.right_menu12')) {
  1165. GM_openInTab(`https://itorrents.org/torrent/${hash}.torrent`, false);
  1166. } else if ($(this).is('.right_menu13')) {
  1167. GM_openInTab(`https://btcache.me/torrent/${hash}`, false);
  1168. }
  1169. return false;
  1170. });
  1171.  
  1172. if (G.get('offline_Down') && localHref.indexOf('115.com') == -1) {
  1173. if (localHref.match(/[0-9]mag\.net|yuhuage/) != null) {
  1174. right_menu();
  1175. var time1 = setInterval(function() {
  1176. offline.addButton();
  1177. if ($('.115offline').length >= 20) {
  1178. clearInterval(time1);
  1179. }
  1180. }, 500);
  1181. setTimeout(function() {
  1182. offline.addSelect();
  1183. $('.mag1').remove();
  1184. clearInterval(time1);
  1185. }, 5000);
  1186. } else if (localHref.match(/www\.gying\./) != null) {
  1187. right_menu();
  1188. if (localHref.match(/\/bt\//) != null) {
  1189. setTimeout(function() {
  1190. offline.addLink();
  1191. offline.addSelect();
  1192. }, 500);
  1193. } else {
  1194. var time2 = setInterval(function() {
  1195. if ($('.torrent').length > 0) {
  1196. offline.addButton();
  1197. offline.addSelect();
  1198. clearInterval(time2);
  1199. }
  1200. if ($('.torrent').length == 0) {
  1201. clearInterval(time2);
  1202. }
  1203. }, 1500);
  1204. }
  1205. } else {
  1206. var time3 = 300;
  1207. if (localHref.match(/av/) != null) {
  1208. time3 = 3000;
  1209. }
  1210. setTimeout(function() {
  1211. offline.addButton();
  1212. if (localHref.match(/av/) != null) {
  1213. $('.movie td').removeAttr('onclick');
  1214. }
  1215. }, time3);
  1216. if (G.get('fuzzy_find')) {
  1217. setTimeout(function() {
  1218. offline.addLink();
  1219. }, time3 + 10);
  1220. }
  1221. setTimeout(function() {
  1222. right_menu();
  1223. offline.addSelect();
  1224. $('.mag1').remove();
  1225. }, time3 + 20);
  1226. }
  1227. }
  1228. });
  1229. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址