aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-10-15 20:33:04 -0700
committerAlex Yatskov <alex@foosoft.net>2016-10-15 20:33:04 -0700
commit38c1a9a5936ff54f06175ef8d36f5422471c430a (patch)
tree6d148ed5aa1509e0d3f8cea4ce357558ecd562f6 /ext
parent5057d6b6cff3bb9a176f3d96e64c878843dd443e (diff)
WIP
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/ankiweb.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/bg/js/ankiweb.js b/ext/bg/js/ankiweb.js
index 9abd9b86..9fc1fb57 100644
--- a/ext/bg/js/ankiweb.js
+++ b/ext/bg/js/ankiweb.js
@@ -78,13 +78,13 @@ class AnkiWeb {
const xhr = new XMLHttpRequest();
xhr.addEventListener('error', () => reject('failed to execute scrape request'));
xhr.addEventListener('load', () => {
- const modelsJson = JSON.parse(/editor\.models = (.*}]);/.exec(data)[1]);
+ const modelsJson = JSON.parse(/editor\.models = (.*}]);/.exec(xhr.responseText)[1]);
if (!modelsJson) {
reject('failed to scrape model data');
return;
}
- const decksJson = JSON.parse(/editor\.decks = (.*}});/.exec(data)[1]);
+ const decksJson = JSON.parse(/editor\.decks = (.*}});/.exec(xhr.responseText)[1]);
if (!decksJson) {
reject('failed to scrape deck data');
return;
@@ -112,7 +112,7 @@ class AnkiWeb {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
xhr.addEventListener('error', () => reject('failed to execute login request'));
- xhr.addEventListener('success', () => {
+ xhr.addEventListener('load', () => {
if (xhr.responseText.includes('class="mitem"')) {
resolve();
} else {