// ==UserScript== // @name 福理工习概刷题 // @namespace https://docs.scriptcat.org/ // @version 0.1.0 // @description try to take over the world! // @author yearzen1 // @match https://mooc1-2.chaoxing.com/exam-ans/exam/test/* // @match https://mooc1-2.chaoxing.com/exam-ans/mooc2/exam/* // ==/UserScript== (async function() { if(!sessionStorage.getItem("start")) { sessionStorage.setItem("start","1") const isTrue1 = confirm("本脚本,需要考试能重考三次,请确定该考试能重考三次") const isTrue = confirm("是否开始刷题") if(!(isTrue&&isTrue1)) return } if(window.location.href.includes("https://mooc1-2.chaoxing.com/exam-ans/exam/test/examcode/examnotes")) { if(sessionStorage.getItem("over") === "1") { alert("刷题结束") return } const agreeCheck = document.querySelector(".agree_check") if(agreeCheck) { agreeCheck.click() sessionStorage.setItem("url",window.location.href) } const startBtn = document.querySelector("#startBtn") if(startBtn) startBtn.click() const tablefull = document.querySelector("#confirmRetestWin") if(tablefull.style.display === "none") document.querySelector("#tabIntoexam2").click() else document.querySelector("#confirmRetestWin > div > div.popBottom > a.jb_btn.jb_btn_92.fr.fs14.confirm").click() } else if(window.location.href.includes("https://mooc1-2.chaoxing.com/exam-ans/exam/test/reVersionTestStartNew")) { const full = document.querySelector(".completeBtn.fl") if(full) full.click() } else if(window.location.href.includes("https://mooc1-2.chaoxing.com/exam-ans/mooc2/exam/preview")) { if(sessionStorage.getItem("rightAnswers")) { const answerTexts = JSON.parse(sessionStorage.getItem('rightAnswers')); let answerTextscount = -1 const myMap = new Map() myMap.set("A",0).set("B",1).set("C",2).set("D",3).set("对",0).set("错",1) const markTableList = document.querySelectorAll(".mark_table > div > div") for(let i=0;i<=markTableList.length-1;++i) { ++answerTextscount const answerList = markTableList[i].querySelectorAll(":scope > form > div > div") if(answerTexts[answerTextscount].length > 1) { for(let j=0;j<=answerTexts[answerTextscount].length-1;++j) { clickSaveMultiSelect(answerList[myMap.get(answerTexts[answerTextscount][j])],markTableList[i].getAttribute("data")) await new Promise(resolve => setTimeout(resolve, 300)); } } else { saveSingleSelect(answerList[myMap.get(answerTexts[answerTextscount])],markTableList[i].getAttribute("data")) await new Promise(resolve => setTimeout(resolve, 300)); } } sessionStorage.setItem("over","1") } const full = document.querySelector(".completeBtn.fl") if(full) finalSubmit() const yes1 = document.querySelector(".jb_btn.jb_btn_92.fr.fs14.confirm") if(yes1) yes1.click() const yes = document.querySelectorAll(".jb_btn.jb_btn_92.fr.fs14.confirm") if(yes) yes[2].click() }//这个是点击整卷阅览后的页面 else if(window.location.href.includes("https://mooc1-2.chaoxing.com/exam-ans/exam/test/look")) { if(!sessionStorage.getItem("look")) sessionStorage.setItem("look","1") if(sessionStorage.getItem("look") === "1") { const chongkao = document.querySelector("body > div.result_Main > div:nth-child(2) > div:nth-child(5) > div > a") if(chongkao) chongkao.click() sessionStorage.setItem("look","2") } else if(sessionStorage.getItem("look") === "2") { const review = document.querySelector(".btnBlue.fs14.btn_124") if(review) review.click() sessionStorage.setItem("look","3") } else if(sessionStorage.getItem("look") === "3") { const chongkao = document.querySelector("body > div.result_Main > div:nth-child(2) > div:nth-child(5) > div > a") if(chongkao) chongkao.click() sessionStorage.setItem("look","4") } } else { const rightanswers = document.querySelectorAll(".rightAnswerContent") if(rightanswers.length > 0) { const answerTexts = Array.from(rightanswers).map(el => el.textContent.trim()); sessionStorage.setItem('rightAnswers', JSON.stringify(answerTexts)); window.location.href = sessionStorage.getItem("url") } } // 第一次:获得答案 })();