// ==UserScript== // @name 异常清理器 // @namespace http://tampermonkey.net/ // @version 3.0 // @description 自动删除包含"验号异常"图标的整个列表项 // @match https://70games.net/search-* // @grant none // @run-at document-end // ==/UserScript== (function() { 'use strict'; // 目标选择器 - 验号异常图标 const WARNING_ICON_SELECTOR = 'i.icon-exclamation-circle[title="验号异常"]'; // 删除包含异常图标的整个列表项 const removeProblemItems = () => { // 查找所有验号异常图标 const warningIcons = document.querySelectorAll(WARNING_ICON_SELECTOR); warningIcons.forEach(icon => { // 向上查找包含整个列表项的
  • 元素 const listItem = icon.closest('li.mdui-ripple.media.thread.threadItem'); if (listItem) { // 删除整个列表项 listItem.remove(); console.log('已移除异常账号列表项'); } }); }; // 初始执行(页面加载后立即执行) if (document.readyState === 'complete') { removeProblemItems(); } else { window.addEventListener('load', removeProblemItems); } // 监听DOM变化(处理动态加载内容) const observer = new MutationObserver((mutations) => { let hasNewItems = false; mutations.forEach(mutation => { if (mutation.addedNodes.length > 0) { hasNewItems = true; } }); if (hasNewItems) { removeProblemItems(); } }); observer.observe(document.body, { childList: true, subtree: true }); // 增强AJAX加载内容处理 (function() { const originalOpen = XMLHttpRequest.prototype.open; const originalFetch = window.fetch; // 拦截XHR请求 XMLHttpRequest.prototype.open = function() { this.addEventListener('load', function() { if (this.readyState === 4 && this.status === 200) { setTimeout(removeProblemItems, 300); } }); originalOpen.apply(this, arguments); }; // 拦截Fetch请求 window.fetch = function() { return originalFetch.apply(this, arguments) .then(response => { if (response.ok) { response.clone().text().then(() => { setTimeout(removeProblemItems, 300); }); } return response; }); }; })(); // 添加CSS规则作为备用方案 const style = document.createElement('style'); style.textContent = ` li.mdui-ripple.media.thread.threadItem:has(i.icon-exclamation-circle[title="验号异常"]) { display: none !important; height: 0 !important; padding: 0 !important; margin: 0 !important; overflow: hidden !important; border: none !important; } `; document.head.appendChild(style); })();