diff options
| author | oweissbarth | 2014-07-23 09:46:07 +0200 |
|---|---|---|
| committer | oweissbarth | 2014-07-23 09:46:07 +0200 |
| commit | c89bd0fc5efb765166e6e7630c9c62cf917c6bda (patch) | |
| tree | e0f9e0a366eaa08c0362cf7db47659c0e2db6858 /www/static/js | |
| parent | cfc38d8cd1f5d7d1114fc1d4bd9124109b08ab49 (diff) | |
| download | files.iamfabulous.de-c89bd0fc5efb765166e6e7630c9c62cf917c6bda.tar.gz | |
Code Cleanup + Added filelist header
Diffstat (limited to 'www/static/js')
| -rw-r--r-- | www/static/js/browser.js | 13 | ||||
| -rw-r--r-- | www/static/js/dropzone.js | 84 |
2 files changed, 65 insertions, 32 deletions
diff --git a/www/static/js/browser.js b/www/static/js/browser.js index 4d201b3..355683c 100644 --- a/www/static/js/browser.js +++ b/www/static/js/browser.js @@ -1,22 +1,22 @@ function showNewFolder(){ - document.getElementById("new-folder-bg").style.visibility = "visible"; + document.getElementById("dialog-bg").style.visibility = "visible"; document.getElementById("new-folder-area").style.visibility = "visible"; return; } function hideNewFolder(){ - document.getElementById("new-folder-bg").style.visibility = "hidden"; + document.getElementById("dialog-bg").style.visibility = "hidden"; document.getElementById("new-folder-area").style.visibility = "hidden"; return; } function showUpload(){ - document.getElementById("upload-bg").style.visibility = "visible"; - document.getElementById("upload-area").style.visibility = "visible"; - return; + document.getElementById("dialog-bg").style.visibility = "visible"; + document.getElementById("upload-area").style.visibility = "visible"; + return; } function hideUpload(){ - document.getElementById("upload-bg").style.visibility = "hidden"; + document.getElementById("dialog-bg").style.visibility = "hidden"; document.getElementById("upload-area").style.visibility = "hidden"; //clean up @@ -67,5 +67,4 @@ function hideMenu() { function copyToClipboard(text){ window.clip.setText(text); - alert("done"); } diff --git a/www/static/js/dropzone.js b/www/static/js/dropzone.js index ba9b429..7accdc2 100644 --- a/www/static/js/dropzone.js +++ b/www/static/js/dropzone.js @@ -29,37 +29,71 @@ var vfs_upload_queue = []; break; } + var filelist = document.getElementById("filelist"); - var entry = document.createElement("tr"); - var filename = document.createElement("td"); - filename.appendChild(document.createTextNode(file.name)); + if(filelist.children.length==0){ + var entry = document.createElement("tr"); + var filenameCol = document.createElement("th"); + filenameCol.id="filename-head"; + filenameCol.appendChild(document.createTextNode("Name")); + + var filesizeCol = document.createElement("th"); + filesizeCol.id = "filesize-head"; + filesizeCol.appendChild(document.createTextNode("Size")); + + var publicCol = document.createElement("th"); + publicCol.id="public-head"; + var globeIcon = document.createElement("i"); + globeIcon.className="fa fa-globe"; + globeIcon.title="public"; + publicCol.appendChild(globeIcon); + + + var progressCol = document.createElement("th"); + progressCol.id="progress-head"; + progressCol.appendChild(document.createTextNode("Progress")); + + + entry.appendChild(filenameCol); + entry.appendChild(filesizeCol); + entry.appendChild(publicCol); + entry.appendChild(progressCol); + + filelist.appendChild(entry); + } + var entry = document.createElement("tr"); + var filename = document.createElement("td"); + filename.className="filenameCol"; + filename.appendChild(document.createTextNode(file.name)); - var filesize = document.createElement("td"); - filesize.appendChild(document.createTextNode(Math.floor(file.size/1024*100)/100+"KB")); - filesize.className = "filesize"; + var filesize = document.createElement("td"); + filesize.appendChild(document.createTextNode(Math.floor(file.size/1024*100)/100+"KB")); + filesize.className = "filesize"; - var progressBar = document.createElement("progress"); - progressBar.id="progressBar-"+file.name; - progressBar.className="progressBar"; - var progressCol = document.createElement("td"); - progressCol.className="progressCol"; - progressCol.appendChild(progressBar); + var progressBar = document.createElement("progress"); + progressBar.id="progressBar-"+file.name; + progressBar.className="progressBar"; + var progressCol = document.createElement("td"); + progressCol.className="progressCol"; + progressCol.appendChild(progressBar); - var publicCol = document.createElement("td"); - var public_at = document.createElement("input"); - public_at.type = "checkbox"; - public_at.id = "public-"+file.name; - publicCol.appendChild(public_at); + var publicCol = document.createElement("td"); + publicCol.className="publicCol"; + var public_at = document.createElement("input"); + public_at.type = "checkbox"; + public_at.id = "public-"+file.name; + public_at.title="public"; + publicCol.appendChild(public_at); - entry.appendChild(filename); - entry.appendChild(filesize); - entry.appendChild(publicCol); - entry.appendChild(progressCol); + entry.appendChild(filename); + entry.appendChild(filesize); + entry.appendChild(publicCol); + entry.appendChild(progressCol); - filelist.appendChild(entry); - vfs_upload_queue.push(file); - } + filelist.appendChild(entry); + vfs_upload_queue.push(file); + } } function upload(){ @@ -91,7 +125,7 @@ var vfs_upload_queue = []; xhr.upload.onprogress= function(e){ if(e.lengthComputable){ document.getElementById("progressBar-"+this.filename).value = Math.floor(e.loaded/e.total*100); - console.log(Math.floor(done/total*100)+"%"); + console.log(Math.floor(e.loaded/e.total*100)+"%"); }else{ alert("cant compute progress"); } |
