添加错误处理。修复教务系统alert后无法继续选课的bug
This commit is contained in:
parent
75582019ed
commit
eb0218d04d
46
shuake.js
46
shuake.js
@ -38,25 +38,37 @@ function gogogo(){
|
|||||||
//选课gogogo!
|
//选课gogogo!
|
||||||
$("#electableLessonList_filter_submit").click(); //模拟点击查询
|
$("#electableLessonList_filter_submit").click(); //模拟点击查询
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
if($("#electableLessonList_data").find("td[class=stdCount]")[0].innerHTML == "0"){
|
try{
|
||||||
//没有剩余名额
|
if($("#electableLessonList_data").find("td[class=stdCount]")[0].innerHTML == "0"){
|
||||||
console.log("课程人数已满," + refresh_time + "秒后再试");
|
//没有剩余名额
|
||||||
setTimeout("gogogo()", refresh_time * 1000 - 1000)
|
console.log("课程人数已满," + refresh_time + "秒后再试");
|
||||||
}else{
|
setTimeout("gogogo()", refresh_time * 1000 - 200)
|
||||||
console.log("有了");
|
}else{
|
||||||
//屏蔽confirm
|
console.log("有了");
|
||||||
_tmp_confirm = window.confirm;
|
//模拟点击选课按钮
|
||||||
window.confirm = function () {
|
$("#electableLessonList_data").find("a[operator=ELECTION]").click()
|
||||||
return true;
|
//恢复confirm和alert
|
||||||
};
|
window.confirm = _tmp_confirm
|
||||||
//模拟点击选课按钮
|
window.alert = _tmp_alert
|
||||||
$("#electableLessonList_data").find("a[operator=ELECTION]").click()
|
}
|
||||||
//恢复confirm
|
}catch(err){
|
||||||
window.confirm = _tmp_confirm
|
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();
|
setNo();
|
||||||
|
Reference in New Issue
Block a user