您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
This is a "like" automator (first N posts only).
当前为
// ==UserScript== // @name Like Automator // @namespace http://tampermonkey.net/ // @version 1.3 // @description This is a "like" automator (first N posts only). // @author biganthonymo // @match https://x.com/* // @match https://mobile.x.com/* // @match https://twitter.com/* // @match https://mobile.twitter.com/* // @icon data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTIyLjg4IDExNC40MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIyLjg4IDExNC40MiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj48IVtDREFUQVsKCS5zdDB7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojRUU0ODU2O30KCS5zdDF7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojRkZGRkZGO30KXV0+PC9zdHlsZT48Zz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNOS4zMiwwaDEwNC4yNGM1LjEzLDAsOS4zMiw0LjIsOS4zMiw5LjMydjczLjYyYzAsNS4xMS00LjIxLDkuMzItOS4zMiw5LjMySDgzLjg0bC0xNi4xNywxOS4wNiBjLTMuNTgsNC4yMy05LjQ1LDQuMDQtMTIuODEsMEwzOS4wNCw5Mi4yNkg5LjMyQzQuMjEsOTIuMjYsMCw4OC4wNywwLDgyLjk0VjkuMzJDMCw0LjE5LDQuMTksMCw5LjMyLDBMOS4zMiwweiIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik02MS4yLDMwLjQyYzMuNTMtMy42OCw2LTYuMTcsMTEuNDMtNi43OWMxMC4yLTEuMTcsMjAuMjcsOS4yNywxNS4xMiwxOS41NmMtMS45LDMuNzktOC40OSwxMC4xNi0xMy43NiwxNS4xNSBjLTIuMDEsMS45LTMuODMsMy42MS01LjEyLDQuODlsLTcuNjYsNy42bC02LjMzLTYuMDljLTEuOTEtMS44My00LjE2LTMuNzktNi40Ni01Ljg3QzQxLjUsNTIuNjQsMzQuMDUsNDUuMywzMy43NCwzNi43MyBjLTAuMjktOC4wMSw2LjcyLTEzLjE1LDE0LTEzLjA2QzU0LjIsMjMuNzYsNTYuOTIsMjYuMjUsNjEuMiwzMC40Mkw2MS4yLDMwLjQyeiIvPjwvZz48L3N2Zz4= // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Create the floating button const floatButton = document.createElement('button'); floatButton.innerText = 'Like Automator'; Object.assign(floatButton.style, { position: 'fixed', bottom: '20px', right: '20px', zIndex: '9999', padding: '10px', backgroundColor: '#007bff', color: '#fff', border: 'none', borderRadius: '5px', cursor: 'pointer' }); document.body.appendChild(floatButton); // Function to get a random delay between 300ms and 1000ms function getRandomDelay() { return Math.floor(Math.random() * (1000 - 300 + 1)) + 300; } // Add click event listener floatButton.addEventListener('click', function() { // Scroll down to the location of the button (+10 pixels) const buttonPosition = floatButton.getBoundingClientRect().top + window.pageYOffset; window.scrollTo({ top: buttonPosition + 10, behavior: 'smooth' }); const buttons = document.querySelectorAll('[data-testid="like"]'); let totalDelay = 0; let clickedCount = 0; for (let i = 1; i < 50 && i < buttons.length; i++) { let delay = getRandomDelay(); totalDelay += delay; setTimeout(function() { buttons[i].click(); clickedCount++; }, totalDelay); } // Output a div at the bottom showing how many were clicked setTimeout(function() { // Create the div element const messageDiv = document.createElement('div'); messageDiv.textContent = `${clickedCount} buttons were clicked`; messageDiv.style.position = 'fixed'; messageDiv.style.bottom = '10px'; messageDiv.style.left = '50%'; messageDiv.style.transform = 'translateX(-50%)'; messageDiv.style.backgroundColor = 'rgba(0, 0, 0, 0.8)'; messageDiv.style.color = '#fff'; messageDiv.style.padding = '10px 20px'; messageDiv.style.borderRadius = '5px'; messageDiv.style.fontSize = '16px'; messageDiv.style.zIndex = '1000'; // Append the div to the body document.body.appendChild(messageDiv); // Remove the div after 3 seconds setTimeout(function() { messageDiv.remove(); }, 3000); }, totalDelay + 500); }); })();