Firefox 瀏覽器附加元件
  • 擴充套件
  • 佈景主題
    • 用於 Firefox
    • 字典與語言套件
    • 其他瀏覽器網站
    • Android 版的附加元件
登入
Look up dictionary by using dict:/// 預覽

Look up dictionary by using dict:/// 作者: Harpseal

Call any dictionary app by using Uri scheme.

3.8 (9 reviews)3.8 (9 reviews)
149 Users149 Users
必須使用 Firefox 才能使用此擴充套件
下載 Firefox 並安裝擴充套件
下載檔案

擴充套件後設資料

畫面擷圖
Right click on the text and the 'Look up "Some Keyword" in Dictionary' will appear in the context menu right away.If the "Launch Application" doesn't open automatically, please check the how-to-use to resolve this issue.
關於此擴充套件
Kindly reminded if your OS is not macOS, this addon can't work without a wrapper script to call the external dictionary software for safety reasons. The following guide require a little programming skills. Please check How-to-use for detail.

This addon is forked from another Firefox addon https://addons.mozilla.org/en-US/firefox/addon/mactionary

For more detailed description with pictures, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme


Update for firefox 84+ users

There is a new permission dialog to approve after firefox 84+.
Please open the Options page of this addon, check the checkbox, press the save button and try to look up some word. The temporary tab for dict scheme will not be closed and leave the permission dialog for user to approve.
After the permission is approved, please uncheck this checkbox in the Option page for normal use.
For more detail pleace check the How-to-use step4.


* How-to-use

