中国大学mooc提前获取测验解析

中国大学mooc提前获取测验解析,记得等待加载完毕后再点击提前解析

当前为 2020-04-09 提交的版本,查看 最新版本

// ==UserScript==
// @name         中国大学mooc提前获取测验解析
// @namespace    https://explorersss.github.io/
// @version      0.1
// @description  中国大学mooc提前获取测验解析,记得等待加载完毕后再点击提前解析
// @author       ccreater
// @match        https://www.icourse163.org/*
// @require      http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @grant        GM_xmlhttpRequest
// @blog         https://explorersss.github.io/
// ==/UserScript==
function get_answer(aid,id){
    if(aid && id)
    {
        var post_data="callCount=1\n"
        post_data+="scriptSessionId=${scriptSessionId}190\n"
        post_data+="httpSessionId=1d4ae12c733f41f495fc1fcbaeccd4f2\n"
        post_data+="c0-scriptName=MocQuizBean\n"
        post_data+="c0-methodName=getQuizPaperDto\n"
        post_data+="c0-id=0\n"
        post_data+="c0-param0=string:"+id+"\n"
        post_data+="c0-param1=number:"+aid+"\n"
        post_data+="c0-param2=boolean:true\n"
        post_data+="batchId=0"
        GM_xmlhttpRequest({
            method: "POST",
            data: post_data,
            headers: {
                "Content-Type": "application/x-www-form-urlencoded"
            },
            url: "https://www.icourse163.org/dwr/call/plaincall/MocQuizBean.getQuizPaperDto.dwr",
            onload: function(response) {
                eval(response.responseText);
                var qlist=document.getElementsByClassName("j-list")[0].children[0].children
                //s1 is question list
                //var qnum=qlist.childElementCount
                for(var i=0;i<s1.length;i++){
                    var answer="";
                    var analyse="";
                    if(s1[i].stdAnswer){
                        answer=s1[i].stdAnswer;
                    }else{
                        for(var j=0;j<s1[i].optionDtos.length;j++){
                            var choice=s1[i].optionDtos[j]
                            if(choice.answer){
                                answer+="ABCD"[j]//+":"
                                //answer+=choice.content+"\n"
                            }
                            if(choice.analyse){
                                analyse+=choice.analyse
                            }
                        }
                    }
                    if(s1[i].analyse){
                        analyse+=s1[i].analyse
                    }
                    console.log(answer)
                    console.log(analyse)
                    answer=answer.replace("##%_YZPRLFH_%##","或")
                    var raw_html=`<div class="analysisInfo ">
	<div>
		<span class="f-f0 tt1">正确答案:
		</span>
		<span class="f-f0 tt2">ANSWER
		</span>
	</div>
	<div>
		<b>解析:ANALYSE
	</div>
</div>`
                    var $node = $(qlist[i])
                    raw_html=raw_html.replace("ANSWER",answer)
                    raw_html=raw_html.replace("ANALYSE",analyse?analyse:"无")
                    $node.append(raw_html)

                }

            }
        });


    }}
(function() {
    var aid=0;
    var id=0;
    eval(document.location.hash.substr(document.location.hash.indexOf("?")+1).replace("&",";"))
    if(aid && id){
      var topBox = "<div style='position:fixed;z-index:999999;background-color:#ccc;cursor:pointer;top:200px;left:0px;'>"+
						"<div id='pre_analysis' style='font-size:13px;padding:10px 2px;color:#FFF;background-color:#25AE84;'>提前解析</div>"+
				 	 "</div>";
        $("body").append(topBox);
        $("body").on("click","#pre_analysis",function(){
	    	get_answer(aid,id);
	    });

    }


})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址