【问题标题】:Thunderbird compose-send-message event does not fireThunderbird compose-send-message 事件不会触发
【发布时间】:2012-06-24 23:35:38
【问题描述】:

我已关注 the tutorial 进行 Thunderbird 扩展,并成功获得使用“加载”事件的扩展(基本的“日期”示例和使用 alert("hey"); 的随机文本都有效)。

但是,我似乎无法触发任何基于消息的事件。我尝试过使用各种类型的警报,但似乎我的代码没有被运行。例如:

function send_event_handler( evt ) {
  alert("hohoho");
}

window.addEventListener( "compose-send-message", send_event_handler, true );

如何触发允许我修改消息正文的事件?

我的测试平台使用的是 Thunderbird 13。

我的清单是:

content     thundersafe    chrome/content/
overlay chrome://messenger/content/messenger.xul chrome://thundersafe/content/thundersafe.xul

【问题讨论】:

  • 您要覆盖哪个 Thunderbird 窗口?换句话说 - 你能添加你的chrome.manifest 内容吗?

标签: javascript thunderbird thunderbird-addon


【解决方案1】:

感谢 WladimirPalant,我寻找其他叠加层。我没有想到这一点,因为我认为覆盖仅对通过 XUL 连接点调整 GUI 有用 - 显然我还有很多东西要学。

我使用的正确叠加层是:

chrome://messenger/content/messengercompose/messengercompose.xul

此叠加层是通过查看其他扩展程序发现的。我在 MDN 上的任何地方都找不到叠加层列表及其预期用途。

【讨论】:

  • 正确 - 您从覆盖加载脚本,因此它在您覆盖的窗口的上下文中运行。由于compose-send-message 事件在 Compose 窗口中触发,您显然需要覆盖 Compose 窗口(您找到了它的地址)。可以用DOM Inspector extension查看chrome windows的地址和结构。
  • 您能否提供有关您的文件的更多详细信息?我尝试做同样的事情,但没有成功
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-29
  • 2014-09-18
  • 1970-01-01
  • 2015-06-25
  • 2014-11-30
  • 2012-06-12
  • 1970-01-01
相关资源
最近更新 更多