您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Counts the number of accounts in your X block list, handling pagination
当前为
// ==UserScript== // @name X Block List Counter // @namespace http://tampermonkey.net/ // @version 1.1 // @description Counts the number of accounts in your X block list, handling pagination // @author adamlproductions // @match https://x.com/settings/blocked/all // @grant none // @license MIT // ==/UserScript== // jshint esversion: 8 (function() { 'use strict'; async function countBlockedAccounts() { let blockedCount = 0; let seenUserIds = new Set(); let lastHeight = document.body.scrollHeight; let noNewContentCount = 0; const counterDiv = document.createElement('div'); counterDiv.style.position = 'fixed'; counterDiv.style.top = '10px'; counterDiv.style.right = '10px'; counterDiv.style.background = '#000000'; counterDiv.style.color = '#FFFFFF'; counterDiv.style.padding = '10px'; counterDiv.style.border = '1px solid #000'; counterDiv.style.zIndex = '1000'; counterDiv.innerText = 'Counting blocked accounts...'; document.body.appendChild(counterDiv); while (noNewContentCount < 3) { const blockedAccounts = document.querySelectorAll('div[data-testid="cellInnerDiv"]'); for (const account of blockedAccounts) { const userLink = account.querySelector('a[href*="/"]'); const userId = userLink ? userLink.getAttribute('href') : null; if (userId && !seenUserIds.has(userId)) { seenUserIds.add(userId); blockedCount++; } } counterDiv.innerText = `Blocked accounts: ${blockedCount}`; window.scrollTo(0, document.body.scrollHeight); await new Promise(resolve => setTimeout(resolve, 1500)); const newHeight = document.body.scrollHeight; if (newHeight === lastHeight) { noNewContentCount++; } else { noNewContentCount = 0; } lastHeight = newHeight; } counterDiv.innerText = `Total blocked accounts: ${blockedCount}`; console.log(`Total blocked accounts: ${blockedCount}`); } window.addEventListener('load', () => { countBlockedAccounts().catch(error => { console.error('Error counting blocked accounts:', error); const errorDiv = document.createElement('div'); errorDiv.style.position = 'fixed'; errorDiv.style.top = '50px'; errorDiv.style.right = '10px'; errorDiv.style.background = '#000000'; errorDiv.style.color = '#FFFFFF'; errorDiv.style.padding = '10px'; errorDiv.style.border = '1px solid #f00'; errorDiv.style.zIndex = '1000'; errorDiv.innerText = 'Error counting blocked accounts. Check console for details.'; document.body.appendChild(errorDiv); }); }); })();