|
@@ -0,0 +1,118 @@
|
|
|
|
|
+// ==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);
|
|
|
|
|
+})();
|