Auto clicker with UI and custom keybinds
当前为
// ==UserScript==
// @name bloxd.io Click booster
// @namespace https://bloxd.io
// @version 1.0.2
// @description Auto clicker with UI and custom keybinds
// @author MakeItOrBreakIt
// @match https://staging.bloxd.io/*
// @grant none
// @license MIT
// ==/UserScript==
(async function () {
let config = JSON.parse(localStorage.getItem('bloxdConfig')) || {
leftClickKey: 'KeyR',
rightClickKey: 'KeyF'
};
let minCPS = 10, maxCPS = 15;
let autoLeftClickEnabled = false;
let autoRightClickEnabled = false;
let autoLeftClickInterval, autoRightClickInterval;
const TARGET_SELECTOR = "#noa-canvas";
document.addEventListener("keydown", function (event) {
if (event.repeat || event.target.tagName === 'INPUT' || event.target.tagName === 'TEXTAREA' || event.target.isContentEditable) return;
if (event.code === config.leftClickKey) toggleAutoLeftClick();
if (event.code === config.rightClickKey) toggleAutoRightClick();
});
function randomInterval() {
return 1000 / (Math.random() * (maxCPS - minCPS) + minCPS);
}
function toggleAutoLeftClick() {
if (autoRightClickEnabled) stopRightClicker();
autoLeftClickEnabled ? stopLeftClicker() : startLeftClicker();
}
function startLeftClicker() {
autoLeftClickEnabled = true;
autoLeftClickInterval = setInterval(() => simulateClick(0), randomInterval());
}
function stopLeftClicker() {
clearInterval(autoLeftClickInterval);
autoLeftClickEnabled = false;
}
function toggleAutoRightClick() {
if (autoLeftClickEnabled) stopLeftClicker();
autoRightClickEnabled ? stopRightClicker() : startRightClicker();
}
function startRightClicker() {
autoRightClickEnabled = true;
autoRightClickInterval = setInterval(() => simulateClick(2), randomInterval());
}
function stopRightClicker() {
clearInterval(autoRightClickInterval);
autoRightClickEnabled = false;
}
function simulateClick(button) {
let el = document.querySelector(TARGET_SELECTOR);
if (!el) return;
el.dispatchEvent(new MouseEvent("mousedown", { button, bubbles: true }));
el.dispatchEvent(new MouseEvent("mouseup", { button, bubbles: true }));
if (button === 0) el.dispatchEvent(new MouseEvent("click", { button, bubbles: true }));
if (button === 2) el.dispatchEvent(new MouseEvent("contextmenu", { button, bubbles: true }));
}
function saveConfig() {
localStorage.setItem('bloxdConfig', JSON.stringify(config));
}
function clearCookies() {
document.cookie.split(";").forEach(c => {
document.cookie = c.split("=")[0] + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
});
setTimeout(() => location.reload(), 1000);
}
function createUI() {
let ui = document.createElement("div");
ui.innerHTML = `
<div style="position: fixed; top: 10px; right: 10px; background: rgba(0,0,0,0.8); color: white; padding: 10px; border-radius: 8px; z-index: 9999; font-size: 14px;">
<button id="leftClickToggle">Left Click</button>
<button id="rightClickToggle">Right Click</button>
<button id="clearCookies">Gen Account</button>
<br><br>
<label>Min CPS: <input type="number" id="minCPS" value="${minCPS}" min="1" max="50"></label>
<label>Max CPS: <input type="number" id="maxCPS" value="${maxCPS}" min="1" max="50"></label>
<br><br>
<label>Left Key: <input id="keyLeft" type="text" value="${config.leftClickKey}" size="10"></label>
<label>Right Key: <input id="keyRight" type="text" value="${config.rightClickKey}" size="10"></label>
<button id="saveKeys">Save Keys</button>
</div>
`;
document.body.appendChild(ui);
document.getElementById("leftClickToggle").onclick = toggleAutoLeftClick;
document.getElementById("rightClickToggle").onclick = toggleAutoRightClick;
document.getElementById("clearCookies").onclick = clearCookies;
document.getElementById("minCPS").onchange = e => minCPS = parseInt(e.target.value);
document.getElementById("maxCPS").onchange = e => maxCPS = parseInt(e.target.value);
document.getElementById("saveKeys").onclick = () => {
config.leftClickKey = document.getElementById("keyLeft").value;
config.rightClickKey = document.getElementById("keyRight").value;
saveConfig();
alert("keybinds saved!");
};
}
if (!/Mobi|Android/i.test(navigator.userAgent)) {
createUI();
}
})();