I wanted something better than wrapping fields in href tags.
This addon adds quick lookup actions to any field in your templates. Click a word, and the addon opens a configured URL with that word as the query.
I use this to quickly look up Japanese examples on YouGlish and similar sites, but anything works, as long as the target site accepts a URL query.
Setup
Add a data-lookup attribute to any element in your template:
<span data-lookup>ζ’η΄’</span>
<!-- Use a different field as the query -->
<span data-lookup={{differentField}}>ζ’η΄’</span>
<!-- Force a specific lookup target -->
<span data-lookup data-target="youglish">ζ’η΄’</span>
A click opens the configured URL, with the field value inserted as the query string (for example, https://jpdb.io/search?q={query}).
Config
Links and keys are configurable in config.json, available via Anki GUI.
"massif": {
"label": "Massif",
"url": "https://massif.la/ja/search?q={query}"
},
"youglish": {
"label": "YouGlish",
"url": "https://youglish.com/pronounce/{query}/japanese"
},
...
"click": {
"default": "massif",
"shift": "youglish",
"alt": "__all__"
}
Features
- Multiple lookup methods. Configure several lookup targets (dictionaries, search engines, example-sentence sites, and so on).
- Custom URLs. Specify the lookup URL for each target. The addon works with any site that accepts a query string.
- One tag per element. A single data-lookup attribute is all a template needs.
- Modifier-key targets. Assign different lookup targets to Alt-click, Shift-click, and plain click, or open all targets at once with one click.