From 92d0acfbe3cc6a695fb6488e53993df416810e87 Mon Sep 17 00:00:00 2001 From: Jeremy Schomery Date: Fri, 3 Feb 2017 12:47:26 +0330 Subject: [PATCH] fixes #11 --- backup/fileSaveLoad.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backup/fileSaveLoad.js b/backup/fileSaveLoad.js index 969ba8dc..8cf123c9 100644 --- a/backup/fileSaveLoad.js +++ b/backup/fileSaveLoad.js @@ -31,18 +31,16 @@ function loadFromFile(formatToFilter){ fileInput.initialValue = fileInput.value; fileInput.addEventListener('change', changeHandler); function changeHandler(){ - if (fileInput.value != fileInput.initialValue){ + if (fileInput.value !== fileInput.initialValue){ var fReader = new FileReader(); - fReader.readAsDataURL(fileInput.files[0]); - fReader.onloadend = function(event){ + fReader.onloadend = function (event){ fileInput.removeEventListener('change', changeHandler); fileInput.remove(); - var b64text = event.target.result.split(",")[1], - rawText = atob(b64text); - resolve(rawText); - } + resolve(event.target.result); + }; + fReader.readAsText(fileInput.files[0], 'utf-8') } } fileInput.click(); }); -} \ No newline at end of file +}