From 3847239d2c05035000da2c106d83f3065dd3b3a6 Mon Sep 17 00:00:00 2001 From: oweissbarth Date: Mon, 21 Jul 2014 16:25:51 +0200 Subject: Added legacy upload --- www/static/browser.css | 4 ++-- www/static/js/browser.js | 24 +++++++++++++++++++----- www/static/js/dropzone.js | 9 ++++++--- 3 files changed, 27 insertions(+), 10 deletions(-) (limited to 'www/static') diff --git a/www/static/browser.css b/www/static/browser.css index fa53a61..ed532d1 100644 --- a/www/static/browser.css +++ b/www/static/browser.css @@ -156,8 +156,8 @@ input.new-folder-input:focus{ visibility: hidden; } -#upload-form{ - +#legacy-file{ + display: none; } #upload-area{ diff --git a/www/static/js/browser.js b/www/static/js/browser.js index b32154b..4d201b3 100644 --- a/www/static/js/browser.js +++ b/www/static/js/browser.js @@ -20,15 +20,19 @@ function hideUpload(){ document.getElementById("upload-area").style.visibility = "hidden"; //clean up + cleanUploads(); + + location.reload(false); + + return; +} + +function cleanUploads(){ vfs_upload_queue = []; var list = document.getElementById("filelist"); while(list.firstChild){ list.removeChild(list.firstChild); } - - location.reload(false); - - return; } @@ -44,9 +48,19 @@ function showMenu(e) { //set context item commands document.getElementById("copy-link").setAttribute("url", url); - } + +function legacyUploadTrigger() { + document.getElementById("legacy-file").click(); +} + +function legacyUpload(){ + //cleanUploads(); + var files = document.getElementById("legacy-file").files; + addToUploadQueue(files); +} + function hideMenu() { document.getElementById("context-menu").style.display = "none"; } diff --git a/www/static/js/dropzone.js b/www/static/js/dropzone.js index bfc5c1a..f4e3399 100644 --- a/www/static/js/dropzone.js +++ b/www/static/js/dropzone.js @@ -14,7 +14,12 @@ var vfs_upload_queue = []; e.preventDefault(); var dropzone = document.getElementById("dropzone"); dropzone.style.backgroundColor = "white"; - for(file of e.dataTransfer.files){ + addToUploadQueue(e.dataTransfer.files); + + } + + function addToUploadQueue(files){ + for(file of files){ try { reader = new FileReader(); reader.readAsBinaryString(file); @@ -78,12 +83,10 @@ var vfs_upload_queue = []; xhr.onreadystatechange=function(){ if (xhr.readyState==4 && xhr.status==200){ - document.getElementById("upload-message").innerHTML = xhr.responseText; } }; xhr.upload.addEventListener("progress", function(e){ - document.getElementById("progressBar-"+this.filename).value = Math.ceil(e.loaded/e.total)*100; }); xhr.send(data); -- cgit v1.2.3