I'm trying to modify a message before it is displayed in the main window in Thunderbird. I can't seem to find 1) An event that will be triggered when a new message is opened/viewed 2) A way to modify the displayed contents of a message.
I believe I need the chrome://messenger/content/messenger.xul
overlay, and can use a listener such as:
window.addEventListener( "SOME MAGIC HERE", modify_message_handler, true );
But what that event is, I am unsure, along with what object I will get (a message header?) and how easily I can modify what is displayed.
So the questions are:
If what you want is something similar to a Greasemonkey script that would run on every message, you should:
load
event of the window
.document.getElementById("messagepane")
.DOMContentLoaded
event, or similar events like load
depending on when exactly you want your handler to be called. DOMContentLoaded
will give you a Greasemonkey-style behavior.event.originalTarget
is the document corresponding to the displayed message. You can apply all the usual DOM modification techniques here.For more details, see this example from the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With