您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Filter catalog threads using regex patterns
当前为
// ==UserScript== // @name 8chan Catalog Filter // @version 1.0 // @description Filter catalog threads using regex patterns // @match *://8chan.moe/*/catalog.* // @grant none // @license MIT // @namespace https://greasyfork.org/users/1459581 // ==/UserScript== (function() { 'use strict'; const config = { filters: [ { pattern: /Arknights|AKG/i, // Example regex pattern action: 'setTop' // 'setTop' or 'remove' }, // Add more filters as needed // { // pattern: /banner submissions/i, // action: 'remove' // } ] }; function processCatalog() { const catalogDiv = document.getElementById('divThreads'); if (!catalogDiv) return; const cells = Array.from(catalogDiv.querySelectorAll('.catalogCell')); const matchedCells = []; cells.forEach(cell => { const subject = cell.querySelector('.labelSubject')?.textContent || ''; const message = cell.querySelector('.divMessage')?.textContent || ''; const text = `${subject} ${message}`; config.filters.forEach(filter => { if (filter.pattern.test(text)) { if (filter.action === 'remove') { cell.style.display = 'none'; } else if (filter.action === 'setTop') { matchedCells.push(cell); cell.style.order = -1; } } }); }); // Bring matched cells to top matchedCells.reverse().forEach(cell => { catalogDiv.insertBefore(cell, catalogDiv.firstChild); }); } // Run on initial load processCatalog(); // Optional: Add mutation observer to handle dynamic updates const observer = new MutationObserver(processCatalog); observer.observe(document.body, { childList: true, subtree: true }); })();