【发布时间】:2010-12-08 22:41:49
【问题描述】:
我正在为 Mozilla Thunderbird 构建一个扩展,用于对消息进行一些翻译。我想添加一个翻译附件功能,尽管我在获取每个附件的内容时遇到了一些麻烦。目前,我正在连接attachmentListContext 弹出窗口,并且我有一些收集相关附件 URI 和 URL 的代码。如何访问每个相关附件的二进制数据?
获取所选附件的当前代码:
handleAttachmentTranslate : function() {
// see code in msgHeaderViewOverlay.js in Thunderbird source
var attachmentList = document.getElementById('attachmentList');
var selectedAttachments = new Array();
for (var i in attachmentList.selectedItems) {
var attachment = attachmentList.selectedItems[i].attachment;
// we can now access attachment.url or attachment.uri, etc
selectedAttachments.push(attachment.url);
// or (ideally)
// alert(this.translate(getData(attachment.url)))
// but what is getData()?
}
},
【问题讨论】:
标签: thunderbird