// ==UserScript== // @name 3000QQ 抽卡 // @namespace local.3000qq.auto.click // @version 1.3 // @description 自动点击指定按钮,并显示可拖动悬浮状态窗 // @match https://3000.qq.com/ai/#/dashboard* // @match https://3000.qq.com/ai/* // @grant none // ==/UserScript== (function () { 'use strict'; const BUTTON_XPATH = '/html/body/div[1]/div/div[2]/div[2]/div/div[1]/div[1]/div[2]/div/div/div/div/span/div[2]'; const CLICK_INTERVAL_MS = 3000; const HEARTBEAT_MAX = 20; let running = false; let timer = null; let startTimeText = '-'; let lastStatus = '未开始'; let heartbeat = 0; let isDragging = false; let moved = false; let offsetX = 0; let offsetY = 0; function getButtonByXPath() { return document.evaluate( BUTTON_XPATH, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null ).singleNodeValue; } function clickTargetButton() { const btn = getButtonByXPath(); if (!btn) { lastStatus = '未发现按钮'; updatePanel(); return; } btn.click(); heartbeat = heartbeat >= HEARTBEAT_MAX ? 1 : heartbeat + 1; lastStatus = '已点击按钮'; updatePanel(); } function startAutoClick() { if (running) return; running = true; heartbeat = 0; startTimeText = new Date().toLocaleTimeString(); lastStatus = '正在持续生成'; updatePanel(); clickTargetButton(); timer = setInterval(clickTargetButton, CLICK_INTERVAL_MS); } function stopAutoClick() { running = false; if (timer) { clearInterval(timer); timer = null; } lastStatus = '已停止'; updatePanel(); } function toggleAutoClick() { running ? stopAutoClick() : startAutoClick(); } const panel = document.createElement('div'); panel.id = 'auto-generate-panel'; panel.style.cssText = ` position: fixed; right: 20px; bottom: 80px; z-index: 999999; width: 200px; padding: 12px; background: rgba(20, 20, 20, 0.88); color: #fff; font-size: 14px; font-family: Arial, "Microsoft YaHei", sans-serif; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,0.35); cursor: pointer; user-select: none; line-height: 1.6; `; document.body.appendChild(panel); panel.addEventListener('mousedown', function (e) { if (e.button !== 0) return; isDragging = true; moved = false; const rect = panel.getBoundingClientRect(); offsetX = e.clientX - rect.left; offsetY = e.clientY - rect.top; panel.style.right = 'auto'; panel.style.bottom = 'auto'; panel.style.left = rect.left + 'px'; panel.style.top = rect.top + 'px'; e.preventDefault(); }); document.addEventListener('mousemove', function (e) { if (!isDragging) return; const x = e.clientX - offsetX; const y = e.clientY - offsetY; if (Math.abs(x - parseFloat(panel.style.left)) > 3 || Math.abs(y - parseFloat(panel.style.top)) > 3) { moved = true; } panel.style.left = x + 'px'; panel.style.top = y + 'px'; }); document.addEventListener('mouseup', function () { if (!isDragging) return; isDragging = false; if (!moved) { toggleAutoClick(); } }); function updatePanel() { panel.innerHTML = `