Skip to content

Instantly share code, notes, and snippets.

@lgessler
Created October 1, 2024 13:44
Show Gist options
  • Save lgessler/9ac1b7f6b557c510148094eb0df7c2b2 to your computer and use it in GitHub Desktop.
Save lgessler/9ac1b7f6b557c510148094eb0df7c2b2 to your computer and use it in GitHub Desktop.
Remove ImportantFilled Icons in Outlook
// ==UserScript==
// @name Remove ImportantFilled Icons in Outlook
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Removes all <i> elements with data-icon-name="ImportantFilled" from the DOM in Outlook
// @match https://outlook.office.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function removeImportantIcons() {
const icons = document.querySelectorAll('i[data-icon-name="ImportantFilled"]');
icons.forEach(icon => icon.remove());
}
// Run the function when the page loads
removeImportantIcons();
// Create a MutationObserver to handle dynamically added elements
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
removeImportantIcons();
}
});
});
// Start observing the document with the configured parameters
observer.observe(document.body, { childList: true, subtree: true });
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment