腾讯课堂、超星自动签到(新版)

腾讯课堂、超星自动签到

目前为 2020-06-12 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name 腾讯课堂、超星自动签到(新版)
  3. // @description 腾讯课堂、超星自动签到
  4. // @namespace CX&TXKT_auto_sign
  5. // @author 涛之雨
  6. // @version 0.3.5
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9. // @grant GM_registerMenuCommand
  10. // @grant GM_addStyle
  11. // @run-at document-start
  12. // @require https://libs.baidu.com/jquery/2.1.4/jquery.min.js
  13. // @match *://ke.qq.com/course/*
  14. // @match *://ke.qq.com/webcourse*
  15. // @match *://mobilelearn.chaoxing.com/widget/pcpick/stu/index*
  16. // @match *://*.chaoxing.com/visit/interaction*
  17. // @match *://i.mooc.chaoxing.com/*
  18. // @license GPL-3.0-only
  19. // @icon https://i.loli.net/2020/03/04/D3h1iWSFeyc8AKG.png
  20. // @home-url https://gf.qytechs.cn/zh-CN/scripts/401115
  21. // ==/UserScript==
  22.  
  23. /*
  24. 超星的另一个辅助,在这里:
  25. https://gf.qytechs.cn/zh-CN/scripts/403935
  26. */
  27.  
  28. /*
  29. * 更新:
  30. * V0.3.5
  31. * 新增超星的随机刷新(减少浏览器同时请求卡顿)
  32. * 对于超星签到循环改为动态加载,增加稳定性
  33. * 修复腾讯课堂网络异常报错的问题(当前为强制刷新)
  34. * 新增腾讯课堂部分直播时有播放按钮的自动播放
  35. * 新增对于腾讯课堂报错后自动延时刷新的支持
  36. * 修改部分逻辑,增加代码的稳定性
  37.  
  38. * V0.3.4
  39. * 修复对于超星界面更新的更新
  40. * 修复对于超星和腾讯课堂不同界面的适配
  41. * 新增超星的动画(虽然没啥用)
  42. * 精简代码,优化部分流程。
  43. * 修复腾讯课堂连续一开始连续相同回复异常
  44. * 加入自动回复人工智能(人工智障),智能判断是否相同
  45. *
  46. * V0.3.3
  47. * 超星的界面变了。。。脚本也要跟着改(气哭.gif)
  48. *
  49. * V0.3.2
  50. * 【给腾讯课堂填坑!】增加腾讯课堂自动检测、刷新(js混淆、平坦化(AST),恶心的要吐)
  51. * 对腾讯课堂播放页面增加判断,录播(回放)不显示脚本,减小系统负担
  52. * 顺便修复了复读机log显示错误的bug以及仅有一条时特殊显示
  53. *
  54. * V0.3.1
  55. * 修复了严重逻辑bug!请更新!
  56. *
  57. * V0.3.0
  58. * 其实就是0.2.10....
  59. * 不过不知道为啥不能正常更新。。。刷个版本试试?
  60. *
  61. * V0.2.10
  62. * 修复之前数字显示异常的bug
  63. * 优化了代码,使其更加规范,执行效率更高,可靠性更强(不是依赖本脚本的原因)
  64. * 修复复读机的一些bug(已经可以正式使用了)
  65. * 修复了重定向按钮显示、点击不正常
  66. *
  67. * V0.2.9
  68. * 增加对于部分页内播放器重定向到全屏播放的重定向按钮(暂未考虑自动重定向)
  69. * (测试功能)回复复读机,指定连续x条回复,自动回复,
  70. * 增加回复黑名单(防止重复回复)
  71. * 改善页面的动画,看起来更流畅,更美观
  72. * 修复对于签到、辅助等连续成功后数字不增加的bug
  73. * 还有若干。。。想不起来了
  74. *
  75. * V0.2.8
  76. * 辅助作答后播报和log中添加选择的选项
  77. * 修复了部分注释的历史遗留问题
  78. *
  79. * V0.2.7
  80. * 修复签到结束后不继续监视的bug
  81. *
  82. * V0.2.6
  83. * 修复签到等待时间小于1秒无法语音播报的bug
  84. *
  85. * V0.2.5
  86. * 修复了腾讯课堂监视配置读取错误的bug
  87. * 修复选择题的点击bug
  88. * 修复选择题点击后关闭窗口的bug
  89. * 修复多次调用点击事件的bug
  90. * 注:尚在测试中,请勿过度依赖本功能(脚本)
  91. *
  92. * V0.2.4
  93. * 修复了选择等待时间错误
  94. * 修复了TTS发音部分参数错误
  95. * 修复了插件更新设置后会多个线程同时执行的BUG
  96. * 如果有懂一点js,会js的朋友如果老师有发起选择题的时候给个样本或是解决方案呗
  97. * 我们这里都要结束了,都没有老师再发起选择题。。。
  98. * 此外还更新了啥我忘了。。。
  99. *
  100. * V0.2.3
  101. * 修复:腾讯课堂无法自动选择(好不容易老师发起一次我还错过了)
  102. * 修复更改设置后许刷新才生效的bug
  103. * 删除会引起错误的调试代码(对于脚本无影响)
  104. *
  105. * V0.2.2
  106. * 【重大更新】修复严重bug(凌晨两点果然脑子就不好了。。。。)
  107. * 增加了双击悬浮球回复默认设置
  108. *
  109. * V0.2.1
  110. * 【重大更新】增加插件设置界面,便于管理
  111. * 【重大更新】增加TTS语音播报功能
  112. * (默认开启,有需要请到支持的页面配置)
  113. * 剩余优化时间的显示
  114. * 优化算法和数据处理,增加插件的稳定性
  115. *
  116. * V0.1.2
  117. * 修复了已知bug(选择题功能尚未测试)
  118. *
  119. * V0.1.1
  120. * 修复了签到子页面无法自动刷新的bug
  121. *
  122. * V0.1.0
  123. * 删掉了我垃圾小站的图标(虽然用广告拦截器一拦截就好了。。。),去掉68行无用代码。。。
  124. * 把自定义参数放到开头,方便用户进行自定义修改(没有基础请勿修改其他部分!)
  125. *
  126. * 腾讯课堂部分:
  127. * 对签到适配更加精准,不会误点
  128. * 增加选择题的随机选择功能
  129. * (未经测试。。。。开启请慎重!)
  130. * (严重的bug倒不会至于。主要可能不是预期效果)
  131. *
  132. * 超星部分:
  133. * 对课程信息进行重新分组
  134. * 对签到的流程进行优化
  135. * 增加签到成功和特殊的签到类型的判断及弹窗提醒,下个版本考虑增加对于微信的对接(太麻烦,懒得,此外本人不看微信。。。。)
  136. *
  137. */
  138.  
  139. //个人小站:https://taozhiyu.gitee.io(虽然啥都没有。。。)
  140. //吾爱主页:https://www.52pojie.cn/home.php?mod=space&uid=879080
  141. //CSDN主页:https://blog.csdn.net/weixin_44352049(虽然也是啥都没有)
  142. //使用说明:https://gf.qytechs.cn/zh-CN/scripts/401115
  143. //吾爱说明:https://www.52pojie.cn/thread-1163575-1-1.html
  144. //CSDN说明:https://blog.csdn.net/weixin_44352049/article/details/106031114
  145. //未做混淆或加密,
  146. //按F12打开console即可看到日志
  147. //懂js可以自行DIY
  148.  
  149.  
  150. (function() {
  151. 'use strict';
  152. if (location.href.match(/ke.qq.com\/course/)) {
  153. var url = "";
  154. $(document).ready(function() {
  155. var Container = document.createElement('a');
  156. Container.id = "modle302";
  157. Container.title = '点击重定向';
  158. Container.innerHTML = '点击重定向';
  159. Container.style = "background: red;color: white;border: blue double;cursor: pointer;display:none";
  160. $(".course-title > h3")[0].appendChild(Container);
  161. $(".js-task-item.task-item").each(
  162. function(e) {
  163. $(this).on("click", function() {
  164. $("#modle302").off("click", clickeve);
  165. $("#modle302").css("display", "none");
  166. });
  167. });
  168.  
  169. function clickeve() {
  170. location.href = url;
  171. }
  172. setInterval(function() {
  173. var ifr = document.querySelector("#js-study-video");
  174. if (ifr) {
  175. try {
  176. var cid = ifr.src.toString().match(/cid=\d+/);
  177. var tid = ifr.src.toString().match(/term_id=\d+/);
  178. var taid = ifr.src.toString().match(/taid=\d+/);
  179. if (cid !== null && tid !== null && taid !== null) {
  180. url = "https://ke.qq.com/webcourse/index.html#cid=" +
  181. cid[0].match(/\d+/)[0] +
  182. "&term_id=" +
  183. tid[0].match(/\d+/)[0] +
  184. "&taid=" +
  185. taid[0].match(/\d+/)[0];
  186. $("#modle302").css("display", "");
  187. $("#modle302").on("click", clickeve);
  188. }
  189. } catch (e) {
  190. console.error("未知错误!\n请复制错误信息提交反馈====>>\n\n", e);
  191. }
  192. }
  193. }, 500);
  194. });
  195. return;
  196. }
  197. let AutoSignConfig = {};
  198. let DefaultConfig = {
  199. TTS_IsOpen: true,
  200. TTS_Volce: 5,
  201. TTS_Speed: 7,
  202. CX_IsOpen: true,
  203. CX_IsRandomWaiting:true,
  204. CX_WaitingTime: 30,
  205. CX_MaxWaitingCount: 20,
  206. TXKT_Repeater_IsOpen: true,
  207. TXKT_Repeater_WaitingTime: 1000,
  208. TXKT_Repeater_MaxWaitingCount: 7,
  209. TXKT_Signing_WaitingTime: 5000,
  210. TXKT_Ansering_IsOpen: true,
  211. TXKT_Ansering_IsRandom: true,
  212. TXKT_Ansering_WaitingTime: -20
  213. };
  214. var sign_times = 0;
  215. var answer_times = 0;
  216. var repeat_times = 0;
  217. var blacklist = "";
  218. var TXKTloading = 0;
  219. Promise.all([GM_getValue("CXAndTXKTConfig")]).then(function(data) {
  220. if (data[0] !== undefined) {
  221. try {
  222. AutoSignConfig = JSON.parse(data[0]);
  223. } catch (e) {
  224. AutoSignConfig = data[0];
  225. }
  226. } else {
  227. AutoSignConfig = DefaultConfig;
  228. }
  229. for (var key in DefaultConfig) {
  230. if (typeof(AutoSignConfig[key]) == "undefined") {
  231. AutoSignConfig[key] = DefaultConfig[key];
  232. }
  233. }
  234. MainFunction();
  235. }).catch(function(except) {
  236. console.log("错误!请复制后上报bug。谢谢==>",except);
  237. });
  238. window.T2S = function(TXT) {
  239. if (!AutoSignConfig.TTS_IsOpen) {
  240. return;
  241. }
  242. if (TXT === undefined) {
  243. TXT = "我有参数呢,播报的内容您还没填呢。填写后才能读出你想要的文字呢,亲!";
  244. }
  245. var tmp = document.createElement("div");
  246. tmp.innerHTML = '<iframe src="data:audio/mpeg;base64,x==" allow="autoplay" style="position:fixed;z-index:-999999999;top:-120px;left:-100px;width:10px;height:10px" autoplay></iframe>';
  247. tmp.id = "taoSignAudioTEST";
  248. document.getElementsByTagName("body")[0].append(tmp);
  249. setTimeout(function() {
  250. document.getElementById('taoSignAudioTEST').remove();
  251. tmp = document.getElementById('taoSignAudio');
  252. if (tmp) {
  253. tmp.src = "http://tts.baidu.com/text2audio?cuid=baiduid&per=4&vol=" + AutoSignConfig.TTS_Volce + "&pit=6&lan=zh&spd=" + AutoSignConfig.TTS_Speed + "&ctp=1&pdt=311&ie=UTF-8&tex=" + TXT;
  254. } else {
  255. tmp = document.createElement("audio");
  256. tmp.id = 'taoSignAudio';
  257. tmp.src = "http://tts.baidu.com/text2audio?cuid=baiduid&per=4&vol=" + AutoSignConfig.TTS_Volce + "&pit=6&lan=zh&spd=" + AutoSignConfig.TTS_Speed + "&ctp=1&pdt=311&ie=UTF-8&tex=" + TXT;
  258. document.getElementsByTagName("body")[0].append(tmp);
  259. }
  260. document.getElementById('taoSignAudio').play();
  261. }, 500);
  262. };
  263. GM_registerMenuCommand('我找不到插件设置窗口!告诉我在哪里', function() {
  264. $("#AutoSignSettingIcon").css("top", 0);
  265. if(location.href.match(/chaoxing\.com/) !== null){
  266. $(".wrap1200.clearfix,.headbanner_new,#to_top,.foot").css("filter", "blur(10px)");
  267. }else{
  268. $("#preloading,#react-body").css("filter", "blur(10px)");
  269. }
  270. setTimeout(function() {
  271. function tmp() {
  272. $("#AutoSignSettingIcon").css("top", "-48px");
  273. if(location.href.match(/chaoxing\.com/) !== null){
  274. $(".wrap1200.clearfix,.headbanner_new,#to_top,.foot").css("filter", "none");
  275. }else{
  276. $("#preloading,#react-body").css("filter", "none");
  277. }
  278. $("body").off("mousemove", tmp());
  279. }
  280. $("body").on("mousemove", tmp());
  281. }, 5000);
  282. });
  283.  
  284. function MainFunction() {
  285. var UPDETE_timeout = 0;
  286.  
  287. function URLChoicer(isResting = false) {
  288. if (!isResting&& top.location == self.location) {
  289. console.log("%c【语音播报】%c功能已%c%s", "color:red", "color:black", AutoSignConfig.TTS_IsOpen ? "background-color:green;color:white;" : "background-color:red;color:white;", AutoSignConfig.TTS_IsOpen ? "开启" : "关闭");
  290. }
  291. if (isResting&&location.href.match(/chaoxing\.com\/space/) !== null) {
  292. $("#frame_content")[0].contentWindow.location.reload();
  293. return;
  294. }
  295. if (location.href.match(/visit\/interaction/) !== null) {
  296. if (isResting) {
  297. window.location.reload();
  298. } else {
  299. window.onload = function() {
  300. cx_sign(true);
  301. };
  302. }
  303. }
  304. if (location.href.match(/mobilelearn/) !== null) {
  305. cx_main();
  306. }
  307. if (location.href.match(/ke.qq.com/) !== null && top.location == self.location) {
  308. if (isResting) {
  309. ke();
  310. } else {
  311. window.onload = function() {
  312. ke();
  313. };
  314. }
  315. }
  316. return;
  317. }
  318.  
  319. function UpdateSettings() {
  320. if (UPDETE_timeout) {
  321. clearTimeout(UPDETE_timeout);
  322. UPDETE_timeout = 0;
  323. }
  324. GM_setValue("CXAndTXKTConfig", JSON.stringify(AutoSignConfig));
  325. UPDETE_timeout = setTimeout(function() {
  326. URLChoicer(true);
  327. }, 3000);
  328. }
  329.  
  330. function updateUI() {
  331. return "<div id='AutoSignSettingIcon' title='双击清除已有设置'></div>\n" +
  332. "<div class='TaoMain'>\n" +
  333. "<div class='TaoTotal'>\n" +
  334. "<fieldset id='fieldsetAll'>\n" +
  335. "<legend style='text-align: right;'><a style='color:#188eee;' href='https://gf.qytechs.cn/zh-CN/scripts/401115'>涛之雨制作|前往脚本发布地址</a>\n" +
  336. "</legend>\n" +
  337. "<fieldset>\n" +
  338. "<legend title='百度语音TTS接入,语音方式提醒'> <font class='SettingTitle'>全局TTS(语音)设置</font>\n" +
  339. "</legend>\n" +
  340. "<ul class='Setting_ul'>\n" +
  341. "<li class='Setting_Choice'>\n" +
  342. "<label style='height: 20px;' title='是否开启语音提醒功能(推荐开启)'>是否开启\n" +
  343. "<input id='TTS_IsOpen' type='button' class='Setting_input Setting_btn " + (AutoSignConfig.TTS_IsOpen ? "Setting_On" : "Setting_Off") + "'>\n" +
  344. "</label>\n" +
  345. "</li>\n" +
  346. "</ul>\n" +
  347. "<div id='TTS_div'>\n" +
  348. "<ul class='Setting_ul'>\n" +
  349. "<li>\n" +
  350. "<label title='范围:[0,9],5为中速'>语速设置\n" +
  351. "<input class='Setting_input' id='TTS_Speed' type='number' max='9' min='0' value='" + AutoSignConfig.TTS_Speed + "'>\n" +
  352. "</label>\n" +
  353. "</li>\n" +
  354. "</ul>\n" +
  355. "<ul class='Setting_ul'>\n" +
  356. "<li>\n" +
  357. "<label title='范围:[0,15],5为中音量'>音量设置\n" +
  358. "<input class='Setting_input' id='TTS_Volce' type='number' max='15' min='0' value='" + AutoSignConfig.TTS_Volce + "'>\n" +
  359. "</label>\n" +
  360. "</li>\n" +
  361. "</ul>\n" +
  362. "</div>\n" +
  363. "</fieldset>\n" +
  364. ((location.href.match(/chaoxing\.com/) !== null)?
  365. "<fieldset>\n" +
  366. "<legend title='超星学习通的相关功能,如自动签到,延时,检测等'><font class='SettingTitle'>超星 设置</font>\n" +
  367. "</legend>\n" +
  368. "<ul class='Setting_ul'>\n" +
  369. "<li class='Setting_Choice'>\n" +
  370. "<label title='是否开启自动签到功能(推荐开启)'>自动签到\n" +
  371. "<input id='CX_IsOpen' type='button' class='Setting_input Setting_btn " + (AutoSignConfig.CX_IsOpen ? "Setting_On" : "Setting_Off") + "'>\n" +
  372. "</label>\n" +
  373. "<label title='签到刷新随机延时±5秒(推荐开启,以防同时加载过多的页面导致卡顿)(测试功能)'>随机延时\n" +
  374. "<input id='CX_IsRandomWaiting' type='button' class='Setting_input Setting_btn " + (AutoSignConfig.CX_IsRandomWaiting ? "Setting_On" : "Setting_Off") + "'>\n" +
  375. "</label>\n" +
  376. "</li>\n" +
  377. "</ul>\n" +
  378. "<div>\n" +
  379. "<ul class='Setting_ul'>\n" +
  380. "<li>\n" +
  381. "<label title='每隔多长时间监视一次'>监视时间\n" +
  382. "<input class='Setting_input' id='CX_WaitingTime' type='number' min='1' value='" + AutoSignConfig.CX_WaitingTime + "'>秒</label>\n" +
  383. "</li>\n" +
  384. "</ul>\n" +
  385. "<ul class='Setting_ul'>\n" +
  386. "<li>\n" +
  387. "<label title='最大检测次数,超过限制停止。值为0则无限制'>最多检测\n" +
  388. "<input class='Setting_input' id='CX_MaxWaitingCount' type='number' min='0' value='" + AutoSignConfig.CX_MaxWaitingCount + "'>次</label>\n" +
  389. "</li>\n" +
  390. "</ul>\n" +
  391. "</div>\n" +
  392. "</fieldset>\n"+
  393. "</fieldset>\n" +
  394. "</div>\n" +
  395. "</div>"
  396. :
  397. "<fieldset>\n" +
  398. "<legend title='回复复读机设置'>" +
  399. /*"<label title='嵌入页面里的录播拉出来(详情可以看脚本主页的介绍)' style='height: 20px;'>重定向\n"+
  400. "<input id='TXKT_Repeater_IsOpen' type='button' class='Setting_input Setting_btn "+(AutoSignConfig.TXKT_Repeater_IsOpen?"Setting_On":"Setting_Off")+"'>\n"+
  401. "</label>\n"+*/
  402. "<font class='SettingTitle'>腾讯课堂复读机 设置</font>\n" +
  403. "</legend>\n" +
  404. "<ul class='Setting_ul'>\n" +
  405. "<li class='Setting_Choice'>\n" +
  406. "<label style='height: 20px;' title='是否开启回复复读机,开启后如果复读完自动加入黑名单,防止重复发送,并且等待10秒后重新开始检测'>回复复读\n" +
  407. "<input id='TXKT_Repeater_IsOpen' type='button' class='Setting_input Setting_btn " + (AutoSignConfig.TXKT_Repeater_IsOpen ? "Setting_On" : "Setting_Off") + "'>\n" +
  408. "</label>\n" +
  409. "</li>\n" +
  410. "</ul>\n" +
  411. "<div>\n" +
  412. "<ul class='Setting_ul'>\n" +
  413. "<li>\n" +
  414. "<label title='检测相同数据的时间'>检测时间\n" +
  415. "<input class='Setting_input' id='TXKT_Repeater_WaitingTime' type='number' value='" + AutoSignConfig.TXKT_Repeater_WaitingTime + "'>毫秒</label>\n" +
  416. "</li>\n" +
  417. "</ul>\n" +
  418. "<ul class='Setting_ul'>\n" +
  419. "<li>\n" +
  420. "<label title='连续多少句的时候触发复读'>检测数量\n" +
  421. "<input class='Setting_input' id='TXKT_Repeater_MaxWaitingCount' type='number' value='" + AutoSignConfig.TXKT_Repeater_MaxWaitingCount + "'>句</label>\n" +
  422. "</li>\n" +
  423. "</ul>\n" +
  424. "</div>\n" +
  425. "</fieldset>\n" +
  426. "<fieldset>\n" +
  427. "<legend class='SettingTitle' title='腾讯课堂自动辅助答题,随机选择,辅助的时机等设置'> <font>腾讯课堂 设置</font>\n" +
  428. "</legend>\n" +
  429. "<ul class='Setting_ul'>\n" +
  430. "<li>\n" +
  431. "<label title='签到的监视时间,可以填理论任意数值。(因为不会发生多层同时出现,可以考虑1000毫秒)'>签到监视\n" +
  432. "<input id='TXKT_Signing_WaitingTime' class='Setting_input' type='number' min='0' value='" + AutoSignConfig.TXKT_Signing_WaitingTime + "'>毫秒</label>\n" +
  433. "</li>\n" +
  434. "</ul>\n" +
  435. "<div>\n" +
  436. "<ul class='Setting_ul'>\n" +
  437. "<li class='Setting_Choice'>\n" +
  438. "<label title='是否开启辅助作答功能'>辅助作答\n" +
  439. "<input type='button' id='TXKT_Ansering_IsOpen' class='Setting_input Setting_btn " + (AutoSignConfig.TXKT_Ansering_IsOpen ? "Setting_On" : "Setting_Off") + "'>\n" +
  440. "</label>\n" +
  441. "<label title='是否开启随机选择选项功能(如关闭则每次都选择第一个选项)'>随机选择\n" +
  442. "<input id='TXKT_Ansering_IsRandom' type='button' class='Setting_input Setting_btn " + (AutoSignConfig.TXKT_Ansering_IsRandom ? "Setting_On" : "Setting_Off") + "'>\n" +
  443. "</label>\n" +
  444. "</li>\n" +
  445. "</ul>\n" +
  446. "<ul class='Setting_ul'>\n" +
  447. "<li>\n" +
  448. "<label title='辅助作答的时间,整数为等待选择时长后作答,负数为倒计时剩余填入时长的时作答'>作答时机\n" +
  449. "<input class='Setting_input' id='TXKT_Ansering_WaitingTime' type='number' value='" + AutoSignConfig.TXKT_Ansering_WaitingTime + "'>秒</label>\n" +
  450. "</li>\n" +
  451. "</ul>\n" +
  452. "</div>\n" +
  453. "</fieldset>\n" +
  454. "</fieldset>\n" +
  455. "</div>\n" +
  456. "</div>");
  457. }
  458. var auto_sign_interval = 0,
  459. auto_answer_interval = 0;
  460. var auto_Repeater_timeout = 0,
  461. T2S_timeout = 0,
  462. icon_timeout = 0;
  463. var canhiden = 0,
  464. canhiden2 = 0;
  465.  
  466. function hidensetting() {
  467. if (icon_timeout) {
  468. clearTimeout(icon_timeout);
  469. icon_timeout = 0;
  470. }
  471. icon_timeout = setTimeout(function() {
  472. $(".TaoTotal").css("opacity", 1);
  473. var fadeout = setInterval(function() {
  474. if (!canhiden || !canhiden2) {
  475. clearTimeout(icon_timeout);
  476. clearInterval(fadeout);
  477. icon_timeout = 0;
  478. $(".TaoTotal").css("opacity", 1);
  479. setTimeout(function() { hidensetting(); }, 1000);
  480. return;
  481. }
  482. $(".TaoTotal").css("opacity", Number($(".TaoTotal").css("opacity")) - 0.01);
  483. if (Number($(".TaoTotal").css("opacity")) <= 0.1) {
  484. clearInterval(fadeout);
  485. $(".TaoTotal").css("opacity", 0);
  486. $("#AutoSignSettingIcon").css("-webkit-transform", " rotate(0deg)").css("-ms-transform", " rotate(0deg)").css("transform", " rotate(0deg);").css("top", "");
  487. $(".TaoTotal").css("display", "none");
  488. }
  489. }, 10);
  490. }, 800);
  491. }
  492.  
  493. function createSettingsWindow() {
  494. if (document.body !== null && document.querySelector("#AutoSignSettingFrame") === null) {
  495. let Container = document.createElement('div');
  496. Container.id = "AutoSignSettingFrame";
  497. Container.innerHTML = updateUI();
  498. document.body.appendChild(Container);
  499. $("#AutoSignSettingIcon").on('mouseover', function(e) {
  500. canhiden = 0;
  501. $("#AutoSignSettingIcon").css("-webkit-transform", " rotate(180deg)").css("-ms-transform", " rotate(180deg)").css("transform", " rotate(180deg);").css("top", 0);
  502. setTimeout(function() {
  503. $(".TaoTotal").css("display", "block");
  504. var fadein = setInterval(function() {
  505. $(".TaoTotal").css("opacity", Number($(".TaoTotal").css("opacity")) + 0.01);
  506. if (Number($(".TaoTotal").css("opacity")) >= 1) {
  507. clearInterval(fadein);
  508. $(".TaoTotal").css("opacity", 1);
  509. }
  510. }, 10);
  511. }, 700);
  512. });
  513. $("#AutoSignSettingIcon").on('mouseout', function(e) {
  514. canhiden = 1;
  515. hidensetting();
  516. });
  517.  
  518. $(".TaoTotal").on('mouseover', function(e) {
  519. canhiden2 = 0;
  520. if(location.href.match(/chaoxing\.com/) !== null){
  521. $(".wrap1200.clearfix,.headbanner_new,#to_top,.foot").css("filter", "blur(10px)");
  522. }else{
  523. $("#preloading,#react-body").css("filter", "blur(10px)");
  524. }
  525. });
  526. $(".TaoTotal").on('mouseout', function(e) {
  527. canhiden2 = 1;
  528. hidensetting();
  529. if(location.href.match(/chaoxing\.com/) !== null){
  530. $(".wrap1200.clearfix,.headbanner_new,#to_top,.foot").css("filter", "none");
  531. }else{
  532. $("#preloading,#react-body").css("filter", "none");
  533. }
  534. });
  535. $("#TTS_IsOpen").on('click', function(e) {
  536. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  537. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  538. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  539. AutoSignConfig.TTS_IsOpen = IsOpen;
  540. UpdateSettings();
  541. if (T2S_timeout) {
  542. clearTimeout(T2S_timeout);
  543. }
  544. T2S_timeout = setTimeout(function() {
  545. window.T2STEST();
  546. }, 1000);
  547. });
  548. $("#TTS_Volce").on('input', function(e) {
  549. var Tmp = Number(e.target.value);
  550. Tmp = Tmp > 15 ? 15 : Tmp < 0 ? 0 : Tmp;
  551. AutoSignConfig.TTS_Volce = Tmp;
  552. $("#TTS_Volce").val(Tmp);
  553. UpdateSettings();
  554. if (T2S_timeout) {
  555. clearTimeout(T2S_timeout);
  556. }
  557. T2S_timeout = setTimeout(function() {
  558. window.T2STEST();
  559. }, 1000);
  560. });
  561. $("#TTS_Speed").on('input', function(e) {
  562. var Tmp = Number(e.target.value);
  563. Tmp = Tmp > 9 ? 9 : Tmp < 0 ? 0 : Tmp;
  564. AutoSignConfig.TTS_Speed = Tmp;
  565. $("#TTS_Speed").val(Tmp);
  566. UpdateSettings();
  567. if (T2S_timeout) {
  568. clearTimeout(T2S_timeout);
  569. }
  570. T2S_timeout = setTimeout(function() {
  571. window.T2STEST();
  572. }, 1000);
  573. });
  574. if(location.href.match(/chaoxing\.com/) !== null){
  575. $("#CX_IsOpen").on('click', function(e) {
  576. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  577. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  578. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  579. AutoSignConfig.CX_IsOpen = IsOpen;
  580. UpdateSettings();
  581. });
  582. $("#CX_IsRandomWaiting").on('click', function(e) {
  583. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  584. if (IsOpen) {
  585. var boo = confirm('这是一个测试的选项,请谨慎打开开关,\n如果异常请打开console控制台,并把报错的内容反馈到插件的主页(右上角有链接)\n你确定要打开么?');
  586. //confirm 会返回你选择的选项,然后可以依据选择执行逻辑
  587. if (!boo) {
  588. return;
  589. }
  590. }
  591. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  592. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  593. AutoSignConfig.CX_IsRandomWaiting = IsOpen;
  594. UpdateSettings();
  595. });
  596. $("#CX_WaitingTime").on('input', function(e) {
  597. AutoSignConfig.CX_WaitingTime = Number(e.target.value);
  598. UpdateSettings();
  599. });
  600. $("#CX_MaxWaitingCount").on('input', function(e) {
  601. AutoSignConfig.CX_MaxWaitingCount = Number(e.target.value);
  602. UpdateSettings();
  603. });
  604. }else{
  605. $("#TXKT_Signing_WaitingTime").on('input', function(e) {
  606. AutoSignConfig.TXKT_Signing_WaitingTime = Number(e.target.value);
  607. UpdateSettings();
  608. });
  609. $("#TXKT_Ansering_IsRandom").on('click', function(e) {
  610. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  611. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  612. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  613. AutoSignConfig.TXKT_Ansering_IsRandom = IsOpen;
  614. UpdateSettings();
  615. });
  616. $("#TXKT_Ansering_IsOpen").on('click', function(e) {
  617. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  618. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  619. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  620. AutoSignConfig.TXKT_Ansering_IsOpen = IsOpen;
  621. UpdateSettings();
  622. });
  623. $("#TXKT_Ansering_WaitingTime").on('input', function(e) {
  624. AutoSignConfig.TXKT_Ansering_WaitingTime = Number(e.target.value);
  625. UpdateSettings();
  626. });
  627. $("#TXKT_Repeater_IsOpen").on('click', function(e) {
  628. var IsOpen = !!!$(e.target).attr("class").match(/Setting_On/g);
  629. $(e.target).addClass(!IsOpen ? "Setting_Off" : "Setting_On");
  630. $(e.target).removeClass(!IsOpen ? "Setting_On" : "Setting_Off");
  631. AutoSignConfig.TXKT_Repeater_IsOpen = IsOpen;
  632. UpdateSettings();
  633. });
  634. $("#TXKT_Repeater_WaitingTime").on('input', function(e) {
  635. AutoSignConfig.TXKT_Repeater_WaitingTime = Number(e.target.value);
  636. UpdateSettings();
  637. });
  638. $("#TXKT_Repeater_MaxWaitingCount").on('input', function(e) {
  639. AutoSignConfig.TXKT_Repeater_MaxWaitingCount = Number(e.target.value);
  640. UpdateSettings();
  641. });
  642. }
  643. $("#AutoSignSettingIcon").on('dblclick', function(e) {
  644. if (window.confirm('你确定要删除已有设置吗?')) {
  645. AutoSignConfig = DefaultConfig;
  646. UpdateSettings();
  647. alert("清除成功!即刻生效");
  648. createSettingsWindow();
  649. return true;
  650. } else {
  651. return false;
  652. }
  653. });
  654. } else {
  655. document.getElementById("AutoSignSettingFrame").innerHTML = updateUI();
  656. }
  657. }
  658. if (top.location == self.location) {
  659. $(document).ready(function() {
  660. GM_addStyle(`
  661. #preloading, #react-body,.headbanner_new,.wrap1200.clearfix,#to_top,.foot{
  662. -webkit-transition:.7s filter;
  663. -o-transition:.7s filter;
  664. -moz-transition:.7s filter;
  665. transition:.7s filter;
  666. }
  667. .TaoMain{
  668. color:aliceblue;
  669. }
  670. #AutoSignSettingIcon {
  671. position: fixed;
  672. left: 50%;
  673. top: -48px;
  674. margin-left: -132px;
  675. z-index: 99999999999;
  676. background-size: 100% 100%;
  677. -webkit-box-sizing: border-box;
  678. box-sizing: border-box;
  679. -webkit-transition: 0.7s;
  680. -webkit-transition-delay: 0.2s;
  681. -o-transition: 0.7s;
  682. -o-transition-delay: 0.2s;
  683. transition: 0.7s;
  684. transition-delay: 0.2s;
  685. padding: 0;
  686. cursor: pointer;
  687. width: 60px;
  688. height: 60px;
  689. border: 4px solid #00bdff96;
  690. border-radius: 50%;
  691. background: url('https://i.loli.net/2020/05/07/6xDftH98IO15MoF.png') no-repeat center center;
  692. -webkit-transform: rotate(0deg);
  693. -ms-transform: rotate(0deg);
  694. transform: rotate(0deg);
  695. }
  696. .Setting_ul {
  697. margin: 5px;
  698. }
  699. .Setting_btn {
  700. border-radius: 50%;
  701. width: 20px;
  702. height: 20px;
  703. border: none;
  704. }
  705. .Setting_On {
  706. background-color: green;
  707. }
  708. .Setting_Off {
  709. background-color: red;
  710. }
  711. .TaoMain{
  712. z-index: 9999999999;
  713. position: fixed;
  714. top: 65px;
  715. left: 50%;
  716. }
  717. .TaoTotal {
  718. -webkit-box-sizing: border-box;
  719. box-sizing: border-box;
  720. min-width:264px;
  721. opacity:0;
  722. margin-left: -132px;
  723. display:none;
  724. border-radius: 3px;
  725. border: 1px solid #A0A0A0;
  726. -webkit-box-shadow: -2px 2px 5px rgba(0,0,0,0.3);
  727. box-shadow: -2px 2px 5px rgba(0,0,0,0.3);
  728. background:rgba(0,0,0,0.8);
  729. width: -webkit-fit-content;
  730. width: -moz-fit-content;
  731. width: fit-content;
  732. padding: 15px;
  733. overflow-y:hidden ;
  734. }
  735. .TaoTotal>fieldset {
  736. margin: auto;
  737. display: -webkit-box;
  738. display: -ms-flexbox;
  739. display: flex;
  740. -webkit-box-orient: vertical;
  741. -webkit-box-direction: normal;
  742. justify-content: space-around;
  743. -ms-flex-direction: column;
  744. flex-direction: column;
  745. -ms-flex-pack: distribute;
  746. items-align: center;
  747. margin: auto;
  748. }
  749. .SettingTitle {
  750. font-size: 15px;
  751. -webkit-transition: 0.5s;
  752. -o-transition: 0.5s;
  753. transition: 0.5s;
  754. }
  755. #fieldsetAll>fieldset:hover>div {
  756. -o-transition: height 0.5s;
  757. transition: height 0.5s;
  758. -webkit-transition: height 0.5s;
  759. height: 55px;
  760. }
  761. #fieldsetAll{
  762. max-height: 403px;
  763. overflow-y:hidden ;
  764. }
  765. fieldset{
  766. padding: .35em .625em .75em;
  767. border: 1px solid silver;
  768. }
  769. #fieldsetAll>fieldset>div {
  770. -o-transition: height 0.5s;
  771. -o-transition-delay: 0.5s;
  772. transition: height 0.5s;
  773. transition-delay: 0.5s;
  774. -webkit-transition: height 0.5s;
  775. -webkit-transition-delay: 0.5s;
  776. height: 0;
  777. overflow: hidden;
  778. }
  779. .SettingTitle:hover {
  780. color: red;
  781. font-size: 18px;
  782. cursor: help;
  783. -webkit-transition: 0.7s;
  784. -webkit-transition-duration: 0.7s;
  785. -o-transition: 0.7s;
  786. -o-transition-duration: 0.7s;
  787. transition: 0.7s;
  788. transition-duration: 0.7s;
  789. }
  790. .Setting_Choice>label {
  791. margin: auto;
  792. }
  793. input.Setting_input {
  794. text-align: center;
  795. -moz-text-align-last: center;
  796. text-align-last: center;
  797. margin: 0 2px;
  798. vertical-align: middle;
  799. }
  800. input.Setting_input[type="number"] {
  801. width: 70px;
  802. color:blue;
  803. }
  804. #fieldsetAll>fieldset {
  805. margin: 5px;
  806. }
  807. hr.MyScript {
  808. margin: 0 auto;
  809. border: groove;
  810. }
  811. #react-body{
  812. transition: .2s filter;
  813. filter:none;
  814. }
  815. #AutoSignSettingFrame{
  816. font-size: 14px;
  817. line-height: 1.5;
  818. font-family: system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Droid Sans,Helvetica Neue,Microsoft YaHei UI,Microsoft YaHei,Hiragino Sans GB,Source Han Sans CN,Fira Sans,arial,sans-serif;
  819. }
  820. `);
  821. createSettingsWindow();
  822. });
  823. }
  824.  
  825. function b64en(str) {
  826. return btoa(encodeURIComponent(str));
  827. }
  828.  
  829. function b64de(str) {
  830. return decodeURIComponent(atob(str));
  831. }
  832. window.T2STEST = function() {
  833. window.T2S("这里是语音测试,如果声音大小,或是语速不合适请修改参数。Power By 涛之雨");
  834. };
  835. $(document).ready(function() {
  836. URLChoicer(false);
  837. });
  838.  
  839. function ke() {
  840. if ($(".ke_loading").length!==0) {
  841. console.log("等待加载完成");
  842. setTimeout(function() {
  843. ke();
  844. }, 2000);
  845. return;
  846. }
  847.  
  848. if ($(".im-dialog-bd-msg").length!==0) {
  849. console.log("错误!\n" + $(".im-dialog-bd-msg").text());
  850. TXKTloading = 0;
  851. window.location.reload();
  852. return;
  853. }
  854. if (location.href.match(/vid=\d+/) !== null) {
  855. console.log("录播");
  856. return;
  857. }
  858.  
  859. function auto_sign(timeout = 5000) {
  860. if (auto_sign_interval) {
  861. clearInterval(auto_sign_interval);
  862. }
  863. auto_sign_interval = setInterval(function() {
  864. try {
  865. if($(".tip").length!==0){
  866. if ($(".tip")[0].innerText.match(/签到/)) {
  867. if ($(".btn-group")[0] !== undefined) {
  868. if (auto_sign_interval) {
  869. clearInterval(auto_sign_interval);
  870. }
  871. $(".btn-group")[0].children[0].click();
  872. setTimeout(function() {
  873. $(".btn-group")[0].children[0].click();
  874. sign_times++;
  875. window.T2S("自动签到插件,签到成功!本节课累积已为您签到," + String(sign_times) + "次。");
  876. auto_sign(Number(AutoSignConfig.TXKT_Signing_WaitingTime));
  877. console.log("%c【腾讯课堂自动签到插件】%c\n于 %s %c签到成功!\n本节课累积已为您签到%c" + String(sign_times) + "次%c!", "color:white;background-color:blue;font-size:20px", "color:red;font-size:20px", (new Date().toLocaleTimeString()), "color:black", "color:red;font-size:20px", "color:black");
  878. }, 500);
  879. }
  880. }
  881. }
  882. } catch (e) {console.log(e)}
  883. }, timeout);
  884. }
  885.  
  886. function auto_Answer(timeout = 1000) {
  887. var isAnswering = false;
  888. var isfristtime = true;
  889. var tx_timeout, timeout_min, timeout_sec, timeout_all, tmp_timeout = 0,
  890. checkout_times = 0;
  891. var isbackingtime = AutoSignConfig.TXKT_Ansering_WaitingTime < 0 ? true : false;
  892. if (AutoSignConfig.TXKT_Ansering_WaitingTime === 0) {
  893. return;
  894. }
  895. var timeout_def = Math.abs(AutoSignConfig.TXKT_Ansering_WaitingTime);
  896. var getrandomchoice = function(totalnumber = 2) {
  897. return Math.floor((Math.random() * totalnumber) + 1) - 1;
  898. };
  899. var answering = function(israndom = true) {
  900. console.log("开始答题");
  901. var anser_type = $(".head-text")[0].innerHTML;
  902. var mychoice = AutoSignConfig.TXKT_Ansering_IsRandom ? getrandomchoice($(".s-f-rc-item").length) : 0;
  903. console.info("anser_type:" + anser_type);
  904. $(".s-f-rc-item")[mychoice].click(); //选择
  905. document.querySelector("#react-body > div.examcard-dialog > div.im-dialog-wrap > div > div.btn-group > span").click(); //提交
  906. setTimeout(function() {
  907. document.querySelector("#react-body > div.examcard-dialog > div.im-dialog-wrap > div > div.dialog-head.drag-handler > i").click(); //关闭窗口
  908. answer_times++;
  909. window.T2S("辅助答题插件,答题成功!本次选择为:" + ["A", "B", "C", "D", "E"][mychoice] + "。本节课累积已为您辅助," + String(answer_times) + "次。");
  910. console.log("%c【腾讯课堂自动签到插件】%c\n%s %c辅助答题成功!\n本次选择为:" + ["A", "B", "C", "D", "E"][mychoice] + "。\n本节课累积已为您答题%c" + String(answer_times) + "次%c!", "color:white;background-color:blue;font-size:20px", "color:red;font-size:20px", (new Date().toLocaleTimeString()), "color:black", "color:red;font-size:20px", "color:black");
  911. isAnswering = false;
  912. }, 200);
  913. };
  914. if (auto_answer_interval) {
  915. clearInterval(auto_answer_interval);
  916. }
  917. auto_answer_interval = setInterval(function() {
  918. try {
  919. if ($(".head-text").length) { //单选题、多选题、(未知)
  920. if ($(".head-text")[0].innerHTML.match(/选题/)) {
  921. if (isfristtime) {
  922. isfristtime = false;
  923. window.T2S("检测到答题窗口,正在密切监视中。。。");
  924. console.log("检测到答题窗口,正在密切监视中。。。");
  925. }
  926. tx_timeout = $(".xq_num")[0].innerHTML;
  927. timeout_min = Number(tx_timeout.match(/\d{2}/g)[0]);
  928. timeout_sec = Number(tx_timeout.match(/\d{2}/g)[1]);
  929. timeout_all = timeout_min * 60 + timeout_sec - 1; //当前答题的剩余时间
  930. console.log("答题辅助:==%s==\n" + timeout_all, (new Date().toLocaleTimeString()));
  931. if (!isAnswering) {
  932. if ($(".drag-handler").length != "0") { //存在答题窗口
  933. if (isbackingtime) {
  934. checkout_times = timeout_all;
  935. if (checkout_times <= timeout_def) {
  936. console.log("时间到!开始执行辅助作答\n随机选择:%c%s", (AutoSignConfig.TXKT_Ansering_IsRandom ? "color:green" : "color:red"), (AutoSignConfig.TXKT_Ansering_IsRandom ? "开" : "关"));
  937. answering(AutoSignConfig.TXKT_Ansering_IsRandom);
  938. isAnswering = true;
  939. } else {
  940. console.log("监视中,剩余等待时间:%c%s%c秒", "color:red", Math.abs(timeout_def - checkout_times), "color:black");
  941. }
  942. } else {
  943. if (checkout_times >= timeout_def) {
  944. console.log("时间到!开始执行辅助作答\n随机选择:%c%s", (AutoSignConfig.TXKT_Ansering_IsRandom ? "color:green" : "color:red"), (AutoSignConfig.TXKT_Ansering_IsRandom ? "开" : "关"));
  945. answering(AutoSignConfig.TXKT_Ansering_IsRandom);
  946. isAnswering = true;
  947. } else {
  948. checkout_times++;
  949. console.log("监视中,剩余等待时间:%c%s%c秒", "color:red", Math.abs(timeout_def - checkout_times), "color:black");
  950. }
  951. }
  952. }
  953. }
  954. }
  955. } else {
  956. checkout_times = 0; //没有签到窗口
  957. isfristtime = true;
  958. }
  959. } catch (e) {
  960. checkout_times = 0; //未知错误吧。。。。
  961. isfristtime = true;
  962. console.error("未知错误!\n请复制错误信息提交反馈====>>\n\n", e);
  963. }
  964. }, timeout);
  965. }
  966.  
  967. function auto_Repeater(waitetime = 1000, maxtimes = 7) {
  968. if (auto_Repeater_timeout) {
  969. clearTimeout(auto_Repeater_timeout);
  970. auto_Repeater_timeout = 0;
  971. }
  972. function AIreplace(str=""){
  973. return str.replace(/(|)| |、|。|,"/g, function(matchStr) {
  974. var tokenMap = {
  975. "(": "(",
  976. ")": ")",
  977. " ": "",
  978. "、": "",
  979. "。": ".",
  980. ",": ",",
  981. };
  982. return tokenMap[matchStr];
  983. });
  984. }
  985. var arr = document.querySelectorAll(".js-chat-item-msg-content span");
  986. var i = 0;
  987. var arrlength = arr.length - 1;
  988. var wordnow="";
  989. if (arrlength + 1 >= maxtimes) {
  990. try {
  991. while (i<arrlength&&AIreplace(arr[arrlength - i].innerHTML.trim()) == AIreplace(arr[arrlength - 1 - i].innerHTML.toString().trim())) {
  992. if (AIreplace(arr[arrlength - i].innerHTML.toString().trim()) == AIreplace(blacklist)) {
  993. i = -2;
  994. break;
  995. }
  996. i++;
  997. }
  998. wordnow=arr[arrlength].innerHTML.toString().trim();
  999. if (i + 1 >= maxtimes) {
  1000. console.log("有效重复:" + (i + 1) + "次\n有效词:“" +wordnow+ "”");
  1001. if (!document.querySelector('div.ql-blank')) {
  1002. document.querySelector('.ql-editor').innerHTML = "";
  1003. }
  1004. var a = setInterval(function() {
  1005. try {
  1006. document.querySelector('div.ql-blank').firstElementChild.innerHTML = wordnow;
  1007. clearInterval(a);
  1008. setTimeout(function() {
  1009. document.querySelector('button.text-editor-btn').click();
  1010. repeat_times++;
  1011. console.log("%c【腾讯课堂·复读机】%c\n于 %s %c复读成功!\n本节课累积已为您复读%c" + String(repeat_times) + "次%c!\n本次复读内容:%c" + wordnow,
  1012. "color:white;background-color:blue;font-size:20px", "color:red;font-size:20px", (new Date().toLocaleTimeString()), "color:black", "color:red;font-size:20px", "color:black", "color:red;font-size:20px");
  1013. }, 1000);
  1014. } catch (e) {}
  1015. }, 1);
  1016. blacklist = wordnow;
  1017. i = -3;
  1018. }
  1019. } catch (e) {
  1020. console.error("未知错误!\n请复制错误信息提交反馈====>>\n\n", e);
  1021. }
  1022. } else {
  1023. i = -1;
  1024. }
  1025. console.log("复读机检测,检测状态:正常,\n" +
  1026. (i == -1 ? "评论不足" + String(maxtimes) + "条,当前条数:" + String(arrlength + 1)+"\n等待10秒":
  1027. i == -2 ? "黑名单词组“" + blacklist + "”\n等待10秒" :
  1028. i == -3 ? "复读成功!,当前词组:“" + wordnow + "”\n等待10秒" :
  1029. i == 0 ? "无重复,当前词组:“" + wordnow + "”" :
  1030. "重复条数:" + String(i + 1) + ",当前词组:“" + wordnow + "”"
  1031. )
  1032. );
  1033. if (i == -1 || i == -2 || i == -3) {
  1034. auto_Repeater_timeout = setTimeout(function() {
  1035. auto_Repeater(Number(AutoSignConfig.TXKT_Repeater_WaitingTime), Number(AutoSignConfig.TXKT_Repeater_MaxWaitingCount));
  1036. }, 10000);
  1037. } else {
  1038. auto_Repeater_timeout = setTimeout(function() {
  1039. auto_Repeater(Number(AutoSignConfig.TXKT_Repeater_WaitingTime), Number(AutoSignConfig.TXKT_Repeater_MaxWaitingCount));
  1040. }, waitetime);
  1041. }
  1042. }
  1043. function reloading() {
  1044. if (self.fetch) {
  1045. try {
  1046. var cid = location.href.match(/cid=\d+/)[0].match(/\d+/)[0];
  1047. var tid = location.href.match(/term_id=\d+/)[0].match(/\d+/)[0];
  1048. fetch("https://ke.qq.com/cgi-bin/pubAccount/getLiveInfo?course_id=" + cid + "&term_id=" + tid, { method: 'GET' })
  1049. .then(function(response) { return response.json(); }).then(function(j) {
  1050. switch (j.result.offline_status) {
  1051. case 1:
  1052. console.log('直播中!立即刷新');
  1053. window.location.reload();
  1054. break;
  1055. case 2:
  1056. console.log('直播结束(有可能是未开课),继续监视');
  1057. setTimeout(reloading, 10000);
  1058. break;
  1059. case 3:
  1060. console.log('直播状态错误,刷新试试?(其实没啥用)');
  1061. window.location.reload();
  1062. break;
  1063. case 4:
  1064. console.log('老师网挂了?就继续监视呗');
  1065. setTimeout(reloading, 10000);
  1066. break;
  1067. }
  1068. }).catch(function(err){
  1069. console.log("网络请求错误!",err);
  1070. console.log("5秒后刷新");
  1071. setTimeout(function() { window.location.reload(); }, 5000);
  1072. });
  1073. } catch (e) {
  1074. console.error("错误!(有可能是链接不对叭)==>" + e);
  1075. setTimeout(function() { window.location.reload(); }, 10000);
  1076. }
  1077. } else {
  1078. setTimeout(function() { window.location.reload(); }, 10000);
  1079. }
  1080. return;
  1081. }
  1082. if ($(".ke_overlay")===null||$(".ke_overlay").length === 0) {
  1083. if($(".video-mask.video-play-btn")!==null){
  1084. $(".video-mask.video-play-btn").click();
  1085. }
  1086. console.group("[%c腾讯课堂插件%c开启情况]", "color:red;", "color:black;");
  1087. if (AutoSignConfig.TXKT_Signing_WaitingTime) {
  1088. console.log("%c【腾讯课堂·自动签到】%c功能已%c开启", "color:red", "color:black", "background-color:green;color:white;");
  1089. setTimeout(function() { auto_sign(Number(AutoSignConfig.TXKT_Signing_WaitingTime)); }, 1);
  1090. } else {
  1091. console.log("%c【腾讯课堂·自动签到】%c功能已%c关闭", "color:red", "color:black", "background-color:red;color:white;");
  1092. }
  1093. if (AutoSignConfig.TXKT_Ansering_IsOpen) {
  1094. console.log("%c【腾讯课堂·辅助作答】%c功能已%c开启", "color:red", "color:black", "background-color:green;color:white;");
  1095. setTimeout(function() { auto_Answer(); }, 1);
  1096. } else {
  1097. console.log("%c【腾讯课堂·辅助作答】%c功能已%c关闭", "color:red", "color:black", "background-color:red;color:white;");
  1098. }
  1099. if (AutoSignConfig.TXKT_Repeater_IsOpen) {
  1100. console.log("%c【腾讯课堂·自动复读】%c功能已%c开启", "color:red", "color:black", "background-color:green;color:white;");
  1101. setTimeout(function() { auto_Repeater(Number(AutoSignConfig.TXKT_Repeater_WaitingTime), Number(AutoSignConfig.TXKT_Repeater_MaxWaitingCount)); }, 1);
  1102. } else {
  1103. console.log("%c【腾讯课堂·自动复读】%c功能已%c关闭", "color:red", "color:black", "background-color:red;color:white;");
  1104. }
  1105. console.groupEnd("[腾讯课堂插件开启情况]");
  1106. } else {
  1107. if (TXKTloading >= 10) {
  1108. setTimeout(reloading, 10000);
  1109. return;
  1110. } else {
  1111. TXKTloading++;
  1112. setTimeout(function() {
  1113. URLChoicer(true);
  1114. }, 100);
  1115. return;
  1116. }
  1117. }
  1118. }
  1119.  
  1120. function cx_sign(isReload=true) {
  1121. if (AutoSignConfig.CX_IsOpen) {
  1122. console.log("%c【超星·主页签到】%c功能已%c开启", "color:red", "color:black", "background-color:green;color:white;");
  1123. } else {
  1124. console.log("%c【超星·主页签到】%c功能已%c关闭", "color:red", "color:black", "background-color:red;color:white;");
  1125. return;
  1126. }
  1127. var getwaittingtime = function(time1,time2) {
  1128. return Math.floor((Math.random() * (time2-time1)) + time1) - 1;
  1129. };
  1130. var wait4time= Number(AutoSignConfig.CX_WaitingTime);
  1131. var wait_format = (parseInt(wait4time / 60) ? (parseInt(wait4time / 60) + "分钟") : "") +
  1132. (parseInt(wait4time % 60) ? parseInt(wait4time % 60) + "秒" : "");
  1133. console.group("$$课程信息$$(点我收起/展开)");
  1134. console.log("一共有%c" + $(".courseItem.curFile").length + "%c门课程:", "color:blue", "color:black");
  1135. window.T2S("签到插件开启,一共有" + $(".courseItem.curFile").length + "门课程。中心监视时长," + wait_format +( AutoSignConfig.CX_IsRandomWaiting?",允许":"不允许")+"随机正负5秒偏移。");
  1136. var echo_number=0;
  1137. if(isReload){
  1138. $(".courseItem.curFile").each(function(inumber,obj) {
  1139. setTimeout(function() {
  1140. inumber+=1;
  1141. var coursename = obj.children[3].children[0].children[0].innerText;
  1142. var courseID = obj.children[0].value;
  1143. var classID=obj.children[1].value;
  1144. console.log("No\t%s:\n专业:%c%s\n%ccourseID:%c" + courseID + "\n%cclassID为:%c" + classID,inumber, "color:red", coursename, "color:black", "color:red", "color:black", "color:red");
  1145. var sign_url = "http://mobilelearn.chaoxing.com/widget/pcpick/stu/index?courseId=" + courseID + "&coursename=" + b64en(coursename) + "&jclassId=" + classID;
  1146. var tmp = document.createElement("iframe");
  1147. tmp.id = 'loginframe_' + courseID;
  1148. tmp.src = sign_url;
  1149. tmp.style = "display:none;width: 0px;height: 0px;position: fixed;left: 0px;bottom: 0px;z-index: -99;";
  1150. $("body")[0].append(tmp);
  1151. echo_number=inumber;
  1152. },10);
  1153. });
  1154. }
  1155. var mytInterval=setInterval(function() {
  1156. if(echo_number==$(".courseItem.curFile").length){
  1157. console.groupEnd("$$课程信息$$(点我收起/展开)");
  1158. clearInterval(mytInterval);
  1159. }
  1160. },10);
  1161. }
  1162.  
  1163. function cx_main() {
  1164. if (!AutoSignConfig.CX_IsOpen) { //关闭主页自动签到
  1165. return;
  1166. }
  1167. var getwaittingtime = function(time1,time2) {
  1168. return Math.floor((Math.random() * (time2-time1)) + time1) - 1;
  1169. };
  1170. var wait4time=0;
  1171. if(!AutoSignConfig.CX_IsRandomWaiting){
  1172. wait4time= Number(AutoSignConfig.CX_WaitingTime);
  1173. }else{
  1174. wait4time= Number(AutoSignConfig.CX_WaitingTime);
  1175. wait4time=getwaittingtime(wait4time-5,wait4time+5);
  1176. }
  1177. if(wait4time<=1){
  1178. wait4time=5;
  1179. }
  1180. var wait_format = (parseInt(wait4time / 60) ? (String(parseInt(wait4time / 60)) + "分钟") : "") +
  1181. (String(parseInt(wait4time % 60)) ? String(parseInt(wait4time % 60)) + "秒" : "");
  1182. wait4time*=1000;
  1183. var coursename = "";
  1184. try {
  1185. coursename = location.href.match(/coursename=[A-Za-z0-9/\+=]+/g)[0].substring(11);
  1186. } catch (e) {}
  1187. var waitingTimes = location.href.match(/tao_auto_refresh_time=\d+/g),
  1188. MAX_waittingTimes = Number(AutoSignConfig.CX_MaxWaitingCount);
  1189. waitingTimes = Number((waitingTimes === null) ? 0 : waitingTimes[0].match(/\d+/g)[0]);
  1190. waitingTimes++;
  1191. try {
  1192. if ($(".qdhover").length !== 0) {
  1193. var getmsg = $(".qdhover").parent().parent().parent()[0].getAttributeNode("onclick").nodeValue.match(/\d+/g);
  1194. if (getmsg[1] == 2) { //普通签到
  1195. var activeId = getmsg[0];
  1196. var courseId = $("#courseId").val();
  1197. var classId = $("#classId").val();
  1198. var fid = $("#fid").val();
  1199. var url = "/widget/sign/pcStuSignController/signIn?activeId=" + activeId + "&classId=" + classId + "&coursename=" + coursename + "&fid=" + fid + "&courseId=" + courseId;
  1200. var tmp = document.createElement("iframe");
  1201. tmp.id = 'loginframe';
  1202. tmp.src = url;
  1203. tmp.style = "display:none;width: 0px;height: 0px;position: fixed;left: 0px;bottom: 0px;z-index: -99;";
  1204. $("body")[0].append(tmp);
  1205. $("#loginframe").load(function() {
  1206. if (window.frames[0].$("title")[0].text.match("成功") !== "") {
  1207. if (top.location == self.location) {
  1208. window.T2S("当前课程,签到成功");
  1209. console.log("%c【当前课程】签到成功!", "color:white;font-size:30px;background-color:green");
  1210. $(".qdhover").parent().parent().parent().children().children()[1].innerHTML += "<font style='color:white;font-size:30px;background-color:green;line-height: 30px;'> 签到成功!</font>";
  1211. $(this).remove();
  1212. } else {
  1213. window.T2S(b64de(coursename) + ",签到成功");
  1214. console.log("%c【%s】签到成功!", "color:white;font-size:30px;background-color:green", b64de(coursename));
  1215. }
  1216. } else {
  1217. window.T2S("未知错误!请手动签到!");
  1218. alert("未知错误!请手动签到!");
  1219. }
  1220. });
  1221. } else { //不支持
  1222. window.T2S(top.location == self.location ? "当前课程" : b64de(coursename) + ",出现非支持签到模式!请手动签到!!!");
  1223. alert("【" + top.location == self.location ? "当前课程" : b64de(coursename) + "】出现非支持签到模式!请手动签到!!!");
  1224. }
  1225. } else {
  1226. if (MAX_waittingTimes && waitingTimes >= MAX_waittingTimes) {
  1227. window.T2S(top.location == self.location ? "当前课程" : b64de(coursename) + "已达尝试上限" + String(MAX_waittingTimes) + "次,已停止");
  1228. console.log("%c【%s】%c已达尝试上限%s次,已停止", "color:red", top.location == self.location ? "当前课程" : b64de(coursename), "color:black", String(MAX_waittingTimes));
  1229. return;
  1230. } else {
  1231. console.log("%c【%s】%c第" + String(waitingTimes) + "次尝试,\n暂无签到任务,%s后自动再次尝试", "color:red", (top.location == self.location ? "当前课程" : b64de(coursename)), "color:black", wait_format);
  1232. setTimeout(function() {
  1233. window.location.href = location.href.indexOf("tao_auto_refresh_time") > -1 ? (location.href.replace(new RegExp("tao_auto_refresh_time=\\d+", 'g'), "tao_auto_refresh_time=" + waitingTimes)) : (location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "tao_auto_refresh_time=" + waitingTimes);
  1234. }, wait4time);
  1235. }
  1236. }
  1237. } catch (e) {
  1238. console.log(e);
  1239. }
  1240. }
  1241. }
  1242. })();

QingJ © 2025

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