Possible to use Greasemonkey in Mail?

User Help for Seamonkey and Mozilla Suite
Post Reply
Lef
Posts: 20
Joined: January 3rd, 2022, 10:50 am

Possible to use Greasemonkey in Mail?

Post by Lef »

I use Greasemonkey to replace text in webpages. I'd like to do the same in Mail, you know for something like for my RSS feeds:
https://xkcd.com/1288/
However while it works just fine in webpages it does not in Mail.

Is it possible to do what I want to do, with Greasemonkey or another way?
morat
Posts: 6394
Joined: February 3rd, 2009, 6:29 pm

Re: Possible to use Greasemonkey in Mail?

Post by morat »

I could use the userChromeJS addon to replace message text in Thunderbird. Maybe you could do something similar in SeaMonkey.

Code: Select all

/* Thunderbird userChrome.js */

(function () {
  if (location == "chrome://messenger/content/messenger.xul" ||
      location == "chrome://messenger/content/messenger.xhtml") {
    setTimeout(function () {
      try {
        var browser = document.getElementById("messagepane");
        browser.addEventListener("load", function () {
          var message = gFolderDisplay.selectedMessage;
          if (message) {
            var body = content.document.body;
            body.innerHTML = body.innerHTML.replace(/Hello/g, "XXX");
          }
        }, true);
      } catch (e) {
        Components.utils.reportError(e);
      };
    }, 1000);
  }
})();
userChromeJS by jikamens
http://addons.thunderbird.net/thunderbird/addon/986610

Instructions:

* install userChromeJS extension
* close email client
* create or edit the userChrome.js file in the chrome folder
* open email client

I can run userChrome.js using the autoconfig feature, but it's more complicated than using the addon.
Post Reply