Created
June 30, 2025 06:13
-
-
Save chrissearle/64f81594ee1007969cc1e3fc2c6293f0 to your computer and use it in GitHub Desktop.
Userscript to hide the "Upgrade" button on gmail (workspace) - hides anything with a given CSS class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| 'use strict'; | |
| const classToHide = 'I6agWe'; // change this as needed | |
| function hideElements() { | |
| const elements = document.querySelectorAll(`.${classToHide}`); | |
| elements.forEach((el, i) => { | |
| el.style.display = 'none'; | |
| }); | |
| } | |
| function init() { | |
| hideElements(); | |
| const observer = new MutationObserver((mutationsList) => { | |
| hideElements(); | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true, | |
| }); | |
| } | |
| if (document.readyState === 'loading') { | |
| document.addEventListener('DOMContentLoaded', init); | |
| } else { | |
| init(); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment