Skip to content

Commit

Permalink
优化滑块速度,修复每日答题不自动关闭的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
poll committed Jan 13, 2023
1 parent 7519699 commit 4272cbb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions 不学习何以强国.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ function closeWin() {

}

async function sleep( timeMS ) {
return new Promise( res => setTimeout( res, time ) );
}

/** 模拟鼠标移动 改方法来自https://blog.csdn.net/Wuzihui___/article/details/79952068
* @param id
* @param clientX 相对窗口横坐标
Expand All @@ -105,7 +109,7 @@ function dragandDrop(btn_hk, clientX, clientY, distance) {
k = 0,
interval;
iME(elem,"mousedown",0, 0, clientX, clientY);
let waitTime = Math.floor(Math.random() * (0.5 * 1000 - 0.1 * 1000) + 0.1 * 1000)
let waitTime = Math.floor(Math.random() * (0.005 * 1000 - 0.09 * 1000) + 0.09 * 1000)
interval = setInterval(function() {
k++;
iter(k);
Expand Down Expand Up @@ -881,7 +885,6 @@ async function doingExam() {
}
}
if (!hasButton) {
//没找到按钮,随便选一个
allbuttons[0].click();
}
break;
Expand Down Expand Up @@ -910,7 +913,11 @@ async function doingExam() {
}
} else {
//没答案,随便选一个
allbuttons[0].click();
try {
allbuttons[0].click();
} catch(e) {
console.log(e);
}
}
break;
}
Expand Down

0 comments on commit 4272cbb

Please sign in to comment.