Intercept the reply event

Talk about add-ons and extension development.
Post Reply
ikabod
Posts: 2
Joined: February 8th, 2024, 12:57 pm

Intercept the reply event

Post by ikabod »

Hello,

I try to react in the background.js file when the user clicks on the "Reply"-Button.

I found some old code, but I guess it is very outdated since it does nothing:

Code: Select all

window.addEventListener("compose-window-init", myReplyHandler, true);

function myReplyHandler(event){
    console.log(event);
}
Does someone have a working code example?

Thanks,
Peter
morat
Posts: 6370
Joined: February 3rd, 2009, 6:29 pm

Re: Intercept the reply event

Post by morat »

Try something like:

Code: Select all

Services.obs.addObserver(function (aSubject, aTopic, aData) {
  console.log("subject: " + aSubject);
  console.log("topic: " + aTopic);
  console.log("data: " + aData);
  console.log("uri: " + aSubject.document.documentURI); // about:blank
  if (aTopic == "domwindowopened") {
    var chromeWindow = aSubject;
    chromeWindow.addEventListener("load", function (aEvent) {
      var doc = aEvent.target;
      var url = doc.location.href;
      if (url == "chrome://messenger/content/messengercompose/messengercompose.xhtml") {
        chromeWindow.addEventListener("compose-window-init", function (aEvent) {
          console.log(aEvent);
        }, true);
      }
    }, false);
  }
}, "chrome-document-global-created", false);
Observer Notifications
http://web.archive.org/web/201910060345 ... ifications

Reference
http://searchfox.org/comm-esr115/search ... &case=true
http://searchfox.org/comm-esr115/search ... &case=true
http://searchfox.org/comm-esr115/search ... &case=true

If you are creating an addon, then it would be best to ask questions in the topicbox forum.

Thunderbird Topicbox - Addon Developers (official forum)
http://thunderbird.topicbox.com/groups/addons
ikabod
Posts: 2
Joined: February 8th, 2024, 12:57 pm

Re: Intercept the reply event

Post by ikabod »

Thank you to point me to the correct forum.

If somebody is interested in the solution:

https://thunderbird.topicbox.com/groups ... rd-message
Post Reply