Twitter Show All Replies

Automatically click 'show more replies'

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Twitter Show All Replies
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Automatically click 'show more replies'
// @author       cro
// @match        https://*.twitter.com/*
// @match        https://*.x.com/*
// @icon         https://www.google.com/s2/favicons?domain=twitter.com
// @grant        none
// @license      MIT
// ==/UserScript==
/* jshint esversion: 6 */

(function() {
    'use strict';
    let path_match = new RegExp('^/.+/status/\\d+$');

    let click_show_more = function()
    {
        if (!window.location.pathname.match(path_match))
        {
            return;
        }
        let nodes = document.querySelector('main[role="main"] section')?.lastChild?.firstChild?.children;
        if (!nodes)
        {
            return;
        }
        for (let node of nodes)
        {
            if (node.querySelector('[data-testid="tweet"]'))
            {
                continue;
            }
            node.querySelector('[role="button"]')?.click()
        }
    };

    setInterval(click_show_more, 500);
})();