When user right-click on any word on any website, the "Look up in dictionary" will appear in the context menu right away. Please select it, and this addon will send the clicked text or selected texts to the dictionary software which supports dict Uri scheme. (ex. dict:///keyword)

The dict:/// Uri scheme is supported by the build-in dictionary software in macOS. If your OS is Windows or Linux, please take the following steps:

  1. Prepare the "wrapper script" before installing this addon. (require programming skills)

  2. Prepare the "wrapper script" before installing this addon, because this script is the connection to the outside of the Firefox. There are some example scripts written in Python (for Linux users) and Autohotkey (for Windows users) in the end of this guide, and one more Copy/Paste Autohotkey example in the this addon's github page. The example scripts still need some customization. Please trace the scripts and customize for your system.

    Python installed by default on Linux. If your OS is Windows, Autohotkey is recommended. Because Firefox only support to call EXE application on windows, you need to compiler the ahk script to EXE by using the Autohotkey compiler. Please download Autohotkey .zip from its website (https://autohotkey.com/download/) and unzip it, the compiler named Ahk2Exe.exe is in the "Complier" folder.

    Before taking the next step, you should check the script is work properly. To test the script, you can execute in the terminal with with uri scheme as the only one parameter. Make sure the dictionary is showed with the word after the dict:/// correctly ("test" for example). ex:
    C:\Tools> look_up_dict.exe dict:///test
  3. Add dict:/// Uri scheme handler
  4. After some version of Firefox 57+, Firefox ignores all unknown URI scheme (ex.dict:/// on Win/Linux) and doesn't show the "Launch Application" window as before, so we have to add it by ourselves. In order to know how to deal with different types of files and URI schemes, Firefox have a internal list to save the action for each content type. The list is showed in Options->Applications. Unfortunately, even if user can change the actions in Options, Firefox doesn't support add or remove file types. We have to edit the list manually. Please take the following steps:

    2.1. Open your Firefox profile folder
    Click the firefox menu button, click Help and select Troubleshooting Information. The Troubleshooting Information tab will open.
    Under the Application Basics section, click on Open Folder. Your profile folder will open.

    2.2. Close firefox

    2.3. Edit "handlers.json"
    Please copy a backup before editing.
    Add "dict":{"action":4,"ask":true} in the end of json. Please check there are only three } in the end of file. ex.
    ...,"itmss":{"action":4,"ask":true},"gameon":{"action":4,"ask":true},"dict":{"action":4,"ask":true}}}[End-of-file]
  5. Install this addon.

  6. After installation, your can try to right click on any text, the "Look up in dictionary" will appear in the context menu. If this is the first time you try to use this addon, a window named "Launch Application" (showed as the second screenshot) should open, please choose the script/exe which you make in the first step.

    If the "Launch Application" is not showed (firefox's rule is changed again...), please open the firefox's Options and scroll down to "Applications" section (or search). The dict is should in the list with question mark. Open the dropdown menu and click Use other... to select your wrapper script.
  7. Approve permission to run the wrapper script.
  8. (only for firefox 84+)

    Look up a keyword at the first time, the temporary tab for dict scheme will not be closed and leave the permission dialog for user to approve which is a new feature after firefox 84+.

    If no temporary tab are shown and the wrapper script is not triggered, please open the Options page of this addon and check the checkbox to keep the temporary tab open.

    After approving the permission, please uncheck the checkbox and click the save buttom in the Option page of this addon for normal use.


    Kindly reminded that all add-ons will be disable in mozilla's add-ons website (https://addons.mozilla.org) and please try this addon on the other website after the installation is completed.


For more wrapper script examples, please check the github repo of this addon. https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme


* Linux (python + GoldenDict)
Please replace the fullwidth space to halfwidth space before using the following python code.
#!/usr/bin/python
import sys
import urllib
from subprocess import call

if len(sys.argv)>=2:
 text = sys.argv[1]
 if text.startswith("dict:///"):
  text = urllib.unquote(urllib.unquote(text[8:]))
 call(["/usr/bin/goldendict",text])

* Windows (Autohotkey + GoldenDict)
dict_path := "C:\Software\GoldenDict\GoldenDict.exe"
uriDecode(Str)
{
Static doc := ComObjCreate("HTMLfile")
Try
{
doc.write("<body><script>document.body.innerText = decodeURIComponent(""" . Str . """);</script>")
Return, doc.body.innerText, doc.body.innerText := ""
}
}

if %0% < 1 ; The left side of a non-expression if-statement is always the name of a variable.
{
ExitApp
}

Loop, 1 ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.

StringLeft, url_scheme, param, 8
if (url_scheme = "dict:///")
param := SubStr(param, 9)

param := uriDecode(param)
Run %dict_path% %param%
}
開發者留言
This addon is forked from another firefox addon https://addons.mozilla.org/en-US/firefox/addon/mactionary

The github repository of this addon:
https://github.com/Harpseal/LookUp-Dictionary-By-dict-URI-Scheme
由 1 位評論者給出 3.8 分
登入後即可幫此擴充套件評分
目前沒有評分

已儲存星等

5
6
4
0
3
0
2
1
1
2
閱讀全部 9 條評論
權限與資料了解更多

必要權限:

  • 存取您所有網站中的資料
更多資訊
附加元件網址
  • 首頁
  • 技術支援網站
  • 技術支援信箱
版本
0.6.3
大小
42.5 KB
最近更新
3 年前 (2022年9月25日)
相關分類
  • 搜尋工具
  • 語言支援
  • 其它
授權條款
MIT License
版本紀錄
  • 瀏覽所有版本
新增至收藏集
檢舉此附加元件
0.6.3 版的發行公告
Fix bug to detect the current browser.
Harpseal 製作的更多擴充套件
  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

  • 目前沒有評分

前往 Mozilla 官網

附加元件

  • 關於
  • Firefox 附加元件部落格
  • 擴充套件工作坊
  • 開發者交流中心
  • 開發者政策
  • 社群部落格
  • 討論區
  • 回報 Bug
  • 評論撰寫指南

瀏覽器

  • Desktop
  • Mobile
  • Enterprise

產品

  • Browsers
  • VPN
  • Relay
  • Monitor
  • Pocket
  • Bluesky (@firefox.com)
  • Instagram (Firefox)
  • YouTube (firefoxchannel)
  • 隱私權
  • Cookie
  • 法律資訊

除另有註明外,本站內容皆採用創用 CC 姓名標示—相同方式分享條款 3.0 或更新版本授權大眾使用。