aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/settings/anki.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-02 14:53:32 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-02 14:53:32 -0500
commite8701cb950edd4c90f6c911e340db3af32194113 (patch)
treeebc8871883b0ee8893f84b5627d9e56e7433d427 /ext/bg/js/settings/anki.js
parentf23e0c9c95a7c0803694ea91b0ea55079e8f52d6 (diff)
Hide anki-invalid-response-error when there is no error
Diffstat (limited to 'ext/bg/js/settings/anki.js')
-rw-r--r--ext/bg/js/settings/anki.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/ext/bg/js/settings/anki.js b/ext/bg/js/settings/anki.js
index 3b0912d4..f55989fc 100644
--- a/ext/bg/js/settings/anki.js
+++ b/ext/bg/js/settings/anki.js
@@ -33,20 +33,27 @@ function _ankiSpinnerShow(show) {
function _ankiSetError(error) {
const node = document.querySelector('#anki-error');
- if (!node) { return; }
+ const node2 = document.querySelector('#anki-invalid-response-error');
if (error) {
const errorString = `${error}`;
- node.hidden = false;
- node.textContent = errorString;
- _ankiSetErrorData(node, error);
+ if (node !== null) {
+ node.hidden = false;
+ node.textContent = errorString;
+ _ankiSetErrorData(node, error);
+ }
- const node2 = document.querySelector('#anki-invalid-response-error');
if (node2 !== null) {
node2.hidden = (errorString.indexOf('Invalid response') < 0);
}
} else {
- node.hidden = true;
- node.textContent = '';
+ if (node !== null) {
+ node.hidden = true;
+ node.textContent = '';
+ }
+
+ if (node2 !== null) {
+ node2.hidden = true;
+ }
}
}