Skip to content

Instantly share code, notes, and snippets.

@chrissearle
Created June 30, 2025 06:13
Show Gist options
  • Select an option

  • Save chrissearle/64f81594ee1007969cc1e3fc2c6293f0 to your computer and use it in GitHub Desktop.

Select an option

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
(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