万能验证码自动输入(升级版)

自动识别填写英文、数字、滑动拼图、滑动行为等验证码,对于自动规则无法覆盖的验证码页面请手动配置规则。感谢老六、哈士奇两位大佬提供的帮助!

  1. // ==UserScript==
  2. // @name 万能验证码自动输入(升级版)
  3. // @namespace https://www.like996.icu:1205/
  4. // @version 6.5
  5. // @description 自动识别填写英文、数字、滑动拼图、滑动行为等验证码,对于自动规则无法覆盖的验证码页面请手动配置规则。感谢老六、哈士奇两位大佬提供的帮助!
  6. // @author crab
  7. // @match *://*/*
  8. // @connect like996.icu
  9. // @connect *
  10. // @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
  11. // @require http://ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js
  12. // @resource cktools https://like996.icu:1205/statics/js/CKTools.js
  13. // @grant GM_setValue
  14. // @grant GM_getValue
  15. // @grant GM_listValues
  16. // @grant GM_openInTab
  17. // @grant GM_registerMenuCommand
  18. // @grant GM_unregisterMenuCommand
  19. // @grant GM_xmlhttpRequest
  20. // @grant GM_getResourceText
  21. // @nocompat Chrome
  22. // ==/UserScript==
  23.  
  24. let Set = undefined;
  25.  
  26. class CaptchaWrite {
  27. IdCard() {
  28. return Set["idCard"] == undefined ? "" : Set["idCard"];
  29. }
  30.  
  31. getCaptchaServerUrl() {
  32. return "https://www.like996.icu:1205/";
  33. }
  34.  
  35. constructor() {
  36. this.Tip = this.AddTip();
  37. if (GM_listValues().indexOf("set") == -1) {
  38. var WhetherHelp = confirm("万能验证码填入\n初始化完毕!\n在将来的时间里将会在后台默默的为你\n自动识别页面是否存在验证码并填入。\n对于一些书写不规整的验证码页面请手动添加规则。\n如需查看使用帮助请点击确认。");
  39. if (WhetherHelp == true) {
  40. this.openHelp();
  41. }
  42. }
  43. Set = GM_getValue("set");
  44. Set = Set == undefined ? {} : Set;
  45. // 设置自动识别初始值(注意:此处包含您的识别码,请勿随意发送给他人,否则将会造成泄漏!)
  46. var configSetKeys = {
  47. "autoIdentification": "true",
  48. "showHintCheck": "true",
  49. "warningTone": "true",
  50. "autoBlackList": "false",
  51. "hotKeyToImgResult": "false",
  52. "idCard": undefined
  53. };
  54. $.each(configSetKeys, function (key, val) {
  55. if (Set[key] == undefined) {
  56. Set[key] = val;
  57. GM_setValue("set", Set);
  58. }
  59. });
  60. }
  61.  
  62. // 恢复出厂设置
  63. clearSet() {
  64. var that = this;
  65. let res = confirm('您确认要恢复出厂设置吗?注意:清除后所有内容均需重新设置!');
  66. if (res == true) {
  67. GM_setValue("set", { "idCard": "" });
  68. }
  69. return res;
  70. }
  71.  
  72. // 打开帮助页面
  73. openHelp() {
  74. return GM_openInTab(this.getCaptchaServerUrl() + "help.html", {
  75. active: true
  76. });
  77. }
  78.  
  79. //手动添加英数规则
  80. LetterPickUp() {
  81. let that = this;
  82. let AddRule = {};
  83. let IdentifyResult = '';
  84. that.Hint('请对验证码图片点击右键!', 1000 * 50);
  85. $("canvas,img,input[type='image']").each(function () {
  86. $(this).on("contextmenu mousedown", function (e) {// 为了避免某些hook的拦截
  87. if (e.button != 2) {//不为右键则返回
  88. return;
  89. }
  90. if (that.getCapFoowwLocalStorage("crabAddRuleLock") != null) {
  91. return;
  92. }
  93. that.setCapFoowwLocalStorage("crabAddRuleLock", "lock", new Date().getTime() + 100);//100毫秒内只能1次
  94. let img = that.Aimed($(this));
  95. console.log('[手动添加规则]验证码图片规则为:' + img);
  96. if ($(img).length != 1) {
  97. that.Hint('验证码选择错误,该图片实际对应多个元素。')
  98. return;
  99. }
  100.  
  101. that.Hint('等待识别')
  102. IdentifyResult = that.ImgPathToResult(img, function ManualRule(img, IdentifyResult) {
  103. if (img && IdentifyResult) {
  104. console.log('记录信息' + img + IdentifyResult);
  105. AddRule['img'] = img;
  106. $("img").each(function () {
  107. $(this).off("click");
  108. $(this).off("on");
  109. $(this).off("load");
  110. });
  111. that.Hint('接下来请点击验证码输入框', 1000 * 50);
  112. $("input").each(function () {
  113. $(this).click(function () {
  114. var input = that.Aimed($(this));
  115. // console.log('LetterPickUp_input' + input);
  116. AddRule['input'] = input;
  117. AddRule['path'] = window.location.href;
  118. AddRule['title'] = document.title;
  119. AddRule['host'] = window.location.host;
  120. AddRule['ocr_type'] = 1;
  121. AddRule['idcard'] = that.IdCard();
  122. that.WriteImgCodeResult(IdentifyResult, input);
  123. that.Hint('完成')
  124. //移除事件
  125. $("input").each(function () {
  126. $(this).off("click");
  127. });
  128. //添加信息
  129. that.Query({
  130. "method": "captchaHostAdd", "data": AddRule
  131. }, function (data) {
  132. writeResultIntervals[writeResultIntervals.length] = {"img": img, "input": input}
  133. });
  134. that.delCapFoowwLocalStorage(window.location.host);
  135. });
  136. });
  137. }
  138. });
  139. });
  140. });
  141. that.sendPostMessage("LetterPickUp")
  142. }
  143.  
  144. //手动添加滑动拼图规则
  145. SlidePickUp() {
  146. crabCaptcha.Hint('请依次点击滑动拼图验证码的大图、小图、滑块(若无法区分请前往官网查看帮助文档)。', 1000 * 50)
  147. $("canvas,img,div,button").each(function () {
  148. $(this).on("contextmenu mousedown click", function (e) {// 为了避免某些hook的拦截
  149. if (e.type != 'click' && e.button != 2) {//不为右键则返回
  150. return;
  151. }
  152. crabCaptcha.onSlideTagClick(e);
  153. });
  154. });
  155.  
  156. crabCaptcha.sendPostMessage("SlidePickUp");
  157. }
  158.  
  159. //递归发送postMessage给iframe中得脚本
  160. sendPostMessage(funName) {
  161. const iframes = document.querySelectorAll("iframe");
  162. iframes.forEach((iframe) => {
  163. iframe.contentWindow.postMessage({
  164. sign: "crab",
  165. action: funName,
  166. }, "*");
  167. });
  168. }
  169.  
  170. // 添加滑动拼图规则
  171. onSlideTagClick(e) {
  172. var that = this;
  173. let el = e.target;
  174. let tagName = el.tagName.toLowerCase();
  175. let eleWidth = Number(that.getNumber(that.getElementStyle(el).width)) || 0;
  176. let eleHeight = Number(that.getNumber(that.getElementStyle(el).height)) || 0;
  177. let eleTop = Number($(el).offset().top) || 0;
  178. let storagePathCache = that.getCapFoowwLocalStorage("slidePathCache");
  179. let ruleCache = (storagePathCache && storagePathCache) || {ocr_type: 4};
  180.  
  181. if (tagName === "img") {
  182. if (eleWidth >= eleHeight && eleWidth > 150) {
  183. ruleCache['big_image'] = that.Aimed(el);
  184. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  185. that.Hint('您已成功选择大图片。', 5000);
  186. that.checkTargetNeedZIndex(ruleCache, el);
  187. } else if (eleWidth < 100 && eleWidth > 15 && eleWidth - eleHeight <= 10) {
  188. ruleCache['small_image'] = that.Aimed(el);
  189. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  190. that.Hint('您已成功选择小图片。', 5000);
  191. that.checkTargetNeedZIndex(ruleCache, el);
  192. }
  193. } else {
  194. let curEl = el;
  195. for (let i = 0; i < 3; i++) {
  196. if (!curEl || curEl === Window) {
  197. break;
  198. }
  199. let position = that.getElementStyle(curEl).position;
  200. let bgUrl = that.getElementStyle(curEl)["backgroundImage"];
  201. eleWidth = Number(that.getNumber(that.getElementStyle(curEl).width)) || 0;
  202. eleHeight = Number(that.getNumber(that.getElementStyle(curEl).height)) || 0;
  203.  
  204. if (position === "absolute" && eleWidth < 100 && eleHeight < 100) {
  205. //如果是绝对定位,并且宽高小于100,基本上就是滑块了
  206. var smallImgRule = null;
  207. if (storagePathCache != null && (smallImgRule = storagePathCache['small_image']) != null) {
  208. //检查一下滑块是否比小图低
  209. if ($(smallImgRule).offset().top < eleTop) {
  210. ruleCache['move_item'] = that.Aimed(curEl);
  211. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  212. that.Hint('您已成功选择滑块。', 5000);
  213. break;
  214. }
  215. }
  216. }
  217. let reg = /url\("(.+)"\)/im;
  218. if (bgUrl && bgUrl.match(reg)) {
  219. // 根据背景图去做操作
  220. if (eleWidth >= eleHeight && eleWidth > 150) {
  221. ruleCache['big_image'] = that.Aimed(el);
  222. that.Hint('您已成功选择大图片。', 5000);
  223. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  224. that.checkTargetNeedZIndex(ruleCache, curEl);
  225. break;
  226. } else if (eleWidth < 100 && eleWidth > 15 && eleWidth - eleHeight <= 10) {
  227. ruleCache['small_image'] = that.Aimed(el);
  228. that.Hint('您已成功选择小图片。', 5000);
  229. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  230. that.checkTargetNeedZIndex(ruleCache, curEl);
  231. break;
  232. }
  233. }
  234. if (tagName === "canvas") {
  235. // 如果是canvas 直接寻找class中特定样式
  236. if ((that.checkClassName(curEl, "canvas_bg") || that.checkClassName(curEl.parentNode, "captcha_basic_bg")) || (position != "absolute" && (eleWidth > 300 && eleWidth >= eleHeight * 1.5 && eleWidth <= eleHeight * 3))) {
  237. ruleCache['big_image'] = that.Aimed(el);
  238. that.Hint('您已成功选择大图片。', 5000);
  239. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  240. that.checkTargetNeedZIndex(ruleCache, curEl);
  241. break;
  242. } else if (that.checkClassName(curEl, "slide") || that.checkClassName(curEl, "slice") || that.checkClassName(curEl, "mark") || that.checkClassName(curEl, "block")) {
  243. ruleCache['small_image'] = that.Aimed(el);
  244. that.Hint('您已成功选择小图片。', 5000);
  245. that.setCapFoowwLocalStorage("slidePathCache", ruleCache, new Date().getTime() + 1000 * 60);
  246. that.checkTargetNeedZIndex(ruleCache, curEl);
  247. break;
  248. }
  249. }
  250.  
  251. curEl = curEl.parentNode;
  252. }
  253.  
  254. curEl = el;
  255. const firstImg = curEl.querySelector("img");
  256. firstImg && that.onSlideTagClick({target: firstImg});
  257. }
  258. const finish = Object.keys(ruleCache).filter((item) => item).length == 4;
  259. if (finish) {
  260. $("canvas,img,div").each(function () {
  261. $(this).off("click");
  262. });
  263.  
  264. var AddRule = {};
  265. AddRule['path'] = window.location.href;
  266. AddRule['title'] = document.title;
  267. AddRule['host'] = window.location.host;
  268. AddRule['idcard'] = that.IdCard();
  269.  
  270. for (var key in ruleCache) {
  271. AddRule[key] = ruleCache[key];
  272. }
  273.  
  274. //添加规则
  275. that.Query({"method": "captchaHostAdd", "data": AddRule});
  276.  
  277. that.Hint('规则添加完毕,开始识别中。', 5000);
  278. ruleCache.ocrType = 4;
  279. writeResultIntervals[writeResultIntervals.length] = ruleCache;
  280. that.checkSlideCaptcha(ruleCache);
  281. that.delCapFoowwLocalStorage("slidePathCache")
  282. }
  283. }
  284.  
  285. /**
  286. * 判断是否存在指定className
  287. * @param curEl
  288. * @param Name
  289. * @returns {boolean}
  290. */
  291. checkClassName(curEl, Name) {
  292. var a = curEl.classList;
  293. for (var i = 0; i < a.length; i++) {
  294. if (a[i].indexOf(Name) != -1) {
  295. return true;
  296. }
  297. }
  298. return false;
  299. }
  300.  
  301. /**
  302. * 判断判断滑块元素是否需要降级
  303. * @param curEl
  304. * @param Name
  305. * @returns {boolean}
  306. */
  307. checkTargetNeedZIndex(ruleCache, curEl) {
  308. if (ruleCache['big_image'] != null && ruleCache['small_image'] != null) {
  309. $(ruleCache['big_image']).css("z-index", "9998");
  310. $(ruleCache['small_image']).css("z-index", "9999");
  311. } else {
  312. $(curEl).css("z-index", "-1");
  313. }
  314. return false;
  315. }
  316.  
  317. // 检查滑动拼图验证码并识别
  318. checkSlideCaptcha(slideCache) {
  319. var that = this;
  320. const {big_image, small_image, move_item} = slideCache;
  321.  
  322. document.querySelector(big_image).onload = function () {
  323. that.checkSlideCaptcha(slideCache);
  324. }
  325.  
  326. //判断验证码是否存在并可见
  327. if (!big_image || !small_image || !move_item || document.querySelector(small_image) == null
  328. || document.querySelector(big_image) == null || document.querySelector(move_item) == null
  329. || !$(small_image).is(":visible") || !$(big_image).is(":visible") || !$(move_item).is(":visible")) {
  330. console.log("滑动拼图验证码不可见,本次不识别");
  331. return;
  332. }
  333.  
  334.  
  335. const check = async () => {
  336. var Results = that.getCapFoowwLocalStorage("验证码滑动整体超时锁");
  337. if (Results != null) {
  338. return;
  339. }
  340. console.log("滑动拼图验证码出现,准备开始识别");
  341. var bigImgElem = document.querySelector(big_image);
  342. var smallImgElem = document.querySelector(small_image);
  343. var moveItemElem = document.querySelector(move_item);
  344.  
  345. const big_base64 = await that.ImgElemToBase64(bigImgElem);
  346. const small_base64 = await that.ImgElemToBase64(smallImgElem);
  347. $(bigImgElem).removeAttr("crab-src-base64");
  348. $(smallImgElem).removeAttr("crab-src-base64");
  349. if (small_base64 == null || big_base64 == null) {
  350. console.log("滑动拼图验证码为null");
  351. return;
  352. }
  353.  
  354. var big_base64Hash = that.strHash(big_base64);
  355. if (that.getCapFoowwLocalStorage("滑块识别缓存:" + big_base64Hash) != null) {
  356. return;
  357. }
  358. that.setCapFoowwLocalStorage("滑块识别缓存:" + big_base64Hash, "同一个滑块仅识别一次", new Date().getTime() + (1000 * 60 * 60));//同一个滑块1小时内仅识别一次
  359. this.Hint("开始滑动, 在下一条提示之前,请勿操作鼠标!", 5000)
  360.  
  361. let bigWidth = that.getNumber(that.getElementStyle(bigImgElem)['width']);
  362. let smallWidth = that.getNumber(that.getElementStyle(smallImgElem)['width']);
  363.  
  364. var postData = {
  365. big_image: big_base64,
  366. small_image: small_base64,
  367. big_image_width: bigWidth,
  368. small_image_width: smallWidth,
  369. ocr_type: 4
  370. }
  371.  
  372. that.Identify_Crab(null, postData, function Slide(data) {
  373. console.log("等待滑动距离:" + data.data)
  374. that.moveSideCaptcha(bigImgElem, smallImgElem, moveItemElem, data);
  375. });
  376. }
  377. check();
  378. }
  379.  
  380. //手动添加滑块行为规则
  381. slideBehaviorRule() {
  382. crabCaptcha.Hint('请点击一次滑块。注意:滑块行为类验证码仅有一个滑块!', 1000 * 50)
  383. $("canvas,img,div,button,span").each(function () {
  384. $(this).on("contextmenu mousedown click", function (e) {// 为了避免某些hook的拦截
  385. if (e.type != 'click' && e.button != 2) {//不为右键则返回
  386. return;
  387. }
  388. crabCaptcha.onSlideBehaviorClick(e);
  389. });
  390. });
  391.  
  392. crabCaptcha.sendPostMessage("slideBehaviorRule");
  393. }
  394.  
  395. // 添加滑块行为规则
  396. onSlideBehaviorClick(e) {
  397. var that = this;
  398. let el = e.target;
  399. let eleWidth = Number(that.getNumber(that.getElementStyle(el).width)) || 0;
  400. let eleHeight = Number(that.getNumber(that.getElementStyle(el).height)) || 0;
  401. let storagePathCache = that.getCapFoowwLocalStorage("slidePathCache");
  402.  
  403.  
  404. let curEl = el;
  405. for (let i = 0; i < 3; i++) {
  406. if (!curEl || curEl === Window) {
  407. break;
  408. }
  409. let position = that.getElementStyle(curEl).position;
  410. eleWidth = Number(that.getNumber(that.getElementStyle(curEl).width)) || 0;
  411. eleHeight = Number(that.getNumber(that.getElementStyle(curEl).height)) || 0;
  412.  
  413. if (position === "absolute" && eleWidth < 100 && eleHeight < 100) {
  414. //如果是绝对定位,并且宽高小于100,基本上就是滑块了
  415. $("canvas,img,div").each(function () {
  416. $(this).off("click");
  417. });
  418. let AddRule = (storagePathCache && storagePathCache) || {ocr_type: 5};
  419. AddRule['path'] = window.location.href;
  420. AddRule['title'] = document.title;
  421. AddRule['host'] = window.location.host;
  422. AddRule['move_item'] = that.Aimed(curEl);
  423. AddRule['idcard'] = that.IdCard();
  424.  
  425. //添加规则
  426. that.Query({"method": "captchaHostAdd", "data": AddRule});
  427.  
  428. that.Hint('规则添加完毕,开始识别中。', 5000);
  429. AddRule.ocrType = 5;
  430. writeResultIntervals[writeResultIntervals.length] = AddRule;
  431. that.checkSlideBehaviorCaptcha(AddRule);
  432. that.delCapFoowwLocalStorage("slidePathCache")
  433. that.Hint('您已成功选择滑块。', 5000);
  434. break;
  435. }
  436. curEl = curEl.parentNode;
  437. }
  438. }
  439.  
  440. // 检查滑块行为验证码并识别
  441. checkSlideBehaviorCaptcha(slideCache) {
  442. var that = this;
  443. const {move_item} = slideCache;
  444.  
  445. //判断验证码是否存在并可见
  446. if (!move_item || document.querySelector(move_item) == null || !$(move_item).is(":visible")) {
  447. // console.log("滑块行为验证码不可见,本次不识别");
  448. return;
  449. }
  450.  
  451. const check = async () => {
  452. var Results = that.getCapFoowwLocalStorage("验证码滑动整体超时锁");
  453. if (Results != null) {
  454. return;
  455. }
  456. console.log("滑块行为验证码出现,准备开始识别");
  457. var moveItemElem = document.querySelector(move_item);
  458.  
  459. let moveItemParentElemStyles = that.getElementStyle(moveItemElem.parentNode);
  460. let moveItemElemStyles = that.getElementStyle(moveItemElem);
  461. let left = that.getNumber(moveItemElemStyles.left);
  462. let small_image_width = that.getNumber(moveItemParentElemStyles.width);
  463. if (left != 0) {
  464. return;
  465. }
  466. if (that.getCapFoowwLocalStorage("滑块行为识别缓存:" + small_image_width) != null) {
  467. return;
  468. }
  469. that.setCapFoowwLocalStorage("滑块行为识别缓存:" + small_image_width, "同一个滑块仅识别一次", new Date().getTime() + (1000 * 60));
  470. this.Hint("开始滑动, 在下一条提示之前,请勿操作鼠标!", 5000)
  471.  
  472. var postData = {
  473. small_image: "5oqx5q2J77yM5Li65LqG56iL5bqP55qE5Y+R5bGV5Y+v5o6n77yM5q2k5aSE5b+F6aG75Lyg5Y+C5Yiw5LqR56uv44CC",
  474. small_image_width: small_image_width,
  475. salt: new Date().getTime(),
  476. ocr_type: 5
  477. }
  478.  
  479. that.Identify_Crab(null, postData, function Slide(data) {
  480. console.log("等待滑动距离:" + data.data)
  481. that.moveSideCaptcha(moveItemElem, moveItemElem, moveItemElem, data);
  482. that.delCapFoowwLocalStorage("滑块行为识别缓存:" + small_image_width);
  483. });
  484. }
  485. check();
  486. }
  487.  
  488. /**
  489. * 滑动事件
  490. * @param targetImg 小图片
  491. * @param moveItem 按钮
  492. * @param distance 滑动距离
  493. */
  494. moveSideCaptcha(bigImg, smallImg, moveItem, data) {
  495. const that = this;
  496. let distance = that.getNumber(data.data);
  497. if (distance === 0) {
  498. console.log("滑动距离不可为0", distance);
  499. return;
  500. }
  501. distance=distance+5;
  502.  
  503. const btn = moveItem;
  504. let target = smallImg;
  505.  
  506. // 剩余滑动距离
  507. let varible = null;
  508. // 上次剩余滑动距离(可能存在识别错误滑到头了滑不动的情况)
  509. let oldVarible = null;
  510. // 获得初始滑块左侧距离
  511. let targetLeft = that.getNumber(that.getElementStyle(target).left) || 0;
  512. let targetWidth = that.getNumber(that.getElementStyle(target).width) || 0;
  513. let targetMargin = that.getNumber(that.getElementStyle(target).marginLeft) || 0;
  514. let targetParentLeft = that.getNumber(that.getElementStyle(target.parentNode).left) || 0;
  515. let targetParentMargin = that.getNumber(that.getElementStyle(target.parentNode).marginLeft) || 0;
  516. let targetTransform = that.getNumber(that.getEleTransform(target)) || 0;
  517. let targetParentTransform = that.getNumber(that.getEleTransform(target.parentNode)) || 0;
  518.  
  519. // 滑块与小图元素距离屏幕左侧的差距(用于后期取不到滑动距离切换参照物的差值)
  520. let eledifference = moveItem.getBoundingClientRect().x - smallImg.getBoundingClientRect().x;
  521.  
  522. // 小图与大图元素距离屏幕左侧的差距(用于后期取不到滑动距离切换参照物的差值)
  523. let bigToSmaill = smallImg.getBoundingClientRect().x - bigImg.getBoundingClientRect().x;
  524.  
  525. var rect = btn.getBoundingClientRect();
  526. //鼠标指针在屏幕上的坐标;
  527. var screenX = rect.x;
  528. var screenY = rect.y;
  529. //鼠标指针在浏览器窗口内的坐标;
  530. var clientX = screenX + rect.width / 2 - 2;
  531. var clientY = screenY + rect.height / 2 - 2;
  532.  
  533. // 初始化 MouseEvent 对象
  534. const mousedown = new MouseEvent("mousedown", {
  535. bubbles: true,
  536. cancelable: true,
  537. view: document.defaultView,
  538. detail: 0,
  539. screenX: screenX,
  540. screenY: screenY,
  541. clientX: clientX,
  542. clientY: clientY,
  543. });
  544. btn.dispatchEvent(mousedown);
  545.  
  546. let dx = 0;
  547. let dy = 0;
  548. // 总滑动次数
  549. let sideCount = 0;
  550. // 滑不动了的次数
  551. let sideMaxCount = 0;
  552. // 滑动取值规则
  553. let crabRuleId = 0;
  554. // 滑动速度
  555. let runTime = 0;
  556. // 突进滑动距离
  557. let firstLength = 20;
  558. // 是否完成
  559. let isFinish = false;
  560.  
  561. //持续滑动
  562. function continueSide() {
  563. setTimeout(function () {
  564. var intervalLock = that.getCapFoowwLocalStorage("验证码滑动整体超时锁");
  565. if (intervalLock == null) {
  566. that.setCapFoowwLocalStorage("验证码滑动整体超时锁", {time: new Date().getTime()}, new Date().getTime() + (1000 * 10));
  567. } else {
  568. // 采用自解开锁模式
  569. if (intervalLock.time + 1000 * 3 < new Date().getTime()) {
  570. that.Hint("本次滑动超时请刷新验证码后重试,若该页面多次出现此问题请联系群内志愿者处理。", 2000);
  571. that.finishSide(btn, distance, 0, distance, 0);
  572. return;
  573. }
  574. }
  575.  
  576. if (sideCount > 20 && varible == null && btn != null) {
  577. //如果10次循环了已滑动的距离还是null,则使用按钮的距离
  578. console.log("使用按钮得距离计算剩余")
  579. let targetWidth = that.getNumber(that.getElementStyle(target).width);
  580. let btnWidth = that.getNumber(that.getElementStyle(btn).width);
  581. //正常来说,小图片应该比滑块的宽度小,此处做*2加权判断
  582. if (targetWidth < btnWidth * 2) {
  583. // 滑块一般贴近左边,而小图可能稍稍向右,所以总滑动距离-滑块得差
  584. distance = distance + eledifference;
  585. } else {
  586. distance = distance - 2.5;
  587. }
  588. target = btn;
  589. }
  590. let newTargetLeft = that.getNumber(that.getElementStyle(target).left) || 0;
  591. let newTargetMargin = that.getNumber(that.getElementStyle(target).marginLeft) || 0;
  592. let newTargetParentLeft = that.getNumber(that.getElementStyle(target.parentNode).left) || 0;
  593. let newTargetParentMargin = that.getNumber(that.getElementStyle(target.parentNode).marginLeft) || 0;
  594. let newTargetTransform = that.getNumber(that.getEleTransform(target)) || 0;
  595. let newTargetParentTransform = that.getNumber(that.getEleTransform(target.parentNode)) || 0;
  596. let newTargetWidth = that.getNumber(that.getElementStyle(target).width) || 0;
  597.  
  598. if (newTargetLeft !== targetLeft || crabRuleId == 1) {
  599. varible = newTargetLeft;
  600. targetLeft = newTargetLeft;
  601. crabRuleId = 1;
  602. } else if (newTargetParentLeft !== targetParentLeft || crabRuleId == 2) {
  603. varible = newTargetParentLeft;
  604. targetParentLeft = newTargetParentLeft;
  605. crabRuleId = 2;
  606. } else if (newTargetTransform !== targetTransform || targetTransform != 0 || crabRuleId == 3) {
  607. varible = newTargetTransform;
  608. targetTransform = newTargetTransform;
  609. crabRuleId = 3;
  610. } else if (newTargetParentTransform != targetParentTransform || crabRuleId == 4) {
  611. varible = newTargetParentTransform;
  612. targetParentTransform = newTargetParentTransform;
  613. crabRuleId = 4;
  614. } else if (newTargetMargin != targetMargin || crabRuleId == 5) {
  615. varible = newTargetMargin;
  616. targetMargin = newTargetMargin;
  617. crabRuleId = 5;
  618. } else if (newTargetParentMargin != targetParentMargin || crabRuleId == 6) {
  619. if (bigToSmaill != 0) {
  620. newTargetParentMargin = newTargetParentMargin + bigToSmaill;
  621. }
  622. varible = newTargetParentMargin;
  623. targetParentMargin = newTargetParentMargin;
  624. crabRuleId = 6;
  625. }
  626.  
  627. if (varible != null && varible != 0) {
  628. if (varible == oldVarible) {
  629. //发现滑不动了
  630. sideMaxCount += 1;
  631. } else {
  632. sideMaxCount = 0;
  633. }
  634. }
  635. oldVarible = varible;
  636. //本次需要滑出去得距离
  637. let tempDistance = firstLength + Math.random();
  638. // 剩余距离(总距离-已滑动距离)
  639. const residue = distance - varible;
  640. const avg = distance / 10;
  641.  
  642. // 判断距离,计算速度
  643. if (residue > distance / 2) {//距离有一半时,距离较较远,可以高速
  644. runTime = 0.2 + Math.random() * (0.5 - 0.2);
  645. firstLength = 5;
  646. } else if (residue > distance / 4) {//距离有四分之一时,距离较近了,开始减速
  647. runTime = Math.floor(Math.random() * (12 - 8 + 1)) + 8;
  648. firstLength = 3;
  649. } else if (residue > avg) {//四分之一到十分之一
  650. runTime = Math.floor(Math.random() * (12 - 8 + 1)) + 8;
  651. firstLength = 2;
  652. } else if (residue < avg) {//最后十分之一
  653. runTime = Math.floor(Math.random() * 5) + 18;
  654. firstLength = 0;
  655. }
  656.  
  657. // 作者在叨叨:如果这段代码能够帮到你,如果你愿意,可以请我喝杯咖啡么?
  658.  
  659. // 总滑动距离较近,慢点滑动避免超速
  660. if (avg <= 10) {
  661. runTime = runTime * 5;
  662. } else if (avg <= 13) {
  663. runTime = runTime * 2;
  664. }
  665.  
  666. //超过了就让他倒着走
  667. if (residue <= 0) {
  668. tempDistance = tempDistance * -1;
  669. console.log("超过了,倒着走:"+tempDistance);
  670. }
  671.  
  672. console.log("滑动速度:" + runTime + ",剩余距离:" + residue + ",突进距离:" + firstLength);
  673.  
  674. dx += tempDistance;
  675. // 随机定义y得偏差
  676. let sign = Math.random() > 0.5 ? -1 : 1;
  677. dy += -1;
  678.  
  679.  
  680. //鼠标指针在屏幕上的坐标
  681. let _screenX = screenX + dx;
  682. let _screenY = screenY + dy;
  683. //鼠标指针在浏览器窗口内的坐标
  684. let _clientX = clientX + dx;
  685. let _clientY = clientY + dy;
  686.  
  687. // 容错值
  688. const fault = 1;
  689. //判断剩余距离是否大于要滑动得距离(1像素误差),或者滑不动了
  690. if (varible != null && (sideMaxCount > 5 || (varible == distance || (varible > distance && varible - fault <= distance) || (varible < distance && varible + fault >= distance)))) {
  691. if (isFinish) {
  692. console.log("滑动完毕,等待清除事件");
  693. that.finishSide(btn, _screenX, _screenY, _clientX, _clientY);
  694. that.Hint(data.description, data.showTime)
  695. return;
  696. }
  697. console.log("故意跳过,使其缓慢回溯");
  698. isFinish = true;
  699. distance-=5;
  700. }
  701.  
  702.  
  703. const mousemove = new MouseEvent('mousemove', {
  704. bubbles: true,
  705. cancelable: true,
  706. view: document.defaultView,
  707. screenX: _screenX,
  708. screenY: _screenY,
  709. clientX: _clientX,
  710. clientY: _clientY
  711. });
  712. btn.dispatchEvent(mousemove);
  713. sideCount += 1;
  714.  
  715. //再次执行
  716. continueSide();
  717. }, runTime);
  718. }
  719.  
  720. continueSide();
  721. }
  722.  
  723. // 完成滑动
  724. finishSide(btn, _screenX, _screenY, _clientX, _clientY) {
  725. var that = this;
  726. var eventList = ["mouseup"]
  727. for (var i = 0; i < eventList.length; i++) {
  728. var mouseup = new MouseEvent(eventList[i], {
  729. bubbles: true,
  730. cancelable: true,
  731. view: document.defaultView,
  732. clientX: _clientX,
  733. clientY: _clientY,
  734. screenX: _screenX,
  735. screenY: _screenY
  736. });
  737. setTimeout(() => {
  738. btn.dispatchEvent(mouseup);
  739. console.log("滑动完毕,释放鼠标");
  740. }, Math.ceil(Math.random() * 500));
  741. }
  742.  
  743. //1秒后解除全局锁,避免网速慢导致验证码刷新不出来
  744. setTimeout(() => {
  745. that.delCapFoowwLocalStorage("验证码滑动整体超时锁");
  746. }, 1000);
  747.  
  748. }
  749.  
  750. getEleTransform(el) {
  751. const style = window.getComputedStyle(el, null);
  752. var transform = style.getPropertyValue("-webkit-transform") || style.getPropertyValue("-moz-transform") || style.getPropertyValue("-ms-transform") || style.getPropertyValue("-o-transform") || style.getPropertyValue("transform") || "null";
  753. return transform && transform.split(",")[4];
  754. }
  755.  
  756. // 字符串转数字
  757. getNumber(str) {
  758. try {
  759. return Number(str.split(".")[0].replace(/[^0-9]/gi, ""));
  760. } catch (e) {
  761. return 0;
  762. }
  763. }
  764.  
  765.  
  766. //创建提示元素
  767. AddTip() {
  768. var TipHtml = $("<div id='like996_identification'></div>").text("Text.");
  769. TipHtml.css({
  770. "background-color": "rgba(211,211,211,0.86)",
  771. "align-items": "center",
  772. "justify-content": "center",
  773. "position": "fixed",
  774. "color": "black",
  775. "top": "-5em",
  776. "height": "2em",
  777. "margin": "0em",
  778. "padding": "0em",
  779. "font-size": "20px",
  780. "width": "100%",
  781. "left": "0",
  782. "right": "0",
  783. "text-align": "center",
  784. "z-index": "9999999999999",
  785. "padding-top": "3px",
  786. display: 'none'
  787.  
  788. });
  789. $("body").append(TipHtml);
  790. return TipHtml;
  791. }
  792.  
  793. //展示提醒
  794. Hint(Content, Duration) {
  795. if (Set["showHintCheck"] != "true") {
  796. return;
  797. }
  798. if (self != top) {
  799. // 如果当前在iframe中,则让父页面去提示
  800. window.parent.postMessage({
  801. sign: "crab",
  802. action: "Hint",
  803. postData: {Content: Content, Duration: Duration}
  804. }, "*");
  805. return;
  806. }
  807. // 处理一下对象传值(很奇怪,这玩意传到最后回出来两层,谁研究透了麻烦告诉我一下)
  808. while (Content?.constructor === Object) {
  809. Content = Content.Content;
  810. Duration = Content.Duration;
  811. }
  812.  
  813. var that = crabCaptcha;
  814.  
  815. that.Tip.stop(true, false).animate({
  816. top: '-5em'
  817. }, 300, function () {
  818. if (Set["warningTone"] == "true") {
  819. Content += that.doWarningTone(Content)
  820. }
  821. Content += "<span style='color:red;float: right;margin-right: 20px;' onclick='document.getElementById(\"like996_identification\").remove()'>X</span>";
  822. that.Tip.show();
  823. that.Tip.html(Content);
  824.  
  825. });
  826. that.Tip.animate({
  827. top: '0em'
  828. }, 500).animate({
  829. top: '0em'
  830. }, Duration ? Duration : 3000).animate({
  831. top: '-5em'
  832. }, 500, function () {
  833. that.Tip.hide();
  834. });
  835. return;
  836. }
  837.  
  838. //查询规则
  839. Query(Json, callback) {
  840. var that = this;
  841. var QueryRule = '';
  842. var LocalStorageData = this.getCapFoowwLocalStorage(Json.method + "_" + Json.data.host);
  843. if (Json.method == 'captchaHostAdd') {
  844. that.delCapFoowwLocalStorage("captchaHostQuery_" + Json.data.host);
  845. LocalStorageData = null;
  846. //清除自动查找验证码功能
  847. clearInterval(this.getCapFoowwLocalStorage("autoRulesIntervalID"));
  848. }
  849. if (LocalStorageData != null) {
  850. console.log("存在本地缓存的验证码识别规则直接使用。")
  851. if (callback != null) {
  852. callback(LocalStorageData);
  853. return;
  854. } else {
  855. return LocalStorageData;
  856. }
  857. }
  858.  
  859. GM_xmlhttpRequest({
  860. url: that.getCaptchaServerUrl() + Json.method,
  861. method: 'POST',
  862. headers: {'Content-Type': 'application/json; charset=utf-8', 'path': window.location.href},
  863. data: JSON.stringify(Json.data),
  864. responseType: "json",
  865. onload: obj => {
  866. var data = obj.response;
  867. if (data.description != undefined) {
  868. that.Hint(data.description)
  869. }
  870. QueryRule = data;
  871. that.setCapFoowwLocalStorage(Json.method + "_" + Json.data.host, data, new Date().getTime() + 1000 * 60)
  872. if (callback != null) {
  873. callback(QueryRule);
  874. }
  875.  
  876. },
  877. onerror: err => {
  878. console.log(err)
  879. }
  880. });
  881.  
  882.  
  883. return QueryRule;
  884. }
  885.  
  886. //开始识别
  887. Start() {
  888. //检查配置中是否有此网站
  889. var that = this;
  890. var Pathname = window.location.href;
  891. var Card = that.IdCard();
  892. if (Set["hotKeyToImgResult"] != "true") {
  893. writeResultInterval = setInterval(function () {
  894. that.WriteResultsInterval();
  895. }, 500);
  896. } else {
  897. crabCaptcha.crabFacebook()
  898. }
  899. that.Query({
  900. "method": "captchaHostQuery", "data": {
  901. "host": window.location.host, "path": Pathname, "idcard": Card
  902. }
  903. }, function (Rule) {
  904. if (Rule.code == 531 || Rule.code == 532) {
  905. console.log('有规则执行规则' + Pathname);
  906. var data = Rule.data;
  907. for (var i = 0; i < data.length; i++) {
  908. writeResultIntervals[i] = data[i];
  909. }
  910. console.log('等待验证码图片出现');
  911. } else if (Rule.code == 530) {
  912. console.log('黑名单' + Pathname);
  913. if (that.getCapFoowwLocalStorage("网站黑名单提示锁") == null) {
  914. that.setCapFoowwLocalStorage("网站黑名单提示锁", "lock", new Date().getTime() + 9999999 * 9999999);//网页黑名单单位时间内仅提示一次
  915. that.Hint('该网站在黑名单中,无法识别。', 5000);
  916. }
  917. return
  918. } else if (Rule.code == 533 && Set["autoIdentification"] == "true") {
  919. //如果当前网页无规则,则启动自动查找验证码功能(无法一直执行否则将大量错误识别!)
  920. console.log('新网站开始自动化验证码查找' + Pathname);
  921. let autoRulesCheckElems = [];
  922. const autoRulesIntervalID = setInterval(function () {
  923. var MatchList = that.AutoRules(autoRulesCheckElems);
  924. if (MatchList != null && MatchList.length > 0) {
  925. //改为定时器绑定,解决快捷键失效问题
  926. writeResultIntervals.splice(0);
  927. console.log('检测到新规则,开始绑定元素');
  928. for (i in MatchList) {
  929. writeResultIntervals[i] = MatchList[i];
  930. }
  931. }
  932. }, 1000);
  933. that.setCapFoowwLocalStorage("autoRulesIntervalID", autoRulesIntervalID, new Date().getTime() + (99999 * 99999));
  934. }
  935. });
  936.  
  937.  
  938. const actions = {
  939. SlidePickUp: that.SlidePickUp,
  940. LetterPickUp: that.LetterPickUp,
  941. slideBehaviorRule: that.slideBehaviorRule,
  942. Hint: that.Hint,
  943. };
  944.  
  945. window.addEventListener(
  946. "message",
  947. (event) => {
  948. const {data = {}} = event || {};
  949. const {sign, action, postData} = data;
  950. if (sign === "crab") {
  951. if (action && actions[action]) {
  952. actions[action](postData);
  953. }
  954. }
  955. },
  956. false
  957. );
  958.  
  959. }
  960.  
  961. // 定时执行绑定验证码img操作
  962. WriteResultsInterval() {
  963. for (var i = 0; i < writeResultIntervals.length; i++) {
  964. var ocrType = writeResultIntervals[i].ocrType;
  965. if (!ocrType || ocrType == 1) {
  966. // 英数验证码
  967. var imgAddr = writeResultIntervals[i].img;
  968. var inputAddr = writeResultIntervals[i].input;
  969. if (document.querySelector(imgAddr) == null || document.querySelector(inputAddr) == null) {
  970. continue;
  971. }
  972. try {
  973. if (this.getCapFoowwLocalStorage("err_" + writeResultIntervals[i].img) == null) {// 写入识别规则之前,先判断她是否有错误
  974. this.RuleBindingElement(imgAddr, inputAddr);
  975. }
  976. } catch (e) {
  977. window.clearInterval(writeResultInterval);
  978. this.addBadWeb(imgAddr, inputAddr);
  979. return;
  980. }
  981. } else if (ocrType == 4) {
  982. //滑动拼图验证码
  983. var big_image = writeResultIntervals[i].big_image;
  984. if (document.querySelector(big_image) == null) {
  985. continue;
  986. }
  987. this.checkSlideCaptcha(writeResultIntervals[i]);
  988. } else if (ocrType == 5) {
  989. //滑块行为验证码
  990. var move_item = writeResultIntervals[i].move_item;
  991. if (document.querySelector(move_item) == null) {
  992. continue;
  993. }
  994. this.checkSlideBehaviorCaptcha(writeResultIntervals[i]);
  995. }
  996. }
  997. }
  998.  
  999. //调用识别接口
  1000. Identify_Crab(img, postData, callback) {
  1001. var that = this;
  1002. var postDataHash = that.strHash(JSON.stringify(postData));
  1003. var Results = that.getCapFoowwLocalStorage("识别结果缓存:" + postDataHash);
  1004. if (Results != null) {
  1005. if (callback.name != 'ManualRule') {// 不为手动直接返回结果
  1006. return Results.data;
  1007. }
  1008. }
  1009. postData["idCard"] = that.IdCard();
  1010. postData["version"] = "6.5";
  1011. that.setCapFoowwLocalStorage("识别结果缓存:" + postDataHash, "识别中..", new Date().getTime() + (9999999 * 9999999));//同一个验证码只识别一次
  1012. var url = that.getCaptchaServerUrl() + "/hello";
  1013. console.log("验证码变动,开始识别");
  1014. GM_xmlhttpRequest({
  1015. url: url,
  1016. method: 'POST',
  1017. headers: {'Content-Type': 'application/json; charset=UTF-8', 'path': window.location.href},
  1018. data: JSON.stringify(postData),
  1019. responseType: "json",
  1020. onload: obj => {
  1021. var data = obj.response;
  1022. if (!data.valid) {
  1023. if (data.description != undefined) {
  1024. that.Hint('识别请求发生错误: ' + data.description, 5000);
  1025. }
  1026. that.setCapFoowwLocalStorage("识别结果缓存:" + postDataHash, data.description, new Date().getTime() + (9999999 * 9999999))
  1027.  
  1028. } else {
  1029.  
  1030. that.setCapFoowwLocalStorage("识别结果缓存:" + postDataHash, data, new Date().getTime() + (9999999 * 9999999))
  1031. if (callback != null) {
  1032. if (callback.name == 'Slide') {
  1033. //滑动识别
  1034. callback(data);
  1035. } else {
  1036. var Results = data.data;
  1037. if (Results.length < 4) {
  1038. that.Hint('验证码识别结果可能错误,请刷新验证码尝试', 5000)
  1039. } else if (data.description != '' && data.description != null) {
  1040. that.Hint(data.description, data.showTime)
  1041. } else {
  1042. that.Hint('验证码识别完成', 500)
  1043. }
  1044. if (callback.name == 'WriteRule') {
  1045. // 自动识别
  1046. callback(data.data);
  1047. } else if (callback.name == 'ManualRule') {
  1048. // 手动添加规则
  1049. callback(img, data.data);
  1050. }
  1051. }
  1052. }
  1053. }
  1054. },
  1055. onerror: err => {
  1056. console.log(err)
  1057. }
  1058. });
  1059.  
  1060. return Results;
  1061. }
  1062.  
  1063. //根据规则提取验证码base64并识别
  1064. async ImgPathToResult(imgElement, callback) {
  1065. var that = this;
  1066. var imgObj = $(imgElement);
  1067. if (!imgObj.is(":visible")) {
  1068. console.log("验证码不可见,本次不识别");
  1069. return;
  1070. }
  1071. try {
  1072. var imgBase64 = await that.ImgElemToBase64(imgObj[0], imgElement);
  1073.  
  1074. if (imgBase64.length < 255) {
  1075. throw new Error("图片大小异常");
  1076. }
  1077. } catch (e) {
  1078. if (callback.name == 'ManualRule') {
  1079. that.Hint('跨域策略,请重新右键点击图片');
  1080. }
  1081. return;
  1082. }
  1083.  
  1084. var postData = {img: imgBase64, ocr_type: 1};
  1085. that.Identify_Crab(imgElement, postData, callback);
  1086. }
  1087.  
  1088. // 图片对象转Base64
  1089. ImgElemToBase64(imgObj) {
  1090. return new Promise((resolve, reject) => {
  1091. var that = this;
  1092. var imgBase64, imgSrc;
  1093. try {
  1094. var elementTagName = imgObj.tagName.toLowerCase();
  1095. if (elementTagName === "img" || elementTagName === "input") {
  1096. imgSrc = $(imgObj).attr("src");
  1097. } else if (elementTagName === "div") {
  1098. imgSrc = that.getElementStyle(imgObj)["backgroundImage"]
  1099. if (imgSrc.trim().indexOf("data:image/") != -1) {
  1100. // 是base64格式的
  1101. imgSrc = imgSrc.match("(data:image/.*?;base64,.*?)[\"']")[1]
  1102. } else {
  1103. // 是url格式的
  1104. imgSrc = imgSrc.split('"')[1];
  1105. }
  1106. }
  1107.  
  1108. if (imgSrc != undefined && imgSrc.indexOf("data:") == 0) {
  1109. // 使用base64页面直显
  1110. imgBase64 = imgSrc;
  1111. // 兼容部分浏览器中replaceAll不存在
  1112. while (imgBase64.indexOf("\n") != -1) {
  1113. imgBase64 = imgBase64.replace("\n", "");
  1114. }
  1115. // 解决存在url编码的换行问题
  1116. while (imgBase64.indexOf("%0D%0A") != -1) {
  1117. imgBase64 = imgBase64.replace("%0D%0A", "");
  1118. }
  1119. } else if (imgSrc != undefined && (((imgSrc.indexOf("http") == 0 || imgSrc.indexOf("//") == 0) && imgSrc.indexOf(window.location.protocol + "//" + window.location.host + "/") == -1) || $(imgObj).attr("crab_err") != undefined)) {
  1120. if (imgSrc.indexOf("//") == 0) {
  1121. imgSrc = window.location.protocol + imgSrc;
  1122. }
  1123. // 跨域模式下单独获取src进行转base64
  1124. var Results = that.getCapFoowwLocalStorage("验证码跨域识别锁:" + imgSrc);
  1125. if (Results != null) {
  1126. reject("验证码跨域识别锁住");
  1127. return;
  1128. }
  1129. that.setCapFoowwLocalStorage("验证码跨域识别锁:" + imgSrc, "避免逻辑错误多次识别", new Date().getTime() + (9999999 * 9999999));//同一个url仅识别一次
  1130.  
  1131. GM_xmlhttpRequest({
  1132. url: imgSrc, method: 'GET', responseType: "blob", onload: obj => {
  1133. if (obj.status == 200) {
  1134. let blob = obj.response;
  1135. let fileReader = new FileReader();
  1136. fileReader.onloadend = (e) => {
  1137. let base64 = e.target.result;
  1138. if (elementTagName == "div") {
  1139. that.setDivImg(base64, imgObj);
  1140. } else {
  1141. $(imgObj).attr("src", base64);
  1142. }
  1143.  
  1144. };
  1145. fileReader.readAsDataURL(blob)
  1146. }
  1147. }, onerror: err => {
  1148. that.Hint('请求跨域图片异常,请联系群内志愿者操作。');
  1149. reject("请求跨域图片异常");
  1150. }
  1151. });
  1152. } else {
  1153. // 使用canvas进行图片转换
  1154. imgBase64 = that.ConversionBase(imgObj);
  1155. }
  1156.  
  1157. var transform = that.getElementStyle(imgObj)['transform'];
  1158. if (transform != 'none' && transform != 'matrix(1, 0, 0, 1, 0, 0)') {
  1159. //图片可能存在旋转
  1160. let rotationBase64 = that.rotationImg(imgObj);
  1161. if (rotationBase64 != null) {
  1162. imgBase64 = rotationBase64;
  1163. }
  1164. }
  1165.  
  1166. resolve(imgBase64.replace(/.*,/, "").trim());
  1167. } catch (e) {
  1168. $(imgObj).attr("crab_err", 1);
  1169. reject("图片转换异常");
  1170. }
  1171.  
  1172. });
  1173. }
  1174.  
  1175. //重新设置div的背景图验证码
  1176. setDivImg(imgBase64, imgObj) {
  1177. var that = this;
  1178. // 创建一个临时的 Image 对象,并设置它的 src 属性为背景图片 URL
  1179. var img = new Image();
  1180. // 创建一个 Canvas 元素
  1181. var canvas = document.createElement('canvas');
  1182. canvas.width = that.getNumber(that.getElementStyle(imgObj)["width"]);
  1183. canvas.height = that.getNumber(that.getElementStyle(imgObj)["height"]);
  1184.  
  1185. // 在 Canvas 上绘制背景图片
  1186. var ctx = canvas.getContext('2d');
  1187.  
  1188. var position = imgObj.style.backgroundPosition;
  1189. var parts = position.split(' ');
  1190. var bgPartsX = 0;
  1191. var bgPartsY = 0;
  1192. if (parts.length == 2) {
  1193. bgPartsX = parseFloat(parts[0].replace(/[^-\d\.]/g, ''));
  1194. bgPartsY = parseFloat(parts[1].replace(/[^-\d\.]/g, ''));
  1195. }
  1196.  
  1197.  
  1198. // 当图片加载完成后执行
  1199. img.onload = function () {
  1200. var position = imgObj.style.backgroundSize;
  1201. var bgSize = position.split(' ');
  1202. var bgSizeW = canvas.width;
  1203. var bgSizeH = canvas.width / img.width * img.height;//有时候页面上的不准,按比例缩放即可
  1204. if (canvas.height == 0) {
  1205. canvas.height = bgSizeH;
  1206. }
  1207. if (bgSize.length == 2) {
  1208. bgSizeW = parseFloat(bgSize[0].replace(/[^-\d\.]/g, ''));
  1209. bgSizeH = parseFloat(bgSize[1].replace(/[^-\d\.]/g, ''));
  1210. }
  1211. if (parts.length == 2 || bgSize.length == 2) {
  1212. ctx.drawImage(img, bgPartsX, bgPartsY, bgSizeW, bgSizeH);
  1213. $(imgObj).css('background-position', '');
  1214. $(imgObj).css('background-size', '');
  1215. } else {
  1216. ctx.drawImage(img, 0, 0);
  1217. }
  1218. // 将截取的图像作为新的背景图片设置到 div 元素中
  1219. $(imgObj).css('background-image', 'url(' + canvas.toDataURL() + ')');
  1220. };
  1221. img.src = imgBase64;
  1222. }
  1223.  
  1224. //绑定规则到元素,并尝试识别
  1225. RuleBindingElement(img, input) {
  1226. var that = this;
  1227. //创建一个触发操作
  1228. let imgObj = img;
  1229. if (typeof (imgObj) == "string") {
  1230. imgObj = document.querySelector(img)
  1231. }
  1232. if (imgObj == null) {
  1233. return;
  1234. }
  1235.  
  1236. imgObj.onload = function () {
  1237. that.RuleBindingElement(imgObj, input)
  1238. }
  1239.  
  1240. this.ImgPathToResult(img, function WriteRule(vcode) {
  1241. that.WriteImgCodeResult(vcode, input)
  1242. })
  1243.  
  1244. }
  1245.  
  1246. //写入操作
  1247. WriteImgCodeResult(ImgCodeResult, WriteInput) {
  1248. var that = this;
  1249. WriteInput = document.querySelector(WriteInput);
  1250. WriteInput.value = ImgCodeResult;
  1251. if (typeof (InputEvent) !== 'undefined') {
  1252. //使用 InputEvent 方法,主流浏览器兼容
  1253. WriteInput.value = ImgCodeResult;
  1254. let eventReactNames = ["input", "change", "focus", "invalid", "keypress", "keydown", "keyup", "input", "blur", "select", "focus"];
  1255. for (var j = 0; j < eventReactNames.length; j++) {
  1256. if (that.FireForReact(WriteInput, eventReactNames[j])) {
  1257. WriteInput.value = ImgCodeResult;
  1258. //return;
  1259. }
  1260. }
  1261. let eventNames = ["keypress", "keydown", "keyup", "input", "blur", "select", "focus"];
  1262. for (var i = 0; i < eventNames.length; i++) {
  1263. that.Fire(WriteInput, eventNames[i]);
  1264. WriteInput.value = ImgCodeResult;
  1265. }
  1266. } else if (KeyboardEvent) {
  1267. //使用 KeyboardEvent 方法,ES6以下的浏览器方法
  1268. WriteInput.dispatchEvent(new KeyboardEvent("input"));
  1269. }
  1270. }
  1271.  
  1272. // 各类原生事件
  1273. Fire(element, eventName) {
  1274. var event = document.createEvent("HTMLEvents");
  1275. event.initEvent(eventName, true, true);
  1276. element.dispatchEvent(event);
  1277. }
  1278.  
  1279. // 各类react事件
  1280. FireForReact(element, eventName) {
  1281. try {
  1282. let env = new Event(eventName);
  1283. element.dispatchEvent(env);
  1284. var funName = Object.keys(element).find(p => Object.keys(element[p]).find(f => f.toLowerCase().endsWith(eventName)));
  1285. if (funName != undefined) {
  1286. element[funName].onChange(env)
  1287. return true;
  1288. }
  1289. } catch (e) {
  1290. // console.log("各类react事件调用出错!")
  1291. }
  1292. return false;
  1293.  
  1294. }
  1295.  
  1296. //转换图片为:canvas
  1297. ConversionBase(img) {
  1298. var canvas = document.createElement("canvas");
  1299. canvas.width = img.width;
  1300. canvas.height = img.height;
  1301. var ctx = canvas.getContext("2d");
  1302. ctx.drawImage(img, 0, 0, img.width, img.height);
  1303. var imgObj = $(img);
  1304. try {
  1305. //尝试直接转换,如果失败,可能存在跨域
  1306. return canvas.toDataURL("image/png");
  1307. } catch (e) {
  1308. // 对跨域的场景进行处理
  1309. let imgSrc = imgObj.attr("crab-src");
  1310. let imgBase64 = imgObj.attr("crab-src-base64");
  1311.  
  1312. if (imgBase64 != undefined) {
  1313. return imgBase64;
  1314. }
  1315. if (imgSrc == undefined) {
  1316. throw new Error("canvas图片跨域,无法加载!");
  1317. }
  1318. // 跨域模式下单独获取src进行转base64
  1319. var Results = this.getCapFoowwLocalStorage("验证码跨域识别锁:" + imgSrc);
  1320. if (Results != null) {
  1321. return null;
  1322. }
  1323. this.setCapFoowwLocalStorage("验证码跨域识别锁:" + imgSrc, "避免逻辑错误多次识别", new Date().getTime() + (9999999 * 9999999));//同一个url仅识别一次
  1324.  
  1325.  
  1326. this.Hint('正在处理跨域验证码请勿操作鼠标!');
  1327. GM_xmlhttpRequest({
  1328. url: imgSrc,
  1329. method: 'GET',
  1330. responseType: "blob",
  1331. onload: (response) => {
  1332. if (response.status === 200) {
  1333. const blob = response.response;
  1334. const fileReader = new FileReader();
  1335. fileReader.onloadend = (e) => {
  1336. const base64 = e.target.result;
  1337. $(img).attr("crab-src-base64", base64);
  1338. }
  1339. fileReader.readAsDataURL(blob);
  1340. }
  1341. }
  1342. });
  1343. }
  1344. }
  1345.  
  1346.  
  1347. // 部分滑动图片可能存在旋转,需要修正
  1348. rotationImg(img) {
  1349. let style = window.getComputedStyle(img); // 获取元素的样式
  1350. let matrix = new DOMMatrixReadOnly(style.transform); // 将样式中的 transform 属性值转换成 DOMMatrix 对象
  1351. var angle = Math.round(Math.atan2(matrix.b, matrix.a) * (180 / Math.PI)); // 通过 DOMMatrix 对象计算旋转角度
  1352. if (angle != 0) {
  1353. let canvas = document.createElement("canvas");
  1354. let ctx = canvas.getContext('2d');
  1355. let width = img.naturalWidth;
  1356. let height = img.naturalHeight;
  1357. canvas.width = width;
  1358. canvas.height = canvas.width * width / height;
  1359. ctx.translate(canvas.width * 0.5, canvas.height * 0.5);
  1360. ctx.rotate(angle * Math.PI / 180);
  1361. ctx.drawImage(img, -canvas.height / 2, -canvas.width / 2, canvas.height, canvas.width);
  1362. return canvas.toDataURL("image/png");
  1363. }
  1364. return null;
  1365.  
  1366. }
  1367.  
  1368. hashCode(strKey) {
  1369. var hash = 0;
  1370. if (strKey != null && strKey != "") {
  1371. for (var i = 0; i < strKey.length; i++) {
  1372. hash = hash * 31 + strKey.charCodeAt(i);
  1373. hash = this.intValue(hash);
  1374. }
  1375. }
  1376. return hash;
  1377. }
  1378.  
  1379. intValue(num) {
  1380. var MAX_VALUE = 0x7fffffff;
  1381. var MIN_VALUE = -0x80000000;
  1382. if (num > MAX_VALUE || num < MIN_VALUE) {
  1383. return num &= 0xFFFFFFFF;
  1384. }
  1385. return num;
  1386. }
  1387.  
  1388. //自动规则
  1389. AutoRules(autoRulesCheckElems) {
  1390. var that = this;
  1391. if (autoRulesCheckElems.length > 1500) {
  1392. //如果一个页面的元素超过1500个,则停止自动规则,避免卡顿
  1393. return;
  1394. }
  1395. // 最终规则
  1396. var MatchList = [];
  1397. //验证码元素
  1398. let captchaMap = [];
  1399. $("canvas,img,input[type='image'],div").each(function () {
  1400. let img = this;
  1401. if (!$(img).is(":visible")) {
  1402. return true;
  1403. }
  1404. let elemCode = that.hashCode($(img).html());
  1405. if (autoRulesCheckElems.indexOf(elemCode) == -1) {
  1406. autoRulesCheckElems.push(elemCode);
  1407. }
  1408.  
  1409. let checkList = [...that.getCaptchaFeature(img), ...that.getCaptchaFeature(img.parentNode),];
  1410. checkList = checkList.filter((item) => item);
  1411. let isInvalid = ["#", "about:blank"].includes(img.getAttribute("src")) || !img.getAttribute("src") || img.getAttribute("src").indexOf("data:") == 0;
  1412. let imgRules = "code,captcha,yzm,check,random,veri,vcodeimg,验证码,看不清,换一张,login,点击,verify,yanzhengma".split(",");
  1413. let isHave = false;
  1414. for (let i = 0; i < checkList.length && !isHave; i++) {
  1415. // 先判null
  1416. if (checkList[i] == null || checkList[i] == undefined || typeof(checkList[i])!="string") {
  1417. continue;
  1418. }
  1419.  
  1420.  
  1421. let elemAttributeData = checkList[i].toLowerCase();
  1422.  
  1423. //如果元素内包含logo字符串,则直接跳过
  1424. if (elemAttributeData.toString().toLowerCase().indexOf("logo") != -1) {
  1425. return true;
  1426. }
  1427.  
  1428.  
  1429. let imgStyles = that.getElementStyle(img);
  1430. let imgWidth = that.getNumber(imgStyles["width"]);
  1431. let imgHeight = that.getNumber(imgStyles["height"]);
  1432. let imgTagName = img.tagName.toLowerCase();
  1433.  
  1434. // 验证码得相关属性需要满足特定字符串,并且宽高及图片属性不能太过分
  1435. for (let j = 0; j < imgRules.length; j++) {
  1436. if (elemAttributeData.indexOf(imgRules[j]) != -1
  1437. && ((imgTagName == "img" && !isInvalid) || imgTagName != "img") && imgWidth > 30 && imgWidth < 150
  1438. && ((imgTagName == "div" && imgStyles['backgroundImage'] != 'none') || imgTagName != "div")
  1439. && imgHeight < 80 && imgHeight != imgWidth) {
  1440. captchaMap.push({"img": img, "input": null})
  1441. isHave = true;
  1442. break;
  1443. }
  1444. }
  1445.  
  1446. }
  1447.  
  1448. });
  1449. captchaMap.forEach((item) => {
  1450. let imgEle = item.img;
  1451. let parentNode = imgEle.parentNode;
  1452. for (let i = 0; i < 4; i++) {
  1453. // 以当前可能是验证码的图片为基点,向上遍历四层查找可能的Input输入框
  1454. if (!parentNode) {
  1455. return;
  1456. }
  1457. let inputTags = [...parentNode.querySelectorAll("input")];
  1458. if (inputTags.length) {
  1459. let input = inputTags.pop();
  1460. let type = input.getAttribute("type");
  1461. while (type !== "text" && inputTags.length) {
  1462. if (type === "password") {
  1463. break;
  1464. }
  1465. input = inputTags.pop();
  1466. type = input.getAttribute("type");
  1467. }
  1468.  
  1469. let inputWidth = that.getNumber(that.getElementStyle(input).width);
  1470. if (!type || (type === "text" && inputWidth > 50)) {
  1471. // 给目标元素添加边框,证明自动规则选中得
  1472. $(imgEle).css("borderStyle", "solid").css("borderColor", "red").css("border-width", "2px").css("box-sizing", "border-box");
  1473. $(input).css("borderStyle", "solid").css("borderColor", "red").css("border-width", "1px").css("box-sizing", "border-box");
  1474. MatchList.push({"img": that.Aimed(imgEle), "input": that.Aimed(input)})
  1475. break;
  1476. }
  1477. if (type === "password") {
  1478. // 验证码一般在密码框后面,遍历到密码框了就大概率说明没有验证码
  1479. break;
  1480. }
  1481. }
  1482. parentNode = parentNode.parentNode;
  1483. }
  1484. });
  1485.  
  1486. return MatchList;
  1487. }
  1488.  
  1489. // 获取验证码特征
  1490. getCaptchaFeature(el) {
  1491. let checkList = [];
  1492. checkList.push(el.getAttribute("id"));
  1493. checkList.push(el.className);
  1494. checkList.push(el.getAttribute("alt"));
  1495. checkList.push(el.getAttribute("src"));
  1496. checkList.push(el.getAttribute("name"));
  1497. checkList.push(el.getAttribute("title"));
  1498.  
  1499. return checkList;
  1500. }
  1501.  
  1502. //根据元素生成JsPath
  1503. Aimed(Element) {
  1504. // console.log('---根据元素创建配置信息---');
  1505. if (Element.length > 0) {
  1506. Element = Element[0]
  1507. }
  1508. var that = this;
  1509. var ElementLocalName = Element.localName;
  1510. var result;
  1511. // 如果有vue的id,则直接返回
  1512. var vueId = that.getDataV(Element);
  1513. if (vueId != null) {
  1514. result = ElementLocalName + "[" + vueId + "]";
  1515. if ($(result).length == 1) {
  1516. return result;
  1517. }
  1518. }
  1519. // 如果有placeholder,则直接返回
  1520. var placeholder = that.getPlaceholder(Element);
  1521. if (placeholder != null) {
  1522. result = ElementLocalName + "[" + placeholder + "]";
  1523. if ($(result).length == 1) {
  1524. return result;
  1525. }
  1526. }
  1527. // 如果有alt,则直接返回
  1528. var alt = that.getAlt(Element);
  1529. if (alt != null) {
  1530. result = ElementLocalName + "[" + alt + "]";
  1531. if ($(result).length == 1) {
  1532. return result;
  1533. }
  1534. }
  1535.  
  1536. // 如果有name且只有一个,则直接返回
  1537. var selectElement = that.getElementName(Element);
  1538. if (selectElement != null) {
  1539. return selectElement;
  1540. }
  1541.  
  1542. // 如果有src,且src后面无参数则直接返回
  1543. var src = that.getSrc(Element);
  1544. if (src != null && src.length < 200) {
  1545. result = ElementLocalName + "[" + src + "]";
  1546. if ($(result).length == 1) {
  1547. return result;
  1548. }
  1549. }
  1550. // 如果有onClick则直接返回
  1551. var onClick = that.getOnClick(Element);
  1552. if (onClick != null && onClick.length < 200) {
  1553. result = ElementLocalName + "[" + onClick + "]";
  1554. if ($(result).length == 1) {
  1555. return result;
  1556. }
  1557. }
  1558. // 如果有elemClassName则直接返回
  1559. var elemClassName = that.getElementClassName(Element);
  1560. if (elemClassName != null && elemClassName.length < 200) {
  1561. return elemClassName;
  1562. }
  1563.  
  1564. var cssPath = that.getElementCssPath(Element);
  1565. if (cssPath != null && cssPath != "") {
  1566. try {
  1567. //避免样式选择器有时候选到错的无法使用问题
  1568. if ($(cssPath).length == 1) {
  1569. return cssPath;
  1570. }
  1571. } catch (e) {
  1572. }
  1573. }
  1574.  
  1575. var Symbol = (this.getElementId(Element) ? "#" : Element.className ? "." : false);
  1576. var locationAddr;
  1577. if (!Symbol) {
  1578. locationAddr = that.Climb(Element.parentNode, ElementLocalName);
  1579. } else {
  1580. locationAddr = that.Climb(Element, ElementLocalName);
  1581. }
  1582. if ($(locationAddr).length == 1) {
  1583. return locationAddr.trim();
  1584. }
  1585.  
  1586. // if (confirm("当前元素无法自动选中,是否手动指定JsPath?\n(该功能为熟悉JavaScript的用户使用,若您不知道,请点击取消。)\n注意:如果该提示影响到您得操作了,关闭'自动查找验证码'功能即可!")) {
  1587. // result = prompt("请输入待选择元素的JsPath,例如:\n#app > div:nth-child(3) > div > input");
  1588. // try {
  1589. // if ($(result).length == 1) {
  1590. // return result;
  1591. // }
  1592. // } catch (e) {
  1593. // }
  1594. // }
  1595.  
  1596. that.Hint('该网站非标准web结构,暂时无法添加规则,请联系群内志愿者添加。')
  1597. return null;
  1598.  
  1599. }
  1600.  
  1601. //判断元素id是否可信
  1602. getElementId(element) {
  1603. var id = element.id;
  1604. if (id) {
  1605. if (this.checkBadElemId(id)) {// 对抗类似vue这种无意义id
  1606. if (id.length < 40) {// 对抗某些会自动变换id的验证码
  1607. return true;
  1608. }
  1609. }
  1610. }
  1611. return false;
  1612. }
  1613.  
  1614. //爬层级
  1615. Climb(Element, ElementLocalName, Joint = '') {
  1616. var ElementType = (this.getElementId(Element) ? Element.id : Element.className ? Element.className.replace(/\s/g, ".") : false);
  1617. var Symbol = (this.getElementId(Element) ? "#" : Element.className ? "." : false);
  1618. var Address;
  1619. if (ElementType && ElementLocalName == Element.localName) {
  1620. Address = ElementLocalName + Symbol + ElementType;
  1621. } else {
  1622. Address = "";
  1623. if (Symbol != false) {
  1624. Address = Address + Symbol;
  1625. }
  1626. if (ElementType != false) {
  1627. Address = Address + ElementType;
  1628. }
  1629. Address = ' ' + ElementLocalName
  1630. }
  1631. if ($(Address).length == 1) {
  1632. return Address + ' ' + Joint;
  1633. } else {
  1634. Joint = this.Climb($(Element).parent()[0], $(Element).parent()[0].localName, Address + ' ' + Joint)
  1635. return Joint;
  1636. }
  1637. }
  1638.  
  1639. // 获取vue的data-v-xxxx
  1640. getDataV(element) {
  1641. var elementKeys = element.attributes;
  1642. if (elementKeys == null) {
  1643. return null;
  1644. }
  1645. for (var i = 0; i < elementKeys.length; i++) {
  1646. var key = elementKeys[i].name;
  1647. if (key.indexOf("data-v-") != -1) {
  1648. return key;
  1649. }
  1650. }
  1651. return null;
  1652. }
  1653.  
  1654. // 获取placeholder="验证码"
  1655. getPlaceholder(element) {
  1656. var elementKeys = element.attributes;
  1657. if (elementKeys == null) {
  1658. return null;
  1659. }
  1660. for (var i = 0; i < elementKeys.length; i++) {
  1661. var key = elementKeys[i].name.toLowerCase();
  1662. if (key == "placeholder" && elementKeys[i].value != "") {
  1663. return elementKeys[i].name + "='" + elementKeys[i].value + "'";
  1664. }
  1665. }
  1666. return null;
  1667. }
  1668.  
  1669. // 获取alt="kaptcha"
  1670. getAlt(element) {
  1671. var elementKeys = element.attributes;
  1672. if (elementKeys == null) {
  1673. return null;
  1674. }
  1675. for (var i = 0; i < elementKeys.length; i++) {
  1676. var key = elementKeys[i].name.toLowerCase();
  1677. if (key == "alt") {
  1678. return elementKeys[i].name + "='" + elementKeys[i].value + "'";
  1679. }
  1680. }
  1681. return null;
  1682. }
  1683.  
  1684. // 获取src="http://xxx.com"
  1685. getSrc(element) {
  1686. var elementKeys = element.attributes;
  1687. if (elementKeys == null) {
  1688. return null;
  1689. }
  1690. for (var i = 0; i < elementKeys.length; i++) {
  1691. var key = elementKeys[i].name.toLowerCase();
  1692. var value = elementKeys[i].value;
  1693. if (key == "src" && value.indexOf("data:image") != 0) {
  1694. var idenIndex = value.indexOf("?");
  1695. if (idenIndex != -1) {
  1696. value = value.substring(0, idenIndex + 1);
  1697. }
  1698.  
  1699. // 从 URL 中提取文件名
  1700. const filename = value.substring(value.lastIndexOf('/') + 1);
  1701. // 从文件名中提取后缀部分
  1702. const fileExtension = filename.substring(filename.lastIndexOf('.') + 1);
  1703. if (fileExtension == "jpg" || fileExtension == "png" || fileExtension == "gif") {
  1704. // 直接是静态文件,无法作为规则
  1705. return null;
  1706. }
  1707. if (/\d/.test(value)) {
  1708. // 存在数字则可能是时间戳之类得,尝试获取上级目录
  1709. const lastSlashIndex = value.lastIndexOf('/');
  1710. if (lastSlashIndex !== -1) {
  1711. let truncateURL = value.substring(0, lastSlashIndex);
  1712. if (truncateURL.indexOf("blob:") == 0) {
  1713. truncateURL = truncateURL.substring(5, truncateURL.length);
  1714. }
  1715. if (truncateURL.indexOf("http") != 0) {
  1716. truncateURL = "http:" + truncateURL;
  1717. }
  1718. try {
  1719. const url = new URL(value);
  1720. if (url.pathname != "/") {
  1721. value = truncateURL;
  1722. }
  1723. } catch (e) {
  1724. //非标准url,不需要处理,直接返回即可
  1725. }
  1726. }
  1727. }
  1728. return elementKeys[i].name + "^='" + value + "'";
  1729. }
  1730. }
  1731.  
  1732. return null;
  1733. }
  1734.  
  1735. // 判断name是否只有一个
  1736. getElementName(element) {
  1737. var elementName = element.name;
  1738. if (elementName == null || elementName == "") {
  1739. return null;
  1740. }
  1741. var selectElement = element.localName + "[name='" + elementName + "']";
  1742. if ($(selectElement).length == 1) {
  1743. return selectElement;
  1744. }
  1745. return null;
  1746. }
  1747.  
  1748. // 判断OnClick是否只有一个
  1749. getOnClick(element) {
  1750. var elementKeys = element.attributes;
  1751. if (elementKeys == null) {
  1752. return null;
  1753. }
  1754. for (var i = 0; i < elementKeys.length; i++) {
  1755. var key = elementKeys[i].name.toLowerCase();
  1756. var value = elementKeys[i].value;
  1757. if (key == "onclick") {
  1758. var idenIndex = value.indexOf("(");
  1759. if (idenIndex != -1) {
  1760. value = value.substring(0, idenIndex + 1);
  1761. }
  1762. return elementKeys[i].name + "^='" + value + "'";
  1763. }
  1764. }
  1765. return null;
  1766. }
  1767.  
  1768. // 判断ClassName是否只有一个
  1769. getElementClassName(element) {
  1770. var a = element.classList;
  1771. var elementClassName = [];
  1772. for (var i = 0; i < a.length; i++) {
  1773. if (a[i].indexOf("hover") != -1 || a[i].indexOf("active") != -1) {
  1774. continue
  1775. }
  1776. elementClassName.push("." + a[i]);
  1777. }
  1778. if (elementClassName.length == 0) {
  1779. return null;
  1780. }
  1781. var selectElement = element.localName + Array.from(elementClassName).join('');
  1782. if ($(selectElement).length == 1) {
  1783. return selectElement;
  1784. }
  1785. return null;
  1786. }
  1787.  
  1788.  
  1789. // 操作webStorage 增加缓存,减少对服务端的请求
  1790. setCapFoowwLocalStorage(key, value, ttl_ms) {
  1791. var data = {value: value, expirse: new Date(ttl_ms).getTime()};
  1792. sessionStorage.setItem(key, JSON.stringify(data));
  1793. }
  1794.  
  1795. getCapFoowwLocalStorage(key) {
  1796. var data = JSON.parse(sessionStorage.getItem(key));
  1797. if (data !== null) {
  1798. if (data.expirse != null && data.expirse < new Date().getTime()) {
  1799. sessionStorage.removeItem(key);
  1800. } else {
  1801. return data.value;
  1802. }
  1803. }
  1804. return null;
  1805. }
  1806.  
  1807. delCapFoowwLocalStorage(key) {
  1808. window.sessionStorage.removeItem(key);
  1809. }
  1810.  
  1811. // 自动添加识别错误黑名单
  1812. addBadWeb(img, input) {
  1813. if (Set["autoBlackList"] == "false") {
  1814. return;
  1815. }
  1816. this.Hint("识别过程中发生错误,已停止识别此网站!(若验证码消失请刷新网站,需再次启用识别请在'更多设置'中删除所有规则)", 15000);
  1817. this.captchaHostBad(img, input);
  1818. }
  1819.  
  1820. // 手动添加识别错误黑名单
  1821. captchaHostBad(img, input) {
  1822. this.setCapFoowwLocalStorage("err_" + img, "可能存在跨域等问题停止操作它", new Date().getTime() + (1000 * 1000));
  1823. this.delCapFoowwLocalStorage("captchaHostQuery_" + window.location.host);
  1824. this.Query({
  1825. "method": "captchaHostAdd", "data": {
  1826. "host": window.location.host,
  1827. "path": window.location.href,
  1828. "img": img,
  1829. "input": input,
  1830. "title": document.title,
  1831. "type": 0,
  1832. "idcard": this.IdCard()
  1833. }
  1834. }, null);
  1835. }
  1836.  
  1837.  
  1838. // 删除规则
  1839. captchaHostDel() {
  1840. if (!confirm("该操作会导致清除‘" + window.location.host + "’网站下含黑名单在内的所有规则,删除后您需要重新手动添加规则,是否继续?")) {
  1841. return;
  1842. }
  1843. this.delCapFoowwLocalStorage("captchaHostQuery_" + window.location.host);
  1844. this.Query({
  1845. "method": "captchaHostDel", "data": {
  1846. "host": window.location.host,
  1847. "idcard": this.IdCard()
  1848. }
  1849. }, null);
  1850. }
  1851.  
  1852. // 设置识别识别码
  1853. SetIdCard() {
  1854. var that = this;
  1855. let gmGetValue = GM_getValue("set");
  1856. var idCard = gmGetValue["idCard"];
  1857. if (idCard != null && idCard.length == 32) {
  1858. return;
  1859. }
  1860.  
  1861. idCard = prompt("申请地址https://like996.icu:1205\n设置后如需修改可在更多设置中“恢复出厂设置”后重试。\n请输入您的识别码:");
  1862. if (idCard == null || idCard == "") {
  1863. that.Hint('取消设置');
  1864. } else {
  1865. if (idCard.length != 32) {
  1866. that.Hint('识别码应为32位,请参考设置中的“查看帮助”进行自行注册(不可用)!');
  1867. } else {
  1868. GM_setValue("set", {
  1869. "idCard": idCard
  1870. });
  1871. that.Hint('识别码设置完成刷新页面生效。');
  1872. }
  1873.  
  1874. }
  1875. return;
  1876. }
  1877.  
  1878. // 播放音频朗读
  1879. doWarningTone(body) {
  1880. if (body.indexOf(",")) {
  1881. body = body.split(",")[0];
  1882. }
  1883. if (body.indexOf(",")) {
  1884. body = body.split(",")[0];
  1885. }
  1886. if (body.indexOf("!")) {
  1887. body = body.split("!")[0];
  1888. }
  1889. var zhText = encodeURI(body);
  1890. var text = "<audio autoplay='autoplay'>" + "<source src='https://dict.youdao.com/dictvoice?le=zh&audio=" + zhText + "' type='audio/mpeg'>" + "<embed height='0' width='0' src='https://dict.youdao.com/dictvoice?le=zh&audio=" + zhText + "'>" + "</audio>";
  1891. return text;
  1892. }
  1893.  
  1894. // 获取元素的全部样式
  1895. getElementStyle(element) {
  1896. if (window.getComputedStyle) {
  1897. return window.getComputedStyle(element, null);
  1898. } else {
  1899. return element.currentStyle;
  1900. }
  1901. }
  1902.  
  1903.  
  1904. // 获取元素的cssPath选择器
  1905. getElementCssPath(element) {
  1906. if (!(element instanceof Element) || !element.parentElement) {
  1907. return null;
  1908. }
  1909.  
  1910. const path = [];
  1911. while (element.parentElement) {
  1912. let selector = element.nodeName.toLowerCase();
  1913. if (element.id && this.checkBadElemId(element.id)) {
  1914. selector += `#${element.id}`;
  1915. path.unshift(selector);
  1916. break;
  1917. } else {
  1918. const siblings = Array.from(element.parentElement.children).filter(e => e.nodeName.toLowerCase() === selector);
  1919. const index = siblings.indexOf(element);
  1920.  
  1921. if (siblings.length > 1) {
  1922. selector += `:nth-of-type(${index + 1})`;
  1923. }
  1924.  
  1925. path.unshift(selector);
  1926. element = element.parentElement;
  1927. }
  1928. }
  1929.  
  1930. return path.join(' > ');
  1931. }
  1932.  
  1933. //检查是否为随机的Id
  1934. checkBadElemId(idStr) {
  1935. if (idStr.indexOf("exifviewer-img-") != -1) {
  1936. return false;
  1937. }
  1938. const pattern = /[-_]\d$/;
  1939. return !pattern.test(idStr);
  1940. }
  1941.  
  1942. // 获取指定字符串hash
  1943. strHash(input) {
  1944. var I64BIT_TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'.split('');
  1945. var hash = 5381;
  1946. var i = input.length - 1;
  1947.  
  1948. if (typeof input == 'string') {
  1949. for (; i > -1; i--) hash += (hash << 5) + input.charCodeAt(i);
  1950. } else {
  1951. for (; i > -1; i--) hash += (hash << 5) + input[i];
  1952. }
  1953. var value = hash & 0x7FFFFFFF;
  1954.  
  1955. var retValue = '';
  1956. do {
  1957. retValue += I64BIT_TABLE[value & 0x3F];
  1958. } while (value >>= 6);
  1959.  
  1960. return retValue;
  1961. }
  1962.  
  1963. // 监控热键
  1964. crabFacebook() {
  1965. document.onkeydown = function () {
  1966. if (Set["hotKeyToImgResult"] == "false") {
  1967. return;
  1968. }
  1969. var keyCodeName = {
  1970. "91": "command",
  1971. "96": "0",
  1972. "97": "1",
  1973. "98": "2",
  1974. "99": "3",
  1975. "100": "4",
  1976. "101": "5",
  1977. "102": "6",
  1978. "103": "7",
  1979. "104": "8",
  1980. "105": "9",
  1981. "106": "*",
  1982. "107": "+",
  1983. "108": "回车",
  1984. "109": "-",
  1985. "110": ".",
  1986. "111": "/",
  1987. "112": "F1",
  1988. "113": "F2",
  1989. "114": "F3",
  1990. "115": "F4",
  1991. "116": "F5",
  1992. "117": "F6",
  1993. "118": "F7",
  1994. "119": "F8",
  1995. "120": "F9",
  1996. "121": "F10",
  1997. "122": "F11",
  1998. "123": "F12",
  1999. "8": "BackSpace",
  2000. "9": "Tab",
  2001. "12": "Clear",
  2002. "13": "回车",
  2003. "16": "Shift",
  2004. "17": "Control",
  2005. "18": "Alt",
  2006. "20": "Cape Lock",
  2007. "27": "Esc",
  2008. "32": "空格",
  2009. "33": "Page Up",
  2010. "34": "Page Down",
  2011. "35": "End",
  2012. "36": "Home",
  2013. "37": "←",
  2014. "38": "↑",
  2015. "39": "→",
  2016. "40": "↓",
  2017. "45": "Insert",
  2018. "46": "Delete",
  2019. "144": "Num Lock",
  2020. "186": ";",
  2021. "187": "=",
  2022. "188": ",",
  2023. "189": "-",
  2024. "190": ".",
  2025. "191": "/",
  2026. "192": "`",
  2027. "219": "[",
  2028. "220": "\\",
  2029. "221": "]",
  2030. "222": "'",
  2031. "65": "A",
  2032. "66": "B",
  2033. "67": "C",
  2034. "68": "D",
  2035. "69": "E",
  2036. "70": "F",
  2037. "71": "G",
  2038. "72": "H",
  2039. "73": "I",
  2040. "74": "J",
  2041. "75": "K",
  2042. "76": "L",
  2043. "77": "M",
  2044. "78": "N",
  2045. "79": "O",
  2046. "80": "P",
  2047. "81": "Q",
  2048. "82": "R",
  2049. "83": "S",
  2050. "84": "T",
  2051. "85": "U",
  2052. "86": "V",
  2053. "87": "W",
  2054. "88": "X",
  2055. "89": "Y",
  2056. "90": "Z",
  2057. "48": "0",
  2058. "49": "1",
  2059. "50": "2",
  2060. "51": "3",
  2061. "52": "4",
  2062. "53": "5",
  2063. "54": "6",
  2064. "55": "7",
  2065. "56": "8",
  2066. "57": "9"
  2067. };
  2068. var a = window.event.keyCode;
  2069. if (Set["hotKeyToImgResult"] == "wait" && a != undefined) {
  2070. var keyName = keyCodeName[a + ""] == undefined ? a : keyCodeName[a + ""];
  2071. crabCaptcha.Hint('快捷键设置成功当前快捷键为:' + keyName + ",重新打开页面生效!");
  2072. Set["hotKeyToImgResult"] = "true";
  2073. Set["hotKey"] = a;
  2074. GM_setValue("set", Set);
  2075. clearInterval(writeResultInterval);
  2076. } else {
  2077. if (a == Set["hotKey"]) {
  2078. crabCaptcha.WriteResultsInterval();
  2079. crabCaptcha.Hint("开始快捷键识别验证码,在当前页面刷新之前新的验证码将自动识别!");
  2080. }
  2081. }
  2082. }
  2083. }
  2084. }
  2085.  
  2086. //所有验证码img的对象数组
  2087. var writeResultIntervals = [];
  2088.  
  2089. //定时执行验证码绑定操作定时器
  2090. var writeResultInterval;
  2091.  
  2092.  
  2093. function closeButton() {
  2094. const closebtn = document.createElement("div");
  2095. closebtn.innerHTML = " × ";
  2096. closebtn.style.position = "absolute";
  2097. closebtn.style.top = "10px";
  2098. closebtn.style.right = "10px";
  2099. closebtn.style.cursor = "pointer";
  2100. closebtn.style.fontWeight = 900;
  2101. closebtn.style.fontSize = "larger";
  2102. closebtn.setAttribute("onclick", "CKTools.modal.hideModal()");
  2103. return closebtn;
  2104. }
  2105.  
  2106. async function GUISettings() {
  2107. if (CKTools.modal.isModalShowing()) {
  2108. CKTools.modal.hideModal();
  2109. }
  2110. const menuList = [{
  2111. name: 'autoIdentification',
  2112. title: '自动查找无规则验证码',
  2113. hintOpen: '已开启自动查找验证码功能,请刷新网页',
  2114. hintClose: '已关闭自动查找验证码功能,遇到新网站请自行手动添加规则!',
  2115. desc: '对于未添加规则的页面,将自动查找页面上的验证码,有找错的可能。',
  2116. openVul: 'true',
  2117. closeVul: 'false'
  2118. }, {
  2119. name: 'showHintCheck',
  2120. title: '提示信息',
  2121. hintOpen: '提示功能已开启!',
  2122. hintClose: '提示功能已关闭,再次开启前将无任何提示!',
  2123. desc: '关闭前请确保已知晓插件的使用流程!',
  2124. openVul: 'true',
  2125. closeVul: 'false'
  2126. }, {
  2127. name: 'warningTone',
  2128. title: '提示音',
  2129. hintOpen: '提示音功能已开启!',
  2130. hintClose: '提示音功能已关闭!',
  2131. desc: '自动朗读提示信息中的文字!',
  2132. openVul: 'true',
  2133. closeVul: 'false'
  2134. }, {
  2135. name: 'autoBlackList',
  2136. title: '识别崩溃自动拉黑网站',
  2137. hintOpen: '崩溃自动拉黑网站功能已开启!',
  2138. hintClose: '崩溃自动拉黑网站功能已关闭!',
  2139. desc: '遇到跨域或其他错误导致验证码无法加载时自动将网站加到黑名单中。',
  2140. openVul: 'true',
  2141. closeVul: 'false'
  2142. }, {
  2143. name: 'hotKeyToImgResult',
  2144. title: '快捷键查找验证码',
  2145. hintOpen: '请直接按下您需要设置的快捷键!设置快捷键前请确保当前页面能够自动识别否则先手动添加规则!',
  2146. hintClose: '快捷键查找验证码已关闭!',
  2147. desc: '先手动添加规则后再开启,开启后将停止自动识别,仅由快捷键识别!',
  2148. openVul: 'wait',
  2149. closeVul: 'false',
  2150. doWork: 'crabCaptcha.crabFacebook()'
  2151. }, {
  2152. name: 'openHelp',
  2153. type: 'button',
  2154. title: '查看使用帮助',
  2155. desc: '如果您使用上遇到问题或障碍,请仔细阅读该内容!',
  2156. hintOpen: '使用帮助说明网页已打开,若遇到您无法解决的问题,可加群联系群内志愿者!',
  2157. doWork: 'crabCaptcha.openHelp()'
  2158. }, {
  2159. name: 'clearSet',
  2160. type: 'button',
  2161. title: '恢复出厂设置',
  2162. hintOpen: '已成功恢复出厂设置刷新页面即可生效',
  2163. desc: '清除所有设置,包括识别码!',
  2164. doWork: 'crabCaptcha.clearSet()'
  2165. },]
  2166. CKTools.modal.openModal("万能验证码自动输入-更多设置(点击切换)", await CKTools.domHelper("div", async container => {
  2167. container.appendChild(closeButton());
  2168. container.style.alignItems = "stretch";
  2169. for (var i = 0; i < menuList.length; i++) {
  2170. container.appendChild(await CKTools.domHelper("li", async list => {
  2171. list.classList.add("showav_menuitem");
  2172. list.setAttribute('menuId', i);
  2173. list.addEventListener("click", e => {
  2174. let targetElem = $(e.target.parentElement);
  2175. let menuId = targetElem.attr("menuId");
  2176. if (menuList[menuId].type == "button") {
  2177. if (eval(menuList[menuId].doWork)) {
  2178. crabCaptcha.Hint(menuList[menuId].hintOpen);
  2179. }
  2180. } else {
  2181. const label = document.querySelector("#" + menuList[menuId].name + "Tip");
  2182. const checkbox = document.querySelector("#" + menuList[menuId].name);
  2183. if (!label) return;
  2184. if (!checkbox.checked) {
  2185. label.innerHTML = "<b>[已开启]</b> " + menuList[menuId].title;
  2186. Set[menuList[menuId].name] = menuList[menuId].openVul;
  2187. GM_setValue("set", Set);
  2188. checkbox.checked = true;
  2189. crabCaptcha.Hint(menuList[menuId].hintOpen);
  2190. let doWork = menuList[menuId].doWork;
  2191. if (doWork != null) {
  2192. eval(doWork)
  2193. }
  2194. } else {
  2195. label.innerHTML = "<span>[已关闭]</span>" + menuList[menuId].title;
  2196. Set[menuList[menuId].name] = menuList[menuId].closeVul;
  2197. checkbox.checked = false;
  2198. GM_setValue("set", Set);
  2199. crabCaptcha.Hint(menuList[menuId].hintClose);
  2200. }
  2201. }
  2202. })
  2203. if (menuList[i].type == 'button') {
  2204. list.appendChild(await CKTools.domHelper("label", label => {
  2205. label.id = menuList[i].name + "Tip";
  2206. label.innerHTML = menuList[i].title;
  2207. }));
  2208. } else {
  2209. list.appendChild(await CKTools.domHelper("input", input => {
  2210. input.type = "checkbox";
  2211. input.id = menuList[i].name;
  2212. input.name = menuList[i].name;
  2213. input.style.display = "none";
  2214. input.checked = Set[menuList[i].name] == 'true';
  2215. }));
  2216. list.appendChild(await CKTools.domHelper("label", label => {
  2217. label.id = menuList[i].name + "Tip";
  2218. label.setAttribute('for', menuList[i].name);
  2219. if (Set[menuList[i].name] == 'true') {
  2220. label.innerHTML = "<b>[已开启]</b>" + menuList[i].title;
  2221. } else {
  2222. label.innerHTML = "<span>[已关闭]</span>" + menuList[i].title;
  2223. }
  2224. }));
  2225. }
  2226. list.appendChild(await CKTools.domHelper("div", div => {
  2227. div.style.paddingLeft = "20px";
  2228. div.style.color = "#919191";
  2229. div.innerHTML = "说明:" + menuList[i].desc;
  2230. }));
  2231. list.style.lineHeight = "2em";
  2232. }))
  2233. }
  2234. container.appendChild(await CKTools.domHelper("div", async btns => {
  2235. btns.style.display = "flex";
  2236. btns.style.alignItems = "flex-end";
  2237. btns.appendChild(await CKTools.domHelper("button", btn => {
  2238. btn.className = "CKTOOLS-toolbar-btns";
  2239. btn.innerHTML = "关闭";
  2240. btn.style.background = "#ececec";
  2241. btn.style.color = "black";
  2242. btn.onclick = e => {
  2243. CKTools.addStyle(``, "showav_lengthpreviewcss", "update");
  2244. CKTools.modal.hideModal();
  2245. }
  2246. }))
  2247. }))
  2248. }));
  2249. //强制设置置顶,避免被占用
  2250. $("#CKTOOLS-modal").css("z-index", "99999999999");
  2251. //强制设置置顶,避免被占用
  2252. $("#CKTOOLS-modal").height("600px");
  2253. }
  2254.  
  2255. async function GUIAddRule() {
  2256. if (CKTools.modal.isModalShowing()) {
  2257. CKTools.modal.hideModal();
  2258. }
  2259. const menuList = [{
  2260. name: 'letterRule',
  2261. title: '添加数字、字母验证码规则',
  2262. type: 'button',
  2263. desc: '请根据网站顶部提示:先右键验证码,再左键点击输入框!',
  2264. doWork: 'crabCaptcha.LetterPickUp()'
  2265. }, {
  2266. name: 'slideRule',
  2267. title: '添加滑动拼图验证码规则',
  2268. type: 'button',
  2269. desc: '请根据网站顶部提示,依次点击(左键右键均可):大图、小图、滑块!',
  2270. doWork: 'crabCaptcha.SlidePickUp()'
  2271. }, {
  2272. name: 'slideBehaviorRule',
  2273. title: '添加滑块行为验证码规则',
  2274. type: 'button',
  2275. desc: '注意:该类验证码仅有一个滑块,请根据网站顶部提示点击滑块!',
  2276. doWork: 'crabCaptcha.slideBehaviorRule()'
  2277. }, {
  2278. name: 'captchaHostBad',
  2279. title: '停止识别该网站',
  2280. type: 'button',
  2281. desc: '停止后该网站将不再识别,如需继续识别点击下方“删除该网站全部规则”。',
  2282. doWork: 'crabCaptcha.captchaHostBad("bad","bad")'
  2283. }, {
  2284. name: 'captchaHostDel',
  2285. title: '删除该网站全部规则',
  2286. type: 'button',
  2287. desc: '删除当前网站用户手动添加的全部规则,含黑名单。',
  2288. doWork: 'crabCaptcha.captchaHostDel()'
  2289. },]
  2290. CKTools.modal.openModal("万能验证码自动输入-规则管理(请点击您要执行的操作)", await CKTools.domHelper("div", async container => {
  2291. container.appendChild(closeButton());
  2292. container.style.alignItems = "stretch";
  2293. for (var i = 0; i < menuList.length; i++) {
  2294. container.appendChild(await CKTools.domHelper("li", async list => {
  2295. list.classList.add("showav_menuitem");
  2296. list.setAttribute('doWork', menuList[i].doWork);
  2297. list.addEventListener("click", e => {
  2298. CKTools.modal.hideModal();
  2299. eval($(e.target.parentElement).attr("doWork"));
  2300. });
  2301. if (menuList[i].type == 'button') {
  2302. list.appendChild(await CKTools.domHelper("label", label => {
  2303. label.id = menuList[i].name + "Tip";
  2304. label.value = i;
  2305. label.setAttribute('style', "color:blue");
  2306. label.innerHTML = menuList[i].title;
  2307. }));
  2308. }
  2309. list.appendChild(await CKTools.domHelper("div", div => {
  2310. div.style.paddingLeft = "20px";
  2311. div.style.color = "#919191";
  2312. div.innerHTML = "说明:" + menuList[i].desc;
  2313. }));
  2314. list.style.lineHeight = "2em";
  2315. }))
  2316. }
  2317. container.appendChild(await CKTools.domHelper("div", async btns => {
  2318. btns.style.display = "flex";
  2319. btns.style.alignItems = "flex-end";
  2320. btns.appendChild(await CKTools.domHelper("button", btn => {
  2321. btn.className = "CKTOOLS-toolbar-btns";
  2322. btn.innerHTML = "关闭";
  2323. btn.style.background = "#ececec";
  2324. btn.style.color = "black";
  2325. btn.onclick = e => {
  2326. CKTools.addStyle(``, "showav_lengthpreviewcss", "update");
  2327. CKTools.modal.hideModal();
  2328. }
  2329. }))
  2330. }))
  2331. }));
  2332. //强制设置置顶,避免被占用
  2333. $("#CKTOOLS-modal").css("z-index", "99999999999");
  2334. $("#CKTOOLS-modal").height("400px");
  2335.  
  2336.  
  2337. }
  2338.  
  2339. // hook一份ctx的结果,用于跨域获取
  2340. const originalDrawImage = CanvasRenderingContext2D.prototype.drawImage;
  2341. CanvasRenderingContext2D.prototype.drawImage = function (image, ...args) {
  2342. if (image.tagName != null && image.tagName.toLowerCase() === "img" && image.src.indexOf("http") != -1) {
  2343. $(this.canvas).attr("crab-src", image.src)
  2344. }
  2345. originalDrawImage.call(this, image, ...args);
  2346. };
  2347. var crabCaptcha = new CaptchaWrite();
  2348. (function () {
  2349. const resourceList = [{name: 'cktools', type: 'js'}]
  2350.  
  2351. function applyResource() {
  2352. resloop: for (let res of resourceList) {
  2353. if (!document.querySelector("#" + res.name)) {
  2354. let el;
  2355. switch (res.type) {
  2356. case 'js':
  2357. case 'rawjs':
  2358. el = document.createElement("script");
  2359. break;
  2360. case 'css':
  2361. case 'rawcss':
  2362. el = document.createElement("style");
  2363. break;
  2364. default:
  2365. console.log('Err:unknown type', res);
  2366. continue resloop;
  2367. }
  2368. el.id = res.name;
  2369. el.innerHTML = res.type.startsWith('raw') ? res.content : GM_getResourceText(res.name);
  2370. document.head.appendChild(el);
  2371. }
  2372. }
  2373. }
  2374.  
  2375. applyResource();
  2376. GM_registerMenuCommand('规则管理', function () {
  2377. GUIAddRule();
  2378. }, 'a');
  2379.  
  2380. if (Set["idCard"] == '' || Set["idCard"] == undefined) {
  2381. GM_registerMenuCommand('设置识别码', function () {
  2382. crabCaptcha.SetIdCard();
  2383. }, 's');
  2384. }
  2385. GM_registerMenuCommand('更多设置', function () {
  2386. GUISettings();
  2387. }, 'u');
  2388. crabCaptcha.Start();
  2389. CKTools.addStyle(`
  2390. #CKTOOLS-modal{
  2391. width: fit-content!important;
  2392. max-width: 80%!important;
  2393. }
  2394. .CKTOOLS-modal-content li label b {
  2395. color: green!important;
  2396. }
  2397. .CKTOOLS-modal-content li label span {
  2398. color: red!important;
  2399. }
  2400. .showav_menuitem{
  2401. line-height: 2em;
  2402. width: 100%;
  2403. transition: all .3s;
  2404. cursor: pointer;
  2405. }
  2406. .showav_menuitem:hover{
  2407. transform: translateX(6px);
  2408. }
  2409. .showav_menuitem>label{
  2410. font-weight: bold;
  2411. font-size: large;
  2412. display: block;
  2413. }
  2414. `, 'showav_dragablecss', "unique", document.head);
  2415.  
  2416. CKTools.addStyle(`
  2417. #CKTOOLS-modal li, #CKTOOLS-modal ul{
  2418. list-style: none !important;
  2419. }
  2420. `, 'showav_css_patch', 'unique', document.head);
  2421. })();

QingJ © 2025

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