// ==UserScript== // @name sosovalue 半自动点击 // @namespace http://tampermonkey.net/ // @version 1.6 // @description 检测并点击页面中的 5 组按钮,并关闭新弹出的页面 // @author Jack // @match https://sosovalue.com/*/* // @grant none // ==/UserScript== (function() { 'use strict'; const GroupSelectors = [ '#\\:rf\\: > span.transition-opacity.font-medium', '#\\:rh\\: > span.transition-opacity.font-medium', '#\\:ri\\: > span.transition-opacity.font-medium', '#\\:rj\\: > span.transition-opacity.font-medium', '#\\:rk\\: > span.transition-opacity.font-medium', '#\\:rg\\: > span.transition-opacity.font-medium', ]; let newWindow = null; const originalOpen = window.open; window.open = function(url, name, features) { newWindow = originalOpen(url, name, features); return newWindow; }; function clickButtonGroup(group, delay, closeWindow = false, callback) { let completed = 0; group.forEach((selector, index) => { setTimeout(() => { const button = document.querySelector(selector); if (button) { button.click(); if (closeWindow && newWindow) { newWindow.close(); } } completed++; if (completed === group.length && callback) { callback(); } }, index * delay); }); } function createCustomButtons() { const button = document.createElement('button'); button.textContent = '执行'; button.style.position = "fixed"; button.style.top = "8%"; button.style.right = "1%"; button.style.transform = "translateY(-50%)"; button.style.padding = "3px 8px"; button.style.fontSize = "10px"; button.style.backgroundColor = "#007baf"; button.style.color = "#fff"; button.style.border = "none"; button.style.borderRadius = "5px"; button.style.cursor = "pointer"; button.style.zIndex = "10000"; button.addEventListener('click', () => { clickButtonGroup(GroupSelectors, 1000, true, () => { // 所有按钮点击完成后,等待1秒刷新页面 setTimeout(() => { location.reload(); }, 1000); }); }); document.body.appendChild(button); } window.addEventListener('load', createCustomButtons); setInterval(() => { if (newWindow && !newWindow.closed) { newWindow.close(); } }, 1000); })();