Greasy Fork is available in English.
6/1/2024, 1:49:37 AM
当前为
// ==UserScript==
// @name Automatically show more replies on Twitter
// @namespace Violentmonkey Scripts
// @match https://x.com/*
// @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();