2010-08-24 27 views
0

我要尋找一個Firefox擴展的解決方案,以攔截Firefox的字典行動:Firefox擴展插件攔截字典行動「加字字典」

當用戶選擇的動作「加字字典」我要修改在將其插入用戶的向下詞典文件persdict.dat之前的單詞。

這可能嗎?如何做呢? 在爲這個特殊用例編寫我自己的擴展時,有什麼特別的東西需要照顧?

回答

0

我找到了自己的問題的答案。覆蓋firefox spellchecker的InlineSpellCheckerUI.addToDictionary功能完成了這項工作。這是我的擴展名爲xul的文件:

<?xml version="1.0"?> 

<overlay id="spellcheck-dehyphenation" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 

    <script type="text/javascript"> 
     InlineSpellCheckerUI.addToDictionary = function() 
     { 
       this.mMisspelling = this.mMisspelling.replace(/\u00ad/g,''); 
       this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling); 
     }; 
    </script> 

</overlay>