From 3d1617b2ded0cdffcbefd360772fee7d2c46fee1 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sat, 8 Nov 2014 15:00:00 +0100 Subject: [PATCH] Upload torrents on user command Don't upload the torrents as soon as they are selected. Also, adjust the HTML code to better place the upload button. --- src/webui/www/public/upload.html | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/webui/www/public/upload.html b/src/webui/www/public/upload.html index c9bc1218f..2b46abdba 100644 --- a/src/webui/www/public/upload.html +++ b/src/webui/www/public/upload.html @@ -36,32 +36,33 @@ function uploadFiles(files) { } } -// file selection -function fileSelectHandler(e) { +function fileHandler(e) { + e.preventDefault(); // fetch FileList object - var files = e.target.files || e.dataTransfer.files; + var files = $('fileselect').files // process all File objects uploadFiles(files); } window.addEvent('load', function() { - $('fileselect').addEvent('change', fileSelectHandler); - // is XHR2 available? + // is XHR2 available? var xhr = new XMLHttpRequest(); - if (xhr.upload) - $('submitbutton').addClass("invisible"); - else - $('upload_frame').addEvent('load', function(e) { window.parent.closeWindows(); }); + if (xhr.upload) { + $('uploadForm').addEvent('submit', fileHandler); + } else { + $('upload_frame').addEvent('load', function() { window.parent.closeWindows(); }); + } }); -
- -
-
-
- + + +
+ +
+
+