From e36dab2aec0625243b7dc11184ba910369bc5710 Mon Sep 17 00:00:00 2001 From: wareya Date: Tue, 19 Dec 2017 16:19:53 -0500 Subject: [PATCH] fix non-affecting bug --- mining.js | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/mining.js b/mining.js index fd3afe1..eca65df 100644 --- a/mining.js +++ b/mining.js @@ -11,22 +11,23 @@ function reset() async function init_page() { let data = (await browser.storage.local.get("cards")).cards; - console.log(data); - let text = ""; - for(let card of data) + if(data) { - text += card.front.replace("\t", "\\t"); - text += "\t"; - text += card.readings.replace("\t", "\\t"); - text += "\t"; - text += card.definitions.replace("\t", "\\t"); - text += "\t"; - text += card.seq.replace("\t", "\\t"); - text += "\n"; + let text = ""; + for(let card of data) + { + text += card.front.replace("\t", "\\t"); + text += "\t"; + text += card.readings.replace("\t", "\\t"); + text += "\t"; + text += card.definitions.replace("\t", "\\t"); + text += "\t"; + text += card.seq.replace("\t", "\\t"); + text += "\n"; + } + let element = document.body.querySelector("#field"); + element.textContent = text; } - let element = document.body.querySelector("#field"); - element.textContent = text; - document.body.querySelector("#reset").addEventListener("click", reset); }