97b544362630d20fed278ef86339e31116702d81
1 // © 2013 Benoît Pin MINES ParisTech
6 DDFileUploader = function(dropbox
) {
7 this.dropbox
= dropbox
;
9 addListener(dropbox
, 'dragenter', function(evt
){thisDDFU
.dragenter(evt
);});
10 addListener(dropbox
, 'dragover', function(evt
){thisDDFU
.dragover(evt
);});
11 addListener(dropbox
, 'drop', function(evt
){thisDDFU
.drop(evt
);});
14 DDFileUploader
.prototype.dragenter = function(evt
) {
16 disablePropagation(evt
);
19 DDFileUploader
.prototype.dragover = function(evt
) {
21 disablePropagation(evt
);
22 evt
= getEventObject(evt
);
23 var dt
= evt
.dataTransfer
;
24 dt
.dropEffect
= 'copy';
28 DDFileUploader
.prototype.drop = function(evt
) {
30 disablePropagation(evt
);
32 var dt
= evt
.dataTransfer
;
33 dt
.dropEffect
= 'copy';
34 this.handleFiles(dt
.files
);
37 DDFileUploader
.prototype.handleFiles = function(files
) {
39 for (i
= 0; i
< files
.length
; i
++) {
41 console
.log(file
.type
);