// ==UserScript== // @name 学堂云/雨课堂(是雨课堂4.0,非雨课堂,题库自动搜集) // @namespace dandanmuaa@gmail.com // @version 1.2 // @description 雨课堂脚本 // @author sea of flowers // @match *://*.yuketang.cn/* // @match *://*.edu.cn/* // @connect huan.fm210.cn // @grant unsafeWindow // @grant GM_xmlhttpRequest // @grant GM_addStyle // @grant GM_getResourceText // @require https://unpkg.com/sweetalert/dist/sweetalert.min.js // @resource cs1 https://www.layuicdn.com/layui/css/layui.css // @run-at document-end // @antifeature ads // @antifeature menbership // ==/UserScript== (function() { 'use strict'; // 设置修改后,需要刷新或重新打开网课页面才会生效 var setting = { passVideo:1, passWork:1, passExam:1, runTimeOut:6000, doTimeOut:6000, }; var window = unsafeWindow; var url = window.location.href; GM_addStyle(GM_getResourceText("cs1")); function fillAnswer(type,answer){ if(type.match("单选题")){ var optionNum = document.getElementsByClassName("radioText").length; for (let i=0;i"; var answer = obj._source.da.split("#"); if(document.getElementsByClassName("el-button el-button--primary el-button--medium").length==1){ fillAnswer(type,answer); } else{ document.getElementsByClassName("el-button el-button--text")[1].click(); }; } else{ content.innerHTML += number +",答案:暂未收录
" document.getElementsByClassName("el-button el-button--text")[1].click(); }; if(value.length==1&&value[0].textContent=="下一题"){ setTimeout(function(){ swal({ title: "搜题已完成", text: "本脚本不保证答案最终准确率,请用户自行检查并提交。\n感谢配合", icon: "success", button: "收到", });},1000); clearInterval(setting.loop); }; } } }); } function pass_video(){ if(setting.passVideo){ document.getElementsByClassName("xt_video_bit_play_btn")[0].click(); } } function pass_homework(){ if(setting.passWork){ var question = document.getElementsByClassName("problem-body")[0].textContent; var type = document.getElementsByClassName("item-type")[0].textContent; findAnswer(question,type); } } if (url.match("cn/courselist|cn/v2/web/index")){ swal({ title: "欢迎使用雨课堂脚本", text: "选择“已接受”或使用该脚本的任何功能,即为遵守使用协议。\n使用协议后续更新不再另行通知。\n脚本协议/使用教程见脚本首页", icon: "warning", button: "我接受", }); }; if (url.match("/video")){ console.log("I'm video"); setTimeout(pass_video,setting.runTimeOut); }; if (url.match("/homework|/exercise")){ var h=document.createElement("div"); h.setAttribute("class","layui-panel"); h.setAttribute("style","width: 400px; height:400px; background-color: #eee;position: fixed;right: 40px;top: 40px;z-index: 99999999;overflow-x: auto;"); var title=document.createElement("div"); title.setAttribute("class","layui-card-body"); h.appendChild(title); var answer=document.createElement("div"); answer.setAttribute("class","layui-card-body"); h.appendChild(answer); document.body.appendChild(h); document.getElementsByClassName("layui-card-body")[0].innerHTML = "脚本初始化中,请耐心等待5秒"; console.log("I'm homework"); var num = 0; setting.loop = setInterval(pass_homework,setting.runTimeOut); }; if (url.match("/exam")){ setTimeout(function(){ console.log("I'm exam"); document.getElementsByClassName("title")[1].innerHTML = "考试题库可以微信扫描该二维码下载搜索~"; },1000); swal({ title: "考试界面", text: "考试功能暂不提供,但可扫描二维码下载APP搜题", icon: "warning", button: "OK", }); }; if (url.match("/graph")){ setTimeout(function(){ swal({ title: "图文章节", text: "课件阅读阅读已完成", icon: "success", button: "OK", }); },1000); }; })();