添加错误处理。修复教务系统alert后无法继续选课的bug
This commit is contained in:
parent
75582019ed
commit
eb0218d04d
46
shuake.js
46
shuake.js
@ -38,25 +38,37 @@ function gogogo(){
|
||||
//选课gogogo!
|
||||
$("#electableLessonList_filter_submit").click(); //模拟点击查询
|
||||
setTimeout(function(){
|
||||
if($("#electableLessonList_data").find("td[class=stdCount]")[0].innerHTML == "0"){
|
||||
//没有剩余名额
|
||||
console.log("课程人数已满," + refresh_time + "秒后再试");
|
||||
setTimeout("gogogo()", refresh_time * 1000 - 1000)
|
||||
}else{
|
||||
console.log("有了");
|
||||
//屏蔽confirm
|
||||
_tmp_confirm = window.confirm;
|
||||
window.confirm = function () {
|
||||
return true;
|
||||
};
|
||||
//模拟点击选课按钮
|
||||
$("#electableLessonList_data").find("a[operator=ELECTION]").click()
|
||||
//恢复confirm
|
||||
window.confirm = _tmp_confirm
|
||||
try{
|
||||
if($("#electableLessonList_data").find("td[class=stdCount]")[0].innerHTML == "0"){
|
||||
//没有剩余名额
|
||||
console.log("课程人数已满," + refresh_time + "秒后再试");
|
||||
setTimeout("gogogo()", refresh_time * 1000 - 200)
|
||||
}else{
|
||||
console.log("有了");
|
||||
//模拟点击选课按钮
|
||||
$("#electableLessonList_data").find("a[operator=ELECTION]").click()
|
||||
//恢复confirm和alert
|
||||
window.confirm = _tmp_confirm
|
||||
window.alert = _tmp_alert
|
||||
}
|
||||
}catch(err){
|
||||
console.log(err);
|
||||
console.log("雾草,出错了,不过没关系,刷课还在继续");
|
||||
setTimeout("gogogo()", refresh_time * 1000 - 200)
|
||||
}
|
||||
}, 1000)
|
||||
}, 200) //这里的200毫秒是request时间,因为没有回调,所以写死了200
|
||||
|
||||
}
|
||||
|
||||
refresh_time = 3; //刷课间隔,可以手动修改,最低为2!
|
||||
//屏蔽教务系统的错误alert和确认comfirm
|
||||
_tmp_alert = window.alert
|
||||
window.alert = function () {
|
||||
return true;
|
||||
};
|
||||
_tmp_confirm = window.confirm;
|
||||
window.confirm = function () {
|
||||
return true;
|
||||
};
|
||||
|
||||
refresh_time = 1.1; //刷课间隔,可以手动修改,最低为1
|
||||
setNo();
|
||||
|
Reference in New Issue
Block a user