Greasy Fork镜像 支持简体中文。

超星/学习通||支持视频||考试||测试

轻轻松松完成,支持视频、音频、文档、图书自动完成,章节测验考试自动答题提交,支持自动切换任务点、挂机阅读时长、自动登录(不可用)等,解除各类功能限制,开放自定义参数||可以自己配置修改

目前為 2021-08-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name 超星/学习通||支持视频||考试||测试
  3. // @namespace name
  4. // @version 3.2.3.4
  5. // @description 轻轻松松完成,支持视频、音频、文档、图书自动完成,章节测验考试自动答题提交,支持自动切换任务点、挂机阅读时长、自动登录(不可用)等,解除各类功能限制,开放自定义参数||可以自己配置修改
  6. // @author wu & wd & Shadow
  7. // @match *://*.chaoxing.com/*
  8. // @match *://*.edu.cn/*
  9. // @connect www.api.52xn.xyz
  10. // @run-at document-end
  11. // @grant unsafeWindow
  12. // @grant GM_xmlhttpRequest
  13. // @grant GM_setClipboard
  14. // @supportURL http://tikull.me/
  15. // @original-script https://gf.qytechs.cn/scripts/369625
  16. // @original-author wyn665817
  17. // @original-license MIT
  18. // @license MIT
  19. // ==/UserScript==
  20.  
  21. // 设置修改后,需要刷新或重新打开网课页面才会生效
  22. var setting = {
  23. // 8E3 == 8000,科学记数法,表示毫秒数
  24. time: 8E3 // 默认响应速度为8秒,不建议小于5秒,减轻服务器响应压力
  25. ,review: 0 // 复习模式,完整挂机视频(音频)时长,支持挂机任务点已完成的视频和音频,默认关闭
  26. ,queue: 1 // 队列模式,开启后任务点逐一完成,关闭则单页面所有任务点同时进行,默认开启
  27. ,tk: 'http://www.api.52xn.xyz/'
  28. // 1代表开启,0代表关闭
  29. ,video: 1 // 视频支持后台、切换窗口不暂停,支持多视频,默认开启
  30. ,work: 1 // 自动答题功能(章节测验),作业需要手动开启查询,高准确率,默认开启
  31. ,audio: 1 // 音频自动播放,与视频功能共享vol和rate参数,默认开启
  32. ,book: 1 // 图书阅读任务点,非课程阅读任务点,默认开启
  33. ,docs: 1 // 文档阅读任务点,PPT类任务点自动完成阅读任务,默认开启
  34. // 本区域参数,上方为任务点功能,下方为独立功能
  35. ,jump: 1 // 自动切换任务点、章节、课程(需要配置course参数),默认关闭
  36. ,read: '65' // 挂机课程阅读时间,单位是分钟,'65'代表挂机65分钟,请手动打开阅读页面,默认'65'分钟
  37. ,face: 1 // 解除面部识别(不支持二维码类面部采集),此功能仅为临时解除,默认关闭
  38. ,total: 0 // 显示课程进度的统计数据,在学习进度页面的上方展示,默认关闭
  39.  
  40. // 仅开启video(audio)时,修改此处才会生效
  41. ,line: '公网1' // 视频播放的默认资源线路,此功能适用于系统默认线路无资源,默认'公网1'
  42. ,http: '标清' // 视频播放的默认清晰度,无效参数则使用系统默认清晰度,默认'标清'
  43. // 本区域参数,上方为video功能独享,下方为audio功能共享
  44. ,vol: '0' // 默认音量的百分数,设定范围:[0,100],'0'为静音,默认'0'
  45. ,rate: '1' // 视频播放默认倍率,参数范围0∪[0.0625,16],'0'为秒过,默认'1'倍
  46.  
  47. // 仅开启work时,修改此处才会生效
  48. ,auto: 1 // 答题完成后自动提交,默认开启
  49. ,none: 0 // 无匹配答案时执行默认操作,关闭后若题目无匹配答案则会暂时保存已作答的题目,默认关闭
  50. ,scale: 0 // 富文本编辑器高度自动拉伸,用于文本类题目,答题框根据内容自动调整大小,默认关闭
  51.  
  52. // 仅开启jump时,修改此处才会生效
  53. ,course: 1 // 当前课程完成后自动切换课程,仅支持按照根目录课程顺序切换,默认开启
  54. ,lock: 1 // 跳过未开放(图标是锁)的章节,即闯关模式或定时发放的任务点,默认开启
  55.  
  56. // 自动登录(不可用)功能配置区
  57. ,school: '账号为手机号可以不修改此参数' // 学校/单位/机构码,要求完整有效可查询,例如'清华大学'
  58. ,username: '' // 学号/工号/借书证号(邮箱/手机号/账号),例如'2018010101',默认''
  59. ,password: '' // 密码,例如'123456',默认''
  60. },
  61. _self = unsafeWindow,
  62. url = location.pathname,
  63. top = _self;
  64.  
  65. if (url != '/studyApp/studying' && top != _self.top) document.domain = location.host.replace(/.+?\./, '');
  66.  
  67. try {
  68. while (top != _self.top) {
  69. top = top.parent.document ? top.parent : _self.top;
  70. if (top.location.pathname == '/mycourse/studentstudy') break;
  71. }
  72. } catch (err) {
  73. // console.log(err);
  74. top = _self;
  75. }
  76.  
  77. var $ = _self.jQuery || top.jQuery,
  78. parent = _self == top ? self : _self.parent,
  79. Ext = _self.Ext || parent.Ext || {},
  80. UE = _self.UE,
  81. vjs = _self.videojs;
  82.  
  83. String.prototype.toCDB = function() {
  84. return this.replace(/\s/g, '').replace(/[\uff01-\uff5e]/g, function(str) {
  85. return String.fromCharCode(str.charCodeAt(0) - 65248);
  86. }).replace(/[“”]/g, '"').replace(/[‘’]/g, "'").replace(/。/g, '.');
  87. };
  88.  
  89. setting.normal = ''; // ':visible'
  90. // setting.time += Math.ceil(setting.time * Math.random()) - setting.time / 2;
  91. setting.job = [':not(*)'];
  92.  
  93. setting.video && setting.job.push('iframe[src*="/video/index.html"]');
  94. setting.work && setting.job.push('iframe[src*="/work/index.html"]');
  95. setting.audio && setting.job.push('iframe[src*="/audio/index.html"]');
  96. setting.book && setting.job.push('iframe[src*="/innerbook/index.html"]');
  97. setting.docs && setting.job.push('iframe[src*="/ppt/index.html"]', 'iframe[src*="/pdf/index.html"]');
  98.  
  99. setting.tip = !setting.queue || top != _self && jobSort($ || Ext.query);
  100.  
  101. if (url == '/mycourse/studentstudy') {
  102. _self.checkMobileBrowerLearn = $.noop;
  103. var classId = location.search.match(/cla[zs]{2}id=(\d+)/i)[1] || 0,
  104. courseId = _self.courseId || location.search.match(/courseId=(\d+)/i)[1] || 0;
  105. setting.lock || $('#coursetree').on('click', '[onclick*=void], [href*=void]', function() {
  106. _self.getTeacherAjax(courseId, classId, $(this).parent().attr('id').slice(3));
  107. });
  108. } else if (url == '/ananas/modules/video/index.html' && setting.video) {
  109. if (setting.review) _self.greenligth = Ext.emptyFn;
  110. checkPlayer(_self.supportH5Video());
  111. } else if (url == '/work/doHomeWorkNew' || url == '/api/work' || url == '/work/addStudentWorkNewWeb') {
  112. if (!UE) {
  113. var len = ($ || Ext.query || Array)('font:contains(未登录(不可用))', document).length;
  114. setTimeout(len == 1 ? top.location.reload : parent.greenligth, setting.time);
  115. } else if (setting.work) {
  116. setTimeout(relieveLimit, 0);
  117. beforeFind();
  118. }
  119. } else if (url == '/ananas/modules/audio/index.html' && setting.audio) {
  120. if (setting.review) _self.greenligth = Ext.emptyFn;
  121. _self.videojs = hookAudio;
  122. hookAudio.xhr = vjs.xhr;
  123. } else if (url == '/ananas/modules/innerbook/index.html' && setting.book && setting.tip) {
  124. setTimeout(function() {
  125. _self.setting ? _self.top.onchangepage(_self.getFrameAttr('end')) : _self.greenligth();
  126. }, setting.time);
  127. } else if (url.match(/^\/ananas\/modules\/(ppt|pdf)\/index\.html$/) && setting.docs && setting.tip) {
  128. setTimeout(function() {
  129. _self.setting ? _self.finishJob() : _self.greenligth();
  130. }, setting.time);
  131. frameElement.setAttribute('download', 1);
  132. } else if (url == '/knowledge/cards') {
  133. $ && checkToNext();
  134. } else if (url.match(/^\/(course|zt)\/\d+\.html$/)) {
  135. setTimeout(function() {
  136. +setting.read && _self.sendLogs && $('.course_section:eq(0) .chapterText').click();
  137. }, setting.time);
  138. } else if (url == '/ztnodedetailcontroller/visitnodedetail') {
  139. setting.read *= 60 / $('.course_section').length;
  140. setting.read && _self.sendLogs && autoRead();
  141. } else if (url == '/mycourse/studentcourse') {
  142. var gv = location.search.match(/d=\d+&/g);
  143. setting.total && $('<a>', {
  144. href: '/moocAnalysis/chapterStatisticByUser?classI' + gv[1] + 'courseI' + gv[0] + 'userId=' + _self.getCookie('_uid') + '&ut=s',
  145. target: '_blank',
  146. title: '点击查看章节统计',
  147. style: 'margin: 0 25px;',
  148. html: '本课程共' + $('.icon').length + '节,剩余' + $('em:not(.openlock)').length + '节未完成'
  149. }).appendTo('.zt_logo').parent().width('auto');
  150. } else if (url.match(/^\/visit\/(courses|interaction)$/)) {
  151. setting.face && $('.zmodel').on('click', '[onclick^=openFaceTip]', DisplayURL);
  152. } else if (location.host.match(/^passport2/)) {
  153. setting.username && getSchoolId();
  154. } else if (location.hostname == 'i.mooc.chaoxing.com') {
  155. _self.layui.use('layer', function() {
  156. this.layer.open({content: '拖动进度条、倍速播放、秒过会导致不良记录!', title: '超星网课助手提示', btn: '我已知悉', offset: 't', closeBtn: 0});
  157. });
  158. } else if (url == '/widget/pcvote/goStudentVotePage') {
  159. $(':checked').click();
  160. $('.StudentTimu').each(function(index) {
  161. var ans = _self.questionlist[index].answer;
  162. $(':radio, :checkbox', this).each(function(num) {
  163. ans[num].isanswer && this.click();
  164. });
  165. $(':text', this).val(function(num) {
  166. return $(ans[num].content).text().trim();
  167. });
  168. });
  169. } else if (url == '/work/selectWorkQuestionYiPiYue') {
  170. submitAnswer(getIframe().parent(), $.extend(true, [], parent._data));
  171. }
  172.  
  173. function getIframe(tip, win, job) {
  174. if (!$) return Ext.get(frameElement || []).parent().child('.ans-job-icon') || Ext.get([]);
  175. do {
  176. win = win ? win.parent : _self;
  177. job = $(win.frameElement).prevAll('.ans-job-icon');
  178. } while (!job.length && win.parent.frameElement);
  179. return tip ? win : job;
  180. }
  181.  
  182. function jobSort($) {
  183. var fn = $.fn ? [getIframe(1), 'length'] : [self, 'dom'],
  184. sel = setting.job.join(', :not(.ans-job-finished) > .ans-job-icon' + setting.normal + ' ~ ');
  185. if ($(sel, fn[0].parent.document)[0] == fn[0].frameElement) return true;
  186. if (!getIframe()[fn[1]] || getIframe().parent().is('.ans-job-finished')) return null;
  187. setInterval(function() {
  188. $(sel, fn[0].parent.document)[0] == fn[0].frameElement && fn[0].location.reload();
  189. }, setting.time);
  190. }
  191.  
  192. function checkPlayer(tip) {
  193. _self.videojs = hookVideo;
  194. hookVideo.xhr = vjs.xhr;
  195. Ext.isSogou = Ext.isIos = Ext.isAndroid = false;
  196. var data = Ext.decode(_self.config('data')) || {};
  197. delete data.danmaku;
  198. data.doublespeed = 1;
  199. frameElement.setAttribute('data', Ext.encode(data));
  200. if (tip) return;
  201. _self.supportH5Video = function() {return true;};
  202. alert('此浏览器不支持html5播放器,请更换浏览器');
  203. }
  204.  
  205. function hookVideo() {
  206. _self.alert = console.log;
  207. var config = arguments[1],
  208. line = Ext.Array.filter(Ext.Array.map(config.playlines, function(value, index) {
  209. return value.label == setting.line && index;
  210. }), function(value) {
  211. return Ext.isNumber(value);
  212. })[0] || 0,
  213. http = Ext.Array.filter(config.sources, function(value) {
  214. return value.label == setting.http;
  215. })[0];
  216. config.playlines.unshift(config.playlines[line]);
  217. config.playlines.splice(line + 1, 1);
  218. config.plugins.videoJsResolutionSwitcher.default = http ? http.res : 360;
  219. config.plugins.studyControl.enableSwitchWindow = 1;
  220. config.plugins.timelineObjects.url = '/richvideo/initdatawithviewer?';
  221. config.plugins.seekBarControl.enableFastForward = 1;
  222. if (!setting.queue) delete config.plugins.studyControl;
  223. // config.preload = setting.tip ? 'auto' : 'none';
  224. var player = vjs.apply(this, arguments),
  225. a = '<a href="https://d0.ananas.chaoxing.com/download/' + _self.config('objectid') + '" target="_blank">',
  226. img = '<img src="https://d0.ananas.chaoxing.com/download/e363b256c0e9bc5bd8266bf99dd6d6bb" style="margin: 6px 0 0 6px;">';
  227. player.volume(Math.round(setting.vol) / 100 || 0);
  228. Ext.get(player.controlBar.addChild('Button').el_).setHTML(a + img + '</a>').dom.title = '下载视频';
  229. player.on('loadstart', function() {
  230. setting.tip && this.play().catch(Ext.emptyFn);
  231. this.playbackRate(setting.rate > 16 || setting.rate < 0.0625 ? 1 : setting.rate);
  232. });
  233. player.one(['loadedmetadata', 'firstplay'], function() {
  234. setting.two = setting.rate === '0' && setting.two < 1;
  235. setting.two && config.plugins.seekBarControl.sendLog(this.children_[0], 'ended', Math.floor(this.cache_.duration));
  236. });
  237. player.on('ended', function() {
  238. Ext.fly(frameElement).parent().addCls('ans-job-finished');
  239. });
  240. return player;
  241. }
  242.  
  243. function hookAudio() {
  244. _self.alert = console.log;
  245. var config = arguments[1];
  246. config.plugins.studyControl.enableSwitchWindow = 1;
  247. config.plugins.seekBarControl.enableFastForward = 1;
  248. if (!setting.queue) delete config.plugins.studyControl;
  249. var player = vjs.apply(this, arguments),
  250. a = '<a href="https://d0.ananas.chaoxing.com/download/' + _self.config('objectid') + '" target="_blank">',
  251. img = '<img src="https://d0.ananas.chaoxing.com/download/e363b256c0e9bc5bd8266bf99dd6d6bb" style="margin: 6px 0 0 6px;">';
  252. player.volume(Math.round(setting.vol) / 100 || 0);
  253. player.playbackRate(setting.rate > 16 || setting.rate < 0.0625 ? 1 : setting.rate);
  254. Ext.get(player.controlBar.addChild('Button').el_).setHTML(a + img + '</a>').dom.title = '下载音频';
  255. player.on('loadeddata', function() {
  256. setting.tip && this.play().catch(Ext.emptyFn);
  257. });
  258. player.one('firstplay', function() {
  259. setting.rate === '0' && config.plugins.seekBarControl.sendLog(this.children_[0], 'ended', Math.floor(this.cache_.duration));
  260. });
  261. player.on('ended', function() {
  262. Ext.fly(frameElement).parent().addCls('ans-job-finished');
  263. });
  264. return player;
  265. }
  266.  
  267. function relieveLimit() {
  268. if (setting.scale) _self.UEDITOR_CONFIG.scaleEnabled = false;
  269. $.each(UE.instants, function() {
  270. var key = this.key;
  271. this.ready(function() {
  272. this.destroy();
  273. UE.getEditor(key);
  274. });
  275. });
  276. }
  277.  
  278. function beforeFind() {
  279. setting.regl = parent.greenligth || $.noop;
  280. if ($.type(parent._data) == 'array') return setting.regl();
  281. setting.div = $(
  282. '<div style="border: 2px dashed rgba(138, 243, 247,0.7); width: 350px; position: fixed; top: 0; right: 0; z-index: 99999; background-color: rgba(197, 252, 255,0.7); overflow-x: auto;border-radius:10px">' +
  283. '<span style="font-size: medium;"></span>' +
  284. '<div style="font-size: medium;">正在搜索答案...</div>' +
  285. '<div style="border-top: 1px solid #000;margin: 2px;overflow: hidden;font-weight:800;">52网络友情出演</div>' +
  286. '<button style="margin-right: 10px;">暂停答题</button>' +
  287. '<button style="margin-right: 10px;">' + (setting.auto ? '取消本次自动提交' : '开启本次自动提交') + '</button>' +
  288. '<button style="margin-right: 10px;" >重新查询</button>' +
  289. '<button>折叠面板</button>' +
  290. '<div style="max-height: 300px; overflow-y: auto;">' +
  291. '<table border="1" style="font-size: 12px;">' +
  292. '<thead>' +
  293. '<tr>' +
  294. '<th style="width: 25px; min-width: 25px;">题号</th>' +
  295. '<th style="width: 60%; min-width: 130px;">题目(点击可复制)</th>' +
  296. '<th style="min-width: 130px;">答案(点击可复制)</th>' +
  297. '</tr>' +
  298. '</thead>' +
  299. '<tfoot style="display: none;">' +
  300. '<tr>' +
  301. '<th colspan="3">答案提示框 已折叠</th>' +
  302. '</tr>' +
  303. '</tfoot>' +
  304. '<tbody>' +
  305. '<tr>' +
  306. '<td colspan="3" style="display: none;"></td>' +
  307. '</tr>' +
  308. '</tbody>' +
  309. '</table>' +
  310. '</div>' +
  311. '</div>'
  312. ).appendTo('body').on('click', 'button, td', function() {
  313. var len = $(this).prevAll('button').length;
  314. if (this.nodeName == 'TD') {
  315. $(this).prev().length && GM_setClipboard($(this).text());
  316. } else if (!$(this).siblings().length) {
  317. $(this).parent().text('正在搜索答案...');
  318. setting.num++;
  319. } else if (len === 0) {
  320. if (setting.loop) {
  321. clearInterval(setting.loop);
  322. delete setting.loop;
  323. len = ['已暂停搜索', '继续答题'];
  324. } else {
  325. setting.loop = setInterval(findAnswer, setting.time);
  326. len = ['正在搜索答案...', '暂停答题'];
  327. }
  328. setting.div.children('div:eq(0)').html(function() {
  329. return $(this).data('html') || len[0];
  330. }).removeData('html');
  331. $(this).html(len[1]);
  332. } else if (len == 1) {
  333. setting.auto = !setting.auto;
  334. $(this).html(setting.auto ? '取消本次自动提交' : '开启本次自动提交');
  335. } else if (len == 2) {
  336. parent.location.reload();
  337. } else if (len == 3) {
  338. setting.div.find('tbody, tfoot').toggle();
  339. }
  340. }).find('table, td, th').css('border', '1px solid').end();
  341. setting.lose = setting.num = 0;
  342. setting.data = parent._data = [];
  343. setting.over = '<button style="margin-right: 10px;">跳过此题</button>';
  344. setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无';
  345. setting.loop = setInterval(findAnswer, setting.time);
  346. var tip = ({undefined: '任务点排队中', null: '等待切换中'})[setting.tip];
  347. tip && setting.div.children('div:eq(0)').data('html', tip).siblings('button:eq(0)').click();
  348. }
  349.  
  350. function findAnswer() {
  351. if (setting.num >= $('.TiMu').length) {
  352. var arr = setting.lose ? ['共有 <font color="red">' + setting.lose + '</font> 道题目待完善(已深色标注)', saveThis] : ['答题已完成', submitThis];
  353. setting.div.children('div:eq(0)').data('html', arr[0]).siblings('button:eq(0)').hide().click();
  354. return setTimeout(arr[1], setting.time);
  355. }
  356. var $TiMu = $('.TiMu').eq(setting.num),
  357. question = filterImg($TiMu.find('.Zy_TItle:eq(0) .clearfix')).replace(/^【.*?】\s*/, '').replace(/\s*(\d+\.\d+分)$/, ''),
  358. type = $TiMu.find('input[name^=answertype]:eq(0)').val() || '-1';
  359. GM_xmlhttpRequest({
  360. method: 'POST',
  361. url: setting.tk + 'cx/',
  362.  
  363. headers: {
  364. 'Content-type': 'application/x-www-form-urlencoded'
  365. },
  366. data: 'q=' + encodeURIComponent(question) + '&type=' + type,
  367. timeout: setting.time,
  368. onload: function(xhr) {
  369. if (!setting.loop) {
  370. } else if (xhr.status == 200) {
  371. var obj = $.parseJSON(xhr.responseText) || {};
  372. if (obj.answer) {
  373. obj.code=1;
  374. obj.data = obj.answer;
  375. setting.div.children('div:eq(0)').text('正在搜索答案...');
  376. var td = '<td style="border: 1px solid;',
  377. data = String(obj.answer).replace(/&/g, '&amp;').replace(/<(?!img)/g, '&lt;');
  378. obj.data = /^http/.test(data) ? '<img src="' + obj.answer + '">' : obj.answer;
  379. $(
  380. '<tr>' +
  381. td + ' text-align: center;">' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '</td>' +
  382. td + '" title="点击可复制">' + (question.match('<img') ? question : question.replace(/&/g, '&amp;').replace(/</g, '&lt')) + '</td>' +
  383. td + '" title="点击可复制">' + (/^http/.test(data) ? obj.answer : '') + data + '</td>' +
  384. '</tr>'
  385. ).appendTo(setting.div.find('tbody')).css('background-color', fillAnswer($TiMu.find('ul:eq(0)').find('li'), obj, type) ? '' : 'rgba(0, 150, 136, 0.6)');
  386. setting.data[setting.num++] = {
  387. code: obj.code > 0 ? 1 : 0,
  388. question: question,
  389. option: obj.data,
  390. type: Number(type)
  391. };
  392. } else {
  393. setting.div.children('div:eq(0)').html(obj.data || setting.over + '服务器繁忙,正在重试...请联系vx:HH54068');
  394. }
  395. setting.div.children('span').html(obj.msg || '');
  396. } else if (xhr.status == 403) {
  397. var html = xhr.responseText.indexOf('{') ? '请求过于频繁,建议稍后再试-请联系vx:HH54068' : $.parseJSON(xhr.responseText).data;
  398. setting.div.children('div:eq(0)').data('html', html).siblings('button:eq(0)').click();
  399. } else {
  400. setting.div.children('div:eq(0)').html(setting.over + '服务器异常,正在重试...请联系vx:HH54068');
  401. }
  402. },
  403. ontimeout: function() {
  404. setting.loop && setting.div.children('div:eq(0)').html(setting.over + '服务器超时,正在重试...请联系vx:HH54068');
  405. }
  406. });
  407. }
  408.  
  409. function fillAnswer($li, obj, type) {
  410. var $input = $li.find(':radio, :checkbox'),
  411. str = String(obj.data).toCDB() || new Date().toString(),
  412. data = str.split(/#|\x01|\|/),
  413. opt = obj.opt || str,
  414. state = setting.lose;
  415. // $li.find(':radio:checked').prop('checked', false);
  416. obj.code > 0 && $input.each(function(index) {
  417. if (this.value == 'true') {
  418. data.join().match(/(^|,)(正确|是|对|√|T|ri)(,|$)/) && this.click();
  419. } else if (this.value == 'false') {
  420. data.join().match(/(^|,)(错误|否|错|×|F|wr)(,|$)/) && this.click();
  421. } else {
  422. var tip = filterImg($li.eq(index).find('.after')).toCDB() || new Date().toString();
  423. Boolean($.inArray(tip, data) + 1 || (type == '1' && str.indexOf(tip) + 1)) == this.checked || this.click();
  424. }
  425. }).each(function() {
  426. if (!/^A?B?C?D?E?F?G?$/.test(opt)) return false;
  427. Boolean(opt.match(this.value)) == this.checked || this.click();
  428. });
  429. if (type.match(/^[013]$/)) {
  430. $input.is(':checked') || (setting.none ? ($input[Math.floor(Math.random() * $input.length)] || $()).click() : setting.lose++);
  431. } else if (type.match(/^(2|[4-9]|1[08])$/)) {
  432. data = String(obj.data).split(/#|\x01|\|/);
  433. str = $li.end().find('textarea').each(function(index) {
  434. index = (obj.code > 0 && data[index]) || '';
  435. UE.getEditor(this.name).setContent(index.trim());
  436. }).length;
  437. (obj.code > 0 && data.length == str) || setting.none || setting.lose++;
  438. } else {
  439. setting.none || setting.lose++;
  440. }
  441. return state == setting.lose;
  442. }
  443.  
  444. function saveThis() {
  445. if (!setting.auto) return setTimeout(saveThis, setting.time);
  446. setting.div.children('button:lt(3)').hide().eq(1).click();
  447. _self.alert = console.log;
  448. $('#tempsave').click();
  449. setting.regl();
  450. }
  451.  
  452. function submitThis() {
  453. if (!setting.auto) {
  454. } else if (!$('.Btn_blue_1:visible').length) {
  455. setting.div.children('button:lt(3)').hide().eq(1).click();
  456. return setting.regl();
  457. } else if ($('#confirmSubWin:visible').length) {
  458. var btn = $('#tipContent + * > a').offset() || {top: 0, left: 0},
  459. mouse = document.createEvent('MouseEvents');
  460. btn = [btn.left + Math.ceil(Math.random() * 46), btn.top + Math.ceil(Math.random() * 26)];
  461. mouse.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, btn[0], btn[1], false, false, false, false, 0, null);
  462. _self.event = $.extend(true, {}, mouse);
  463. delete _self.event.isTrusted;
  464. _self.form1submit();
  465. } else {
  466. $('.Btn_blue_1')[0].click();
  467. }
  468. setTimeout(submitThis, Math.ceil(setting.time * Math.random()) * 2);
  469. }
  470.  
  471. function checkToNext() {
  472. var $tip = $(setting.job.join(', '), document).prevAll('.ans-job-icon' + setting.normal);
  473. setInterval(function() {
  474. $tip.parent(':not(.ans-job-finished)').length || setting.jump && toNext();
  475. }, setting.time);
  476. }
  477.  
  478. function toNext() {
  479. var $cur = $('#cur' + $('#chapterIdid').val()),
  480. $tip = $('span.currents ~ span'),
  481. sel = setting.review ? 'html' : '.blue';
  482. if (!$cur.has(sel).length && $tip.length) return $tip.eq(0).click();
  483. $tip = $('.roundpointStudent, .roundpoint').parent();
  484. $tip = $tip.slice($tip.index($cur) + 1).not(':has(' + sel + ')');
  485. $tip.not(setting.lock ? ':has(.lock)' : 'html').find('span').eq(0).click();
  486. $tip.length || setting.course && switchCourse();
  487. }
  488.  
  489. function switchCourse() {
  490. GM_xmlhttpRequest({
  491. method: 'GET',
  492. url: '/visit/courses/study?isAjax=true&fileId=0&debug=',
  493. headers: {
  494. 'Referer': location.origin + '/visit/courses',
  495. 'X-Requested-With': 'XMLHttpRequest'
  496. },
  497. onload: function(xhr) {
  498. var list = $('h3 a[target]', xhr.responseText).map(function() {
  499. return $(this).attr('href');
  500. }),
  501. index = list.map(function(index) {
  502. return this.match(top.courseId) && index;
  503. }).filter(function() {
  504. return $.isNumeric(this);
  505. })[0] + 1 || 0;
  506. setting.course = list[index] ? goCourse(list[index]) : 0;
  507. }
  508. });
  509. }
  510.  
  511. function goCourse(url) {
  512. GM_xmlhttpRequest({
  513. method: 'GET',
  514. url: url,
  515. onload: function(xhr) {
  516. $.globalEval('location.href = "' + $('.articlename a[href]', xhr.responseText).attr('href') + '";');
  517. }
  518. });
  519. }
  520.  
  521. function autoRead() {
  522. $('html, body').animate({
  523. scrollTop: $(document).height() - $(window).height()
  524. }, Math.round(setting.read) * 1E3, function() {
  525. $('.nodeItem.r i').click();
  526. }).one('click', '#top', function(event) {
  527. $(event.delegateTarget).stop();
  528. });
  529. }
  530.  
  531. function DisplayURL() {
  532. _self.WAY.box.hide();
  533. var $li = $(this).closest('li');
  534. $.get('/visit/goToCourseByFace', {
  535. courseId: $li.find('input[name=courseId]').val(),
  536. clazzId: $li.find('input[name=classId]').val()
  537. }, function(data) {
  538. $li.find('[onclick^=openFaceTip]').removeAttr('onclick').attr({
  539. target: '_blank',
  540. href: $(data).filter('script:last').text().match(/n\("(.+?)"/)[1]
  541. });
  542. alert('本课程已临时解除面部识别');
  543. }, 'html');
  544. }
  545.  
  546. function getSchoolId() {
  547. var school = /^1\d{10}$/.test(setting.username) ? '' : setting.school;
  548. if (!isNaN(school)) return setTimeout(toLogin, setting.time, school);
  549. if (school == '账号为手机号可以不修改此参数') return alert('请修改school参数');
  550. $.getJSON('/org/searchUnis?filter=' + encodeURI(school) + '&product=44', function(data) {
  551. if (!data.result) return alert('学校查询错误');
  552. var msg = $.grep(data.froms, function(value) {
  553. return value.name == school;
  554. })[0];
  555. msg ? setTimeout(toLogin, setting.time, msg.schoolid) : alert('学校名称不完整');
  556. });
  557. }
  558.  
  559. function toLogin(fid) {
  560. GM_xmlhttpRequest({
  561. method: 'GET',
  562. url: '/api/login?name=' + setting.username + '&pwd=' + setting.password + '&schoolid=' + fid + '&verify=0',
  563. onload: function(xhr) {
  564. var obj = $.parseJSON(xhr.responseText) || {};
  565. obj.result ? location.href = decodeURIComponent($('#ref, #refer_0x001').val()) : alert(obj.errorMsg || 'Error');
  566. }
  567. });
  568. }
  569.  
  570. function submitAnswer($job, data) {
  571. $job.removeClass('ans-job-finished');
  572. data = data.length ? $(data) : $('.TiMu').map(function() {
  573. var title = filterImg($('.Zy_TItle .clearfix', this));
  574. return {
  575. question: title.replace(/^【.*?】\s*/, ''),
  576. type: ({单选题: 0, 多选题: 1, 填空题: 2, 判断题: 3})[title.match(/^【(.*?)】|$/)[1]]
  577. };
  578. });
  579. data = $.grep(data.map(function(index) {
  580. var $TiMu = $('.TiMu').eq(index);
  581. if (!($.isPlainObject(this) && this.type < 4 && $TiMu.find('.fr').length)) {
  582. return false;
  583. } else if (this.type == 2) {
  584. var $ans = $TiMu.find('.Py_tk, .Py_answer').eq(0);
  585. if (!$TiMu.find('.cuo').length && this.code) {
  586. return false;
  587. } else if (!$ans.find('.cuo').length) {
  588. this.option = $ans.find('.clearfix').map(function() {
  589. return $(this).text().trim();
  590. }).get().join('#') || '无';
  591. } else if (this.code) {
  592. this.code = -1;
  593. } else {
  594. return false;
  595. }
  596. } else if (this.type == 3) {
  597. var ans = $TiMu.find('.font20:last').text();
  598. if ($TiMu.find('.cuo').length) {
  599. this.option = ({'√': '错误', '×': '正确'})[ans] || '无';
  600. } else if (!this.code) {
  601. this.option = ({'√': '正确', '×': '错误'})[ans] || '无';
  602. } else {
  603. return false;
  604. }
  605. } else {
  606. var text = $TiMu.find('.Py_answer > span:eq(0)').text();
  607. if ($TiMu.find('.dui').length && this.code && !/^A?B?C?D?E?F?G?$/.test(this.option)) {
  608. return false;
  609. } else if ($TiMu.find('.dui').length || text.match('正确答案')) {
  610. text = text.match(/[A-G]/gi) || [];
  611. this.option = $.map(text, function(value) {
  612. return filterImg($TiMu.find('.fl:contains(' + value + ') + a'));
  613. }).join('#') || '无';
  614. this.key = text.join('');
  615. } else if (this.code) {
  616. this.code = -1;
  617. } else {
  618. return false;
  619. }
  620. }
  621. return this;
  622. }), function(value) {
  623. return value && value.option != '无';
  624. });
  625. setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无';
  626. data.length && GM_xmlhttpRequest({
  627. method: 'POST',
  628. url: setting.tk + 'cx/?workRelationId=' + $('#workId').val(),
  629. headers: {
  630. 'Content-type': 'application/x-www-form-urlencoded'
  631. },
  632. data: 'course=' + encodeURIComponent(setting.curs) + '&data=' + encodeURIComponent((Ext.encode || JSON.stringify)(data)) + '&id=' + $('#jobid').val().slice(5)
  633. });
  634. $job.addClass('ans-job-finished');
  635. }
  636.  
  637. function filterImg(dom) {
  638. return $(dom).clone().find('img[src]').replaceWith(function() {
  639. return $('<p></p>').text('<img src="' + $(this).attr('src') + '">');
  640. }).end().find('iframe[src]').replaceWith(function() {
  641. return $('<p></p>').text('<iframe src="' + $(this).attr('src') + '"></irame>');
  642. }).end().text().trim();
  643. }

QingJ © 2025

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