|
// ==UserScript==
// @name 职教云自动答题
// @namespace http://zjy.com
// @version 1.0
// @description 职教云 自动答题
// @author Zhang Chenxi
// @match https://zjy2.icve.com.cn/*
// @require http://libs.baidu.com/jquery/2.0.0/jquery.min.js
// @grant GM_xmlhttpRequest
// @grant GM_download
// ==/UserScript==
var result = "";
(function() {
$(function(){
function init_word(){
var quesion_list = $(".e-q-q");
var question_number = quesion_list.length;
for(var i=0;i<question_number;i++){
runAsync("q="+quesion_list[i].innerText,i);
}
var x = 15*question_number;//最长提交时间,单位s
var y = 8*question_number;// 最短提交时间,单位s
var rand = parseInt(Math.random() * (x - y + 1) + y);
$("input[name='useTime']").val(rand);
$("input[name='UseTime']").val(rand);
$(".e-quest-header").append("<br><div style='color:red'>本次提交时间约为:"+ Math.round(rand/60)+"分"+(rand%60)+"秒<div>");
// $(".e-quest-header").append("<br>—总之岁月漫长,然而值得等待—");
}
window.setTimeout( init_word, 2000 );
});
})();
function get_option(true_answer,question_id){
var option_list = $(".e-a-g ul")[question_id];
var option_length = $(option_list).children().length;
for(var i=0;i<option_length;i++){
var answert_1 = $($(option_list).children()[i]).children(".ErichText.destroyTitleButton")[0].innerText;
if(answert_1 == true_answer){
$(option_list).children()[i].click();
break;
}else{
if(i==option_length-1){
var max = option_length-1;//最长提交时间,单位s
var min = 0;// 最短提交时间,单位s
var rand = parseInt(Math.random() * (max - min + 1) + min);
$(option_list).children()[rand].click();
var c = ["A","B","C","D"];
console.log("第"+(question_id+1)+"题未找到答案,系统随机选择"+c[rand] );
}
}
}
}
function runAsync(data_ry,question_id){
GM_xmlhttpRequest({
method: "POST",
url: "",//接口
data:data_ry,
headers: {
"Content-Type": "application/x-www-form-urlencoded;charset=utf-8"
},
onload: function(response) {
get_option(response.responseText.trim(),question_id);
}
});
}
|
|