From 38c1a9a5936ff54f06175ef8d36f5422471c430a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 15 Oct 2016 20:33:04 -0700 Subject: [PATCH] WIP --- ext/bg/js/ankiweb.js | 6 +++--- 1 file 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 {