Skip to content

Instantly share code, notes, and snippets.

@lumpenspace
Last active January 7, 2024 19:39
Show Gist options
  • Save lumpenspace/f8f25ce8c05d784b023279a029156762 to your computer and use it in GitHub Desktop.
Save lumpenspace/f8f25ce8c05d784b023279a029156762 to your computer and use it in GitHub Desktop.
tampermonkeys
// ==UserScript==// ==UserScript==
// @name Xitter unnagger
// @namespace https://lumpenspace.github.io
// @version 2024-01-07
// @description Removes premium+ nag and For You tab from twitter/x
// @author lumpenspace
// @match https://twitter.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant none
// ==/UserScript==
const observer = new MutationObserver (() => {
const premiumNag = document.querySelector('aside[aria-label="Subscribe to Premium"')
const horroTab = document.querySelector('main nav div[role=presentation] a[href="/home"] span')
.closest('a[href="/home"]')
.remove()
[premiumNag, horrorTab].forEach(el => el && el.parentElement.remove())
})
observer.observe(document, {subtree: true, attributes: true, attributeFilter: ['aria-label', "Subscribe to premium"], });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment