aboutsummaryrefslogtreecommitdiff
path: root/ext/js/comm
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-02-24 21:54:58 -0500
committerGitHub <noreply@github.com>2021-02-24 21:54:58 -0500
commitae92e0b3781e27d54cbac2570ba2a1b8a6b11999 (patch)
treeb7d7a7171a6cbc25d5f1fc4b4996024c4f73033e /ext/js/comm
parent0a76de1b44443cc668882125d73d83d5f7ba8a63 (diff)
AnkiUtil (#1439)
* Add AnkiUtil * Update AnkiConnect to use AnkiUtil * Use AnkiUtil in AnkiNoteBuilder * Replace containsAnyMarker with AnkiUtil.stringContainsAnyFieldMarker * Add AnkiUtil.getFieldMarkers * Add fieldsObjectContainsMarker to AnkiUtil * Remove unused global * Remove unused parameter: enabled * Add cloneFieldMarkerPattern
Diffstat (limited to 'ext/js/comm')
-rw-r--r--ext/js/comm/anki.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/ext/js/comm/anki.js b/ext/js/comm/anki.js
index 251e0e0c..da234eff 100644
--- a/ext/js/comm/anki.js
+++ b/ext/js/comm/anki.js
@@ -15,6 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+/* global
+ * AnkiUtil
+ */
+
class AnkiConnect {
constructor() {
this._enabled = false;
@@ -113,7 +117,7 @@ class AnkiConnect {
query = `"deck:${this._escapeQuery(note.deckName)}" `;
break;
case 'deck-root':
- query = `"deck:${this._escapeQuery(this.getRootDeckName(note.deckName))}" `;
+ query = `"deck:${this._escapeQuery(AnkiUtil.getRootDeckName(note.deckName))}" `;
break;
}
query += this._fieldsToQuery(note.fields);
@@ -138,11 +142,6 @@ class AnkiConnect {
return await this.findCards(`nid:${noteId}`);
}
- getRootDeckName(deckName) {
- const index = deckName.indexOf('::');
- return index >= 0 ? deckName.substring(0, index) : deckName;
- }
-
// Private
async _checkVersion() {