Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ninja33/anki-bookmarklet
An simple anki dict helper bookmarklet
https://github.com/ninja33/anki-bookmarklet
anki bookmarklet learning-english
Last synced: 11 days ago
JSON representation
An simple anki dict helper bookmarklet
- Host: GitHub
- URL: https://github.com/ninja33/anki-bookmarklet
- Owner: ninja33
- Created: 2018-01-10T07:58:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-14T14:10:50.000Z (almost 7 years ago)
- Last Synced: 2024-11-29T10:29:46.470Z (2 months ago)
- Topics: anki, bookmarklet, learning-english
- Language: JavaScript
- Homepage:
- Size: 104 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Translation Bookmarklet for Ankiconnect/Ankimobile
It's a simple client side javascript(bookmarklet) to help language learner translate word and make anki note while reading web page.
## Usage
1. Save a bookmark for your browser. Next, edit this bookmark, copy and paste below source to bookmark's `url` field, and then save.
2. Click this bookmarklet while browsing web. After loading, a green light LED will keep flashing at right/bottom of the bowser which means `ready`.
3. Select web page text by dragging or double clicking mouse left button. It will popup a window to display 3 fields as below:
- Selected Text (Word)
- Translated Text (Definition)
- Context(Sentence)
4. Click green "plus" icon top/right of the window. Based on below option, it will add a note to anki deskptop client through ankiconnect addon.## Bookmarklet Source to be Copied
```javascript
javascript:(function () { _bklOptions = { deck: "Antimoon", type: "Antimoon", word: "expression", defs: "glossary", sent: "sentence", base: "https://rawgit.com/ninja33/anki-bookmarklet/master/", }; if (window.showIndicator !== undefined) { showIndicator(_bklOptions); } else { var s = document.createElement("script"); s.type = "text/javascript"; s.src = "https://cdn.rawgit.com/muicss/loadjs/3.5.2/dist/loadjs.min.js"; s.onload = function () { let libs = [ "main.css", "lib/jsonp.js", "lib/md5.js", "popup.js", "util.js", "youdao.js", "translator.js", "ankiconnect.js", "ankimobile.js", "main.js" ]; libs = libs.map((x) => _bklOptions.base + x); loadjs(libs, () => { window.ankibookmarklet = new Ankibookmarklet(); showIndicator(_bklOptions); }); }; document.body.appendChild(s); } })()
```## Options
Because it's bookmarklet, so basically, it's client side script which can not store any information in cookies(cross-domain) or browser local storage.
So, all options must be hardcode and passed by above bookmarklet code itself.### Anki options
If you want to use this bookmarklet to make note by using ankiconnect, you may change below option in above source of variable `bklOptions` to match your anki deck/type/fields
- deck:"Antimoon"; //define anki deck name
- type:"Antimoon"; //define anki note type name
- word:"expression"; //define word field of above note type
- defs:"glossary"; //define definition field of above note type
- sent:"sentence"; //define sentence field of above note type## Customization
This bookmark is written by javascript and the source actually is stored on Github and loaded as git raw data. That means you can fork or clone this repository, then change above bookmarklet source to point to your new Github repository, and do whatever change you want(e.g change part of translation script for other new language learning purpose), .
### Git options
you may change below option in above source of variable `abkl_options` to match your git user name and repository. It will be used to make script/css/images base url
- base: "https://rawgit.com/{user}/{repo}/{branch}/"; //replace `{user}`, `{repo}`, `{branch}` to your git username, repository and branch name.