Automatically show more replies on Twitter

6/1/2024, 1:49:37 AM

目前為 2024-06-01 提交的版本,檢視 最新版本

// ==UserScript==
// @name        Automatically show more replies on Twitter
// @namespace   Violentmonkey Scripts
// @match       https://x.com/FatsPostingLs/status/1518605088595525634*
// @grant       none
// @version     1.0
// @author      minnieo
// @description 6/1/2024, 1:49:37 AM
// @license     MIT
// ==/UserScript==


// Function to check and click the button
function clickShowMoreRepliesButton() {
    // Find the button that contains a span with the text 'Show more replies'
    const buttons = document.querySelectorAll('button');
    buttons.forEach(button => {
        const span = button.querySelector('span');
        if (span && span.textContent === 'Show more replies') {
            button.click();
            console.log('Button clicked!');
        }
    });
}

// Set up a MutationObserver to monitor changes in the DOM
const observer = new MutationObserver((mutationsList, observer) => {
    for (let mutation of mutationsList) {
        if (mutation.type === 'childList' || mutation.type === 'subtree') {
            clickShowMoreRepliesButton();
        }
    }
});

// Start observing the entire document for changes
observer.observe(document.body, {
    childList: true,
    subtree: true
});

// Initial check in case the button is already present
clickShowMoreRepliesButton();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址