Skip to main content
Home About Privacy Contact

Add update available option to Anki Deck (For deck developer)


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

Popular posts from this blog

Sentence Adder Anki Addon: Add sentence in Anki editor in one click

Add sentences to Anki editor window in one click with batch adder option Select a word in edit field and click add button to add sentences to that fields matching the words. Also create/add sentences for any languages. The sentences database created using tatoeba language tsv files. Download language tsv file from tatoeba . Install Download addon from AnkiWeb  Sentence Adder Anki Addon Download from GitHub release page  Sentence Adder Anki Addon Features Create new language database Add random sentence in one click View list of all sentences matching the selected word Change language (Require restart of Anki to apply changes) Change color of sentences Batch sentences adder Sentences containing spaces Usage Install 1. Install Addon from AnkiWeb Anki -> Tools -> Add-ons -> Get Add-ons... Paste the code 1682655437 and install. 2. Restart Anki and open the Addon to add new languages. 3. Download language of ch...

Anki JS API addon for getting decks and cards info like AnkiDroid JS API

AnkiDroid JavaScript API allow deck developer to add functionality to cards that can call native functions defined in AnkiDroid. This can be used to design whole new layout for buttons, cards info, top bar card counts, mark, flag etc. But Anki Desktop there are no official support like this JS API.  So, this is Anki addon for supporting the AnkiDroid-JS-API . Download AnkiJS API Addon View Source Code Usages To know more about the options view  AnkiDroid-JS-API .  New Count pycmd("AnkiJS.ankiGetNewCardCount()", (ret) => { console.log(ret); }); Learn Count pycmd("AnkiJS.ankiGetLrnCardCount()", (ret) => { console.log(ret); }); Review Count pycmd("AnkiJS.ankiGetRevCardCount()", (ret) => { console.log(ret); }); Mark pycmd("AnkiJS.ankiGetCardMark()", (ret) => { console.log(ret); }); Flag pycmd("AnkiJS.ankiGetCardFlag()", (ret) => { console.log(ret); }); Card Id pycmd("AnkiJS.ankiGe...

Create language database with translation using Google Sheets

In Chinese vocabulary Generator Anki Addon , I used python module to translate example sentences but it increases the time for list generation. So, in this post I will explain how to create database with translation using Google sheets. This will help in creating flashcards offline with sentences and translation. Also it can be used in Anki addon development for language learning. I will take example of creating Chinese language database. 1. Download the sentences database from tatoeba 2. Open it with Google sheets 3. Use Google Translate function to translate all the sentences.  = GOOGLETRANSLATE ( C1 , "zh" , "en" ) 4. Select first cell then click   CTRL + SHIFT + down arrow, after that  click  CTRL + D to copy formula to all cell in that column. 5. Wait for sometime to complete the translations 6. Download the sheets as TSV files 7. Use this python script to create sqlite db file from tsv file. Note: Change the fields and table ...