Skip to content

Instantly share code, notes, and snippets.

@shinmai
Last active January 11, 2024 08:40
Show Gist options
  • Save shinmai/88c6af7f2219c8f81ec6517438dc0dcb to your computer and use it in GitHub Desktop.
Save shinmai/88c6af7f2219c8f81ec6517438dc0dcb to your computer and use it in GitHub Desktop.
Remove Twitter Blue adverts from anywhere I come across them on Twitter :)
// ==UserScript==
// @name Blue Twitter? I hardly know her!
// @namespace rip.aapo.userscripts
// @version 0.0.8
// @description Let Elon figure out another way to make $8
// @author @shinmai - https://shinmai.wtf
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @updateURL https://gist.github.com/shinmai/88c6af7f2219c8f81ec6517438dc0dcb/raw/moreliketwitterblewamirite.user.js
// @downloadURL https://gist.github.com/shinmai/88c6af7f2219c8f81ec6517438dc0dcb/raw/moreliketwitterblewamirite.user.js
// @grant none
// ==/UserScript==
/**
* Changelog:
* 0.0.1 (221223) - initial version
* 0.0.2 (230422) - hide Blue for Orgs, too
* 0.0.3 (230607) - the desperate losers keep adding more links to buy blue
* 0.0.3b (230607) - missed one and forgot to bump version-number, oops
* 0.0.4 (230617) - hide the "Get Verified" box on the sidebar (doesn't work on Firefox unless user enables the layout.css.has-selector.enabled config flag, see: https://caniuse.com/css-has)
* 0.0.5 (230817) - hide the new banner on the sidebar, same caveat as 0.0.4 re: the has selector
* 0.0.6 (231208) - hide new inline upsell in the tweet editor, needs has-selector just like 0.0.5 and 0.0.4
* 0.0.7 (231208) - hide For You tab banner, needs has-selector just like 0.0.6, 0.0.5 and 0.0.4
* 0.0.8 (231208) - Needs has-selector just like 0.0.6, 0.0.5 and 0.0.4. I don't know how long it takes Twitter engineers to add these, it takes about 15 sec for me to remove them ¯\_(🤷‍)_/¯
*/
(function() {
'use strict';
const style=document.createElement('style')
style.innerHTML="a[href='/i/twitter_blue_sign_up'],a[href='/i/twitter_blue_sign_up?referring_page=tweet_highlight_action_upsell'],a[data-testid='highlightUpsell'],a[aria-label='Verified'],a[href='/i/verified-choose'],a[href='/i/verified-orgs-signup'],div:has(> aside[aria-label='Get Verified']),div:has(> aside[aria-label='Subscribe to Premium']),div[aria-live='polite']:has(a[href='/i/premium_sign_up?referring_page=post-composer']),div[data-testid='cellInnerDiv']:has(img[src='https://ton.twimg.com/onboarding/subscriptions/no_ads_v4.png']),div[data-testid='cellInnerDiv']:has(a[href='/i/premium_sign_up?referring_page=timeline_prompt']){display:none;}"
document.head.appendChild(style)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment