Skip to content

Instantly share code, notes, and snippets.

@aiya000
Last active April 13, 2025 22:27
Show Gist options
  • Save aiya000/9c5a16c3a96f0b14576923128fe261b4 to your computer and use it in GitHub Desktop.
Save aiya000/9c5a16c3a96f0b14576923128fe261b4 to your computer and use it in GitHub Desktop.
Deprecated. ~~A tampermonky script, to solves the problem of the 'Control Panel for Twitter' extension not being able to hide the number of followers of a Twitter account.~~
// ==UserScript==
// @name Remove Twitter Follower Count
// @namespace https://gist.github.com/aiya000/9c5a16c3a96f0b14576923128fe261b4
// @version 2025-04-09
// @description Remove Twitter(X)'s follower count at profile. This solves the problem of the 'Control Panel for Twitter' extension not being able to hide the number of followers of a Twitter account.
// @author aiya000
// @match https://x.com/*
// @match https://twitter.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
;(function () {
'use strict'
// Monitor dynamically generated elements
new MutationObserver(() => {
document.querySelectorAll('a').forEach((link) => {
const combinedText = Array.from(link.querySelectorAll('span'))
.map((span) => span.textContent.trim())
.join('')
// NOTE: Below outputs like '4,1384,138フォロワーフォロワー', but '4,138フォロワー' is not shown. What?
// console.log('poi:', combinedText)
// NOTE: Below didn't work
// const pattern = /^\d{1,3}(,\d{3})*フォロワー$/
const pattern = /\d{1,3}(,\d{3})*フォロワー/ // Currently, Japanese support only
if (pattern.test(combinedText)) {
link.style.display = 'none'
}
})
}).observe(document.body, { childList: true, subtree: true })
})()
@aiya000
Copy link
Author

aiya000 commented Apr 9, 2025

You should also install Control Panel for Twitter to clean noizes.

@aiya000
Copy link
Author

aiya000 commented Apr 13, 2025

Use this.

やあ!これらのメトリックやその他のメトリックは次のように非表示にできます

TwitterのDOMはReact Native for Webを使用しているため非常に奇​​妙です pic.twitter.com/GOhryxQJb9

— Control Panel for  (@ControlPanelFT) April 10, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment