-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtwitter-show-all-replies.js
41 lines (38 loc) · 1.12 KB
/
twitter-show-all-replies.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ==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);
})();