summaryrefslogtreecommitdiff
path: root/ext/bg/js/anki.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-14 22:42:11 -0500
committerGitHub <noreply@github.com>2021-01-14 22:42:11 -0500
commit1dcfbf6ba6516d05f756d26bf84049d94776ab14 (patch)
tree538a1a4346a4f98ba366949eda33b4e981e58766 /ext/bg/js/anki.js
parentd9f5d21d15a8239ecf349d254606be2c8fa70d31 (diff)
Support suspending new anki cards (#1240)
* Add new option: anki.suspendNewCards * Update Anki APIs * Suspend card based on options * Add setting * Disable wrap for toggle property
Diffstat (limited to 'ext/bg/js/anki.js')
-rw-r--r--ext/bg/js/anki.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/bg/js/anki.js b/ext/bg/js/anki.js
index 05c07ce2..68d9fc43 100644
--- a/ext/bg/js/anki.js
+++ b/ext/bg/js/anki.js
@@ -122,6 +122,22 @@ class AnkiConnect {
return await this._invoke('multi', {actions});
}
+ async suspendCards(cardIds) {
+ if (!this._enabled) { return false; }
+ await this._checkVersion();
+ return await this._invoke('suspend', {cards: cardIds});
+ }
+
+ async findCards(query) {
+ if (!this._enabled) { return []; }
+ await this._checkVersion();
+ return await this._invoke('findCards', {query});
+ }
+
+ async findCardsForNote(noteId) {
+ return await this.findCards(`nid:${noteId}`);
+ }
+
getRootDeckName(deckName) {
const index = deckName.indexOf('::');
return index >= 0 ? deckName.substring(0, index) : deckName;