Hide tweets from blue check accounts (status only)

Hide tweets from blue check accounts on twitter.com and x.com for status pages only

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Hide tweets from blue check accounts (status only)
// @match       https://twitter.com/*/status/*
// @match       https://x.com/*/status/*
// @version     1.1
// @description Hide tweets from blue check accounts on twitter.com and x.com for status pages only
// @namespace   Violentmonkey Scripts
// @license MIT
// @author LucioB16
// ==/UserScript==

// Use setInterval to repeatedly run the function every 500 milliseconds.
// This ensures the script catches newly loaded tweets as you scroll or interact with the page.
setInterval(function hideBlueCheckTweets() {

  // Select all elements with the specified data-testid attribute ('cellInnerDiv').
  // This includes both tweet blocks and structural elements dividing tweets on the page.
  const tweets = document.querySelectorAll('div[data-testid="cellInnerDiv"]');

  // Loop through each element, accessing its index in the list.
  tweets.forEach((tweet, index) => {

    // Ignore the first tweet (index 0), which is typically the main tweet of the thread.
    // Also, ignore elements in odd positions (these may be dividers or other non-tweet elements).
    if (index !== 0 && index % 2 === 0) {

      // Search within the current element for the blue check verification icon.
      // The blue check icon is identified by the 'data-testid="icon-verified"' attribute.
      const blueCheckIcon = tweet.querySelector('svg[data-testid="icon-verified"]');

      // If the element contains a blue check icon, hide the entire element by setting its display to 'none'.
      if (blueCheckIcon) {
        tweet.style.display = "none";
      }
    }
  });
}, 500);