| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- // ==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 firstGroupSelectors = [
- '#\\:ro\\: > span.transition-opacity.font-medium',
- '#\\:rp\\: > span.transition-opacity.font-medium',
- '#\\:rq\\: > span.transition-opacity.font-medium',
- '#\\:rr\\: > span.transition-opacity.font-medium',
- '#\\:rs\\: > span.transition-opacity.font-medium',
- '#\\:r8\\: > span.transition-opacity.font-medium',
- '#\\:rh\\: > span.transition-opacity.font-medium',
- '#\\:rg\\: > span.transition-opacity.font-medium',
- '#\\:r7\\: > span.transition-opacity.font-medium',
- '#\\:r6\\: > span.transition-opacity.font-medium',
- '#\\:r10\\: > span.transition-opacity.font-medium',
- '#\\:ri\\: > span.transition-opacity.font-medium'
- ];
- const secondGroupSelectors = [
- '#\\: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'
- ];
- 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 button1 = document.createElement('button');
- button1.textContent = '验证';
- button1.style.position = 'fixed';
- button1.style.top = '20px';
- button1.style.left = '40%';
- button1.style.padding = '10px 20px';
- button1.style.backgroundColor = '#007bff';
- button1.style.color = '#fff';
- button1.style.border = 'none';
- button1.style.borderRadius = '5px';
- button1.style.cursor = 'pointer';
- button1.style.zIndex = '10000';
- button1.addEventListener('click', () => {
- clickButtonGroup(firstGroupSelectors, 100, false, () => {
- setTimeout(() => {
- location.reload();
- }, 1000);
- });
- });
- const button2 = document.createElement('button');
- button2.textContent = '执行';
- button2.style.position = 'fixed';
- button2.style.top = '20px';
- button2.style.left = '60%';
- button2.style.padding = '10px 20px';
- button2.style.backgroundColor = '#007bff';
- button2.style.color = '#fff';
- button2.style.border = 'none';
- button2.style.borderRadius = '5px';
- button2.style.cursor = 'pointer';
- button2.style.zIndex = '10000';
- button2.addEventListener('click', () => {
- clickButtonGroup(secondGroupSelectors, 500, true, () => {
- setTimeout(() => {
- location.reload();
- }, 1000);
- });
- });
- document.body.appendChild(button1);
- document.body.appendChild(button2);
- }
- window.addEventListener('load', createCustomButtons);
- setInterval(() => {
- if (newWindow && !newWindow.closed) {
- newWindow.close();
- }
- }, 1000);
- })();
|