Greasy Fork

Greasy Fork is available in English.

清除雨课堂做题痕迹

清除雨课堂试卷做题痕迹(仅UI变更,不涉及雨课堂后台数据),便于复习。支持黑暗模式、日光模式(需更新到V3.0.0.RELEASE及以上版本)。支持吃菇子的“手气不错”模式(需更新到V3.1.0.RELEASE及以上版本)。支持设置答题正误并导出错题(需要更新到V4.0.0版本及以上)

目前为 2022-06-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         清除雨课堂做题痕迹
// @namespace    http://tampermonkey.net/
// @version      4.0.1
// @description  清除雨课堂试卷做题痕迹(仅UI变更,不涉及雨课堂后台数据),便于复习。支持黑暗模式、日光模式(需更新到V3.0.0.RELEASE及以上版本)。支持吃菇子的“手气不错”模式(需更新到V3.1.0.RELEASE及以上版本)。支持设置答题正误并导出错题(需要更新到V4.0.0版本及以上)
// @author       冰镇杨梅瑞纳冰YYDS
// @match        https://examination.xuetangx.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=xuetangx.com
// @grant        none
// @license DONT FUCKING CARE
// ==/UserScript==

(function() {
    'use strict';
    var checkDiv = document.createElement("div");
    var rightAnswer;
    var button;
    var isClicked = 0;
    checkDiv.setAttribute("id","test");
    document.body.appendChild(checkDiv);
    var testBlock = document.getElementById("test");
    testBlock.style.height="auto";
    testBlock.style.width="auto";
    testBlock.style.position="fixed";
    testBlock.style.top=0;
    testBlock.style.right=0;
    testBlock.style.zindex=1000;
    testBlock.innerHTML+='<div style="margin:60px; z-index:1000; text-align:center;width:100dp" ><button id="start" onClick="ErasAll()" width="40px" style=\"width:100%; background-color:#4286F3; padding:15px; border-radius:5px;border:0;color:white\">清除做题痕迹</button><br><button id="nightmode" onClick="Night()" style=\"background-color:#002361; width:45%; padding:15px; border-radius:5px;border:0;color:white;margin-top:10px;\">🌙</button><button id="daymode" onClick="Day()" style=\"background-color:#fcd5c0; padding:15px; width:45%;border-radius:5px;border:0;color:white;margin-top:10px;margin-left:10%;\">🌞</button><br><button id="start" onClick="ImFeelingLucky()" width="40px" style=\"background-color:#4286F3; padding:15px; border-radius:5px;border:0;color:white;margin-top:10px;width:100%\">🦚 手气不错</button><br><button id="start" onClick="SaveError()" style=\"background-color:#4286F3; width:100%;padding:15px; margin-top:10px;border-radius:5px;border:0;color:white\">📔只保留错题</button><button id="start" onClick="SaveError()" style=\"background-color:#4286F3; width:100%;padding:15px; margin-top:10px;border-radius:5px;border:0;color:white\"><a href="http://greasyfork.icu/zh-CN/scripts/446101-%E6%B8%85%E9%99%A4%E9%9B%A8%E8%AF%BE%E5%A0%82%E5%81%9A%E9%A2%98%E7%97%95%E8%BF%B9" style="text-decoration: none;>⏫检查更新</a></button></div>'
    // Your code here...


    window.SaveError = function(){
        let errorList = document.getElementsByClassName("congras");
        if(errorList.length<1){
            alert("你必须设置至少一道正确的题目");
        }else{
            for(let abc=0;abc<errorList.length;abc++){
                errorList[abc].parentNode.style.display="none";
            }
            errorList = null;
        }
    }



    window.Night = function(){

        var mainbackground = document.getElementsByClassName("exam-main");
        mainbackground[0].style.backgroundColor="black";
        mainbackground[0].style.backgroundColor="black";
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("header-content");
        mainbackground[0].style.backgroundColor="black";
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("exam-aside");
        mainbackground[0].style.backgroundColor="black";
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("exam-main--body");
        mainbackground[0].style.backgroundColor="#0c0d0d";
        mainbackground[0].style.color="#d4d4d4";
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("item-footer");

        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.backgroundColor="black";
            mainbackground[i].style.color="#d4d4d4";
            mainbackground[i].style.transitionDuration="1s";

        }

        mainbackground = document.getElementsByTagName("p");
        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.color="#d4d4d4";
            mainbackground[0].style.transitionDuration="1s";

        }
        var bala = document.getElementsByClassName("radioInput");
        for(let i=0;i<bala.length;i++){
            bala[i].style.backgroundColor="black";
            bala[i].style.color="#d4d4d4";
            bala[i].style.transitionDuration="1s";
        }
    }

    window.Day = function(){
        var mainbackground = document.getElementsByClassName("exam-main");
        mainbackground[0].style.backgroundColor="#f7f7f7";
        mainbackground = document.getElementsByClassName("header-content");
        mainbackground[0].style.backgroundColor="white";
        mainbackground = document.getElementsByClassName("exam-aside");
        mainbackground[0].style.backgroundColor="white";
        mainbackground = document.getElementsByClassName("exam-main--body");
        mainbackground[0].style.backgroundColor="white";
        mainbackground[0].style.color="black";
        mainbackground = document.getElementsByTagName("p");
        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.color="black";

        }
        mainbackground = document.getElementsByClassName("item-footer");

        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.backgroundColor="#f9f9f9";
            mainbackground[i].style.color="black";
            mainbackground[i].style.transitionDuration="1s";

        }
        var bala = document.getElementsByClassName("radioInput");
        for(let i=0;i<bala.length;i++){
            bala[i].style.backgroundColor="white";
            bala[i].style.color="#d4d4d4";
            bala[i].style.transitionDuration="1s";
        }


    }

    window.RandomColor=function(){
        var r = Math.floor(Math.random() * 256);
        var g = Math.floor(Math.random() * 256);
        var b = Math.floor(Math.random() * 256);
        return "rgb(" + r + "," + g + "," + b + ")";
    };

    window.ImFeelingLucky=function(){
        var mainbackground = document.getElementsByClassName("exam-main");
        mainbackground[0].style.backgroundColor=RandomColor();
        mainbackground[0].style.backgroundColor=RandomColor();
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("header-content");
        mainbackground[0].style.backgroundColor=RandomColor();
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("exam-aside");
        mainbackground[0].style.backgroundColor=RandomColor();
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("exam-main--body");
        mainbackground[0].style.backgroundColor=RandomColor();
        mainbackground[0].style.color=RandomColor();
        mainbackground[0].style.transitionDuration="1s";
        mainbackground = document.getElementsByClassName("item-footer");
        let theColor = RandomColor();
        let theColor2 = RandomColor();
        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.backgroundColor=theColor;
            mainbackground[i].style.color=theColor2;
            mainbackground[i].style.transitionDuration="1s";

        }

        mainbackground = document.getElementsByTagName("p");
        for(let i=0;i<mainbackground.length;i++){
            mainbackground[i].style.color=theColor2;
            mainbackground[0].style.transitionDuration="1s";

        }
        var bala = document.getElementsByClassName("radioInput");
        for(let i=0;i<bala.length;i++){
            bala[i].style.backgroundColor=theColor;
            bala[i].style.color=theColor2;
            bala[i].style.transitionDuration="1s";
        }
    }



    window.ErasAll = function(){
        isClicked=1;
        alert("🐵你的答案痕迹已被清除,查看答案点击对应题目的查看答案。题目处理可能需要等待。");
        // 删除所有蓝色选项按钮
        var sideBar = document.getElementsByClassName('exam-aside');
        sideBar[0].style.transitionDuration="1s";
        sideBar[0].style.display="none";
        var headerbar = document.getElementsByClassName("header");
        headerbar[0].style.display="none";
        var isChecked = document.getElementsByClassName('el-radio');
        for(let i=0;i<isChecked.length;i++){
            isChecked[i].className="el-radio is-disabled";
            isChecked[i].style.transitionDuration="1s";
        }


        //隐藏所有正确答案
        rightAnswer = document.getElementsByClassName("item-footer");
        for(let g=0;g<rightAnswer.length;g++){
            rightAnswer[g].style.display="none";
        }
        //新增显示答案
        var questions = document.getElementsByClassName("item-body");
        var showidbtns = document.getElementsByClassName("ShowAnswerBtn");
        if(showidbtns.length>1){
            for(let v=0;v<showidbtns.length;v++){
                showidbtns[v].style.display="block";
            }
        }else{
            for(let t=0;t<questions.length;t++){
                var num = t;
                questions[t].innerHTML+='<button id="'+t+'" class="ShowAnswerBtn" style="background-color: #4286F3; padding:15px; border-radius:5px;border:0;color:white" onClick="ShowAnswer('+t+')"><p>显示答案</p></button><a id="num" style="display:none;">'+num+'</a><button class="right" style="background-color: #83e939; padding:15px; border-radius:5px;border:0;color:white;margin-left:10px;" onClick="Result('+t+',1)"><p>✔️</p></button><button class="right" style="background-color: #fc9696; padding:15px; border-radius:5px;border:0;color:white;margin-left:10px;" onClick="Result('+t+',0)"><p>❌</p></button>';
            }
        }


        var myTextAnswer = document.getElementsByClassName("subject-answer");
        for(let i=0;i<myTextAnswer.length;i++){
            myTextAnswer[i].innerHTML="你的答案已被脚本吃掉了";
        }
        for(let j=0;j<50;j++){
            //删除所有的标记(多删几次)
            var rightAnswerMark = document.getElementsByClassName("dot");
            for(let i=0;i<rightAnswerMark.length;i++){
                let dotParent = rightAnswerMark[i].parentNode;
                dotParent.removeChild(rightAnswerMark[i]);
            }
        }
    }
    window.ShowAnswer=function(num){
        rightAnswer[num].style.display="block";
        var thebutton = document.getElementsByClassName('ShowAnswerBtn');
        thebutton[num].style.display="none";
    }
    window.Result = function(num,type){
        //var rightbtns = document.getElementsByClassName('right');
        let questions = document.getElementsByClassName("result_item");
        let questionstitle = document.getElementsByClassName("item-type");
        let parent = document.getElementsByClassName("subject-item");
        if(type==1){
            questions[num].style.display="none";
            questions[num].style.transitionDuration="1s";
            let thecount = num+1;
            questions[num].parentNode.innerHTML+='<div class="congras">🥳恭喜你,第'+thecount+'题回答正确,已隐藏该问题</div>';
            questions[num].style.transitionDuration="1s";
            questions[num].parentNode.transitionDuration="1s";
            questions[num].style.backgroundColor="";
            questions[num].parentNode.style.backgroundColor="";

        }else{
            questionstitle[num].style.transitionDuration="1s";
            questionstitle[num].parentNode.transitionDuration="1s";
            questionstitle[num].style.backgroundColor="#ffb6dc";
            questionstitle[num].style.color="black";



        }
    }

})();