Note : In latest version of Anki, it may not work. So, move this from deck description to card template.
Future versions of Anki will block JS from the deck descriptions - the fact that it's currently allowed was just an oversight.
When new deck released then users have to check it manually for update for
that deck. But in this post learn to add update available option to your deck.
(For deck developer).
1. Add a version json file to your
deck. For example my deck “Write Kanji” has “version.json” file which contain
following info.
2. That file can be accessed using
CDN
https://cdn.jsdelivr.net/gh/your-username/project-name/file-name
Example for “Write Kanji” Deck:
https://cdn.jsdelivr.net/gh/infinyte7/Write-Kanji/Versions/version.json
3. Accessing that file in description
of deck.
The file can be accessed using XMLHttpRequest(). Copy the code below and change link and version according to your deck respectively.
4. Full HTML/CSS/JS
Note: Add @master or @latest in url so new file will be fetched when it get updated.
5. Finally popup will be shown if new version available. Like this.
Image
6. If deck version updated, then change the json file version at GitHub as
well as deckVersion inside deck description.
Demo
Note: A version should be present inside deck. It will compare with version in json file.
Comments
Post a Comment