您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Automate daily sign-in with a click of a button and check for the second button regularly
当前为
// ==UserScript== // @name IMYAI网站点击按钮快速每日签到Daily Sign-in Automation in IMYAI // @namespace http://tampermonkey.net/ // @version 0.1 // @description Automate daily sign-in with a click of a button and check for the second button regularly // @author GPT4.0 // @match https://ai.imyai.top/* // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to simulate a mouse click function simulateClick(element) { const mouseClickEvents = ['mousedown', 'click', 'mouseup']; mouseClickEvents.forEach(mouseEventType => element.dispatchEvent( new MouseEvent(mouseEventType, { view: window, bubbles: true, cancelable: true, buttons: 1 }) ) ); } // Function to add the new button to the page function addButton() { const newButton = document.createElement('button'); newButton.innerText = '点这里快速每日签到'; newButton.style.position = 'fixed'; newButton.style.top = '10px'; newButton.style.left = '10px'; newButton.style.zIndex = '10000'; newButton.onclick = function() { // Query for the first sign-in button const firstSignInButton = document.querySelector('svg.iconify--noto'); if (firstSignInButton) { simulateClick(firstSignInButton); } // Check for the second button every half second const checkExist = setInterval(function() { const secondSignInButton = document.querySelector('div.flex.mt-3.w-full.mt-14 > button.n-button--info-type'); if (secondSignInButton) { simulateClick(secondSignInButton); clearInterval(checkExist); // Stop checking once the button has been clicked } }, 500); // Check every 500ms }; document.body.appendChild(newButton); } // Add the button after the DOM is fully loaded if (document.readyState === 'complete') { addButton(); } else { window.addEventListener('load', addButton); } })();