💯Muketool超星学习通网课助手💸可永久免费使用所有功能🔍AI搜题全网聚合题库💻视频音频文档挂机,任务点自动切换📝章节测试可自动搜题,自动保存,自动提交✅试题还原解密,可一键复制

👆👆👆👆👆👆👆 🥇操作简单🥇超星尔雅MOOC自动挂机,无需配置安装即可使用。🎗️功能齐全🎗️支持视频、音频、文档、图书自动完成;章节测验自动答题、自动提交,支持自动切换任务点、挂机阅读时长、自动登录等。🎁独家题库🎁独家丰富试题库,精准识别,答案全对。🏆功能扩展🏆解除各类功能限制,解除字体加密,支持下载视频、pdf文档,开放自定义参数

  1. // ==UserScript==
  2. // @name 💯Muketool超星学习通网课助手💸可永久免费使用所有功能🔍AI搜题全网聚合题库💻视频音频文档挂机,任务点自动切换📝章节测试可自动搜题,自动保存,自动提交✅试题还原解密,可一键复制
  3. // @namespace Muketool
  4. // @version 2.3.3
  5. // @description 👆👆👆👆👆👆👆 🥇操作简单🥇超星尔雅MOOC自动挂机,无需配置安装即可使用。🎗️功能齐全🎗️支持视频、音频、文档、图书自动完成;章节测验自动答题、自动提交,支持自动切换任务点、挂机阅读时长、自动登录等。🎁独家题库🎁独家丰富试题库,精准识别,答案全对。🏆功能扩展🏆解除各类功能限制,解除字体加密,支持下载视频、pdf文档,开放自定义参数
  6. // @author Muketool
  7. // @match *://*.chaoxing.com/*
  8. // @connect greasyfork.org
  9. // @connect api.muketool.com
  10. // @connect api2.muketool.com
  11. // @connect static.muketool.com
  12. // @run-at document-end
  13. // @grant unsafeWindow
  14. // @grant GM_addStyle
  15. // @grant GM_setValue
  16. // @grant GM_getValue
  17. // @grant GM_getResourceText
  18. // @grant GM_xmlhttpRequest
  19. // @grant GM_setClipboard
  20. // @grant GM_getResourceURL
  21. // @antifeature ads
  22. // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js
  23. // @require https://static.muketool.com/scripts/cx/v2/js/Typr.min.js#md5=2ac9c9459368259ca63b0968c613e525
  24. // @require https://static.muketool.com/scripts/cx/v2/js/Typr.U.min.js#md5=7fa27f07b2a19fbff3426bf5bfbaec2a
  25. // @resource CxSecretsFont https://static.muketool.com/scripts/cx/v2/fonts/cxsecret.json
  26. // @resource Layui https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/css/layui.min.css
  27. // @resource LayuiIconFont-woff2 https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/font/iconfont.woff2
  28. // @resource LayuiIconFont-woff https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/font/iconfont.woff
  29. // @resource LayuiIconFont-ttf https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layui/2.6.8/font/iconfont.ttf
  30. // @license MIT
  31. // @original-script https://greasyfork.org/scripts/369625
  32. // @original-author wyn665817
  33. // @original-license MIT
  34. // @icon https://static.muketool.com/scripts/cx/v2/images/icon.png
  35. // ==/UserScript==
  36. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37. // 这里是脚本的全局设置区域。内容为0代表功能关闭,内容为1代表功能开启,修改的时候不要删掉末尾的,号,否则脚本无法正常运行。
  38. // 设置修改后,需要刷新或重新打开网课页面才会生效。
  39. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. var setting = {
  41. tiku: 'https://api.muketool.com',
  42.  
  43. // 默认响应速度为8秒,不建议小于3秒,否则高峰期可能出现答题失败的情况。5E3 == 5000,科学记数法,表示毫秒数
  44. time: 8E3,
  45. // 复习模式,完整挂机视频(音频)时长,支持挂机任务点已完成的视频和音频
  46. review: 0,
  47. // 队列模式,开启后任务点逐一完成,关闭则单页面所有任务点同时进行
  48. queue: 1,
  49. // 视频支持后台、切换窗口不暂停,支持多视频
  50. video: 1,
  51. // 自动答题功能(章节测验),作业需要手动开启查询,高准确率
  52. work: 1,
  53. // 音频自动播放,与视频功能共享vol和rate参数
  54. audio: 1,
  55. // 图书阅读任务点,非课程阅读任务点
  56. book: 1,
  57. // 文档阅读任务点,PPT类任务点自动完成阅读任务
  58. docs: 1,
  59. // 自动切换标签、章节、课程(需要配置course参数)
  60. jump: 1,
  61. // 挂机课程阅读时间,单位分钟
  62. read: '10',
  63. // 显示课程进度的统计数据,在学习进度页面的上方展示
  64. total: 1,
  65.  
  66. ////////////////////////////////////////////////////////////////////
  67. // 仅开启video(audio)时,修改此处才会生效
  68. ////////////////////////////////////////////////////////////////////
  69. // 视频播放的默认资源线路
  70. line: '公网1',
  71. // 视频播放的默认清晰度
  72. http: '标清',
  73. // 默认音量的百分数,设定范围:[0,100],'0'为静音
  74. vol: '0',
  75. // 倍速已经失效,建议一倍速看,多倍速会异常提示
  76. rate: '0',
  77. // 答题完成后自动保存,默认开启, 仅开启work时,修改此处才会生效
  78. auto_save: 1,
  79. // 答题完成后自动提交,默认关闭, 仅开启work时,修改此处才会生效
  80. auto_submit: 0,
  81. // 无匹配答案时执行默认操作,关闭后若题目无匹配答案则会暂时保存已作答的题目
  82. none: 0,
  83. // 富文本编辑器高度自动拉伸,用于文本类题目,答题框根据内容自动调整大小
  84. scale: 1,
  85. // 当前课程完成后自动切换课程,仅支持按照根目录课程顺序切换,默认关闭
  86. course: 0,
  87. // 跳过未开放(图标是锁)的章节,即闯关模式或定时发放的任务点,默认开启
  88. lock: 1,
  89. // 搜索历史记录
  90. search_history: 1,
  91. },
  92.  
  93.  
  94. // 除非您知道如何正确修改代码,否则不要修改下方任意内容。如果不小心修改导致脚本运行异常,请删除脚本重新安装。
  95.  
  96.  
  97. _self = unsafeWindow,
  98. url = location.pathname,
  99. top = _self;
  100. if (url != '/studyApp/studying' && top != _self.top) document.domain = location.host.replace(/.+?\./, '');
  101. try {
  102. while (top != _self.top) {
  103. top = top.parent.document ? top.parent : _self.top;
  104. if (top.location.pathname.endsWith('/mycourse/studentstudy')) break;
  105. }
  106. } catch (err) {
  107. top = _self;
  108. }
  109. if (GM_info.script.namespace != 'Muketool' || GM_info.script.author != 'Muketool' ){
  110. console.log("Muketool error...")
  111. return;
  112. }
  113. initMtSetting();
  114.  
  115. GM_addStyle(`
  116. @import url(${GM_getResourceURL('Layui')});
  117. `);
  118. GM_addStyle(`
  119. @font-face {
  120. font-family: 'layui-icon';
  121. src: url(${GM_getResourceURL('LayuiIconFont-woff2')}) format('woff2'),
  122. url(${GM_getResourceURL('LayuiIconFont-woff')}.woff) format('woff'),
  123. url(${GM_getResourceURL('LayuiIconFont-ttf')}) format('truetype');
  124. font-weight: normal;
  125. font-style: normal;
  126. }
  127.  
  128. `);
  129.  
  130. var $ = _self.jQuery || top.jQuery,
  131. parent = _self == top ? self : _self.parent,
  132. Ext = _self.Ext || parent.Ext || {},
  133. UE = _self.UE,
  134. vjs = _self.videojs;
  135.  
  136. $('.Header').find('a:contains(回到旧版)')[0] ? $('.Header').find('a:contains(回到旧版)')[0].click() : '';
  137. if (location.href.indexOf('mooc2=1') != -1) {
  138. location.href = location.href.replace('mooc2=1', 'mooc2=0');
  139. }
  140. String.prototype.toCDB = function () {
  141. return this.replace(/\s/g, '').replace(/[\uff01-\uff5e]/g, function (str) {
  142. return String.fromCharCode(str.charCodeAt(0) - 65248);
  143. }).replace(/[“”]/g, '"').replace(/[‘’]/g, "'").replace(/。/g, '.');
  144. };
  145. _self.alert = console.log;
  146. setting.normal = '';
  147. setting.job = [':not(*)'];
  148. setting.video && setting.job.push('iframe[src*="/video/index.html"]');
  149. setting.work && setting.job.push('iframe[src*="/work/index.html"]');
  150. setting.audio && setting.job.push('iframe[src*="/audio/index.html"]');
  151. setting.book && setting.job.push('iframe[src*="/innerbook/index.html"]');
  152. setting.docs && setting.job.push('iframe[src*="/ppt/index.html"]', 'iframe[src*="/pdf/index.html"]');
  153. if (url.endsWith('/mycourse/studentstudy')) {
  154. // checkUpdate();
  155. stopMouseout();
  156. showMtDashboard();
  157. switchToNormal();
  158. _self.checkMobileBrowerLearn = $.noop;
  159. var classId = location.search.match(/cla[zs]{2}id=(\d+)/i)[1] || 0,
  160. courseId = _self.courseId || location.search.match(/courseId=(\d+)/i)[1] || 0;
  161. !setting.jump || setting.lock || $('#coursetree').on('click', '[onclick*=void], [href*=void]', function () {
  162. _self.getTeacherAjax(courseId, classId, $(this).parent().attr('id').slice(3));
  163. });
  164. } else if ((url.endsWith('/ananas/modules/video/index.html')) && setting.video) {
  165. switchToNormal();
  166. if (setting.review) _self.greenligth = Ext.emptyFn;
  167. passVideo();
  168. } else if (url.endsWith('/work/doHomeWorkNew') || url == '/api/work' || url.endsWith('/work/addStudentWorkNewWeb')) {
  169.  
  170. beforeFind();
  171.  
  172. top.courseId = location.search.match(/courseId=(\d+)/i)[1];
  173. if (!UE) {
  174. var len = ($ || Ext.query || Array)('font:contains(未登录)', document).length;
  175. setTimeout(len == 1 ? top.location.reload : parent.greenligth, setting.time);
  176. } else if (setting.work) {
  177. setTimeout(relieveLimit, 0);
  178. // beforeFind();
  179. }
  180. } else if ((url.endsWith('/ananas/modules/innerbook/index.html')) && setting.book) {
  181. setTimeout(function () {
  182. if (getTip()) _self.setting ? _self.top.onchangepage(_self.getFrameAttr('end')) : _self.greenligth();
  183. }, setting.time);
  184. } else if (url.match(/^\/ananas\/modules\/(ppt|pdf)\/index\.html$/) && setting.docs) {
  185. setTimeout(function () {
  186. if (getTip()) _self.setting ? _self.finishJob() : _self.greenligth();
  187. }, setting.time);
  188. frameElement.setAttribute('download', 1);
  189. if (_self.downloadNum == '') _self.downloadNum = '1';
  190. } else if (url.endsWith('/knowledge/cards')) {
  191. $ && checkToNext();
  192. } else if (url.match(/^\/(course|zt)\/\d+\.html$/)) {
  193. setTimeout(function () {
  194. +setting.read && _self.sendLogs && $('.course_section:eq(0) .chapterText').click();
  195. }, setting.time);
  196. } else if (url.endsWith('/ztnodedetailcontroller/visitnodedetail')) {
  197. setting.read *= 60 / $('.course_section').length;
  198. setting.read && _self.sendLogs && autoRead();
  199. } else if (url.endsWith('/mycourse/studentcourse')) {
  200. var gv = location.search.match(/d=\d+&/g);
  201. setting.total && $('<a>', {
  202. href: '/moocAnalysis/chapterStatisticByUser?classI' + gv[1] + 'courseI' + gv[0] + 'userId=' + _self.getCookie('_uid') + '&ut=s',
  203. target: '_blank',
  204. title: '点击查看章节统计',
  205. style: 'margin: 0 25px;',
  206. html: '本课程共' + $('.icon').length + '节,剩余' + $('em:not(.openlock)').length + '节未完成'
  207. }).appendTo('.zt_logo').parent().width('auto');
  208. } else if (location.hostname == 'i.mooc.chaoxing.com') { } else if (url.endsWith('/work/selectWorkQuestionYiPiYue')) {
  209. submitAnswer(getIframe().parent(), $.extend(true, [], parent._data));
  210. } else if (url == '/exam-ans/exam/test') { };
  211.  
  212. function decryptText() {
  213. console.log('MT: fonts decrypted!')
  214. var $tip = $('style:contains(font-cxsecret)');
  215. if (!$tip.length) return;
  216. var font = $tip.text().match(/base64,([\w\W]+?)'/)[1];
  217. font = Typr.parse(base64ToUint8Array(font))[0];
  218. var CxSecretsFont = JSON.parse(GM_getResourceText('CxSecretsFont'));
  219. var match = {};
  220. for (var i = 19968; i < 40870; i++) {
  221. $tip = Typr.U.codeToGlyph(font, i);
  222. if (!$tip) continue;
  223. $tip = Typr.U.glyphToPath(font, $tip);
  224. $tip = $.md5(JSON.stringify($tip)).slice(24);
  225. match[i] = CxSecretsFont[$tip];
  226. }
  227. $('.font-cxsecret').html(function (index, html) {
  228. $.each(match, function (key, value) {
  229. key = String.fromCharCode(key);
  230. key = new RegExp(key, 'g');
  231. value = String.fromCharCode(value);
  232. html = html.replace(key, value);
  233. });
  234. return html;
  235. }).removeClass('font-cxsecret');
  236.  
  237. function base64ToUint8Array(base64) {
  238. var data = window.atob(base64);
  239. var buffer = new Uint8Array(data.length);
  240. for (var i = 0; i < data.length; ++i) {
  241. buffer[i] = data.charCodeAt(i);
  242. }
  243. return buffer;
  244. }
  245. }
  246.  
  247. function time_to_sec(time) {
  248. let s = 0;
  249. let t = 1;
  250. for (let i = time.split(':').length - 1; i >= 0; i--) {
  251. s += Number(time.split(':')[i]) * t
  252. t *= 60
  253. }
  254. return s;
  255. };
  256.  
  257. function getTip() {
  258. return top != _self && jobSort($ || Ext.query);
  259. }
  260.  
  261. function passVideo() {
  262. skipQuestion();
  263. getTip() && setTimeout(() => {
  264. let vd = $('video')[0];
  265. if (vd) {
  266. vd.volume = vd.volume === 0 ? 1 : 0;
  267. $('.vjs-big-play-button')[0].click();
  268. }
  269. }, 2000)
  270. }
  271.  
  272. function jobSort($) {
  273. var fn = $.fn ? [getIframe(1), 'length'] : [self, 'dom'],
  274. sel = setting.job.join(', :not(.ans-job-finished) > .ans-job-icon' + setting.normal + ' ~ ');
  275. if (!getIframe()[fn[1]] || getIframe().parent().is('.ans-job-finished')) return 0;
  276. if (!setting.queue || $(sel, fn[0].parent.document)[0] == fn[0].frameElement) return 1;
  277. setInterval(function () {
  278. $(sel, fn[0].parent.document)[0] == fn[0].frameElement && fn[0].location.reload();
  279. }, setting.time);
  280. }
  281.  
  282. function getIframe(tip, win, job) {
  283. if (!$) return Ext.get(frameElement || []).parent().child('.ans-job-icon') || Ext.get([]);
  284. do {
  285. win = win ? win.parent : _self;
  286. job = $(win.frameElement).prevAll('.ans-job-icon');
  287. } while (!job.length && win.parent.frameElement);
  288. return tip ? win : job;
  289. }
  290.  
  291. function relieveLimit() {
  292. if (setting.scale) _self.UEDITOR_CONFIG.scaleEnabled = false;
  293. $.each(UE.instants, function () {
  294. var key = this.key;
  295. this.ready(function () {
  296. this.destroy();
  297. UE.getEditor(key);
  298. });
  299. });
  300. }
  301.  
  302. function beforeFind() {
  303. decryptText();
  304. setting.regl = parent.greenligth || $.noop;
  305. if ($.type(parent._data) == 'array') return setting.regl();
  306. switchToAnswering();
  307. let $mt_dashboard = _self.top.$('#mt-dashboard');
  308. setInterval(function () {
  309. // if (setting.work == 1) {
  310. if (setting.work == 1 && (setting.num <= $('.TiMu').length)) {
  311. findAnswer();
  312. }
  313. }, setting.time);
  314. $mt_dashboard.on('click', 'td', function () {
  315. $(this).prev().length && GM_setClipboard($(this).text());
  316. });
  317. $mt_dashboard.on('click', 'button', function () {
  318. const button_clicked = $(this).attr('id');
  319. if (button_clicked == 'mt-setting-button-1') {
  320. if (setting.work) {
  321. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-pause"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">自动答题已暂停,您可在下方重新开启</span>');
  322. $('#mt-setting-button-1', $mt_dashboard).html('<i class="layui-icon layui-icon-close"></i>自动答题已暂停');
  323. } else {
  324. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">正在拼命搜索试题答案中......</span>');
  325. $('#mt-setting-button-1', $mt_dashboard).html('<i class="layui-icon layui-icon-ok"></i>自动答题已开启');
  326. }
  327. setting.work = !setting.work;
  328. } else if (button_clicked == 'mt-setting-button-2') {
  329.  
  330. var parentWindow = window.parent;
  331. if (!parentWindow) {
  332. console.log('没有父窗口');
  333. return;
  334. }
  335.  
  336. var parentDocument = parentWindow.document;
  337. if (!parentDocument) {
  338. console.log('父窗口没有 document 对象');
  339. return;
  340. }
  341.  
  342.  
  343. var element = document.querySelector('#mt-setting-button-2');
  344. if (!element) {
  345. // 在子页面中无法找到该元素,尝试在父页面中查找
  346. var parentWindow = window.parent;
  347. var parentDocument = parentWindow.document;
  348. element = parentDocument.querySelector('#mt-setting-button-2');
  349. }
  350.  
  351.  
  352. // let $mt_dashboard = _self.top.jQuery('#mt-dashboard');
  353. GM_setValue('mtSetting_autoSubmit', !GM_getValue('mtSetting_autoSubmit'));
  354. console.log('自动提交已' + (GM_getValue('mtSetting_autoSubmit') ? '开启' : '关闭'));
  355. GM_getValue('mtSetting_autoSubmit') ? $('#mt-setting-button-2', $mt_dashboard).html('<i class="layui-icon layui-icon-ok"></i>自动提交已开启') : $('#mt-setting-button-2', $mt_dashboard).html('<i class="layui-icon layui-icon-close"></i>自动提交已关闭');
  356.  
  357.  
  358. if (GM_getValue('mtSetting_autoSubmit')) {
  359. alert('🚨警告🚨\n\n①您已经手动开启自动提交!答案一旦提交无法再修改!开启即代表您已知晓并接受其中的风险!\n②不建议开启此功能。脚本会自动保存已搜索到的答案,建议在答题结束后手动提交!\n③为保证安全,该功能仅在所有试题都搜索到答案时才会生效。');
  360. }
  361.  
  362. } else if (button_clicked == 'mt-setting-button-3') {
  363. location.reload();
  364. } else if (button_clicked == 'mt-setting-button-4') {
  365. setting.search_history = !setting.search_history;
  366. setting.search_history ? $('#mt-setting-button-4', $mt_dashboard).html('<i class="layui-icon layui-icon-down"></i>') : $('#mt-setting-button-4', $mt_dashboard).html('<i class="layui-icon layui-icon-right"></i>');
  367. setting.search_history ? $('#mt-dashboard-history', $mt_dashboard).show() : $('#mt-dashboard-history', $mt_dashboard).hide();
  368. setting.search_history ? $('#mt-table-tips', $mt_dashboard).html('温馨提示:点击下方表格中的文字可直接复制。如果试题黄色高亮代表搜索到的答案不完全匹配建议手动搜索。') : $('#mt-table-tips', $mt_dashboard).html('搜题历史记录已隐藏,您可在上方重新开启');
  369. }
  370. });
  371. setting.lose = setting.num = 0;
  372. setting.data = parent._data = [];
  373. setting.over = '<button style="margin-right: 10px;">跳过此题</button>';
  374. setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:'(.+?)'|$/)[1] || $('h1').text().trim() || '无';
  375. var tip = ({
  376. undefined: '任务点排队中',
  377. 0: '等待切换中'
  378. })[getTip()];
  379. tip && $('#mt-dashboard-status', $mt_dashboard).data('html', tip).siblings('button:eq(0)').click();
  380. if (tip) {
  381. $('#mt-dashboard-status', $mt_dashboard).html(tip);
  382. $mt_dashboard.siblings('button:eq(0)').click();
  383. }
  384. }
  385.  
  386.  
  387. function findAnswer() {
  388. let $mt_dashboard = _self.top.$('#mt-dashboard');
  389. console.log('正在搜索答案。总数:' + $('.TiMu').length + ',已搜索:' + setting.num + ',无答案:' + setting.lose);
  390. if (setting.num >= $('.TiMu').length) {
  391. if (setting.lose) {
  392. $('#mt-dashboard-status', $mt_dashboard).html(`<i class="layui-icon layui-icon-about"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold; color:red; ">有【${setting.lose}】道题目的答案不完全匹配,已在面板最下方黄色高亮显示,建议尝试手动搜索试题答案。30秒后将自动保存当前内容继续下一章节。</span>`);
  393. }
  394. if (!setting.lose && GM_getValue('mtSetting_autoSubmit')) {
  395. return setTimeout(submitThis, setting.time);
  396. }
  397. if (!setting.lose && setting.auto_save) {
  398. return setTimeout(saveThis, setting.time);
  399. }
  400. if (setting.lose && setting.auto_save) {
  401. console.log('存在无答案试题,等待30秒后继续下一章节');
  402. return setTimeout(saveThis, 30000);
  403. }
  404. }
  405. var $TiMu = $('.TiMu').eq(setting.num);
  406. var question = filterImg($TiMu.find('.Zy_TItle:eq(0) .clearfix')).replace(/^【.*?】\s*/, '').replace(/\s*(\d+\.\d+分)$/, ''),
  407. type = $TiMu.find('input[name^=answertype]:eq(0)').val() || '-1';
  408.  
  409. const course_name = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无';
  410. GM_xmlhttpRequest({
  411. method: 'POST',
  412. url: setting.tiku + '/cx/v2/query',
  413. headers: {
  414. 'Content-type': 'application/json'
  415. },
  416. data: JSON.stringify({
  417. question: encodeURIComponent(question),
  418. type: type,
  419. course: course_name,
  420. }),
  421. timeout: setting.time,
  422. onload: function (xhr) {
  423. if (!setting.work) { } else if (xhr.status == 200) {
  424. var obj = $.parseJSON(xhr.responseText) || {};
  425. obj.answer = obj.data;
  426. if (obj.code == 1) {
  427. var answer = obj.answer.replace(/&/g, '&amp;').replace(/<(?!img)/g, '&lt;');
  428. obj.answer = /^http/.test(answer) ? '<img src="' + obj.answer + '">' : obj.answer;
  429. $(
  430. '<tr>' +
  431. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '</td>' +
  432. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + (question.match('<img') ? question : question.replace(/&/g, '&amp;').replace(/</g, '&lt')) + '</td>' +
  433. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + (/^http/.test(answer) ? obj.answer : '') + obj.answer + '</td>' +
  434. '</tr>'
  435. ).appendTo($mt_dashboard.find('tbody')).css('background-color', fillAnswer($TiMu.find('ul:eq(0)').find('li'), obj, type) ? '' : '#FFC107');
  436. setting.num++;
  437. } else {
  438. $(
  439. '<tr>' +
  440. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + $TiMu.find('.Zy_TItle:eq(0) i').text().trim() + '</td>' +
  441. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + (question.match('<img') ? question : question.replace(/&/g, '&amp;').replace(/</g, '&lt')) + '</td>' +
  442. '<td class="layui-font-12" style="padding: 5px; line-height: 15px;">' + obj.msg + '</td>' +
  443. '</tr>'
  444. ).appendTo($mt_dashboard.find('tbody')).css('background-color', '#FFC107');
  445. setting.loop++;
  446. setting.num++;
  447. setting.lose++;
  448. }
  449.  
  450.  
  451. } else if (xhr.status == 403) {
  452. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-close-fill"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">试题搜索失败,可能是当前试题含有特殊字符或者搜索次数过于频繁导致,请尝试稍后重新搜索或暂时跳过当前章节。</span>')
  453.  
  454.  
  455. } else {
  456. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-close-fill"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">Muketool服务器连接异常,可能是正常维护或被攻击,请稍后重试......</span>')
  457. }
  458. },
  459. ontimeout: function () {
  460. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-close-fill"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">Muketool服务器连接异常,可能是正常维护或被攻击,请稍后重试......</span>')
  461. }
  462. });
  463. }
  464.  
  465. function fillAnswer($li, obj, type) {
  466. var $input = $li.find(':radio, :checkbox'),
  467. str = String(obj.data).toCDB() || new Date().toString(),
  468. data = str.split(/#|\x01|\|/),
  469. opt = obj.opt || str,
  470. state = setting.lose;
  471. obj.code > 0 && $input.each(function (index) {
  472. if (this.value == 'true') {
  473. data.join().match(/(^|,)(正确|是|对|√|T|ri|right|true)(,|$)/) && this.click();
  474. } else if (this.value == 'false') {
  475. data.join().match(/(^|,)(错误|否|错|×|F|wr|wrong|false)(,|$)/) && this.click();
  476. } else {
  477. var tip = filterImg($li.eq(index).find('.after')).toCDB() || new Date().toString();
  478. Boolean($.inArray(tip, data) + 1 || (type == '1' && str.indexOf(tip) + 1)) == this.checked || this.click();
  479. }
  480. }).each(function () {
  481. if (!/^A?B?C?D?E?F?G?$/.test(opt)) return false;
  482. Boolean(opt.match(this.value)) == this.checked || this.click();
  483. });
  484. if (type.match(/^[013]$/)) {
  485. $input.is(':checked') || (setting.none ? ($input[Math.floor(Math.random() * $input.length)] || $()).click() : setting.lose++);
  486. } else if (type.match(/^(2|[4-9]|1[08])$/)) {
  487. data = String(obj.data).split(/#|\x01|\|/);
  488. str = $li.end().find('textarea').each(function (index) {
  489. index = (obj.code > 0 && data[index]) || this.value || '';
  490. UE.getEditor(this.name).setContent(index.trim());
  491. }).length;
  492. (obj.code == 1 && data.length == str) || setting.none || setting.lose++;
  493. } else {
  494. setting.none || setting.lose++;
  495. }
  496. return state == setting.lose;
  497. }
  498.  
  499. function saveThis() {
  500. if (!setting.auto_save) return setTimeout(saveThis, setting.time);
  501. $('#tempsave').click();
  502. console.log('答题信息已保存');
  503. setting.regl();
  504. }
  505.  
  506. function submitThis() {
  507. if (!GM_getValue('mtSetting_autoSubmit')) { } else if (!$('.Btn_blue_1:visible').length) {
  508. return setting.regl();
  509. } else if ($('#confirmSubWin:visible').length) {
  510. var btn = $('#tipContent + * > a').offset() || {
  511. top: 0,
  512. left: 0
  513. },
  514. mouse = document.createEvent('MouseEvents');
  515. btn = [btn.left + Math.ceil(Math.random() * 46), btn.top + Math.ceil(Math.random() * 26)];
  516. mouse.initMouseEvent('click', true, true, document.defaultView, 0, 0, 0, btn[0], btn[1], false, false, false, false, 0, null);
  517. _self.event = $.extend(true, {}, mouse);
  518. delete _self.event.isTrusted;
  519. _self.form1submit();
  520. } else {
  521. $('.Btn_blue_1')[0].click();
  522. }
  523. setTimeout(submitThis, Math.ceil(setting.time * Math.random()) * 2);
  524. }
  525.  
  526. function checkToNext() {
  527. var $tip = $(setting.job.join(', '), document).prevAll('.ans-job-icon' + setting.normal);
  528. setInterval(function () {
  529. $tip.parent(':not(.ans-job-finished)').length || setting.jump && toNext();
  530. }, setting.time);
  531. }
  532.  
  533. function toNext() {
  534. let $ = _self.parent.$;
  535. var $cur = $('#cur' + $('#chapterIdid').val()),
  536. $tip = $('span.currents ~ span'),
  537. sel = setting.review ? 'html' : '.blue';
  538. if (!$cur.has(sel).length && $tip.length) return $tip.eq(0).click();
  539. $tip = $('.roundpointStudent, .roundpoint').parent();
  540. $tip = $tip.slice($tip.index($cur) + 1).not(':has(' + sel + ')');
  541. $tip.not(setting.lock ? ':has(.lock)' : 'html').find('span').eq(0).click();
  542. $tip.length || setting.course && switchCourse();
  543. }
  544.  
  545. function switchCourse() {
  546. console.log('所有章节均完成!');
  547. }
  548.  
  549. function goCourse(url) {
  550. GM_xmlhttpRequest({
  551. method: 'GET',
  552. url: url,
  553. onload: function (xhr) {
  554. $.globalEval('location.href = "' + $('.articlename a[href]', xhr.responseText).attr('href') + '";');
  555. }
  556. });
  557. }
  558.  
  559. function autoRead() {
  560. $('html, body').animate({
  561. scrollTop: $(document).height() - $(window).height()
  562. }, Math.round(setting.read) * 1E3, function () {
  563. $('.nodeItem.r i').click();
  564. }).one('click', '#top', function (event) {
  565. $(event.delegateTarget).stop();
  566. });
  567. }
  568.  
  569. function submitAnswer($job, data) {
  570. $job.removeClass('ans-job-finished');
  571. data = data.length ? $(data) : $('.TiMu').map(function () {
  572. var title = filterImg($('.Zy_TItle .clearfix', this));
  573. // console.log('题目数据:' + JSON.stringify(this))
  574. var optionTexts = [];
  575. $('.Zy_ulTop li', this).each(function() {
  576. var optionText = $(this).find('a').text().trim();
  577. optionTexts.push(optionText);
  578. });
  579.  
  580. console.log(optionTexts);
  581.  
  582. return {
  583. question: title.replace(/^【.*?】\s*/, ''),
  584. optionTexts: optionTexts,
  585. type: ({
  586. 单选题: 0,
  587. 多选题: 1,
  588. 填空题: 2,
  589. 判断题: 3
  590. })[title.match(/^【(.*?)】|$/)[1]]
  591. };
  592. });
  593.  
  594. data = $.grep(data.map(function (index) {
  595. var $TiMu = $('.TiMu').eq(index);
  596. if (!($.isPlainObject(this) && this.type < 4 && $TiMu.find('.fr').length)) {
  597. return false;
  598. } else if (this.type == 2) {
  599. var $ans = $TiMu.find('.Py_tk, .Py_answer').eq(0);
  600. if (!$TiMu.find('.cuo').length && this.code) {
  601. return false;
  602. } else if (!$ans.find('.cuo').length) {
  603. this.option = $ans.find('.clearfix').map(function () {
  604. return filterImg(this);
  605. }).get().join('#') || '无';
  606. } else if (this.code) {
  607. this.code = -1;
  608. } else {
  609. return false;
  610. }
  611. } else if (this.type == 3) {
  612. var ans = $TiMu.find('.font20:last').text();
  613. if ($TiMu.find('.cuo').length) {
  614. this.option = ({
  615. '√': '错误',
  616. '×': '正确'
  617. })[ans] || '无';
  618. } else if (!this.code) {
  619. this.option = ({
  620. '√': '正确',
  621. '×': '错误'
  622. })[ans] || '无';
  623. } else {
  624. return false;
  625. }
  626. } else {
  627. var text = $TiMu.find('.Py_answer > span:eq(0)').text();
  628. if ($TiMu.find('.dui').length && this.code && !/^A?B?C?D?E?F?G?$/.test(this.option)) {
  629. return false;
  630. } else if ($TiMu.find('.dui').length || text.match('正确答案')) {
  631. text = text.match(/[A-G]/gi) || [];
  632. this.option = $.map(text, function (value) {
  633. return filterImg($TiMu.find('.fl:contains(' + value + ') + a'));
  634. }).join('#') || '无';
  635. this.key = text.join('');
  636. } else if (this.code) {
  637. this.code = -1;
  638. } else {
  639. return false;
  640. }
  641. }
  642. return this;
  643. }), function (value) {
  644. return value && value.option != '无';
  645. });
  646. setting.curs = $('script:contains(courseName)', top.document).text().match(/courseName:\'(.+?)\'|$/)[1] || $('h1').text().trim() || '无';
  647. const mt_courseId = $("#curCourseId", top.document).val() || "";
  648. const mt_chapterId = $("#curChapterId", top.document).val() || "";
  649. const mt_clazzId = $("#curClazzId", top.document).val() || "";
  650.  
  651. data.length && GM_xmlhttpRequest({
  652. method: 'POST',
  653. url: setting.tiku + '/cx/v2/work',
  654. headers: {
  655. 'Content-type': 'application/json'
  656. },
  657. data: JSON.stringify({
  658. course: setting.curs,
  659. data: (Ext.encode || JSON.stringify)(data),
  660. jobId: $('#jobid').val().slice(5),
  661. workId: $('#workId').val(),
  662. courseId: mt_courseId,
  663. chapterId: mt_chapterId,
  664. clazzId: mt_clazzId,
  665.  
  666. }),
  667. onload: function(response) {
  668. if (response.status >= 200 && response.status < 300) {
  669. console.log('submit success')
  670. } else {
  671. console.log('submit error:' + response.statusText);
  672. }
  673. },
  674. onerror: function() {
  675. console.log('submit error');
  676. }
  677. });
  678. $job.addClass('ans-job-finished');
  679. }
  680.  
  681. function showMtDashboard() {
  682. $('#mt-dashboard').remove();
  683.  
  684. const dashboardHtml = `
  685. <div id="mt-dashboard" class="layui-card" style="top: 30px; left: 10px; position: fixed;width: 380px; margin-left: 20px; touch-action: none; border-radius: 10px;box-shadow: 0px 6px 20px -6px #0b2b9e26; border: 3px solid #7431F9">
  686. <div class="layui-card-header" style="background-color: #7431F9; color: white; border-bottom:0px;">
  687. <i class="layui-icon layui-icon-senior"></i>
  688. <span style="font-weight: bold;">Muketool 网课助手&nbsp;&nbsp;</span>
  689. <span id="mt-dashboard-version">
  690. <a href="https://www.muketool.com" target="_blank" class="layui-btn layui-btn-xs" style="color: white;background-color: #7431F9; border: 1px solid white;border-radius: 5px;">${GM_info.script.version}</a>
  691. </span>
  692. <span id="mt-dashboard-help">
  693. <a href="https://www.muketool.com" target="_blank" class="layui-btn layui-btn-xs" style="background-color: white; color: black;border-radius: 5px;">使用帮助</a>
  694. </span>
  695. </div>
  696. <div class="layui-card-body " style="border-radius: 10px; padding-bottom:30px;">
  697. <div id="mt-dashboard-status">
  698. <i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i>&nbsp;
  699. <span class="layui-font-13" style="font-weight: bold;">正在自动执行相关任务,请喝杯茶耐心等待......</span>
  700. </div>
  701. <div id="mt-dashboard-tips">
  702. <hr class="layui-border-cyan">
  703. <div class="layui-font-12" style="margin-bottom: 5px; line-height:20px;">
  704. 欢迎使用Muketool超星网课助手,该面板将控制脚本的运行及显示相关的通知,您可以使用鼠标拖动面板调整位置哦 : ) <br/>本脚本的下载、安装及使用完全免费,仅包含少量广告用于题库服务器开支,对您造成的不便敬请谅解。
  705. </div>
  706. </div>
  707. <div id="mt-dashboard-notifications">
  708. <hr class="layui-border-cyan">
  709. <div class="layui-font-13" style="margin-bottom: 5px; color:#0D6EFD; line-height:20px;">超火爆的人工智能CHAT-G-P-T免费体验,最强大的生产力工具,支持写论文、写代码、写简历、写文案、学习辅导、研究咨询、论文降重等功能,无需使用教程,只需和人类对话般描述自己的需求,即可立即获得解答、完成任务,点击下方链接免费体验:</div>
  710. <a href="https://www.todaoke.com/" target="_blank" class="layui-btn layui-btn-sm" style="background-color: #0D6EFD; border-radius: 5px;"><i class="layui-icon layui-icon-diamond"></i>立即免费体验</a>
  711. </div>
  712. <div id="mt-dashboard-setting">
  713. <hr class="layui-border-cyan">
  714. <div class="layui-btn-container">
  715. <button type="button" id="mt-setting-button-1" class="layui-btn layui-btn-sm" style="background-color: white;border-radius: 5px; color: black; border-color: #7431F9"><i class="layui-icon layui-icon-ok"></i>自动答题已开启
  716. </button>
  717. <button type="button" id="mt-setting-button-2" class="layui-btn layui-btn-sm" style="background-color: white;border-radius: 5px; color: black; border-color: #7431F9"><i class="layui-icon layui-icon-close"></i>自动提交已关闭
  718. </button>
  719. <button type="button" id="mt-setting-button-3" class="layui-btn layui-btn-sm" style="background-color: white;border-radius: 5px; color: black; border-color: #7431F9; display:none; "><i class="layui-icon layui-icon-refresh"></i>重新搜索答案
  720. </button>
  721. <button type="button" id="mt-setting-button-4" class="layui-btn layui-btn-sm" style="background-color: white;border-radius: 5px; color: black; border-color: #7431F9;"><i class="layui-icon layui-icon-down"></i>
  722. </button>
  723. </div>
  724. </div>
  725. <div style="max-height: 200px; overflow: auto;">
  726. <hr class="layui-border-cyan">
  727. <div class="layui-font-12" id="mt-table-tips">
  728. 温馨提示:点击下方表格中的文字可直接复制。如果试题黄色高亮代表搜索到的答案不完全匹配建议手动搜索。
  729. </div>
  730. <table class="layui-table" id="mt-dashboard-history" >
  731. <colgroup>
  732. <col>
  733. <col>
  734. <col>
  735. </colgroup>
  736. <thead>
  737. <tr>
  738. <th class="layui-font-12 layui-center" style="font-weight: bold; padding: 5px; line-height: 15px; width: 12%;">题号</th>
  739. <th class="layui-font-12 layui-center" style="font-weight: bold; padding: 5px; line-height: 15px; width: 44%;">题目</th>
  740. <th class="layui-font-12 layui-center" style="font-weight: bold; padding: 5px; line-height: 15px; width: 44%;">答案</th>
  741. </tr>
  742. </thead>
  743. <tbody>
  744. </tbody>
  745. </table>
  746. </div>
  747. </div>
  748. </div>
  749. `;
  750. _self.top.$(dashboardHtml).appendTo('body');
  751. let $mt_dashboard = _self.top.$('#mt-dashboard');
  752. var $body = $('body');
  753. var $document = $(_self.top.document);
  754. $mt_dashboard.on('mousedown', function (e) {
  755. e.preventDefault();
  756. var x = e.clientX,
  757. y = e.clientY,
  758. l = $mt_dashboard.position().left,
  759. t = $mt_dashboard.position().top;
  760. var scrollTop = $document.scrollTop();
  761. $body.css('cursor', 'move');
  762. $mt_dashboard.css('cursor', 'move');
  763. $document.on('mousemove', function (e) {
  764. $mt_dashboard.css({
  765. left: l + e.clientX - x,
  766. top: t + e.clientY - y - scrollTop
  767. });
  768. // dashboardPosition[1] = e.clientX - x;
  769. // dashboardPosition[0] = t + e.clientY - y - scrollTop
  770. }).on('mouseup', function () {
  771. // GM_setValue('mtSetting_dashboardPosition', [$mt_dashboard.position().top, $mt_dashboard.position().left])
  772. $body.css('cursor', '');
  773. $mt_dashboard.css('cursor', '');
  774. $(this).off('mousemove mouseup');
  775. });
  776. });
  777. var $dashboardTips = $('#mt-dashboard-tips', $mt_dashboard);
  778. var $dashboardNotifications = $('#mt-dashboard-notifications', $mt_dashboard);
  779. // var $dashboardVersion = $('#mt-dashboard-version', $mt_dashboard);
  780. var $dashboardHelp = $('#mt-dashboard-doc', $mt_dashboard);
  781. var resp_version, resp_tips, resp_notifications, resp_update, resp_help;
  782. GM_xmlhttpRequest({
  783. method: 'GET',
  784. url: setting.tiku + '/cx/v2/notification?script=cx&version=' + GM_info.script.version,
  785. timeout: setting.time,
  786. onload: function (xhr) {
  787. if (xhr.status == 200) {
  788. var obj = $.parseJSON(xhr.responseText) || {};
  789. resp_version = obj.version;
  790. resp_tips = obj.tips;
  791. resp_notifications = obj.notifications;
  792. resp_update = obj.update;
  793. resp_help = obj.help;
  794.  
  795. // 版本更新提示
  796. const currentVersion = GM_info.script.version;
  797. if (currentVersion != resp_version) {
  798. console.log("[MT]New version found. Current version: " + currentVersion + ', Latest version: ' + resp_version);
  799. let $mt_dashboard = _self.top.$('#mt-dashboard');
  800. var $dashboardVersion = $('#mt-dashboard-version', $mt_dashboard);
  801. $dashboardVersion.html(`<a href="${resp_update}" target="_blank" class="layui-btn layui-btn-xs" style="color: white;background-color: #7431F9; border: 1px solid white;border-radius: 5px;">💡更新脚本</a>`)
  802. } else {
  803. console.log("[MT]The script is already the latest version: " + currentVersion);
  804. }
  805.  
  806. // if (resp_version != setting.script_version && resp_version != '') {
  807. // $dashboardVersion.html(`<a href="${resp_update}" target="_blank" class="layui-btn layui-btn-xs" style="color: white;background-color: #7431F9; border: 1px solid white;border-radius: 5px;">更新脚本</a>`)
  808. // }
  809. $dashboardHelp.html(`<a href="${resp_help}" target="_blank" class="layui-btn layui-btn-xs" style="background-color: white; color: black;border-radius: 5px;">使用帮助</a>`)
  810. } else {
  811. resp_version = '';
  812. resp_tips = [`<hr class="layui-border-cyan"><div class="layui-font-12" style="margin-bottom: 5px; line-height:20px;">Muketool服务器连接失败,错误码:${xhr.status},可能是服务器正在维护或被攻击所致,稍后将尝试重新连接,如果长时间出现此异常请&nbsp;<a href="https://www.muketool.com" target="_blank" class="layui-btn layui-btn-xs layui-bg-red">点击此处</a>&nbsp;反馈。</div>`];
  813. resp_notifications = ['<hr class="layui-border-cyan"><div class="layui-font-12" style="margin-bottom: 5px;">服务器连接失败时自动搜题功能将不可用,其他功能正常,请耐心等待修复......</div>'];
  814. resp_update = 'https://www.muketool.com';
  815. resp_help = 'https://www.muketool.com/';
  816. }
  817. },
  818. onerror: function (error) {
  819. resp_version = '';
  820. resp_tips = [`<hr class="layui-border-cyan"><div class="layui-font-12" style="margin-bottom: 5px; line-height:20px;">Muketool服务器连接失败,可能是服务器正在维护或被攻击所致,稍后将尝试重新连接,如果长时间出现此异常请&nbsp;<a href="https://www.muketool.com" target="_blank" class="layui-btn layui-btn-xs layui-bg-red">点击此处</a>&nbsp;反馈。</div>`];
  821. resp_notifications = ['<hr class="layui-border-cyan"><div class="layui-font-12" style="margin-bottom: 5px;">服务器连接失败时自动搜题功能将不可用,其他功能正常,请耐心等待修复......</div>'];
  822. resp_update = 'https://www.muketool.com';
  823. resp_help = 'https://www.muketool.com/';
  824. console.log('出现错误2');
  825. console.error('服务器超时,正在重试...' + JSON.stringify(error));
  826. }
  827. });
  828. setInterval(function () {
  829. $dashboardTips.html(resp_tips[Math.floor(Math.random() * resp_tips.length)]);
  830. $dashboardNotifications.html(resp_notifications[Math.floor(Math.random() * resp_notifications.length)]);
  831. }, 15000); // TODO
  832. }
  833.  
  834. function switchToNormal() {
  835. clearInterval(setting.loop);
  836. delete setting.loop;
  837. let $mt_dashboard = _self.top.$('#mt-dashboard');
  838. $('#mt-dashboard-setting', $mt_dashboard).hide();
  839. $('#mt-table-tips', $mt_dashboard).hide();
  840. $('#mt-dashboard-history tr', $mt_dashboard).not(':first').remove();
  841. $('#mt-dashboard-history', $mt_dashboard).hide();
  842. $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">正在自动执行相关任务,请喝杯茶耐心等待......</span>');
  843. }
  844.  
  845. function switchToAnswering() {
  846. clearInterval(setting.loop);
  847. delete setting.loop;
  848. let $mt_dashboard = _self.top.$('#mt-dashboard');
  849. $('#mt-dashboard-setting', $mt_dashboard).show();
  850. $('#mt-table-tips', $mt_dashboard).show();
  851. $('#mt-dashboard-history tr', $mt_dashboard).not(':first').remove();
  852. $('#mt-dashboard-history', $mt_dashboard).show();
  853. setting.work ? $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-loading-1 layui-anim layui-anim-rotate layui-anim-loop"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">正在拼命搜索试题答案中,您可在下方查看详情......</span>') : $('#mt-dashboard-status', $mt_dashboard).html('<i class="layui-icon layui-icon-pause"></i>&nbsp;<span class="layui-font-13" style="font-weight: bold;">自动答题已暂停,您可在下方重新开启</span>');
  854. setting.search_history ? $('#mt-dashboard-history', $mt_dashboard).show() : '';
  855. setting.work ? $('#mt-setting-button-1', $mt_dashboard).html('<i class="layui-icon layui-icon-ok"></i>自动答题已开启') : $('#mt-setting-button-1', $mt_dashboard).html('<i class="layui-icon layui-icon-close"></i>自动答题已暂停');
  856. GM_getValue('mtSetting_autoSubmit') ? $('#mt-setting-button-2', $mt_dashboard).html('<i class="layui-icon layui-icon-ok"></i>自动提交已开启') : $('#mt-setting-button-2', $mt_dashboard).html('<i class="layui-icon layui-icon-close"></i>自动提交已关闭');
  857. setting.search_history ? $('#mt-setting-button-4', $mt_dashboard).html('<i class="layui-icon layui-icon-down"></i>') : $('#mt-setting-button-4', $mt_dashboard).html('<i class="layui-icon layui-icon-right"></i>');
  858. setting.search_history ? $('#mt-table-tips', $mt_dashboard).html('温馨提示:点击下方表格中的文字可直接复制。如果试题黄色高亮代表搜索到的答案不完全匹配建议手动搜索。') : $('#mt-table-tips', $mt_dashboard).html('搜题历史记录已隐藏,您可在上方重新开启');
  859. }
  860.  
  861. function filterImg(dom) {
  862. return $(dom).clone().find('img[src]').replaceWith(function () {
  863. return $('<p></p>').text('<img src="' + $(this).attr('src') + '">');
  864. }).end().find('iframe[src]').replaceWith(function () {
  865. return $('<p></p>').text('<iframe src="' + $(this).attr('src') + '"></irame>');
  866. }).end().text().trim();
  867. }
  868.  
  869. function skipQuestion() {
  870. const originOpen = XMLHttpRequest.prototype.open;
  871. XMLHttpRequest.prototype.open = function (_, url) {
  872. if (url.indexOf('richvideo/initdatawithviewerV2') > -1) {
  873. this.addEventListener("readystatechange", function () {
  874. if (this.readyState === 4) {
  875. Object.defineProperty(this, "responseText", {
  876. writable: true,
  877. });
  878. this.responseText = JSON.stringify([]);
  879. }
  880. });
  881. }
  882. originOpen.apply(this, arguments);
  883. };
  884. }
  885.  
  886.  
  887. function stopMouseout() {
  888. console.log('[MT]Stop mouseout...');
  889. const elements = document.getElementsByTagName('*');
  890. for (let i = 0; i < elements.length; i++) {
  891. elements[i].addEventListener('mouseout', function (event) {
  892. event.stopPropagation();
  893. }, true);
  894. }
  895. }
  896.  
  897.  
  898. function initMtSetting() {
  899. if (typeof GM_getValue('mtSetting_autoSubmit') === 'undefined') {
  900. GM_setValue('mtSetting_autoSubmit', false);
  901. }
  902. console.log('[MT]Auto submit is ' + (GM_getValue('mtSetting_autoSubmit') ? 'enabled' : 'disabled'));
  903.  
  904. }