Skip to content
This repository has been archived by the owner on Jan 24, 2021. It is now read-only.

Remove "More Tweets" widget on single tweet page #196

Closed
ahmetb opened this issue Mar 10, 2020 · 5 comments
Closed

Remove "More Tweets" widget on single tweet page #196

ahmetb opened this issue Mar 10, 2020 · 5 comments

Comments

@ahmetb
Copy link

ahmetb commented Mar 10, 2020

Twitter just added a very confusing More Tweets section to individual tweet pages, showing "similar" tweets. Totally useless. Let's refine.

e.g. screenshot from https://twitter.com/stroughtonsmith/status/1237037972526071808
image

@sindresorhus
Copy link
Owner

Agreed. PR welcome :)

@ahmetb
Copy link
Author

ahmetb commented Mar 11, 2020

I definitely lack the JS skills to do that.

@FoxxMD
Copy link

FoxxMD commented May 7, 2020

Yo this would be amazing

@imkaihao
Copy link

Find a userscript from Reddit that works.

// ==UserScript==
// @name    RIP "More Tweets"
// @version 1.0.0
// @grant   none
// @run-at 	document-start
// @match   *://*.twitter.com/*/status/*
// ==/UserScript==


//https://stackoverflow.com/a/12222317
var cssPath = function(el) {
    if (!(el instanceof Element))
        return;
    var path = [];
    while (el.nodeType === Node.ELEMENT_NODE) {
        var selector = el.nodeName.toLowerCase();
        if (el.id) {
            selector += '#' + el.id;
            path.unshift(selector);
            break;
        } else {
            var sib = el,
                nth = 1;
            while (sib = sib.previousElementSibling) {
                if (sib.nodeName.toLowerCase() == selector)
                    nth++;
            }
            if (nth != 1) {
              	// Build "n+X" directly here
                if (path.length === 0) {
                    selector += ":nth-of-type(n+" + nth + ")";
                } else {
                    selector += ":nth-of-type(" + nth + ")";
                }
            }
            path.unshift(selector);
            el = el.parentNode;
        }
        return path.join(" > ");
    }
}


function rmMo() {
    var moTweets = [...document.querySelectorAll('span')].find(el => el.innerHTML === "More Tweets");
    if (moTweets) {
        var moContainer = moTweets.parentNode.parentNode.parentNode.parentNode.parentNode;
        pt = cssPath(moContainer);
        var sheet = window.document.styleSheets[0];
        sheet.insertRule(`${pt} { display: none; }`, sheet.cssRules.length);
        window.clearInterval(intval);
    }
}
intval = window.setInterval(rmMo, 200);

Source: https://www.reddit.com/r/uBlockOrigin/comments/faqqxx/remove_more_tweets_from_a_tweet_opened_in_a_new/flrhjh2/

@sindresorhus
Copy link
Owner

Closing as this extension is now deprecated: 8dd9df7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants