forked from mozilla/chromeless
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More to the drag and drop folder infra. Some HTML5 drag stuff to supp…
…orting where user drag and rop file from OS to the this div.
- Loading branch information
Showing
3 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function onDrop(e) { | ||
e.stopPropagation(); | ||
e.preventDefault(); | ||
var dt = e.dataTransfer; | ||
var files = dt.files; | ||
var count = files.length; | ||
for (var i = 0; i < count; i++) { | ||
var types = dt.mozTypesAt(i); | ||
for (var t = 0; t < types.length; t++) { | ||
console.log("Checking all types, type = " + types[t]); | ||
if (types[t] == "application/x-moz-file") { | ||
try { | ||
var data = files[i]; | ||
console.log("(" + (typeof data) + ") : <" + data + " > " + data.fileName + " " + data.fileSize + "\n"); | ||
document.getElementById("droparea").innerHTML="<h2>The file name is: " + data.fileName+"</h2>"; | ||
} catch (i) { | ||
console.log("Something wrong"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
function onDragEnter(e) { | ||
|
||
} | ||
|
||
function onDragLeave(e) { | ||
console.log("Drag leave"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ function dragEnable() { | |
dragItems[i].addEventListener("dragend", handleDragEnd, true); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters