您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
自动挂机看尔雅MOOC,支持后台、切换窗口不暂停,视频自动切换,屏蔽视频内的题目,倍速播放、进度条拖动、快进快退
当前为
// ==UserScript== // @name 超星网课助手(测试版) // @namespace [email protected] // @version 0.0.26 // @description 自动挂机看尔雅MOOC,支持后台、切换窗口不暂停,视频自动切换,屏蔽视频内的题目,倍速播放、进度条拖动、快进快退 // @author wyn665817 // @match *://*.chaoxing.com/exam/test/reVersionTestStartNew* // @run-at document-end // @grant unsafeWindow // @license MIT // ==/UserScript== /** * 注意事项: * 1.此版本为考试专版,仅具有细化的考试功能,建议在指导下使用 * 2.此版本为测试版,可能与正式版存在冲突,使用时建议关闭正式版 * 3.自动答题功能仅支持单选题、判断题、多选题 * 4.选择默认选项,即单选题、多选题单选A选项,判断题选择正确 * 5.其他注意事项会逐步完善 */ // 设置修改后,需要刷新或重新打开网课页面才会生效 var setting = { // 3E3 == 3000,表示毫秒数 time: 3E3 // 默认响应速度为3秒,不建议小于2秒 // 1代表开启,0代表关闭 ,auto: 1 // 自动答题功能,默认开启 ,retry: 0 // 服务器异常时进行重试,默认关闭 ,hide: 0 // 隐藏答案搜索提示框,默认关闭 // 仅开启auto时,修改此处才会生效 ,jump: 1 // 答题完成后自动切换,默认开启 ,none: 0 // 未找到答案时选择默认选项,默认关闭 // 仅开启jump时,修改此处才会生效 ,other: 0 // 对不支持自动答题的题目进行跳转,默认关闭 }, $ = unsafeWindow.$; setting.text = ['自动答题已完成,', '已选择默认选项,', '未找到匹配的答案,', '该题型不支持自动答题,']; setting.div = setting.hide ? $() : $( '<div style="border: 2px dashed rgb(0, 85, 68); width: 350px; position: fixed; top: 0; right: 0; background-color: rgba(70, 196, 38, 0.6); overflow: auto;">' + '<div style="font-size: medium;">正在搜索答案...</div>' + '<button>重新查询</button>' + (setting.jump ? '<button style="margin-left: 10px;">点击停止本次切换</button>' : '') + '<table border="1" style="font-size: 12px;">' + '<tr>' + '<td width="60%">题目</td>' + '<td width="40%">答案</td>' + '</tr>' + '</table>' + '</div>' ).appendTo('body'); setting.div.children('button').on('click', function() { var len = $(this).prevAll('button').length; if (len == 0) { $('.current')[0].click(); } else if (len == 1) { clearTimeout(setting.timeid); setting.jump = 0; setting.div.children('div').text((setting.tip == undefined ? '' : setting.text[setting.tip]) + '已关闭本次自动切换'); $(this).remove(); } }); setTimeout(findTiMu, setting.time); function findTiMu() { var TiMu = $('.TiMu .Cy_TItle .clearfix').text().trim(), xhr = new XMLHttpRequest(); xhr.open('POST', 'https://www.forestpolice.org/php/unify.php'); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.timeout = setting.time * 4; xhr.onloadend = function() { if (xhr.status == 200) { var obj = JSON.parse(xhr.responseText); if (obj.code) { setting.div.children('table').append('<tr><td>' + TiMu + '</td><td>' + obj.data + '</td></tr>'); if (setting.auto) { setting.div.children('div').text('答案搜索已完成,正在自动答题...'); checkBox(obj.data); } else { setting.div.children('div').text('答案搜索已完成,未开启自动答题'); } } else { setting.div.children('div').text(obj.data); } } else if (setting.retry) { setting.div.children('div').text('服务器异常,正在重新搜索答案'); setTimeout(findTiMu, setting.time * 2); } else { setting.div.children('div').text('服务器异常,未开启自动重试'); } }; xhr.send('question=' + encodeURIComponent(TiMu) + '&username=test00&password=123456'); } function checkBox(event) { var type = $('.current').parent().prev().text(); if (type == '多选题') { var index = 0, arr = event.split('#'), $check = $('#submitTest ul:eq(0) .clearfix'), timeId = setInterval(function() { if (index >= $check.length) { clearInterval(timeId); checkDef(); } else { var text = $check.eq(index).text().trim(); arr.find(function(currentValue) { var tip = text.includes(currentValue); if (tip && !$('#submitTest :checkbox').eq(index).is(':checked')) { $check.eq(index).click(); } else if (!tip && $('#submitTest :checkbox').eq(index).is(':checked')) { $check.eq(index).click(); } return tip; }); } index++; }, setting.time); } else if (type == '判断题') { var $input = $('#submitTest ul input'); if (event == '正确' || event == '是') { $input.eq(0).click(); } else if (event == '错误' || event == '否') { $input.eq(1).click(); } checkDef(); } else if (type == '单选题') { $('#submitTest ul:eq(0) .clearfix').each(function() { if ($(this).text().trim().includes(event)) { $(this).click(); return false; } }); checkDef(); } else if (setting.other) { jumpTimu(3); } else { setting.div.children('div').text('该题型不支持自动答题,请手动完成'); } } function checkDef() { var id = 0; if (!$('#submitTest :checked').length) { if (setting.none) { $(':radio, :checkbox', '#submitTest').eq(0).click(); id = 1; } else if (setting.other) { id = 2; } else { setting.div.children('div').text('无正确答案,未开启选择默认选项'); return; } } jumpTimu(id); } function jumpTimu(id) { var $next = $('.leftBottom a:contains("下一题")'); if ($next.hasClass('saveYl01')) { setting.div.children('div').text('考试已完成'); } else { var text = '未开启自动切换'; if (setting.jump) { text = '即将切换下一题'; setting.tip = id; setting.timeid = setTimeout(function() { $next[0].click(); }, setting.time); } setting.div.children('div').text(setting.text[id] + text); } }