X.com (Twitter) - Auto Show More

X.com (Twitter) Auto Show More Replies(Included Probable Spam), Show Entire Long Tweets/Replies. 推特自动显示所有回复(包括可能的垃圾信息),并且展开完整的长推文和长回复。

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         X.com (Twitter) - Auto Show More
// @namespace    http://tampermonkey.net/
// @version      3.2
// @description  X.com (Twitter) Auto Show More Replies(Included Probable Spam), Show Entire Long Tweets/Replies. 推特自动显示所有回复(包括可能的垃圾信息),并且展开完整的长推文和长回复。
// @author       Martin______X
// @match        https://x.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=x.com
// @grant        none
// @license      MIT
// ==/UserScript==

/* Tweet Thread Replies */
let $button1 = "css-175oi2r r-1777fci r-1pl7oy7 r-13qz1uu r-1loqt21 r-o7ynqc r-6416eg r-1ny4l3l";
/* Tweet Priority Replies*/
let $button2 = "css-175oi2r r-16y2uox r-1cwvpvk r-1noe1sz r-1loqt21 r-o7ynqc r-6416eg r-1ny4l3l";
/* Long Tweet & Reply - More */
let $button3 = "css-146c3p1 r-bcqeeo r-qvutc0 r-37j5jr r-a023e6 r-rjixqe r-16dba41 r-fdjqy7";
/**/
let $gork = "css-175oi2r r-9aw3ui r-1s2bzr4";
let $post = "css-175oi2r r-1iusvr4 r-16y2uox r-1777fci r-kzbkwu";

const simpleClick = (async (button) => {
    button.click();
});
const moreRepliesInterval = setInterval(() => {
    try{
        if(url_check(document.URL)){
            //
            let buttons;
            //
            if (document.URL.includes("status")) {
                buttons = document.getElementsByClassName($button1);
                for (let i = 0; i < buttons.length; i++) {
                    simpleClick(buttons[i]);
                }
                buttons = document.getElementsByClassName($button2);
                for (let i = 0; i < buttons.length; i++) {
                    simpleClick(buttons[i]);
                }
            }
            buttons = document.getElementsByClassName($button3);
            for (let i = 0; i < buttons.length; i++) {
                if(normal_post(buttons[i])){
                    simpleClick(buttons[i]);
                }
            }
        }
    }catch(error){
        //console.error(error)
    }
}, 1);

const url_check = (url) => {
    let ex_urls = ["/settings/", "/notifications", "/messages", "/i/", "/compose/"];
    let in_urls = ["/i/bookmarks"];
    if(included_one_of(url, ex_urls) && !included_one_of(url, in_urls)){
        return false;
    }
    return true;
}

const normal_post = (button) =>{
    let gorks = document.getElementsByClassName($gork);
    let posts = document.getElementsByClassName($post);
    for (let i=0; i<gorks.length; i++){
        if(gorks[i].hasAttribute("aria-labelledby") && gorks[i].contains(button)){
            return false;
        }
    }
    for (let i=0; i<posts.length; i++){
        if(posts[i].contains(button)){
            return true;
        }
    }
}

const included_one_of = (url, array) => {
    let result = false;
    for(let i=0; i<array.length; i++){
        if(url.includes(array[i])){
            result = true;
        }
    }
    return result;
}