code.txt的内容
[Asm] 纯文本查看 复制代码 var answer = [];
var times = 0;
var totalTimes = 0;
var Next = function () {
var questionId = answer[times]['questionId']
console.log("questionId", questionId)
// $(`[id$=_${questionId}]`).click();
$(`li[value=${questionId}]`).children('a').get(0).click()
setTimeout(
function () {
var strAns = answer[times]['answerNo'];
var arrA = strAns.split('');
for (a of arrA) {
if(a == 1){
a = 'A'
}
if(a == 0){
a = 'B'
}
$('input[value=' + a + ']').click()
}
times += 1;
if (times < totalTimes) {
Next();
}
else {
console.debug('完成');
}
}, 1000); //等待1000毫秒, 如果网速不好适当增加这里的值;
};
var getCookie = function(name) {
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
return v ? v[2] : null;
}
var start = function () {
console.debug('开始');
let paperId = $('#hid').attr('value')
let seriesId = getCookie(`ex_range_${paperId}`)
let answerUrl = `http://www.faxuanyun.com/ess/service/getpaper?paperId=${paperId}&series=${seriesId}_answer`
fetch(answerUrl, {
"headers": {
"cache-control": "no-cache",
"pragma": "no-cache",
"upgrade-insecure-requests": "1"
},
"referrerPolicy": "strict-origin-when-cross-origin",
"body": null,
"method": "GET",
"mode": "no-cors",
"credentials": "include"
}).then(res => res.text()).then(body => {
console.log("test", body);
if (!body) {
console.log('响应结果异常!')
return;
}
let answerString = body.split("\n")[2];
answer = JSON.parse(answerString);
totalTimes = answer.length;
Next();
});
}
start(); |