Greasy Fork

Greasy Fork is available in English.

圈吧屏蔽挖坟帖

Hides posts on Baidu Tieba Oricon if the last reply time is a date (e.g., 6-15) instead of a time (e.g., 12:30).

当前为 2025-07-18 提交的版本,查看 最新版本

// ==UserScript==
// @name         圈吧屏蔽挖坟帖
// @namespace    http://tampermonkey.net/
// @version      2025-07-18
// @description  Hides posts on Baidu Tieba Oricon if the last reply time is a date (e.g., 6-15) instead of a time (e.g., 12:30).
// @author       Gemini-x3c
// @match        https://tieba.baidu.com/f?kw=oricon*
// @grant        none
// @icon         https://www.google.com/s2/favicons?sz=64&domain=baidu.com
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    function hidePosts() {
        // Select all thread containers. The class name may vary, so we use a selector that is more likely to work.
        // After inspection, 'j_thread_list' seems to be the right class for the li elements.
        var threads = document.querySelectorAll('li.j_thread_list');

        threads.forEach(function(thread) {
            // Find the last reply time element within each thread.
            // The class name 'threadlist_reply_date' is a good candidate.
            var replyTimeElement = thread.querySelector('.threadlist_reply_date');

            if (replyTimeElement) {
                var replyTimeText = replyTimeElement.textContent.trim();

                // Use a regular expression to check if the text is in the "MM-DD" format.
                // This regex matches one or two digits, a hyphen, and then one or two digits.
                var datePattern = /^\d{1,2}-\d{1,2}$/;

                if (datePattern.test(replyTimeText)) {
                    // If the reply time is a date, hide the entire thread.
                    thread.style.display = 'none';
                }
            }
        });
    }

    // Run the function to hide posts when the page loads.
    hidePosts();

    // Tieba pages often load more content dynamically, so we need to handle that.
    // We can use a MutationObserver to watch for changes in the DOM and rerun our function.
    var observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length) {
                hidePosts();
            }
        });
    });

    // Start observing the main content area for changes.
    var targetNode = document.getElementById('thread_list');
    if (targetNode) {
        observer.observe(targetNode, { childList: true });
    }
})();