forked from 1944876825/jxjypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.min.js
9 lines (6 loc) · 1.74 KB
/
main.min.js
1
2
3
4
5
6
7
8
9
// 只需将一下两个脚本添加进浏览器书签即可
// 脚本1
javascript:var zkjxs=$('#questionModule>ul>li .zkjx');console.log(zkjxs.length);zkjxs.each(function(index,zkjx){zkjx.click()});etimeSeconds=6000;
// 脚本2
javascript:var lis=$('#questionModule>ul>li');console.log(lis.length);var myevent=new Event('change',{bubbles:true});if(lis.length>0){for(let index=0;index<lis.length;index++){var li=lis[index];var tx=getTx(li.querySelector('.sub-dotitle i').textContent);if(tx==-1){console.log('err tx');continue}var answers=getAnswer(tx,li.querySelector('.solution').textContent);if(answers.length<=0){console.log('err answer');continue}if(tx==0||tx==1||tx==2){var dds=li.querySelectorAll('.sub-answer dd');if(dds.length>0){var breakxh=false;for(let i=0;i<dds.length;i++){var dd=dds[i];var ddtext=dd.attributes['data-value'].textContent;console.log(ddtext);for(let j=0;j<answers.length;j++){if(ddtext==answers[j]){dd.click();if(tx!=1){breakxh=true}break}}if(breakxh){break}}}else{console.log('err dd tx 0 1')}}if(tx==3){var txa=li.querySelector('.e__textarea');txa.value=answers[0];txa.dispatchEvent(myevent)}}}function getAnswer(tx,answer){var ans=[];if(tx==1||tx==0){var xx=['A','B','C','D'];for(let index=0;index<xx.length;index++){if(answer.indexOf(xx[index])!=-1){ans.push(xx[index]);if(tx==0){break}}}}if(tx==2){if(answer.indexOf('参考答案:错')!=-1){ans=['错误']}if(answer.indexOf('参考答案:对')!=-1){ans=['正确']}}if(tx==3){const regex=/参考答案:(.*?)\n答案解析:/s;const res=answer.match(regex);console.log(res);if(res&&res.length==2){ans=[res[1]]}}return ans}function getTx(str){if(str.indexOf('单选题')!=-1){return 0}if(str.indexOf('多选题')!=-1){return 1}if(str.indexOf('判断题')!=-1){return 2}return 3}
// end