// ==UserScript== // @name Bangumi排行榜隐藏已收藏条目 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 排行榜隐藏已收藏条目 // @author KunimiSaya // @match https://bgm.tv/*/browser* // @match https://bangumi.tv/*/browser* // @match https://chii.in/*/browser* // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Function to hide collected items function hideCollectedItems() { // Select all items let items = document.querySelectorAll('.item'); items.forEach(function(item) { // Check if the item is collected by looking for the "collectModify" element if (item.querySelector('.collectModify')) { // Hide the item item.style.display = 'none'; } }); } // Initial hiding of collected items hideCollectedItems(); // Observe the page for any new nodes being added let observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length) { hideCollectedItems(); } }); }); // Start observing the body for changes observer.observe(document.body, { childList: true, // Detect when new elements are added or removed subtree: true // Observe all nodes, not just the direct children of the body }); })();