From f2b5d069c079bdeff50b8acd1ff3a75948a0f18b Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 11 Feb 2013 02:46:14 +0400 Subject: [PATCH] added uploading, still not working... Signed-off-by: Alex A. Naanou --- index.html | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index ed24360..877f736 100755 --- a/index.html +++ b/index.html @@ -761,6 +761,7 @@ $(document).ready(function(){

download magazine... +


@@ -1002,7 +1003,7 @@ $(document).ready(function(){ loadSettings() - // setup the link... + // setup download link... $('#downloader') .attr('href','data:text/octet-stream;base64,'+btoa( JSON.stringify(buildJSON(true, true)) @@ -1010,6 +1011,33 @@ $(document).ready(function(){ // entities with actual chars... .replace(/–/g, '–'))) + // upload... + function handleFileSelect(evt) { + var files = evt.target.files; // FileList object + + // Loop through the FileList and render image files as thumbnails. + for (var i = 0, f; f = files[i]; i++) { + + var reader = new FileReader(); + + // Closure to capture the file information. + reader.onload = (function(theFile) { + return function(e) { + console.log('loading...') + console.log($.parseJSON(e.target.result)) + loadJSON($.parseJSON(e.target.result), true) + console.log('done.') + }; + })(f); + + // Read in the image file as a data URL. + reader.readAsText(f); + } + } + + $('#upload').on('change', handleFileSelect); + +