1. 程式人生 > 實用技巧 >自動網頁做題

自動網頁做題

var daAn=new Array("2"
,"0"
,"1"
,"2"
,"3"
,"1"
,"3"
,"0"
,"2"
,"3"
,"1"
,"3"
,"0"
,"3"
,"1"
,"1"
,"1"
,"1"
,"0"
,"1"
,"0"
,"3"
,"1"
,"2"
,"1"
,"3"
,"3"
,"0"
,"0"
,"0"
,"1"
,"2"
,"2"
,"1"
,"0"
,"0"
,"0"
,"2"
,"1"
,"0"
,"0"
,"3"
,"0"
,"1"
,"2"
,"3"
,"0"
,"2"
,"3"
,"3"
,"0"
,"3"
,"1"
,"2"
,"0"
,"3"
,"2"
,"0"
,"1"
,"3"
,
"3" ,"1" ,"3" ,"3" ,"3" ,"1" ,"1" ,"1" ,"3" ,"3" ,"1" ,"0" ,"2" ,"3" ,"0" ,"0" ,"0" ,"3" ,"3" ,"3" ,"3" ,"2" ,"0" ,"2" ,"2" ,"2" ,"0" ,"1" ,"2" ,"0" ,"3" ,"0" ,"0" ,"1" ,"0" ,"0" ,"0" ,"2" ,"1" ,"0" ,"1" ,"1" ,"3" ,"0" ,"3" ,"2" ,"0" ,"2" ,"2" ,"2" ,"2" ,"2" ,"3" ,"1" ,"1" ,"1" ,"3" ,"1" ,"1" ,"0" ,"3" ,"1");
function stripscript(s) { var pattern = new RegExp("[`~!@#$^&*()=|{ 《》}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]") var rs = ""; for (var i = 0; i < s.length; i++) { rs = rs+s.substr(i, 1).replace(pattern, ''); }
//var reg = /[0-9a-zA-Z]/g; //rs.replace(reg,""); rs=rs.replace(/\s+/g,""); return rs; } function clickNext() { //console.log('OUTODATI clickNext被執行了!'); len=document.getElementsByClassName('ant-btn').length; if(document.getElementsByClassName('ant-btn')[len-1]) { //console.log(len); document.getElementsByClassName('ant-btn')[len-1].click(); } } function selectLabel() { //console.log('OUTODATI selectLabel被執行了!'); var len; for(var i=0;i<122;i++) { timu=document.getElementsByClassName('exam-content-question')[0].innerText; //exam-single-content-box ant-radio-wrapper ant-radio-wrapper-checked //console.log(stripscript(timu)); //console.log(stripscript(tiMu[i])); if(stripscript(tiMu[i]).search(stripscript(timu)) != -1) { len = document.getElementsByTagName('label').length; //console.log(len); for(var j=0;j<len;j++) { //console.log(len); if(document.getElementsByTagName('label')[j] && daAn[i].search(String(j)) != -1) { document.getElementsByTagName('label')[j].click(); } } break; } } if(i == 122) { alert("未找到答案,點選確定重新答題。"); location.reload(); } } //console.log('OUTODATI inject被執行了!'); var time=1000; for(var i=0;i<20;i++) { setTimeout("clickNext()",time); time=time+1000; setTimeout("selectLabel()",time); time=time+1000; } time=time+500; setTimeout("clickNext()",time); time=time+1000; setTimeout("window.location.href='https://www.2-class.com/'",time);