Hide Reposts on Twitter

Hides reposts (retweets) when scrolling

Stan na 26-02-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name		Hide Reposts on Twitter
// @description	Hides reposts (retweets) when scrolling
// @namespace	Hide_Reposts_on_Twitter
// @compatible	Chrome
// @compatible	Firefox
// @version		1.1
// @author		Owyn
// @match		https://twitter.com/*
// @grant		GM_registerMenuCommand
// @noframes
// @run-at		document-end
// @sandbox		JavaScript
// @license		MIT
// ==/UserScript==
'use strict';

const tweetCSS = '[data-testid="cellInnerDiv"]';
const repostCSS = '[data-testid="socialContext"]';
const alreadyHiddenCSS = '[style*="display: none;"]';

function hideReposts()
{
	var n = document.querySelectorAll(tweetCSS+':has('+repostCSS+'):not('+alreadyHiddenCSS+')');
	for (let i = 0; i < n.length; i++)
	{
		n[i].style.display = "none";
		console.debug("hid a repost");
	}
	setTimeout(hideReposts, 500);
}

window.addEventListener("scroll", hideReposts);

if (typeof GM_registerMenuCommand !== "undefined")
{
	GM_registerMenuCommand("Disable (this once for this page)", () => window.removeEventListener("scroll", hideReposts), "h");
}