采石场放置自动点击完美按钮
采石场放置屏蔽了F12打开控制台,可以通过鼠标右键-检查打开控制台。
代码:
function imitateClick(oElement, iClientX, iClientY) {
var oEvent;
if (document.createEventObject) {
oEvent = document.createEventObject();
oEvent.clientX = iClientX;
oEvent.clientY = iClientY;
oElement.fireEvent("onclick", oEvent)
} else {
oEvent = document.createEvent("MouseEvents");
oEvent.initMouseEvent("click", true, true, document.defaultView, 0, 0, 0, iClientX, iClientY);
oElement.dispatchEvent(oEvent)
}
};
function pxToInteger(str) {
return Math.round(Number(str.slice(0,-2)).toFixed(0));
};
self.autoClickButton = setInterval(() => {
const btn = document.querySelector("#button");
if (btn) {
imitateClick(btn, pxToInteger(btn.style.left) + 50, pxToInteger(btn.style.top) + 50);
}
}, 10);