Greasy Fork is available in English.

网盘自动填写访问码【威力加强版】

智能融合网盘密码到网址中,打开网盘链接时不再需要手动复制密码,并自动提交密码,一路畅通无阻。同时记录网盘信息,当你再次打开该分享文件时,不再需要去找提取码,同时可追溯网盘地址的来源。

Від 24.09.2024. Дивіться остання версія.

  1. // ==UserScript==
  2. // @name 网盘自动填写访问码【威力加强版】
  3. // @description 智能融合网盘密码到网址中,打开网盘链接时不再需要手动复制密码,并自动提交密码,一路畅通无阻。同时记录网盘信息,当你再次打开该分享文件时,不再需要去找提取码,同时可追溯网盘地址的来源。
  4. // @author 极品小猫
  5. // @namespace https://greasyfork.org/zh-CN/users/3128
  6. // @version 3.24.40
  7. //
  8. // @include http://*
  9. // @include https://*
  10. //
  11. // @exclude https://*.12315.cn
  12. // @exclude http*://*.pcs.baidu.com/*
  13. // @exclude http*://*.baidupcs.com/*
  14. // @exclude http*://*:8666/file/*
  15. // @exclude http*://*.baidu.com/file/*
  16. // @exclude http*://index.baidu.com/*
  17. //
  18. // @exclude http*://*.gov/*
  19. // @exclude http*://*.gov.cn/*
  20. // @exclude http*://*.taobao.com/*
  21. // @exclude http*://*.tmall.com/*
  22. // @exclude http*://*.alimama.com/*
  23. // @exclude http*://*.jd.com/*
  24. // @exclude http*://*.zol.com.cn/*
  25. // @exclude http*://*.ctrip.com/*
  26. // @exclude http*://*.evernote.com/*
  27. // @exclude http*://*.yinxiang.com/*
  28. // @exclude http*://mail.*
  29. // @exclude http*://ping.*
  30. // @exclude http*://whois.*
  31. // @exclude http*://inbox.google.com/*
  32. // @exclude https://www.12377.cn/*
  33. // @exclude /^https?://(localhost|10\.|192\.|127\.)/
  34. // @exclude /https?://www.baidu.com/(?:s|baidu)\?/
  35. // @exclude http*://www.zhihu.com/question/*/answers/created
  36. // @exclude https://caiyun.feixin.10086.cn/portal/index.jsp#myfile*
  37. // @require https://bowercdn.net/c/jquery-2.1.4/dist/jquery.min.js
  38. // @require https://greasyfork.org/scripts/35940-my-jquery-plugin/code/My%20jQuery%20Plugin.js?version=234478
  39. // @supportURL https://scriptcat.org/script-show-page/373/issue
  40. // @homepage https://scriptcat.org/users/46868
  41. // @icon https://nd-static.bdstatic.com/m-static/wp-brand/favicon.ico
  42.  
  43. // @connect agefans.tv
  44. // @grant unsafeWindow
  45. // @grant GM_setValue
  46. // @grant GM_getValue
  47. // @grant GM_deleteValue
  48. // @grant GM_listValues
  49. // @grant GM_addStyle
  50. // @grant GM_xmlhttpRequest
  51. // @grant GM_notification
  52. // @grant GM_registerMenuCommand
  53. // @grant GM_info
  54. // @noframes
  55. // @encoding utf-8
  56. // @run-at document-idle
  57. // @license GPL-3.0 License
  58. // ==/UserScript==
  59.  
  60. (function(){
  61. /* globals $ */
  62. 'use strict';
  63. let urls=location.href,
  64. hash=location.hash,
  65. host=location.hostname.replace(/^(?:www|pan)\.(?!baidu.com|xunlei.com)/i,'').replace(/([^.]+)\.(?=lanzou[a-z]?.com|ctfile.com)/,'').replace(/share\.(115.com)/i,'$1').toLowerCase(),
  66. hosts=location.hostname.toLowerCase(),
  67. search=location.search,
  68. paths=location.pathname.toLowerCase(),
  69. Control_newTag=true, // 网盘链接添加以新页面打开属性
  70. u=unsafeWindow,
  71. msgControl=false; //信息日志关闭开关
  72.  
  73. //蓝奏云域名预处理
  74. host=host.replace(/^\w+\.(?=lanzou)/,'').replace(/(?<=lanzou)[a-z]?/i,'').replace(/^\w+\.(?=lanzn)/,'');
  75. host=host.replace(/\w+\.(?=ctfile.com)/, '');
  76.  
  77. //管理功能开关 & 设置
  78. let CatPW_Manage_Config, // 管理功能配置,采用 GM_setValue API进行保存,非 localStorage
  79. StorageSave, // 信息记录功能,localStorage 记录密码开关
  80. StorageExp, // localStorage 记录密码的有效期(天数)
  81. UpdataConfig={
  82. UpdataSave:true, // 再次访问该网盘地址时,更新信息
  83. UpdataNotify:true, // 更新该网盘地址时,发出桌面通知
  84. UpdataPlugin:true, // 脚本更新后,发出桌面通知
  85. };
  86.  
  87. if(typeof(GM_getValue('CatPW_Manage'))==='undefined') {
  88. CatPW_Manage_Config={'StorageSave':true,'UpdataConfig':UpdataConfig,'StorageExp':365};
  89. GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  90. } else {
  91. CatPW_Manage_Config=GM_getValue('CatPW_Manage');
  92. if(!CatPW_Manage_Config.UpdataConfig) {
  93. CatPW_Manage_Config.UpdataConfig=UpdataConfig;
  94. GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  95. }
  96. }
  97.  
  98. StorageSave=CatPW_Manage_Config.StorageSave;
  99. StorageExp=CatPW_Manage_Config.StorageExp;
  100. UpdataConfig=CatPW_Manage_Config.UpdataConfig;
  101.  
  102. let Cat = {
  103. changelog : `
  104. 【修复】脚本图标
  105. 【增加】蓝奏网盘 lanzo.com 域名支持
  106. 【优化】停止使用 GM.info 接口,以便于兼容Via等其它手机浏览器。
  107. 【优化】脚本更新内容提示逻辑。
  108. 【优化】网盘密码识别策略,增加已融合提取码纠错。
  109. 【增加】新的融合方法,支持【选中提取码】文本点击网盘链接,优先融合选定的提取码。
  110. 【修复】迅雷网盘移动端页面不会自动提交问题。
  111. 【特殊支持】密码融合,异星软件空间(yxssp.com
  112. `,
  113. UpdataPlugin : function(e){
  114. console.log(this);
  115. //插件更新提示
  116. if(this.changelog!==UpdataConfig.changelog) {
  117. GM_notification({
  118. 'title' : '网盘自动填写访问码 - 更新日志',
  119. 'text' : `更详细的更新信息,请点击通知查看`,
  120. 'image' : `https://nd-static.bdstatic.com/m-static/wp-brand/favicon.ico`,
  121. 'timeout' : 60*1000,
  122. 'onclick' : function(e){
  123. alert(`更新日志详细${Cat.changelog}`);
  124. }
  125. });
  126. CatPW_Manage_Config.UpdataConfig.changelog=this.changelog;
  127. GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  128. }
  129. },
  130. init : function(){
  131. this.UpdataPlugin();//更新提示
  132. }
  133. };
  134. Cat.init();
  135.  
  136. var site = {
  137. 'pwdRule' : /(?:提取|访问)[码碼]?\s*[::﹕ ]?\s*([a-z\d]{4})/, //常规密码
  138. 'codeRule' : /(?:(?:提取|访问|(?<!解压)密[码碼]|艾|Extracted-code)[码碼]?)\s*[::﹕ ]?\s*([a-z\d]{4})/i, //其它类型的访问密码
  139. 'codeRuleBorder' : /(?:(?:提取|访问|(?<!解压)密[码碼]|艾|Extracted-code)[码碼]?)\s*[::﹕ ]?\s*([a-z\d]{4,8})[\))]/i, //其它类型的访问密码
  140. 'YunDisk':{
  141. 'pan.baidu.com':{
  142. exclude : /\/disk\//i,
  143. CodeParam: 'pwd',
  144. surl : function(){
  145. if(getQueryString('surl')) return getQueryString('surl');
  146. else if(yunData.LRURPVSDB) return yunData.LRURPVSDB.replace(/%26%2Fs%2F.+/,'');
  147. else return location.pathname.replace('/s/1','').replace(/#.+/,'');
  148. },
  149. chk : /^[a-z0-9]{4}$/,
  150. code : '.pickpw input, #accessCode, [placeholder="请输入提取码"]',
  151. btn : '.g-button, #submitBtn, #getfileBtn, .m-button-big',
  152. PreProcess: function() { //预处理
  153. console.group('===== 百度网盘自动填写密码 Begin =====');
  154. if(!/mobile/i.test(navigator.userAgent)) {
  155. let CatPW_BaiduPan={
  156. CatPW_Manage : function(){
  157. let CatPW_Manage_Menu_Fn = {
  158. infoFn : function(e){ //信息记录功能
  159. StorageSave=CatPW_Manage_Config.StorageSave=StorageSave?!confirm('你已开启“信息记录功能”,是否需要关闭?'):confirm('你已关闭“信息记录功能”,是否需要开启?');
  160. $(this).text(StorageSave?'已开启信息记录功能':'已关闭信息记录功能');
  161. CatPW_Manage_Menu_Fn.save();
  162. CatPW_BaiduPan.ShowInfo();
  163. },
  164. UpdataConfigFn : {
  165. UpdataSave : function(e){
  166. UpdataConfig.UpdataSave=CatPW_Manage_Config.UpdataConfig.UpdataSave=UpdataConfig.UpdataSave?!confirm('你已开启“信息记录更新功能”,是否需要关闭?'):confirm('你已关闭“信息记录更新功能”,是否需要开启?');
  167. $(this).text(UpdataConfig.UpdataSave?'已开启记录更新功能':'已关闭记录更新功能');
  168. CatPW_Manage_Menu_Fn.save();
  169. },
  170. UpdataNotify : function(e){
  171. UpdataConfig.UpdataNotify=CatPW_Manage_Config.UpdataConfig.UpdataNotify=UpdataConfig.UpdataNotify?!confirm('你已开启“信息记录更新桌面通知功能”,是否需要关闭?'):confirm('你已关闭“信息记录更新桌面通知功能”,是否需要开启?');
  172. $(this).text(UpdataConfig.UpdataNotify?'已开启更新桌面通知':'已关闭更新桌面通知');
  173. CatPW_Manage_Menu_Fn.save();
  174. },
  175. UpdataPlugin : function(e){
  176. UpdataConfig.UpdataPlugin=CatPW_Manage_Config.UpdataConfig.UpdataPlugin=UpdataConfig.UpdataPlugin?!confirm('你已开启“脚本更新桌面通知功能”,是否需要关闭?'):confirm('你已关闭“脚本更新桌面通知功能”,是否需要开启?');
  177. $(this).text(UpdataConfig.UpdataPlugin?'脚本更新桌面通知':'脚本更新不通知');
  178. CatPW_Manage_Menu_Fn.save();
  179. },
  180. MessageUI : function(e){
  181. UpdataConfig.MessageUI=CatPW_Manage_Config.UpdataConfig.MessageUI=UpdataConfig.MessageUI?!confirm('你已开启“网页嵌入式的网盘信息”,是否切换为“顶部浮动式的网盘信息”?'):confirm('你已开启“网页嵌入式的网盘信息”,是否切换为“浮动窗式的网盘信息”?');
  182. $(this).text(UpdataConfig.MessageUI?'切换为浮动式网盘信息':'切换为嵌入式网盘信息');
  183. CatPW_Manage_Menu_Fn.save();
  184. location.reload();
  185. }
  186. },
  187. Exp : function(e){
  188. var _StorageExpTemp;
  189. do{
  190. _StorageExpTemp=prompt("设置信息保存时间(天数):", _StorageExpTemp||StorageExp)||_StorageExpTemp||StorageExp;
  191. if(!/^\d+$/.test(_StorageExpTemp)) {
  192. alert('所设置的天数不是数字,请重新设置');
  193. }
  194. else break;
  195. } while(!/^\d+$/.test(_StorageExpTemp));
  196. StorageExp=CatPW_Manage_Config.StorageExp=_StorageExpTemp;
  197. $(this).text('信息保存时间:'+_StorageExpTemp+'天');
  198. CatPW_Manage_Menu_Fn.save();
  199. },
  200. CleanInfo : function(e){
  201. var _CleanInfo=confirm("如果所记录的信息并没有及时更新,可通过该功能清除记录。");
  202. if(_CleanInfo) GM_setValue('CatPW', {});
  203. },
  204. save : function(){
  205. GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  206. }
  207. };
  208. let CatPW_Manage_Main=$('<span style="margin: 0px;">').attr({'class':'g-dropdown-button'})//.css({'width':'140px','position':'absolute','left':'-145px'});
  209. let CatPW_Manage_A=$('<a>').attr({'class':'g-button','data-button-id':'b300','data-button-index':'300','href':'javascript:void(0);'});
  210. let CatPW_Manage_A_span=$('<span class="g-button-right">');
  211. let CatPW_Manage_A_span_span=$('<span class="text">').text('密码填写管理');
  212. let CatPW_Manage_Menu=$('<span class="menu" style="width:auto;z-index:41;">');
  213. let CatPW_Manage_Menu_infoFn=$('<A class="g-button-menu" href="javascript:void(0);">').text(StorageSave?'已开启信息记录功能':'已关闭信息记录功能').attr({'data-menu-id':'b-menu307'}).click(CatPW_Manage_Menu_Fn.infoFn);
  214. let CatPW_Manage_Menu_Exp=$('<A class="g-button-menu" href="javascript:void(0);">').text('信息保存时间:'+StorageExp+'天').attr({'data-menu-id':'b-menu308'}).click(CatPW_Manage_Menu_Fn.Exp);
  215. let CatPW_Manage_Menu_CleanInfo=$('<A class="g-button-menu" href="javascript:void(0);">').text('清除缓存记录信息').attr({'data-menu-id':'b-menu309'}).click(CatPW_Manage_Menu_Fn.CleanInfo);
  216. let CatPW_Manage_Menu_UpdataSave=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataSave?'已开启记录更新功能':'已关闭记录更新功能').attr({'data-menu-id':'b-menu310'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataSave);
  217. let CatPW_Manage_Menu_UpdataNotify=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataNotify?'已开启网盘信息通知':'已关闭网盘信息通知').attr({'data-menu-id':'b-menu311'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataNotify);
  218. let CatPW_Manage_Menu_UpdataPlugin=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.UpdataPlugin?'已开启脚本更新通知':'已关闭脚本更新通知').attr({'data-menu-id':'b-menu313'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.UpdataPlugin);
  219. let CatPW_Manage_Menu_MessageUI=$('<A class="g-button-menu" href="javascript:void(0);">').text(UpdataConfig.MessageUI?'切换为浮动式网盘信息':'切换为嵌入式网盘信息').attr({'data-menu-id':'b-menu314'}).click(CatPW_Manage_Menu_Fn.UpdataConfigFn.MessageUI);
  220.  
  221.  
  222. CatPW_Manage_A.append(CatPW_Manage_A_span);
  223. CatPW_Manage_A_span.append(CatPW_Manage_A_span_span);
  224. CatPW_Manage_Menu.append(CatPW_Manage_Menu_infoFn, CatPW_Manage_Menu_Exp, CatPW_Manage_Menu_CleanInfo, '<hr>', CatPW_Manage_Menu_UpdataSave, CatPW_Manage_Menu_UpdataNotify, CatPW_Manage_Menu_UpdataPlugin, CatPW_Manage_Menu_MessageUI);
  225. CatPW_Manage_Main.insertBefore('.x-button-box>.g-button.tools-share-save-hb');
  226.  
  227. CatPW_Manage_Main.append(CatPW_Manage_A).append(CatPW_Manage_Menu).hover(function(){
  228. CatPW_Manage_Main.toggleClass('button-open');
  229. });
  230. //GM_addStyle('.slide-show-right{width:650px!important;}');
  231. },
  232. ShowInfo : function(){
  233. //显示信息记录
  234. var CatPW_Info_Display=$('#CatPW_Info').css('display');
  235. if(CatPW_Info_Display) {
  236. if(CatPW_Info_Display=='none') $('#CatPW_Info').css('display','block');
  237. else $('#CatPW_Info').css('display','none');
  238. } else if(StorageSave){
  239. //插入信息记录
  240. var yunData=unsafeWindow.yunData, //取得 yunData 数据
  241. CatPW,
  242. CatPW_Format={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'surl':'', 'Hash':'', "webSrc":'', "webTitle":''}; //初始化信息记录变量
  243. yunData.surl=getQueryString('surl')||location.pathname.replace('/s/1','').replace(/#.+/,''); //获取当前的分享ID,并添加到 yunData 中
  244. yunData.Src=getQueryString('Src')||location.href.replace(location.search,'');
  245. //初始化 getValue 数据
  246. if(typeof(GM_getValue('CatPW'))==='undefined') {
  247. if(StorageDB('Share_'+yunData.surl).read()) GM_setValue('CatPW', StorageDB('Share_'+yunData.surl).read());
  248. else GM_setValue('CatPW', CatPW_Format); //初始化
  249. }
  250. var isCatPW=GM_getValue('CatPW').Src.search(yunData.surl)>0; //检查当前网盘地址是否与记录匹配
  251. var isCatPW_DB=StorageDB('Share_'+yunData.surl).read();
  252. CatPW=isCatPW?GM_getValue('CatPW'):isCatPW_DB?isCatPW_DB:CatPW_Format; //取得信息记录
  253. CatPW.Src=urls.replace(hash,'');
  254. CatPW.surl='Share_'+yunData.surl; //获取 分享文件surl
  255. CatPW.unPW=decodeURIComponent(CatPW.unPW);
  256. CatPW.webSrc=decodeURIComponent(CatPW.webSrc);
  257. CatPW.webTitle=decodeURIComponent(CatPW.webTitle);
  258. CatPW.sCode=CatPW.sCode||(CatPW.Hash?CatPW.Hash.replace('#',''):/^#/.test(hash)&&!/^#list\/path=/i.test(hash)?hash.match(/^#([^&]+)&?/)[1]:''); //获取 提取码
  259. if(!localStorage[CatPW.surl]) { //当不存在记录时,收集信息
  260. msg('不存在记录,插入信息', 'Src:'+CatPW.Src, 'surl:'+yunData.surl, CatPW);
  261. if(CatPW.Src.search(yunData.surl)<0) {//新记录中的网盘地址与当前的分享ID不一致时,更新信息记录变量
  262. CatPW.Src=urls.replace(hash,'');
  263. CatPW.Hash=hash;
  264. CatPW.sCode=CatPW.sCode;
  265. CatPW.unPW=CatPW.webTitle=CatPW.webSrc=''; //当前网址与记录的信息不符时,只保留密码信息
  266. }
  267.  
  268. CatPW.ShareUK=yunData.SHARE_UK; //获取 分享用户ID
  269. CatPW.ShareID=yunData.SHARE_ID; //获取 分享文件ID
  270. StorageDB(CatPW.surl).insert(CatPW);
  271. }
  272.  
  273. else if(UpdataConfig.UpdataSave && localStorage[CatPW.surl] &&//是否已开启网盘信息记录更新,是否存在缓存
  274. CatPW.Src.search(StorageDB(CatPW.surl).read().surl.replace('Share_',''))>0)//从检测缓存中的分享ID是否与记录中的分享ID匹配
  275. {
  276. var CatPW_StorageDB=StorageDB(CatPW.surl).read();
  277. if(decodeURIComponent(CatPW.webSrc)!==decodeURIComponent(CatPW_StorageDB.webSrc)) {
  278. CatPW_StorageDB.webSrc=decodeURIComponent(CatPW.webSrc);
  279. CatPW_StorageDB.webTitle=decodeURIComponent(CatPW.webTitle);
  280. StorageDB(CatPW.surl).insert(CatPW_StorageDB);
  281. if(UpdataConfig.UpdataNotify) GM_notification({
  282. 'text':'网盘地址来源与上一次记录不同,记录已更新',
  283. 'title':'网盘信息记录更新通知',
  284. 'image':'https://nd-static.bdstatic.com/m-static/wp-brand/favicon.ico',
  285. 'timeout': 1.5*1000
  286. });
  287. }
  288. } else {//直接载入记录
  289. msg('载入 locatStorage 记录');
  290. CatPW=StorageDB(CatPW.surl||yunData.SHARE_ID||getQueryString('shareid')).read();
  291. }
  292.  
  293. msg('分享文件ID:', CatPW.surl, '提取码:', StorageDB(CatPW.surl).find('sCode'));
  294. msg('已收集的信息:', 'conf:', conf, 'localStorage CatPW:', CatPW, 'GM CatPW: ', GM_getValue('CatPW'));
  295.  
  296.  
  297. $(conf.btn).on('mouseup', function(e){ //百度网盘访问码提交事件,提交密码时
  298. var $code=$(conf.code).val().trim();
  299. if($code.search(/\*/)>0) return false;
  300. if($code!=='' && !CatPW.sCode){
  301. CatPW.sCode=$code;
  302. }
  303.  
  304. var tips=$('form[name="accessForm"]~div[style*="display: block"]');
  305. tips.text('')
  306. //提取码提交click事件
  307. if(!localStorage[CatPW.surl]) {
  308. //不存在记录时,添加新纪录
  309. StorageDB(CatPW.surl).insert(CatPW);//插入记录
  310. StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  311. } else if(!StorageDB(CatPW.surl).find('sCode')) {
  312. //不存在提取码信息时,重新获取提取码
  313. StorageDB(CatPW.surl).insert(CatPW);//插入记录
  314. StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  315. } else if($code!==StorageDB(CatPW.surl).find('sCode')&&(tips.text()==='')){
  316. //已记录的提取码与填写的提取码不一致时,更新提取码记录
  317. StorageDB(CatPW.surl).add('sCode', CatPW.sCode);//更新提取码记录
  318. StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  319. }
  320. });
  321.  
  322. //当存在解压密码时,插入新纪录
  323. if(CatPW.unPW&&!localStorage[CatPW.surl]){
  324. StorageDB(CatPW.surl).insert(CatPW);
  325. StorageDB('ShareIDexp').add(CatPW.surl,{'date':Dates(),'id':CatPW.surl,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  326. }
  327.  
  328. //显示记录的信息
  329. if('Share_'+yunData.surl==CatPW.surl && localStorage[CatPW.surl]){
  330. let baiduPan_API={
  331. //API: require('system-core:context/context.js').instanceForSystem.list.getCurrentList(),
  332. //server_Filename: i => {return baiduPan_API.API[i||0].server_filename;}
  333. }
  334.  
  335. let CatPW_Data={
  336. //FileName: $('<span>').text('FileName:').append($('<span>').text(baiduPan_API.server_Filename()))
  337. }
  338.  
  339. var CatPW_Info=$('<DIV>').attr('id','CatPW_Info').text('提取码:'+CatPW.sCode+'  '+'解压密码:');
  340. //解压密码
  341. var CatPW_Info_unPW=$('<input>').attr({'id':'unPW','title':'点击复制密码,修改内容将被保存'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(CatPW.unPW).change(function(){
  342. StorageDB(CatPW.surl).add('unPW',encodeURIComponent(this.value));
  343. CatPW.unPW=encodeURIComponent(this.value);
  344. GM_setValue('CatPW', CatPW);
  345. }).click(function(){
  346. document.execCommand("SelectAll");document.execCommand("copy");
  347. });
  348.  
  349.  
  350.  
  351. //来源页面:
  352. var CatPW_Info_delBtn=$('<button>').text('删除记录').val('删除记录').click(function(){
  353. delete localStorage[CatPW.surl];
  354. StorageDB('ShareIDexp').del(CatPW.surl);
  355. GM_setValue('CatPW', CatPW_Format);
  356. this.disabled=true;
  357. });
  358.  
  359. var CatPW_Info_WebTitle=$('<span>').attr({'id':'CatPW_webTitle'}).text('网页标题:'+CatPW.webTitle);
  360. var CatPW_Info_WebSrc=$('<A>').attr({'id':'CatPW_webSrc','href':CatPW.webSrc,'target':'_blank'}).text('网盘来源:'+CatPW.webSrc);
  361. GM_addStyle(`
  362. #CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}
  363. #CatPW_Info > span {margin-left:20px;}
  364. button[value="删除记录"][disabled] {background:#aaa;}
  365.  
  366. `);
  367.  
  368. CatPW_Info.append(CatPW_Info_unPW, CatPW_Info_delBtn, /*CatPW_Data.FileName,*/ '<br>', CatPW_Info_WebTitle, '<br>', CatPW_Info_WebSrc);
  369. UpdataConfig.MessageUI?CatPW_Info.insertBefore('.module-share-header'):Fn_MessageUI(CatPW_Info);
  370. }
  371.  
  372. StorageDB('ShareIDexp').deleteExpires();
  373.  
  374. }
  375. },
  376. init : function(){
  377. if(document.querySelector('.verify-input') && !CatPW_Manage_Config?.Tips_BaiduUse) {
  378. let Tips_BaiduUse=$('<div id="Tips_BaiduUse"><span style="color:red">网盘自动填写访问码</span>是一款点击网页链接时,帮你自动融合填写网站上提供的“访问密码”的免费工具。因隐私安全原因,“不支持未知访问码”的自动填写,详细请<a href="https://scriptcat.org/script-show-page/373" target="_blank">阅读脚本使用说明</a>。</div>'),
  379. Tips_BaiduUseClose=$('<button>').text("不再提示").click(()=>{
  380. CatPW_Manage_Config.Tips_BaiduUse=true;
  381. GM_setValue('CatPW_Manage', CatPW_Manage_Config);
  382. Tips_BaiduUse.hide();
  383. });
  384.  
  385. $('.verify-input').prepend(Tips_BaiduUse.append(Tips_BaiduUseClose));
  386. }
  387. if(u.currentSekey) {
  388. this.CatPW_Manage();
  389. this.ShowInfo();
  390. }
  391. }
  392. };
  393. CatPW_BaiduPan.init();
  394. }
  395. console.groupEnd();
  396. },
  397. preSubmit : function(codebox, cdoebtn, sCode){
  398. //百度网盘,手机版页面提交方法
  399. if(!document.querySelector("#init-new")) {
  400. let CodeInput=$('input', '.extract-content');
  401. CodeInput.val(sCode);
  402. CodeInput.get(0).dispatchEvent(new InputEvent("input"));
  403. setTimeout(function(){
  404. $(cdoebtn).click();
  405. }, 1000);
  406. }
  407. }
  408. },
  409. 'eyun.baidu.com': {
  410. chk: /^[a-z0-9]{4}$/,
  411. code: '.share-access-code',
  412. btn: '.g-button-right',
  413. pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,14})/,
  414. codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,14})/i,
  415. PreProcess: function() {
  416. if((hash&&!/sharelink|path/i.test(hash))&&!/enterprise/.test(paths)) {
  417. location.href=location.href.replace(location.hash,'');
  418. }
  419. conf.ShareUK=yunData.SHARE_UK||getQueryString('uk'); //获取 分享用户ID
  420. conf.ShareID=yunData.SHARE_ID||getQueryString('cid'); //获取 分享文件ID
  421. conf.sCode=/^#/.test(hash)?hash.match(/^#(\w+)&?/)[1]:StorageDB(conf.ShareID).find('sCode'); //获取 提取码
  422. $(conf.btn).click(function(){
  423. if(!localStorage[conf.ShareID]&&conf.sCode) {
  424. StorageDB(conf.ShareID).insert({'sCode':conf.sCode});
  425. StorageDB('ShareIDexp').add(conf.ShareID,{'id':conf.ShareID,'exp':$.now()+StorageExp*24*60*60*1000}); //记录超时时间
  426. }
  427. });
  428. StorageDB('ShareIDexp').deleteExpires();
  429. }
  430. },
  431. 'yunpan.360.cn':{
  432. chk : /^[a-z0-9]{4,8}$/,
  433. code : '.pwd-input',
  434. btn : '.submit-btn'
  435. },
  436. 'lanzou.com':{
  437. chk : /^[a-z0-9]{4,8}$/,
  438. code : '#pwd',
  439. btn : '#sub, .passwddiv-btn',
  440. pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,6})/,
  441. codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,6})/i,
  442. IntervalSubmit : true,
  443. PreProcess : function(){
  444. //蓝凑云,手机版页面提交方法
  445. console.log('蓝奏云WAP页面提交')
  446. let tp=document.querySelector('[href^="/tp/"]');
  447. if(tp) {
  448. tp.hash=location.hash;
  449. tp.target="";
  450. }
  451. },
  452. preSubmit : function(codebox, cdoebtn, sCode){
  453. console.log(`蓝凑云预定义方法提交`)
  454. $('.ifr2').contents().find(codebox).val(sCode);
  455. $('.ifr2').contents().find(cdoebtn).click();
  456. },
  457. HostRule: /lanzou[a-z].com/i
  458. },
  459. '115.com': {
  460. chk : /^[a-z0-9]{4,8}$/,
  461. CodeParam: 'password',
  462. code : '.form-item input[placeholder="请输入访问码"]',
  463. btn : '.form-decode>.submit>a[btn="confirm"]',
  464. IntervalSubmit : true
  465. },
  466. 'share.weiyun.com': {
  467. chk: /^[a-z0-9]{6}$/i,
  468. code: '.input-txt',
  469. btn: '.btn.btn-l.btn-main',
  470. pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,6})/,
  471. codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,6})/i,
  472. IntervalSubmit : true
  473. },
  474. 'caiyun.feixin.10086.cn' : {
  475. chk: /^[a-z0-9]{4}$/i,
  476. code: '.lookOutLink_tq_input>input[type="text"]',
  477. btn: '#linkPassEnter',
  478. preSubmit : function(codebox, cdoebtn, sCode){
  479. setTimeout(function(){
  480. $(cdoebtn).click();
  481. }, 1000);
  482. }
  483. },
  484. 'ctfile.com':{
  485. code : '#passcode',
  486. btn : '[onclick="verify_passcode()"]',
  487. IntervalSubmit : true
  488. },
  489. 'dufile.com':{
  490. PreProcess: function(){
  491. if(/\/down\//.test(location.pathname)) {
  492. var hiddenProperty = 'hidden' in document ? 'hidden' :
  493. 'webkitHidden' in document ? 'webkitHidden' :
  494. 'mozHidden' in document ? 'mozHidden' :
  495. null;
  496. var visibilityChangeEvent = hiddenProperty.replace(/hidden/i, 'visibilitychange');
  497. var onVisibilityChange = function(){
  498. if (!document[hiddenProperty]) {
  499. document.title='被发现啦(*´∇`*) 快来输验证码!';
  500. } else {
  501. alert('DuFile 快来输验证码!');
  502. }
  503. }
  504. document.addEventListener(visibilityChangeEvent, onVisibilityChange);
  505. }
  506. }
  507. },
  508. 'fxpan.com':{
  509. PreProcess:function(){
  510. var Key=$('#key').val(); //文件分享ID
  511.  
  512. var CatPW={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'Hash':'', "webSrc":'', "webTitle":''};
  513. var CatPW_Data=(GM_getValue('CatPW')!=('undefined')||GM_getValue('CatPW')!==undefined)?GM_getValue('CatPW'):GM_setValue('CatPW',CatPW);
  514.  
  515. if(CatPW_Data['webSrc'].search(Key)>-1) {
  516. var $CatPW_Info=$('<DIV>').attr('id','CatPW_Info');
  517. var $CatPW_Info_unPW=$('<div>').text('解压密码:').append($('<input>').attr({'id':'unPW','title':'点击复制密码'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(decodeURIComponent(CatPW_Data.unPW)).click(function(){document.execCommand("SelectAll");document.execCommand("copy");}));
  518. var $CatPW_Info_title=$('<span>').attr({'id':'CatPW_webTitle'}).text('网页标题:'+decodeURIComponent(CatPW_Data.webTitle));
  519. var $CatPW_Info_webSrc=$('<A>').attr({'id':'CatPW_webSrc','href':decodeURIComponent(CatPW_Data.webSrc),'target':'_blank'}).text('网盘来源:'+decodeURIComponent(CatPW_Data.webSrc));
  520. $CatPW_Info.append($CatPW_Info_unPW, '<br>', $CatPW_Info_title,'<br>', $CatPW_Info_webSrc).insertBefore('.file_item.file_desc');
  521. $('.ysbtn').click(function(){
  522. StorageDB(Key).insert(CatPW_Data);
  523. StorageDB().insert(CatPW_Data);
  524. });
  525. }
  526. GM_addStyle('#CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}');
  527. }
  528. },
  529. 'cloud.189.cn':{
  530. chk: /^[a-z0-9]{4}$/i,
  531. code: '#code_txt',
  532. btn: '.btn.btn-primary, .button',
  533. IntervalSubmit : true
  534. },
  535. 'h5.cloud.189.cn':{
  536. code: '.access-code-input',
  537. btn: '.button',
  538. sCode: 'CacheCode',
  539. IntervalSubmit : true
  540. },
  541. 'own-cloud.cn':{
  542. chk: /^[a-z0-9]{4,6}$/i,
  543. pwdRule : /(?:提取|访问)[码碼]?\s*[:: ]?\s*([a-z\d]{4,6})/,
  544. codeRule : /(?:(?:提取|访问|密[码碼]|Extracted-code)[码碼]?)\s*[:: ]?\s*([a-z\d]{4,6})/i,
  545. code:'#inputPassword',
  546. btn:'#submit_pwd'
  547. },
  548. 'pan.xunlei.com': {
  549. chk: /^[a-z0-9]{4}$/i,
  550. code : '[class="td-input__inner"]',
  551. btn : '#__nuxt .td-button',
  552. IntervalSubmit : true
  553. },
  554. 'aliyundrive.com' : {
  555. chk: /^[a-z0-9]{4}$/i,
  556. code : '.ant-input:not(.ant-input-borderless)',
  557. btn : '.button--fep7l',
  558. IntervalSubmit: true,
  559. },
  560. 'jianguoyun.com': {chk: /^\w{4,8}$/i, code : '#access-pwd', btn : '.action-button.ok-button'},
  561. '123pan.com': {
  562. chk: /^\w{4,8}$/i,
  563. code : '.ant-input',
  564. btn : '.ant-input~button, .ca-fot>button',
  565. //IntervalSubmit: true, 采用ajax模拟请求方式访问
  566. preSubmit : function(codebox, cdoebtn, sCode){
  567. let shareKey=location.pathname.replace('/s/', '').replace(/\.html$/i,''), SharePwd=sCode;
  568. localStorage['shareKey']=`"${shareKey}"`;
  569. localStorage['SharePwd']=`"${sCode}"`;
  570. //$.cookie('shareKey', shareKey);
  571. //$.cookie('SharePwd', SharePwd);
  572. //模拟发送获取文件列表请求,以确认是否登录成功
  573. let post_data=$.param({Limit: 100, next: 0, shareKey: shareKey, SharePwd: sCode, orderBy: 'share_id', orderDirection: 'desc',ParentFileId:0, Page:1});
  574. $.ajax({
  575. url: "/api/share/get",
  576. type: "get",
  577. data : post_data,
  578. success: function (result) {
  579. if(result.message && result.message=='ok') {
  580. location.reload();
  581. }
  582. }
  583. }).then(function(result){
  584. //请求成功
  585. });
  586. }
  587. },
  588. 'dubox.com': {chk: /^\w{4,8}$/i, code : '.pwd-box', btn : '.pwd-submit-btn', pwdRule : /Password\s*[:: ]?\s*([a-z\d]{4,6})/i, IntervalSubmit: true},
  589. 'terabox.com': {chk: /^\w{4,8}$/i, code : '.pwd-input', btn : '.pwd-submit-btn', pwdRule : /Password\s*[:: ]?\s*([a-z\d]{4,6})/i, IntervalSubmit: true},
  590. 'bhpan.buaa.edu.cn':{chk: /^\w{4,8}$/i, code : '.password-input', btn : '.button'},
  591. 'disk.simiyun.cn':{
  592. chk: /^\w{4,8}$/i, CodeParam: 'pwd', code : '.pwd-box', btn : '.pwd-submit-btn', pwdRule : /Password\s*[:: ]?\s*([a-z\d]{4,6})/i, IntervalSubmit: true,
  593. PreProcess(codebox, cdoebtn, sCode){
  594. console.log(codebox, codebtn, sCode);
  595. alert('y')
  596. }, preSubmit(codebox, cdoebtn, sCode){
  597. alert('y2');
  598. }
  599. },
  600. },
  601. //跳转链预处理
  602. 'JumpUrl' : {
  603. 'zhihu.com' : {
  604. href: $('A[href*="//link.zhihu.com/?target="]'),
  605. url:/.*\/\/link\.zhihu\.com\/\?target=/
  606. },
  607. 'zhuanlan.zhihu.com' : {
  608. href: $('A[href*="//link.zhihu.com/?target="]'),
  609. url:/.*\/\/link\.zhihu\.com\/\?target=/
  610. },
  611. 'sijihuisuo.club': {
  612. href: $('.down-tip A[href^="https://www.sijihuisuo.club/go/?url="]'),
  613. url: 'https://www.sijihuisuo.club/go/?url='
  614. },
  615. 'nyavo.com':{
  616. href: $('.content a'),
  617. url: 'https://www.nyavo.com/go?url='
  618. },
  619. 'pixiv.net':{href:$('a'), url:'/jump.php?'}
  620. },
  621. //密码融合需要特殊支持的网站
  622. 'Support' : {
  623. 'zhidao.baidu.com': {
  624. path :/question\/\d+.html/,
  625. callback : function(){
  626. let baiduyun=$('baiduyun');
  627. baiduyun.each(function(i, e){
  628. let bdy=$('<a>').attr({'href':$(this).attr('data_sharelink')+'#'+$(this).attr('data_code')}).text($(this).attr('data_title') + "(" +$(this).attr('data_size') + ")");
  629. let filelogo=$('<img>').attr({'src': $(this).attr('data_filelogo'), 'alt': '网盘自动填写访问码(密码融合)', 'title': '网盘自动填写访问码(密码融合)'}).css({'display':'inline-block','width':'32px'});
  630. $(this).after("<br>", "密码融合:", bdy, filelogo);
  631. });
  632. }
  633. },
  634. '115.com': {
  635. path: /home\/detail_view/i,
  636. callback: function(){
  637. //console.log('115 特殊支持');
  638. }
  639. },
  640. 'agefans.tv':{
  641. path: /detail/i,
  642. callback: function(){
  643. $('.res_links_a').each(function(){
  644. var res_links_a = this;
  645. GM_xmlhttpRequest({
  646. method: "get",
  647. url: res_links_a.href,
  648. onload: function (result) {
  649. //console.log('load:', res_links_a.href, result.finalUrl, result);
  650. //console.log(res_links_a);
  651. $(res_links_a).attr({'href': result.finalUrl});
  652. }
  653. });
  654. });
  655. }
  656. },
  657. 'yunpanjingling.com':{
  658. path : /search/i,
  659. callback:function(){
  660. $('.item').each(function(){
  661. var name=$(this).find('.name').text().trim();
  662. var code=$(this).find('.code').text()||'';
  663. var href=$(this).find('.name').find('a');
  664. var referrer=$(this).find('.referrer').find('a');
  665. referrer.attr('href',decodeURIComponent(getQueryString('url',referrer.attr('href'))));
  666. href.attr('href',decodeURIComponent(getQueryString('url',href.attr('href'))));
  667. if(code) href.attr('href',href.attr('href')+'#'+code);
  668. href.click(function(){
  669. var CatPW_Data={'date':Dates(),'sCode':code, unPW:'', 'Src':href.attr('href'), 'Hash':'#'+code, "webSrc":referrer.attr('href'), "webTitle":encodeURIComponent(name)};
  670. sessionStorage['CatPW_Data']=JSON.stringify(CatPW_Data);
  671. })
  672. });
  673. }
  674. },
  675. 'jiluhome.cn' : {
  676. path:/./i,
  677. callback:function(){
  678. var PostID=$.getUrlParam('p', $('link[rel="shortlink"]').attr('href'));
  679. //获取网盘地址
  680. DownAjax('http://www.jiluhome.cn/wp-content/plugins/erphpdown/download.php?postid='+PostID, '#erphpdown-download', function(e){
  681. $(e).find('a[href*="download.php"]').each(function(){
  682. var target=this;
  683. $.ajax({
  684. "url":'http://www.jiluhome.cn/wp-content/plugins/erphpdown/download.php?postid='+PostID+"&url=&key=1",
  685. success:function(d){
  686. target.href=d.match(/window.location=\'([^']+?)\'/i)[1];
  687. }
  688. });
  689. });
  690. $('#erphpdown>center').append(e);//.replaceWith(e);
  691. });
  692. }
  693. },
  694. 'dakashangche.com':{
  695. path:/\/sj\/\d/,
  696. callback:function(){
  697. //console.log('特殊支持');
  698. $('.down-tip>a[href*="du.acgget.com"]').each(function(){
  699. DownAjax(this.href,'.panel-body',function(e){
  700. $(e).appendTo($('#paydown'));
  701. });
  702. });
  703. }
  704. },
  705. 'appinn.com':{
  706. path:/\/[^\/]+\//i,
  707. callback:function(){
  708. //console.log('小众软件特殊支持');
  709. new PreHandle.VM();
  710. }
  711. },
  712. 'meta.appinn.com':{
  713. path:/\/t\/[^/]+\//i,
  714. callback:function(){
  715. new PreHandle.VM();
  716. $('A[href*="pan.baidu.com"],A[href*="eyun.baidu.com"]').each(function(){
  717. $(this).data({'url':this.href}).click(function(e){
  718. location.href=$(this).data('url');
  719. });
  720. });
  721. }
  722. },
  723. 'madsck.com':{
  724. path: /\/resource\/\d+/,
  725. callback:function(){
  726. var ID=$('.btn-download').data('id');
  727. $.ajax({
  728. "url":"http://www.madsck.com/ajax/login/download-link?id="+ID,
  729. method: "GET",
  730. dataType: "json",
  731. success:function(e){
  732. var res=e.resource;
  733. $('.btn-download').css('display','none');
  734. $('<a>').attr({'href':res.resource_link+'#'+res.fetch_code,'target':'_blank','class':'btn-download'}).css({'line-height':'60px','text-align':'center','font-size':'24px'}).text('下载').insertBefore('.btn-download');
  735. }
  736. });
  737. }
  738. },
  739. 'idanmu.com': {
  740. path : /storage\-download/i,
  741. callback : function(){
  742. $('.input-group').each(function(){
  743. $(this).text($(this).text()+$(this).find('input').val());
  744. });
  745. }
  746. },
  747. 'qiuquan.cc':{
  748. path:/./,
  749. callback : function(){
  750. $('#down>a[href*="pan.baidu.com"]').each(function(){
  751. if(!this.hash) {
  752. this.hash=$(this).text().match(/[\((](\w+)[)\)]/i)[1];
  753. }
  754. });
  755. }
  756. },
  757. 'acg44.com':{
  758. //search:['page_id','p'],
  759. path:/download/i,
  760. callback : function(){
  761. site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4}|[^$]+)/i;
  762. addMutationObserver('#download-container',function(e){
  763. e.some(function(a){
  764. for(var i in a.addedNodes){
  765. var b=a.addedNodes[i];
  766. if(b.className=='animated fadeIn') {
  767. var VerCode=$('[id^="downloadPwd"]').val();
  768. var unZipPW=encodeURIComponent($('[id^="extractPwd"]').val());
  769. var DownUrl=$('#download-container a.btn').attr('href');
  770. if(/pan.baidu.com\/share/i.test(DownUrl)){
  771. $('#download-container a.btn').attr('href',DownUrl+'&unPW='+unZipPW+'&Src='+encodeURIComponent(urls));
  772. } else {
  773. $('#download-container a.btn').attr('href',DownUrl+'#'+VerCode+'&unPW='+unZipPW+'&Src='+encodeURIComponent(urls));
  774. }
  775. }
  776. }
  777. });
  778. });
  779. }
  780. },
  781. 'reimu.net': {
  782. path: /archives/i,
  783. callback: function(){
  784. site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4}|8酱)/i;
  785. }
  786. },
  787. 'ccava.net': {
  788. path: /post/i,
  789. JumpHref: 'a[href*="/?url="]',
  790. callback: function(){
  791. site['codeRule']=/(?:(?:提取|访问|密[码碼])[码碼]?)\s*[:: ]?\s*([a-z\d]{4,8}|ccava)/i;
  792. }
  793. },
  794. //189天翼云盘支持
  795. 'mebook.cc':{
  796. path: /download.php/i,
  797. callback:function(){
  798. $('a').click(function(){
  799. if(this.hostname=='cloud.189.cn') site['codeRule']=/天翼云盘密码\s*[:: ]?\s*([a-z\d]{4,8})/i;
  800. else site['codeRule']=/百度网盘密码\s*[:: ]?\s*([a-z\d]{4,8})/i;
  801. });
  802. }
  803. },
  804. 'kudm.net':{ //天使动漫
  805. path:/./,
  806. callback:function(){
  807. $('body').on('click','a',function(){
  808. if(this.hostname=='pan.baidu.com') this.hash=$(this).text().replace(/.+(?:[集版]|无修)(\w{4,8})$/,'$1');
  809. });
  810. }
  811. },
  812. 'mikuclub.org':{
  813. path:/\d+/,
  814. callback:function(){
  815. $('.passw').each(function(){
  816. var dl=$(this).parent().next().find('.dl');
  817. dl[0].hash=this.value;
  818. });
  819. }
  820. },
  821. //特殊支持——跳转链处理
  822. '423down.com': {path: /\/\d+\.html/, JumpHref: 'a[href*="/go.php?"]',},
  823. 'dayanzai.me': {path: /\/[^.]+\.html/, JumpHref: '.intro-box a',},
  824.  
  825. //特殊支持——异类访问码融合
  826. //'th-sjy.com':{path:/\/$/, pwdRule:/(?:(?:提取|访问|(?<!解压)密[码碼]|艾|Extracted-code)[码碼]?)\s*[::﹕ ]?\s*([a-z\d]{4,6})/i},//城通网盘6位访问密码,访问码有边界在括号内,使用 codeRuleBorder 规则
  827. 'meijumi.net':{path:/\/\d+\.html/, pwdRule: /(\w{4,8})/},
  828. 'jpsub.com':{path:/\/forum.php|\/thread-\d+/, pwdRule: /(\w{4,8})/, pwdContainer: 'copy_open brs', Fusion: 'bbs'},
  829.  
  830.  
  831. //特殊支持——文本框访问码融合
  832. 'mikuclub.org':{path:/\d+/, input_password: '.password1', input_unzip: '.password_unzip1'},
  833. 'acgjc.com':{path:/storage-download/, input_password: '[id^="theme_custom_storage-"][id$="-download-pwd"]', input_unzip: '[id^="theme_custom_storage-"][id$="-extract-pwd"]'},
  834.  
  835. //特殊支持——下载页面加载
  836. 'sxpdf.com':{path:/\/\d+\.html|\/down.php/,callback:()=>{$('.xz.down').load($('.down>a').attr('href')+' .down-list-box, .down-pass>p');$('a[onclick="copyUrl2()"]').removeAttr('onclick');}},
  837. 'shoucangzhe.top': {
  838. path:/\d+.html|download.php/,
  839. callback: ()=>{
  840. let PostID=$.getUrlParam('p', $('link[rel="shortlink"]').attr('href'))||$.getUrlParam('postid');
  841. if(document.querySelector('.erphpdown-box')) {
  842. $('.erphpdown-box').append($('<div>').load(`/wp-content/plugins/erphpdown/download.php?postid=${PostID}&iframe=1 #erphpdown-download`, ()=>{
  843. GM_addStyle('#erphpdown-download {margin-top:30px!important;padding:20px;} #erphpdown-download .link {display: inline-block;background: #ff5f33;padding: 3px 12px;color: #fff;border-radius: 20px;font-size: 13px;margin: 0 10px}')
  844. $.get(`/wp-content/plugins/erphpdown/download.php?postid=${PostID}&key=1&index=`, e=>{
  845. $('#erphpdown-download a[href*="download.php"]').css({'background': '#33a1ff'}).attr('href', e.match(/https?:\/\/[^']+/).toString());
  846. });
  847. }));
  848. } else if(document.querySelector('.erphpdown-down-btn')) {
  849. $.get(`/wp-content/plugins/erphpdown/download.php?postid=${PostID}&key=1&index=`, e=>{
  850. $('.erphpdown-msg a[href*="download.php"]').css({'background': '#33a1ff'}).attr('href', e.match(/https?:\/\/[^']+/).toString());
  851. });
  852. }
  853. }
  854. },
  855. 'hifini.com': {path: /thread-\d+.htm/,callback: ()=>{$('.alert.alert-success>span').map((i,e)=>{if($(e).css('display')==='none') $(e).remove()});}}, //处理提取码中隐藏的干扰码
  856. 'ygobbs.com': {path: /\/t\/[^/]+\/\d+/, callback: function(){new PreHandle.VM();}},
  857. 'yxssp.com':{
  858. path: /\/\d+.html/,
  859. callback: ()=>{
  860. $('.downlink').load($('.downbtn').attr('href')+" .mr-auto>.list-group-flush a", (r,s,x)=>{
  861. $(`.downlink a`).addClass('downbtn')
  862. let lanzou=$('.downlink a[href*="lanz"]'), lanzouPW=r.match(/蓝奏云盘密码:(\w+)/)[1];
  863. lanzou.attr('href', lanzou.attr('href')+'#'+lanzouPW)
  864.  
  865. })
  866. }
  867. }
  868. }
  869. };
  870.  
  871.  
  872.  
  873. /***** 镜像域名映射 Begin *****/
  874. var HostToList={}, HostToListArr={
  875. YunDisk : {
  876. 'ctfile.com':['089u.com','089m.com','down.sxpdf.com'],
  877. 'lanzou.com': ['lanzou[a-z].com','lanzn.com','woozooo.com'],
  878. 'disk.simiyun.cn':['disk.bestcloud.cn']
  879. },
  880. Support : {
  881. 's-dm.com':['fodm.net'],
  882. 'reimu.net':['blog.reimu.net'],
  883. 'idanmu.com':['idanmu.co','idanmu.ch','idanmu.at'],
  884. 'shoucangzhe.top':['shoucangzhe8.top','scz666.top','scz888.top'],
  885. 'meijumi.net':['meijumi.top'],
  886. }
  887. },
  888. HostExpJSON={
  889. }
  890.  
  891. for(let key in HostToListArr){
  892. HostToList[key]={};
  893. for(let key_i in HostToListArr[key]) {
  894. let key_host=HostToListArr[key][key_i];
  895. for(let key_j=0;key_j<key_host.length;key_j++){
  896. HostToList[key][key_host[key_j]]=key_i;
  897. }
  898. }
  899. }
  900.  
  901. //扩展镜像域名到主 YunDisk 列表
  902. for(let key in HostToList['YunDisk']) {
  903. site['YunDisk'][key]=site['YunDisk'][HostToList['YunDisk'][key]];
  904. }
  905.  
  906. //站点存在则加入到 Site 中
  907. if(HostToList['YunDisk'][host]) site['YunDisk'][host]=site['YunDisk'][HostToList['YunDisk'][host]];
  908. else if(HostToList['Support'][host]) site['Support'][host]=site['Support'][HostToList['Support'][host]];
  909. else if(/yunpan.360.cn/.test(host)) host='yunpan.360.cn'; //如果是360云盘,重设主域名Host
  910. //else if(/lanzou[a-z].com/i.test(host)) host='lanzou.com'; //如果是蓝凑网盘,重设主域名Host
  911. //console.warn('CheckHostToList: ', host, HostToList['Support'][host], site['Support'][HostToList['Support'][host]]);
  912. /***** 镜像域名映射 End *****/
  913.  
  914.  
  915. let conf = site['YunDisk'][host]; //设置主域名
  916. const SupportHost=site['Support'][host]; //特别支持网站
  917.  
  918. /* -----===== 生成正则,校验匹配的网盘 Start =====----- */
  919. let HostArr = []; //生成域名数组
  920. for(let i in site['YunDisk']) HostArr.push(i); //插入域名对象数组
  921. for(let i in HostToList['YunDisk']) HostArr.push(i); //插入域名对象数组
  922. let HostExp = new RegExp(HostArr.join("|"),'i'); //生成支持网盘的校验正则,进行密码融合
  923. for(let i in HostToList['YunDisk']) HostArr.push(i);
  924. let HostSelector = HostArr.map(HostI => `[href*="${HostI}"]`);
  925. /* -----===== 生成正则,校验匹配的网盘 End =====----- */
  926.  
  927. msg(`网盘域名正则表:${HostExp}`);
  928.  
  929. /* -----===== 检查是否需要处理跳转链 Start =====----- */
  930. //console.log(site.JumpUrl[host]);
  931. if(site['JumpUrl'][host]){
  932. msg(`跳转链处理:${site['JumpUrl'][host]['href']}`);
  933. if(site['JumpUrl'][host]['Observer']) {
  934. console.warn('跳转链处理 —— 监听页面变化')
  935. addMutationObserver(site['JumpUrl'][host]['Observer']['watch'], site['JumpUrl'][host]['Observer']['fn']);
  936. } else {
  937. site['JumpUrl'][host]['href'].each(function(){
  938. //console.log(site['JumpUrl'][host]['rep']);
  939. $(this).attr({'href':decodeURIComponent($(this).attr('href').replace(site['JumpUrl'][host]['url'],'')),'target':'_blank'});
  940. });
  941. }
  942. }
  943. /* -----===== 检查是否需要处理跳转链 End =====----- */
  944. //console.warn('checkSite: ', site, 'YunDisk:', site['YunDisk'], site['YunDisk'][host], 'Support: ', site['Support'], site['YunDisk'][host]);
  945. //console.warn('checkHost: ', host, conf, 'HostToList: ', HostToList);
  946.  
  947. /* -----===== 检查是否为网盘页面 Start =====----- */
  948. msg({
  949. host: host,
  950. conf: conf,
  951. siteList: site['YunDisk'],
  952. supportHostList: SupportHost,
  953. supportHost:SupportHost && SupportHost['path'].test(paths),
  954. })
  955. //网盘页面填密码登录
  956. if(!(SupportHost && SupportHost['path'].test(paths)) && conf && (!conf.exclude || !conf.exclude.test(location.pathname))){
  957. //地址栏含(提取码:)处理为 #
  958. if(/(%E5%AF%86%E7%A0%81|%E6%8F%90%E5%8F%96%E7%A0%81)/i.test(location.search)) {
  959. let newBaiDuPanUrl=location.href.replace(/(?:%20)?(?:%EF%BC%88)?(?:(?:%E8%AE%BF%E9%97%AE)?%E5%AF%86%E7%A0%81|%E6%8F%90%E5%8F%96%E7%A0%81)(?:%EF%BC%9A|:)?(?:%20)?(\w+)(?:%20)?(?:%EF%BC%89)?/i, '#$1'); // 空格+括号+(密码|提取码)+冒号+空格+反括号
  960. if(/\#\w{4,8}/.test(newBaiDuPanUrl)) location.href=newBaiDuPanUrl;
  961. }
  962.  
  963. // 抓取提取码
  964. if(conf.PreProcess) conf.PreProcess(); //内容预处理
  965. let StorageCode = conf.surl ? StorageDB('Share_'+conf.surl()).find('sCode') : null, //从缓存中读取提取码
  966. HashCode = /^#/.test(hash) && !/\//i.test(hash) ? hash.match(/^#([^&]+)&?/)[1] : '', //从Hash中读取提取码
  967. CodeParam = conf.CodeParam ? $.getUrlParam(conf.CodeParam) : '', //从地址参数中读取提取码(115网盘支持)
  968. ASCII_Param_Code = /(%E5%AF%86%E7%A0%81|%E6%8F%90%E5%8F%96%E7%A0%81)/i.test(location.search) ? location.search.match(/(?:%E8%AE%BF%E9%97%AE%E5%AF%86%E7%A0%81|%E6%8F%90%E5%8F%96%E7%A0%81)(?:%EF%BC%9A|:)?(?:%20)?(\w+)/i)[1] : '',
  969. CacheCode = GM_getValue('CatPW').Hash.replace('#','');
  970.  
  971. let sCode = CodeParam ? CodeParam : (conf.sCode && conf.sCode=='CacheCode') ? CacheCode : (((StorageCode&&StorageCode==HashCode)||(HashCode=='')) ? StorageCode : HashCode)||ASCII_Param_Code;
  972. //顺序:CodeParam、conf.sCode=CacheCode、StorageCode=HashCode、HashCode、ASCII_Param_Code
  973.  
  974. // 调试用,检查是否为合法格式
  975.  
  976. if (!sCode) msg('没有 Key 或格式不对');
  977. else msg('抓取到的提取码: ', sCode);
  978. msg('code: ', $(conf.code), 'btn: ', $(conf.btn))
  979.  
  980. if(conf.IntervalSubmit) { //延时提交,访问码框动态加载,需检测访问码框后才触发提交操作
  981. let IntervalSubmit_Step=0, t=setInterval(function() {
  982. msg('间隔提交方式,访问码:', sCode, $(conf.code).val());
  983. IntervalSubmit_Step++;
  984. if($(conf.btn).length>0 && sCode) {
  985.  
  986. let CodeInput = document.querySelector(conf.code);
  987.  
  988. if(CodeInput._valueTracker) { //兼容 u.React 方法
  989. let PWD_lastValue=CodeInput.value;
  990. CodeInput.value=sCode;
  991. CodeInput._valueTracker.setValue(PWD_lastValue);
  992. } else
  993. $(conf.code).val(sCode);
  994.  
  995. if($(conf.code).val()!=='') {
  996. if(typeof(InputEvent)!=='undefined') {
  997. //使用 InputEvent 方法,主流浏览器兼容
  998. CodeInput.dispatchEvent(new InputEvent("input", {bubbles: true})); //模拟事件
  999. } else if(KeyboardEvent) {
  1000. //使用 KeyboardEvent 方法,ES6以下的浏览器方法
  1001. $(conf.code).get(0).dispatchEvent(new KeyboardEvent("input", {bubbles: true}));
  1002. }
  1003. clearInterval(t);
  1004. //$(conf.btn).click();
  1005.  
  1006. $(conf.btn).get(0).dispatchEvent(new MouseEvent("click"));
  1007. //new MouseEvent("click", {bubbles: true,cancelable: true,view: window});
  1008.  
  1009. if(conf.preSubmit) conf.preSubmit (conf.code, conf.btn, sCode); //特殊提交方式
  1010. }
  1011. } else if(!sCode) clearInterval(t);
  1012. else if(IntervalSubmit_Step>10) clearInterval(t); //限制延时提交尝试次数
  1013. }, 1000);
  1014. }
  1015. else if($(conf.btn).length>0) { //存在提交按钮时才触发填写操作
  1016. // 加个小延时
  1017. setTimeout (function(){
  1018. // 键入提取码并单击「提交」按钮,报错不用理。
  1019. var codeBox = $(conf.code),
  1020. btnOk = $(conf.btn);
  1021. msg('提交访问:',codeBox, btnOk);
  1022. if (conf.preSubmit) { //特殊提交方式
  1023. msg('preSubmit 特殊提交方式');
  1024. codeBox.val(sCode); //填写验证码
  1025. btnOk.click(); //先尝试常规提交
  1026. conf.preSubmit (conf.code, conf.btn, sCode); //最后尝试预处理方案,可能需要页面 ready 才能生效
  1027. }
  1028. else if(codeBox.length>0) { //存在密码框时才进行密码提交操作
  1029. msg('正常提交')
  1030. codeBox.val(sCode); //填写验证码
  1031. btnOk.click();
  1032. }
  1033. }, 10);
  1034. }
  1035.  
  1036. /* -----===== 检查是否为网盘页面 End =====----- */
  1037. } else {
  1038. //密码融合 特别支持的网站
  1039. if(SupportHost&&(SupportHost['path']?SupportHost['path'].test(paths):getQueryString(SupportHost['search']))) {
  1040. if(SupportHost.input_password) $(SupportHost.input_password).text($(SupportHost.input_password).val()); //转化 input 提取码内容,添加文本
  1041. if(SupportHost.input_unzip) {
  1042. $(SupportHost.input_unzip).text($(SupportHost.input_unzip).val()); //转化 Input 解压密码内容,添加文本
  1043. SupportHost.unzip=$(SupportHost.input_unzip).val();
  1044. }
  1045. if(SupportHost.JumpHref) { //用于处理被加密的跳转链
  1046. $(SupportHost.JumpHref).each(function(){
  1047. let txt=$(this).text().trim();
  1048. //let JumpHrefSearch=new URLSearchParams(this.search);
  1049. //如果目标链接的“文本”为超链接
  1050. if(/^https?:\/\/[^/]+\/.+/i.test(txt)) {//(baidu|lanzou.?|pcloud|189)
  1051. $(this).attr('href', txt);
  1052. } else if(/点击下载/i.test(txt)){ //把纯文本替换为链接
  1053. $(this).text(this.href);
  1054. }
  1055. });
  1056. }
  1057. if(SupportHost.pwdRule) site.pwdRule=SupportHost.pwdRule;
  1058. if(SupportHost.AccessPW) {
  1059. switch(SupportHost.AccessPW) {
  1060. case 'nextSibling':
  1061. $(HostSelector).each((i,x) => {
  1062. //console.log(this, x);
  1063. });
  1064. }
  1065. }
  1066. if(SupportHost.callback) SupportHost.callback();
  1067. }
  1068.  
  1069. let PreHandle={ //内容预处理
  1070. Text : function(text){ //预处理含解码密码的文本
  1071. text=text?typeof(text)=="string"?text.trim():text.textContent.trim():null;
  1072. text=text?text.replace('本帖隐藏的内容',''):null; //文本内容预处理,提高DZ论坛的匹配率
  1073. text=text?text.replace(/([\[【]?解[压壓]|[压壓][缩縮])密[码碼][\]】]?\s*[:: ]?(?:&nbsp;?)\s*([a-z\d]{4}|[^\n]+)/ig,''):null;
  1074. return text;
  1075. },
  1076. Code : function(obj){ //密码有效性校验
  1077. let text=this.Text(obj);
  1078. if(!text) return;
  1079. /**
  1080. * PreHandle.Code
  1081. * @params {string} pwdRule 提取码|访问码
  1082. * @params {string} codeRuleBorder 带边界的其它类型访问码
  1083. * @params {string} codeRule 无边界的其它类型访问码
  1084. * @description 依上述顺序匹配访问码关键字
  1085. =====*/
  1086. let pw=site['pwdRule'] && site['pwdRule'].test(text) ? text.match(site['pwdRule'])[1] : site['codeRuleBorder']&&site['codeRuleBorder'].test(text) ? text.match(site['codeRuleBorder'])[1] : site['codeRule']&&site['codeRule'].test(text) ? text.match(site['codeRule'])[1]:null;
  1087. msg('尝试获取提取码:', text, site['pwdRule'], site['codeRule']);
  1088. return pw;
  1089. },
  1090. coercive : (target, pass)=>target.href+=`#${pass}`,
  1091. Fusion : function(target, obj){ //融合密码
  1092. let sCode = this.Code(obj);
  1093. msg({
  1094. targetHash: target.hash,
  1095. sCode : sCode
  1096. })
  1097. if(!target.hash) {
  1098. target.href+=`#${sCode}`;
  1099. }
  1100. },
  1101. VM : function(){ //暴力匹配
  1102. let Link=$('A[href*="pan.baidu.com"],A[href*="eyun.baidu.com"]');
  1103. for(i=0;i<Link.length;i++){
  1104. let LinkParent=$(Link[i]).parent();
  1105. let LinkParentHtml=LinkParent.html();
  1106. if(PreHandle.Code(LinkParentHtml)) Link[i].href+='#'+PreHandle.Code(LinkParentHtml);
  1107. }
  1108. },
  1109. PassWord : function(CatPW_Data){
  1110. if(StorageSave) {
  1111. if(SupportHost && SupportHost.unzip) { //如果存在特殊支持网站,内置解压密码文本框,则使用特殊支持网站的规则
  1112. msg('特殊网站“解压密码”规则:'+SupportHost.input_unzip, '解压密码提取:'+SupportHost.unzip);
  1113. CatPW_Data.unPW=encodeURIComponent(SupportHost.unzip);
  1114. } else { //否则遍历网站提取解压密码
  1115.  
  1116. let unPWArr=[
  1117. /[^\w]password(?!=")?([^\n]+)/igm, //passwordd 开头的文本
  1118. /解压[:: ]?(\w+)/gm,
  1119. /【解[压壓]密[码碼]】\s*[:: ]?\s*(\w+)/igm,
  1120. /【解[压壓]密[码碼]】\s*[:: ]?\s*([^\r\n]+)/igm,
  1121. /\[解[压壓]密[码碼]\]\s*[:: ]?\s*([a-z\d\.:/@]+)/igm, //http://www.itokoo.com/
  1122. /(?:解[压壓]密?[码碼])\s*[:: ]?\s*([a-z\d\.:/@]+)(?!-)\b/igm,
  1123. /(?:解[压壓]密?[码碼])(?:都?是|为)\s*[:: ]?\s*([\w\.:/@]+)[^$\r\n]/igm,
  1124. /(?:解[压壓]密?[码碼])(?:都?是|为)\s*[:: ]?\s*([^\w]+)[^$\r\n]/igm, //中文类
  1125. /【?压缩密码】?\s*[:: ]?\s*([^\n]+)/igm,
  1126. /【?[資资]源密[码碼]】?:(\w+)/ //来源:http://www.abcmm.co
  1127. ];
  1128. let bodyText=document.body.innerText, bodyHtml=document.body.outerHTML,
  1129. BodyHtml_Processing=document.body.outerHTML.replace(/\b[-\w]+=['"]?[^'"]+['"]?/ig,'');
  1130. for(let i=0;i<unPWArr.length;i++) {
  1131. let unPWTemp=unPWArr[i].exec(bodyText)||unPWArr[i].exec(BodyHtml_Processing)||unPWArr[i].exec(document.body.textContent);
  1132. if(unPWTemp) {
  1133. msg(i, '规则:'+unPWArr[i], '解压密码提取:'+encodeURIComponent(unPWTemp[1]), '所有结果:'+unPWTemp);
  1134. CatPW_Data.unPW=encodeURIComponent(unPWTemp[1]);
  1135. break;
  1136. }
  1137. }
  1138. }
  1139. if(sessionStorage['CatPW_Data']) GM_setValue('CatPW', JSON.parse(sessionStorage['CatPW_Data']));
  1140. else GM_setValue('CatPW', CatPW_Data);
  1141. msg('GM_getValue', GM_getValue('CatPW'));
  1142. }
  1143. },
  1144. EachSibling : function($parent, $target, pi, $sibling, $i, $max){
  1145. console.group('=== 同级元素遍历模式 第 ' + pi + ' 次 ===');
  1146. var dz_i=$i||1, dz_maxParent = $max||5, dz_sibling=5||$sibling, dz_parent=$parent;
  1147. while(dz_i<=dz_maxParent){
  1148. console.group('=== Part2. 同级元素遍历模式 第 ' + dz_i + ' 个父元素 ===');
  1149. msg('%c === 同级元素遍历模式 向上遍历 '+dz_maxParent+' 次 同级元素 '+dz_sibling+' 个 第 ' + dz_i +' 个父元素 ===', 'color: yellow');
  1150. msg('目标:', dz_parent, dz_parent.tagName);
  1151. if($parent.tagName!=='FONT') {
  1152. dz_i++;
  1153. } else {
  1154. msg('不计算父元素 ' + $parent.tagName + ' 节点');
  1155. }
  1156. var dz_si=1, dz_nextSibling=dz_parent.nextSibling;//获得节点的兄弟节点
  1157. while(dz_si<=dz_sibling){
  1158. msg(' 第 ' + dz_si + ' 个同级元素', dz_nextSibling);
  1159. if(dz_nextSibling) { //检测同级元素是否存在
  1160. if(PreHandle.Code(dz_nextSibling)) {
  1161. console.groupEnd('=== Part2. 同级元素遍历模式 ===');
  1162. console.groupEnd('--- 普通父级遍历模式 ----');
  1163. PreHandle.Fusion($target, dz_nextSibling);
  1164. return;
  1165. }
  1166. } else {
  1167. msg(' 在目标元素查找 ', PreHandle.Code(dz_parent));
  1168. if(dz_parent==document.body) return;
  1169. if(PreHandle.Code(dz_parent)) {
  1170. console.groupEnd('=== 同级元素遍历模式 End ===');
  1171. console.groupEnd('--- 普通父级遍历模式 End ----');
  1172. PreHandle.Fusion($target, dz_parent);
  1173. return true;
  1174. }
  1175. break;
  1176. }
  1177. //console.groupEnd('=== 同级元素遍历模式 End ===');
  1178. console.groupEnd('--- 普通父级遍历模式 End ----');
  1179. dz_si++;
  1180. dz_nextSibling=dz_nextSibling.nextSibling;
  1181. }
  1182.  
  1183. dz_parent=dz_parent.parentNode;
  1184. msg(dz_parent);
  1185. console.groupEnd('--- 普通父级遍历模式 ----');
  1186. }
  1187. console.groupEnd('=== 同级元素遍历模式 ===');
  1188. }
  1189. };
  1190.  
  1191. //监听 A 标签点击事件
  1192. $('body').on('click', 'a', function (e) {
  1193. let target=this, CatPW_Data,
  1194. thisHost=this.host.toLowerCase().replace(/^(?:www|pan)\.(?!baidu.com)/i,'');
  1195. //thisHost=thisHost.replace(/^\w+\.(?=lanzou)/,'').replace(/(?<=lanzou)[a-z]?/i,''); //蓝凑云网盘地址变体处理
  1196.  
  1197. msg(`密码融合点击监听`, thisHost);
  1198.  
  1199. //提升密码匹配范围,以兼容部分网盘
  1200. if(site['YunDisk'][thisHost] && site['YunDisk'][thisHost]['pwdRule']) {
  1201. site['pwdRule']=site['YunDisk'][thisHost]['pwdRule'];
  1202. }
  1203. if(site['YunDisk'][thisHost] && site['YunDisk'][thisHost]['codeRule']) {
  1204. site['codeRule']=site['YunDisk'][thisHost]['codeRule'];
  1205. }
  1206.  
  1207. if(HostExp.test(this.href)){
  1208. if(Control_newTag) this.target='_blank'; //新页面打开网盘
  1209. this.href=this.href.replace(/#$/,''); //处理链接末尾的hash标记
  1210. this.href=this.href.replace(/(?:%20)?(?:%EF%BC%88)?(%E8%AE%BF%E9%97%AE%E5%AF%86%E7%A0%81|%E6%8F%90%E5%8F%96%E7%A0%81)(?:%EF%BC%9A)?\w+(?:%EF%BC%89)?/i, ''); //处理掉链接中包含这些文本——“ (?:()?(访问密码|提取码)(?::)?\d+(?:))?”)
  1211. //初始化信息记录变量
  1212.  
  1213. CatPW_Data={'date':Dates(),'sCode':'', unPW:'', 'Src':this.href, 'surl':'', 'Hash':this.hash, "webSrc":encodeURIComponent(urls), "webTitle":encodeURIComponent(document.title)};
  1214.  
  1215. msg(CatPW_Data);
  1216.  
  1217. if((this.hash && !this.hash.includes('/')) || /115.com\/s\/.+\?password/i.test(this.href)) { //如果超链接已有 hash ,或者 115 网盘的 password 参数,则跳过密码融合
  1218. msg('密码已融合,跳过密码融合步骤');
  1219. if(sessionStorage['CatPW_Data']) GM_setValue('CatPW', JSON.parse(sessionStorage['CatPW_Data']));
  1220. else GM_setValue('CatPW', CatPW_Data);
  1221. PreHandle.PassWord(CatPW_Data); //融合解压密码
  1222. return;
  1223. } else if(this.hash && this.hash.includes('/')){
  1224. //目标有Hash,但是不是提取码,则采用gmVal方案缓存密码,未完成
  1225. //CatPW_Data.sCode = sCode;
  1226. //GM_setValue('CatPW', CatPW_Data)
  1227. }
  1228. console.group(' ===== 网盘自动填写密码 密码融合 =====');
  1229.  
  1230. //选定密码强制融合
  1231. if(window.getSelection().toString()) {
  1232. msg('强制融合密码')
  1233. let slc=window.getSelection().toString();
  1234. //选中的内容为纯英文数字时,直接融合为访问码
  1235. if(!/[^\w]/.test(slc)&&/^\w+$/.test(slc)&&slc.length<=8) {
  1236. PreHandle.coercive(target, slc)
  1237. } else if(PreHandle.Code(slc)) {
  1238. PreHandle.Fusion(target, slc)
  1239. }
  1240. }
  1241.  
  1242. //论坛兼容模式
  1243. if($.getUrlParam('mod')=='viewthread'&&$.getUrlParam('tid')&&$('.showhide').length>0||u.discuz_uid){
  1244. if($(target).next().hasClass("showhide") && PreHandle.Code(target.nextElementSibling)) {
  1245. msg('论坛特殊兼容模式 - 从链接后隐藏内容中查找密码');
  1246. PreHandle.Fusion(target, target.nextElementSibling);
  1247. } else if(SupportHost && SupportHost.Fusion) {
  1248. msg('论坛特殊兼容模式 - 密码在超链接后面的兄弟对象中');
  1249. let nextTager=target.nextElementSibling;
  1250. if(SupportHost.pwdContainer) {
  1251. while(nextTager) {
  1252. nextTager=nextTager.nextElementSibling;
  1253. if(nextTager.className==SupportHost.pwdContainer) break;
  1254. }
  1255. }
  1256. PreHandle.Fusion(target, nextTager);
  1257. }
  1258. }
  1259.  
  1260. //常规匹配模式
  1261. if(PreHandle.Code(target)) {
  1262. msg('在当前超链接的对象中查找密码');
  1263. PreHandle.Fusion(target, target);
  1264. } else if(PreHandle.Code(target.nextSibling)){
  1265. msg('密码在超链接后面的兄弟元素中');
  1266. PreHandle.Fusion(target, target.nextSibling);
  1267. } else if(PreHandle.Code(target.parentNode)){
  1268. msg('从父对象中查找密码', target.parentNode);
  1269. PreHandle.Fusion(target, target.parentNode);
  1270. } else {
  1271. console.group('--- 普通父级遍历模式 ----');
  1272. var i = 0,
  1273. maxParent = 5, //向上遍历的层级
  1274. parent = target,
  1275. $parent = parent;
  1276. while(i<maxParent) {
  1277. i++; //遍历计数
  1278. parent = parent.parentNode; //取得父对象
  1279. msg('遍历上级目录查找密码:'+ i, parent);
  1280. if(parent.tagName=="TR") { //如果父对象是表格,则从表格中提取密码
  1281. if(PreHandle.Code(parent.nextElementSibling)) {
  1282. parent=parent.nextElementSibling;
  1283. msg('表格中查找密码成功!',parent);
  1284. PreHandle.Fusion(target, parent);
  1285. break;
  1286. }
  1287. } else {
  1288. var EachSiblingResult=PreHandle.EachSibling($parent, target, i); //同级遍历函数
  1289. if(EachSiblingResult) break; //遍历取得结果,停止遍历
  1290.  
  1291. $parent=parent.parentNode; //取得上一级父对象
  1292. if(maxParent>5) {
  1293. msg('已超出遍历范围');
  1294. }
  1295. }
  1296. if(parent==document.body) break; //如果已经遍历到最顶部
  1297. }
  1298. console.groupEnd('--- 普通父级遍历模式 ----');
  1299. }
  1300.  
  1301. CatPW_Data.Hash=this.hash;
  1302. PreHandle.PassWord(CatPW_Data); //融合解压密码
  1303. }
  1304. console.groupEnd();
  1305. });
  1306. }
  1307.  
  1308. function msg(text){
  1309. let obj = (e)=>{
  1310. }
  1311. if(msgControl) {
  1312. //console.log('arguments.length', arguments.length, arguments);
  1313. if(arguments.length>1) {
  1314. let args=Array.prototype.slice.call(arguments)
  1315. console.log(args);
  1316. } else if(Object.prototype.toString.call(text).includes('Object')){
  1317. console.table(text);
  1318. }
  1319. else {
  1320. console.log(text);
  1321. }
  1322. }
  1323. }
  1324.  
  1325. function addMutationObserver(selector, callback, Kill) {
  1326. var watch = document.querySelector(selector);
  1327.  
  1328. if (!watch) {
  1329. return;
  1330. }
  1331. var observer = new MutationObserver(function(mutations){
  1332. var nodeAdded = mutations.some(function(x){ return x.addedNodes.length > 0; });
  1333. if (nodeAdded) {
  1334. callback(mutations);
  1335. if(Kill) {
  1336. msg('停止'+selector+'的监控');
  1337. observer.disconnect();
  1338. }
  1339. }
  1340. });
  1341. observer.observe(watch, {childList: true, subtree: true});
  1342. }
  1343.  
  1344. function getQueryString(name,url) {//筛选参数
  1345. var reg, str;
  1346. url=url?url.match(/[?#].*/).toString():location.search; //网址传递的参数提取,如果传入了url参数则使用传入的参数,否则使用当前页面的网址参数
  1347.  
  1348. if(Array.isArray(name)){
  1349. for(var i in name){
  1350. reg = new RegExp("(?:^|&)(" + name[i] + ")=([^&]*)(?:&|$)", "i"); //正则筛选参数
  1351. str = url.substr(1).match(reg);
  1352. if (str !== null) return unescape(str[2]);
  1353. }
  1354. } else {
  1355. reg = new RegExp("(?:^|&)(" + name + ")=([^&]*)(?:&|$)", "i"); //正则筛选参数
  1356. str = url.substr(1).match(reg);
  1357. if (str !== null) return unescape(str[2]);
  1358. }
  1359. return null;
  1360. }
  1361.  
  1362. function StorageDB(collectionName) {
  1363. //如果没有 集合名,则使用默认 default
  1364. collectionName = collectionName ? collectionName : 'default';
  1365. //创建JSON缓存,如果缓存存在,则转为JSON,否则新建
  1366. var cache = localStorage[collectionName] ? JSON.parse(localStorage[collectionName]) : {};
  1367.  
  1368. return {
  1369. add : function(name, value) {
  1370. cache[name]=value;
  1371. localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  1372. },
  1373. del:function(name) {
  1374. if(name) {
  1375. msg(cache, cache[name]);
  1376. delete cache[name];
  1377. localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  1378. } else {
  1379. //删除整个 localStorage 数据
  1380. localStorage.removeItem(name);
  1381. }
  1382. },
  1383. insert: function(obj){
  1384. localStorage.setItem(collectionName, JSON.stringify(obj));
  1385. },
  1386. Updata : function(name,obj,value){
  1387. cache[obj]=cache[obj]||{};
  1388. cache[obj][name]=value;
  1389. localStorage.setItem(collectionName, JSON.stringify(cache)); //回写 localStorage
  1390. },
  1391. Query : function(obj,name){
  1392. return cache[obj]?name?(cache[obj][name]?cache[obj][name]:null):cache[obj]:null;
  1393. },
  1394. find : function(name) {
  1395. if(!collectionName) return false;
  1396. return cache[name];
  1397. },
  1398. read : function(){
  1399. return $.isEmptyObject(cache)?null:cache;//如果为空,则返回 null
  1400. },
  1401. deleteExpires : function(now){
  1402. now=now||$.now();
  1403. for(var i in cache) {
  1404. //console.log(i, collectionName, now, cache[i]['exp'], now>cache[i]['exp']); //删除记录显示
  1405. //console.log(cache[i], localStorage[i]);
  1406. if(now>cache[i]['exp']) {
  1407. delete localStorage[i]; //删除对应分享 ID 的记录
  1408. this.del(i); //删除时间表中的记录
  1409. }
  1410. }
  1411. }
  1412. };
  1413. }
  1414.  
  1415. function DiskInfo(Key, target, Prepocess){
  1416. //Key文件分享ID
  1417. var insertTarget=target, //信息插入的目标位置
  1418. CatPW_Data,
  1419. CatPW_Format={'date':Dates(),'sCode':'', unPW:'', 'Src':'', 'Hash':'', "webSrc":'', "webTitle":''};
  1420.  
  1421. //初始化 getValue 数据
  1422.  
  1423. if(StorageDB(Key).read()) {
  1424. GM_setValue('CatPW', StorageDB(Key).read());
  1425. CatPW_Data=StorageDB(Key).read();
  1426. } else if(GM_getValue('CatPW')=='undefined'||GM_getValue('CatPW')===undefined) {
  1427. GM_setValue('CatPW', CatPW_Format); //初始化
  1428. } else {
  1429. CatPW_Data=GM_getValue('CatPW');
  1430. }
  1431. if(Prepocess) Prepocess(CatPW_Data, Key);
  1432.  
  1433. if((CatPW_Data['Src'].search(Key)>-1||CatPW_Data['FileID']==Key)&&$('#CatPW_Info').length<1) {
  1434. var $CatPW_Info=$('<DIV>').attr('id','CatPW_Info');
  1435. var $CatPW_Info_unPW=$('<div>').text('解压密码:').append($('<input>').attr({'id':'unPW','title':'点击复制密码'}).css({'margin':'0 10px','width':'150px','text-align':'center'}).val(decodeURIComponent(CatPW_Data.unPW)).click(function(){document.execCommand("SelectAll");document.execCommand("copy");}).change(function(){
  1436. StorageDB(Key).add('unPW',encodeURIComponent(this.value));
  1437. CatPW_Data.unPW=encodeURIComponent(this.value);
  1438. GM_setValue('CatPW', CatPW_Data);
  1439. }));
  1440. var $CatPW_Info_title=$('<span>').text('网页标题:').append($('<input>').attr({'id':'CatPW_webTitle','title':'内容修改自动保存'}).val(decodeURIComponent(CatPW_Data.webTitle)).css({'margin':'0 10px','padding':'0 2px','min-width':'450px'}).show(function(){
  1441. $(this).css({'width':this.value.length*15});
  1442. }).change(function(){
  1443. StorageDB(Key).add('webTitle',encodeURIComponent(this.value));
  1444. }));
  1445. var $CatPW_Info_webSrc=$('<A>').attr({'id':'CatPW_webSrc','href':decodeURIComponent(CatPW_Data.webSrc),'target':'_blank'}).text('网盘来源:'+decodeURIComponent(decodeURIComponent(CatPW_Data.webSrc)));
  1446. var $CatPW_Info_DeleteBtn=$('<button>').text('删除记录').val('删除记录').css({'display':'inline-block'}).click(function(){
  1447. delete localStorage[Key];
  1448. GM_setValue('CatPW', CatPW_Format);
  1449. this.disabled=true;
  1450. });
  1451. $CatPW_Info.append($CatPW_Info_unPW.append($CatPW_Info_DeleteBtn), '<br>', $CatPW_Info_title,'<br>', $CatPW_Info_webSrc).insertBefore(insertTarget);
  1452. StorageDB(Key).insert(CatPW_Data);
  1453. } else {
  1454. $('<div>').append('当前记录网盘地址为:',$('<A>').attr({'href':CatPW_Data.Src,'target':'_blank'}).text(CatPW_Data.Src),' 与当前网盘不符').insertBefore(insertTarget);
  1455. }
  1456. GM_addStyle('#CatPW_Info{font-size:14px;border:1px solid #06c;padding:5px;display:block;}');
  1457. }
  1458.  
  1459. function DownAjax(urls, selection,callback){
  1460. GM_xmlhttpRequest({
  1461. method: "GET",
  1462. url: urls,
  1463. onload: function (result) {
  1464. var parsetext = function(text){
  1465. var doc = null;
  1466. try {
  1467. doc = document.implementation.createHTMLDocument("");
  1468. doc.documentElement.innerHTML = text;
  1469. return doc;
  1470. }
  1471. catch (e) {
  1472. alert("parse error");
  1473. }
  1474. };
  1475. var Down;
  1476. var doc = parsetext(result.responseText);
  1477. var t = $(doc).find(selection);
  1478. callback(t);
  1479. }
  1480. });
  1481. }
  1482.  
  1483. function Dates(){
  1484. var sDate=new Date();
  1485. return sDate.getFullYear()+'/'+(sDate.getMonth()+1)+'/'+sDate.getDate();
  1486. }
  1487.  
  1488.  
  1489. function Fn_MessageUI(content){
  1490. GM_addStyle(`
  1491. #MessageUI {
  1492. width: 100%;
  1493. position: fixed;
  1494. left: 0;
  1495. top: 0;
  1496. z-index: 99999999;
  1497. pointer-events: none;
  1498. }
  1499. #MessageUI * {
  1500. pointer-events: auto;
  1501. }
  1502. #MessageUI_Btn {
  1503. position: relative;
  1504. margin: 0 auto;
  1505. padding: 1px 0;
  1506. width: 100px;
  1507. height: 16px;
  1508. color: #000;
  1509. font-size: 12px;
  1510. line-height: 10px;
  1511. cursor: pointer;
  1512. text-align: center;
  1513. border: 1px solid #AAA;
  1514. border-radius: 0 0 12px 12px;
  1515. background-color: #fff;
  1516. box-shadow: 0 0 5px rgba(0, 0, 0, .1);
  1517. }
  1518. #MessageUI_Btn:hover {
  1519. color: rgba(0, 0, 0, .8);
  1520. background-color: rgba(255, 255, 255, 0.8);
  1521. }
  1522. #MessageUI_Panel {
  1523. display: none;
  1524. border-top: 5px solid #65adff;
  1525. background-color: #FFF;
  1526. box-shadow: 0 0 5px rgba(0, 0, 0, .1);
  1527. }
  1528. #MessageUI_Panel > #MessageUI_Panel_Content {
  1529. display: flex;
  1530. flex: 1 1 none;
  1531. flex-wrap: wrap;
  1532. width: 100%;
  1533. max-width: 1400px;
  1534. margin: 0 auto;
  1535. padding: 16px 20px;
  1536. position: relative;
  1537. }
  1538. `);
  1539. /** 添加界面 **/
  1540. var MessageUI=$('<div>').attr({'id':'MessageUI'}),
  1541. MessageUI_Btn=$('<div>').attr({'id':'MessageUI_Btn'}).text('查看网盘信息'),
  1542. MessageUI_Panel=$('<div>').attr({'id':'MessageUI_Panel'}),
  1543. MessageUI_Panel_Content=$('<div>').attr({'id':'MessageUI_Panel_Content'});
  1544.  
  1545. MessageUI_Btn.click(function(ele){
  1546. var eleStyle = MessageUI_Panel.css('display');
  1547. if(MessageUI_Panel.css('display') === 'none'){
  1548. MessageUI_Panel.css('display','block');
  1549. MessageUI_Btn.text('收起网盘信息');
  1550. } else {
  1551. MessageUI_Panel.css('display','');
  1552. MessageUI_Btn.text('查看网盘信息');
  1553. }
  1554. });
  1555.  
  1556. MessageUI_Panel_Content.html(content);
  1557.  
  1558. $('body').after(MessageUI.append(MessageUI_Btn, MessageUI_Panel.append(MessageUI_Panel_Content)));
  1559. }
  1560. })();