commit 82822fcfdbaf0e6faaa4d999c40505aed14f4c88
parent 25154bab0a34b577f3a20e52c98cdfcb03acb20b
Author: Commit-Bot <unknown>
Date: Tue, 10 Aug 2010 07:50:02 +0000
Automatic commit from picoLisp.tgz, From: Tue, 10 Aug 2010 07:50:02 GMT
Diffstat:
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/lib/form.js b/lib/form.js
@@ -1,4 +1,4 @@
-/* 09aug10abu
+/* 10aug10abu
* (c) Software Lab. Alexander Burger
*/
@@ -8,12 +8,14 @@ var HintReq = false;
try {
FormReq = new XMLHttpRequest();
HintReq = new XMLHttpRequest();
+ FormReq.upload.addEventListener("progress", dropProgress, false);
+ FormReq.upload.addEventListener("load", dropLoad, false);
}
catch (e) {}
var Queue = new Array();
var Btn = new Array();
-var Key, InBtn, Auto;
+var Key, InBtn, Auto, Drop;
function inBtn(flg) {InBtn = flg;}
@@ -40,10 +42,21 @@ function doDrag(event) {
function doDrop(btn, event) {
doDrag(event);
- Btn.push(btn);
+ Btn.push(Drop = btn);
+ btn.value = "0 %";
post(btn.form, event.dataTransfer.files[0]);
}
+function dropProgress(event) {
+ if (Drop)
+ Drop.value = event.lengthComputable?
+ Math.round((event.loaded * 100) / event.total) + " %" : "(?) %";
+}
+
+function dropLoad(event) {
+ Drop = null;
+}
+
/*** Form submit ***/
function doPost(form) {
for (var i = 0; ; ++i) {