新增加的FireFox Ubiquity指令:books、k+與en2zh

又增加幾個Ubiquity指令,能處理下列功能:

  • 博客來關鍵字搜尋,如:books 德川家康
  • Yahoo!知識+搜尋,如:k+ Twitter
  • 將目前網頁翻譯為中文,使用Google的翻譯功能將英文網頁翻譯為繁體中文,如:en2zh

 

下載資訊:

增加的程式碼:

  1. CmdUtils.CreateCommand({
  2. name: "books",
  3. author: { name: "emisjerry"},
  4. contributors: ["emisjerry"],
  5. license: "GPL",
  6. description: "博客來關鍵字搜尋",
  7. takes: {"要查詢的商品": noun_arb_text},
  8. icon: "http://www.books.com.tw/favicon.ico",
  9. execute: function(directObject) {
  10. Utils.openUrlInBrowser("http://search.books.com.tw/exep/prod_search.php?cat=all&key=" +
  11. encodeURIComponent(directObject.text));
  12. }
  13. });
  14.  
  15. CmdUtils.CreateCommand({
  16. name: "k+",
  17. author: { name: "emisjerry"},
  18. contributors: ["emisjerry"],
  19. license: "GPL",
  20. description: "Yahoo!知識+搜尋",
  21. takes: {"要搜尋的內容": noun_arb_text},
  22. icon: "http://www.books.com.tw/favicon.ico",
  23. execute: function(directObject) {
  24. Utils.openUrlInBrowser("http://tw.knowledge.yahoo.com/search/search_result?p=" +
  25. encodeURIComponent(directObject.text));
  26. }
  27. });
  28.  
  29. CmdUtils.CreateCommand({
  30. name: "en2zh",
  31. icon: "http://www.google.com/favicon.ico",
  32. description: "將目前網頁翻譯為中文",
  33. execute: function() {
  34. var word = context.focusedWindow.document.location;
  35. Utils.openUrlInBrowser( "http://translate.google.com/translate?sl=en&tl=zh-TW&hl=zh-TW&ie=UTF-8&u=" +
  36. escape(word) );
  37. },
  38. preview : function(obj){
  39. obj.innerHTML = "將目前網頁翻譯為中文";
  40. }
  41. });

您可能也會有興趣的類似文章

簡睿

服務於軟體業的資訊老兵。興趣廣泛,學習力佳,樂於分享所知所學。

您可能也會喜歡…

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *