Skip to content

Commit 8d4141a

Browse files
authored
Merge pull request #72 from thriller-ab/main
优化滑块速度,修复每日答题不自动关闭的问题
2 parents 7519699 + 4272cbb commit 8d4141a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

不学习何以强国.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ function closeWin() {
9494

9595
}
9696

97+
async function sleep( timeMS ) {
98+
return new Promise( res => setTimeout( res, time ) );
99+
}
100+
97101
/** 模拟鼠标移动 改方法来自https://blog.csdn.net/Wuzihui___/article/details/79952068
98102
* @param id
99103
* @param clientX 相对窗口横坐标
@@ -105,7 +109,7 @@ function dragandDrop(btn_hk, clientX, clientY, distance) {
105109
k = 0,
106110
interval;
107111
iME(elem,"mousedown",0, 0, clientX, clientY);
108-
let waitTime = Math.floor(Math.random() * (0.5 * 1000 - 0.1 * 1000) + 0.1 * 1000)
112+
let waitTime = Math.floor(Math.random() * (0.005 * 1000 - 0.09 * 1000) + 0.09 * 1000)
109113
interval = setInterval(function() {
110114
k++;
111115
iter(k);
@@ -881,7 +885,6 @@ async function doingExam() {
881885
}
882886
}
883887
if (!hasButton) {
884-
//没找到按钮,随便选一个
885888
allbuttons[0].click();
886889
}
887890
break;
@@ -910,7 +913,11 @@ async function doingExam() {
910913
}
911914
} else {
912915
//没答案,随便选一个
913-
allbuttons[0].click();
916+
try {
917+
allbuttons[0].click();
918+
} catch(e) {
919+
console.log(e);
920+
}
914921
}
915922
break;
916923
}

0 commit comments

Comments
 (0)