summaryrefslogtreecommitdiff
path: root/www/static/js
diff options
context:
space:
mode:
authoroweissbarth2014-07-21 16:25:51 +0200
committeroweissbarth2014-07-21 16:25:51 +0200
commit3847239d2c05035000da2c106d83f3065dd3b3a6 (patch)
tree3e2684bf8f26da1fae32a68323d7963021aff07a /www/static/js
parent0097ccaf345cbc423df415322357e1f574e19140 (diff)
downloadfiles.iamfabulous.de-3847239d2c05035000da2c106d83f3065dd3b3a6.tar.gz
Added legacy upload
Diffstat (limited to 'www/static/js')
-rw-r--r--www/static/js/browser.js24
-rw-r--r--www/static/js/dropzone.js9
2 files changed, 25 insertions, 8 deletions
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);