1 function dragenter(evt
) {
3 disablePropagation(evt
);
6 function dragover(evt
) {
8 disablePropagation(evt
);
9 evt
= getEventObject(evt
);
10 var dt
= evt
.dataTransfer
;
11 dt
.dropEffect
= 'copy';
17 disablePropagation(evt
);
19 var dt
= evt
.dataTransfer
;
20 dt
.dropEffect
= 'copy';
21 handleFiles(dt
.files
);
24 function handleFiles(files
) {
25 for (var i
= 0; i
< files
.length
; i
++) {
27 console
.log(file
.type
);
29 // var imageType = /image.*/;
31 // if (!file.type.match(imageType)) {
35 // var img = document.createElement("img");
36 // img.classList.add("obj");
38 // preview.appendChild(img);
40 // var reader = new FileReader();
41 // reader.onload = (function(aImg) { return function(e) { aImg.src = e.target.result; }; })(img);
42 // reader.readAsDataURL(file);
47 var dropbox
= document
.getElementById('dropbox');
48 addListener(dropbox
, 'dragenter', dragenter
);
49 addListener(dropbox
, 'dragover', dragover
);
50 addListener(dropbox
, 'drop', drop
);
54 addListener(window
, 'load', init
);