Add a button on translation websites to create an Anki card from a translation.
/hooks/wordreference_com_hook.user.js
/hooks/reverso_net_hook.user.js
/hooks/translate_google_com_hook.user.js
1- Install a userscript add-on for your favorite browser:
- Chrome: install Tampermonkey.
- Firefox: install Tampermonkey or Greasemonkey.
- Safari: install Tampermonkey.
- Other browsers: Check Tampermonkey Website.
This extension allows the browser to run the AnkiAddHooks userscripts.
2- Click on some of the links to install the Hook User Scripts on the websites of your choice:
- Install Anki Add Hooks on translate.google.com
- Install Anki Add Hooks on wordreference.com
- Install Anki Add Hooks on reverso.net
- Install Anki Add Hooks on lingea.cz
3- Install Anki Desktop and synchronize your Anki account.
4- Install the AnkiConnect add-on for Anki Desktop, then restart Anki Desktop.
1- Anki's Add Button will appear on the translation pages for the websites you installed.
2- Anki Desktop must be running on your computer when you click on a hook.
3- File an issue for any unexpected behavior.
The most convenient way to develop a new tampermonkey script is to install a userscript (that never changes) which @require
s a local file on your computer. That local file will be recompiled everytime your source file is modified. Thus you don't need to manually recompile and reinstall your userscript everytime you change a thing. The following steps describe how to set up that environment.
1- Rename src/hooks/my_website_com.js
and fix inside all the metatags and the exported members.
2- Run npm install
to install dependencies.
3- Run npm run dev-build
to create two files:
dev-hooks/my_website_com_dev_hook.user.js
dev-hooks/my_website_com_dev_hook_required.js
4- Make sure Tampermonkey extension is allowed to access local files from your computer:
1- Go to `chrome://extensions` with Chrome.
2- Find `Tampermonkey` and click `Details`.
3- Find the `Allow access to file URLs` setting and turn it on.
You need this so that my_website_com_dev_hook.user.js
is allowed to require local file my_website_com_dev_hook_required.js
.
5- Install dev-hooks/my_website_com_dev_hook.user.js
in Tampermonkey.
6- Now when you modify and save src/hooks/my_website_com.js
, you just need to reload your website to see the result of your modifications, without having to reinstall your script everytime!
7- When you are happy with your script, run npm run build
to compile it to the final standalone userscript hooks/my_website_com_hook.user.js
.
8- Make a pull-request if you think it can be useful for other people.