2010-12-08 37 views
0

我正在構建一個Mozilla Thunderbird的擴展,它可以對消息進行一些翻譯。我想添加翻譯附件功能,儘管我在查看每個附件的內容時遇到了一些問題。目前,我正在接入attachmentListContext彈出窗口,並且我有一些代碼收集相關的附件URI和URL。如何訪問每個相關附件的二進制數據?如何獲取Mozilla Thunderbird擴展中的附件內容?

當前代碼獲取所選的附件:

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()? 
    } 
}, 

回答

2

FiltaQuilla插件確實有保存附件等,它可能包含一些代碼,是相關的能力。

更新2011年4月25日:page posted by speedball2001已在3月25日和3月31日之間進行了修改。現在它有一個完整的示例。檢查出。它還指向完成附件操作的a real extension。這看起來是一個有希望的答案。

現在的想法是在必要時將此新演示代碼連接到FiltaQuilla。

+0

好的。我看着FiltaQuilla代碼,它不提取附件,因此它不相關。 – minghua 2011-03-25 06:18:11

相關問題