// ==UserScript== // @name Block Tweet Responders // @namespace http://tampermonkey.net/ // @version 1.0 // @description Blocks all users who replied to a tweet starting from the 5th reply // @author me // @match https://x.com/* // @grant none // ==/UserScript== (function() { 'use strict'; // Function to add a delay between actions function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } // Function to block tweet responders async function blockTweetResponders() { // Find all tweet elements const tweets = document.querySelectorAll('[data-testid="tweet"]'); // Start from the 5th tweet (index 4) for (let i = 4; i < tweets.length; i++) { const tweet = tweets[i]; try { // Find and click the "More" button const moreButton = tweet.querySelector('[data-testid="caret"]'); if (moreButton) { moreButton.click(); await sleep(500); // Wait for the menu to appear // Find and click the "Block" option const blockButton = Array.from(document.querySelectorAll('span')) .find(span => span.textContent && span.textContent.includes('Block @')); if (blockButton) { blockButton.click(); await sleep(500); // Wait for the confirmation dialog // Confirm the block if there's a confirmation button const confirmButton = Array.from(document.querySelectorAll('span')) .find(span => span.textContent && span.textContent.includes('Block')); if (confirmButton) { confirmButton.click(); await sleep(1000); // Wait for the block to complete } } } } catch (error) { console.error('Error blocking tweet:', error); } } } // Create a button to trigger the blocking const blockButton = document.createElement('button'); blockButton.textContent = 'Block Tweet Responders'; blockButton.style.position = 'fixed'; blockButton.style.top = '10px'; blockButton.style.right = '10px'; blockButton.style.zIndex = '9999'; blockButton.style.padding = '10px'; blockButton.style.backgroundColor = '#1DA1F2'; blockButton.style.color = 'white'; blockButton.style.border = 'none'; blockButton.style.borderRadius = '5px'; blockButton.style.cursor = 'pointer'; blockButton.style.fontWeight = 'bold'; blockButton.addEventListener('click', blockTweetResponders); document.body.appendChild(blockButton); })();